From 8534025c45b4736975730678b9ccf23570a75f95 Mon Sep 17 00:00:00 2001
From: liuyu <yu.liu@cqgbkj.com>
Date: 星期二, 22 九月 2026 09:25:48 +0800
Subject: [PATCH] feat(tms): 新增试卷、培训任务、个人任务页面
---
apps/jnpf-web-apps-main/src/views/x/tms/selfTest/index.vue | 45 ++++++++++++++++++++++++++++++++++++++-------
1 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/apps/jnpf-web-apps-main/src/views/x/tms/selfTest/index.vue b/apps/jnpf-web-apps-main/src/views/x/tms/selfTest/index.vue
index 9912477..682c37e 100644
--- a/apps/jnpf-web-apps-main/src/views/x/tms/selfTest/index.vue
+++ b/apps/jnpf-web-apps-main/src/views/x/tms/selfTest/index.vue
@@ -2,10 +2,11 @@
import type { QuestionBankOption } from '#/views/x/tms/question/types';
import type { SelfTestFormModel } from './types';
-import { computed, onMounted, reactive, ref } from 'vue';
+import { computed, onActivated, onMounted, reactive, ref } from 'vue';
import { useRouter } from 'vue-router';
import { useMessage } from '@jnpf/hooks';
+import { useTabbarStore } from '@vben/stores';
import { getSelfTestBanks, startSelfTest } from '#/api/x/tms/selfTest';
@@ -20,10 +21,12 @@
const router = useRouter();
const { createMessage } = useMessage();
+const tabbarStore = useTabbarStore();
const banks = ref<QuestionBankOption[]>([]);
const loading = ref(false);
const formRef = ref();
+const pageReady = ref(false);
function defaultSetting() {
return { count: 0, difficulty: 'normal' as SelfTestDifficulty };
@@ -44,10 +47,28 @@
() => Number(dataForm.single.count || 0) + Number(dataForm.multi.count || 0) + Number(dataForm.judge.count || 0),
);
-onMounted(async () => {
- banks.value = (await getSelfTestBanks()) || [];
- if (banks.value.length === 1) {
- dataForm.bankId = banks.value[0].id;
+async function loadBanks() {
+ try {
+ banks.value = (await getSelfTestBanks()) || [];
+ if (!dataForm.bankId && banks.value.length === 1) {
+ dataForm.bankId = banks.value[0].id;
+ }
+ } catch (e: any) {
+ banks.value = [];
+ createMessage.error(e?.message || '鍔犺浇棰樺簱澶辫触');
+ } finally {
+ pageReady.value = true;
+ }
+}
+
+onMounted(() => {
+ tabbarStore.renderRouteView = true;
+ loadBanks();
+});
+onActivated(() => {
+ tabbarStore.renderRouteView = true;
+ if (!pageReady.value || !banks.value.length) {
+ loadBanks();
}
});
@@ -92,6 +113,10 @@
loading.value = false;
}
}
+
+function goRecords() {
+ router.push('/tms/selfTest/records');
+}
</script>
<template>
@@ -99,8 +124,11 @@
<div class="jnpf-content-wrapper-center">
<div class="jnpf-content-wrapper-content tms-self-test-page">
<div class="tms-self-test-header">
- <div class="text-base font-medium">鑷垜妫�娴�</div>
- <div class="mt-1 text-gray-400 text-sm">璁剧疆鏌ヨ鏉′欢锛屼粠棰樺簱涓瓫閫夐鐩繘琛岃嚜鎴戞娴嬨��</div>
+ <div>
+ <div class="text-base font-medium">鑷垜妫�娴�</div>
+ <div class="mt-1 text-gray-400 text-sm">璁剧疆鏌ヨ鏉′欢锛屼粠棰樺簱涓瓫閫夐鐩繘琛岃嚜鎴戞娴嬨��</div>
+ </div>
+ <a-button @click="goRecords">鎴戠殑妫�娴嬭褰�</a-button>
</div>
<a-form
@@ -213,6 +241,9 @@
}
.tms-self-test-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-start;
margin-bottom: 24px;
padding-bottom: 12px;
border-bottom: 1px solid #f0f0f0;
--
Gitblit v1.8.0