Compare commits
2 Commits
4720e60dff
...
d40c61efd2
Author | SHA1 | Date | |
---|---|---|---|
d40c61efd2 | |||
15e1a31e7b |
@ -1,396 +1,389 @@
|
||||
<template>
|
||||
<view class="page flex-col">
|
||||
<view class="box_1 flex-col justify-end">
|
||||
<view class="page flex-col">
|
||||
<view class="box_1 flex-col justify-end">
|
||||
|
||||
|
||||
<view class="box_7 flex-row justify-between">
|
||||
<view class="image-text_1 flex-row justify-between">
|
||||
<view class="group_1 flex-col">
|
||||
<view class="image-wrapper_2 flex-col">
|
||||
<image
|
||||
class="image_2"
|
||||
referrerpolicy="no-referrer"
|
||||
:src="selfInfo && selfInfo.avatar ? imageUrl + '/' + selfInfo.avatar : '/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG185e54e3ffd47170ac4e6e5108c9a54f.png'"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-group_1 flex-col justify-between">
|
||||
<view v-if="selfInfo.nickname" class="text_3">{{ selfInfo.nickname }}</view>
|
||||
<view v-if="selfInfo.username" class="text_3">{{ selfInfo.username }}</view>
|
||||
<view v-else @click="toLogin()" class="text_2">登录/注册</view>
|
||||
<text v-if="!selfInfo.username" class="text_3">登录将开启全部服务</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="image-text_2 flex-col justify-between" @click="toMyQrCode()">
|
||||
<image
|
||||
class="label_1"
|
||||
referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG7e67772393591f7c5436c0b59f7b3b17.png"
|
||||
/>
|
||||
<text class="text-group_2">学车码</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="box_8 flex-row">
|
||||
<view class="image-wrapper_3 flex-col justify-center">
|
||||
<image
|
||||
class="label_2"
|
||||
referrerpolicy="no-referrer"
|
||||
:src="coachDetails && coachDetails.image ? imageUrl + '/' + coachDetails.image : '/static/lanhu_gerenzhongxin/FigmaDDSSlicePNGa95a4d1d98d08b238a3082514eefafd0.png'"
|
||||
/>
|
||||
</view>
|
||||
<view class="text-group_3 flex-col justify-between">
|
||||
<text class="text_4" v-if="coachDetails.name != null">{{ coachDetails.name }}</text>
|
||||
<text class="text_111" v-else> 暂无教练信息</text>
|
||||
<view class="text-wrapper_1" v-if="coachDetails.seniority != null">
|
||||
<text class="text_5">教龄:</text>
|
||||
<text class="text_6">{{ coachDetails.seniority }}</text>
|
||||
<text class="text_7">年</text>
|
||||
</view>
|
||||
<view class="box_7 flex-row justify-between">
|
||||
<view class="image-text_1 flex-row justify-between">
|
||||
<view class="group_1 flex-col">
|
||||
<view class="image-wrapper_2 flex-col">
|
||||
<image class="image_2" referrerpolicy="no-referrer"
|
||||
:src="selfInfo && selfInfo.avatar ? imageUrl + '/' + selfInfo.avatar : '/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG185e54e3ffd47170ac4e6e5108c9a54f.png'" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-group_1 flex-col justify-between">
|
||||
<view v-if="selfInfo.nickname" class="text_3">{{ selfInfo.nickname }}</view>
|
||||
<view v-if="selfInfo.username" class="text_3">{{ selfInfo.username }}</view>
|
||||
<view v-else @click="toLogin()" class="text_2">登录/注册</view>
|
||||
<text v-if="!selfInfo.username" class="text_3">登录将开启全部服务</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="image-text_2 flex-col justify-between" @click="toMyQrCode()">
|
||||
<image class="label_1" referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG7e67772393591f7c5436c0b59f7b3b17.png" />
|
||||
<text class="text-group_2">学车码</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="box_8 flex-row">
|
||||
<view class="image-wrapper_3 flex-col justify-center">
|
||||
<image class="label_2" referrerpolicy="no-referrer"
|
||||
:src="coachDetails && coachDetails.image ? imageUrl + '/' + coachDetails.image : '/static/lanhu_gerenzhongxin/FigmaDDSSlicePNGa95a4d1d98d08b238a3082514eefafd0.png'" />
|
||||
</view>
|
||||
<view class="text-group_3 flex-col justify-between">
|
||||
<text class="text_4" v-if="coachDetails.name != null">{{ coachDetails.name }}</text>
|
||||
<text class="text_111" v-else> 暂无教练信息</text>
|
||||
<view class="text-wrapper_1" v-if="coachDetails.seniority != null">
|
||||
<text class="text_5">教龄:</text>
|
||||
<text class="text_6">{{ coachDetails.seniority }}</text>
|
||||
<text class="text_7">年</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<!-- <view class="text-wrapper_2" v-if="coachDetails">
|
||||
</view>
|
||||
<!-- <view class="text-wrapper_2" v-if="coachDetails">
|
||||
<text class="text_8">学员数:</text>
|
||||
<text class="text_9">{{}}</text>
|
||||
</view>
|
||||
<view class="text-wrapper_2" v-else>
|
||||
<text class="text_8">暂无数据</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="box_9 flex-col">
|
||||
<view class="block_1 flex-col">
|
||||
<text class="text_10">我的订单</text>
|
||||
<view class="list_1 flex-row">
|
||||
<view
|
||||
class="image-text_3 flex-col justify-between"
|
||||
v-for="(item, index) in loopData"
|
||||
:key="index"
|
||||
@click="toOrderPage(item.orderType,item.type)"
|
||||
>
|
||||
<image
|
||||
class="label_3"
|
||||
referrerpolicy="no-referrer"
|
||||
:src="item.url"
|
||||
/>
|
||||
<text class="text-group_4" v-text="item.text"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="box_9 flex-col">
|
||||
<view class="block_1 flex-col">
|
||||
<text class="text_10">我的订单</text>
|
||||
<view class="list_1 flex-row">
|
||||
<view class="image-text_3 flex-col justify-between" v-for="(item, index) in loopData" :key="index"
|
||||
@click="toOrderPage(item.orderType,item.type)">
|
||||
<image class="label_3" referrerpolicy="no-referrer" :src="item.url" />
|
||||
<text class="text-group_4" v-text="item.text"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-list">
|
||||
<!-- 个人信息 -->
|
||||
<view class="menu-item" @click="goMyInDetails()">
|
||||
<image class="menu-icon" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG1bb0cdc369203c305a42d848736e8f01.png" />
|
||||
<text class="menu-text">个人信息</text>
|
||||
<image class="menu-arrow" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG4f20daae79bb7c60189f8702897465d1.png" />
|
||||
</view>
|
||||
|
||||
<!-- <view class="menu-item">
|
||||
<view class="menu-list">
|
||||
<!-- 个人信息 -->
|
||||
<view class="menu-item" @click="goMyInDetails()">
|
||||
<image class="menu-icon"
|
||||
src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG1bb0cdc369203c305a42d848736e8f01.png" />
|
||||
<text class="menu-text">个人信息</text>
|
||||
<image class="menu-arrow"
|
||||
src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG4f20daae79bb7c60189f8702897465d1.png" />
|
||||
</view>
|
||||
|
||||
<!-- <view class="menu-item">
|
||||
<button open-type="contact" class="menu-item-btn">
|
||||
<image class="menu-icon" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNGb5e90b5b4c1f154eb4e27313164118a4.png" />
|
||||
<text class="menu-text">在线客服</text>
|
||||
<image class="menu-arrow" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG4f20daae79bb7c60189f8702897465d1.png" />
|
||||
</button></view> -->
|
||||
|
||||
<!-- 消息中心 -->
|
||||
<view class="menu-item" @click="goFeedback">
|
||||
<image class="menu-icon" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNGa728895586dafec1bde5f90c89d05c48.png" />
|
||||
<text class="menu-text">消息中心</text>
|
||||
<text class="message-num" v-if="noReadNum > 0">{{ noReadNum }}</text>
|
||||
<image class="menu-arrow" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG4f20daae79bb7c60189f8702897465d1.png" />
|
||||
</view>
|
||||
|
||||
<!-- 消息中心 -->
|
||||
<view class="menu-item" @click="goFeedback">
|
||||
<image class="menu-icon"
|
||||
src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNGa728895586dafec1bde5f90c89d05c48.png" />
|
||||
<text class="menu-text">消息中心</text>
|
||||
<text class="message-num" v-if="noReadNum > 0">{{ noReadNum }}</text>
|
||||
<image class="menu-arrow"
|
||||
src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG4f20daae79bb7c60189f8702897465d1.png" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <tabbar :msg='msg'></tabbar> -->
|
||||
<u-popup round="20" :show="showQrCode" @close="closeQrCode" mode="center" zoom="false" @open="openQrCode">
|
||||
<view style="padding: 50rpx 50rpx 20rpx 50rpx">
|
||||
<canvas id="qrcode" canvas-id="qrcode" style="width: 300rpx;height: 300rpx"/>
|
||||
</view>
|
||||
<span style="text-align: center;margin-bottom: 20rpx;">学车码</span>
|
||||
</u-popup>
|
||||
</view>
|
||||
|
||||
<!-- <tabbar :msg='msg'></tabbar> -->
|
||||
<u-popup round="20" :show="showQrCode" @close="closeQrCode" mode="center" zoom="false" @open="openQrCode">
|
||||
<view style="padding: 50rpx 50rpx 20rpx 50rpx">
|
||||
<canvas id="qrcode" canvas-id="qrcode" style="width: 300rpx;height: 300rpx" />
|
||||
</view>
|
||||
<span style="text-align: center;margin-bottom: 20rpx;">学车码</span>
|
||||
</u-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import headers from '../../components/header/headers.vue'
|
||||
import tabbar from '../../components/tabbar/tabbar.vue'
|
||||
import request from '@/utils/request.js'
|
||||
import UQRCode from 'uqrcodejs';
|
||||
import {
|
||||
getLocalUserInfo,
|
||||
getToken,
|
||||
setLocalUserInfo
|
||||
} from '@/utils/auth'
|
||||
import headers from '../../components/header/headers.vue'
|
||||
import tabbar from '../../components/tabbar/tabbar.vue'
|
||||
import request from '@/utils/request.js'
|
||||
import UQRCode from 'uqrcodejs';
|
||||
import {
|
||||
getLocalUserInfo,
|
||||
getToken,
|
||||
setLocalUserInfo
|
||||
} from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
msg: "3",
|
||||
selfInfo: {},
|
||||
selfInfoLocal: {},
|
||||
coachDetails: {},
|
||||
userDetails: {},
|
||||
orderList: {},
|
||||
processList: {},
|
||||
showQrCode: false,
|
||||
isCreateQrCode:true,
|
||||
noReadNum:0,
|
||||
rpxUnit: 2,
|
||||
loopData: [
|
||||
{
|
||||
url: '/static/myImgs/alreadyPaid.png',
|
||||
text: '已付款',
|
||||
orderType: '2',
|
||||
type: '2',
|
||||
},
|
||||
{
|
||||
url: '/static/myImgs/alreadyInterviewed.png',
|
||||
text: '已面签',
|
||||
orderType: '4',
|
||||
type: '3',
|
||||
},
|
||||
{
|
||||
url: '/static/myImgs/registered.png',
|
||||
text: '已报名',
|
||||
orderType: '2',
|
||||
type: '4',
|
||||
},
|
||||
{
|
||||
url: '/static/myImgs/allOrder.png',
|
||||
text: '全部订单',
|
||||
orderType: '',
|
||||
type: '1',
|
||||
}
|
||||
],
|
||||
constants: {},
|
||||
imageUrl: this.$imagesUrl,
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.selfInfoLocal = getLocalUserInfo()
|
||||
this.getUserInfo()
|
||||
this.systemInfo()
|
||||
|
||||
},
|
||||
onShow() {
|
||||
if (getToken()) {
|
||||
this.selfInfoLocal = getLocalUserInfo()
|
||||
this.getUserInfo()
|
||||
this.systemInfo()
|
||||
}
|
||||
data() {
|
||||
return {
|
||||
msg: "3",
|
||||
selfInfo: {},
|
||||
selfInfoLocal: {},
|
||||
coachDetails: {},
|
||||
userDetails: {},
|
||||
orderList: {},
|
||||
processList: {},
|
||||
showQrCode: false,
|
||||
isCreateQrCode: true,
|
||||
noReadNum: 0,
|
||||
rpxUnit: 2,
|
||||
loopData: [{
|
||||
url: '/static/myImgs/alreadyPaid.png',
|
||||
text: '已付款',
|
||||
orderType: '2',
|
||||
type: '2',
|
||||
},
|
||||
{
|
||||
url: '/static/myImgs/alreadyInterviewed.png',
|
||||
text: '已面签',
|
||||
orderType: '4',
|
||||
type: '3',
|
||||
},
|
||||
{
|
||||
url: '/static/myImgs/registered.png',
|
||||
text: '已报名',
|
||||
orderType: '2',
|
||||
type: '4',
|
||||
},
|
||||
{
|
||||
url: '/static/myImgs/allOrder.png',
|
||||
text: '全部订单',
|
||||
orderType: '',
|
||||
type: '1',
|
||||
}
|
||||
],
|
||||
constants: {},
|
||||
imageUrl: this.$imagesUrl,
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
console.log('userInfo', getLocalUserInfo())
|
||||
console.log('myToken', getToken())
|
||||
this.selfInfoLocal = getLocalUserInfo()
|
||||
this.getUserInfo()
|
||||
this.systemInfo()
|
||||
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
console.log("刷新");
|
||||
uni.stopPullDownRefresh()
|
||||
this.getUserInfo()
|
||||
},
|
||||
onReachBottom() {
|
||||
// this.show = true
|
||||
setTimeout(() => {
|
||||
console.log("加载执行");
|
||||
}, 2000)
|
||||
},
|
||||
components: {
|
||||
headers,
|
||||
tabbar
|
||||
},
|
||||
methods: {
|
||||
systemInfo(){
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
//1rpx 转换px 的单位
|
||||
this.rpxUnit= (systemInfo.screenWidth / 750)
|
||||
},
|
||||
goback() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
toLogin() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
})
|
||||
},
|
||||
createQrCode(data) {
|
||||
const qr = new UQRCode();
|
||||
qr.data = data;
|
||||
qr.size = 300*this.rpxUnit-10;
|
||||
qr.make();
|
||||
const ctx = uni.createCanvasContext('qrcode', this); // 组件内调用需传this,vue3 中 this 为 getCurrentInstance()?.proxy
|
||||
qr.canvasContext = ctx;
|
||||
qr.drawCanvas();
|
||||
this.isCreateQrCode = false
|
||||
},
|
||||
closeQrCode() {
|
||||
this.showQrCode = false
|
||||
},
|
||||
openQrCode(){
|
||||
|
||||
// 判断是否有二维码 有了不需要绘制
|
||||
if (this.isCreateQrCode){
|
||||
this.createQrCode(this.userDetails.uniqueCode)
|
||||
}
|
||||
},
|
||||
/*async findSelfInfo() {
|
||||
let res = await request({
|
||||
url: `/app-api/small/driving/findSelfInfo`,
|
||||
method: 'get',
|
||||
})
|
||||
console.log(res, 138);
|
||||
this.selfInfo = res
|
||||
},*/
|
||||
toMyQrCode() {
|
||||
if (!getToken()) {
|
||||
uni.showModal({
|
||||
title: '未登录',
|
||||
content: '请先登录',
|
||||
confirmText: '去登录',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
});
|
||||
},
|
||||
onShow() {
|
||||
if (getToken()) {
|
||||
this.selfInfoLocal = getLocalUserInfo()
|
||||
this.getUserInfo()
|
||||
this.systemInfo()
|
||||
}
|
||||
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
console.log("刷新");
|
||||
uni.stopPullDownRefresh()
|
||||
this.getUserInfo()
|
||||
},
|
||||
onReachBottom() {
|
||||
// this.show = true
|
||||
setTimeout(() => {
|
||||
console.log("加载执行");
|
||||
}, 2000)
|
||||
},
|
||||
components: {
|
||||
headers,
|
||||
tabbar
|
||||
},
|
||||
methods: {
|
||||
systemInfo() {
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
//1rpx 转换px 的单位
|
||||
this.rpxUnit = (systemInfo.screenWidth / 750)
|
||||
},
|
||||
goback() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
toLogin() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
})
|
||||
},
|
||||
createQrCode(data) {
|
||||
const qr = new UQRCode();
|
||||
qr.data = data;
|
||||
qr.size = 300 * this.rpxUnit - 10;
|
||||
qr.make();
|
||||
const ctx = uni.createCanvasContext('qrcode',
|
||||
this); // 组件内调用需传this,vue3 中 this 为 getCurrentInstance()?.proxy
|
||||
qr.canvasContext = ctx;
|
||||
qr.drawCanvas();
|
||||
this.isCreateQrCode = false
|
||||
},
|
||||
closeQrCode() {
|
||||
this.showQrCode = false
|
||||
},
|
||||
openQrCode() {
|
||||
|
||||
// 判断是否有二维码 有了不需要绘制
|
||||
if (this.isCreateQrCode) {
|
||||
this.createQrCode(this.userDetails.uniqueCode)
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
},
|
||||
/*async findSelfInfo() {
|
||||
let res = await request({
|
||||
url: `/app-api/small/driving/findSelfInfo`,
|
||||
method: 'get',
|
||||
})
|
||||
console.log(res, 138);
|
||||
this.selfInfo = res
|
||||
},*/
|
||||
toMyQrCode() {
|
||||
if (!getToken()) {
|
||||
uni.showModal({
|
||||
title: '未登录',
|
||||
content: '请先登录',
|
||||
confirmText: '去登录',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.showQrCode = true
|
||||
},
|
||||
|
||||
toOrderPage(orderType, type) {
|
||||
if (!getToken()) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/newPages/orderList/index?orderType=${orderType}&type=${type}&userId=${this.selfInfo.id}`
|
||||
})
|
||||
},
|
||||
goMyInDetails() {
|
||||
if (!getToken()) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/information/index?userId=${this.selfInfo.id}`
|
||||
})
|
||||
},
|
||||
goFeedback() {
|
||||
uni.navigateTo({
|
||||
url: "/newPages/messageCenter/index"
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
getUserInfo() {
|
||||
if (!getToken()) {
|
||||
return;
|
||||
}
|
||||
request({
|
||||
url: '/app-api/small/dl-drive-school-student/getUsersInfo',
|
||||
method: 'GET',
|
||||
}).then(res => {
|
||||
this.selfInfo = res.data
|
||||
if (this.selfInfo != null) {
|
||||
setLocalUserInfo(this.selfInfo)
|
||||
}
|
||||
this.getOrder()
|
||||
this.getStudentInfo()
|
||||
this.getNoReadNum()
|
||||
})
|
||||
},
|
||||
getStudentInfo() {
|
||||
request({
|
||||
url: '/app-api/small/dl-drive-school-student/getByUserId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
userId: this.selfInfo.id
|
||||
}
|
||||
}).then(res => {
|
||||
this.userDetails = {
|
||||
...res.data
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
getCoachDetails(coachId) {
|
||||
request({
|
||||
url: '/app-api/dl-drive-school-coach-small/getCoachByUserId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
userId: coachId
|
||||
}
|
||||
}).then(res => {
|
||||
this.coachDetails = res.data
|
||||
})
|
||||
},
|
||||
|
||||
getOrder() {
|
||||
request({
|
||||
url: '/app-api/small/drive/school-course-order/getCourseByLoginUser',
|
||||
method: 'GET',
|
||||
}).then(res => {
|
||||
this.orderList = res.data
|
||||
if (this.orderList.length > 0) {
|
||||
this.getProcess(this.orderList[0].courseId)
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getProcess(courseId) {
|
||||
request({
|
||||
url: '/app-api/process/getAllByCourseId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
courseId: courseId
|
||||
}
|
||||
}).then(res => {
|
||||
let result = null; // 默认返回 null(如果没有符合条件的数据)
|
||||
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
this.processList = res.data;
|
||||
|
||||
// 1. 筛选出所有 status === "1" 的数据(注意是字符串 "1")
|
||||
const statusOneItems = this.processList.filter(item => item.status === "1");
|
||||
|
||||
if (statusOneItems.length === 1) {
|
||||
// 2. 如果只有一条,直接赋值
|
||||
result = statusOneItems[0];
|
||||
this.getCoachDetails(result.coachId)
|
||||
} else if (statusOneItems.length > 1) {
|
||||
// 3. 如果有多条,按 subject(int 类型)降序排序,取第一条(subject 最大的)
|
||||
const sortedItems = [...statusOneItems].sort((a, b) => b.subject - a.subject);
|
||||
result = sortedItems[0];
|
||||
this.getCoachDetails(result.coachId)
|
||||
}
|
||||
// 如果没有数据,result 保持 null
|
||||
}
|
||||
|
||||
return result; // 如果需要返回结果,可以加上 return
|
||||
}).catch(error => {
|
||||
console.error('请求出错:', error);
|
||||
return null; // 出错时也返回 null
|
||||
});
|
||||
},
|
||||
|
||||
//获取未读消息数量
|
||||
async getNoReadNum() {
|
||||
await request({
|
||||
url: "/app-api/system/notify-message/get-unread-count",
|
||||
method: "GET",
|
||||
tenantIdFlag: false
|
||||
}).then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.noReadNum = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
this.showQrCode = true
|
||||
},
|
||||
|
||||
toOrderPage(orderType, type) {
|
||||
if (!getToken()) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/newPages/orderList/index?orderType=${orderType}&type=${type}&userId=${this.selfInfo.id}`
|
||||
})
|
||||
},
|
||||
goMyInDetails() {
|
||||
if (!getToken()) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/information/index?userId=${this.selfInfo.id}`
|
||||
})
|
||||
},
|
||||
goFeedback(){
|
||||
uni.navigateTo({
|
||||
url: "/newPages/messageCenter/index"
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
getUserInfo() {
|
||||
if (!getToken()) {
|
||||
return;
|
||||
}
|
||||
request({
|
||||
url: '/app-api/small/dl-drive-school-student/getUsersInfo',
|
||||
method: 'GET',
|
||||
}).then(res => {
|
||||
this.selfInfo = res.data
|
||||
if (this.userInfo != null) {
|
||||
setLocalUserInfo(this.selfInfo)
|
||||
}
|
||||
this.getOrder()
|
||||
this.getStudentInfo()
|
||||
this.getNoReadNum()
|
||||
})
|
||||
},
|
||||
getStudentInfo(){
|
||||
request({
|
||||
url: '/app-api/small/dl-drive-school-student/getByUserId',
|
||||
method: 'GET',
|
||||
params: { userId: this.selfInfo.id }
|
||||
}).then(res => {
|
||||
this.userDetails = { ...res.data };
|
||||
});
|
||||
},
|
||||
|
||||
getCoachDetails(coachId) {
|
||||
request({
|
||||
url: '/app-api/dl-drive-school-coach-small/getCoachByUserId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
userId: coachId
|
||||
}
|
||||
}).then(res => {
|
||||
this.coachDetails = res.data
|
||||
})
|
||||
},
|
||||
|
||||
getOrder() {
|
||||
request({
|
||||
url: '/app-api/small/drive/school-course-order/getCourseByLoginUser',
|
||||
method: 'GET',
|
||||
}).then(res => {
|
||||
this.orderList = res.data
|
||||
if (this.orderList.length > 0) {
|
||||
this.getProcess(this.orderList[0].courseId)
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getProcess(courseId) {
|
||||
request({
|
||||
url: '/app-api/process/getAllByCourseId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
courseId: courseId
|
||||
}
|
||||
}).then(res => {
|
||||
let result = null; // 默认返回 null(如果没有符合条件的数据)
|
||||
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
this.processList = res.data;
|
||||
|
||||
// 1. 筛选出所有 status === "1" 的数据(注意是字符串 "1")
|
||||
const statusOneItems = this.processList.filter(item => item.status === "1");
|
||||
|
||||
if (statusOneItems.length === 1) {
|
||||
// 2. 如果只有一条,直接赋值
|
||||
result = statusOneItems[0];
|
||||
this.getCoachDetails(result.coachId)
|
||||
} else if (statusOneItems.length > 1) {
|
||||
// 3. 如果有多条,按 subject(int 类型)降序排序,取第一条(subject 最大的)
|
||||
const sortedItems = [...statusOneItems].sort((a, b) => b.subject - a.subject);
|
||||
result = sortedItems[0];
|
||||
this.getCoachDetails(result.coachId)
|
||||
}
|
||||
// 如果没有数据,result 保持 null
|
||||
}
|
||||
|
||||
return result; // 如果需要返回结果,可以加上 return
|
||||
}).catch(error => {
|
||||
console.error('请求出错:', error);
|
||||
return null; // 出错时也返回 null
|
||||
});
|
||||
},
|
||||
|
||||
//获取未读消息数量
|
||||
async getNoReadNum(){
|
||||
await request({
|
||||
url: "/app-api/system/notify-message/get-unread-count",
|
||||
method: "GET",
|
||||
tenantIdFlag:false
|
||||
}).then((res) => {
|
||||
if(res.code==0){
|
||||
this.noReadNum = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
@import '../common/common.scss';
|
||||
@import './assets/style/index.rpx.scss';
|
||||
</style>
|
||||
@import '../common/common.scss';
|
||||
@import './assets/style/index.rpx.scss';
|
||||
</style>
|
@ -103,7 +103,7 @@
|
||||
}
|
||||
.section_2 {
|
||||
width: 750rpx;
|
||||
height: 1020rpx;
|
||||
// height: 1020rpx;
|
||||
.list_1 {
|
||||
width: 618rpx;
|
||||
height: 112rpx;
|
||||
|
@ -35,9 +35,10 @@
|
||||
src="/static/lanhu_shouye2gai/FigmaDDSSlicePNGc8586e4d9e76802e4b93ae8fb3654b38.png" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="itemContent">
|
||||
<!-- 使用 scroll-view 包裹 SchoolInfo 组件 -->
|
||||
<scroll-view class="school-scroll-view" scroll-y>
|
||||
<scroll-view class="scroll-view" scroll-y :style="{ height: scrollHeight + 'px' }">
|
||||
<SchoolInfo style="" v-for="(school, index) in schoolList" :key="index" :schoolInfo="school"
|
||||
@click="goSchoolDetail(school)" />
|
||||
</scroll-view>
|
||||
@ -103,12 +104,15 @@
|
||||
noticeList: [],
|
||||
qTenantId: null,
|
||||
qCoachId: null,
|
||||
scrollHeight: 0,
|
||||
};
|
||||
},
|
||||
onLoad(query) {
|
||||
console.log('query', query)
|
||||
// setInviteId('JLPXF1')
|
||||
// this.getTenantIdByInviteId()
|
||||
console.log('userInfo', getLocalUserInfo())
|
||||
console.log('token', getToken())
|
||||
this.getSwiperList()
|
||||
this.getTextList()
|
||||
|
||||
@ -132,6 +136,10 @@
|
||||
}) */
|
||||
}
|
||||
},
|
||||
onReady() {
|
||||
// 动态计算滚动区域高度
|
||||
this.calculateScrollHeight();
|
||||
},
|
||||
methods: {
|
||||
getTenantIdByInviteId() {
|
||||
console.log('1122', getInviteId())
|
||||
@ -296,6 +304,36 @@
|
||||
});
|
||||
},
|
||||
|
||||
calculateScrollHeight() {
|
||||
/* // 获取屏幕高度
|
||||
const screenHeight = uni.getSystemInfoSync().windowHeight;
|
||||
// 获取顶部区域高度
|
||||
const topHeight = 490;
|
||||
// 计算滚动区域高度
|
||||
this.scrollHeight = screenHeight - topHeight; */
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = systemInfo.windowHeight;
|
||||
const rpxToPx = systemInfo.windowWidth / 750;
|
||||
|
||||
const topOccupiedHeight = 960 * rpxToPx;
|
||||
|
||||
this.scrollHeight = windowHeight - topOccupiedHeight;
|
||||
},
|
||||
/* calculateScrollHeight() {
|
||||
// 获取屏幕高度
|
||||
const screenHeight = uni.getSystemInfoSync().windowHeight;
|
||||
// 使用选择器获取顶部区域实际高度
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('.top_').boundingClientRect(data => {
|
||||
const topHeight = data ? data.height : 0;
|
||||
query.select('.section_2').boundingClientRect(data => {
|
||||
const sectionHeight = data ? data.height : 0;
|
||||
// 转换为 rpx (假设 1px = 2rpx,根据实际情况调整)
|
||||
this.scrollHeight = (screenHeight - topHeight - sectionHeight) * 2;
|
||||
}).exec();
|
||||
}).exec();
|
||||
}, */
|
||||
|
||||
handleItemClick(item) {
|
||||
// 根据 item.text 判断点击的是哪一项
|
||||
switch (item.text) {
|
||||
@ -398,16 +436,17 @@
|
||||
|
||||
// 新增 scroll-view 样式
|
||||
.school-scroll-view {
|
||||
height: 500rpx; // 设置一个固定高度,根据需要调整
|
||||
/* height: 500rpx; // 设置一个固定高度,根据需要调整 */
|
||||
overflow-y: auto;
|
||||
margin-left: 22rpx;
|
||||
}
|
||||
|
||||
.itemContent {
|
||||
padding: 30rpx 0;
|
||||
margin-top: 20rpx;
|
||||
/* padding: 10rpx 0; */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
row-gap: 20rpx;
|
||||
/* row-gap: 10rpx; */
|
||||
margin-bottom: 200rpx;
|
||||
}
|
||||
|
||||
|
@ -94,9 +94,18 @@
|
||||
status: 'loading',
|
||||
selfInfo: {}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
if (getToken()) {
|
||||
console.log('myToken', getToken())
|
||||
this.findSelfInfo()
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
onShow() {
|
||||
if (getToken()) {
|
||||
console.log('myToken', getToken())
|
||||
this.findSelfInfo()
|
||||
}
|
||||
|
||||
@ -143,7 +152,7 @@
|
||||
},
|
||||
async findSelfInfo() {
|
||||
let res = await request({
|
||||
url: `/app-api/driving/findSelfInfo`,
|
||||
url: `/app-api/small/driving/findSelfInfo`,
|
||||
method: 'get',
|
||||
})
|
||||
console.log(res, 138);
|
||||
@ -331,4 +340,4 @@
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -1,384 +1,393 @@
|
||||
<template>
|
||||
<view class="page flex-col">
|
||||
<view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;">
|
||||
<headers titles="考试结果录入">
|
||||
<uni-icons type="left" color="#000000" size="22px"></uni-icons>
|
||||
</headers>
|
||||
</view>
|
||||
<view class="block_2 flex-col">
|
||||
<scroll-view
|
||||
class="scroll-view"
|
||||
scroll-y
|
||||
:style="{ height: scrollHeight + 'px' }"
|
||||
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered"
|
||||
>
|
||||
<view
|
||||
class="box_5 flex-col" v-for="(item, index) in examList"
|
||||
:key="index"
|
||||
:style="{ height: ((item.subject != 2 && item.subject != 3) || (getButtonInfo(item).text === '1' || getButtonInfo(item).text === '2')) ? '230rpx' : 'auto' }">
|
||||
<view class="block_3 flex-row justify-between">
|
||||
<view class="text-group_1 flex-col justify-between">
|
||||
<view class="page flex-col">
|
||||
<view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;">
|
||||
<headers titles="考试结果录入">
|
||||
<uni-icons type="left" color="#000000" size="22px"></uni-icons>
|
||||
</headers>
|
||||
</view>
|
||||
<view class="block_2 flex-col">
|
||||
<scroll-view class="scroll-view" scroll-y :style="{ height: scrollHeight + 'px' }" refresher-enabled
|
||||
@refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
|
||||
<view class="box_5 flex-col" v-for="(item, index) in examList" :key="index"
|
||||
:style="{ height: ((item.subject != 2 && item.subject != 3) || (getButtonInfo(item).text === '1' || getButtonInfo(item).text === '2')) ? '230rpx' : 'auto' }">
|
||||
<view class="block_3 flex-row justify-between">
|
||||
<view class="text-group_1 flex-col justify-between">
|
||||
|
||||
<text class="text_2" v-if="item.subject == 1 || item.subject == 4">{{
|
||||
<text class="text_2" v-if="item.subject == 1 || item.subject == 4">{{
|
||||
formatDate(item.examTime)
|
||||
}}
|
||||
</text>
|
||||
<text class="text_2" v-else>{{ formatDate(item.startTime) }}</text>
|
||||
</text>
|
||||
<text class="text_2" v-else>{{ formatDate(item.startTime) }}</text>
|
||||
<text class="text_3">{{ item.courseName }}</text>
|
||||
</view>
|
||||
<view class="text-group_2 flex-col justify-between">
|
||||
<text class="text_4" v-if="item.examScore">{{ item.examScore }}</text>
|
||||
<text class="text_4" v-else>{{ '--' }}</text>
|
||||
<text class="text_5">{{ getStatusText(item.examStatus) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="block_4 flex-row justify-between">
|
||||
<view class="text-wrapper_1 flex-col">
|
||||
<text class="text_6">{{ getCourseTypeText(item.subject) }}</text>
|
||||
</view>
|
||||
<view class="text-wrapper_2 flex-col">
|
||||
<text class="text_7">{{ item.courseType }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-wrapper_3 flex-row justify-between" v-if="item.subject == 2 || item.subject == 3">
|
||||
<text class="text_8">考试地址:</text>
|
||||
<text class="text_9">{{ item.addr }}</text>
|
||||
</view>
|
||||
<view class="block_5 flex-row"
|
||||
v-if="(item.subject == 2 || item.subject == 3) && (getButtonInfo(item).text !== '1' && getButtonInfo(item).text !== '2')">
|
||||
<view class="text-wrapper_4 flex-col" @click="handleButtonClick(item)">
|
||||
<text class="text_10">{{ getButtonInfo(item).text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<text class="text_3">{{ item.courseName }}</text>
|
||||
</view>
|
||||
<view class="text-group_2 flex-col justify-between">
|
||||
<text class="text_4" v-if="item.examScore">{{ item.examScore }}</text>
|
||||
<text class="text_4" v-else>{{ '--' }}</text>
|
||||
<text class="text_5">{{ getStatusText(item.examStatus) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="block_4 flex-row justify-between">
|
||||
<view class="text-wrapper_1 flex-col">
|
||||
<text class="text_6">{{ getCourseTypeText(item.subject) }}</text>
|
||||
</view>
|
||||
<view class="text-wrapper_2 flex-col">
|
||||
<text class="text_7">{{ item.courseType }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-wrapper_3 flex-row justify-between" v-if="item.subject == 2 || item.subject == 3">
|
||||
<text class="text_8">考试地址:</text>
|
||||
<text class="text_9">{{ item.addr }}</text>
|
||||
</view>
|
||||
<view class="block_5 flex-row" v-if="(item.subject == 2 || item.subject == 3) && (getButtonInfo(item).text !== '1' && getButtonInfo(item).text !== '2')">
|
||||
<view class="text-wrapper_4 flex-col" @click="handleButtonClick(item)" >
|
||||
<text class="text_10">{{ getButtonInfo(item).text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="block_8 flex-col">
|
||||
<view class="text-wrapper_8 flex-col" @click="onEnterScoreClick()">
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="block_8 flex-col">
|
||||
<view class="text-wrapper_8 flex-col" @click="onEnterScoreClick()">
|
||||
|
||||
<text class="text_19">笔试成绩录入</text>
|
||||
<u-picker
|
||||
:show="pickerShow"
|
||||
:columns="[pickerColumns]"
|
||||
keyName="label"
|
||||
@confirm="onPickerConfirm"
|
||||
@cancel="pickerShow = false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="text_19">笔试成绩录入</text>
|
||||
<u-picker :show="pickerShow" :columns="[pickerColumns]" keyName="label" @confirm="onPickerConfirm"
|
||||
@cancel="pickerShow = false" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import {getLocalUserInfo} from '../../utils/auth';
|
||||
import request from '@/utils/request.js'
|
||||
import headers from "@/components/header/headers.vue";
|
||||
import {
|
||||
getLocalUserInfo
|
||||
} from '../../utils/auth';
|
||||
import request from '@/utils/request.js'
|
||||
import headers from "@/components/header/headers.vue";
|
||||
|
||||
export default {
|
||||
components: {headers},
|
||||
data() {
|
||||
return {
|
||||
loopData0: [
|
||||
{
|
||||
lanhutext0: '2025-01-20',
|
||||
lanhutext1: '考试名称',
|
||||
lanhutext2: '60分',
|
||||
lanhufontColor2: 'rgba(251,66,59,1.000000)',
|
||||
lanhutext3: '考试未通过',
|
||||
lanhufontColor3: 'rgba(251,66,59,1.000000)',
|
||||
lanhutext4: '科目二',
|
||||
lanhutext5: 'C2',
|
||||
lanhutext6: '考试地址:',
|
||||
lanhutext7: '山东省济南市历下区'
|
||||
},
|
||||
{
|
||||
lanhutext0: '2025-01-20',
|
||||
lanhutext1: '考试名称',
|
||||
lanhutext2: '--',
|
||||
lanhufontColor2: 'rgba(51,51,51,1.000000)',
|
||||
lanhutext3: '待审批',
|
||||
lanhufontColor3: 'rgba(51,51,51,1.000000)',
|
||||
lanhutext4: '科目二',
|
||||
lanhutext5: 'C2',
|
||||
lanhutext6: '考试地址:',
|
||||
lanhutext7: '山东省济南市历下区'
|
||||
}
|
||||
],
|
||||
userInfo: {},
|
||||
examList: {},
|
||||
examTwoList: {},
|
||||
scrollHeight: 0,
|
||||
constants: {},
|
||||
courseList: [],
|
||||
pickerShow: false,
|
||||
pickerColumns: [],
|
||||
curNow: 0,
|
||||
isTriggered: false,
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.userInfo = getLocalUserInfo()
|
||||
this.getExamList()
|
||||
this.getCourseList()
|
||||
// 监听刷新事件
|
||||
uni.$on('refresh', () => {
|
||||
this.getExamList()
|
||||
})
|
||||
},
|
||||
onReady() {
|
||||
// 动态计算滚动区域高度
|
||||
this.calculateScrollHeight();
|
||||
},
|
||||
methods: {
|
||||
handleBack() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
},
|
||||
export default {
|
||||
components: {
|
||||
headers
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loopData0: [{
|
||||
lanhutext0: '2025-01-20',
|
||||
lanhutext1: '考试名称',
|
||||
lanhutext2: '60分',
|
||||
lanhufontColor2: 'rgba(251,66,59,1.000000)',
|
||||
lanhutext3: '考试未通过',
|
||||
lanhufontColor3: 'rgba(251,66,59,1.000000)',
|
||||
lanhutext4: '科目二',
|
||||
lanhutext5: 'C2',
|
||||
lanhutext6: '考试地址:',
|
||||
lanhutext7: '山东省济南市历下区'
|
||||
},
|
||||
{
|
||||
lanhutext0: '2025-01-20',
|
||||
lanhutext1: '考试名称',
|
||||
lanhutext2: '--',
|
||||
lanhufontColor2: 'rgba(51,51,51,1.000000)',
|
||||
lanhutext3: '待审批',
|
||||
lanhufontColor3: 'rgba(51,51,51,1.000000)',
|
||||
lanhutext4: '科目二',
|
||||
lanhutext5: 'C2',
|
||||
lanhutext6: '考试地址:',
|
||||
lanhutext7: '山东省济南市历下区'
|
||||
}
|
||||
],
|
||||
userInfo: {},
|
||||
examList: {},
|
||||
examTwoList: {},
|
||||
scrollHeight: 0,
|
||||
constants: {},
|
||||
courseList: [],
|
||||
pickerShow: false,
|
||||
pickerColumns: [],
|
||||
curNow: 0,
|
||||
isTriggered: false,
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.userInfo = getLocalUserInfo()
|
||||
this.getExamList()
|
||||
this.getCourseList()
|
||||
// 监听刷新事件
|
||||
uni.$on('refresh', () => {
|
||||
this.getExamList()
|
||||
})
|
||||
},
|
||||
onReady() {
|
||||
// 动态计算滚动区域高度
|
||||
this.calculateScrollHeight();
|
||||
},
|
||||
methods: {
|
||||
handleBack() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 下拉刷新数据
|
||||
*/
|
||||
onRefresherrefresh() {
|
||||
this.isTriggered = true
|
||||
this.pageNo = 1
|
||||
this.total = 0
|
||||
this.examList = []
|
||||
this.getExamList()
|
||||
/**
|
||||
* 下拉刷新数据
|
||||
*/
|
||||
onRefresherrefresh() {
|
||||
this.isTriggered = true
|
||||
this.pageNo = 1
|
||||
this.total = 0
|
||||
this.examList = []
|
||||
this.getExamList()
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
// 点击笔试成绩录入的时候 检查是否已报名课程
|
||||
onEnterScoreClick() {
|
||||
if (this.courseList.length > 0) {
|
||||
console.log('123123123', this.courseList)
|
||||
this.pickerColumns = this.courseList.map(item => ({
|
||||
label: item.courseName,
|
||||
value: item.courseId
|
||||
}));
|
||||
this.pickerShow = true;
|
||||
} else {
|
||||
this.$u.toast("暂无课程信息");
|
||||
}
|
||||
},
|
||||
// 点击笔试成绩录入的时候 检查是否已报名课程
|
||||
onEnterScoreClick() {
|
||||
if (this.courseList.length > 0) {
|
||||
console.log('123123123', this.courseList)
|
||||
this.pickerColumns = this.courseList.map(item => ({
|
||||
label: item.courseName,
|
||||
value: item.courseId
|
||||
}));
|
||||
this.pickerShow = true;
|
||||
} else {
|
||||
this.$u.toast("暂无课程信息");
|
||||
}
|
||||
},
|
||||
|
||||
// 选择课程后检查是否有课程进度信息
|
||||
onPickerConfirm(e) {
|
||||
const selectedCourseId = e.value[0];
|
||||
const selectedCourse = this.courseList.find(item => item.courseId === selectedCourseId.value);
|
||||
// 选择课程后检查是否有课程进度信息
|
||||
onPickerConfirm(e) {
|
||||
const selectedCourseId = e.value[0];
|
||||
const selectedCourse = this.courseList.find(item => item.courseId === selectedCourseId.value);
|
||||
|
||||
if (selectedCourse) {
|
||||
this.getProcess(selectedCourse.courseId).then(processData => {
|
||||
if (!processData || processData.length === 0) {
|
||||
uni.showToast({
|
||||
title: '暂无课程进度信息',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (selectedCourse) {
|
||||
this.getProcess(selectedCourse.courseId).then(processData => {
|
||||
if (!processData || processData.length === 0) {
|
||||
uni.showToast({
|
||||
title: '暂无课程进度信息',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否存在科目1或科目4的数据
|
||||
const hasSubject1Or4 = processData.some(item =>
|
||||
item.subject === 1 || item.subject === 4
|
||||
);
|
||||
// 检查是否存在科目1或科目4的数据
|
||||
const hasSubject1Or4 = processData.some(item =>
|
||||
item.subject === 1 || item.subject === 4
|
||||
);
|
||||
|
||||
if (hasSubject1Or4) {
|
||||
this.goToScoreEntry(selectedCourse);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '未找到考试信息',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (hasSubject1Or4) {
|
||||
this.goToScoreEntry(selectedCourse);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '未找到考试信息',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.pickerShow = false;
|
||||
},
|
||||
this.pickerShow = false;
|
||||
},
|
||||
|
||||
// 跳转成绩录入界面
|
||||
goToScoreEntry(course) {
|
||||
console.log('course', course)
|
||||
/* uni.navigateTo({
|
||||
url: `/pagesA/examinationAdd/index?courseId=${course.value}&courseType=${course.courseType}&userId=${course.userId}&tenantId=${course.tenantId}&coachId=${course.coachUserId}`
|
||||
}); */
|
||||
this.$u.route({
|
||||
url: '/pagesA/examinationAdd/index',
|
||||
params: {
|
||||
courseId: course.courseId,
|
||||
courseType: course.courseType,
|
||||
userId: course.userId,
|
||||
tenantId: course.tenantId,
|
||||
coachId :course.coachUserId,
|
||||
}
|
||||
});
|
||||
},
|
||||
// 跳转成绩录入界面
|
||||
goToScoreEntry(course) {
|
||||
console.log('course', course)
|
||||
/* uni.navigateTo({
|
||||
url: `/pagesA/examinationAdd/index?courseId=${course.value}&courseType=${course.courseType}&userId=${course.userId}&tenantId=${course.tenantId}&coachId=${course.coachUserId}`
|
||||
}); */
|
||||
this.$u.route({
|
||||
url: '/pagesA/examinationAdd/index',
|
||||
params: {
|
||||
courseId: course.courseId,
|
||||
courseType: course.courseType,
|
||||
userId: course.userId,
|
||||
tenantId: course.tenantId,
|
||||
coachId: course.coachUserId,
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 获取课程进度
|
||||
getProcess(courseId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: '/app-api/process/getAllByUserIdAndCourseId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
userId: this.userInfo.id,
|
||||
courseId: courseId,
|
||||
}
|
||||
}).then(res => {
|
||||
this.processList = res.data;
|
||||
resolve(res.data);
|
||||
}).catch(err => {
|
||||
console.error('查询失败:', err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
},
|
||||
// 获取课程进度
|
||||
getProcess(courseId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: '/app-api/process/getAllByUserIdAndCourseId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
userId: this.userInfo.id,
|
||||
courseId: courseId,
|
||||
}
|
||||
}).then(res => {
|
||||
this.processList = res.data;
|
||||
resolve(res.data);
|
||||
}).catch(err => {
|
||||
console.error('查询失败:', err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 获取考试信息
|
||||
getExamList() {
|
||||
request({
|
||||
url: '/app-api/process/getExamListByUserId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
userId: this.userInfo.id,
|
||||
}
|
||||
}).then(res => {
|
||||
// this.examList = res.data
|
||||
this.examList = res.data.sort((a, b) => {
|
||||
return a.subject - b.subject;
|
||||
});
|
||||
// this.getExamTwoList()
|
||||
this.isTriggered = false
|
||||
})
|
||||
},
|
||||
/* getExamTwoList() {
|
||||
request({
|
||||
url: '/app-api/examBatch/selectExamByUserIdAndCoachId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
userId: this.userInfo.id,
|
||||
}
|
||||
}).then(res => {
|
||||
this.examTwoList = res.data
|
||||
console.log('examTwoList', this.examTwoList)
|
||||
console.log('resTwo', res)
|
||||
})
|
||||
}, */
|
||||
|
||||
// 获取课程信息
|
||||
getCourseList() {
|
||||
request({
|
||||
url: '/app-api/small/drive/school-course-order/getCourseByLoginUser',
|
||||
method: 'GET'
|
||||
}).then(res => {
|
||||
console.log('课程', res)
|
||||
this.courseList = res.data
|
||||
})
|
||||
},
|
||||
|
||||
// 转换考试状态
|
||||
getStatusText(status) {
|
||||
const statusMap = {
|
||||
0: '未通过',
|
||||
1: '已通过',
|
||||
9: '已送考',
|
||||
'null': '未送考',
|
||||
'true': '已通过',
|
||||
'false': '未通过',
|
||||
};
|
||||
return statusMap[status] || '未知状态';
|
||||
},
|
||||
// 获取考试信息
|
||||
getExamList() {
|
||||
request({
|
||||
url: '/app-api/process/getExamListByUserId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
userId: this.userInfo.id,
|
||||
}
|
||||
}).then(res => {
|
||||
// this.examList = res.data
|
||||
console.log('res', res)
|
||||
// 先按 subject 升序,subject 相同时按 createTime 升序
|
||||
this.examList = res.data.sort((a, b) => {
|
||||
if (a.subject !== b.subject) {
|
||||
return a.subject - b.subject;
|
||||
} else {
|
||||
return new Date(a.createTime) - new Date(b.createTime);
|
||||
}
|
||||
});
|
||||
this.isTriggered = false
|
||||
})
|
||||
},
|
||||
/* getExamTwoList() {
|
||||
request({
|
||||
url: '/app-api/examBatch/selectExamByUserIdAndCoachId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
userId: this.userInfo.id,
|
||||
}
|
||||
}).then(res => {
|
||||
this.examTwoList = res.data
|
||||
console.log('examTwoList', this.examTwoList)
|
||||
console.log('resTwo', res)
|
||||
})
|
||||
}, */
|
||||
|
||||
// 转换科目
|
||||
getCourseTypeText(status) {
|
||||
const statusMap = {
|
||||
'1': '科目一',
|
||||
'2': '科目二',
|
||||
'3': '科目三',
|
||||
'4': '科目四',
|
||||
};
|
||||
return statusMap[status] || '未知状态';
|
||||
},
|
||||
|
||||
// 格式化时间
|
||||
formatDate(timestamp) {
|
||||
const date = new Date(timestamp);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要+1
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
return `${year}-${month}-${day}`;
|
||||
},
|
||||
// 获取课程信息
|
||||
getCourseList() {
|
||||
request({
|
||||
url: '/app-api/small/drive/school-course-order/getCourseByLoginUser',
|
||||
method: 'GET'
|
||||
}).then(res => {
|
||||
console.log('课程', res)
|
||||
this.courseList = res.data
|
||||
})
|
||||
},
|
||||
|
||||
calculateScrollHeight() {
|
||||
// 获取屏幕高度
|
||||
const screenHeight = uni.getSystemInfoSync().windowHeight;
|
||||
// 获取顶部区域高度
|
||||
const topHeight = 88;
|
||||
// 计算滚动区域高度
|
||||
this.scrollHeight = screenHeight - topHeight;
|
||||
},
|
||||
// 转换考试状态
|
||||
getStatusText(status) {
|
||||
const statusMap = {
|
||||
0: '未通过',
|
||||
1: '已通过',
|
||||
9: '已送考',
|
||||
'null': '未送考',
|
||||
'true': '已通过',
|
||||
'false': '未通过',
|
||||
};
|
||||
return statusMap[status] || '未知状态';
|
||||
},
|
||||
|
||||
|
||||
getButtonInfo(item) {
|
||||
if (item.fraction == null) {
|
||||
return {text: '成绩录入', type: 'input'}
|
||||
} else if (!item.ifPass) {
|
||||
return {text: '2', type: 'failed'}
|
||||
} else if (!item.ifEvaluate) {
|
||||
return {text: '开始评价', type: 'evaluate'}
|
||||
}else {
|
||||
return {text: '1', type: 'evaluate'}
|
||||
}
|
||||
// else if (item.ifEvaluate) {
|
||||
// return { text: '查看评价', type: 'view' }
|
||||
// }
|
||||
},
|
||||
// 转换科目
|
||||
getCourseTypeText(status) {
|
||||
const statusMap = {
|
||||
'1': '科目一',
|
||||
'2': '科目二',
|
||||
'3': '科目三',
|
||||
'4': '科目四',
|
||||
};
|
||||
return statusMap[status] || '未知状态';
|
||||
},
|
||||
|
||||
//
|
||||
handleButtonClick(item) {
|
||||
const buttonInfo = this.getButtonInfo(item)
|
||||
// 格式化时间
|
||||
formatDate(timestamp) {
|
||||
const date = new Date(timestamp);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要+1
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
return `${year}-${month}-${day}`;
|
||||
},
|
||||
|
||||
switch (buttonInfo.type) {
|
||||
case 'input':
|
||||
this.goScoreInput(item)
|
||||
break
|
||||
case 'evaluate':
|
||||
this.goEvaluate(item)
|
||||
break
|
||||
case 'view':
|
||||
this.goViewEvaluation(item)
|
||||
break
|
||||
default:
|
||||
calculateScrollHeight() {
|
||||
// 获取屏幕高度
|
||||
const screenHeight = uni.getSystemInfoSync().windowHeight;
|
||||
// 获取顶部区域高度
|
||||
const topHeight = 88;
|
||||
// 计算滚动区域高度
|
||||
this.scrollHeight = screenHeight - topHeight;
|
||||
},
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// 跳转到成绩录入页面
|
||||
goScoreInput(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/examinationAdd/index?id=${item.batchItemId}&batchId=${item.batchId}&batchId=${item.batchId}&tenantId=${item.tenantId}&courseType=${item.courseType}&subject=${item.subject}&courseId=${item.courseId}&coachId=${item.coachId}`
|
||||
});
|
||||
},
|
||||
// 跳转到开始评价页面
|
||||
goEvaluate(item) {
|
||||
item = JSON.stringify(item)
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/evaluateAdd/index?data=${item}&type=kaoshi&controls=add`
|
||||
})
|
||||
},
|
||||
getButtonInfo(item) {
|
||||
if (item.fraction == null) {
|
||||
return {
|
||||
text: '成绩录入',
|
||||
type: 'input'
|
||||
}
|
||||
} else if (!item.ifPass) {
|
||||
return {
|
||||
text: '2',
|
||||
type: 'failed'
|
||||
}
|
||||
} else if (!item.ifEvaluate) {
|
||||
return {
|
||||
text: '开始评价',
|
||||
type: 'evaluate'
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
text: '1',
|
||||
type: 'evaluate'
|
||||
}
|
||||
}
|
||||
// else if (item.ifEvaluate) {
|
||||
// return { text: '查看评价', type: 'view' }
|
||||
// }
|
||||
},
|
||||
|
||||
// 跳转到查看评价页面
|
||||
goViewEvaluation(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/evaluationDetail/index?evaluateId=${item.evaluateId}`
|
||||
})
|
||||
}
|
||||
//
|
||||
handleButtonClick(item) {
|
||||
const buttonInfo = this.getButtonInfo(item)
|
||||
|
||||
}
|
||||
};
|
||||
switch (buttonInfo.type) {
|
||||
case 'input':
|
||||
this.goScoreInput(item)
|
||||
break
|
||||
case 'evaluate':
|
||||
this.goEvaluate(item)
|
||||
break
|
||||
case 'view':
|
||||
this.goViewEvaluation(item)
|
||||
break
|
||||
default:
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// 跳转到成绩录入页面
|
||||
goScoreInput(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/examinationAdd/index?id=${item.batchItemId}&batchId=${item.batchId}&batchId=${item.batchId}&tenantId=${item.tenantId}&courseType=${item.courseType}&subject=${item.subject}&courseId=${item.courseId}&coachId=${item.coachId}`
|
||||
});
|
||||
},
|
||||
// 跳转到开始评价页面
|
||||
goEvaluate(item) {
|
||||
item = JSON.stringify(item)
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/evaluateAdd/index?data=${item}&type=kaoshi&controls=add`
|
||||
})
|
||||
},
|
||||
|
||||
// 跳转到查看评价页面
|
||||
goViewEvaluation(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pagesA/evaluationDetail/index?evaluateId=${item.evaluateId}`
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
@import '../common/common.scss';
|
||||
@import './assets/style/index.rpx.scss';
|
||||
</style>
|
||||
@import '../common/common.scss';
|
||||
@import './assets/style/index.rpx.scss';
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user