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

View File

@ -15,7 +15,7 @@
<text class="text_1">考试结果录入</text>
</view>
<view class="box_5 flex-col">
<!-- <view class="box_5 flex-col">
<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>
@ -43,43 +43,41 @@
<text class="text_10">开始评价</text>
</view>
</view>
</view>
</view> -->
<view class="list_1 flex-col">
<view
class="list-items_1 flex-col"
v-for="(item, index) in loopData0"
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" v-html="item.lanhutext0"></text>
<text class="text_12" v-html="item.lanhutext1"></text>
<text class="text_11" >{{ formatDate(item.examTime) }}</text>
<text class="text_12" >{{item.courseName}}</text>
</view>
<view class="text-group_4 flex-col justify-between">
<text
class="text_13"
:style="{ color: item.lanhufontColor2 }"
v-html="item.lanhutext2"
></text>
:style="{ color: item.examScore }"
>{{item.examScore}}</text>
<text
class="text_14"
:style="{ color: item.lanhufontColor3 }"
v-html="item.lanhutext3"
></text>
:style="{ color: item.examStatus }"
>{{ getStatusText(item.examStatus) }}</text>
</view>
</view>
<view class="block_7 flex-row justify-between">
<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 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 class="text-wrapper_7 flex-row justify-between">
<text class="text_17" v-html="item.lanhutext6"></text>
<text class="text_18" v-html="item.lanhutext7"></text>
</view>
<!-- <view class="text-wrapper_7 flex-row justify-between">
<text class="text_17" >{{3}}</text>
<text class="text_18" >{{4}}</text>
</view> -->
</view>
</view>
</view>
@ -91,6 +89,8 @@
</view>
</template>
<script>
import { getLocalUserInfo } from '../../utils/auth';
import request from '@/utils/request.js'
export default {
data() {
return {
@ -120,9 +120,15 @@ export default {
lanhutext7: '山东省济南市历下区'
}
],
userInfo: {},
examList: {},
constants: {}
};
},
onLoad(){
this.userInfo = getLocalUserInfo()
this.getExamList()
},
methods: {
handleBack() {
uni.navigateBack({
@ -134,6 +140,46 @@ export default {
uni.navigateTo({
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}`;
}
}
};