This commit is contained in:
Lx 2025-04-17 14:49:28 +08:00
parent 4720e60dff
commit 15e1a31e7b
4 changed files with 753 additions and 726 deletions

View File

@ -1,396 +1,389 @@
<template> <template>
<view class="page flex-col"> <view class="page flex-col">
<view class="box_1 flex-col justify-end"> <view class="box_1 flex-col justify-end">
<view class="box_7 flex-row justify-between"> <view class="box_7 flex-row justify-between">
<view class="image-text_1 flex-row justify-between"> <view class="image-text_1 flex-row justify-between">
<view class="group_1 flex-col"> <view class="group_1 flex-col">
<view class="image-wrapper_2 flex-col"> <view class="image-wrapper_2 flex-col">
<image <image class="image_2" referrerpolicy="no-referrer"
class="image_2" :src="selfInfo && selfInfo.avatar ? imageUrl + '/' + selfInfo.avatar : '/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG185e54e3ffd47170ac4e6e5108c9a54f.png'" />
referrerpolicy="no-referrer" </view>
:src="selfInfo && selfInfo.avatar ? imageUrl + '/' + selfInfo.avatar : '/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG185e54e3ffd47170ac4e6e5108c9a54f.png'" </view>
/> <view class="text-group_1 flex-col justify-between">
</view> <view v-if="selfInfo.nickname" class="text_3">{{ selfInfo.nickname }}</view>
</view> <view v-if="selfInfo.username" class="text_3">{{ selfInfo.username }}</view>
<view class="text-group_1 flex-col justify-between"> <view v-else @click="toLogin()" class="text_2">登录/注册</view>
<view v-if="selfInfo.nickname" class="text_3">{{ selfInfo.nickname }}</view> <text v-if="!selfInfo.username" class="text_3">登录将开启全部服务</text>
<view v-if="selfInfo.username" class="text_3">{{ selfInfo.username }}</view> </view>
<view v-else @click="toLogin()" class="text_2">登录/注册</view> </view>
<text v-if="!selfInfo.username" class="text_3">登录将开启全部服务</text> <view class="image-text_2 flex-col justify-between" @click="toMyQrCode()">
</view> <image class="label_1" referrerpolicy="no-referrer"
</view> src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG7e67772393591f7c5436c0b59f7b3b17.png" />
<view class="image-text_2 flex-col justify-between" @click="toMyQrCode()"> <text class="text-group_2">学车码</text>
<image </view>
class="label_1" </view>
referrerpolicy="no-referrer" <view class="box_8 flex-row">
src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG7e67772393591f7c5436c0b59f7b3b17.png" <view class="image-wrapper_3 flex-col justify-center">
/> <image class="label_2" referrerpolicy="no-referrer"
<text class="text-group_2">学车码</text> :src="coachDetails && coachDetails.image ? imageUrl + '/' + coachDetails.image : '/static/lanhu_gerenzhongxin/FigmaDDSSlicePNGa95a4d1d98d08b238a3082514eefafd0.png'" />
</view> </view>
</view> <view class="text-group_3 flex-col justify-between">
<view class="box_8 flex-row"> <text class="text_4" v-if="coachDetails.name != null">{{ coachDetails.name }}</text>
<view class="image-wrapper_3 flex-col justify-center"> <text class="text_111" v-else> 暂无教练信息</text>
<image <view class="text-wrapper_1" v-if="coachDetails.seniority != null">
class="label_2" <text class="text_5">教龄</text>
referrerpolicy="no-referrer" <text class="text_6">{{ coachDetails.seniority }}</text>
:src="coachDetails && coachDetails.image ? imageUrl + '/' + coachDetails.image : '/static/lanhu_gerenzhongxin/FigmaDDSSlicePNGa95a4d1d98d08b238a3082514eefafd0.png'" <text class="text_7"></text>
/> </view>
</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>
<!-- <view class="text-wrapper_2" v-if="coachDetails"> <!-- <view class="text-wrapper_2" v-if="coachDetails">
<text class="text_8">学员数</text> <text class="text_8">学员数</text>
<text class="text_9">{{}}</text> <text class="text_9">{{}}</text>
</view> </view>
<view class="text-wrapper_2" v-else> <view class="text-wrapper_2" v-else>
<text class="text_8">暂无数据</text> <text class="text_8">暂无数据</text>
</view> --> </view> -->
</view> </view>
</view> </view>
<view class="box_9 flex-col"> <view class="box_9 flex-col">
<view class="block_1 flex-col"> <view class="block_1 flex-col">
<text class="text_10">我的订单</text> <text class="text_10">我的订单</text>
<view class="list_1 flex-row"> <view class="list_1 flex-row">
<view <view class="image-text_3 flex-col justify-between" v-for="(item, index) in loopData" :key="index"
class="image-text_3 flex-col justify-between" @click="toOrderPage(item.orderType,item.type)">
v-for="(item, index) in loopData" <image class="label_3" referrerpolicy="no-referrer" :src="item.url" />
:key="index" <text class="text-group_4" v-text="item.text"></text>
@click="toOrderPage(item.orderType,item.type)" </view>
> </view>
<image </view>
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-list">
<!-- 个人信息 --> <!-- 个人信息 -->
<view class="menu-item" @click="goMyInDetails()"> <view class="menu-item" @click="goMyInDetails()">
<image class="menu-icon" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG1bb0cdc369203c305a42d848736e8f01.png" /> <image class="menu-icon"
<text class="menu-text">个人信息</text> src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG1bb0cdc369203c305a42d848736e8f01.png" />
<image class="menu-arrow" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG4f20daae79bb7c60189f8702897465d1.png" /> <text class="menu-text">个人信息</text>
</view> <image class="menu-arrow"
src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG4f20daae79bb7c60189f8702897465d1.png" />
<!-- <view class="menu-item"> </view>
<!-- <view class="menu-item">
<button open-type="contact" class="menu-item-btn"> <button open-type="contact" class="menu-item-btn">
<image class="menu-icon" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNGb5e90b5b4c1f154eb4e27313164118a4.png" /> <image class="menu-icon" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNGb5e90b5b4c1f154eb4e27313164118a4.png" />
<text class="menu-text">在线客服</text> <text class="menu-text">在线客服</text>
<image class="menu-arrow" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG4f20daae79bb7c60189f8702897465d1.png" /> <image class="menu-arrow" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG4f20daae79bb7c60189f8702897465d1.png" />
</button></view> --> </button></view> -->
<!-- 消息中心 --> <!-- 消息中心 -->
<view class="menu-item" @click="goFeedback"> <view class="menu-item" @click="goFeedback">
<image class="menu-icon" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNGa728895586dafec1bde5f90c89d05c48.png" /> <image class="menu-icon"
<text class="menu-text">消息中心</text> src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNGa728895586dafec1bde5f90c89d05c48.png" />
<text class="message-num" v-if="noReadNum > 0">{{ noReadNum }}</text> <text class="menu-text">消息中心</text>
<image class="menu-arrow" src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG4f20daae79bb7c60189f8702897465d1.png" /> <text class="message-num" v-if="noReadNum > 0">{{ noReadNum }}</text>
</view> <image class="menu-arrow"
src="/static/lanhu_gerenzhongxin/FigmaDDSSlicePNG4f20daae79bb7c60189f8702897465d1.png" />
</view>
</view>
</view> </view>
</view>
<!-- <tabbar :msg='msg'></tabbar> -->
<!-- <tabbar :msg='msg'></tabbar> --> <u-popup round="20" :show="showQrCode" @close="closeQrCode" mode="center" zoom="false" @open="openQrCode">
<u-popup round="20" :show="showQrCode" @close="closeQrCode" mode="center" zoom="false" @open="openQrCode"> <view style="padding: 50rpx 50rpx 20rpx 50rpx">
<view style="padding: 50rpx 50rpx 20rpx 50rpx"> <canvas id="qrcode" canvas-id="qrcode" style="width: 300rpx;height: 300rpx" />
<canvas id="qrcode" canvas-id="qrcode" style="width: 300rpx;height: 300rpx"/> </view>
</view> <span style="text-align: center;margin-bottom: 20rpx;">学车码</span>
<span style="text-align: center;margin-bottom: 20rpx;">学车码</span> </u-popup>
</u-popup> </view>
</view>
</template> </template>
<script> <script>
import headers from '../../components/header/headers.vue' import headers from '../../components/header/headers.vue'
import tabbar from '../../components/tabbar/tabbar.vue' import tabbar from '../../components/tabbar/tabbar.vue'
import request from '@/utils/request.js' import request from '@/utils/request.js'
import UQRCode from 'uqrcodejs'; import UQRCode from 'uqrcodejs';
import { import {
getLocalUserInfo, getLocalUserInfo,
getToken, getToken,
setLocalUserInfo setLocalUserInfo
} from '@/utils/auth' } from '@/utils/auth'
export default { export default {
data() { data() {
return { return {
msg: "3", msg: "3",
selfInfo: {}, selfInfo: {},
selfInfoLocal: {}, selfInfoLocal: {},
coachDetails: {}, coachDetails: {},
userDetails: {}, userDetails: {},
orderList: {}, orderList: {},
processList: {}, processList: {},
showQrCode: false, showQrCode: false,
isCreateQrCode:true, isCreateQrCode: true,
noReadNum:0, noReadNum: 0,
rpxUnit: 2, rpxUnit: 2,
loopData: [ loopData: [{
{ url: '/static/myImgs/alreadyPaid.png',
url: '/static/myImgs/alreadyPaid.png', text: '已付款',
text: '已付款', orderType: '2',
orderType: '2', type: '2',
type: '2', },
}, {
{ url: '/static/myImgs/alreadyInterviewed.png',
url: '/static/myImgs/alreadyInterviewed.png', text: '已面签',
text: '已面签', orderType: '4',
orderType: '4', type: '3',
type: '3', },
}, {
{ url: '/static/myImgs/registered.png',
url: '/static/myImgs/registered.png', text: '已报名',
text: '已报名', orderType: '2',
orderType: '2', type: '4',
type: '4', },
}, {
{ url: '/static/myImgs/allOrder.png',
url: '/static/myImgs/allOrder.png', text: '全部订单',
text: '全部订单', orderType: '',
orderType: '', type: '1',
type: '1', }
} ],
], constants: {},
constants: {}, imageUrl: this.$imagesUrl,
imageUrl: this.$imagesUrl, };
}; },
}, onLoad() {
onLoad() { console.log('userInfo', getLocalUserInfo())
this.selfInfoLocal = getLocalUserInfo() console.log('myToken', getToken())
this.getUserInfo() this.selfInfoLocal = getLocalUserInfo()
this.systemInfo() this.getUserInfo()
this.systemInfo()
},
onShow() {
if (getToken()) {
this.selfInfoLocal = getLocalUserInfo()
this.getUserInfo()
this.systemInfo()
}
}, },
onPullDownRefresh() { onShow() {
console.log("刷新"); if (getToken()) {
uni.stopPullDownRefresh() this.selfInfoLocal = getLocalUserInfo()
this.getUserInfo() this.getUserInfo()
}, this.systemInfo()
onReachBottom() { }
// this.show = true
setTimeout(() => { },
console.log("加载执行"); onPullDownRefresh() {
}, 2000) console.log("刷新");
}, uni.stopPullDownRefresh()
components: { this.getUserInfo()
headers, },
tabbar onReachBottom() {
}, // this.show = true
methods: { setTimeout(() => {
systemInfo(){ console.log("加载执行");
const systemInfo = uni.getSystemInfoSync(); }, 2000)
//1rpx px },
this.rpxUnit= (systemInfo.screenWidth / 750) components: {
}, headers,
goback() { tabbar
uni.navigateBack() },
}, methods: {
toLogin() { systemInfo() {
uni.navigateTo({ const systemInfo = uni.getSystemInfoSync();
url: "/pages/login/login" //1rpx px
}) this.rpxUnit = (systemInfo.screenWidth / 750)
}, },
createQrCode(data) { goback() {
const qr = new UQRCode(); uni.navigateBack()
qr.data = data; },
qr.size = 300*this.rpxUnit-10; toLogin() {
qr.make(); uni.navigateTo({
const ctx = uni.createCanvasContext('qrcode', this); // thisvue3 this getCurrentInstance()?.proxy url: "/pages/login/login"
qr.canvasContext = ctx; })
qr.drawCanvas(); },
this.isCreateQrCode = false createQrCode(data) {
}, const qr = new UQRCode();
closeQrCode() { qr.data = data;
this.showQrCode = false qr.size = 300 * this.rpxUnit - 10;
}, qr.make();
openQrCode(){ const ctx = uni.createCanvasContext('qrcode',
this); // thisvue3 this getCurrentInstance()?.proxy
// qr.canvasContext = ctx;
if (this.isCreateQrCode){ qr.drawCanvas();
this.createQrCode(this.userDetails.uniqueCode) this.isCreateQrCode = false
} },
}, closeQrCode() {
/*async findSelfInfo() { this.showQrCode = false
let res = await request({ },
url: `/app-api/small/driving/findSelfInfo`, openQrCode() {
method: 'get',
}) //
console.log(res, 138); if (this.isCreateQrCode) {
this.selfInfo = res this.createQrCode(this.userDetails.uniqueCode)
},*/
toMyQrCode() {
if (!getToken()) {
uni.showModal({
title: '未登录',
content: '请先登录',
confirmText: '去登录',
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: '/pages/login/login'
});
} }
} },
}); /*async findSelfInfo() {
return; 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. subjectint 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. subjectint 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> </script>
<style lang='scss'> <style lang='scss'>
@import '../common/common.scss'; @import '../common/common.scss';
@import './assets/style/index.rpx.scss'; @import './assets/style/index.rpx.scss';
</style> </style>

View File

@ -37,7 +37,7 @@
</view> </view>
<view class="itemContent"> <view class="itemContent">
<!-- 使用 scroll-view 包裹 SchoolInfo 组件 --> <!-- 使用 scroll-view 包裹 SchoolInfo 组件 -->
<scroll-view class="school-scroll-view" scroll-y> <scroll-view class="school-scroll-view" scroll-y :style="{ height: scrollHeight + 'px' }">
<SchoolInfo style="" v-for="(school, index) in schoolList" :key="index" :schoolInfo="school" <SchoolInfo style="" v-for="(school, index) in schoolList" :key="index" :schoolInfo="school"
@click="goSchoolDetail(school)" /> @click="goSchoolDetail(school)" />
</scroll-view> </scroll-view>
@ -103,12 +103,15 @@
noticeList: [], noticeList: [],
qTenantId: null, qTenantId: null,
qCoachId: null, qCoachId: null,
scrollHeight: 0,
}; };
}, },
onLoad(query) { onLoad(query) {
console.log('query', query) console.log('query', query)
// setInviteId('JLPXF1') // setInviteId('JLPXF1')
// this.getTenantIdByInviteId() // this.getTenantIdByInviteId()
console.log('userInfo', getLocalUserInfo())
console.log('token', getToken())
this.getSwiperList() this.getSwiperList()
this.getTextList() this.getTextList()
@ -132,6 +135,10 @@
}) */ }) */
} }
}, },
onReady() {
//
this.calculateScrollHeight();
},
methods: { methods: {
getTenantIdByInviteId() { getTenantIdByInviteId() {
console.log('1122', getInviteId()) console.log('1122', getInviteId())
@ -296,6 +303,15 @@
}); });
}, },
calculateScrollHeight() {
//
const screenHeight = uni.getSystemInfoSync().windowHeight;
//
const topHeight = 490;
//
this.scrollHeight = screenHeight - topHeight;
},
handleItemClick(item) { handleItemClick(item) {
// item.text // item.text
switch (item.text) { switch (item.text) {
@ -408,7 +424,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
row-gap: 20rpx; row-gap: 20rpx;
margin-bottom: 200rpx; /* margin-bottom: 200rpx; */
} }
.top_ { .top_ {

View File

@ -94,9 +94,18 @@
status: 'loading', status: 'loading',
selfInfo: {} selfInfo: {}
} }
},
onLoad() {
if (getToken()) {
console.log('myToken', getToken())
this.findSelfInfo()
}
}, },
onShow() { onShow() {
if (getToken()) { if (getToken()) {
console.log('myToken', getToken())
this.findSelfInfo() this.findSelfInfo()
} }
@ -143,7 +152,7 @@
}, },
async findSelfInfo() { async findSelfInfo() {
let res = await request({ let res = await request({
url: `/app-api/driving/findSelfInfo`, url: `/app-api/small/driving/findSelfInfo`,
method: 'get', method: 'get',
}) })
console.log(res, 138); console.log(res, 138);
@ -331,4 +340,4 @@
margin-right: 10px; margin-right: 10px;
} }
} }
</style> </style>

View File

@ -1,384 +1,393 @@
<template> <template>
<view class="page flex-col"> <view class="page flex-col">
<view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;"> <view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;">
<headers titles="考试结果录入"> <headers titles="考试结果录入">
<uni-icons type="left" color="#000000" size="22px"></uni-icons> <uni-icons type="left" color="#000000" size="22px"></uni-icons>
</headers> </headers>
</view> </view>
<view class="block_2 flex-col"> <view class="block_2 flex-col">
<scroll-view <scroll-view class="scroll-view" scroll-y :style="{ height: scrollHeight + 'px' }" refresher-enabled
class="scroll-view" @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
scroll-y <view class="box_5 flex-col" v-for="(item, index) in examList" :key="index"
:style="{ height: scrollHeight + 'px' }" :style="{ height: ((item.subject != 2 && item.subject != 3) || (getButtonInfo(item).text === '1' || getButtonInfo(item).text === '2')) ? '230rpx' : 'auto' }">
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered" <view class="block_3 flex-row justify-between">
> <view class="text-group_1 flex-col justify-between">
<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) formatDate(item.examTime)
}} }}
</text> </text>
<text class="text_2" v-else>{{ formatDate(item.startTime) }}</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> </scroll-view>
</view> </view>
<view class="text-group_2 flex-col justify-between"> <view class="block_8 flex-col">
<text class="text_4" v-if="item.examScore">{{ item.examScore }}</text> <view class="text-wrapper_8 flex-col" @click="onEnterScoreClick()">
<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()">
<text class="text_19">笔试成绩录入</text> <text class="text_19">笔试成绩录入</text>
<u-picker <u-picker :show="pickerShow" :columns="[pickerColumns]" keyName="label" @confirm="onPickerConfirm"
:show="pickerShow" @cancel="pickerShow = false" />
:columns="[pickerColumns]" </view>
keyName="label" </view>
@confirm="onPickerConfirm" </view>
@cancel="pickerShow = false"
/>
</view>
</view>
</view>
</template> </template>
<script> <script>
import {getLocalUserInfo} from '../../utils/auth'; import {
import request from '@/utils/request.js' getLocalUserInfo
import headers from "@/components/header/headers.vue"; } from '../../utils/auth';
import request from '@/utils/request.js'
import headers from "@/components/header/headers.vue";
export default { export default {
components: {headers}, components: {
data() { headers
return { },
loopData0: [ data() {
{ return {
lanhutext0: '2025-01-20', loopData0: [{
lanhutext1: '考试名称', lanhutext0: '2025-01-20',
lanhutext2: '60分', lanhutext1: '考试名称',
lanhufontColor2: 'rgba(251,66,59,1.000000)', lanhutext2: '60分',
lanhutext3: '考试未通过', lanhufontColor2: 'rgba(251,66,59,1.000000)',
lanhufontColor3: 'rgba(251,66,59,1.000000)', lanhutext3: '考试未通过',
lanhutext4: '科目二', lanhufontColor3: 'rgba(251,66,59,1.000000)',
lanhutext5: 'C2', lanhutext4: '科目二',
lanhutext6: '考试地址:', lanhutext5: 'C2',
lanhutext7: '山东省济南市历下区' lanhutext6: '考试地址:',
}, lanhutext7: '山东省济南市历下区'
{ },
lanhutext0: '2025-01-20', {
lanhutext1: '考试名称', lanhutext0: '2025-01-20',
lanhutext2: '--', lanhutext1: '考试名称',
lanhufontColor2: 'rgba(51,51,51,1.000000)', lanhutext2: '--',
lanhutext3: '待审批', lanhufontColor2: 'rgba(51,51,51,1.000000)',
lanhufontColor3: 'rgba(51,51,51,1.000000)', lanhutext3: '待审批',
lanhutext4: '科目二', lanhufontColor3: 'rgba(51,51,51,1.000000)',
lanhutext5: 'C2', lanhutext4: '科目二',
lanhutext6: '考试地址:', lanhutext5: 'C2',
lanhutext7: '山东省济南市历下区' lanhutext6: '考试地址:',
} lanhutext7: '山东省济南市历下区'
], }
userInfo: {}, ],
examList: {}, userInfo: {},
examTwoList: {}, examList: {},
scrollHeight: 0, examTwoList: {},
constants: {}, scrollHeight: 0,
courseList: [], constants: {},
pickerShow: false, courseList: [],
pickerColumns: [], pickerShow: false,
curNow: 0, pickerColumns: [],
isTriggered: false, curNow: 0,
}; isTriggered: false,
}, };
onLoad() { },
this.userInfo = getLocalUserInfo() onLoad() {
this.getExamList() this.userInfo = getLocalUserInfo()
this.getCourseList() this.getExamList()
// this.getCourseList()
uni.$on('refresh', () => { //
this.getExamList() uni.$on('refresh', () => {
}) this.getExamList()
}, })
onReady() { },
// onReady() {
this.calculateScrollHeight(); //
}, this.calculateScrollHeight();
methods: { },
handleBack() { methods: {
uni.navigateBack({ handleBack() {
delta: 1 uni.navigateBack({
}); delta: 1
}, });
},
/** /**
* 下拉刷新数据 * 下拉刷新数据
*/ */
onRefresherrefresh() { onRefresherrefresh() {
this.isTriggered = true this.isTriggered = true
this.pageNo = 1 this.pageNo = 1
this.total = 0 this.total = 0
this.examList = [] this.examList = []
this.getExamList() this.getExamList()
}, },
// //
onEnterScoreClick() { onEnterScoreClick() {
if (this.courseList.length > 0) { if (this.courseList.length > 0) {
console.log('123123123', this.courseList) console.log('123123123', this.courseList)
this.pickerColumns = this.courseList.map(item => ({ this.pickerColumns = this.courseList.map(item => ({
label: item.courseName, label: item.courseName,
value: item.courseId value: item.courseId
})); }));
this.pickerShow = true; this.pickerShow = true;
} else { } else {
this.$u.toast("暂无课程信息"); this.$u.toast("暂无课程信息");
} }
}, },
// //
onPickerConfirm(e) { onPickerConfirm(e) {
const selectedCourseId = e.value[0]; const selectedCourseId = e.value[0];
const selectedCourse = this.courseList.find(item => item.courseId === selectedCourseId.value); const selectedCourse = this.courseList.find(item => item.courseId === selectedCourseId.value);
if (selectedCourse) { if (selectedCourse) {
this.getProcess(selectedCourse.courseId).then(processData => { this.getProcess(selectedCourse.courseId).then(processData => {
if (!processData || processData.length === 0) { if (!processData || processData.length === 0) {
uni.showToast({ uni.showToast({
title: '暂无课程进度信息', title: '暂无课程进度信息',
icon: 'none' icon: 'none'
}); });
return; return;
} }
// 14 // 14
const hasSubject1Or4 = processData.some(item => const hasSubject1Or4 = processData.some(item =>
item.subject === 1 || item.subject === 4 item.subject === 1 || item.subject === 4
); );
if (hasSubject1Or4) { if (hasSubject1Or4) {
this.goToScoreEntry(selectedCourse); this.goToScoreEntry(selectedCourse);
} else { } else {
uni.showToast({ uni.showToast({
title: '未找到考试信息', title: '未找到考试信息',
icon: 'none' icon: 'none'
}); });
} }
}); });
} }
this.pickerShow = false; this.pickerShow = false;
}, },
// //
goToScoreEntry(course) { goToScoreEntry(course) {
console.log('course', course) console.log('course', course)
/* uni.navigateTo({ /* uni.navigateTo({
url: `/pagesA/examinationAdd/index?courseId=${course.value}&courseType=${course.courseType}&userId=${course.userId}&tenantId=${course.tenantId}&coachId=${course.coachUserId}` url: `/pagesA/examinationAdd/index?courseId=${course.value}&courseType=${course.courseType}&userId=${course.userId}&tenantId=${course.tenantId}&coachId=${course.coachUserId}`
}); */ }); */
this.$u.route({ this.$u.route({
url: '/pagesA/examinationAdd/index', url: '/pagesA/examinationAdd/index',
params: { params: {
courseId: course.courseId, courseId: course.courseId,
courseType: course.courseType, courseType: course.courseType,
userId: course.userId, userId: course.userId,
tenantId: course.tenantId, tenantId: course.tenantId,
coachId :course.coachUserId, coachId: course.coachUserId,
} }
}); });
}, },
// //
getProcess(courseId) { getProcess(courseId) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
request({ request({
url: '/app-api/process/getAllByUserIdAndCourseId', url: '/app-api/process/getAllByUserIdAndCourseId',
method: 'GET', method: 'GET',
params: { params: {
userId: this.userInfo.id, userId: this.userInfo.id,
courseId: courseId, courseId: courseId,
} }
}).then(res => { }).then(res => {
this.processList = res.data; this.processList = res.data;
resolve(res.data); resolve(res.data);
}).catch(err => { }).catch(err => {
console.error('查询失败:', err); console.error('查询失败:', err);
reject(err); reject(err);
}); });
}); });
}, },
// //
getExamList() { getExamList() {
request({ request({
url: '/app-api/process/getExamListByUserId', url: '/app-api/process/getExamListByUserId',
method: 'GET', method: 'GET',
params: { params: {
userId: this.userInfo.id, userId: this.userInfo.id,
} }
}).then(res => { }).then(res => {
// this.examList = res.data // this.examList = res.data
this.examList = res.data.sort((a, b) => { console.log('res', res)
return a.subject - b.subject; // subject subject createTime
}); this.examList = res.data.sort((a, b) => {
// this.getExamTwoList() if (a.subject !== b.subject) {
this.isTriggered = false return a.subject - b.subject;
}) } else {
}, return new Date(a.createTime) - new Date(b.createTime);
/* getExamTwoList() { }
request({ });
url: '/app-api/examBatch/selectExamByUserIdAndCoachId', this.isTriggered = false
method: 'GET', })
params: { },
userId: this.userInfo.id, /* getExamTwoList() {
} request({
}).then(res => { url: '/app-api/examBatch/selectExamByUserIdAndCoachId',
this.examTwoList = res.data method: 'GET',
console.log('examTwoList', this.examTwoList) params: {
console.log('resTwo', res) userId: this.userInfo.id,
}) }
}, */ }).then(res => {
this.examTwoList = res.data
// console.log('examTwoList', this.examTwoList)
getCourseList() { console.log('resTwo', res)
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] || '未知状态';
},
// //
getCourseTypeText(status) { getCourseList() {
const statusMap = { request({
'1': '科目一', url: '/app-api/small/drive/school-course-order/getCourseByLoginUser',
'2': '科目二', method: 'GET'
'3': '科目三', }).then(res => {
'4': '科目四', console.log('课程', res)
}; this.courseList = res.data
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}`;
},
calculateScrollHeight() { //
// getStatusText(status) {
const screenHeight = uni.getSystemInfoSync().windowHeight; const statusMap = {
// 0: '未通过',
const topHeight = 88; 1: '已通过',
// 9: '已送考',
this.scrollHeight = screenHeight - topHeight; 'null': '未送考',
}, 'true': '已通过',
'false': '未通过',
};
return statusMap[status] || '未知状态';
},
//
getButtonInfo(item) { getCourseTypeText(status) {
if (item.fraction == null) { const statusMap = {
return {text: '成绩录入', type: 'input'} '1': '科目一',
} else if (!item.ifPass) { '2': '科目二',
return {text: '2', type: 'failed'} '3': '科目三',
} else if (!item.ifEvaluate) { '4': '科目四',
return {text: '开始评价', type: 'evaluate'} };
}else { return statusMap[status] || '未知状态';
return {text: '1', type: 'evaluate'} },
}
// else if (item.ifEvaluate) {
// return { text: '', type: 'view' }
// }
},
// //
handleButtonClick(item) { formatDate(timestamp) {
const buttonInfo = this.getButtonInfo(item) 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) { calculateScrollHeight() {
case 'input': //
this.goScoreInput(item) const screenHeight = uni.getSystemInfoSync().windowHeight;
break //
case 'evaluate': const topHeight = 88;
this.goEvaluate(item) //
break this.scrollHeight = screenHeight - topHeight;
case 'view': },
this.goViewEvaluation(item)
break
default:
}
},
// getButtonInfo(item) {
goScoreInput(item) { if (item.fraction == null) {
uni.navigateTo({ return {
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}` text: '成绩录入',
}); type: 'input'
}, }
// } else if (!item.ifPass) {
goEvaluate(item) { return {
item = JSON.stringify(item) text: '2',
uni.navigateTo({ type: 'failed'
url: `/pagesA/evaluateAdd/index?data=${item}&type=kaoshi&controls=add` }
}) } else if (!item.ifEvaluate) {
}, return {
text: '开始评价',
type: 'evaluate'
}
} else {
return {
text: '1',
type: 'evaluate'
}
}
// else if (item.ifEvaluate) {
// return { text: '', type: 'view' }
// }
},
// //
goViewEvaluation(item) { handleButtonClick(item) {
uni.navigateTo({ const buttonInfo = this.getButtonInfo(item)
url: `/pagesA/evaluationDetail/index?evaluateId=${item.evaluateId}`
})
}
} 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> </script>
<style lang='scss'> <style lang='scss'>
@import '../common/common.scss'; @import '../common/common.scss';
@import './assets/style/index.rpx.scss'; @import './assets/style/index.rpx.scss';
</style> </style>