CourseDetail.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <div class="courseDetail">
  3. <van-radio-group v-model="radioSelect">
  4. <van-cell-group class="" v-for="(item, index) in dataList" :border="false" :key="index" @click="onDetail(item)">
  5. <van-cell title-class="title-content" :center="true">
  6. <template slot="title">
  7. <div class="title-section" :class="[signStatus || (!signStatus && item.newCourseId && item.newCourseId != item.id) ? 'signInfo' : null]">
  8. <div class="title-info">
  9. <span class="teachMode">{{ item.teachMode == 'ONLINE' ? '线上' : null }}{{ item.teachMode == 'OFFLINE' ? '线下' : null }}</span>
  10. <span :class="['courseType', item.type]">{{ item.type | coursesType }}</span>
  11. <span style="line-height: 18px;vertical-align: bottom;">{{ item.name }}</span>
  12. </div>
  13. <div class="title-status" v-if="signStatus">
  14. <span class="teachMode" :class="[`sign${item.signInStatus}`]">{{ item.signInStatus | attendanceType }}</span>
  15. </div>
  16. <div class="title-status" v-if="!signStatus && item.newCourseId && item.newCourseId != item.id">
  17. <span class="teachMode sign1">被合并</span>
  18. </div>
  19. </div>
  20. </template>
  21. <template slot="label">
  22. <div style="padding: .05rem 0 0;">
  23. <p>
  24. <span>
  25. 上课日期:{{item.startClassTime | formatDateExtend}}
  26. </span>
  27. </p>
  28. <!-- <p v-if="item.type != 'VIP' && item.type != 'PRACTICE'">
  29. 所在乐团:{{ item.groupName }}
  30. </p> -->
  31. <p>
  32. <span v-if="item.teachMode == 'ONLINE'">
  33. 上课地点:网络教室
  34. </span>
  35. <span v-else>
  36. 上课地点:{{ item.schoolName }}
  37. </span>
  38. </p>
  39. <p v-if="teacherStatus">主讲老师:{{ item.teacherName }}</p>
  40. </div>
  41. </template>
  42. </van-cell>
  43. <van-cell :icon="icon_timer" :center="true" value-class="courseTimer">
  44. <!-- <template slot="default">
  45. <template v-if="radioStatus">
  46. <van-radio
  47. ref="radioes"
  48. :disabled="item.radioDisabled"
  49. :name="item.id"
  50. >
  51. <template #icon="props">
  52. <img v-if="!item.radioDisabled" class="img-icon" :src="props.checked ? activeButtonIcon : inactiveButtonIcon" />
  53. </template>
  54. </van-radio>
  55. </template>
  56. <template v-else>
  57. <p>
  58. <span>到课:{{ item.studentNum }}/{{ item.totalStudentNum }}</span>
  59. <span>请假:{{ item.leaveStudentNum }}</span>
  60. </p>
  61. </template>
  62. </template> -->
  63. <template slot="title">{{ item.startClassTime | formatDate }} - {{ item.endClassTime | formatDate }}</template>
  64. </van-cell>
  65. </van-cell-group>
  66. </van-radio-group>
  67. </div>
  68. </template>
  69. <script>
  70. export default {
  71. name: 'courseDetail',
  72. props: {
  73. dataList: {
  74. type: Array,
  75. default() {
  76. return []
  77. }
  78. },
  79. selectRadioId: {
  80. type: [Number, String],
  81. default() {
  82. return null
  83. }
  84. },
  85. signStatus: { // 是否显示签到状态
  86. type: Boolean,
  87. default() {
  88. return false
  89. }
  90. },
  91. radioStatus: { // 是否显示单选按钮
  92. type: Boolean,
  93. default() {
  94. return false
  95. }
  96. },
  97. teacherStatus: {
  98. type: Boolean,
  99. default() {
  100. return false
  101. }
  102. }
  103. },
  104. data() {
  105. return {
  106. icon_timer: require('@/assets/images/common/icon_timer.png'),
  107. radioSelect: this.selectRadioId || null
  108. }
  109. },
  110. methods: {
  111. onDetail(item) {
  112. if(!item.radioDisabled) {
  113. this.radioSelect = item.id;
  114. }
  115. this.$emit('onDetail', item)
  116. }
  117. },
  118. watch: {
  119. selectRadioId() {
  120. this.radioSelect = this.selectRadioId
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="less" scoped>
  126. @import url('../assets/commonLess/variable');
  127. .courseDetail {
  128. margin: 0 .12rem;
  129. /deep/.van-cell__left-icon img {
  130. padding-top: .03rem;
  131. }
  132. /deep/.van-cell__title {
  133. font-size: .16rem;
  134. color: #333333;
  135. }
  136. /deep/.van-cell-group {
  137. margin-top: .15rem;
  138. border-radius: .1rem;
  139. overflow: hidden;
  140. }
  141. .title-content {
  142. font-weight: bold;
  143. flex: 1 auto;
  144. padding-top: 5px;
  145. .van-cell__label {
  146. font-weight: 400;
  147. margin-top: .06rem;
  148. display: flex;
  149. align-items: center;
  150. }
  151. .van-icon-location, .van-icon-video-o {
  152. margin-right: .05rem;
  153. }
  154. .groupName {
  155. display: block;
  156. font-size: .14rem;
  157. font-weight: 400;
  158. padding-bottom: 0.04rem;
  159. overflow: hidden;
  160. white-space: nowrap;
  161. text-overflow: ellipsis;
  162. }
  163. }
  164. /deep/.van-cell__value, /deep/.van-cell__label {
  165. color: #808080;
  166. span {
  167. padding-right: .1rem;
  168. }
  169. }
  170. // .title-info {
  171. // display: flex;
  172. // align-items: center;
  173. // line-height: 1.2;
  174. // overflow: hidden;
  175. // white-space: nowrap;
  176. // text-overflow: ellipsis;
  177. // }
  178. .title-section {
  179. display: flex;
  180. justify-content: space-between;
  181. align-items: baseline;
  182. &.signInfo {
  183. .title-info {
  184. flex-basis: 80%;
  185. }
  186. .title-status {
  187. flex-basis: 20%;
  188. text-align: right;
  189. }
  190. }
  191. }
  192. .courseTimer {
  193. display: flex;
  194. justify-content: flex-end;
  195. }
  196. }
  197. /deep/.van-radio__icon--disabled .van-icon {
  198. border-color: transparent;
  199. background: #fff;
  200. color: transparent;
  201. }
  202. </style>