unTable.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <view class="warp_">
  3. <view class="box">
  4. <t-table @change="change" v-for="(items,index) in scoresList" :key="index">
  5. <t-tr>
  6. <t-th v-for="(itemTitle,i) in items.colNames" :key="i" style="width: 100%;">{{itemTitle}}</t-th>
  7. </t-tr>
  8. <t-tr v-for="(c,p) in testResult == 2 ?items.newTableContext.result : items.tableContext" :key="p">
  9. <t-td>{{c.name != undefined?c.name:'总分'}}</t-td>
  10. <t-td
  11. v-if="(c.name != undefined) && (c.percent == undefined)">{{testResult == 2?c.score:c.value[0]}}</t-td>
  12. <t-td v-if="(c.name != undefined) && (c.percent != undefined)"><progress-plus style="width: 100%"
  13. :color="colors[p%6]" :percent="c.percent" :score="c.score" /></t-td>
  14. </t-tr>
  15. <!-- <t-tr v-if='items.newTableContext.result.length==0 &&testResult == 2'>
  16. <t-td>总分</t-td>
  17. <t-td>0.00</t-td>
  18. </t-tr> -->
  19. </t-table>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. // https://ext.dcloud.net.cn/plugin?id=413
  25. import tTable from '@/components/t-table/t-table.vue';
  26. import tTh from '@/components/t-table/t-th.vue';
  27. import tTr from '@/components/t-table/t-tr.vue';
  28. import tTd from '@/components/t-table/t-td.vue';
  29. import ProgressPlus from '@/components/ProgressPlus/ProgressPlus.vue'
  30. export default {
  31. props: ['scoresList', 'testResult'],
  32. components: {
  33. tTable,
  34. tTh,
  35. tTr,
  36. tTd,
  37. ProgressPlus
  38. },
  39. data() {
  40. return {
  41. colors: [
  42. '#1C82F3',
  43. '#21C9CF',
  44. '#ECB84F',
  45. '#EC6F4F',
  46. '#CF63D6',
  47. '#4F5FEC'
  48. ]
  49. };
  50. },
  51. methods: {
  52. change(e) {
  53. console.log(e.detail);
  54. }
  55. }
  56. };
  57. </script>
  58. <style scoped>
  59. .warp_ {
  60. /* width: 94%; */
  61. width: 100%;
  62. margin: 0 auto;
  63. }
  64. </style>