classdetail.vue 7.9 KB

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