|
|
@ -10,11 +10,11 @@ |
|
|
<view class="section_1"> |
|
|
<view class="section_1"> |
|
|
<view class="ul"> |
|
|
<view class="ul"> |
|
|
<view class="li" v-for="(v,k) in dateList" :key="k" @click="selectDate(v.date)"> |
|
|
<view class="li" v-for="(v,k) in dateList" :key="k" @click="selectDate(v.date)"> |
|
|
<text>{{v.name}}</text> |
|
|
<text>{{v.week}}</text> |
|
|
|
|
|
|
|
|
<text :class="[filteredData.schedule_date == v.date ? 'today':'']">{{today == v.date ? '今':v.today}}</text> |
|
|
<text :class="[filteredData.schedule_date == v.date ? 'today':'']">{{today == v.date ? '今':v.today}}</text> |
|
|
|
|
|
|
|
|
<text :class="[today == v.date ?'select_plan':'']"></text> |
|
|
<text :class="[v.status == 2 ?'select_plan':'']"></text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -40,15 +40,14 @@ |
|
|
<view v-for="(v,k) in tableList" :key="k" class="li" @click="openViewCourseInfo({id:v.id})"> |
|
|
<view v-for="(v,k) in tableList" :key="k" class="li" @click="openViewCourseInfo({id:v.id})"> |
|
|
<view class="top_box"> |
|
|
<view class="top_box"> |
|
|
<view class="center_box"> |
|
|
<view class="center_box"> |
|
|
<view>班级:{{v.name}}</view> |
|
|
<view>班级:{{v.classes_name}}</view> |
|
|
<view>时间:{{v.start_date}} - {{$util.formatToDateTime(v.end_date,'H:i')}}</view> |
|
|
<view>时间:{{v.date}}</view> |
|
|
<view>课室:{{v.address}} |
|
|
<view>课室:{{v.address}}</view> |
|
|
</view> |
|
|
<view>课程:{{v.courses_name}}</view> |
|
|
<view>课程:{{v.courses_name}} |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
<view class="right_box"> |
|
|
<view class="right_box"> |
|
|
<view class="tag" :style="{background: v.status === 1 ? '#1cd188' : v.status === 2 ? '#fad24e' : '#ff4d4f'}"> |
|
|
<!-- v.status|1=未开始,2=进行中,3=已结束--> |
|
|
|
|
|
<view class="tag" :style="{background: v.status == 1 ? '#1cd188' : v.status == 2 ? '#fad24e' : '#ff4d4f'}"> |
|
|
{{ v.status === 1 ? '未开始' : v.status === 2 ? '上课中' : '已结束' }} |
|
|
{{ v.status === 1 ? '未开始' : v.status === 2 ? '上课中' : '已结束' }} |
|
|
</view> |
|
|
</view> |
|
|
<!-- <view class="tag" style="background:#1cd188;">待上课</view>--> |
|
|
<!-- <view class="tag" style="background:#1cd188;">待上课</view>--> |
|
|
@ -56,12 +55,12 @@ |
|
|
</view> |
|
|
</view> |
|
|
<view class="bottom_box"> |
|
|
<view class="bottom_box"> |
|
|
<view class="hint"> |
|
|
<view class="hint"> |
|
|
已签到学生 ({{v.has_sign_count }}/{{v.max_students }}) |
|
|
已签到学生 ({{v.sign_list.length }}/{{v.max_students.split(',').length }}) |
|
|
</view> |
|
|
</view> |
|
|
<view class="list_box"> |
|
|
<view class="list_box"> |
|
|
<view class="list"> |
|
|
<view class="list"> |
|
|
<view class="itme" v-for="index in parseInt(v.has_sign_count) || 0" :key="index"> |
|
|
<view class="itme" v-for="(item,index) in v.sign_list || 0" :key="index"> |
|
|
<image src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image> |
|
|
<image :src="$util.img(item.header)"></image> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="btn" @click="openViewTimetableInfo(v)"> |
|
|
<view class="btn" @click="openViewTimetableInfo(v)"> |
|
|
@ -114,7 +113,10 @@ export default { |
|
|
dateList:[]//日期列表 |
|
|
dateList:[]//日期列表 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onLoad() { |
|
|
onLoad(options) { |
|
|
|
|
|
if(options.venue_id){ |
|
|
|
|
|
this.filteredData.venue_id = options.venue_id |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
onShow() { |
|
|
onShow() { |
|
|
this.init()//初始化 |
|
|
this.init()//初始化 |
|
|
@ -123,7 +125,6 @@ export default { |
|
|
async onPullDownRefresh() { |
|
|
async onPullDownRefresh() { |
|
|
//重置为第一页 |
|
|
//重置为第一页 |
|
|
let schedule_date = this.filteredData.schedule_date |
|
|
let schedule_date = this.filteredData.schedule_date |
|
|
console.log('eee',schedule_date) |
|
|
|
|
|
await this.loadData() |
|
|
await this.loadData() |
|
|
this.filteredData.schedule_date = schedule_date |
|
|
this.filteredData.schedule_date = schedule_date |
|
|
await this.getList() |
|
|
await this.getList() |
|
|
@ -132,14 +133,42 @@ export default { |
|
|
methods: { |
|
|
methods: { |
|
|
//初始化 |
|
|
//初始化 |
|
|
async init(){ |
|
|
async init(){ |
|
|
await this.getDate() |
|
|
await this.getThisDate() |
|
|
|
|
|
await this.getHeadDate() |
|
|
await this.getList() |
|
|
await this.getList() |
|
|
await this.getDateList(); // 获取日期列表 |
|
|
// await this.getDateList(); // 获取日期列表 |
|
|
console.log(1111,this.dateList) |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//获取课程头日期 |
|
|
|
|
|
async getHeadDate() { |
|
|
|
|
|
let res = await memberApi.getDate() |
|
|
|
|
|
if (res.code != 1){ |
|
|
|
|
|
//提示 |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: res.msg, |
|
|
|
|
|
icon: 'none', |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.dateList = [] |
|
|
|
|
|
res.data.forEach((v,k)=>{ |
|
|
|
|
|
let today = v.date.split("-")[2]; // "09" |
|
|
|
|
|
this.dateList.push({ |
|
|
|
|
|
date: v.date, |
|
|
|
|
|
status: v.status,//1是正常 2请假 |
|
|
|
|
|
week: v.week, |
|
|
|
|
|
today: today, |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('xxx',res) |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//获取当前日期 |
|
|
//获取当前日期 |
|
|
async getDate() { |
|
|
async getThisDate() { |
|
|
let date = new Date(); |
|
|
let date = new Date(); |
|
|
let year = date.getFullYear(); |
|
|
let year = date.getFullYear(); |
|
|
let month = String(date.getMonth() + 1).padStart(2, '0'); // 月份前补零 |
|
|
let month = String(date.getMonth() + 1).padStart(2, '0'); // 月份前补零 |
|
|
@ -152,39 +181,6 @@ export default { |
|
|
this.today = res; |
|
|
this.today = res; |
|
|
this.filteredData.schedule_date = res; |
|
|
this.filteredData.schedule_date = res; |
|
|
}, |
|
|
}, |
|
|
// 获取日期列表 |
|
|
|
|
|
async getDateList() { |
|
|
|
|
|
const days = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; |
|
|
|
|
|
const dateList = []; |
|
|
|
|
|
const today = new Date(); // 获取当前日期 |
|
|
|
|
|
|
|
|
|
|
|
// 获取前2天和后4天的日期 |
|
|
|
|
|
for (let i = -2; i <= 4; i++) { |
|
|
|
|
|
const date = new Date(today); |
|
|
|
|
|
date.setDate(today.getDate() + i); // 计算日期 |
|
|
|
|
|
let dayOfWeek = days[date.getDay()]; // 获取星期几 |
|
|
|
|
|
let formattedDateArr = this.formatDate(date); // 格式化日期 |
|
|
|
|
|
let formattedDate = `${formattedDateArr[0]}-${formattedDateArr[1]}-${formattedDateArr[2]}`; // 格式化日期 |
|
|
|
|
|
|
|
|
|
|
|
dateList.push({ |
|
|
|
|
|
name: dayOfWeek, |
|
|
|
|
|
date: formattedDate, |
|
|
|
|
|
today: formattedDateArr[2],//日 |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.dateList = dateList |
|
|
|
|
|
}, |
|
|
|
|
|
// 格式化日期为 YYYY-MM-DD |
|
|
|
|
|
formatDate(date) { |
|
|
|
|
|
const year = date.getFullYear(); |
|
|
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0'); |
|
|
|
|
|
const day = String(date.getDate()).padStart(2, '0'); |
|
|
|
|
|
return [ |
|
|
|
|
|
year, month, day |
|
|
|
|
|
] |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//加载更过(下一页) |
|
|
//加载更过(下一页) |
|
|
loadMoreData() { |
|
|
loadMoreData() { |
|
|
@ -197,13 +193,10 @@ export default { |
|
|
//重置为第一页 |
|
|
//重置为第一页 |
|
|
async loadData() { |
|
|
async loadData() { |
|
|
this.isReachedBottom = false; // 重置状态,以便下次触发加载更多 |
|
|
this.isReachedBottom = false; // 重置状态,以便下次触发加载更多 |
|
|
this.filteredData = { |
|
|
|
|
|
page:1,//当前页码 |
|
|
this.filteredData.page = 1//当前页码 |
|
|
limit:10,//每页返回数据条数 |
|
|
this.filteredData.limit = 10//每页返回数据条数 |
|
|
total:10,//数据总条数 |
|
|
this.filteredData.total = 10//数据总条数 |
|
|
schedule_date:'',//日期 |
|
|
|
|
|
venue_id:'',//场地id |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
//获取列表 |
|
|
//获取列表 |
|
|
async getList(){ |
|
|
async getList(){ |
|
|
@ -251,8 +244,9 @@ export default { |
|
|
|
|
|
|
|
|
//打开课表详情页 |
|
|
//打开课表详情页 |
|
|
openViewTimetableInfo(item){ |
|
|
openViewTimetableInfo(item){ |
|
|
|
|
|
// courses_id=课程id |
|
|
uni.navigateTo({ |
|
|
uni.navigateTo({ |
|
|
url: `/pages/student/timetable/info?id=${item.id}` |
|
|
url: `/pages/student/timetable/info?id=${item.courses_id}` |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
//体育馆列表 |
|
|
//体育馆列表 |
|
|
|