|
|
@ -12,9 +12,9 @@ |
|
|
<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.week}}</text> |
|
|
<text>{{v.week}}</text> |
|
|
|
|
|
|
|
|
<text :class="[filteredData.schedule_date == v.date ? 'today':'']">{{today == v.date ? '今':v.today}}</text> |
|
|
<text :class="[filteredData.course_date == v.date ? 'today':'']">{{today == v.date ? '今':v.today}}</text> |
|
|
|
|
|
|
|
|
<text :class="[v.status == 2 ?'select_plan':'']"></text> |
|
|
<text :class="[v.is_sign == 1 ? 'select_plan':'']"></text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="btn" @click="show_calendar=true"> |
|
|
<view class="btn" @click="show_calendar=true"> |
|
|
@ -24,10 +24,10 @@ |
|
|
|
|
|
|
|
|
<view class="section_2"> |
|
|
<view class="section_2"> |
|
|
<view class="item_box"> |
|
|
<view class="item_box"> |
|
|
{{venuesInfo.name}} |
|
|
<text v-if="(venuesInfo.id || '')">{{venuesInfo.venue_name}}</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="item_box" style="text-align: right;color: #F59A23;" @click="more"> |
|
|
<view class="item_box" style="text-align: right;color: #F59A23;" @click="more"> |
|
|
更多 |
|
|
更多场馆 |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
</view> |
|
|
</view> |
|
|
@ -43,29 +43,31 @@ |
|
|
<view v-for="(v,k) in tableList" :key="k" class="li" @click="openViewCourseInfo(v)"> |
|
|
<view v-for="(v,k) in tableList" :key="k" class="li" @click="openViewCourseInfo(v)"> |
|
|
<view class="top_box"> |
|
|
<view class="top_box"> |
|
|
<view class="center_box"> |
|
|
<view class="center_box"> |
|
|
<view>班级:{{v.classes_name}}</view> |
|
|
<view>教练:{{v.courseScheduleHasOne.coach.name}}</view> |
|
|
<view>时间:{{v.date}}</view> |
|
|
<view>课程:{{v.courseScheduleHasOne.course.course_name}}</view> |
|
|
<view>课室:{{v.address}}</view> |
|
|
<view>时间:{{v.course_date}}</view> |
|
|
<view>课程:{{v.courses_name}}</view> |
|
|
<view>课室:{{v.courseScheduleHasOne.campus_name}} {{v.courseScheduleHasOne.venue.venue_name}}</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="right_box"> |
|
|
<view class="right_box"> |
|
|
<!-- v.status|1=未开始,2=进行中,3=已结束--> |
|
|
<!-- v.status|1=未开始,2=进行中,3=已结束--> |
|
|
<view class="tag" :style="{background: v.status == 1 ? '#1cd188' : v.status == 2 ? '#fad24e' : '#ff4d4f'}"> |
|
|
<view class="tag" |
|
|
{{ v.status === 1 ? '未开始' : v.status === 2 ? '上课中' : '已结束' }} |
|
|
v-if="v.status != null" |
|
|
|
|
|
:style="{background: v.status == 1 ? '#1cd188' : v.status == 2 ? '#fad24e' : '#ff4d4f'}"> |
|
|
|
|
|
{{ v.status == 0 ? '待上课' : v.status == 1 ? '已上课' : '请假' }} |
|
|
</view> |
|
|
</view> |
|
|
<!-- <view class="tag" style="background:#1cd188;">待上课</view>--> |
|
|
<!-- <view class="tag" style="background:#1cd188;">待上课</view>--> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="bottom_box"> |
|
|
<view class="bottom_box"> |
|
|
<view class="hint"> |
|
|
<view class="hint"> |
|
|
已签到学生 ({{v.sign_list.length }}/{{v.max_students.split(',').length }}) |
|
|
<!-- 已签到学生 ({{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="(item,index) in v.sign_list || 0" :key="index"> |
|
|
<!-- <view class="itme" v-for="(item,index) in v.sign_list || 0" :key="index">--> |
|
|
<image :src="$util.img(item.header)"></image> |
|
|
<!-- <image :src="$util.img(item.header)"></image>--> |
|
|
</view> |
|
|
<!-- </view>--> |
|
|
</view> |
|
|
<!-- </view>--> |
|
|
<view class="btn"> |
|
|
<view class="btn"> |
|
|
详情 |
|
|
详情 |
|
|
</view> |
|
|
</view> |
|
|
@ -99,6 +101,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
|
|
|
import apiRoute from '@/api/apiRoute.js'; |
|
|
import memberApi from '@/api/member.js'; |
|
|
import memberApi from '@/api/member.js'; |
|
|
import commonApi from '@/api/common.js'; |
|
|
import commonApi from '@/api/common.js'; |
|
|
import AQTabber from "@/components/AQ/AQTabber.vue" |
|
|
import AQTabber from "@/components/AQ/AQTabber.vue" |
|
|
@ -114,17 +117,20 @@ export default { |
|
|
lowerThreshold: 100,//距离底部多远触发 |
|
|
lowerThreshold: 100,//距离底部多远触发 |
|
|
isReachedBottom: false,//防止重复加载|true=不可加载|false=可加载 |
|
|
isReachedBottom: false,//防止重复加载|true=不可加载|false=可加载 |
|
|
|
|
|
|
|
|
|
|
|
memberInfo:{},//当前登录的学生详情 |
|
|
|
|
|
|
|
|
//筛选条件 |
|
|
//筛选条件 |
|
|
filteredData: { |
|
|
filteredData: { |
|
|
page: 1,//当前页码 |
|
|
page: 1,//当前页码 |
|
|
limit: 10,//每页返回数据条数 |
|
|
limit: 10,//每页返回数据条数 |
|
|
total: 10,//数据总条数 |
|
|
total: 10,//数据总条数 |
|
|
schedule_date: '',//日期 |
|
|
resources_id:'',//客户资源表id |
|
|
|
|
|
course_date: '',//上课日期 |
|
|
venue_id: '',//场地id |
|
|
venue_id: '',//场地id |
|
|
}, |
|
|
}, |
|
|
tableList: [],//表格数据 |
|
|
tableList: [],//表格数据 |
|
|
|
|
|
|
|
|
venuesInfo: {},//场地信息 |
|
|
venuesInfo: {id:''},//场地信息 |
|
|
|
|
|
|
|
|
//今日日期 |
|
|
//今日日期 |
|
|
today: '', |
|
|
today: '', |
|
|
@ -134,7 +140,16 @@ export default { |
|
|
show_calendar:false,//是否展示日期 |
|
|
show_calendar:false,//是否展示日期 |
|
|
startDate:'',//开始日期 |
|
|
startDate:'',//开始日期 |
|
|
endDate:'',//结束日期 |
|
|
endDate:'',//结束日期 |
|
|
calendarSelected: [],//日历打点 |
|
|
calendarSelected: [ |
|
|
|
|
|
// { |
|
|
|
|
|
// date: '2025-04-07',//需要上课的日期 |
|
|
|
|
|
// }, |
|
|
|
|
|
// { |
|
|
|
|
|
// date: '2025-04-09',//需要上课的日期 |
|
|
|
|
|
// }, |
|
|
|
|
|
],//日历打点(有课的日期) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onLoad(options) { |
|
|
onLoad(options) { |
|
|
@ -148,27 +163,58 @@ export default { |
|
|
//下拉刷新 |
|
|
//下拉刷新 |
|
|
async onPullDownRefresh() { |
|
|
async onPullDownRefresh() { |
|
|
//重置为第一页 |
|
|
//重置为第一页 |
|
|
let schedule_date = this.filteredData.schedule_date |
|
|
let course_date = this.filteredData.course_date |
|
|
await this.loadData() |
|
|
await this.loadData() |
|
|
this.filteredData.schedule_date = schedule_date |
|
|
this.filteredData.course_date = course_date |
|
|
await this.getList() |
|
|
await this.getList() |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
//初始化 |
|
|
//初始化 |
|
|
async init() { |
|
|
async init() { |
|
|
await this.getThisDate() |
|
|
await this.getMemberInfo()//获取当前登录的学生信息 |
|
|
await this.getHeadDate() |
|
|
await this.getThisDate()//获取当前日期 |
|
|
await this.getList() |
|
|
await this.getList()//获取列表 |
|
|
|
|
|
await this.getHeadDate()//获取课程头日期 |
|
|
|
|
|
|
|
|
this.getDateRange() |
|
|
this.getDateRange()//获取日期范围 |
|
|
this.setCalendarSelected() |
|
|
this.setCalendarSelected()//设置日期打点 |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取当前登录的学生信息 |
|
|
|
|
|
async getMemberInfo() { |
|
|
|
|
|
let res = await apiRoute.xy_memberInfo({}) |
|
|
|
|
|
if(res.code != 1){ |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: res.msg, |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.memberInfo = res.data |
|
|
|
|
|
this.filteredData.resources_id = res.data.id |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
//获取课程头日期 |
|
|
//获取课程头日期 |
|
|
async getHeadDate() { |
|
|
async getHeadDate() { |
|
|
let res = await commonApi.getDate() |
|
|
// 计算开始日期:从今天往前推2天 |
|
|
|
|
|
let startDate = new Date(); |
|
|
|
|
|
startDate.setDate(startDate.getDate() - 2); |
|
|
|
|
|
let start_date = startDate.toISOString().split('T')[0]; |
|
|
|
|
|
|
|
|
|
|
|
// 计算结束日期:从今天往后推4天 |
|
|
|
|
|
let endDate = new Date(); |
|
|
|
|
|
endDate.setDate(endDate.getDate() + 4); |
|
|
|
|
|
let end_date = endDate.toISOString().split('T')[0]; |
|
|
|
|
|
|
|
|
|
|
|
let params = { |
|
|
|
|
|
resources_id: this.memberInfo.id, // 客户资源ID |
|
|
|
|
|
start_date: start_date, // 开始日期(Y-m-d) |
|
|
|
|
|
end_date: end_date, // 结束日期(Y-m-d) |
|
|
|
|
|
} |
|
|
|
|
|
let res = await apiRoute.xy_personCourseScheduleGetCalendar(params) |
|
|
if (res.code != 1) { |
|
|
if (res.code != 1) { |
|
|
//提示 |
|
|
//提示 |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
@ -180,12 +226,12 @@ export default { |
|
|
|
|
|
|
|
|
this.dateList = [] |
|
|
this.dateList = [] |
|
|
res.data.forEach((v, k) => { |
|
|
res.data.forEach((v, k) => { |
|
|
let today = v.date.split("-")[2]; // "09" |
|
|
|
|
|
this.dateList.push({ |
|
|
this.dateList.push({ |
|
|
date: v.date, |
|
|
date: v.date, |
|
|
status: v.status,//1是正常 2请假 |
|
|
status: v.status,//1是正常 2请假 |
|
|
week: v.week, |
|
|
week: v.week, |
|
|
today: today, |
|
|
today: v.today, |
|
|
|
|
|
is_sign: v.is_sign, |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
@ -206,15 +252,15 @@ export default { |
|
|
|
|
|
|
|
|
let res = `${year}-${month}-${day}`; // 格式化日期 |
|
|
let res = `${year}-${month}-${day}`; // 格式化日期 |
|
|
this.today = res; |
|
|
this.today = res; |
|
|
this.filteredData.schedule_date = res; |
|
|
this.filteredData.course_date = res; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//加载更过(下一页) |
|
|
//加载更过(下一页) |
|
|
loadMoreData() { |
|
|
async loadMoreData() { |
|
|
//判断是否加载 |
|
|
//判断是否加载 |
|
|
if (!this.isReachedBottom) { |
|
|
if (!this.isReachedBottom) { |
|
|
this.isReachedBottom = true;//设置为不可请求状态 |
|
|
this.isReachedBottom = true;//设置为不可请求状态 |
|
|
this.getList(); |
|
|
await this.getList(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
//重置为第一页 |
|
|
//重置为第一页 |
|
|
@ -230,6 +276,9 @@ export default { |
|
|
this.loading = true |
|
|
this.loading = true |
|
|
|
|
|
|
|
|
let data = {...this.filteredData} |
|
|
let data = {...this.filteredData} |
|
|
|
|
|
if(this.filteredData.page == 1){ |
|
|
|
|
|
this.tableList = [] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//判断是否还有数据 |
|
|
//判断是否还有数据 |
|
|
if ((this.filteredData.page - 1) * this.filteredData.limit >= this.filteredData.total) { |
|
|
if ((this.filteredData.page - 1) * this.filteredData.limit >= this.filteredData.total) { |
|
|
@ -241,7 +290,7 @@ export default { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let res = await memberApi.courseList(data) |
|
|
let res = await apiRoute.xy_personCourseSchedule(data) |
|
|
this.loading = false |
|
|
this.loading = false |
|
|
this.isReachedBottom = false; |
|
|
this.isReachedBottom = false; |
|
|
if (res.code != 1) { |
|
|
if (res.code != 1) { |
|
|
@ -252,18 +301,19 @@ export default { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.tableList = res.data.list.data |
|
|
this.tableList = this.tableList.concat(res.data.data); // 使用 concat 方法 将新数据追加到数组中 |
|
|
|
|
|
|
|
|
//场地信息 |
|
|
//场地信息 |
|
|
this.venuesInfo = res.data.venues_info |
|
|
this.venuesInfo = res.data.venues_info |
|
|
|
|
|
|
|
|
this.filteredData.total = res.data.list.total |
|
|
this.filteredData.total = res.data.total |
|
|
this.filteredData.page++ |
|
|
this.filteredData.page++ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//选择日期 |
|
|
//选择日期 |
|
|
async selectDate(date) { |
|
|
async selectDate(date) { |
|
|
this.loadData() |
|
|
this.loadData() |
|
|
this.filteredData.schedule_date = date |
|
|
this.filteredData.course_date = date |
|
|
this.getList() |
|
|
this.getList() |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
@ -296,25 +346,43 @@ export default { |
|
|
//设置日期打点 |
|
|
//设置日期打点 |
|
|
async setCalendarSelected(){ |
|
|
async setCalendarSelected(){ |
|
|
//获取当前月份 |
|
|
//获取当前月份 |
|
|
let month = new Date().getMonth() + 1; |
|
|
const today = new Date(); // 获取当前日期 |
|
|
|
|
|
const year = today.getFullYear(); // 获取年份 |
|
|
|
|
|
const month = today.getMonth(); // 获取月份(0-11) |
|
|
|
|
|
|
|
|
let res = await commonApi.getMonthDate({month:month}) |
|
|
// 计算本月第一天 |
|
|
if (res.code != 1){ |
|
|
const firstDay = new Date(year, month, 1); |
|
|
//提示 |
|
|
// 计算本月最后一天(下个月的第一天减去1天) |
|
|
uni.showToast({ |
|
|
const lastDay = new Date(year, month + 1, 0); |
|
|
title: res.msg, |
|
|
|
|
|
icon: 'none', |
|
|
// 格式化日期为 YYYY-MM-DD |
|
|
duration: 2000 |
|
|
const formatDate = (date) => { |
|
|
}) |
|
|
const y = date.getFullYear(); |
|
|
return |
|
|
const m = String(date.getMonth() + 1).padStart(2, '0'); // 月份补零 |
|
|
|
|
|
const d = String(date.getDate()).padStart(2, '0'); // 日期补零 |
|
|
|
|
|
return `${y}-${m}-${d}`; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
let start_date = formatDate(firstDay); // 本月第一天 |
|
|
|
|
|
let end_date = formatDate(lastDay); // 本月最后一天 |
|
|
|
|
|
|
|
|
|
|
|
let params = { |
|
|
|
|
|
resources_id: this.memberInfo.id, // 客户资源ID |
|
|
|
|
|
start_date: start_date, // 开始日期(Y-m-d) |
|
|
|
|
|
end_date: end_date, // 结束日期(Y-m-d) |
|
|
} |
|
|
} |
|
|
|
|
|
let res = await apiRoute.xy_personCourseScheduleGetCalendar(params) |
|
|
|
|
|
|
|
|
this.calendarSelected = [] |
|
|
this.calendarSelected = [] |
|
|
res.data.forEach((v,k)=>{ |
|
|
res.data.forEach((v,k)=>{ |
|
|
this.calendarSelected.push({ |
|
|
if(v.is_sign == 1){ |
|
|
date: v.date, |
|
|
this.calendarSelected.push({ |
|
|
}) |
|
|
date: v.date, |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.calendarSelected = [ |
|
|
// this.calendarSelected = [ |
|
|
// { |
|
|
// { |
|
|
// date: '2025-04-07', |
|
|
// date: '2025-04-07', |
|
|
@ -334,23 +402,24 @@ export default { |
|
|
console.log('日历',e) |
|
|
console.log('日历',e) |
|
|
this.show_calendar = false |
|
|
this.show_calendar = false |
|
|
this.loadData() |
|
|
this.loadData() |
|
|
this.filteredData.schedule_date = e.fulldate |
|
|
this.filteredData.course_date = e.fulldate |
|
|
this.getList() |
|
|
this.getList() |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//打开课表详情页 |
|
|
//打开课表详情页 |
|
|
openViewCourseInfo(item) { |
|
|
openViewCourseInfo(item) { |
|
|
|
|
|
let person_course_schedule_id = item.id |
|
|
uni.navigateTo({ |
|
|
uni.navigateTo({ |
|
|
url: `/pages/student/timetable/info?id=${item.id}` |
|
|
url: `/pages/student/timetable/info?person_course_schedule_id=${person_course_schedule_id}` |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
//体育馆列表 |
|
|
//体育馆列表 |
|
|
more() { |
|
|
more() { |
|
|
let schedule_date = this.filteredData.schedule_date |
|
|
let course_date = this.filteredData.course_date |
|
|
let venue_id = this.venuesInfo.id//当前场馆id |
|
|
let venue_id = this.venuesInfo.id || ''//当前场馆id |
|
|
uni.navigateTo({ |
|
|
uni.navigateTo({ |
|
|
url: `/pages/student/timetable/list?schedule_date=${schedule_date}&venue_id=${venue_id}` |
|
|
url: `/pages/student/timetable/list?course_date=${course_date}&venue_id=${venue_id}` |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -443,8 +512,8 @@ export default { |
|
|
padding: 0 20rpx ; |
|
|
padding: 0 20rpx ; |
|
|
color: #fff; |
|
|
color: #fff; |
|
|
display: flex; |
|
|
display: flex; |
|
|
|
|
|
justify-content: space-between; |
|
|
align-items: center; |
|
|
align-items: center; |
|
|
gap: 20rpx; |
|
|
|
|
|
.item_box { |
|
|
.item_box { |
|
|
width: 45%; |
|
|
width: 45%; |
|
|
.fui-filter__item { |
|
|
.fui-filter__item { |
|
|
|