From 4adf92071b09fd2b5165076390d691540bdbf16b Mon Sep 17 00:00:00 2001
From: Lx <935448346@qq.com>
Date: Sun, 6 Apr 2025 20:52:37 +0800
Subject: [PATCH] 0406
---
newPages/examinationAdd/index.vue | 160 ++++++++++++++++++++---------
newPages/examinationList/index.vue | 151 ++++++++++++++++++++++-----
2 files changed, 238 insertions(+), 73 deletions(-)
diff --git a/newPages/examinationAdd/index.vue b/newPages/examinationAdd/index.vue
index 160d637..58eb555 100644
--- a/newPages/examinationAdd/index.vue
+++ b/newPages/examinationAdd/index.vue
@@ -51,8 +51,6 @@
>
{{ process.examTime ? formatDate(process.examTime) : '选择时间' }}
-
-
考试类型
- {{ courseType }}
+ {{ courseType }}
+ {{ opCourseType }}
-
+
考试科目
@@ -120,11 +119,15 @@ export default {
userInfo: [],
courseType: null,
courseCompleteStatusList: {},
+ opTenantId: null,
+ opCourseType: null,
+ examId:null,
process: {
+ id:null,
userName: null,
userId: null,
subject:null,
-
+ fraction: null,
examNum: null,
examStatus: null,
examScore: null,
@@ -133,13 +136,26 @@ export default {
images: null,
tenantId: null,
courseId: null,
+ ifPass: null,
+ batchId: null,
+ coachId: null,
},
constants: {}
};
},
- onLoad() {
+ onLoad(options) {
this.userInfo = getLocalUserInfo()
+ console.log('userInfo', this.userInfo)
this.getUserOrderDetails()
+ this.process.subject = options.subject
+ this.opTenantId = options.tenantId
+ this.opCourseType = options.courseType
+ this.process.subject = options.subject
+ this.process.courseId = options.courseId
+ this.process.batchId = options.batchId
+ this.examId = options.id
+ this.process.coachId = options.coachId
+ console.log('options',options)
},
computed: {
displayFileList() {
@@ -274,8 +290,14 @@ export default {
console.log('订单信息',res.data)
if(res.data.records.length > 0){
const tempData = res.data.records[0]
- this.process.courseId = tempData.courseId
- this.courseType = tempData.courseType
+ if(this.process.subject != 2 && this.process.subject != 3){
+ this.process.courseId = tempData.courseId
+ }
+
+ if(this.process.subject != 2 && this.process.subject != 3){
+ this.courseType = tempData.courseType
+ }
+
this.process.tenantId = tempData.tenantId
this.getCourseCompleteStatus()
}
@@ -308,49 +330,89 @@ export default {
},
saveData() {
+ if(this.process.subject == 1 || this.process.subject == 4){
+ this.saveDataOne()
+ }
+ if(this.process.subject == 2 || this.process.subject == 3){
+ this.saveDataTwo()
+ }
+ },
+ saveDataOne(){
if(this.process.subject === 1 && this.courseCompleteStatusList.length <= 0){
- console.log('this.courseCompleteStatusList',this.courseCompleteStatusList)
- uni.showToast({ title: '请联系驾校人员', icon: 'none' });
- return;
-
- }
- if(this.process.subject === 4 && this.courseCompleteStatusList.length <= 0){
-
- uni.showToast({ title: '请联系驾校人员', icon: 'none' });
- return;
-
- }
- console.log('courseCompleteStatusList', this.courseCompleteStatusList.length)
+ console.log('this.courseCompleteStatusList',this.courseCompleteStatusList)
+ uni.showToast({ title: '请联系驾校人员', icon: 'none' });
+ return;
+
+ }
+ if(this.process.subject === 4 && this.courseCompleteStatusList.length <= 0){
+
+ uni.showToast({ title: '请联系驾校人员', icon: 'none' });
+ return;
+
+ }
+ console.log('courseCompleteStatusList', this.courseCompleteStatusList.length)
+
+ this.process.userId = this.userInfo.id
+ this.process.tenantId = this.orderList.tenantId
+ this.process.images = this.fileList?.map(item => item.url).join(',') || '';
+ console.log('process', this.process)
+
+ if (!this.process.userId || !this.process.subject || !this.process.examScore || !this.process.examStatus || !this.process.examTime) {
+ uni.showToast({ title: '信息填写不完整', icon: 'none' });
+ return;
+ }
+ request({
+ url: '/app-api/process/updateProcess',
+ method: 'PUT',
+ data: this.process,
+ }).then(res => {
+ if(res.code === 0){
+ uni.showToast({
+ title: '保存成功',
+ icon: 'success',
+ duration: 1000
+ });
+ setTimeout(() => {
+ uni.navigateBack({
+ delta: 1
+ });
+ }, 1500);
+ }else{
+ uni.showToast({ title: res.data?.message || '保存失败', icon: 'none' });
+ }
+ })
+ },
+ saveDataTwo(){
this.process.userId = this.userInfo.id
- this.process.tenantId = this.userInfo.tenantId
- this.process.images = this.fileList?.map(item => item.url).join(',') || '';
- console.log('process', this.process)
-
- if (!this.process.userId || !this.process.subject || !this.process.examScore || !this.process.examStatus || !this.process.examTime) {
- uni.showToast({ title: '信息填写不完整', icon: 'none' });
- return;
- }
-
- request({
- url: '/app-api/process/updateProcess',
- method: 'PUT',
- data: this.process,
- }).then(res => {
- if(res.code === 0){
- uni.showToast({
- title: '保存成功',
- icon: 'success',
- duration: 1000
- });
- setTimeout(() => {
- uni.navigateBack({
- delta: 1
- });
- }, 1500);
- }else{
- uni.showToast({ title: res.data?.message || '保存失败', icon: 'none' });
- }
- })
+ this.process.tenantId = this.opTenantId
+ this.process.fraction = this.process.examScore
+ this.process.ifPass = this.process.examStatus
+ this.process.id = this.examId
+ this.process.images = this.fileList?.map(item => item.url).join(',') || '';
+ if (!this.process.userId || !this.process.subject || !this.process.examScore || !this.process.examStatus || !this.process.examTime) {
+ uni.showToast({ title: '信息填写不完整', icon: 'none' });
+ return;
+ }
+ request({
+ url: '/app-api/examBatch/update',
+ method: 'PUT',
+ data: this.process,
+ }).then(res => {
+ if(res.code === 0){
+ uni.showToast({
+ title: '保存成功',
+ icon: 'success',
+ duration: 1000
+ });
+ setTimeout(() => {
+ uni.navigateBack({
+ delta: 1
+ });
+ }, 1500);
+ }else{
+ uni.showToast({ title: res.data?.message || '保存失败', icon: 'none' });
+ }
+ })
}
}
diff --git a/newPages/examinationList/index.vue b/newPages/examinationList/index.vue
index 03af137..593193a 100644
--- a/newPages/examinationList/index.vue
+++ b/newPages/examinationList/index.vue
@@ -15,41 +15,52 @@
考试结果录入
-
+ {{ getButtonInfo(item).text }}
- -->
-
-
+
+
+
+ 考试地址:
+ 山东省济南市历下区
+
+ -->
+
@@ -122,6 +135,8 @@ export default {
],
userInfo: {},
examList: {},
+ examTwoList: {},
+ scrollHeight: 0,
constants: {}
};
},
@@ -129,6 +144,10 @@ export default {
this.userInfo = getLocalUserInfo()
this.getExamList()
},
+ onReady() {
+ // 动态计算滚动区域高度
+ this.calculateScrollHeight();
+ },
methods: {
handleBack() {
uni.navigateBack({
@@ -151,20 +170,37 @@ export default {
}
}).then(res => {
this.examList = res.data
+ this.getExamTwoList()
console.log('examList', this.examList)
console.log('res',res)
})
},
+ 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)
+ })
+ },
getStatusText(status) {
const statusMap = {
0: '未通过',
1: '已通过',
9: '已送考',
'null': '未送考',
+ 'true': '已通过',
+ 'false': '未通过',
};
return statusMap[status] || '未知状态';
},
+
getCourseTypeText(status) {
const statusMap = {
'1': '科目一',
@@ -180,7 +216,74 @@ export default {
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要+1
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
- }
+ },
+
+ calculateScrollHeight() {
+ // 获取屏幕高度
+ const screenHeight = uni.getSystemInfoSync().windowHeight;
+ // 获取顶部区域高度
+ const topHeight = 160;
+ // 计算滚动区域高度
+ this.scrollHeight = screenHeight - topHeight;
+ },
+ /* getButtonText(item) {
+ if (item.ifPass && !item.ifEvaluate) return '开始评价'
+ if (item.fraction == null && !item.ifPass) return '成绩录入'
+ if (item.ifEvaluate) return '查看评价'
+ return ''
+ } */
+
+ getButtonInfo(item) {
+ console.log('item', item)
+ if (item.fraction == null ) {
+ return { text: '成绩录入', type: 'input' }
+ } else if (!item.ifPass) {
+ return { text: '考试未通过', type: 'failed' }
+ } else if (item.ifEvaluate) {
+ return { text: '查看评价', type: 'view' }
+ } else {
+ return { text: '开始评价', type: 'evaluate' }
+ }
+ },
+
+ 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: `/newPages/examinationAdd/index?id=${item.id}&batchId=${item.batchId}&tenantId=${item.tenantId}&courseType=${item.courseType}&subject=${item.subject}&courseId=${item.courseId}&coachId=${item.coachId}`
+ });
+ },
+ // 跳转到开始评价页面
+ goEvaluate(item) {
+ uni.navigateTo({
+ url: `/newPages/evaluation/index?batchId=${item.batchId}&evaluateId=${item.evaluateId || ''}`
+ })
+ },
+
+ // 跳转到查看评价页面
+ goViewEvaluation(item) {
+ uni.navigateTo({
+ url: `/newPages/evaluationDetail/index?evaluateId=${item.evaluateId}`
+ })
+ }
+
}
};