Quellcode durchsuchen

添加支付接口

shmily1213 vor 1 Woche
Ursprung
Commit
e3ce77138b

+ 6 - 0
src/api/modules/pay.ts

@@ -0,0 +1,6 @@
+import { ApiResponse } from "@/types";
+import flyio from "../flyio";
+
+export function pay(params: any) {
+  return flyio.post('/front/ecard', params) as Promise<ApiResponse<any>>;
+}

+ 6 - 1
src/pagesMain/pages/me/components/me-info.vue

@@ -44,6 +44,8 @@
 <script lang="ts" setup>
 import { useUserStore } from '@/store/userStore';
 import { useTransferPage } from '@/hooks/useTransferPage';
+import { pay } from '@/api/modules/pay';
+
 const userStore = useUserStore();
 const { transferTo } = useTransferPage();
 const avatar = computed(() => userStore.avatar);
@@ -83,7 +85,10 @@ const handleHeaderClick = async () => {
   }
 }
 const handleVip = () => {
-  transferTo('/pagesSystem/pages/card-verify/card-verify')
+  // transferTo('/pagesSystem/pages/card-verify/card-verify')
+  pay({}).then(res => {
+    console.log(res)
+  })
 }
 
 const handleSettingClick = async () => {

+ 32 - 6
src/pagesStudy/components/vhs-exam-item.vue

@@ -17,22 +17,48 @@
         <text>分</text>
       </view>
       <view class="px-20 py-8 bg-primary border border-solid border-primary rounded-full text-24 text-white"
-        @click="handleStartExam">开始考试</view>
+        @click="handleStartExam">
+        <text>{{ isFinished ? '查看分析' : '开始考试' }}</text>
+      </view>
     </view>
   </view>
 </template>
 <script lang="ts" setup>
-import { Study } from '@/types';
+import { EnumPaperType, EnumSimulatedRecordStatus } from '@/common/enum';
+import { Study, Transfer } from '@/types';
+import { useTransferPage } from '@/hooks/useTransferPage';
 
+const { transferTo } = useTransferPage();
 const props = defineProps<{
   data: Study.VHSPaper;
   type?: number
 }>();
-const emit = defineEmits<{
-  (e: 'startExam', data: Study.VHSPaper): void;
-}>();
+const isFinished = computed(() => {
+  return props.data.status === EnumSimulatedRecordStatus.SUBMIT;
+});
+
 const handleStartExam = () => {
-  emit('startExam', props.data);
+  if (isFinished.value) {
+    transferTo('/pagesStudy/pages/simulation-analysis/simulation-analysis', {
+      data: {
+        examineeId: props.data.id,
+        paperType: EnumPaperType.SIMULATED
+      }
+    });
+  } else {
+    const pageOptions: Transfer.ExamAnalysisPageOptions = {
+      paperType: EnumPaperType.SIMULATED,
+      readonly: false,
+      simulationInfo: {
+        name: props.data.paperName,
+        // 难受
+        examineeId: props.data.id,
+      }
+    }
+    transferTo('/pagesStudy/pages/exam-start/exam-start', {
+      data: pageOptions,
+    });
+  }
 }
 
 </script>

+ 1 - 15
src/pagesStudy/pages/index/compoentns/vhs-exam.vue

@@ -13,7 +13,7 @@
       </view>
 
       <view class="px-30 pb-24 bg-back flex flex-col gap-20 sticky z-1 " :style="{ top: baseStickyTop + 20 + 'px' }">
-        <vhs-exam-item v-for="(item, index) in list" :key="index" :data="item" :type="current" @start-exam="handleStartExam" />
+        <vhs-exam-item v-for="(item, index) in list" :key="index" :data="item" :type="current" />
       </view>
     </view>
   </view>
@@ -41,20 +41,6 @@ const loadData = async () => {
   });
   list.value = data;
 }
-const handleStartExam = (data: Study.VHSPaper) => {
-  const pageOptions: Transfer.ExamAnalysisPageOptions = {
-    paperType: EnumPaperType.SIMULATED,
-    readonly: false,
-    simulationInfo: {
-      name: data.paperName,
-      // 难受
-      examineeId: data.id,
-    }
-  }
-  transferTo('/pagesStudy/pages/exam-start/exam-start', {
-    data: pageOptions,
-  });
-}
 onLoad(() => {
   loadData();
 });

+ 26 - 20
src/pagesStudy/pages/simulation-analysis/simulation-analysis.vue

@@ -10,16 +10,18 @@
           <rate-chart :value="rightRate" />
           <view class="h-1 bg-[#E6E6E6] my-20"></view>
           <view>
-            <view class="my-20 flex items-center justify-between text-24">
-              <ie-image src="/pagesStudy/static/image/icon-house.png" custom-class="w-24 h-24" mode="aspectFill" />
-              <text class="ml-10 text-fore-light flex-1">考试院校</text>
-              <text class="text-fore-title">{{ examineeData.collegeName }}-{{ examineeData.majorName }}</text>
-            </view>
-            <view class="my-20 flex items-center justify-between text-24">
-              <ie-image src="/pagesStudy/static/image/icon-group.png" custom-class="w-24 h-24" mode="aspectFill" />
-              <text class="ml-10 text-fore-light flex-1">考试科目</text>
-              <text class="text-fore-title">{{ examineeData.subjectName }}</text>
-            </view>
+            <template v-if="!userStore.isVHS">
+              <view class="my-20 flex items-center justify-between text-24">
+                <ie-image src="/pagesStudy/static/image/icon-house.png" custom-class="w-24 h-24" mode="aspectFill" />
+                <text class="ml-10 text-fore-light flex-1">考试院校</text>
+                <text class="text-fore-title">{{ examineeData.collegeName }}-{{ examineeData.majorName }}</text>
+              </view>
+              <view class="my-20 flex items-center justify-between text-24">
+                <ie-image src="/pagesStudy/static/image/icon-group.png" custom-class="w-24 h-24" mode="aspectFill" />
+                <text class="ml-10 text-fore-light flex-1">考试科目</text>
+                <text class="text-fore-title">{{ examineeData.subjectName }}</text>
+              </view>
+            </template>
             <view class="my-20 flex items-center justify-between text-24">
               <ie-image src="/pagesStudy/static/image/icon-clock.png" custom-class="w-24 h-24" mode="aspectFill" />
               <text class="ml-10 text-fore-light flex-1">考试时长</text>
@@ -40,11 +42,14 @@ import ExamStat from './components/exam-stat.vue';
 import ScoreStat from './components/score-stat.vue';
 import { getExamineeResult } from '@/api/modules/study';
 import { useTransferPage } from '@/hooks/useTransferPage';
+import { useUserStore } from '@/store/userStore';
 import { Study, Transfer } from '@/types';
 import { EnumPaperType, EnumQuestionType } from '@/common/enum';
+
 const { prevData, transferTo } = useTransferPage<Transfer.SimulationAnalysisPageOptions, Transfer.ExamAnalysisPageOptions>();
 const examineeData = ref<Study.Examinee>();
-  const titleMap = {
+const userStore = useUserStore();
+const titleMap = {
   [EnumPaperType.PRACTICE]: '知识点练习',
   [EnumPaperType.SIMULATED]: '模拟考试',
   [EnumPaperType.TEST]: '组卷作业',
@@ -80,17 +85,18 @@ const formatTime = (time: number) => {
 const handleDetail = (item: Study.Question) => {
   if (!examineeData.value) {
     return;
-  }  
-  transferTo('/pagesStudy/pages/exam-start/exam-start', {
-    data: {
+  }
+  const pageOptions: Transfer.ExamAnalysisPageOptions = {
+    readonly: true,
+    questionId: item.id,
+    paperType: prevData.value.paperType,
+    simulationInfo: {
       name: paperName.value,
-      readonly: true,
-      questionId: item.id,
-      paperType: prevData.value.paperType,
-      simulationInfo: {
-        examineeId: examineeData.value.examineeId
-      }
+      examineeId: examineeData.value.examineeId
     }
+  }
+  transferTo('/pagesStudy/pages/exam-start/exam-start', {
+    data: pageOptions,
   });
 };
 const loadData = async () => {

+ 1 - 1
src/types/study.ts

@@ -483,7 +483,7 @@ export interface VHSPaper {
   paperType: string;
   relateId: number;
   remark: string | null;
-  status: string | null;
+  status: number;
   subjectId: number;
   subjectName: string;
   tiid: string;