Browse Source

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

master
王泽彦 9 months ago
parent
commit
dcfeaf0e95
  1. 273
      pages/coach/course/info_list.vue
  2. 161
      pages/coach/home/index.vue

273
pages/coach/course/info_list.vue

@ -12,11 +12,11 @@
<view class="isbtn" @click="addStudent">
添加学员
</view>
<view v-if="isNowBetween(courseInfo.student_courses[0].start_date, courseInfo.student_courses[0].end_date)" class="tag" style="background-color: #FAD24E;">上课中
<view v-if="courseInfo.student_courses[0] && isNowBetween(courseInfo.student_courses[0].start_date, courseInfo.student_courses[0].end_date)" class="tag" style="background-color: #FAD24E;">上课中
</view>
<view v-if="!isCourseFuture(courseInfo.student_courses[0].end_date)" class="tag" style="background-color: #e2e2e2;">已结束
<view v-if="courseInfo.student_courses[0] && !isCourseFuture(courseInfo.student_courses[0].end_date)" class="tag" style="background-color: #e2e2e2;">已结束
</view>
<view v-if="isCourseFuture(courseInfo.student_courses[0].start_date)" class="tag" style="background-color: #1cd188;">未开始
<view v-if="courseInfo.student_courses[0] && isCourseFuture(courseInfo.student_courses[0].start_date)" class="tag" style="background-color: #1cd188;">未开始
</view>
</view>
@ -35,6 +35,10 @@
<image class="pic" model="aspectFit" :src="$util.img(v.avatar)"></image>
<view class="box">
<view class="title">{{v.name}}</view>
<view class="title">来源{{v.source}}</view>
<view class="title">一访情况{{v['school_six_speed'].first_visit_time}}</view>
<view class="title">一访时间{{v['school_six_speed'].first_visit_status}}</view>
<view class="title">课程截止时间{{v.end_date}}</view>
</view>
</view>
@ -209,59 +213,60 @@
//-
async getCourseInfo() {
// let res = await apiRoute.courseInfo({
// id: this.course_id
// })
// if (res.code != 1) {
// uni.showToast({
// title: res.msg,
// icon: 'none'
// })
// return
// }
// this.courseInfo = res.data
// console.log('', this.courseInfo)
let res = await apiRoute.courseInfo({
id: this.course_id
})
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
console.log('课程详情', res.data)
this.courseInfo = res.data
// 使
this.courseInfo = {
id: this.course_id || '1',
course_date: '2025-07-25',
time_slot: '14:00-15:30',
status: 'pending',
venue: {
venue_name: '总部校区 305教室',
capacity: 20
},
course: {
course_name: '少儿英语基础班'
},
coach: {
name: '王教练'
},
student_courses: [
{
student_id: '1001',
name: '张三',
avatar: '',
start_date: '2025-07-25',
end_date: '2025-10-25',
status: 'pending'
},
{
student_id: '1002',
name: '李四',
avatar: '',
start_date: '2025-07-25',
end_date: '2025-10-25',
status: 'pending'
}
],
groupedByStatus1: [], //
groupedByStatus2: [], //
groupedByStatus3: [] //
};
console.log('课程详情(模拟数据)', this.courseInfo);
// 使
// this.courseInfo = {
// id: this.course_id || '1',
// course_date: '2025-07-25',
// time_slot: '14:00-15:30',
// status: 'pending',
// venue: {
// venue_name: ' 305',
// capacity: 20
// },
// course: {
// course_name: ''
// },
// coach: {
// name: ''
// },
// student_courses: [
// {
// student_id: '1001',
// name: '',
// avatar: '',
// start_date: '2025-07-25',
// end_date: '2025-10-25',
// status: 'pending'
// },
// {
// student_id: '1002',
// name: '',
// avatar: '',
// start_date: '2025-07-25',
// end_date: '2025-10-25',
// status: 'pending'
// }
// ],
// groupedByStatus1: [], //
// groupedByStatus2: [], //
// groupedByStatus3: [] //
// };
// console.log('()', this.courseInfo);
},
//
@ -292,97 +297,97 @@
//
async addStudent() {
// let res = await apiRoute.addStudentList({
// id: this.course_id
// })
// if (res.code != 1) {
// uni.showToast({
// title: res.msg,
// icon: 'none'
// })
// return
// }
// this.StudentList = res.data
// if (this.StudentList.length == 0) {
// uni.showToast({
// title: '',
// icon: 'none'
// })
// return
// } else {
// this.show = true
// }
let res = await apiRoute.addStudentList({
id: this.course_id
})
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.StudentList = res.data
if (this.StudentList.length == 0) {
uni.showToast({
title: '暂无可填加的学员',
icon: 'none'
})
return
} else {
this.show = true
}
// 使
this.StudentList = [
{
text: '张三',
value: '1001'
},
{
text: '李四',
value: '1002'
},
{
text: '王五',
value: '1003'
},
{
text: '赵六',
value: '1004'
},
{
text: '钱七',
value: '1005'
}
];
this.show = true;
// this.StudentList = [
// {
// text: '',
// value: '1001'
// },
// {
// text: '',
// value: '1002'
// },
// {
// text: '',
// value: '1003'
// },
// {
// text: '',
// value: '1004'
// },
// {
// text: '',
// value: '1005'
// }
// ];
// this.show = true;
},
async change(e) {
this.show = false
// let res = await apiRoute.addStudent({
// student_id: e.value,
// schedule_id: this.course_id,
// time_slot: this.courseInfo.time_slot,
// course_date: this.courseInfo.course_date
// })
// if (res.code != 1) {
// uni.showToast({
// title: res.msg,
// icon: 'none'
// })
// return
// }
// this.init()
let res = await apiRoute.addStudent({
student_id: e.value,
schedule_id: this.course_id,
time_slot: this.courseInfo.time_slot,
course_date: this.courseInfo.course_date
})
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.init()
// 使
const selectedStudent = this.StudentList.find(student => student.value === e.value);
if (!selectedStudent) return;
// const selectedStudent = this.StudentList.find(student => student.value === e.value);
// if (!selectedStudent) return;
//
if (!this.courseInfo.student_courses) {
this.courseInfo.student_courses = [];
}
// //
// if (!this.courseInfo.student_courses) {
// this.courseInfo.student_courses = [];
// }
//
const now = new Date();
const futureDate = new Date();
futureDate.setMonth(futureDate.getMonth() + 3); // 3
// //
// const now = new Date();
// const futureDate = new Date();
// futureDate.setMonth(futureDate.getMonth() + 3); // 3
//
this.courseInfo.student_courses.push({
student_id: e.value,
name: selectedStudent.text,
avatar: '', //
start_date: now.toISOString().split('T')[0],
end_date: futureDate.toISOString().split('T')[0],
status: 'pending' //
});
// //
// this.courseInfo.student_courses.push({
// student_id: e.value,
// name: selectedStudent.text,
// avatar: '', //
// start_date: now.toISOString().split('T')[0],
// end_date: futureDate.toISOString().split('T')[0],
// status: 'pending' //
// });
uni.showToast({
title: '添加学员成功',
icon: 'success'
});
// uni.showToast({
// title: '',
// icon: 'success'
// });
},
cancel() {
this.show = false

161
pages/coach/home/index.vue

@ -14,13 +14,13 @@
<!-- 上课中-->
<view class="li" v-for="(v,k) in infoData.course_list" :key="k" @click="openViewCourseInfoList(v)">
<view class="top_box">
<view class="title">课程{{ v.courses_name }}</view>
<view class="title">时间{{ v.date_time }} {{ v.time_slot.split(',')[0] }}-{{ v.time_slot.split(',')[1] }}
<view class="title">课程{{ v.course_name }}</view>
<view class="title">时间{{ v.date_time }} {{ v.time_slot }}
</view>
<view class="title">地点{{ v.address }}</view>
</view>
<view class="botton_box" v-if="v.status == 1">
<view class="botton_box" v-if="v.status == 'ongoing'">
<view class="box">
<view>已签到学生{{ v.sign_count }}/{{ v.students_count }}</view>
<view>
@ -44,15 +44,22 @@
</view>
<view
v-if="v.status == 1"
v-if="v.status == 'pending'"
class="tag"
style="background:#fad24e;">上课中
</view>
<view
v-else
class="tag"
style="background:#1cd188;">待上课
style="background:#fad24e;">待开始
</view>
<view
v-if="v.status == 'upcoming'"
class="tag"
style="background:#1cd188;">待上课
</view>
<view
v-if="v.status == 'ongoing'"
class="tag"
style="background:#fad24e;">上课中
</view>
</view>
</view>
<!-- 没有数据时的占位区域 -->
@ -73,7 +80,7 @@
</view>
<view class="ul" v-if="infoData.task_list && infoData.task_list.length > 0">
<view class="li" v-for="(v,k) in infoData.task_list" :key="k" @click="openViewWorkDetails(v)">
<view class="left_box">
<!-- <view class="left_box">
<view class="date_box">
<text>{{v.wc_count}}</text>
<text>/</text>
@ -82,11 +89,11 @@
<view class="ratio">
完成率{{v.rate}}%
</view>
</view>
</view> -->
<view class="center_box">
<view>班级{{v.class_name}}</view>
<view>时间{{v.send_time}}</view>
<view>课程{{v.courses_name}}
<view>时间{{v.create_time}}</view>
<view>课程{{v.course_name}}
</view>
</view>
<view class="right_box">
@ -114,9 +121,9 @@
<view class="service-list" v-if="serviceList && serviceList.length > 0">
<view class="service-item" v-for="(item, index) in serviceList" :key="index" @click="viewServiceDetail(item)">
<view class="service-info">
<view class="service-name">{{item.name}}</view>
<view class="service-name">{{item.service_name}}</view>
<view class="service-desc">{{item.description}}</view>
<view class="service-time">创建时间{{item.create_time}}</view>
<view class="service-time">创建时间{{item.created_at}}</view>
</view>
<view class="service-status" :class="{'active': item.status === 1}">
{{item.status === 1 ? '进行中' : '已结束'}}
@ -168,76 +175,28 @@ export default {
//
async init(){
await this.getInfo()
await this.getServiceList() //
// await this.getServiceList() //
},
//
async getInfo(){
// API使
// let res = await memberApi.jlIndex({})
// if(res.code != 1){
// uni.showToast({
// title: res.msg,
// icon: 'none'
// })
// return
// }
// this.infoData = res.data
let res = await memberApi.jlIndex({})
if(res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
let course_list = res.data.course_list
let task_list = res.data.task_list
this.serviceList = res.data.service_list
// 使
this.infoData = {
course_list: [
{
id: 1,
courses_name: '少儿英语基础班',
date_time: '2025-07-20',
time_slot: '15:30,17:00',
address: '总部校区 305教室',
status: 0,
sign_count: 0,
students_count: 15
},
{
id: 2,
courses_name: '少儿英语进阶班',
date_time: '2025-07-21',
time_slot: '14:00,15:30',
address: '西区校区 203教室',
status: 1,
sign_count: 12,
students_count: 18
},
{
id: 3,
courses_name: '少儿英语口语班',
date_time: '2025-07-22',
time_slot: '10:00,11:30',
address: '东区校区 102教室',
status: 0,
sign_count: 0,
students_count: 10
}
],
task_list: [
{
id: 1,
wc_count: 8,
student_count: 15,
rate: 53,
class_name: '英语基础1班',
send_time: '2025-07-18',
courses_name: '少儿英语基础班'
},
{
id: 2,
wc_count: 15,
student_count: 18,
rate: 83,
class_name: '英语进阶2班',
send_time: '2025-07-17',
courses_name: '少儿英语进阶班'
}
]
course_list: course_list,
task_list: task_list
}
},
@ -264,29 +223,29 @@ export default {
// }
// 使
this.serviceList = [
{
id: 1,
name: '一对一辅导服务',
description: '针对学生个人情况定制的一对一辅导计划,帮助学生快速提高成绩。',
create_time: '2025-07-15',
status: 1
},
{
id: 2,
name: '小组课程服务',
description: '3-5人小组课程,提供互动学习环境,培养学生团队协作能力。',
create_time: '2025-07-20',
status: 0
},
{
id: 3,
name: '课后辅导服务',
description: '针对课后作业和复习提供专业辅导,巩固课堂所学知识。',
create_time: '2025-07-01',
status: 1
}
]
// this.serviceList = [
// {
// id: 1,
// name: '',
// description: '',
// create_time: '2025-07-15',
// status: 1
// },
// {
// id: 2,
// name: '',
// description: '3-5',
// create_time: '2025-07-20',
// status: 0
// },
// {
// id: 3,
// name: '',
// description: '',
// create_time: '2025-07-01',
// status: 1
// }
// ]
},
//-

Loading…
Cancel
Save