classroom_item.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="u-flex-column">
  3. <!-- 日期 -->
  4. <view v-if="data.isSection" class="flex margin-sm align-center">
  5. <text class="lg text-red cuIcon-round"></text>
  6. <text class="margin-lr-sm text-lg text-bold"> {{ data.date }} </text>
  7. </view>
  8. <!-- 时间线 -->
  9. <view class="u-flex-column">
  10. <!-- 左侧时间线与图标 -->
  11. <view class="cu-timeline bg-normal">
  12. <view class="cu-item cuIcon-title bg-normal">
  13. <view class="flex align-center bg-normal">
  14. <text class="text-black text-bold"> {{ startTime + ' - ' + endTime }} </text>
  15. </view>
  16. <!-- 课程信息 -->
  17. <view class="lesson-item u-flex-column bg-white" :style="{ 'border-left': '5px solid ' + mainColor }">
  18. <!-- 课程状态 -->
  19. <view class="flex justify-between margin-sm">
  20. <view class="text-center round padding-lr-sm u-border-bottom" :style="{ 'background-color': mainColor }">
  21. <text class="text-red text-xs" v-if="!data.if_feedback"> {{ $t('feedback') }} </text>
  22. </view>
  23. <view class="lesson-status text-xs flex align-center" @click="classStatusDidClick">
  24. <view class="cuIcon-form sm"></view>
  25. <text> {{ data.if_feedback ? $t('Completed') : $t('Uncompleted') }} </text>
  26. </view>
  27. </view>
  28. <view class="margin-sm" @click="lessonItemOnTap">
  29. <view class="bg-gray" style="height: 1px;" />
  30. <view class="flex justify-between align-center">
  31. <text class="margin-xs">{{ data.class_number || '-' }}</text>
  32. <text class="margin-xs">{{ answerStatus }}</text>
  33. </view>
  34. <view class="flex justify-start align-center">
  35. <uni-icons type="location"></uni-icons>
  36. <text class="padding-lr-xs text-sm text-gray">{{ data.school_address || '-' }}</text>
  37. </view>
  38. <view class="bg-gray margin-tb-sm" style="height: 1px;" />
  39. <view class="margin-lr-sm flex justify-start align-start">
  40. <text class="text-gray text-sm"> 学员: </text>
  41. <view v-if="data.stu_list" class="flex flex-wrap" style="flex:1">
  42. <view class="margin-lr-sm" v-for="(item, index) in data.stu_list" :key="index">
  43. <text class="text-gray text-sm"> {{ item.stu_name }} </text>
  44. </view>
  45. </view>
  46. <text v-else class="text-gray text-sm margin-lr-sm">暂无学员</text>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import moment from 'moment';
  57. export default {
  58. props: {
  59. data: {
  60. type: Object,
  61. default: () => ({})
  62. }
  63. },
  64. data() {
  65. return {
  66. };
  67. },
  68. computed: {
  69. startTime() {
  70. return moment(this.data.start_time).format('hh:mm');
  71. },
  72. endTime() {
  73. return moment(this.data.end_time).format('hh:mm');
  74. },
  75. mainColor() {
  76. if (this.data.if_feedback) {
  77. return '#F7C405'
  78. } else {
  79. return '#FFD7D9';
  80. }
  81. },
  82. lessonStatus() {
  83. if (this.data.study_state == 45) return '未上课';
  84. if (this.data.study_state == 47) return '已上课';
  85. if (this.data.study_state == 686) return '已取消';
  86. return ''
  87. },
  88. answerStatus() {
  89. var total = (this.data.stu_list || []).length
  90. return `${this.$i18n.t('answered')}\(${this.data.finish_num}/${total}\)`
  91. }
  92. },
  93. onReady() {},
  94. mounted() {},
  95. methods: {
  96. lessonItemOnTap(){
  97. uni.navigateTo({
  98. url:`../lesson/lesson_detail?lessonId=${this.data.id}`
  99. })
  100. },
  101. classStatusDidClick() {
  102. console.log('classStatusDidClick')
  103. }
  104. }
  105. };
  106. </script>
  107. <style lang="scss" scoped>
  108. .bg-normal {
  109. background-color: $uni-bg-color-hover;
  110. }
  111. .lesson-item {
  112. width: auto;
  113. border-top: 1px solid #f1f1f1;
  114. margin: 5px;
  115. padding-bottom: 5px;
  116. border-radius: 5px;
  117. box-shadow: 3px 3px 0 0 #f1f1f1;
  118. }
  119. .lesson-top-box {
  120. display: flex;
  121. justify-content: space-between;
  122. margin: 10px;
  123. }
  124. .lesson-status {
  125. background-color: red;
  126. color: white;
  127. padding: 3px 5px;
  128. border-radius: 10px 2px 10px 2px;
  129. }
  130. </style>