Browse Source

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

master
王泽彦 1 year ago
parent
commit
d70b68342e
  1. 35
      api/apiRoute.js
  2. 9
      pages.json
  3. 191
      pages/student/index/index.vue
  4. 45
      pages/student/index/job_list.vue
  5. 4
      pages/student/login/login.vue
  6. 47
      pages/student/my/lesson_consumption.vue
  7. 9
      pages/student/my/my.vue
  8. 211
      pages/student/my/my_coach.vue

35
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;
})
},

9
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",

191
pages/student/index/index.vue

@ -76,36 +76,47 @@
<view class="after-class-con" v-for="(v,k) in jobAssignmentsInfo" :key="k" @click="openViewWorkDetails(v)">
<view class="after-class-con-txt">
<view style="width: 25%;margin-top: 5%;">
<view style="font-size: 55rpx;color: #fff;"><span style="color: #29d3b4;">12</span>/23
</view>
<view style="font-size: 35rpx;color: #ccc;padding-left: 10rpx;">已完成</view>
</view>
<view style="width: 70%;">
<!-- <view style="width: 25%;margin-top: 5%;">-->
<!-- <view style="font-size: 55rpx;color: #fff;"><span style="color: #29d3b4;">12</span>/23-->
<!-- </view>-->
<!-- <view style="font-size: 35rpx;color: #ccc;padding-left: 10rpx;">已完成</view>-->
<!-- </view>-->
<view style="width: 100%;">
<view style="color: #fff;display: flex;justify-content: space-between;align-items: center;">
<view style="display: flex;align-items: center;">
<image :src="$util.img(v.coach_pic)" style="width: 50rpx;height: 50rpx;">
<image :src="v.student.customerResources.member.headimg ? v.student.customerResources.member.headimg : $util.img('/uniapp_src/static/images/common/yong_hu.png')" style="width: 50rpx;height: 50rpx;">
</image>
<span style="padding-left: 10rpx;font-size: 35rpx;">{{v.coach_name}}</span>
<span style="padding-left: 10rpx;font-size: 35rpx;">{{v.student.name}}</span>
</view>
<view>
<fui-button background="#404045" color="#F59A23" borderColor="#F59A23"
btnSize="mini" @click="submitJob(v)">上传</fui-button>
</view>
</view>
<view style="color: #fff;padding: 10rpx;">时间:{{v.create_time}}</view>
<view class="multi-line-ellipsis" v-html="v.content_text">
<view style="color: #fff;padding: 10rpx;">时间:{{$util.formatToDateTime(v.created_at, "Y-m-d H:i")}}</view>
<view style="color: #fff;padding: 10rpx;">类型:{{v.content_type == 1 ? '图片' : (v.content_type == 2 ? '视频':'文本')}}</view>
<view class="description">
{{v.description}}
</view>
</view>
</view>
</view>
<!-- 已提交的作业列表-->
<view class="item" v-for="(v,k) in assignmentsList" :key="k" @click="openViewWorkDetails(v)">
<view class="multi-line-ellipsis text-style" v-html="v.content_text"></view>
<view style="width: 92%;margin: auto;border-radius: 15rpx;" v-if="v.student_file">
<video v-if="v.student_file_type == 2" style="width: 100%;border-radius: 15rpx;" :src="$util.img(v.student_file)"></video>
<image v-else style="width: 100%;border-radius: 15rpx;" :src="$util.img(v.student_file)" mode="aspectFit"></image>
<view class="box">
<view class="description">
描述:{{v.description}}
</view>
<view class="content_box" v-if="v.content_text">
<video class="video" v-if="v.content_type == 2" :src="v.content_text"></video>
<image class="image" v-else-if="v.content_type == 1" :src="v.content_text" mode="aspectFit"></image>
<view class="text" v-else-if="v.content_type == 3" >作业内容:{{ v.content_text }}</view>
</view>
</view>
</view>
@ -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;
}
}
}
}
</style>

45
pages/student/index/job_list.vue

@ -13,24 +13,25 @@
>
<view class="con-list" v-for="(v,k) in tableList" :key="k" @click="openViewWorkDetails(v)">
<view class="con-list-img" v-if="v.student_file">
<video v-if="v.student_file_type == 2" class="pic" style="width: 100%;border-radius: 15rpx;" :src="$util.img(v.student_file)"></video>
<image v-else style="width: 100%;border-radius: 15rpx;" :src="$util.img(v.student_file)" mode="aspectFit"></image>
<view class="con-list-img" v-if="v.content_text">
<video v-if="v.content_type == 2" class="pic" style="width: 100%;border-radius: 15rpx;" :src="$util.img(v.content_text)"></video>
<image v-else-if="v.content_type == 1" style="width: 100%;border-radius: 15rpx;" :src="$util.img(v.content_text)" mode="aspectFit"></image>
<view class="text" v-else>{{v.content_text}}</view>
</view>
<view class="date_box">
<view class="describe" style="margin-top: 20rpx;">
时间:{{v.create_time}}
时间:{{v.created_at}}
</view>
<!--是否已经完成作业-->
<view class="mark" v-if="v.status == 2">
<view class="mark" v-if="v.status == 3">
<image class="check_mark" :src="$util.img('/uniapp_src/static/images/index/check_mark.png')"></image>
</view>
</view>
<!--作业描述-->
<view class="con" style="margin-bottom: 20rpx; color:#fff;" v-html="v.content_text"></view>
<view class="con" style="margin-bottom: 20rpx; color:#fff;" v-html="v.description"></view>
<view class="assignment">
<view>{{v.type == 1 ? '班级作业' : '个人作业'}}</view>
@ -44,6 +45,7 @@
</template>
<script>
import apiRoute from '@/api/apiRoute.js';
import memberApi from '@/api/member.js';
export default {
@ -58,11 +60,14 @@ import memberApi from '@/api/member.js';
page:1,//当前页码
limit:10,//每页返回数据条数
total:10,//数据总条数
status: '',//1=未提交,2=已提交,3=已批改
resources_id: '',//学生资源id
status: '',//状态 1待批改 2未提交 3已提交
},
tableList:[],//表格数据
member_info:{},//学生信息
}
},
onShow(){
@ -77,9 +82,25 @@ import memberApi from '@/api/member.js';
methods: {
//初始化
async init(){
await this.memberInit()
await this.getList();
},
//获取学员信息
async memberInit() {
let res = await apiRoute.xy_memberInfo({})
if(res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.member_info = res.data
this.filteredData.resources_id = this.member_info.id,//学生资源id
console.log('xxxx',this.member_info)
},
//加载更多(下一页)
loadMoreData() {
//判断是否加载
@ -117,7 +138,7 @@ import memberApi from '@/api/member.js';
this.tableList = []
}
let res = await memberApi.assignmentsList(data)
let res = await apiRoute.xy_assignment(data)
this.loading = false
this.isReachedBottom = false;
if (res.code != 1){
@ -192,7 +213,6 @@ import memberApi from '@/api/member.js';
}
.con-list-img{
width: 100%;
height: 280rpx;
display: flex;
align-items: center;
justify-content: center;
@ -205,6 +225,13 @@ import memberApi from '@/api/member.js';
width: 100%;
height: 280rpx;
}
.text{
width: 100%;
font-size: 28rpx;
color:#fff;
white-space: pre-wrap;
word-wrap: break-word;
}
}
.pic{

4
pages/student/login/login.vue

@ -277,8 +277,8 @@ export default {
this.password1= '123123' //密码
}else{
//学生端
this.user= '15335526445' //账户
this.password1= '123123' //密码
this.user= '13042409890' //账户
this.password1= '13042409890' //密码
}
},

47
pages/student/my/lesson_consumption.vue

@ -2,27 +2,23 @@
<template>
<view class="assemble">
<view style="height: 50rpx;"></view>
<view class="ul">
<view class="message_box" v-if="!tableList.length">
暂无更多数据
</view>
<view class="ul" v-if="tableList.length">
<view class="li" v-for="(v,k) in tableList" :key="k">
<view class="left">
<view class="title">{{v.name}}</view>
<view class="date">上课时间:{{v.create_time}}</view>
<view class="date">课程使用日期:{{v.usage_date}}</view>
</view>
<view class="right">
<view
v-if="v.status == 1"
class="btn"
style="background-color: #29d3b4;"
>
{{v.hour}}课时
</view>
<view
v-if="v.status == 2"
class="btn"
style="background-color: #FAD04D;"
>
请假
{{v.usage_date}}课时
</view>
</view>
</view>
@ -31,7 +27,7 @@
</template>
<script>
import memberApi from '@/api/member.js';
import apiRoute from '@/api/apiRoute.js';
export default {
data() {
@ -45,9 +41,12 @@ import memberApi from '@/api/member.js';
page:1,//当前页码
limit:10,//每页返回数据条数
total:10,//数据总条数
resources_id:'',//学生资源表id
},
tableList:[],//表格数据
memberInfo:{},//当前登录的学生资源信息
}
},
onLoad(options) {
@ -65,9 +64,24 @@ import memberApi from '@/api/member.js';
methods: {
//初始化
async init(){
await this.getMemberInfo()//获取当前登录的学生信息
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
},
//加载更多(下一页)
loadMoreData() {
//判断是否加载
@ -105,7 +119,7 @@ import memberApi from '@/api/member.js';
this.tableList = []
}
let res = await memberApi.studentsSignList(data)
let res = await apiRoute.xy_personCourseScheduleGetStudentCourseUsageList(data)
this.loading = false
this.isReachedBottom = false;
if (res.code != 1){
@ -128,6 +142,11 @@ import memberApi from '@/api/member.js';
</script>
<style lang="less" scoped>
.message_box{
font-size: 30rpx;
text-align: center;
color: #fff;
}
.assemble {
width: 100%;
height: 100vh;

9
pages/student/my/my.vue

@ -64,7 +64,7 @@
<view class="section_box">
<view class="item">
<view>我的教练</view>
<view @click="openViewMyCoach()">我的教练</view>
<view></view>
</view>
<!-- <view class="item">-->
@ -160,6 +160,13 @@
url: `/pages/common/my_message`
})
},
//跳转页面-我的教练
openViewMyCoach(){
uni.navigateTo({
url: `/pages/student/my/my_coach`
})
},
}
}
</script>

211
pages/student/my/my_coach.vue

@ -0,0 +1,211 @@
<!--我的教练-列表-->
<template>
<view class="main_box">
<scroll-view scroll-y="true" :lower-threshold="lowerThreshold"
@scrolltolower="loadMoreData" style="height: 100%;padding-top:50rpx;padding-bottom: 50rpx">
<!-- <view class="data_hint" v-if="!this.tableList.length">暂无更多数据</view>-->
<view class="main_section" v-for="(v,k) in tableList" :key="k">
<view class="left">
<!-- 头像-->
<image :src="v.head_img ? v.head_img : $util.img('/uniapp_src/static/images/common/yong_hu.png')" class="pic"></image>
</view>
<view class="right">
<view class="title">姓名:{{v.name}}</view>
<view class="title">电话:{{v.phone}}</view>
</view>
</view>
</scroll-view>
<!-- 加载状态-->
<!-- <fui-loading :isFixed="true" srcCol="/static/icon-img/loading_white.png" text="正在加载..." v-if="loading"></fui-loading>-->
</view>
</template>
<script>
import apiRoute from '@/api/apiRoute.js';
import memberApi from '@/api/member.js';
import AQTabber from "@/components/AQ/AQTabber.vue"
export default {
components: {
AQTabber,
},
data() {
return {
loading:false,//加载状态
lowerThreshold: 100,//距离底部多远触发
isReachedBottom: false,//防止重复加载|true=不可加载|false=可加载
memberInfo:{id:''},//客户资源信息
//筛选条件
filteredData:{
page:1,//当前页码
limit:10,//每页返回数据条数
total:10,//数据总条数
resources_id:'',//学生资源表id
},
tableList:[],//表格数据
}
},
onLoad(options) {},
onShow() {
this.init()//初始化
},
//下拉刷新
async onPullDownRefresh() {
//重置为第一页
await this.resetFilteredData()
await this.getList()
},
methods: {
//初始化
async init() {
await this.getMemberInfo();
await this.getList();
},
//重置为第一页
async resetFilteredData() {
this.isReachedBottom = false; // 重置状态,以便下次触发加载更多
this.filteredData.page = 1//当前页码
this.filteredData.limit = 10//每页返回数据条数
this.filteredData.total = 10//数据总条数
},
//获取当前登录的学生信息
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
},
//加载更多(下一页)
loadMoreData() {
return //本页面无需下一页
//判断是否加载
if (!this.isReachedBottom) {
this.isReachedBottom = true;//设置为不可请求状态
this.getList();
}
},
//重置为第一页
loadData() {
setTimeout(() => {
this.isReachedBottom = false; // 重置状态,以便下次触发加载更多
}, 1000);
},
//获取教练列表
async getList(){
this.loading = true
let data = {...this.filteredData}
//判断是否还有数据
if ((this.filteredData.page - 1) * this.filteredData.limit >= this.filteredData.total) {
this.loading = false
uni.showToast({
title: '暂无更多',
icon: 'none'
})
return
}
if(data.page == 1){
this.tableList = []
}
let res = await apiRoute.xy_personCourseScheduleGetMyCoach(data)
this.loading = false
this.isReachedBottom = false;
if (res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.tableList = this.tableList.concat(res.data.data); // 使用 concat 方法 将新数据追加到数组中
console.log('列表',this.tableList)
this.filteredData.total = res.data.total
this.filteredData.page++
},
}
}
</script>
<style lang="less" scoped>
.main_box {
width: 100%;
height: 100%;
overflow: auto;
background: #292929;
}
.data_hint{
margin-top: 100rpx;
font-size: 30rpx;
text-align: center;
color: #fff;
}
.main_section{
width: 92%;
border-radius: 15rpx;
background-color: #404045;
margin: 20rpx auto;
padding: 30rpx;
color: #fff;
display: flex;
align-items: center;
.left{
display: flex;
flex-direction: column;
align-items: center;
.pic{
width: 100rpx;
height: 100rpx;
border-radius: 50%;
}
}
.right{
margin-left: 20rpx;
display: flex;
flex-direction: column;
gap: 20rpx;
}
}
.title{
font-size: 32rpx;
}
.con{
color: #D7D7D7;
font-size: 26rpx;
margin-top: 20rpx;
}
.current-venue{
border-radius: 8rpx;
border: 2rpx #F59A23 solid;
width: 120rpx;
text-align: center;
color: #F59A23;
position: absolute;
top: 10%;
right: 3%;
}
</style>
Loading…
Cancel
Save