Browse Source

接口

master
李双庆 10 months ago
parent
commit
168a7bf6cc
  1. 35
      api/apiRoute.js
  2. 118
      pages/coach/class/info.vue
  3. 20
      pages/coach/course/info_list.vue
  4. 45
      pages/coach/student/info.vue
  5. 14
      pages/coach/student/physical_examination.vue

35
api/apiRoute.js

@ -143,13 +143,27 @@ export default {
//↓↓↓↓↓↓↓↓↓↓↓↓-----教练接口相关-----↓↓↓↓↓↓↓↓↓↓↓↓ //↓↓↓↓↓↓↓↓↓↓↓↓-----教练接口相关-----↓↓↓↓↓↓↓↓↓↓↓↓
//体测报告-详情
physicalTestInfo(data = {}) {
let url = '/class/physicalTest/info'
return http.get(url, data).then(res => {
return res;
})
},
//体测报告-列表
physicalTest(data = {}) {
let url = '/class/physicalTest'
return http.get(url, data).then(res => {
return res;
})
},
//获取学员详情
jlStudentsInfo(data = {}) {
let url = '/class/jlStudentsInfo'
return http.get(url, data).then(res => {
return res;
})
},
//获取添加学员列表 //获取添加学员列表
addStudentList(data = {}) { addStudentList(data = {}) {
let url = '/course/addStudentList' let url = '/course/addStudentList'
@ -189,6 +203,13 @@ export default {
return http.get(url, data).then(res => { return http.get(url, data).then(res => {
return res; return res;
}) })
},
//获取班级课程列表
classCourseList(data = {}) {
let url = '/course/classCourseList'
return http.get(url, data).then(res => {
return res;
})
}, },
//获取课程详情 //获取课程详情
courseInfo(data = {}) { courseInfo(data = {}) {

118
pages/coach/class/info.vue

@ -74,12 +74,8 @@
<!-- 班级成员列表--> <!-- 班级成员列表-->
<view class="section_4" v-if="tabType=='1'"> <view class="section_4" v-if="tabType=='1'">
<view class="ul"> <view class="ul">
<view <view class="li" v-for="(v,k) in classInfo.classPersonnelRel" :key="k"
class="li" @click="openViewStudentInfo(v)">
v-for="(v,k) in classInfo.classPersonnelRel"
:key="k"
@click="openViewStudentInfo(v)"
>
<view class="left"> <view class="left">
<view class="box_1"> <view class="box_1">
<image class="pic" :src="$util.img(v.student.customerResources.member.headimg)"></image> <image class="pic" :src="$util.img(v.student.customerResources.member.headimg)"></image>
@ -94,11 +90,14 @@
</view> </view>
<view class="right"> <view class="right">
<view class="item"> <view class="item">
<view>{{ v.studentCoursesInfo.use_gift_hours + v.studentCoursesInfo.use_gift_hours }}</view> <view>{{ v.studentCoursesInfo.use_gift_hours + v.studentCoursesInfo.use_gift_hours }}
</view>
<view>已上课时</view> <view>已上课时</view>
</view> </view>
<view class="item"> <view class="item">
<view>{{ (v.studentCoursesInfo.total_hours + v.studentCoursesInfo.gift_hours) - (v.studentCoursesInfo.use_gift_hours + v.studentCoursesInfo.use_gift_hours) }}</view> <view>
{{ (v.studentCoursesInfo.total_hours + v.studentCoursesInfo.gift_hours) - (v.studentCoursesInfo.use_gift_hours + v.studentCoursesInfo.use_gift_hours) }}
</view>
<view>剩余课时</view> <view>剩余课时</view>
</view> </view>
</view> </view>
@ -107,42 +106,31 @@
</view> </view>
<!--课程计划--> <!--课程计划-->
<scroll-view <scroll-view v-if="tabType=='2'" class="section_5" scroll-y="true" :lower-threshold="lowerThreshold"
v-if="tabType=='2'" @scrolltolower="loadMoreData" style="height: 65vh;">
class="section_5"
scroll-y="true"
:lower-threshold="lowerThreshold"
@scrolltolower="loadMoreData"
style="height: 65vh;"
>
<view class="ul"> <view class="ul">
<view <view class="li" v-for="(v,k) in courseList" :key="k" @click="openViewCourseInfo(v)">
class="li"
v-for="(v,k) in courseList"
:key="k"
@click="openViewCourseInfo(v)"
>
<view class="top_box"> <view class="top_box">
<view class="title"> <view class="title">
课程{{v.courses_name}} 课程{{v.course.course_name}}
</view> </view>
<view class="title"> <view class="title">
时间{{v.date}} 时间{{v.course_date}}
</view> </view>
<view class="title"> <view class="title">
地点{{v.address}} 地点{{v.campus_name}}
</view> </view>
</view> </view>
<view class="bottom_box"> <view class="bottom_box">
<view class="item"> <view class="item">
<view class="left">应到学员{{v.max_students}}</view> <view class="left">应到学员{{v.student.length}}</view>
<view class="right"> <view class="right">
查看 查看
<fui-icon size="35" color="#fff" name="arrowright"></fui-icon> <fui-icon size="35" color="#fff" name="arrowright"></fui-icon>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="left">已签到学生{{v.has_sign_count}}/{{v.max_students}}</view> <view class="left">已签到学生{{v.student_courses.length}}/{{v.student.length}}</view>
<view class="right"> <view class="right">
查看 查看
<fui-icon size="35" color="#fff" name="arrowright"></fui-icon> <fui-icon size="35" color="#fff" name="arrowright"></fui-icon>
@ -157,14 +145,15 @@
<!-- </view>--> <!-- </view>-->
</view> </view>
<view class="tag" v-if="!(['1','2'].includes(String(v.status)))" style="background-color:#20CAAF;"> <view class="tag" v-if="isCourseFuture(v.student_courses[0].start_date)"
style="background-color:#20CAAF;">
未开始 未开始
</view> </view>
<view class="tag" v-if="v.status == 1" style="background-color:#fad24e;"> <view class="tag" v-if="isNowBetween(v.student_courses[0].start_date, v.student_courses[0].end_date)"
style="background-color:#fad24e;">
上课中 上课中
</view> </view>
<view class="tag" v-if="!isCourseFuture(v.student_courses[0].end_date)" style="background-color:#e2e2e2;">
<view class="tag" v-if="v.status == 2" style="background-color:#e2e2e2;">
已结束 已结束
</view> </view>
</view> </view>
@ -227,13 +216,29 @@ export default {
// member/course_list// // member/course_list//
// member/class_info//+ // member/class_info//+
this.getClassInfo() // this.getClassInfo() //
//await this.getCourseList()// await this.getCourseList() //
},
isNowBetween(start_date, end_date) {
const now = new Date();
const start = new Date(start_date);
const end = new Date(end_date);
return now >= start && now <= end;
},
isCourseFuture(courseDate) {
const courseTime = new Date(courseDate).getTime();
const nowTime = new Date().getTime();
return courseTime > nowTime;
}, },
//- //-
async getClassInfo() { async getClassInfo() {
let res = await apiRoute.jlClassInfo({class_id:this.class_id})// let res = await apiRoute.jlClassInfo({
class_id: this.class_id
}) //
if (res.code != 1) { if (res.code != 1) {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@ -266,7 +271,9 @@ export default {
//- //-
async getCourseList() { async getCourseList() {
let data = {...this.filteredData} let data = {
...this.filteredData
}
data.class_id = this.class_id data.class_id = this.class_id
console.log(12123, this.courseList) console.log(12123, this.courseList)
@ -285,7 +292,7 @@ export default {
return return
} }
let res = await memberApi.courseList(data) let res = await apiRoute.classCourseList(data)
this.loading = false this.loading = false
this.isReachedBottom = false; this.isReachedBottom = false;
if (res.code != 1) { if (res.code != 1) {
@ -297,9 +304,9 @@ export default {
} }
this.courseList = this.courseList.concat(res.data.list.data)// 使 concat this.courseList = this.courseList.concat(res.data.data) // 使 concat
this.filteredData.total = res.data.list.total this.filteredData.total = res.data.total
console.log('获取课程列表', this.courseList) console.log('获取课程列表', this.courseList)
this.filteredData.page++ this.filteredData.page++
@ -321,7 +328,7 @@ export default {
}, },
// //
openViewStudentInfo(item) { openViewStudentInfo(item) {
let students_id = item.id let students_id = item.student.id
uni.navigateTo({ uni.navigateTo({
url: `/pages/coach/student/info?students_id=${students_id}` url: `/pages/coach/student/info?students_id=${students_id}`
}) })
@ -331,7 +338,6 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.main_box { .main_box {
background: #292929; background: #292929;
} }
@ -342,6 +348,7 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background: #292929; background: #292929;
.title { .title {
padding: 40rpx 0rpx; padding: 40rpx 0rpx;
@ -372,35 +379,42 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 38rpx; gap: 38rpx;
.left { .left {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
gap: 12rpx; gap: 12rpx;
.pic { .pic {
width: 92rpx; width: 92rpx;
height: 92rpx; height: 92rpx;
border-radius: 50%; border-radius: 50%;
} }
} }
.right { .right {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12rpx; gap: 12rpx;
.item {} .item {}
} }
} }
.section_2 { .section_2 {
margin-top: 42rpx; margin-top: 42rpx;
.title_box { .title_box {
font-size: 32rpx; font-size: 32rpx;
} }
.tag_list { .tag_list {
margin-top: 26rpx; margin-top: 26rpx;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 26rpx; gap: 26rpx;
.item { .item {
padding-left: 20rpx; padding-left: 20rpx;
width: 330rpx; width: 330rpx;
@ -421,6 +435,7 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.btn_box { .btn_box {
width: 698rpx; width: 698rpx;
border-radius: 8rpx; border-radius: 8rpx;
@ -431,6 +446,7 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
overflow: hidden; overflow: hidden;
.btn { .btn {
width: 100%; width: 100%;
height: 76rpx; height: 76rpx;
@ -439,6 +455,7 @@ export default {
color: #fff; color: #fff;
font-size: 26rpx; font-size: 26rpx;
} }
.select { .select {
color: #1684fc; color: #1684fc;
background-color: #fff; background-color: #fff;
@ -450,20 +467,24 @@ export default {
// //
.section_4 { .section_4 {
margin-top: 40rpx; margin-top: 40rpx;
.ul { .ul {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10rpx; gap: 10rpx;
.li { .li {
padding: 20rpx 0; padding: 20rpx 0;
padding-bottom: 40rpx; padding-bottom: 40rpx;
border-bottom: 2px solid #D7D7D7; border-bottom: 2px solid #D7D7D7;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.left { .left {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 30rpx; gap: 30rpx;
.box_1 { .box_1 {
padding-left: 20rpx; padding-left: 20rpx;
display: flex; display: flex;
@ -471,11 +492,13 @@ export default {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: relative; position: relative;
.pic { .pic {
width: 84rpx; width: 84rpx;
height: 84rpx; height: 84rpx;
border-radius: 50%; border-radius: 50%;
} }
.tag_box { .tag_box {
position: absolute; position: absolute;
bottom: -30rpx; bottom: -30rpx;
@ -488,38 +511,46 @@ export default {
font-size: 20rpx; font-size: 20rpx;
} }
} }
.box_2 { .box_2 {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 20rpx; gap: 20rpx;
.name { .name {
font-size: 28rpx; font-size: 28rpx;
} }
.date { .date {
font-size: 24rpx; font-size: 24rpx;
} }
} }
} }
.right { .right {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 14rpx; gap: 14rpx;
.item { .item {
border: 1px solid #00E5BB; border: 1px solid #00E5BB;
border-radius: 10rpx; border-radius: 10rpx;
width: 102rpx; width: 102rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
view { view {
text-align: center; text-align: center;
height: 50rpx; height: 50rpx;
line-height: 50rpx; line-height: 50rpx;
} }
view:nth-child(1) { view:nth-child(1) {
font-size: 32rpx; font-size: 32rpx;
background-color: #fff; background-color: #fff;
color: #00e5bb; color: #00e5bb;
} }
view:nth-child(2) { view:nth-child(2) {
font-size: 20rpx; font-size: 20rpx;
background-color: #00e5bb; background-color: #00e5bb;
@ -534,10 +565,12 @@ export default {
// //
.section_5 { .section_5 {
margin-top: 36rpx; margin-top: 36rpx;
.ul { .ul {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 30rpx; gap: 30rpx;
.li { .li {
position: relative; position: relative;
border-radius: 10rpx; border-radius: 10rpx;
@ -547,15 +580,18 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.top_box { .top_box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10rpx; gap: 10rpx;
.title { .title {
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
font-size: 24rpx; font-size: 24rpx;
} }
} }
.bottom_box { .bottom_box {
padding-top: 10rpx; padding-top: 10rpx;
margin-top: 20rpx; margin-top: 20rpx;
@ -563,6 +599,7 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10rpx; gap: 10rpx;
.item { .item {
display: flex; display: flex;
align-items: center; align-items: center;
@ -572,6 +609,7 @@ export default {
font-size: 24rpx; font-size: 24rpx;
} }
} }
.tag { .tag {
position: absolute; position: absolute;
right: 0rpx; right: 0rpx;
@ -597,6 +635,4 @@ export default {
} }
</style> </style>

20
pages/coach/course/info_list.vue

@ -11,11 +11,11 @@
<view class="isbtn" @click="addStudent"> <view class="isbtn" @click="addStudent">
添加学员 添加学员
</view> </view>
<view v-if="courseInfo.status == 'ongoing'" class="tag" style="background-color: #FAD24E;">上课中 <view v-if="isNowBetween(courseInfo.student_courses[0].start_date, courseInfo.student_courses[0].end_date)" class="tag" style="background-color: #FAD24E;">上课中
</view> </view>
<view v-if="courseInfo.status == 'completed'" class="tag" style="background-color: #e2e2e2;">已结束 <view v-if="!isCourseFuture(courseInfo.student_courses[0].end_date)" class="tag" style="background-color: #e2e2e2;">已结束
</view> </view>
<view v-if="courseInfo.status == 'pending'" class="tag" style="background-color: #1cd188;">未开始 <view v-if="isCourseFuture(courseInfo.student_courses[0].start_date)" class="tag" style="background-color: #1cd188;">未开始
</view> </view>
</view> </view>
@ -190,6 +190,20 @@
this.getCourseInfo() this.getCourseInfo()
}, },
isNowBetween(start_date, end_date) {
const now = new Date();
const start = new Date(start_date);
const end = new Date(end_date);
return now >= start && now <= end;
},
isCourseFuture(courseDate) {
const courseTime = new Date(courseDate).getTime();
const nowTime = new Date().getTime();
return courseTime > nowTime;
},
//- //-
async getCourseInfo() { async getCourseInfo() {
let res = await apiRoute.courseInfo({ let res = await apiRoute.courseInfo({

45
pages/coach/student/info.vue

@ -10,23 +10,24 @@
<view class="user_section"> <view class="user_section">
<view class="box"> <view class="box">
<view class="left"> <view class="left">
<image class="pic" :src="$util.img(studentsInfo.header)"></image> <image class="pic" :src="$util.img(studentsInfo.customerResources.member.headimg)"></image>
<view class="btn_box" v-if="checkExpireTime(studentsInfo.expire_time)"> <!-- <view class="btn_box" v-if="checkExpireTime(studentsInfo.expire_time)">
<view class="btn">即将到期</view> <view class="btn">即将到期</view>
</view> </view> -->
</view> </view>
<view class="right"> <view class="right">
<view class="item"> <view class="item">
<view class="name">{{studentsInfo.name}}</view> <view class="name">{{studentsInfo.name}}</view>
<view class="age"> <view class="age">
{{studentsInfo.age}} <!-- {{formatAgeMonth(studentsInfo.age)}} -->
{{studentsInfo.customerResources.age}}
</view> </view>
</view> </view>
<!-- <view class="item">--> <!-- <view class="item">-->
<!-- <view class="title">家长姓名黄大呢</view>--> <!-- <view class="title">家长姓名黄大呢</view>-->
<!-- </view>--> <!-- </view>-->
<view class="item"> <view class="item">
<view class="title">电话{{studentsInfo.phone}}</view> <view class="title">电话{{studentsInfo.customerResources.phone_number}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -111,10 +112,10 @@
:key="k" @click="openViewPhysicalExamination(v)" :key="k" @click="openViewPhysicalExamination(v)"
> >
<view class="top"> <view class="top">
<view class="title">综合评分:{{v.score}}</view> <view class="title">综合评分:{{v.calculateChildHealthScore}}</view>
<!-- <view class="hint">打败了99%学员</view>--> <!-- <view class="hint">打败了99%学员</view>-->
</view> </view>
<view class="bottom">测试时间{{v.create_time}}</view> <view class="bottom">测试时间{{$util.formatToDateTime(v.created_at, 'Y-m-d')}}</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
@ -133,7 +134,7 @@
<script> <script>
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"
import apiRoute from '@/api/apiRoute.js';
export default { export default {
components: { components: {
@ -157,14 +158,13 @@ export default {
page:1,// page:1,//
limit:10,// limit:10,//
total:10,// total:10,//
students_id: '',//id user_id: '',//id
}, },
surveyList:[],// surveyList:[],//
} }
}, },
onLoad(options) { onLoad(options) {
this.students_id = options.students_id//id this.students_id = options.students_id//id
this.filteredData.students_id = options.students_id//id
}, },
onShow(){ onShow(){
this.init()// this.init()//
@ -174,14 +174,26 @@ export default {
async init(){ async init(){
// //
await this.getStudentsInfo() await this.getStudentsInfo()
this.getSurveyList() await this.getSurveyList()
},
formatAgeMonth(input) {
let str = String(input);
//
let [yearPart, monthPart] = str.split('.');
// 0
if (!monthPart) {
monthPart = '00';
}
// 00 0
monthPart = monthPart === '00' ? '0' : monthPart;
return `${yearPart}${monthPart}`;
}, },
// //
async getStudentsInfo(){ async getStudentsInfo(){
let data = { let data = {
students_id:this.students_id students_id:this.students_id
} }
let res = await memberApi.jlStudentsInfo(data) let res = await apiRoute.jlStudentsInfo(data)
if (res.code != 1){ if (res.code != 1){
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@ -192,7 +204,8 @@ export default {
this.studentsInfo = res.data// this.studentsInfo = res.data//
this.assignmentsList = res.data.assignments_list// this.assignmentsList = res.data.physical_test//
this.filteredData.user_id = res.data.user_id
}, },
// expire_time 5 // expire_time 5
@ -253,7 +266,7 @@ export default {
} }
//- //-
let res = await memberApi.surveyList(data) let res = await apiRoute.physicalTest(data)
this.loading = false this.loading = false
this.isReachedBottom = false; this.isReachedBottom = false;
if (res.code != 1){ if (res.code != 1){
@ -264,10 +277,10 @@ export default {
return return
} }
this.surveyList = this.surveyList.concat(res.data.list.data); // 使 concat this.surveyList = this.surveyList.concat(res.data.data); // 使 concat
console.log('列表',this.surveyList) console.log('列表',this.surveyList)
this.filteredData.total = res.data.list.total this.filteredData.total = res.data.total
this.filteredData.page++ this.filteredData.page++
}, },

14
pages/coach/student/physical_examination.vue

@ -8,34 +8,34 @@
<view class="card-con-txt1-left"> <view class="card-con-txt1-left">
<image :src="$util.img('/uniapp_src/static/images/index/score.png')" class="overlay-image"></image> <image :src="$util.img('/uniapp_src/static/images/index/score.png')" class="overlay-image"></image>
</view> </view>
<view class="card-con-txt1-left-txt">{{surveyInfo.score}}</view> <view class="card-con-txt1-left-txt">{{v.score}}</view>
<view class="card-con-txt1-left-txt top1">综合评分</view> <view class="card-con-txt1-left-txt top1">综合评分</view>
</view> </view>
<view style="height: 170rpx;"></view> <view style="height: 170rpx;"></view>
<view style="display: flex;justify-content: space-around;"> <view style="display: flex;justify-content: space-around;">
<view style="text-align: center;"> <view style="text-align: center;">
<view style="color: #AAAAAA;font-size: 30rpx;padding: 15rpx 0;">身高 (CM)</view> <view style="color: #AAAAAA;font-size: 30rpx;padding: 15rpx 0;">身高 (CM)</view>
<view style="font-size: 55rpx;color: #29d3b4;">{{surveyInfo.height}}</view> <view style="font-size: 55rpx;color: #29d3b4;">{{(v.height * 100)}}</view>
</view> </view>
<view style="text-align: center;"> <view style="text-align: center;">
<view style="color: #AAAAAA;font-size: 30rpx;padding: 15rpx 0;">体重 (KG)</view> <view style="color: #AAAAAA;font-size: 30rpx;padding: 15rpx 0;">体重 (KG)</view>
<view style="font-size: 55rpx;color: #29d3b4;">{{surveyInfo.weight}}</view> <view style="font-size: 55rpx;color: #29d3b4;">{{v.weight}}</view>
</view> </view>
</view> </view>
<view class="coach-message"> <view class="coach-message">
<view> <view>
<image :src="$util.img('/uniapp_src/static/images/index/lv.png')" class="drop-image"></image> <image :src="$util.img('/uniapp_src/static/images/index/lv.png')" class="drop-image"></image>
</view> </view>
<view style="padding: 15rpx 0 0 5rpx;line-height: 1.6;font-size: 30rpx;color: #7F7F7F;">{{surveyInfo.content}}</view> <view style="padding: 15rpx 0 0 5rpx;line-height: 1.6;font-size: 30rpx;color: #7F7F7F;">{{v.content}}</view>
</view> </view>
<!-- <view style="font-size: 45rpx;text-align: center;margin-top: 30%;">详细数据信息</view>--> <view style="font-size: 45rpx;text-align: center;margin-top: 30%;">详细数据信息</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import memberApi from '@/api/member.js'; import memberApi from '@/api/member.js';
import apiRoute from '@/api/apiRoute.js';
export default { export default {
data() { data() {
return { return {
@ -61,7 +61,7 @@ import memberApi from '@/api/member.js';
let data = { let data = {
survey_id:this.survey_id survey_id:this.survey_id
} }
let res = await memberApi.jlSurveyInfo(data) let res = await apiRoute.physicalTestInfo(data)
if(res.code != 1){ if(res.code != 1){
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,

Loading…
Cancel
Save