driverSchool/newPages/examinationList/index.vue

294 lines
9.2 KiB
Vue
Raw Normal View History

2025-03-15 17:32:23 +08:00
<template>
<view class="page flex-col">
<view class="block_1 flex-row">
2025-04-01 17:57:14 +08:00
2025-03-15 17:32:23 +08:00
</view>
<view class="block_2 flex-col">
<view class="box_3 flex-row">
<image
class="label_1"
referrerpolicy="no-referrer"
src="/static/lanhu_kaoshijieguoluru/FigmaDDSSlicePNGacf527a62cbe7351c6472edd8f5b2814.png"
2025-04-01 17:57:14 +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>
2025-04-06 20:52:37 +08:00
<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' }">
2025-03-15 17:32:23 +08:00
<view class="block_3 flex-row justify-between">
<view class="text-group_1 flex-col justify-between">
2025-04-06 20:52:37 +08:00
<text class="text_2">{{ formatDate(item.examTime) }}</text>
<text class="text_3">{{ item.courseName }}</text>
2025-03-15 17:32:23 +08:00
</view>
<view class="text-group_2 flex-col justify-between">
2025-04-06 20:52:37 +08:00
<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>
2025-03-15 17:32:23 +08:00
</view>
</view>
<view class="block_4 flex-row justify-between">
<view class="text-wrapper_1 flex-col">
2025-04-06 20:52:37 +08:00
<text class="text_6">{{getCourseTypeText(item.subject)}}</text>
2025-03-15 17:32:23 +08:00
</view>
<view class="text-wrapper_2 flex-col">
2025-04-06 20:52:37 +08:00
<text class="text_7">{{ item.courseType }}</text>
2025-03-15 17:32:23 +08:00
</view>
</view>
2025-04-06 20:52:37 +08:00
<view class="text-wrapper_3 flex-row justify-between" v-if="item.subject == 2 || item.suject == 3">
2025-03-15 17:32:23 +08:00
<text class="text_8">考试地址</text>
2025-04-06 20:52:37 +08:00
<text class="text_9">{{ item.addr }}</text>
2025-03-15 17:32:23 +08:00
</view>
2025-04-06 20:52:37 +08:00
<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>
2025-03-15 17:32:23 +08:00
</view>
</view>
2025-04-06 20:52:37 +08:00
</view>
<!-- <view class="list_1 flex-col">
<view class="list-items_1 flex-col" v-for="(item, index) in examList" :key="index" >
2025-03-15 17:32:23 +08:00
<view class="block_6 flex-row justify-between">
<view class="text-group_3 flex-col justify-between">
2025-04-02 18:05:36 +08:00
<text class="text_11" >{{ formatDate(item.examTime) }}</text>
<text class="text_12" >{{item.courseName}}</text>
2025-03-15 17:32:23 +08:00
</view>
<view class="text-group_4 flex-col justify-between">
<text
class="text_13"
2025-04-02 18:05:36 +08:00
:style="{ color: item.examScore }"
>{{item.examScore}}</text>
2025-03-15 17:32:23 +08:00
<text
class="text_14"
2025-04-02 18:05:36 +08:00
:style="{ color: item.examStatus }"
>{{ getStatusText(item.examStatus) }}</text>
2025-03-15 17:32:23 +08:00
</view>
</view>
<view class="block_7 flex-row justify-between">
<view class="text-wrapper_5 flex-col">
2025-04-02 18:05:36 +08:00
<text class="text_15" >{{getCourseTypeText(item.subject)}}</text>
2025-03-15 17:32:23 +08:00
</view>
<view class="text-wrapper_6 flex-col">
2025-04-02 18:05:36 +08:00
<text class="text_16" >{{item.courseType}}</text>
2025-03-15 17:32:23 +08:00
</view>
</view>
2025-04-06 20:52:37 +08:00
<view class="text-wrapper_7 flex-row justify-between">
<text class="text_17" >考试地址</text>
<text class="text_18" >山东省济南市历下区</text>
</view>
2025-03-15 17:32:23 +08:00
</view>
2025-04-06 20:52:37 +08:00
</view> -->
</scroll-view>
2025-03-15 17:32:23 +08:00
</view>
</view>
<view class="block_8 flex-col">
2025-04-01 17:57:14 +08:00
<view class="text-wrapper_8 flex-col" @click="goScorerecord()">
2025-03-15 17:32:23 +08:00
<text class="text_19">笔试成绩录入</text>
</view>
</view>
</view>
</template>
<script>
2025-04-02 18:05:36 +08:00
import { getLocalUserInfo } from '../../utils/auth';
import request from '@/utils/request.js'
2025-03-15 17:32:23 +08:00
export default {
data() {
return {
loopData0: [
{
lanhutext0: '2025-01-20',
lanhutext1: '考试名称',
lanhutext2: '60分',
lanhufontColor2: 'rgba(251,66,59,1.000000)',
lanhutext3: '考试未通过',
lanhufontColor3: 'rgba(251,66,59,1.000000)',
lanhutext4: '科目二',
lanhutext5: 'C2',
lanhutext6: '考试地址:',
lanhutext7: '山东省济南市历下区'
},
{
lanhutext0: '2025-01-20',
lanhutext1: '考试名称',
lanhutext2: '--',
lanhufontColor2: 'rgba(51,51,51,1.000000)',
lanhutext3: '待审批',
lanhufontColor3: 'rgba(51,51,51,1.000000)',
lanhutext4: '科目二',
lanhutext5: 'C2',
lanhutext6: '考试地址:',
lanhutext7: '山东省济南市历下区'
}
],
2025-04-02 18:05:36 +08:00
userInfo: {},
examList: {},
2025-04-06 20:52:37 +08:00
examTwoList: {},
scrollHeight: 0,
2025-03-15 17:32:23 +08:00
constants: {}
};
},
2025-04-02 18:05:36 +08:00
onLoad(){
this.userInfo = getLocalUserInfo()
this.getExamList()
},
2025-04-06 20:52:37 +08:00
onReady() {
// 动态计算滚动区域高度
this.calculateScrollHeight();
},
2025-04-01 17:57:14 +08:00
methods: {
handleBack() {
uni.navigateBack({
delta: 1
});
},
goScorerecord(){
uni.navigateTo({
url: '/newPages/examinationAdd/index'
});
2025-04-02 18:05:36 +08:00
},
getExamList(){
request({
url: '/app-api/process/getExamListByUserId',
method:'GET',
params: {
userId: this.userInfo.id,
}
}).then(res => {
this.examList = res.data
2025-04-06 20:52:37 +08:00
this.getExamTwoList()
2025-04-02 18:05:36 +08:00
console.log('examList', this.examList)
console.log('res',res)
})
},
2025-04-06 20:52:37 +08:00
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)
})
},
2025-04-02 18:05:36 +08:00
getStatusText(status) {
const statusMap = {
0: '未通过',
1: '已通过',
9: '已送考',
'null': '未送考',
2025-04-06 20:52:37 +08:00
'true': '已通过',
'false': '未通过',
2025-04-02 18:05:36 +08:00
};
return statusMap[status] || '未知状态';
},
2025-04-06 20:52:37 +08:00
2025-04-02 18:05:36 +08:00
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}`;
2025-04-06 20:52:37 +08:00
},
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}`
})
}
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';
</style>