classList.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <!-- 课程详情列表页面 -->
  2. <template>
  3. <view class="page-view">
  4. <top-return color="#FFF" text="课程详情"></top-return>
  5. <!-- 背景 -->
  6. <view class="bg-box2"></view>
  7. <!-- 页面标题内容 -->
  8. <view class="top-box">
  9. <view class="flex-baseline">
  10. <view class="info-title" style="margin-left: 0;">{{dayTime.split('月')[0]}}</view>
  11. <view class="info-subtitle">月</view>
  12. <view class="info-title">{{dayTime.split('月')[1]}}
  13. </view>
  14. <view class="info-subtitle">日</view>
  15. <view class="info-title" style="margin-left: 20rpx;">{{weekTime}}</view>
  16. </view>
  17. <view class="flex-baseline">
  18. <view class="data-subtitle" style="margin-left: 0;">孩子今日共</view>
  19. <view class="data-title">
  20. {{classList.length}}
  21. </view>
  22. <view class="data-subtitle">节课程</view>
  23. </view>
  24. </view>
  25. <!-- 天数选择 -->
  26. <scroll-view class="week-view" scroll-x="true">
  27. <view style="margin-top:20rpx;">
  28. <view v-for="(item,index) in weekList" :key="index"
  29. :class="isactive == index ? 'week-item-select' : 'week-item' " @click='chooseDay(index,item)'>
  30. <view class="item-box">
  31. <view class="item-title">{{item.weekNum}}</view>
  32. <view class="item-day">{{item.dayNum}}</view>
  33. <view class="tag-fill" v-if="isactive == index">
  34. <view class="tag-text" v-if="isactive == index && currentClassList.length != 0">
  35. {{currentClassList.length}} 节课
  36. </view>
  37. <view class="tag-text" v-if="isactive == index && currentClassList.length === 0">无课程</view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </scroll-view>
  43. <!-- 课程表 -->
  44. <view class="card-view">
  45. <view class="card-item" style="width: 100%;">
  46. <view class="card-title">
  47. <view class="front-tag"></view>
  48. <view class="title">{{weekList[isactive].weekNum}}课程表</view>
  49. </view>
  50. <view class="class-list">
  51. <view class="class-item"
  52. :style="{borderImage: index == current&& isactive == 0?'linear-gradient(to right, #4169E1, #FFF) 1': none}"
  53. v-for="(item,index) in currentClassList" :key="index">
  54. <view class="flex-row" style="justify-content: space-around;">
  55. <view class="t-icon t-icon-shuji2"></view>
  56. <view class="item-title"
  57. :style="{color: index == current && isactive == 0?'#4169E1':'#303133'}">{{item.name}}
  58. </view>
  59. <view class="tag" style="margin: 0;">
  60. <view class="tag-text">{{item.teacher}}</view>
  61. </view>
  62. <view class="item-subtitle"
  63. :style="{color: index == current && isactive == 0?'#4169E1':'#909399',fontSize: 24 + 'rpx'}">
  64. {{index == current && isactive == 0?'课程进行中':item.timeFrame}}</view>
  65. <view class="item-title"
  66. :style="{color: index == current && isactive == 0?'#4169E1':'#303133'}">{{item.time}}
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="image-box" v-if="!currentClassList">
  72. <view class="detail-image1" :style="{backgroundImage:`url(${image1})`}"></view>
  73. <view class="subtitle">当前选中日期孩子暂无课程</view>
  74. <view class="subtitle" style="margin-top: 20rpx;">注意劳逸结合</view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </template>
  80. <script>
  81. import MockData from '@/common/global_js/MockData.js'
  82. import {
  83. mapState
  84. } from 'vuex'
  85. export default {
  86. computed: {
  87. ...mapState('m_children', ['classList'])
  88. },
  89. data() {
  90. return {
  91. dayTime: '',
  92. weekTime: '',
  93. isactive: 0,
  94. weekList: [{
  95. weekNum: '',
  96. dayNum: '',
  97. }, {
  98. weekNum: '',
  99. dayNum: '',
  100. }, {
  101. weekNum: '',
  102. dayNum: '',
  103. }, {
  104. weekNum: '',
  105. dayNum: '',
  106. }, {
  107. weekNum: '',
  108. dayNum: '',
  109. }, {
  110. weekNum: '',
  111. dayNum: '',
  112. }, {
  113. weekNum: '',
  114. dayNum: '',
  115. }],
  116. currentClassList: '',
  117. weekClassData: MockData.classData,
  118. image1: 'https://ouch-cdn2.icons8.com/kO20yenejB3M-ElZUGZMtv3FCQ4fbFa7TbOKX5dGf0w/rs:fit:456:456/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9zdmcvNDY4/LzU4OWMzZTZkLWQz/OTAtNGQ0My04NTgx/LTY4NDkzMGZiNWRk/ZC5zdmc.png',
  119. current: '',
  120. };
  121. },
  122. onLoad(parameter) {
  123. this.getPageData()
  124. this.current = parameter.index - 1
  125. },
  126. methods: {
  127. getPageData() {
  128. this.dayTime = (new Date()).format('M-d').replace('-', '月')
  129. this.weekTime = "星期" + "日一二三四五六".charAt(new Date().getDay());
  130. this.currentClassList = this.classList
  131. // 课程选择查看列表
  132. this.weekList.forEach(function(item, index) {
  133. var dateTime = new Date();
  134. dateTime = dateTime.setDate(dateTime.getDate() + index);
  135. let weekDateStr = "周" + "日一二三四五六".charAt(new Date(dateTime).getDay());
  136. item.weekNum = weekDateStr
  137. // if (index === 0) {
  138. // item.weekNum = '今日'
  139. // }
  140. item.dayNum = new Date(dateTime).format('d') + ' 号'
  141. });
  142. },
  143. //选中日期
  144. chooseDay(index, item) {
  145. this.isactive = index
  146. for (const key in this.weekClassData) {
  147. if (key === item.weekNum) {
  148. this.currentClassList = this.weekClassData[key]
  149. }
  150. }
  151. }
  152. }
  153. }
  154. </script>
  155. <style lang="scss">
  156. @import '@/subpkg/datalist/top_info.scss';
  157. .week-view {
  158. white-space: nowrap;
  159. .week-item {
  160. display: inline-block;
  161. vertical-align: top;
  162. height: 140rpx;
  163. width: 120rpx;
  164. margin: 20rpx;
  165. padding: 20rpx;
  166. border-radius: $border-radius;
  167. background-color: #FFF;
  168. .item-box {
  169. width: 100%;
  170. height: 100%;
  171. display: flex;
  172. flex-direction: column;
  173. align-items: center;
  174. justify-content: space-around;
  175. .item-title {
  176. font-size: 30rpx;
  177. color: #898b91;
  178. }
  179. .item-day {
  180. font-size: 40rpx;
  181. font-weight: bold;
  182. color: #505155;
  183. }
  184. }
  185. }
  186. .week-item-select {
  187. display: inline-block;
  188. vertical-align: top;
  189. height: 160rpx;
  190. width: 140rpx;
  191. margin: 20rpx;
  192. padding: 20rpx;
  193. border-radius: $border-radius;
  194. background-color: #FFF;
  195. border: 3px solid $title;
  196. .item-box {
  197. width: 100%;
  198. height: 100%;
  199. display: flex;
  200. flex-direction: column;
  201. align-items: center;
  202. justify-content: space-between;
  203. .tag-fill {
  204. border-radius: 6rpx;
  205. background-color: $title;
  206. padding: 5rpx 20rpx;
  207. .tag-text {
  208. font-size: 28rpx;
  209. color: #FFF;
  210. }
  211. }
  212. .item-title {
  213. font-size: 34rpx;
  214. color: $title;
  215. }
  216. .item-day {
  217. font-size: 50rpx;
  218. font-weight: bold;
  219. color: $title;
  220. }
  221. }
  222. }
  223. }
  224. .class-list {
  225. display: flex;
  226. flex-direction: column;
  227. justify-content: space-between;
  228. margin: 0 30rpx 20rpx 30rpx;
  229. .class-item {
  230. display: flex;
  231. flex-direction: column;
  232. justify-content: space-around;
  233. margin: 10rpx 0;
  234. padding: 10rpx 0;
  235. height: 100rpx;
  236. border-bottom: 4rpx solid #f3f4f9;
  237. border-top: 4rpx solid #f3f4f9;
  238. border-image: linear-gradient(to right, #FFF, #d5d5d5) 1;
  239. .item-title {
  240. font-size: 32rpx;
  241. font-weight: bold;
  242. color: $title;
  243. }
  244. .item-subtitle {
  245. font-size: 30rpx;
  246. font-weight: bold;
  247. color: $subtitle;
  248. overflow: hidden;
  249. text-overflow: ellipsis;
  250. white-space: nowrap;
  251. }
  252. }
  253. }
  254. .image-box {
  255. display: flex;
  256. flex-direction: column;
  257. height: 100%;
  258. align-items: center;
  259. margin-bottom: 70rpx;
  260. }
  261. .detail-image1 {
  262. width: 500rpx;
  263. height: 600rpx;
  264. background-size: 100%;
  265. background-repeat: no-repeat;
  266. z-index: 51;
  267. }
  268. </style>