2025-03-15 17:32:23 +08:00
|
|
|
<template>
|
|
|
|
<view class="page flex-col">
|
|
|
|
<view class="group_1 flex-row">
|
2025-04-01 17:57:14 +08:00
|
|
|
|
|
|
|
|
2025-03-15 17:32:23 +08:00
|
|
|
</view>
|
|
|
|
<view class="group_2 flex-row">
|
|
|
|
<image
|
|
|
|
class="label_1"
|
|
|
|
referrerpolicy="no-referrer"
|
|
|
|
src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNGacf527a62cbe7351c6472edd8f5b2814.png"
|
2025-04-02 14:02:49 +08:00
|
|
|
@click="handleBack()"
|
2025-03-15 17:32:23 +08:00
|
|
|
/>
|
|
|
|
<text class="text_1">考试结果</text>
|
2025-04-01 17:57:14 +08:00
|
|
|
|
2025-03-15 17:32:23 +08:00
|
|
|
</view>
|
|
|
|
<view class="group_4 flex-col">
|
2025-04-01 17:57:14 +08:00
|
|
|
<view class="block_1 flex-row justify-between" @click="show = true">
|
2025-03-15 17:32:23 +08:00
|
|
|
<text class="text_19">是否通过</text>
|
|
|
|
<view class="image-text_1 flex-row justify-between">
|
2025-04-01 17:57:14 +08:00
|
|
|
|
|
|
|
<view>
|
|
|
|
<u-picker v-model="process.examStatus" :show="show" :columns="ifPassColumns" title="是否通过" @confirm="ifPassOnConfirm" @cancel="show = false">
|
|
|
|
</u-picker>
|
|
|
|
<text class="text-group_2">{{ selectedValue || '请选择' }}</text>
|
|
|
|
</view>
|
|
|
|
|
2025-03-15 17:32:23 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="text-wrapper_7 flex-row justify-between">
|
|
|
|
<text class="text_4">分数</text>
|
2025-04-01 17:57:14 +08:00
|
|
|
<view class="text_5_1 ">
|
|
|
|
<u--input
|
|
|
|
placeholder="请输入分数"
|
|
|
|
border="none"
|
|
|
|
v-model="process.examScore"
|
|
|
|
maxlength="3"
|
|
|
|
inputAlign="right"
|
|
|
|
>分</u--input>
|
|
|
|
</view>
|
2025-03-15 17:32:23 +08:00
|
|
|
</view>
|
|
|
|
<view class="text-wrapper_8 flex-row justify-between">
|
|
|
|
<text class="text_20">时间</text>
|
2025-04-01 17:57:14 +08:00
|
|
|
<view>
|
|
|
|
<u-datetime-picker
|
|
|
|
:show="showTimePicker"
|
|
|
|
v-model="process.examTime"
|
|
|
|
mode="datetime"
|
|
|
|
@confirm="onConfirmExamTime"
|
|
|
|
@cancel="showTimePicker = false"
|
|
|
|
></u-datetime-picker>
|
|
|
|
<text class="text_3" @click="showTimePicker = true">{{ process.examTime ? formatDate(process.examTime) : '选择时间' }}</text>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
2025-03-15 17:32:23 +08:00
|
|
|
</view>
|
2025-04-02 18:05:36 +08:00
|
|
|
<!-- <view class="text-wrapper_9 flex-row justify-between">
|
2025-03-15 17:32:23 +08:00
|
|
|
<text class="text_6">姓名</text>
|
2025-04-01 17:57:14 +08:00
|
|
|
<view class="text_5_1 ">
|
|
|
|
<u--input
|
|
|
|
placeholder="请输入姓名"
|
|
|
|
border="none"
|
2025-04-02 14:02:49 +08:00
|
|
|
v-model="process.userName"
|
2025-04-01 17:57:14 +08:00
|
|
|
maxlength="3"
|
|
|
|
inputAlign="right"
|
2025-04-02 18:05:36 +08:00
|
|
|
></u--input>
|
2025-04-01 17:57:14 +08:00
|
|
|
</view>
|
2025-04-02 18:05:36 +08:00
|
|
|
</view> -->
|
2025-03-15 17:32:23 +08:00
|
|
|
<view class="text-wrapper_10 flex-row justify-between">
|
|
|
|
<text class="text_8">考试类型</text>
|
2025-04-02 18:05:36 +08:00
|
|
|
<text class="text_9">{{ courseType }}</text>
|
2025-03-15 17:32:23 +08:00
|
|
|
</view>
|
2025-04-01 17:57:14 +08:00
|
|
|
<view class="text-wrapper_11 flex-row justify-between" @click="subjectShow = true">
|
2025-03-15 17:32:23 +08:00
|
|
|
<text class="text_10">考试科目</text>
|
2025-04-01 17:57:14 +08:00
|
|
|
<view>
|
|
|
|
<u-picker v-model="process.subject" :show="subjectShow" :columns="subjectColumns" title="科目" @confirm="subjectOnConfirm" @cancel="subjectShow = false">
|
|
|
|
</u-picker>
|
|
|
|
<text class="text-group_2">{{ subjectValue || '请选择科目' }}</text>
|
|
|
|
</view>
|
2025-03-15 17:32:23 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="group_5 flex-col">
|
|
|
|
<text class="text_16">备注</text>
|
2025-04-02 14:02:49 +08:00
|
|
|
<u--textarea class="text_17" v-model="process.remark" placeholder="请输入内容" count ></u--textarea>
|
2025-03-15 17:32:23 +08:00
|
|
|
<text class="text_18">图片</text>
|
|
|
|
<view class="image-wrapper_4 flex-row justify-between">
|
2025-04-02 14:02:49 +08:00
|
|
|
<u-upload
|
|
|
|
|
|
|
|
:fileList="displayFileList"
|
|
|
|
@afterRead="afterRead"
|
|
|
|
@delete="deletePic"
|
|
|
|
multiple
|
|
|
|
:maxCount="2"
|
|
|
|
></u-upload>
|
2025-03-15 17:32:23 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
2025-04-02 14:02:49 +08:00
|
|
|
<view class="block_8 flex-col">
|
|
|
|
<view class="text-wrapper_8 flex-col" @click="saveData()">
|
|
|
|
<text class="text_19">确定</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
2025-03-15 17:32:23 +08:00
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
<script>
|
2025-04-02 14:02:49 +08:00
|
|
|
import upload from '@/utils/upload.js'
|
|
|
|
import request from '@/utils/request.js'
|
|
|
|
import { getLocalUserInfo } from '../../utils/auth';
|
2025-03-15 17:32:23 +08:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2025-04-01 17:57:14 +08:00
|
|
|
show: false,
|
|
|
|
showTimePicker: false,
|
|
|
|
subjectShow: false,
|
|
|
|
ifPassColumns: [['已通过', '未通过']],
|
2025-04-02 18:05:36 +08:00
|
|
|
subjectColumns: [['科目一']],
|
2025-04-01 17:57:14 +08:00
|
|
|
selectedValue: '',
|
|
|
|
subjectValue: '',
|
2025-04-02 14:02:49 +08:00
|
|
|
fileList: [],
|
|
|
|
imageUrl: this.$imagesUrl,
|
|
|
|
userInfo: [],
|
2025-04-02 18:05:36 +08:00
|
|
|
courseType: null,
|
|
|
|
courseCompleteStatusList: {},
|
2025-04-01 17:57:14 +08:00
|
|
|
process: {
|
2025-04-02 14:02:49 +08:00
|
|
|
userName: null,
|
2025-04-01 17:57:14 +08:00
|
|
|
userId: null,
|
|
|
|
subject:null,
|
2025-04-02 18:05:36 +08:00
|
|
|
|
2025-04-01 17:57:14 +08:00
|
|
|
examNum: null,
|
|
|
|
examStatus: null,
|
|
|
|
examScore: null,
|
2025-04-02 14:02:49 +08:00
|
|
|
remark: '',
|
2025-04-01 17:57:14 +08:00
|
|
|
examTime: null,
|
|
|
|
images: null,
|
2025-04-02 14:02:49 +08:00
|
|
|
tenantId: null,
|
2025-04-02 18:05:36 +08:00
|
|
|
courseId: null,
|
2025-04-01 17:57:14 +08:00
|
|
|
},
|
2025-03-15 17:32:23 +08:00
|
|
|
constants: {}
|
|
|
|
};
|
|
|
|
},
|
2025-04-02 14:02:49 +08:00
|
|
|
onLoad() {
|
|
|
|
this.userInfo = getLocalUserInfo()
|
|
|
|
this.getUserOrderDetails()
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
displayFileList() {
|
|
|
|
return this.fileList.map(item => {
|
|
|
|
if (item.url.startsWith('http')) {
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
const prefix = this.$imagesUrl.endsWith('/') ? this.$imagesUrl : `${this.$imagesUrl}/`;
|
|
|
|
const fullUrl = item.url.startsWith('/')
|
2025-04-02 18:05:36 +08:00
|
|
|
? `${prefix}${item.url.slice(1)}`
|
|
|
|
: `${prefix}${item.url}`;
|
2025-04-02 14:02:49 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
...item,
|
|
|
|
url: fullUrl,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
2025-04-01 17:57:14 +08:00
|
|
|
methods: {
|
2025-04-02 14:02:49 +08:00
|
|
|
handleBack() {
|
|
|
|
uni.navigateBack({
|
|
|
|
delta: 1
|
|
|
|
});
|
|
|
|
},
|
2025-04-01 17:57:14 +08:00
|
|
|
ifPassOnConfirm(value) {
|
|
|
|
console.log('选中的值:', value);
|
|
|
|
|
|
|
|
const statusMap = {
|
|
|
|
'已通过': 1,
|
|
|
|
'未通过': 0
|
|
|
|
};
|
|
|
|
|
|
|
|
// 更新数据
|
2025-04-02 18:05:36 +08:00
|
|
|
this.process.examStatus = statusMap[value.value[0]];
|
2025-04-01 17:57:14 +08:00
|
|
|
console.log('value[0]', value.value[0])
|
2025-04-02 18:05:36 +08:00
|
|
|
this.selectedValue = value.value[0];
|
|
|
|
this.show = false;
|
2025-04-01 17:57:14 +08:00
|
|
|
|
|
|
|
console.log('examStatus:', this.process.examStatus);
|
|
|
|
console.log('process', this.process)
|
|
|
|
},
|
|
|
|
|
|
|
|
subjectOnConfirm(value) {
|
|
|
|
console.log('选中的值:', value);
|
|
|
|
|
|
|
|
const statusMap = {
|
|
|
|
'科目一': 1,
|
|
|
|
'科目四': 4
|
|
|
|
};
|
|
|
|
|
|
|
|
// 更新数据
|
2025-04-02 18:05:36 +08:00
|
|
|
this.process.subject = statusMap[value.value[0]];
|
2025-04-01 17:57:14 +08:00
|
|
|
console.log('value[0]', value.value[0])
|
2025-04-02 18:05:36 +08:00
|
|
|
this.subjectValue = value.value[0];
|
|
|
|
this.subjectShow = false;
|
2025-04-01 17:57:14 +08:00
|
|
|
|
|
|
|
console.log('subject:', this.process.subject);
|
|
|
|
console.log('process', this.process)
|
|
|
|
},
|
|
|
|
|
|
|
|
onConfirmExamTime(value) {
|
|
|
|
console.log("选中的时间:", value);
|
2025-04-02 18:05:36 +08:00
|
|
|
this.process.examTime = value;
|
|
|
|
this.showTimePicker = false;
|
2025-04-01 17:57:14 +08:00
|
|
|
},
|
|
|
|
// 格式化时间戳的方法
|
|
|
|
formatDate(timestamp) {
|
|
|
|
const date = new Date(timestamp);
|
|
|
|
const year = date.getFullYear();
|
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
|
const day = String(date.getDate()).padStart(2, '0');
|
|
|
|
const hours = String(date.getHours()).padStart(2, '0');
|
|
|
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
|
|
return `${year}-${month}-${day} ${hours}:${minutes}`;
|
|
|
|
},
|
2025-04-02 14:02:49 +08:00
|
|
|
|
2025-04-02 18:05:36 +08:00
|
|
|
|
2025-04-02 14:02:49 +08:00
|
|
|
deletePic(event) {
|
2025-04-02 18:05:36 +08:00
|
|
|
this.fileList.splice(event.index, 1);
|
2025-04-02 14:02:49 +08:00
|
|
|
},
|
|
|
|
// 新增图片
|
|
|
|
async afterRead(event) {
|
2025-04-02 18:05:36 +08:00
|
|
|
let lists = [].concat(event.file);
|
2025-04-02 14:02:49 +08:00
|
|
|
let fileListLen = this.fileList.length;
|
|
|
|
|
|
|
|
for (let i = 0; i < lists.length; i++) {
|
|
|
|
try {
|
2025-04-02 18:05:36 +08:00
|
|
|
const resultUrl = await this.uploadFilePromise(lists[i].url);
|
2025-04-02 14:02:49 +08:00
|
|
|
let item = {
|
|
|
|
status: 'success',
|
2025-04-02 18:05:36 +08:00
|
|
|
url: resultUrl,
|
2025-04-02 14:02:49 +08:00
|
|
|
};
|
|
|
|
this.fileList.splice(fileListLen, 0, item);
|
|
|
|
fileListLen++;
|
|
|
|
} catch (error) {
|
|
|
|
console.error('图片上传失败', error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
uploadFilePromise(filePath) {
|
|
|
|
console.log('图片地址', filePath)
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
upload({
|
|
|
|
url: '/app-api/small-upload/common/upload',
|
|
|
|
filePath: filePath,
|
|
|
|
}).then((res) => {
|
|
|
|
if (res.data && res.data.url) {
|
2025-04-02 18:05:36 +08:00
|
|
|
resolve(res.data.url);
|
2025-04-02 14:02:49 +08:00
|
|
|
console.log('返回', res)
|
|
|
|
console.log('返回url', res.data.url)
|
|
|
|
} else {
|
|
|
|
reject(new Error('上传失败'));
|
|
|
|
}
|
|
|
|
}).catch(err => reject(err));
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
getUserOrderDetails() {
|
|
|
|
request({
|
|
|
|
url: '/app-api/small/drive/school-course-order/page',
|
|
|
|
method: 'GET',
|
|
|
|
params: {
|
2025-04-02 18:05:36 +08:00
|
|
|
userId: this.userInfo.id,
|
2025-04-02 14:02:49 +08:00
|
|
|
paymentStatus:'2',
|
|
|
|
ifEnd: 0,
|
|
|
|
},
|
|
|
|
tenantIdFlag : false
|
|
|
|
}).then(res => {
|
|
|
|
this.orderList = res.data.records;
|
|
|
|
console.log('订单信息',res.data)
|
2025-04-02 18:05:36 +08:00
|
|
|
if(res.data.records.length > 0){
|
|
|
|
const tempData = res.data.records[0]
|
|
|
|
this.process.courseId = tempData.courseId
|
|
|
|
this.courseType = tempData.courseType
|
|
|
|
this.process.tenantId = tempData.tenantId
|
|
|
|
this.getCourseCompleteStatus()
|
|
|
|
}
|
2025-04-02 14:02:49 +08:00
|
|
|
});
|
|
|
|
},
|
2025-04-02 18:05:36 +08:00
|
|
|
|
|
|
|
getCourseCompleteStatus(){
|
|
|
|
console.log('userId', this.userId)
|
|
|
|
console.log('courseId', this.process.courseId)
|
|
|
|
request({
|
|
|
|
url:'/app-api/process/page',
|
|
|
|
method: 'GET',
|
|
|
|
params: {
|
|
|
|
userId: this.userInfo.id,
|
|
|
|
courseId: this.process.courseId,
|
|
|
|
}
|
|
|
|
}).then(res => {
|
|
|
|
this.courseCompleteStatusList = res.data.records
|
|
|
|
console.log('res.data',res.data)
|
|
|
|
if(this.courseCompleteStatusList.length > 0){
|
|
|
|
console.log('courseCompleteStatusList', this.courseCompleteStatusList)
|
|
|
|
const subject2 = this.courseCompleteStatusList.find(item => item.subject === 2)
|
|
|
|
const subject3 = this.courseCompleteStatusList.find(item => item.subject === 3)
|
|
|
|
|
|
|
|
if (subject2?.status === 2 && subject3?.status === 2) {
|
|
|
|
this.subjectColumns = [['科目一', '科目四']]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
2025-04-02 14:02:49 +08:00
|
|
|
|
|
|
|
saveData() {
|
2025-04-02 18:05:36 +08:00
|
|
|
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)
|
2025-04-02 14:02:49 +08:00
|
|
|
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)
|
|
|
|
|
2025-04-02 18:05:36 +08:00
|
|
|
if (!this.process.userId || !this.process.subject || !this.process.examScore || !this.process.examStatus || !this.process.examTime) {
|
|
|
|
uni.showToast({ title: '信息填写不完整', icon: 'none' });
|
2025-04-02 14:02:49 +08:00
|
|
|
return;
|
|
|
|
}
|
2025-04-02 18:05:36 +08:00
|
|
|
|
2025-04-02 14:02:49 +08:00
|
|
|
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(() => {
|
2025-04-02 18:05:36 +08:00
|
|
|
uni.navigateBack({
|
|
|
|
delta: 1
|
2025-04-02 14:02:49 +08:00
|
|
|
});
|
|
|
|
}, 1500);
|
|
|
|
}else{
|
|
|
|
uni.showToast({ title: res.data?.message || '保存失败', icon: 'none' });
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2025-04-01 17:57:14 +08:00
|
|
|
|
|
|
|
}
|
2025-03-15 17:32:23 +08:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style lang='scss'>
|
|
|
|
@import '../common/common.scss';
|
|
|
|
@import './assets/style/index.rpx.scss';
|
2025-04-01 17:57:14 +08:00
|
|
|
|
2025-03-15 17:32:23 +08:00
|
|
|
</style>
|