Bläddra i källkod

修改定向提示

shmily1213 1 månad sedan
förälder
incheckning
0a93a8718f

+ 20 - 4
src/pagesStudy/pages/index/compoentns/index-test.vue

@@ -41,7 +41,13 @@
 import { useTransferPage } from '@/hooks/useTransferPage';
 import { DirectedSchool, SelectedUniversityMajor, SimulationTestInfo, SimulationTestOptions } from '@/types/study';
 import { getSimulationInfo } from '@/api/modules/study';
+import { useUserStore } from '@/store/userStore';
+
+const userStore = useUserStore();
+const { hasDirectedSchool, directedSchoolList } = toRefs(userStore);
+const firstDirectedSchool = computed(() => directedSchoolList.value[0] || {});
 const { transferTo } = useTransferPage();
+
 type Props = {
   directedSchool: DirectedSchool;
 }
@@ -60,10 +66,20 @@ const handleSelectCollege = () => {
     data: {}
   });
 }
-const handleStartTest = () => {
-  transferTo('/pagesStudy/pages/simulation-entry/simulation-entry', {
-    data: props.directedSchool
-  });
+const handleStartTest = async () => {
+  const notice = firstDirectedSchool.value.notice;
+  if (notice) {
+    await uni.$ie.showModal({
+      title: '提示',
+      content: notice,
+      showCancel: false,
+      confirmText: '知道了'
+    });
+  } else {
+    transferTo('/pagesStudy/pages/simulation-entry/simulation-entry', {
+      data: props.directedSchool
+    });
+  }
 }
 const loadData = () => {
   getSimulationInfo().then(res => {

+ 15 - 14
src/pagesStudy/pages/index/index.vue

@@ -96,23 +96,24 @@ const handlePracticeDirected = async () => {
     addTarget();
     return;
   }
-  transferTo('/pagesStudy/pages/knowledge-practice/knowledge-practice', {
-    data: {
-      directed: true
-    }
-  });
+  const notice = firstDirectedSchool.value.notice;
+  if (notice) {
+    await uni.$ie.showModal({
+      title: '提示',
+      content: notice,
+      showCancel: false,
+      confirmText: '知道了'
+    });
+  } else {
+    transferTo('/pagesStudy/pages/knowledge-practice/knowledge-practice', {
+      data: {
+        directed: true
+      }
+    });
+  }
 }
 const handleSetting = async () => {
   if (hasDirectedSchool.value) {
-    const notice = firstDirectedSchool.value.notice;
-    if (notice) {
-      await uni.$ie.showModal({
-        title: '提示',
-        content: notice,
-        showCancel: false,
-        confirmText: '知道了'
-      });
-    }
     transferTo('/pagesStudy/pages/targeted-setting/targeted-setting');
   } else {
     addTarget();

+ 6 - 1
src/pagesStudy/pages/simulation-analysis/components/exam-stat.vue

@@ -15,7 +15,7 @@
         <view class="mt-5 text-28 text-fore-light">得分</view>
       </view>
       <view class="flex-1 text-center">
-        <view class="text-40 text-fore-title font-bold">{{ stats.rate }}%</view>
+        <view class="text-40 text-fore-title font-bold">{{ rightRate }}%</view>
         <view class="mt-5 text-28 text-fore-light">正确率</view>
       </view>
     </view>
@@ -74,6 +74,11 @@ const stats = computed(() => {
 const totalQuestions = computed(() => {
   return (flatQuestionList.value || []).length;
 });
+const rightRate = computed(() => {
+  const { totalCount = 0, wrongCount = 0 } = props.data || {};
+  return Math.max(Math.round((totalCount - wrongCount) / totalCount * 100), 1);
+});
+
 const filterTypes = ref<('correct' | 'incorrect' | 'unanswered')[]>(['correct', 'incorrect', 'unanswered']);
 const filteredQuestionList = computed(() => {
   const list: QuestionItem[] = [];

+ 1 - 1
src/pagesStudy/pages/simulation-analysis/simulation-analysis.vue

@@ -49,7 +49,7 @@ const paperName = computed(() => {
 });
 const rightRate = computed(() => {
   const { totalCount = 0, wrongCount = 0 } = examineeData.value || {};
-  return Math.round((totalCount - wrongCount) / totalCount * 100) || 0;
+  return Math.max(Math.round((totalCount - wrongCount) / totalCount * 100), 1);
 });
 
 const formatTime = (time: number) => {