123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 |
- <template>
- <view class="page-view">
- <top-return color="#FFF" text="课程详情"></top-return>
- <!-- 背景 -->
- <view class="bg-box2"></view>
- <!-- 页面标题内容 -->
- <view class="top-box">
- <view class="flex-baseline">
- <view class="info-title" style="margin-left: 0;">{{dayTime.split('月')[0]}}</view>
- <view class="info-subtitle">月</view>
- <view class="info-title">{{dayTime.split('月')[1]}}
- </view>
- <view class="info-subtitle">日</view>
- <view class="info-title" style="margin-left: 20rpx;">{{weekTime}}</view>
- </view>
- <view class="flex-baseline">
- <view class="data-subtitle" style="margin-left: 0;">孩子今日共</view>
- <view class="data-title">
- {{classList.length}}
- </view>
- <view class="data-subtitle">节课程</view>
- </view>
- </view>
- <!-- 天数选择 -->
- <scroll-view class="week-view" scroll-x="true" :scroll-with-animation="true" scroll-left="0">
- <view style="margin-top:20rpx;">
- <view v-for="(item,index) in weekList" :key="index"
- :class="isactive == index ? 'week-item-select' : 'week-item' " @click='chooseDay(index,item)'>
- <view class="item-box">
- <view class="item-title">{{item.weekNum}}</view>
- <view class="item-day">{{item.dayNum}}</view>
- <view class="tag-fill" v-if="isactive == index">
- <view class="tag-text" v-if="isactive == index && currentClassList.length != 0">
- {{currentClassList.length}} 节课
- </view>
- <view class="tag-text" v-if="isactive == index && currentClassList.length === 0">无课程</view>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- <!-- 课程表 -->
- <view class="card-view">
- <view class="card-item" style="width: 100%;">
- <view class="card-title">
- <view class="front-tag"></view>
- <view class="title">{{weekList[isactive].weekNum}}课程表</view>
- </view>
- <view class="class-list">
- <view class="class-item"
- :style="{borderImage: index == current&& isactive == 0?'linear-gradient(to right, #4169E1, #FFF) 1': none}"
- v-for="(item,index) in currentClassList" :key="index">
- <view class="flex-row" style="justify-content: space-around;">
- <view class="t-icon t-icon-shuji2"></view>
- <view class="item-title"
- :style="{color: index == current && isactive == 0?'#4169E1':'#303133'}">{{item.name}}
- </view>
- <view class="tag" style="margin: 0;">
- <view class="tag-text">{{item.teacher}}</view>
- </view>
- <view class="item-subtitle"
- :style="{color: index == current && isactive == 0?'#4169E1':'#909399',fontSize: 24 + 'rpx'}">
- {{index == current && isactive == 0?'课程进行中':item.timeFrame}}</view>
- <view class="item-title"
- :style="{color: index == current && isactive == 0?'#4169E1':'#303133'}">{{item.time}}
- </view>
- </view>
- </view>
- </view>
- <view class="image-box" v-if="!currentClassList">
- <view class="detail-image1" :style="{backgroundImage:`url(${image1})`}"></view>
- <view class="subtitle">当前选中日期孩子暂无课程</view>
- <view class="subtitle" style="margin-top: 20rpx;">注意劳逸结合</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import MockData from '@/common/global_js/MockData.js'
- import {
- mapState
- } from 'vuex'
- export default {
- computed: {
- ...mapState('m_children', ['classList'])
- },
- data() {
- return {
- dayTime: '',
- weekTime: '',
- isactive: 0,
- weekList: [{
- weekNum: '',
- dayNum: '',
- }, {
- weekNum: '',
- dayNum: '',
- }, {
- weekNum: '',
- dayNum: '',
- }, {
- weekNum: '',
- dayNum: '',
- }, {
- weekNum: '',
- dayNum: '',
- }, {
- weekNum: '',
- dayNum: '',
- }, {
- weekNum: '',
- dayNum: '',
- }],
- currentClassList: '',
- weekClassData: MockData.classData,
- image1: 'https://ouch-cdn2.icons8.com/kO20yenejB3M-ElZUGZMtv3FCQ4fbFa7TbOKX5dGf0w/rs:fit:456:456/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9zdmcvNDY4/LzU4OWMzZTZkLWQz/OTAtNGQ0My04NTgx/LTY4NDkzMGZiNWRk/ZC5zdmc.png',
- current: '',
- };
- },
- onLoad(parameter) {
- this.getPageData()
- this.current = parameter.index - 1
- },
- methods: {
- getPageData() {
- this.dayTime = (new Date()).format('M-d').replace('-', '月')
- this.weekTime = "星期" + "日一二三四五六".charAt(new Date().getDay());
- this.currentClassList = this.classList
- // 课程选择查看列表
- this.weekList.forEach(function(item, index) {
- var dateTime = new Date();
- dateTime = dateTime.setDate(dateTime.getDate() + index);
- let weekDateStr = "周" + "日一二三四五六".charAt(new Date(dateTime).getDay());
- item.weekNum = weekDateStr
- // if (index === 0) {
- // item.weekNum = '今日'
- // }
- item.dayNum = new Date(dateTime).format('d') + ' 号'
- });
- },
- //选中日期
- chooseDay(index, item) {
- this.isactive = index
- for (const key in this.weekClassData) {
- if (key === item.weekNum) {
- this.currentClassList = this.weekClassData[key]
- }
- }
- }
- }
- }
- </script>
- <style lang="scss">
- @import '@/subpkg/datalist/top_info.scss';
- .week-view {
- white-space: nowrap;
- .week-item {
- display: inline-block;
- vertical-align: top;
- height: 140rpx;
- width: 120rpx;
- margin: 20rpx;
- padding: 20rpx;
- border-radius: $border-radius;
- background-color: #FFF;
- .item-box {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-around;
- .item-title {
- font-size: 30rpx;
- color: #898b91;
- }
- .item-day {
- font-size: 40rpx;
- font-weight: bold;
- color: #505155;
- }
- }
- }
- .week-item-select {
- display: inline-block;
- vertical-align: top;
- height: 160rpx;
- width: 140rpx;
- margin: 20rpx;
- padding: 20rpx;
- border-radius: $border-radius;
- background-color: #FFF;
- border: 3px solid $title;
- .item-box {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-between;
- .tag-fill {
- border-radius: 6rpx;
- background-color: $title;
- padding: 5rpx 20rpx;
- .tag-text {
- font-size: 28rpx;
- color: #FFF;
- }
- }
- .item-title {
- font-size: 34rpx;
- color: $title;
- }
- .item-day {
- font-size: 50rpx;
- font-weight: bold;
- color: $title;
- }
- }
- }
- }
- .class-list {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- margin: 0 30rpx 20rpx 30rpx;
- .class-item {
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- margin: 10rpx 0;
- padding: 10rpx 0;
- height: 100rpx;
- border-bottom: 4rpx solid #f3f4f9;
- border-top: 4rpx solid #f3f4f9;
- border-image: linear-gradient(to right, #FFF, #d5d5d5) 1;
- .item-title {
- font-size: 32rpx;
- font-weight: bold;
- color: $title;
- }
- .item-subtitle {
- font-size: 30rpx;
- font-weight: bold;
- color: $subtitle;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- }
- .image-box {
- display: flex;
- flex-direction: column;
- height: 100%;
- align-items: center;
- margin-bottom: 70rpx;
- }
- .detail-image1 {
- width: 500rpx;
- height: 600rpx;
- background-size: 100%;
- background-repeat: no-repeat;
- z-index: 51;
- }
- </style>
|