|
@@ -109,23 +109,27 @@
|
|
|
<img src="../../../assets/img/riFill-calendar-todo-fill@1x.png" alt="">最近课程
|
|
|
</view>
|
|
|
<view class="course-infos">
|
|
|
- <view class="info-box" @click="gotoUrl('pages/teacher/callNames/classCall')">
|
|
|
- <view class="position today">
|
|
|
+ <view class="info-box" v-for="(item,index) in courseList" :key="index"
|
|
|
+ @click="gotoUrl('pages/parents/classSchedule/classScheduleDetails')">
|
|
|
+ <view class="position today" v-if="item.courseDate == date">
|
|
|
今
|
|
|
</view>
|
|
|
+ <view class="position tomorrow" v-if="item.courseDate == tomorrow">
|
|
|
+ 明
|
|
|
+ </view>
|
|
|
<view class="class-name">
|
|
|
- 周开琴书法班1
|
|
|
+ {{item.className}}
|
|
|
</view>
|
|
|
<view class="location-time">
|
|
|
<view class="location">
|
|
|
- 4楼6教室
|
|
|
+ {{item.classroom}}
|
|
|
</view>
|
|
|
<view class="time">
|
|
|
- 09:30-10:45
|
|
|
+ {{item.coursePeriods}}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="date">
|
|
|
- 2023.1.3
|
|
|
+ {{item.courseDate}}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="info-box info-box2">
|
|
@@ -155,14 +159,15 @@
|
|
|
<view class="recommend">
|
|
|
<view class="title">
|
|
|
<view class="title">
|
|
|
- <img src="../../../assets/img/riFill-award-fill@1x.png" alt="">最近课程
|
|
|
+ <img src="../../../assets/img/riFill-award-fill@1x.png" alt="">课程推荐
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="classify">
|
|
|
- <view class="item chosen">
|
|
|
- 全部
|
|
|
+ <view class="item" v-for="(item,index) in chosenList" :key="index"
|
|
|
+ :class="chosenActive == index ? 'chosen' : ''" @click="chosenClick(item,index)">
|
|
|
+ {{item.name}}
|
|
|
</view>
|
|
|
- <view class="item">
|
|
|
+ <!-- <view class="item">
|
|
|
精品试听
|
|
|
</view>
|
|
|
<view class="item">
|
|
@@ -170,7 +175,7 @@
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
机构推荐
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
</view>
|
|
|
|
|
|
<view class="infos-box">
|
|
@@ -273,6 +278,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import * as classScheduleApi from '@/apis/parents/classSchedule.js'
|
|
|
import * as mineApi from '@/apis/parents/mine.js'
|
|
|
import ParentsTabbar from '@/components/ParentsTabbar.vue'
|
|
|
|
|
@@ -282,6 +288,20 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ chosenList: [
|
|
|
+ {name: '全部'},
|
|
|
+ {name: '精品试听'},
|
|
|
+ {name: '为您优选'},
|
|
|
+ {name: '机构推荐'}
|
|
|
+ ],
|
|
|
+ chosenActive: 0,
|
|
|
+ date: '',
|
|
|
+ tomorrow: '',
|
|
|
+ weekDate: [],
|
|
|
+ weekN: ["一", "二", "三", "四", "五", "六", "日"],
|
|
|
+ activeClass: 0,
|
|
|
+ weekDate1: '',
|
|
|
+ courseList: [],
|
|
|
form: {
|
|
|
studentName: '',
|
|
|
headPhoto: ''
|
|
@@ -298,11 +318,86 @@
|
|
|
if(this.carhelp.getStudentId()) {
|
|
|
this.studentId = this.carhelp.getStudentId().studentId;
|
|
|
this.getStudentDetail();
|
|
|
+ this.getToday();
|
|
|
}
|
|
|
|
|
|
this.getStudentList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ chosenClick(item,index) {
|
|
|
+ this.chosenActive = index;
|
|
|
+ },
|
|
|
+ getCourseList() {
|
|
|
+ this.courseList = [];
|
|
|
+ uni.showLoading({
|
|
|
+ title: "加载中",
|
|
|
+ mask: true,
|
|
|
+ })
|
|
|
+ classScheduleApi.loadMySchedule({
|
|
|
+ studentId: this.studentId,
|
|
|
+ startDate: this.date,
|
|
|
+ endDate: this.weekDate[6].day
|
|
|
+ }).then((response) => {
|
|
|
+ uni.hideLoading();
|
|
|
+ this.courseList = response.data;
|
|
|
+ }).catch(error => {
|
|
|
+ uni.showToast({
|
|
|
+ title: error,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getToday() {
|
|
|
+ this.weekDate = [];
|
|
|
+ let date = new Date(); //当前日期
|
|
|
+ let year = date.getFullYear(); //当前年
|
|
|
+ let month = date.getMonth() + 1; //当前月
|
|
|
+ let day = date.getDate(); //当天
|
|
|
+ let mydate = new Date(year, month - 1, day);
|
|
|
+ let weekday = mydate.getDay();
|
|
|
+ this.weekDate1 = new Date(year, month - 1, day + 1 - weekday);
|
|
|
+ this.getWeekDate(true);
|
|
|
+ },
|
|
|
+ getWeekDate(bl) {
|
|
|
+ let weekDate2 = new Date(this.weekDate1.getTime());
|
|
|
+ for (var i = 0; i < 7; i++) {
|
|
|
+ for (var j = 0; j < this.weekN.length; j++) {
|
|
|
+ if (i == j) {
|
|
|
+ this.weekDate.push({
|
|
|
+ week: this.weekN[j],
|
|
|
+ day: this.getFormatDate(new Date(weekDate2.setDate(this.weekDate1.getDate() + i))),
|
|
|
+ isDotShow: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bl) {
|
|
|
+ let date = new Date(); //当前日期
|
|
|
+ date = this.getFormatDate(date);
|
|
|
+ for (var m = 0; m < this.weekDate.length; m++) {
|
|
|
+ if (date == this.weekDate[m].day) {
|
|
|
+ this.activeClass = m;
|
|
|
+ this.date = this.weekDate[m].day;
|
|
|
+ this.tomorrow = this.weekDate[m+1].day;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.getCourseList();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getFormatDate(date) {
|
|
|
+ let myyear = date.getFullYear();
|
|
|
+ let mymonth = date.getMonth() + 1;
|
|
|
+ let myweekday = date.getDate();
|
|
|
+ if (mymonth < 10) {
|
|
|
+ mymonth = "0" + mymonth;
|
|
|
+ }
|
|
|
+ if (myweekday < 10) {
|
|
|
+ myweekday = "0" + myweekday;
|
|
|
+ }
|
|
|
+
|
|
|
+ return (myyear + "-" + mymonth + "-" + myweekday);
|
|
|
+ },
|
|
|
getStudentDetail() {
|
|
|
uni.showLoading({
|
|
|
title: "加载中",
|