This commit is contained in:
Lx 2025-04-02 18:05:36 +08:00
parent 536a1d41a3
commit 98eb6ed5f2
2 changed files with 139 additions and 90 deletions

View File

@ -18,20 +18,13 @@
<view class="block_1 flex-row justify-between" @click="show = true"> <view class="block_1 flex-row justify-between" @click="show = true">
<text class="text_19">是否通过</text> <text class="text_19">是否通过</text>
<view class="image-text_1 flex-row justify-between"> <view class="image-text_1 flex-row justify-between">
<!-- <text class="text-group_2">已通过</text> -->
<view> <view>
<u-picker v-model="process.examStatus" :show="show" :columns="ifPassColumns" title="是否通过" @confirm="ifPassOnConfirm" @cancel="show = false"> <u-picker v-model="process.examStatus" :show="show" :columns="ifPassColumns" title="是否通过" @confirm="ifPassOnConfirm" @cancel="show = false">
</u-picker> </u-picker>
<text class="text-group_2">{{ selectedValue || '请选择' }}</text> <text class="text-group_2">{{ selectedValue || '请选择' }}</text>
<!-- <u-button @click="show = true"><text class="text-group_2">{{ selectedValue || '请选择' }}</text></u-button> -->
</view> </view>
<!-- <image
class="thumbnail_2"
referrerpolicy="no-referrer"
src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNGe9aade9ef56a9cabc28f2f1b0555105b.png"
/> -->
</view> </view>
</view> </view>
<view class="text-wrapper_7 flex-row justify-between"> <view class="text-wrapper_7 flex-row justify-between">
@ -57,13 +50,11 @@
@cancel="showTimePicker = false" @cancel="showTimePicker = false"
></u-datetime-picker> ></u-datetime-picker>
<text class="text_3" @click="showTimePicker = true">{{ process.examTime ? formatDate(process.examTime) : '选择时间' }}</text> <text class="text_3" @click="showTimePicker = true">{{ process.examTime ? formatDate(process.examTime) : '选择时间' }}</text>
<!-- <u-button @click="showTimePicker = true">打开</u-button> -->
</view> </view>
</view> </view>
<view class="text-wrapper_9 flex-row justify-between"> <!-- <view class="text-wrapper_9 flex-row justify-between">
<text class="text_6">姓名</text> <text class="text_6">姓名</text>
<view class="text_5_1 "> <view class="text_5_1 ">
<u--input <u--input
@ -72,12 +63,12 @@
v-model="process.userName" v-model="process.userName"
maxlength="3" maxlength="3"
inputAlign="right" inputAlign="right"
></u--input> ></u--input>
</view>
</view> </view>
</view> -->
<view class="text-wrapper_10 flex-row justify-between"> <view class="text-wrapper_10 flex-row justify-between">
<text class="text_8">考试类型</text> <text class="text_8">考试类型</text>
<text class="text_9">C1</text> <text class="text_9">{{ courseType }}</text>
</view> </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">
<text class="text_10">考试科目</text> <text class="text_10">考试科目</text>
@ -85,18 +76,8 @@
<u-picker v-model="process.subject" :show="subjectShow" :columns="subjectColumns" title="科目" @confirm="subjectOnConfirm" @cancel="subjectShow = false"> <u-picker v-model="process.subject" :show="subjectShow" :columns="subjectColumns" title="科目" @confirm="subjectOnConfirm" @cancel="subjectShow = false">
</u-picker> </u-picker>
<text class="text-group_2">{{ subjectValue || '请选择科目' }}</text> <text class="text-group_2">{{ subjectValue || '请选择科目' }}</text>
<!-- <u-button @click="show = true"><text class="text-group_2">{{ selectedValue || '请选择' }}</text></u-button> -->
</view> </view>
<!-- <text class="text_11">科目二</text> -->
</view> </view>
<!-- <view class="text-wrapper_12 flex-row justify-between">
<text class="text_12">考试地址</text>
<text class="text_13">山东省济南市历下区</text>
</view>
<view class="text-wrapper_13 flex-row justify-between">
<text class="text_14">交通方式</text>
<text class="text_15">公交车</text>
</view> -->
</view> </view>
<view class="group_5 flex-col"> <view class="group_5 flex-col">
<text class="text_16">备注</text> <text class="text_16">备注</text>
@ -111,16 +92,6 @@
multiple multiple
:maxCount="2" :maxCount="2"
></u-upload> ></u-upload>
<!-- <image
class="image_3"
referrerpolicy="no-referrer"
src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNG531b2664a25a7d42a43f00faa060acb1.png"
/>
<image
class="image_4"
referrerpolicy="no-referrer"
src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNG66b1c863f069a58fb4ff203ed443e5ad.png"
/> -->
</view> </view>
</view> </view>
<view class="block_8 flex-col"> <view class="block_8 flex-col">
@ -141,17 +112,19 @@ export default {
showTimePicker: false, showTimePicker: false,
subjectShow: false, subjectShow: false,
ifPassColumns: [['已通过', '未通过']], ifPassColumns: [['已通过', '未通过']],
subjectColumns: [['科目一', '科目四' ]], subjectColumns: [['科目一']],
selectedValue: '', selectedValue: '',
subjectValue: '', subjectValue: '',
fileList: [], fileList: [],
imageUrl: this.$imagesUrl, imageUrl: this.$imagesUrl,
userInfo: [], userInfo: [],
courseType: null,
courseCompleteStatusList: {},
process: { process: {
userName: null, userName: null,
userId: null, userId: null,
subject:null, subject:null,
courseType: null,
examNum: null, examNum: null,
examStatus: null, examStatus: null,
examScore: null, examScore: null,
@ -159,7 +132,7 @@ export default {
examTime: null, examTime: null,
images: null, images: null,
tenantId: null, tenantId: null,
courseId: null,
}, },
constants: {} constants: {}
}; };
@ -171,16 +144,14 @@ export default {
computed: { computed: {
displayFileList() { displayFileList() {
return this.fileList.map(item => { return this.fileList.map(item => {
// url http/https使
if (item.url.startsWith('http')) { if (item.url.startsWith('http')) {
return item; return item;
} }
//
const prefix = this.$imagesUrl.endsWith('/') ? this.$imagesUrl : `${this.$imagesUrl}/`; const prefix = this.$imagesUrl.endsWith('/') ? this.$imagesUrl : `${this.$imagesUrl}/`;
const fullUrl = item.url.startsWith('/') const fullUrl = item.url.startsWith('/')
? `${prefix}${item.url.slice(1)}` // 避免双斜杠(如 https://domain.com//path ? `${prefix}${item.url.slice(1)}`
: `${prefix}${item.url}`; // https://domain.com/path : `${prefix}${item.url}`;
return { return {
...item, ...item,
@ -204,10 +175,10 @@ export default {
}; };
// //
this.process.examStatus = statusMap[value.value[0]]; // \ this.process.examStatus = statusMap[value.value[0]];
console.log('value[0]', value.value[0]) console.log('value[0]', value.value[0])
this.selectedValue = value.value[0]; // this.selectedValue = value.value[0];
this.show = false; // this.show = false;
console.log('examStatus:', this.process.examStatus); console.log('examStatus:', this.process.examStatus);
console.log('process', this.process) console.log('process', this.process)
@ -222,10 +193,10 @@ export default {
}; };
// //
this.process.subject = statusMap[value.value[0]]; // \ this.process.subject = statusMap[value.value[0]];
console.log('value[0]', value.value[0]) console.log('value[0]', value.value[0])
this.subjectValue = value.value[0]; // this.subjectValue = value.value[0];
this.subjectShow = false; // this.subjectShow = false;
console.log('subject:', this.process.subject); console.log('subject:', this.process.subject);
console.log('process', this.process) console.log('process', this.process)
@ -233,8 +204,8 @@ export default {
onConfirmExamTime(value) { onConfirmExamTime(value) {
console.log("选中的时间:", value); console.log("选中的时间:", value);
this.process.examTime = value; // process.examTime this.process.examTime = value;
this.showTimePicker = false; // this.showTimePicker = false;
}, },
// //
formatDate(timestamp) { formatDate(timestamp) {
@ -247,31 +218,21 @@ export default {
return `${year}-${month}-${day} ${hours}:${minutes}`; return `${year}-${month}-${day} ${hours}:${minutes}`;
}, },
//
/* deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
if (event.name == '1') {
this.photoUrl.splice(event.index, 1)
}
if (event.name == '2') {
this.videoUr = null
}
}, */
deletePic(event) { deletePic(event) {
this.fileList.splice(event.index, 1); // fileList this.fileList.splice(event.index, 1);
}, },
// //
async afterRead(event) { async afterRead(event) {
let lists = [].concat(event.file); // let lists = [].concat(event.file);
let fileListLen = this.fileList.length; let fileListLen = this.fileList.length;
for (let i = 0; i < lists.length; i++) { for (let i = 0; i < lists.length; i++) {
try { try {
const resultUrl = await this.uploadFilePromise(lists[i].url); // URL const resultUrl = await this.uploadFilePromise(lists[i].url);
let item = { let item = {
status: 'success', status: 'success',
url: resultUrl, // URL url: resultUrl,
}; };
this.fileList.splice(fileListLen, 0, item); this.fileList.splice(fileListLen, 0, item);
fileListLen++; fileListLen++;
@ -288,7 +249,7 @@ export default {
filePath: filePath, filePath: filePath,
}).then((res) => { }).then((res) => {
if (res.data && res.data.url) { if (res.data && res.data.url) {
resolve(res.data.url); // URL resolve(res.data.url);
console.log('返回', res) console.log('返回', res)
console.log('返回url', res.data.url) console.log('返回url', res.data.url)
} else { } else {
@ -303,7 +264,7 @@ export default {
url: '/app-api/small/drive/school-course-order/page', url: '/app-api/small/drive/school-course-order/page',
method: 'GET', method: 'GET',
params: { params: {
userId: this.userId, userId: this.userInfo.id,
paymentStatus:'2', paymentStatus:'2',
ifEnd: 0, ifEnd: 0,
}, },
@ -311,20 +272,62 @@ export default {
}).then(res => { }).then(res => {
this.orderList = res.data.records; this.orderList = res.data.records;
console.log('订单信息',res.data) 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
this.process.tenantId = tempData.tenantId
this.getCourseCompleteStatus()
}
}); });
}, },
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 = [['科目一', '科目四']]
}
}
})
},
saveData() { saveData() {
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)
this.process.userId = this.userInfo.id this.process.userId = this.userInfo.id
this.process.tenantId = this.userInfo.tenantId this.process.tenantId = this.userInfo.tenantId
// 1. URL
this.process.images = this.fileList?.map(item => item.url).join(',') || ''; this.process.images = this.fileList?.map(item => item.url).join(',') || '';
console.log('process', this.process) console.log('process', this.process)
// 2. if (!this.process.userId || !this.process.subject || !this.process.examScore || !this.process.examStatus || !this.process.examTime) {
if (!this.process.userId || !this.process.subject) { uni.showToast({ title: '信息填写不完整', icon: 'none' });
uni.showToast({ title: '用户ID和科目不能为空', icon: 'none' });
return; return;
} }
@ -340,8 +343,8 @@ export default {
duration: 1000 duration: 1000
}); });
setTimeout(() => { setTimeout(() => {
uni.navigateTo({ uni.navigateBack({
url: '/newPages/examinationList/index' delta: 1
}); });
}, 1500); }, 1500);
}else{ }else{

View File

@ -15,7 +15,7 @@
<text class="text_1">考试结果录入</text> <text class="text_1">考试结果录入</text>
</view> </view>
<view class="box_5 flex-col"> <!-- <view class="box_5 flex-col">
<view class="block_3 flex-row justify-between"> <view class="block_3 flex-row justify-between">
<view class="text-group_1 flex-col justify-between"> <view class="text-group_1 flex-col justify-between">
<text class="text_2">2025-01-20</text> <text class="text_2">2025-01-20</text>
@ -43,43 +43,41 @@
<text class="text_10">开始评价</text> <text class="text_10">开始评价</text>
</view> </view>
</view> </view>
</view> </view> -->
<view class="list_1 flex-col"> <view class="list_1 flex-col">
<view <view
class="list-items_1 flex-col" class="list-items_1 flex-col"
v-for="(item, index) in loopData0" v-for="(item, index) in examList"
:key="index" :key="index"
> >
<view class="block_6 flex-row justify-between"> <view class="block_6 flex-row justify-between">
<view class="text-group_3 flex-col justify-between"> <view class="text-group_3 flex-col justify-between">
<text class="text_11" v-html="item.lanhutext0"></text> <text class="text_11" >{{ formatDate(item.examTime) }}</text>
<text class="text_12" v-html="item.lanhutext1"></text> <text class="text_12" >{{item.courseName}}</text>
</view> </view>
<view class="text-group_4 flex-col justify-between"> <view class="text-group_4 flex-col justify-between">
<text <text
class="text_13" class="text_13"
:style="{ color: item.lanhufontColor2 }" :style="{ color: item.examScore }"
v-html="item.lanhutext2" >{{item.examScore}}</text>
></text>
<text <text
class="text_14" class="text_14"
:style="{ color: item.lanhufontColor3 }" :style="{ color: item.examStatus }"
v-html="item.lanhutext3" >{{ getStatusText(item.examStatus) }}</text>
></text>
</view> </view>
</view> </view>
<view class="block_7 flex-row justify-between"> <view class="block_7 flex-row justify-between">
<view class="text-wrapper_5 flex-col"> <view class="text-wrapper_5 flex-col">
<text class="text_15" v-html="item.lanhutext4"></text> <text class="text_15" >{{getCourseTypeText(item.subject)}}</text>
</view> </view>
<view class="text-wrapper_6 flex-col"> <view class="text-wrapper_6 flex-col">
<text class="text_16" v-html="item.lanhutext5"></text> <text class="text_16" >{{item.courseType}}</text>
</view> </view>
</view> </view>
<view class="text-wrapper_7 flex-row justify-between"> <!-- <view class="text-wrapper_7 flex-row justify-between">
<text class="text_17" v-html="item.lanhutext6"></text> <text class="text_17" >{{3}}</text>
<text class="text_18" v-html="item.lanhutext7"></text> <text class="text_18" >{{4}}</text>
</view> </view> -->
</view> </view>
</view> </view>
</view> </view>
@ -91,6 +89,8 @@
</view> </view>
</template> </template>
<script> <script>
import { getLocalUserInfo } from '../../utils/auth';
import request from '@/utils/request.js'
export default { export default {
data() { data() {
return { return {
@ -120,9 +120,15 @@ export default {
lanhutext7: '山东省济南市历下区' lanhutext7: '山东省济南市历下区'
} }
], ],
userInfo: {},
examList: {},
constants: {} constants: {}
}; };
}, },
onLoad(){
this.userInfo = getLocalUserInfo()
this.getExamList()
},
methods: { methods: {
handleBack() { handleBack() {
uni.navigateBack({ uni.navigateBack({
@ -134,6 +140,46 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: '/newPages/examinationAdd/index' url: '/newPages/examinationAdd/index'
}); });
},
getExamList(){
request({
url: '/app-api/process/getExamListByUserId',
method:'GET',
params: {
userId: this.userInfo.id,
}
}).then(res => {
this.examList = res.data
console.log('examList', this.examList)
console.log('res',res)
})
},
getStatusText(status) {
const statusMap = {
0: '未通过',
1: '已通过',
9: '已送考',
'null': '未送考',
};
return statusMap[status] || '未知状态';
},
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}`;
} }
} }
}; };