于宏哲PHP 9 months ago
parent
commit
cbcf599837
  1. 273
      pages/coach/course/info_list.vue
  2. 153
      pages/coach/home/index.vue

273
pages/coach/course/info_list.vue

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

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

Loading…
Cancel
Save