123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- <template>
- <view class="page_view">
- <top-return color="#FFF" text="课程详情"></top-return>
- <!-- 背景 -->
- <view class="bg_card"></view>
- <!-- 页面标题内容 -->
- <view class="flex_cloumn">
- <view class="flex_baseline">
- <view class="content_title" style="font-size: 60rpx;">{{dayTime.split('月')[0]}}</view>
- <view class="content_title" style="margin-left: 10rpx;">月</view>
- <view class="content_title" style="font-size: 60rpx; margin-left: 10rpx;">{{dayTime.split('月')[1]}}
- </view>
- <view class="content_title" style="margin-left: 10rpx;">日</view>
- <view class="content_title" style="font-size: 60rpx;margin-left: 20rpx;">{{weekTime}}</view>
- </view>
- <view class="flex_baseline">
- <view class="content_subtitle" style="opacity: 0.8;">孩子今日共</view>
- <view class="content_subtitle" style="margin-left: 20rpx;font-size: 40rpx;transform: skew(-15deg);">
- {{classList.length}}
- </view>
- <view class="content_subtitle" style="margin-left: 20rpx;opacity: 0.8;">节课程</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="_title">{{item.weekNum}}</view>
- <view class="_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" v-for="(item,index) in currentClassList" :key="index">
- <view class="flex_row" style="justify-content: space-around;">
- <view class="class_item_title">{{item.name}}</view>
- <view class="tag" style="margin: 0;">
- <view class="tag_text">{{item.teacher}}</view>
- </view>
- <view class="class_item_subtitle" style="font-size: 24rpx;">{{item.timeFrame}}</view>
- <view class="class_item_title">{{item.time}}</view>
- </view>
- </view>
- </view>
- <view style="display: flex;flex-direction: column;height: 100%;align-items: center;margin-bottom: 50rpx;" 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',
- };
- },
- onLoad() {
- this.getPageData()
- },
- 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">
- .week_view {
- white-space: nowrap;
- .week_item {
- display: inline-block;
- vertical-align: top;
- height: 150rpx;
- width: 130rpx;
- 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;
- ._title {
- font-size: 30rpx;
- color: #898b91;
- }
- ._day {
- font-size: 40rpx;
- font-weight: bold;
- color: #505155;
- }
- }
- }
- .week_item_select {
- display: inline-block;
- vertical-align: top;
- height: 180rpx;
- width: 160rpx;
- 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-around;
- .tag_fill {
- border-radius: 6rpx;
- background-color: $title;
- padding: 5rpx 20rpx;
- .tag_text {
- font-size: 28rpx;
- color: #FFF;
- }
- }
- ._title {
- font-size: 36rpx;
- color: $title;
- }
- ._day {
- margin-top: -10rpx;
- font-size: 50rpx;
- font-weight: bold;
- color: $title;
- }
- }
- }
- }
- .class_list {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- margin: 0 20rpx 20rpx 20rpx;
- .class_item {
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- margin: 10rpx 0;
- padding: 10rpx;
- height: 100rpx;
- background-color: $page-color;
- border-radius: $border-radius;
- 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;
- background-color: rgba(0, 0, 0, 0);
- background-size: auto, auto;
- background-color: #f3f4f9;
- background-size: 64px 128px;
- &_title {
- font-size: 32rpx;
- font-weight: bold;
- color: $title;
- }
- &_subtitle {
- font-size: 30rpx;
- font-weight: bold;
- color: $subtitle;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- &_detail {
- margin-left: 40rpx;
- line-height: 30rpx;
- font-size: 26rpx;
- font-weight: bold;
- color: $subtitle;
- }
- }
- }
- .flex_cloumn {
- margin: 140rpx 0 0 50rpx;
- height: 170rpx;
- justify-content: space-around;
- .content_title {
- font-size: 35rpx;
- font-weight: bold;
- transform: skew(-15deg);
- color: #FFF;
- z-index: 2;
- }
- .content_subtitle {
- font-size: 35rpx;
- color: #FFF;
- z-index: 2;
- }
- }
- .detail_image1 {
- width: 500rpx;
- height: 600rpx;
- background-size: 100%;
- background-repeat: no-repeat;
- z-index: 51;
- }
- </style>
|