This commit is contained in:
Lx 2025-04-06 20:52:37 +08:00
parent 98eb6ed5f2
commit 4adf92071b
2 changed files with 238 additions and 73 deletions

View File

@ -51,8 +51,6 @@
></u-datetime-picker>
<text class="text_3" @click="showTimePicker = true">{{ process.examTime ? formatDate(process.examTime) : '选择时间' }}</text>
</view>
</view>
<!-- <view class="text-wrapper_9 flex-row justify-between">
<text class="text_6">姓名</text>
@ -68,9 +66,10 @@
</view> -->
<view class="text-wrapper_10 flex-row justify-between">
<text class="text_8">考试类型</text>
<text class="text_9">{{ courseType }}</text>
<text class="text_9" v-if="process.subject != 2 && process.subject != 3" >{{ courseType }}</text>
<text class="text_9" v-else >{{ opCourseType }}</text>
</view>
<view class="text-wrapper_11 flex-row justify-between" @click="subjectShow = true">
<view class="text-wrapper_11 flex-row justify-between" @click="subjectShow = true" v-if="process.subject != 2 && process.subject != 3">
<text class="text_10">考试科目</text>
<view>
<u-picker v-model="process.subject" :show="subjectShow" :columns="subjectColumns" title="科目" @confirm="subjectOnConfirm" @cancel="subjectShow = false">
@ -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' });
}
})
}
}

View File

@ -15,41 +15,52 @@
<text class="text_1">考试结果录入</text>
</view>
<!-- <view class="box_5 flex-col">
<view>
<scroll-view
class="scroll-view"
scroll-y
:style="{ height: scrollHeight + 'px' }"
>
<view
class="box_5 flex-col" v-for="(item, index) in examList"
:key="index"
:style="{ height: (item.subject != 2 && item.subject != 3) ? '210rpx' : 'auto' }">
<view class="block_3 flex-row justify-between">
<view class="text-group_1 flex-col justify-between">
<text class="text_2">2025-01-20</text>
<text class="text_3">考试名称</text>
<text class="text_2">{{ formatDate(item.examTime) }}</text>
<text class="text_3">{{ item.courseName }}</text>
</view>
<view class="text-group_2 flex-col justify-between">
<text class="text_4">99</text>
<text class="text_5">考试通过</text>
<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">科目二</text>
<text class="text_6">{{getCourseTypeText(item.subject)}}</text>
</view>
<view class="text-wrapper_2 flex-col">
<text class="text_7">C2</text>
<text class="text_7">{{ item.courseType }}</text>
</view>
</view>
<view class="text-wrapper_3 flex-row justify-between">
<view class="text-wrapper_3 flex-row justify-between" v-if="item.subject == 2 || item.suject == 3">
<text class="text_8">考试地址</text>
<text class="text_9">山东省济南市历下区</text>
<text class="text_9">{{ item.addr }}</text>
</view>
<view class="block_5 flex-row">
<view class="text-wrapper_4 flex-col">
<text class="text_10">开始评价</text>
<view class="block_5 flex-row" v-if="item.subject == 2 || item.subject == 3">
<view class="text-wrapper_4 flex-col" @click="handleButtonClick(item)">
<!-- <text class="text_10" v-if="item.fraction != null && item.ifPass">开始评价</text>
<text class="text_10" v-else-if="item.fraction == null && (item.ifPass == null || item.ifPass == 0)">成绩录入</text>
<text class="text_10" v-else-if="!item.ifEvaluate">查看评价</text> -->
<text class="text_10">{{ getButtonInfo(item).text }}</text>
</view>
</view>
</view> -->
<view class="list_1 flex-col">
<view
class="list-items_1 flex-col"
v-for="(item, index) in examList"
:key="index"
>
</view>
<!-- <view class="list_1 flex-col">
<view class="list-items_1 flex-col" v-for="(item, index) in examList" :key="index" >
<view class="block_6 flex-row justify-between">
<view class="text-group_3 flex-col justify-between">
<text class="text_11" >{{ formatDate(item.examTime) }}</text>
@ -74,11 +85,13 @@
<text class="text_16" >{{item.courseType}}</text>
</view>
</view>
<!-- <view class="text-wrapper_7 flex-row justify-between">
<text class="text_17" >{{3}}</text>
<text class="text_18" >{{4}}</text>
</view> -->
<view class="text-wrapper_7 flex-row justify-between">
<text class="text_17" >考试地址</text>
<text class="text_18" >山东省济南市历下区</text>
</view>
</view>
</view> -->
</scroll-view>
</view>
</view>
<view class="block_8 flex-col">
@ -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}`
})
}
}
};
</script>