item.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <van-cell-group class="item" @click="onItem" v-show="dataInfo.courseScheduleId">
  3. <van-cell title-class="timer" class="comment">
  4. <template #title>
  5. <van-icon :name="icon_timer" size="16" style="padding-right: .06rem;margin-top: 0.02rem;" />
  6. {{dataInfo.classStartTime | dayFormat('YYYY-MM-DD HH:mm')}}-{{ dataInfo.classEndTime | dayFormat('HH:mm') }}
  7. </template>
  8. <template #default>
  9. <!-- <span v-show="isComment" style="color: #01C1B5; font-size: .15rem">
  10. {{ dataInfo.courseScheduleReviewId ? '已评价' : '待评价' }}
  11. </span> -->
  12. </template>
  13. </van-cell>
  14. <van-cell label-class="address">
  15. <template #title>
  16. <div class="course-info">
  17. <span class="teachMode">{{ dataInfo.teachMode == 'ONLINE' ? '线上' : null }}{{ dataInfo.teachMode == 'OFFLINE' ? '线下' : null }}</span>
  18. <span :class="['courseType', dataInfo.courseType]">{{ dataInfo.courseType | coursesType }}</span>
  19. <span style="line-height: .18rem;vertical-align: bottom;color: #1A1A1A;font-size: .16rem;font-weight: 500;">{{ dataInfo.courseName }}</span>
  20. <!-- <div class="course-img">
  21. <img v-if="dataInfo.courseType === 'VIP'" src="../images/icon_vip.png" alt="">
  22. <img v-if="dataInfo.courseType === 'PRACTICE'" src="../images/icon_p.png" alt="">
  23. <img v-if="dataInfo.courseType !== 'VIP' && dataInfo.courseType !== 'PRACTICE'" src="../images/icon_music.png" alt="">
  24. </div>
  25. <div class="course-name">
  26. {{ dataInfo.courseName }}<span class="teachMode" v-show="dataInfo.teachMode">{{ dataInfo.teachMode === 'ONLINE' ? '线上' : '线下' }}</span>
  27. </div> -->
  28. </div>
  29. </template>
  30. <template #label>
  31. <van-icon v-if="dataInfo.schoolName || dataInfo.teachMode == 'ONLINE'" :name="icon_address" class="icon-address" style="padding-right: .02rem;vertical-align: middle;" />
  32. {{ dataInfo.teachMode == 'ONLINE' ? '上课地点:网络教室' : dataInfo.schoolName }}
  33. </template>
  34. </van-cell>
  35. </van-cell-group>
  36. </template>
  37. <script>
  38. // classStartTime
  39. // classEndTime
  40. // courseType
  41. // courseName
  42. // teachMode
  43. // schoolName
  44. // courseScheduleId
  45. import dayjs from 'dayjs';
  46. export default {
  47. name: "item",
  48. props: {
  49. dataInfo: { // 单个课程对象
  50. type: Object,
  51. default() {
  52. return {}
  53. }
  54. },
  55. isComment: {
  56. type: Boolean,
  57. default: true
  58. }
  59. },
  60. data() {
  61. return {
  62. icon_timer: require('@/views/afterClassEvaluate/images/icon_timer.png'),
  63. icon_address: require('@/views/afterClassEvaluate/images/icon_address.png'),
  64. }
  65. },
  66. methods: {
  67. onItem() {
  68. this.$emit('onItem', this.dataInfo)
  69. }
  70. },
  71. filters: {
  72. dayFormat(val, formatStr = 'HH:mm:ss') {
  73. return dayjs(val).format(formatStr)
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="less" scoped>
  79. .item {
  80. margin: .15rem .12rem 0;
  81. border-radius: .1rem;
  82. overflow: hidden;
  83. .timer {
  84. display: flex;
  85. align-items: center;
  86. font-size: .14rem;
  87. color: #666;
  88. flex: 1 auto;
  89. }
  90. .address {
  91. font-size: .14rem;
  92. color: #666;
  93. line-height: 1.5;
  94. }
  95. .icon-address {
  96. width: .12rem;
  97. height: .15rem;
  98. .van-icon__image {
  99. width: inherit;
  100. height: inherit;
  101. }
  102. }
  103. .course-info {
  104. // display: flex;
  105. // align-items: center;
  106. padding: 2px 0 16px;
  107. .course-img {
  108. // width: .48rem;
  109. // height: .4rem;
  110. // margin-right: .08rem;
  111. // img {
  112. // border-radius: 50%;
  113. // width: .4rem;
  114. // height: .4rem;
  115. // }
  116. }
  117. .course-name {
  118. color: #1A1A1A;
  119. font-size: .16rem;
  120. font-weight: 500;
  121. }
  122. }
  123. .teachMode {
  124. background: #F2FFFC;
  125. border-radius: .03rem;
  126. border: 1px solid #01C1B5;
  127. font-size: 12px;
  128. color: #01C1B5;
  129. display: inline-block;
  130. // height: 16px;
  131. line-height: 16px;
  132. padding: 0 5px;
  133. // margin-left: .05rem;
  134. }
  135. .comment {
  136. /deep/.van-cell__value {
  137. flex-basis: auto;
  138. }
  139. }
  140. }
  141. @mColor: #01C1B5;
  142. @color1: #FF8642;
  143. @color2: #8C98E5;
  144. @color3: #6FB2FF;
  145. @color4: #7DC0CF;
  146. @color5: #cfcaca;
  147. @color6: #FF9288;
  148. @color7: #AA92CF;
  149. @color8: #2CD3E3;
  150. @color9: #0684E8;
  151. @color10: #97C672;
  152. @color11: #72C67A;
  153. @color12: #51CF83;
  154. @color13: #FFA25F;
  155. @color14: #85BEBE;
  156. @color15: #7584E8;
  157. .courseType {
  158. line-height: 18px;
  159. // height: 18px;
  160. font-size: 12px;
  161. color: #fff;
  162. display: inline-block;
  163. border-radius: 0px 5px 0px 5px;
  164. padding: 0 3px;
  165. margin: 0 .05rem;
  166. }
  167. .NORMAL, .SINGLE {
  168. background: @color4;
  169. }
  170. .MIX {
  171. background: @color6;
  172. }
  173. .HIGH {
  174. background: @color7;
  175. }
  176. .VIP {
  177. background: @color1;
  178. }
  179. .DEMO {
  180. background: @color3;
  181. }
  182. .COMPREHENSIVE {
  183. background: @color8;
  184. }
  185. .ENLIGHTENMENT {
  186. background: @color9;
  187. }
  188. .TRAINING {
  189. background: @color10;
  190. }
  191. .TRAINING_SINGLE {
  192. background: @color11;
  193. }
  194. .TRAINING_MIX {
  195. background: @color12;
  196. }
  197. .CLASSROOM {
  198. background: @color13;
  199. }
  200. .PRACTICE, .MUSIC_NETWORK {
  201. background: @color2;
  202. }
  203. .COMM {
  204. background: @color14;
  205. }
  206. .MUSIC {
  207. background: @mColor;
  208. }
  209. .HIGH_ONLINE {
  210. background: @color15;
  211. }
  212. </style>