This commit is contained in:
许允枞 2025-04-09 09:13:03 +08:00
parent ca09addd0b
commit c29ddaf254
3 changed files with 364 additions and 336 deletions

View File

@ -160,4 +160,12 @@
align-items: center; /* 垂直居中 */ align-items: center; /* 垂直居中 */
height: 100vh; /* 或者你需要撑满的高度 */ height: 100vh; /* 或者你需要撑满的高度 */
} }
.text-group_1 {
display: inline-block;
max-width: 4em; /* 一个汉字大概占1em3em就是三个字 */
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style> </style>

View File

@ -111,8 +111,13 @@
} else if (options.type === 'kaoshi') { } else if (options.type === 'kaoshi') {
this.title = '考试' this.title = '考试'
// //
this.info.evaluateType = 0 this.info.evaluateType = 1
this.info.busiId = data.batchItemId
} }
this.info.createTime = undefined
this.info.updataTime = undefined
this.info.creator = undefined
this.info.updater = undefined
} else { } else {
Object.assign(this.info, data); Object.assign(this.info, data);
} }
@ -171,4 +176,11 @@
justify-content: center; justify-content: center;
/* 新增:水平居中 */ /* 新增:水平居中 */
} }
.text-group_2 {
display: inline-block;
max-width: 4em; /* 一个汉字大概占1em3em就是三个字 */
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style> </style>

View File

@ -1,120 +1,124 @@
<template> <template>
<view class="page flex-col"> <view class="page flex-col">
<view class="block_1 flex-row"> <view class="block_1 flex-row">
</view> </view>
<view class="block_2 flex-col"> <view class="block_2 flex-col">
<view class="box_3 flex-row"> <view class="box_3 flex-row">
<image <image
class="label_1" class="label_1"
referrerpolicy="no-referrer" referrerpolicy="no-referrer"
src="/static/lanhu_kaoshijieguoluru/FigmaDDSSlicePNGacf527a62cbe7351c6472edd8f5b2814.png" src="/static/lanhu_kaoshijieguoluru/FigmaDDSSlicePNGacf527a62cbe7351c6472edd8f5b2814.png"
@click="handleBack()" @click="handleBack()"
/> />
<text class="text_1">考试结果录入</text> <text class="text_1">考试结果录入</text>
</view> </view>
<view> <view>
<scroll-view <scroll-view
class="scroll-view" class="scroll-view"
scroll-y scroll-y
:style="{ height: scrollHeight + 'px' }" :style="{ height: scrollHeight + 'px' }"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered" refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered"
> >
<view <view
class="box_5 flex-col" v-for="(item, index) in examList" class="box_5 flex-col" v-for="(item, index) in examList"
:key="index" :key="index"
:style="{ height: (item.subject != 2 && item.subject != 3) ? '210rpx' : 'auto' }"> :style="{ height: ((item.subject != 2 && item.subject != 3) || getButtonInfo(item).text === '1') ? '230rpx' : 'auto' }">
<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" v-if="item.subject == 1 || item.subject == 4">{{ formatDate(item.examTime) }}</text> <text class="text_2" v-if="item.subject == 1 || item.subject == 4">{{
<text class="text_2" v-else>{{ formatDate(item.startTime) }}</text> formatDate(item.examTime)
}}
<text class="text_3">{{ item.courseName }}</text> </text>
</view> <text class="text_2" v-else>{{ formatDate(item.startTime) }}</text>
<view class="text-group_2 flex-col justify-between">
<text class="text_4" v-if="item.examScore">{{ item.examScore }}</text> <text class="text_3">{{ item.courseName }}</text>
<text class="text_4" v-else>{{ '--' }}</text> </view>
<text class="text_5">{{ getStatusText(item.examStatus) }}</text> <view class="text-group_2 flex-col justify-between">
</view> <text class="text_4" v-if="item.examScore">{{ item.examScore }}</text>
</view> <text class="text_4" v-else>{{ '--' }}</text>
<view class="block_4 flex-row justify-between"> <text class="text_5">{{ getStatusText(item.examStatus) }}</text>
<view class="text-wrapper_1 flex-col"> </view>
<text class="text_6">{{getCourseTypeText(item.subject)}}</text>
</view>
<view class="text-wrapper_2 flex-col">
<text class="text_7">{{ item.courseType }}</text>
</view>
</view>
<view class="text-wrapper_3 flex-row justify-between" v-if="item.subject == 2 || item.subject == 3">
<text class="text_8">考试地址</text>
<text class="text_9">{{ item.addr }}</text>
</view>
<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 class="block_6 flex-row justify-between">
<view class="text-group_3 flex-col justify-between">
<text class="text_11" >{{ formatDate(item.examTime) }}</text>
<text class="text_12" >{{item.courseName}}</text>
</view> </view>
<view class="text-group_4 flex-col justify-between"> <view class="block_4 flex-row justify-between">
<text <view class="text-wrapper_1 flex-col">
class="text_13" <text class="text_6">{{ getCourseTypeText(item.subject) }}</text>
:style="{ color: item.examScore }" </view>
>{{item.examScore}}</text> <view class="text-wrapper_2 flex-col">
<text <text class="text_7">{{ item.courseType }}</text>
class="text_14" </view>
:style="{ color: item.examStatus }" </view>
>{{ getStatusText(item.examStatus) }}</text> <view class="text-wrapper_3 flex-row justify-between" v-if="item.subject == 2 || item.subject == 3">
<text class="text_8">考试地址</text>
<text class="text_9">{{ item.addr }}</text>
</view>
<view class="block_5 flex-row" v-if="(item.subject == 2 || item.subject == 3) && getButtonInfo(item).text !== '1'">
<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> </view>
<view class="block_7 flex-row justify-between"> <!-- <view class="list_1 flex-col">
<view class="text-wrapper_5 flex-col"> <view class="list-items_1 flex-col" v-for="(item, index) in examList" :key="index" >
<text class="text_15" >{{getCourseTypeText(item.subject)}}</text> <view class="block_6 flex-row justify-between">
</view> <view class="text-group_3 flex-col justify-between">
<view class="text-wrapper_6 flex-col"> <text class="text_11" >{{ formatDate(item.examTime) }}</text>
<text class="text_16" >{{item.courseType}}</text> <text class="text_12" >{{item.courseName}}</text>
</view> </view>
<view class="text-group_4 flex-col justify-between">
<text
class="text_13"
:style="{ color: item.examScore }"
>{{item.examScore}}</text>
<text
class="text_14"
: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" >{{getCourseTypeText(item.subject)}}</text>
</view>
<view class="text-wrapper_6 flex-col">
<text class="text_16" >{{item.courseType}}</text>
</view>
</view>
<view class="text-wrapper_7 flex-row justify-between">
<text class="text_17" >考试地址</text>
<text class="text_18" >山东省济南市历下区</text>
</view> </view>
<view class="text-wrapper_7 flex-row justify-between"> </view>
<text class="text_17" >考试地址</text> </view> -->
<text class="text_18" >山东省济南市历下区</text> </scroll-view>
</view>
</view>
</view> -->
</scroll-view>
</view> </view>
</view> </view>
<view class="block_8 flex-col"> <view class="block_8 flex-col">
<view class="text-wrapper_8 flex-col" @click="onEnterScoreClick()"> <view class="text-wrapper_8 flex-col" @click="onEnterScoreClick()">
<text class="text_19">笔试成绩录入</text> <text class="text_19">笔试成绩录入</text>
<u-picker <u-picker
:show="pickerShow" :show="pickerShow"
:columns="[pickerColumns]" :columns="[pickerColumns]"
keyName="label" keyName="label"
@confirm="onPickerConfirm" @confirm="onPickerConfirm"
@cancel="pickerShow = false" @cancel="pickerShow = false"
/> />
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { getLocalUserInfo } from '../../utils/auth'; import {getLocalUserInfo} from '../../utils/auth';
import request from '@/utils/request.js' import request from '@/utils/request.js'
export default { export default {
data() { data() {
return { return {
@ -144,256 +148,260 @@ export default {
lanhutext7: '山东省济南市历下区' lanhutext7: '山东省济南市历下区'
} }
], ],
userInfo: {}, userInfo: {},
examList: {}, examList: {},
examTwoList: {}, examTwoList: {},
scrollHeight: 0, scrollHeight: 0,
constants: {}, constants: {},
courseList: [], courseList: [],
pickerShow: false, pickerShow: false,
pickerColumns: [], pickerColumns: [],
curNow: 0, curNow: 0,
isTriggered: false, isTriggered: false,
}; };
}, },
onLoad(){ onLoad() {
this.userInfo = getLocalUserInfo() this.userInfo = getLocalUserInfo()
this.getExamList() this.getExamList()
this.getCourseList() this.getCourseList()
}, },
onReady() { onReady() {
// //
this.calculateScrollHeight(); this.calculateScrollHeight();
}, },
methods: { methods: {
handleBack() { handleBack() {
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}); });
}, },
/** /**
* 下拉刷新数据 * 下拉刷新数据
*/ */
onRefresherrefresh() { onRefresherrefresh() {
this.isTriggered = true this.isTriggered = true
this.pageNo = 1 this.pageNo = 1
this.total = 0 this.total = 0
this.examList = [] this.examList = []
this.getExamList() this.getExamList()
}, },
onEnterScoreClick() { onEnterScoreClick() {
if (this.courseList.length > 0) { if (this.courseList.length > 0) {
this.pickerColumns = this.courseList.map(item => ({ this.pickerColumns = this.courseList.map(item => ({
label: item.courseName, label: item.courseName,
value: item.courseId value: item.courseId
})); }));
this.pickerShow = true; this.pickerShow = true;
} else if (this.courseList.length === 1) { } else if (this.courseList.length === 1) {
this.goToScoreEntry(this.courseList[0]); this.goToScoreEntry(this.courseList[0]);
} else { } else {
this.$u.toast("暂无课程信息"); this.$u.toast("暂无课程信息");
} }
}, },
onPickerConfirm(e) { onPickerConfirm(e) {
const selectedCourseId = e.value[0]; const selectedCourseId = e.value[0];
const selectedCourse = this.courseList.find(item => item.courseId === selectedCourseId.value); const selectedCourse = this.courseList.find(item => item.courseId === selectedCourseId.value);
console.log('courseList', this.courseList); console.log('courseList', this.courseList);
console.log('selectedCourseId', selectedCourseId); console.log('selectedCourseId', selectedCourseId);
console.log('selectedCourse', selectedCourse); console.log('selectedCourse', selectedCourse);
if (selectedCourse) { if (selectedCourse) {
this.getProcess(selectedCourse.courseId).then(processData => { this.getProcess(selectedCourse.courseId).then(processData => {
if (!processData || processData.length === 0) { if (!processData || processData.length === 0) {
uni.showToast({ uni.showToast({
title: '请联系驾校负责人', title: '请联系驾校负责人',
icon: 'none' icon: 'none'
}); });
return; return;
} }
// 14 // 14
const hasSubject1Or4 = processData.some(item => const hasSubject1Or4 = processData.some(item =>
item.subject === 1 || item.subject === 4 item.subject === 1 || item.subject === 4
); );
if (hasSubject1Or4) { if (hasSubject1Or4) {
this.goToScoreEntry(selectedCourse); this.goToScoreEntry(selectedCourse);
} else { } else {
uni.showToast({ uni.showToast({
title: '未找到考试信息', title: '未找到考试信息',
icon: 'none' icon: 'none'
}); });
} }
}); });
} }
this.pickerShow = false; this.pickerShow = false;
}, },
goToScoreEntry(course) { goToScoreEntry(course) {
this.$u.route({ this.$u.route({
url: '/newPages/examinationAdd/index', url: '/newPages/examinationAdd/index',
params: { params: {
courseId: course.value, courseId: course.value,
courseType: course.courseType, courseType: course.courseType,
userId: course.userId, userId: course.userId,
tenantId: course.tenantId, tenantId: course.tenantId,
} }
}); });
}, },
getProcess(courseId) {
return new Promise((resolve, reject) => {
request({
url: '/app-api/process/getAllByUserIdAndCourseId',
method: 'GET',
params: {
userId: this.userInfo.id,
courseId: courseId,
}
}).then(res => {
console.log('res123', res);
this.processList = res.data;
resolve(res.data);
}).catch(err => {
console.error('查询失败:', err);
reject(err);
});
});
},
getExamList() {
request({
url: '/app-api/process/getExamListByUserId',
method: 'GET',
params: {
userId: this.userInfo.id,
}
}).then(res => {
this.examList = res.data
this.getExamTwoList()
console.log('examList', this.examList)
console.log('res', res)
this.isTriggered = false
})
},
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)
})
},
getCourseList() {
request({
url: '/app-api/small/drive/school-course-order/getCourseByLoginUser',
method: 'GET'
}).then(res => {
this.courseList = res.data
console.log('res111', res)
})
},
getStatusText(status) {
const statusMap = {
0: '未通过',
1: '已通过',
9: '已送考',
'null': '未送考',
'true': '已通过',
'false': '未通过',
};
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}`;
},
calculateScrollHeight() {
//
const screenHeight = uni.getSystemInfoSync().windowHeight;
//
const topHeight = 160;
//
this.scrollHeight = screenHeight - topHeight;
},
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: 'evaluate'}
}else {
return {text: '1', type: 'evaluate'}
}
// else if (item.ifEvaluate) {
// return { text: '', type: 'view' }
// }
},
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.batchItemId}&batchId=${item.batchId}&batchId=${item.batchId}&tenantId=${item.tenantId}&courseType=${item.courseType}&subject=${item.subject}&courseId=${item.courseId}&coachId=${item.coachId}`
});
},
//
goEvaluate(item) {
item = JSON.stringify(item)
uni.navigateTo({
url: `/newPages/evaluateAdd/index?data=${item}&type=kaoshi&controls=add`
})
},
//
goViewEvaluation(item) {
uni.navigateTo({
url: `/newPages/evaluationDetail/index?evaluateId=${item.evaluateId}`
})
}
getProcess(courseId) {
return new Promise((resolve, reject) => {
request({
url: '/app-api/process/getAllByUserIdAndCourseId',
method: 'GET',
params: {
userId: this.userInfo.id,
courseId: courseId,
}
}).then(res => {
console.log('res123', res);
this.processList = res.data;
resolve(res.data);
}).catch(err => {
console.error('查询失败:', err);
reject(err);
});
});
},
getExamList(){
request({
url: '/app-api/process/getExamListByUserId',
method:'GET',
params: {
userId: this.userInfo.id,
}
}).then(res => {
this.examList = res.data
this.getExamTwoList()
console.log('examList', this.examList)
console.log('res',res)
this.isTriggered = false
})
},
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)
})
},
getCourseList(){
request({
url:'/app-api/small/drive/school-course-order/getCourseByLoginUser',
method: 'GET'
}).then(res => {
this.courseList = res.data
console.log('res111',res)
})
},
getStatusText(status) {
const statusMap = {
0: '未通过',
1: '已通过',
9: '已送考',
'null': '未送考',
'true': '已通过',
'false': '未通过',
};
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}`;
},
calculateScrollHeight() {
//
const screenHeight = uni.getSystemInfoSync().windowHeight;
//
const topHeight = 160;
//
this.scrollHeight = screenHeight - topHeight;
},
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.batchItemId}&batchId=${item.batchId}&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> </script>