This commit is contained in:
2026-09-24 16:25:22 +08:00
commit 7428184f01
1198 changed files with 314515 additions and 0 deletions
+185
View File
@@ -0,0 +1,185 @@
<template>
<hr-page page-bg="#F3F4F6" status-bg="#FFFFFF" nav-title="我的考试" :xloading="true" @right-click="onSort">
<template v-slot:right>
<x-icon name="arrow-up-down-line" color="#6B7280" font-size="17"></x-icon>
</template>
<view class="hr-body">
<view class="hr-seg">
<view v-for="(s, i) in segs" :key="i" :class="seg == i ? 'hr-seg-i hr-seg-i-on' : 'hr-seg-i'"
@click="seg = i">
<text :class="seg == i ? 'ex-seg-t ex-seg-t-on' : 'ex-seg-t'">{{ s }}</text>
</view>
</view>
<!-- ============ 待考(P0 紧急) ============ -->
<view v-if="seg != 2 && plans.length > 0" class="ex-plan">
<view class="hr-row-top">
<view class="ex-plan-ic">
<text class="ex-plan-ic-t">!</text>
</view>
<view class="hr-flex1">
<view class="hr-row-between">
<text class="ex-plan-t">{{ plans[0].name }}</text>
<hr-pc :level="plans[0].priority"></hr-pc>
</view>
<text class="ex-plan-cd">{{ plans[0].countdown }}</text>
<text class="ex-plan-meta">{{ plans[0].time }} · {{ plans[0].place }}</text>
</view>
</view>
<view class="ex-plan-btn" @click="onPrepare">
<text class="ex-plan-btn-t">进入备考</text>
</view>
</view>
<!-- ============ 已完成 ============ -->
<hr-card v-if="seg != 1" variant="list" style="margin-top:10px">
<hr-lrow v-for="(r, i) in shownRecords" :key="i" :icon="r.passed ? '✓' : '✗'"
:theme="r.passed ? 'grn' : 'red'" :title="r.name"
:sub="r.date + ' · 得分 ' + r.score + ' · ' + (r.passed ? '已通过' : '未通过')"
:value="r.score.toString() + ' '" :value-theme="r.passed ? 'grn' : 'red'" :value-bold="true"
:is-last="i == shownRecords.length - 1" @click="onRecordClick(r)"></hr-lrow>
</hr-card>
<hr-empty v-if="seg == 1 && plans.length == 0" icon="✓" title="暂无待考安排"
sub="有新的考试安排时会在消息中心提醒你"></hr-empty>
<hr-tip style="margin-top:14px" theme="info" icon=""
text="理论测验通过后自动计入课题完成度;未通过的测验可在 7 天后重新参加。"></hr-tip>
<view style="height:14px"></view>
</view>
</hr-page>
</template>
<script lang="uts" setup>
import { ref, computed } from 'vue'
import { examPlans, examRecords } from '@/mock/index.uts'
import { HrExamRecord, HrExamPlan } from '@/mock/types.uts'
import { navTo } from '@/utils/nav.uts'
/** s12 我的考试 */
const segs : string[] = ['全部', '待考', '已完成']
const seg = ref(0)
const plans = ref<HrExamPlan[]>(examPlans)
const records = ref<HrExamRecord[]>(examRecords)
const passOnly = ref(false)
const shownRecords = computed(() : HrExamRecord[] => {
if (passOnly.value) {
const list : HrExamRecord[] = []
for (let i = 0; i < records.value.length; i++) {
if (records.value[i].passed) { list.push(records.value[i]) }
}
return list
}
return records.value
})
function onPrepare() : void {
navTo('/pages/course/practice')
}
function onRecordClick(r : HrExamRecord) : void {
if (r.passed) {
uni.showModal({
title: r.name,
content: `得分 ${r.score} 分 · ${r.date}\n可查看错题解析与答卷详情。`,
cancelText: '关闭',
confirmText: '查看错题',
success: (res) => {
if (res.confirm) { navTo('/pages/study/wrong-book') }
}
})
return
}
uni.showModal({
title: r.name,
content: `得分 ${r.score} 分 · 未通过\n补考开放时间:${r.date} 起 7 天后`,
cancelText: '关闭',
confirmText: '进入复习',
success: (res) => {
if (res.confirm) { navTo('/pages/course/practice') }
}
})
}
function onSort() : void {
uni.showToast({ title: '按时间排序', icon: 'none' })
}
</script>
<style>
.ex-seg-t {
font-size: 29.2rpx;
color: #6B7280;
}
.ex-seg-t-on {
color: #2563EB;
font-weight: bold;
}
.ex-plan {
margin-top: 20rpx;
background-color: #FFF5F5;
border: 2rpx solid #FECACA;
border-radius: 26rpx;
padding: 24rpx 26rpx 24rpx 26rpx;
}
.ex-plan-ic {
width: 68rpx;
height: 68rpx;
border-radius: 20rpx;
background-color: #DC2626;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin-right: 20rpx;
}
.ex-plan-ic-t {
font-size: 35.8rpx;
font-weight: bold;
color: #FFFFFF;
}
.ex-plan-t {
font-size: 30.2rpx;
font-weight: bold;
color: #1F2937;
}
.ex-plan-cd {
font-size: 25.8rpx;
color: #DC2626;
font-weight: bold;
margin-top: 12rpx;
}
.ex-plan-meta {
font-size: 24.6rpx;
color: #6B7280;
margin-top: 10rpx;
}
.ex-plan-btn {
margin-top: 24rpx;
height: 88rpx;
border-radius: 24rpx;
background-color: #DC2626;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.ex-plan-btn-t {
font-size: 31.4rpx;
font-weight: bold;
color: #FFFFFF;
}
</style>