Browse Source

Merge branch 'master' of ssh://gitlab.frkj.cc:222/php/ZhiHuiJiaoWu_UniApp

master
王泽彦 10 months ago
parent
commit
5de5eea0e1
  1. 17
      api/apiRoute.js
  2. 179
      pages/student/timetable/index.vue
  3. 73
      pages/student/timetable/list.vue

17
api/apiRoute.js

@ -515,7 +515,7 @@ export default {
}) })
}, },
//学生端-学生课程安排-详情 //学生端-学生课程安排-修改请假状态
xy_personCourseScheduleEditStatus(data = {}) { xy_personCourseScheduleEditStatus(data = {}) {
let url = '/xy/personCourseSchedule/editStatus' let url = '/xy/personCourseSchedule/editStatus'
return http.post(url, data).then(res => { return http.post(url, data).then(res => {
@ -523,8 +523,21 @@ export default {
}) })
}, },
//学生端-学生课程安排-获取排课日历
xy_personCourseScheduleGetCalendar(data = {}) {
let url = '/xy/personCourseSchedule/getCalendar'
return http.get(url, data).then(res => {
return res;
})
},
//学生端-学生课程安排-获取学生排课的全部场地列表
xy_personCourseScheduleGetVenueListAll(data = {}) {
let url = '/xy/personCourseSchedule/getVenueListAll'
return http.get(url, data).then(res => {
return res;
})
},

179
pages/student/timetable/index.vue

@ -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 {

73
pages/student/timetable/list.vue

@ -4,11 +4,13 @@
<scroll-view scroll-y="true" :lower-threshold="lowerThreshold" <scroll-view scroll-y="true" :lower-threshold="lowerThreshold"
@scrolltolower="loadMoreData" style="height: 100vh;"> @scrolltolower="loadMoreData" style="height: 100vh;">
<view class="data_hint" v-if="!this.tableList.length">暂无更多数据</view>
<view class="main_section" v-for="(v,k) in tableList" :key="k" @click="opebViewTimetable(v)"> <view class="main_section" v-for="(v,k) in tableList" :key="k" @click="opebViewTimetable(v)">
<view class="title">{{v.name}}</view> <view class="title">{{v.campus.campus_name}} </view>
<view class="con">{{v.address}}</view> <view class="con">{{v.campus.campus_address}} {{v.venue_name}}</view>
<view class="con" v-if="v.distance === null ">无法获取定位</view> <!-- <view class="con" v-if="v.distance === null ">无法获取定位</view>-->
<view class="con" v-else-if="v.distance">距您{{v.distance}}km</view> <!-- <view class="con" v-else-if="v.distance">距您{{v.distance}}km</view>-->
<view class="current-venue" v-if="venue_id == v.id"> <view class="current-venue" v-if="venue_id == v.id">
当前场馆 当前场馆
</view> </view>
@ -20,6 +22,7 @@
</template> </template>
<script> <script>
import apiRoute from '@/api/apiRoute.js';
import memberApi from '@/api/member.js'; import memberApi from '@/api/member.js';
import AQTabber from "@/components/AQ/AQTabber.vue" import AQTabber from "@/components/AQ/AQTabber.vue"
@ -34,12 +37,15 @@
lowerThreshold: 100,// lowerThreshold: 100,//
isReachedBottom: false,//|true=|false= isReachedBottom: false,//|true=|false=
memberInfo:{id:''},//
// //
filteredData:{ filteredData:{
// page:1,// // page:1,//
// limit:10,// // limit:10,//
// total:10,// // total:10,//
schedule_date:'',// course_date:'',//
resources_id:'',//ID
}, },
tableList:[],// tableList:[],//
@ -50,9 +56,9 @@
} }
}, },
onLoad(options) { onLoad(options) {
this.filteredData.schedule_date = options.schedule_date// this.filteredData.course_date = options.course_date//
//id //id
this.venue_id = options.venue_id || '' this.venue_id = options.venue_id || ''//ID
}, },
onShow() { onShow() {
this.init()// this.init()//
@ -60,10 +66,26 @@
methods: { methods: {
// //
async init() { async init() {
await this.getUserLocation(); // await this.getUserLocation();
await this.getMemberInfo();
await this.getList(); await this.getList();
}, },
//
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 getUserLocation() { async getUserLocation() {
@ -142,16 +164,16 @@
let data = {...this.filteredData} let data = {...this.filteredData}
// //
if(this.filteredData.page * this.filteredData.limit > this.total){ // if(this.filteredData.page * this.filteredData.limit > this.total){
this.loading = false // this.loading = false
uni.showToast({ // uni.showToast({
title: '暂无更多', // title: '',
icon: 'none' // icon: 'none'
}) // })
return // return
} // }
let res = await memberApi.venuesList(data) let res = await apiRoute.xy_personCourseScheduleGetVenueListAll(data)
this.loading = false this.loading = false
this.isReachedBottom = false; this.isReachedBottom = false;
if (res.code != 1){ if (res.code != 1){
@ -165,9 +187,9 @@
this.tableList = res.data this.tableList = res.data
this.tableList.forEach((v,k)=>{ this.tableList.forEach((v,k)=>{
if(this.longitude && this.latitude && v.longitude && v.latitude){ if(this.longitude && this.latitude && (v.longitude || '') && (v.latitude || '')){
//
v.distance = this.getDistance(this.latitude, this.longitude, v.latitude, v.longitude) v.distance = this.getDistance(this.latitude, this.longitude, v.latitude, v.longitude)
}else{ }else{
v.distance = null v.distance = null
@ -175,11 +197,6 @@
}) })
console.log('列表',this.tableList) console.log('列表',this.tableList)
}, },
//- //-
@ -201,6 +218,12 @@
overflow: auto; overflow: auto;
background: #292929; background: #292929;
} }
.data_hint{
margin-top: 100rpx;
font-size: 30rpx;
text-align: center;
color: #fff;
}
.main_section{ .main_section{
width: 92%; width: 92%;
border-radius: 15rpx; border-radius: 15rpx;

Loading…
Cancel
Save