classlist.vue 7.5 KB

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