diff --git a/api/apiRoute.js b/api/apiRoute.js index 90fc535..749a5a7 100644 --- a/api/apiRoute.js +++ b/api/apiRoute.js @@ -539,6 +539,41 @@ export default { }) }, + //学生端-学生课程安排-获取学生排课的全部场地列表 + xy_personCourseScheduleGetMyCoach(data = {}) { + let url = '/xy/personCourseSchedule/getMyCoach' + return http.get(url, data).then(res => { + return res; + }) + }, + + //学生端-学生课程安排-获取学生课程消耗记录列表 + xy_personCourseScheduleGetStudentCourseUsageList(data = {}) { + let url = '/xy/personCourseSchedule/getStudentCourseUsageList' + return http.get(url, data).then(res => { + return res; + }) + }, + + //学生端-获取作业列表 + xy_assignment(data = {}) { + let url = '/xy/assignment' + return http.get(url, data).then(res => { + return res; + }) + }, + + //学生端-提交作业 + xy_assignmentSubmitObj(data = {}) { + let url = '/xy/assignment/submitObj' + return http.get(url, data).then(res => { + return res; + }) + }, + + + + diff --git a/pages.json b/pages.json index e4795b8..063c1d3 100644 --- a/pages.json +++ b/pages.json @@ -36,6 +36,15 @@ "navigationBarTextStyle": "white" } }, + { + "path": "pages/student/my/my_coach", + "style": { + "navigationBarTitleText": "我的教练", + "navigationStyle": "default", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" + } + }, { "path": "pages/student/login/forgot", diff --git a/pages/student/index/index.vue b/pages/student/index/index.vue index e09ee43..09eaf39 100644 --- a/pages/student/index/index.vue +++ b/pages/student/index/index.vue @@ -76,37 +76,48 @@ - - 12/23 - - 已完成 - - + + + + + + - + - {{v.coach_name}} + {{v.student.name}} 上传 - 时间:{{v.create_time}} - - + 时间:{{$util.formatToDateTime(v.created_at, "Y-m-d H:i")}} + 类型:{{v.content_type == 1 ? '图片' : (v.content_type == 2 ? '视频':'文本')}} + + {{v.description}} + - - - - - + + + 描述:{{v.description}} + + + + + + + + 作业内容:{{ v.content_text }} + + + @@ -138,32 +149,14 @@ //上传接口地址 uploadApiUrl: ``, - uploadImageApiUrl: `${Api_url}/file/image`, - uploadVideoApiUrl: `${Api_url}/file/video`, + uploadImageApiUrl: `${Api_url}/memberUploadImage`,//图片上传接口 + uploadVideoApiUrl: `${Api_url}/memberUploadVideo`,//视频上传接口 member_info: {},//学生信息 assignmentsList: [],//作业列表 jobAssignmentsInfo: [],//待完成的作业 - memberIndexData:{ - tx:{//体测信息 - height: '', // 身高(单位:米) - weight: '', // 体重(单位:公斤) - score: '', // 综合评分 - create_time: '' // 体测时间 - }, - kcyg: { // 课程预告信息 - id: '', // 课程ID - date_time: "", // 课程日期 - time_slot: "", // 课程时间段 - address: "", // 课程地点 - courses_name: "", // 课程名称 - date_md: "", // 课程日期(月/日格式) - weekday: "" // 课程星期 - } - },//首页数据 - path_arr:{ '1':'/pages/coach/home/index',//教练 '2':'/pages/market/index/index',//销售 @@ -194,7 +187,6 @@ await this.member_init() await this.getPhysicalTestList() await this.getPersonCourseScheduleList() - this.getMemberIndex() this.getList() this.getJobAssignmentsInfo() }, @@ -248,64 +240,15 @@ } }, - - - async openViewHome_COPY(){ - //获取当前页面路径 - let pages = getCurrentPages(); - //当前页面路径 - this.thisPath = '/' + pages[0].route - //获取缓存用户登陆类型 - let userType = String(uni.getStorageSync('userType')) - - this.openPath = this.path_arr[userType] - - console.log( - '跳转', - this.thisPath, - userType, - this.path_arr[userType] - ) - if(this.thisPath != this.openPath){ - console.log('打印1') - //跳转tabBar首页-页面 - uni.setStorageSync('tabBerIndex', 0) - uni.navigateTo({ - url: this.openPath - }) - return - }else{ - //页面正确的情况下->执行学生页面初始化 - this.init() - } - }, - - async getMemberIndex(){ - let res = await memberApi.memberIndex({}) - if(res.code != 1){ - uni.showToast({ - title: res.msg, - icon: 'none' - }) - return - } - // console.log('首页',res) - - if(res.data.kcyg.time_slot){ - res.data.kcyg.time_slot = res.data.kcyg.time_slot.split(','); - } - - this.memberIndexData = res.data - }, - //获取作业列表 async getList(){ let data = { page: 1, limit: 10, - status: '2',//1=未提交,2=已提交,3=已批改 + resources_id: this.member_info.id, + status: '3',//1待批改 2未提交 3已提交 } - let res = await memberApi.assignmentsList(data) + let res = await apiRoute.xy_assignment(data) if(res.code != 1){ uni.showToast({ title: res.msg, @@ -322,9 +265,10 @@ let data = { page: 1, limit: 1, - status: '1',//1=未提交,2=已提交,3=已批改 + resources_id: this.member_info.id, + status: '2',//状态 1待批改 2未提交 3已提交 } - let res = await memberApi.assignmentsList(data) + let res = await apiRoute.xy_assignment(data) if(res.code != 1){ uni.showToast({ title: res.msg, @@ -373,15 +317,15 @@ // 上传作业 async submitJob(item) { - let type = item.content_type // 作业类型1图片2视频 + let type = item.content_type // 作业类型1图片2视频3文本 try { // 等待上传文件的返回结果 let uploadRes = await this.uploadFile(type) - // console.log('上传结果', uploadRes) + console.log('上传结果', uploadRes) // 检查上传结果 - if (!uploadRes.data.path) { + if (!uploadRes.data.url) { return } @@ -389,22 +333,28 @@ let data = { id: item.id, // 作业列表id student_file: uploadRes.data.path, // 附件 - student_file_type: type, // 作业类型1图片2视频 - student_content: '', // 内容 + resources_id:this.member_info.id, // 学生资源id + content_text:uploadRes.data.url } // 提交作业 await this.assignmentsSubmit(data) } catch (error) { console.error('上传或提交作业失败:', error) - alert('上传或提交作业失败') + //alert('上传或提交作业失败') + //提示 + uni.showToast({ + title: '上传或提交作业失败', + icon: 'none' + }) } }, -// 上传单文件(视频/图片) type=作业类型1图片2视频 +// 上传单文件(视频/图片) type=作业类型1图片2视频3文本 async uploadFile(type) { return new Promise((resolve, reject) => { if (type == 1) { + //图片作业 this.uploadApiUrl = this.uploadImageApiUrl uni.chooseImage({ count: 1, @@ -424,7 +374,8 @@ reject(error) } }) - } else { + } else if(type == 2){ + //视频作业 this.uploadApiUrl = this.uploadVideoApiUrl uni.chooseVideo({ count: 1, @@ -493,12 +444,11 @@ // 提交作业接口 async assignmentsSubmit(item) { let data = { - id: item.id, // 作业列表id - student_file: item.student_file, // 附件 - student_file_type: item.student_file_type, // 作业类型1图片2视频 - student_content: item.student_content, // 内容 + resources_id:item.resources_id, // 学生资源id + id:item.id, + content_text:item.content_text } - let res = await memberApi.assignmentsSubmit(data) + let res = await apiRoute.xy_assignmentSubmitObj(data) if (res.code != 1) { uni.showToast({ title: res.msg, @@ -569,6 +519,7 @@ } .multi-line-ellipsis { + width: 100%; color: #fff; padding: 5rpx 10rpx; display: -webkit-box; @@ -779,7 +730,7 @@ .after-class-con { width: 92%; - height: 246rpx; + //height: 246rpx; background-color: #404045; border-radius: 20rpx; margin: 15rpx auto; @@ -791,9 +742,11 @@ display: flex; justify-content: space-between; padding: 20rpx; - height: 95%; width: 100%; align-content: space-around; + .description{ + color: #fff; + } } .pic { @@ -801,4 +754,32 @@ height: 144rpx; border-radius: 50%; } + + .item{ + padding: 40rpx; + .box{ + color: #fff; + display: flex; + flex-direction: column; + .description{ + } + .content_box{ + width: 100%; + margin: auto; + margin-top: 20rpx; + border-radius: 15rpx; + .video{ + width: 100%; + border-radius: 15rpx; + } + .image{ + width: 100%; + border-radius: 15rpx; + } + .text{ + color: #fff; + } + } + } + } \ No newline at end of file diff --git a/pages/student/index/job_list.vue b/pages/student/index/job_list.vue index e46ba6e..c334388 100644 --- a/pages/student/index/job_list.vue +++ b/pages/student/index/job_list.vue @@ -13,24 +13,25 @@ > - - - + + + + {{v.content_text}} - 时间:{{v.create_time}} + 时间:{{v.created_at}} - + - + {{v.type == 1 ? '班级作业' : '个人作业'}} @@ -44,6 +45,7 @@ \ No newline at end of file