classlist.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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="flex_cloumn">
  8. <view class="flex_baseline">
  9. <view class="content_title" style="font-size: 70rpx;">{{dayTime.split('月')[0]}}</view>
  10. <view class="content_title" style="margin-left: 10rpx;">月</view>
  11. <view class="content_title" style="font-size: 70rpx; margin-left: 10rpx;">{{dayTime.split('月')[1]}}
  12. </view>
  13. <view class="content_title" style="margin-left: 10rpx;">日</view>
  14. <view class="content_title" style="font-size: 70rpx;margin-left: 20rpx;">{{weekTime}}</view>
  15. </view>
  16. <view class="flex_baseline">
  17. <view class="content_subtitle" style="opacity: 0.8;">孩子今日共</view>
  18. <view class="content_subtitle" style="margin-left: 20rpx;font-size: 60rpx;">
  19. {{classList.length}}
  20. </view>
  21. <view class="content_subtitle" style="margin-left: 20rpx;opacity: 0.8;">节课程</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="_title">{{item.weekNum}}</view>
  31. <view class="_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="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="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="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. .week_view {
  156. white-space: nowrap;
  157. .week_item {
  158. display: inline-block;
  159. vertical-align: top;
  160. height: 140rpx;
  161. width: 120rpx;
  162. margin: 20rpx;
  163. padding: 20rpx;
  164. border-radius: $border-radius;
  165. background-color: #FFF;
  166. .item_box {
  167. width: 100%;
  168. height: 100%;
  169. display: flex;
  170. flex-direction: column;
  171. align-items: center;
  172. justify-content: space-around;
  173. ._title {
  174. font-size: 30rpx;
  175. color: #898b91;
  176. }
  177. ._day {
  178. font-size: 40rpx;
  179. font-weight: bold;
  180. color: #505155;
  181. }
  182. }
  183. }
  184. .week_item_select {
  185. display: inline-block;
  186. vertical-align: top;
  187. height: 160rpx;
  188. width: 140rpx;
  189. margin: 20rpx;
  190. padding: 20rpx;
  191. border-radius: $border-radius;
  192. background-color: #FFF;
  193. border: 3px solid $title;
  194. .item_box {
  195. width: 100%;
  196. height: 100%;
  197. display: flex;
  198. flex-direction: column;
  199. align-items: center;
  200. justify-content: space-between;
  201. .tag-fill {
  202. border-radius: 6rpx;
  203. background-color: $title;
  204. padding: 5rpx 20rpx;
  205. .tag-text {
  206. font-size: 28rpx;
  207. color: #FFF;
  208. }
  209. }
  210. ._title {
  211. font-size: 34rpx;
  212. color: $title;
  213. }
  214. ._day {
  215. font-size: 50rpx;
  216. font-weight: bold;
  217. color: $title;
  218. }
  219. }
  220. }
  221. }
  222. .class_list {
  223. display: flex;
  224. flex-direction: column;
  225. justify-content: space-between;
  226. margin: 0 30rpx 20rpx 30rpx;
  227. .class_item {
  228. display: flex;
  229. flex-direction: column;
  230. justify-content: space-around;
  231. margin: 10rpx 0;
  232. padding: 10rpx 0;
  233. height: 100rpx;
  234. border-bottom: 4rpx solid #f3f4f9;
  235. border-top: 4rpx solid #f3f4f9;
  236. border-image: linear-gradient(to right, #FFF, #d5d5d5) 1;
  237. &_title {
  238. font-size: 32rpx;
  239. font-weight: bold;
  240. color: $title;
  241. }
  242. &_subtitle {
  243. font-size: 30rpx;
  244. font-weight: bold;
  245. color: $subtitle;
  246. overflow: hidden;
  247. text-overflow: ellipsis;
  248. white-space: nowrap;
  249. }
  250. &_detail {
  251. margin-left: 40rpx;
  252. line-height: 30rpx;
  253. font-size: 26rpx;
  254. font-weight: bold;
  255. color: $subtitle;
  256. }
  257. }
  258. }
  259. .flex_cloumn {
  260. margin: 140rpx 0 0 50rpx;
  261. height: 170rpx;
  262. justify-content: space-around;
  263. .content_title {
  264. font-size: 40rpx;
  265. font-family: YSfont;
  266. color: #FFF;
  267. z-index: 2;
  268. text-shadow: 1px -1px 0px #c0c0c0, 2px -2px 0px #b0b0b0, 1px -1px 0px #a0a0a0, 2px -2px 0px #909090;
  269. }
  270. .content_subtitle {
  271. font-size: 40rpx;
  272. font-family: YSfont;
  273. color: #FFF;
  274. z-index: 2;
  275. }
  276. }
  277. .image_box {
  278. display: flex;
  279. flex-direction: column;
  280. height: 100%;
  281. align-items: center;
  282. margin-bottom: 70rpx;
  283. }
  284. .detail_image1 {
  285. width: 500rpx;
  286. height: 600rpx;
  287. background-size: 100%;
  288. background-repeat: no-repeat;
  289. z-index: 51;
  290. }
  291. </style>