shmily1213 1 tydzień temu
rodzic
commit
fc736b7d38

+ 9 - 3
src/api/modules/pay.ts

@@ -1,6 +1,12 @@
-import { ApiResponse } from "@/types";
+import { ApiResponse, Pay } from "@/types";
 import flyio from "../flyio";
+// @ts-ignore
+import qs from 'qs';
 
-export function pay(params: any) {
-  return flyio.post('/front/ecard', params) as Promise<ApiResponse<any>>;
+export function getEcardPrices(params: any) {
+  return flyio.get('/front/ecard/getEcardPrices', params) as Promise<ApiResponse<Pay.EcardPrice[]>>;
+}
+
+export function createOrder(params: any) {
+  return flyio.post('/front/ecard/createOrder?' + qs.stringify(params)) as Promise<ApiResponse<any>>;
 }

+ 32 - 0
src/hooks/usePay.ts

@@ -0,0 +1,32 @@
+import { createOrder, getEcardPrices } from "@/api/modules/pay";
+
+export const usePay = () => {
+  const ready = ref(false);
+  const price = ref(468000);
+  const formatPrice = computed(() => {
+    return price.value / 100;
+  });
+  const getPrice = async () => {
+    const res = await getEcardPrices({});
+    const card = res.data?.at(0);
+    if (card) {
+      price.value = card.price;
+      ready.value = true;
+    }
+  }
+  const pay = () => {
+    createOrder({
+      totalFee: price.value,
+      type: undefined
+    }).then(res => {
+      console.log(res)
+    })
+  }
+  getPrice();
+  return {
+    price,
+    formatPrice,
+    ready,
+    pay
+  }
+}

+ 6 - 0
src/pages.json

@@ -553,6 +553,12 @@
           "style": {
             "navigationBarTitleText": ""
           }
+        },
+        {
+          "path": "pages/pay/pay",
+          "style": {
+            "navigationBarTitleText": ""
+          }
         }
       ]
     },

+ 5 - 4
src/pagesMain/pages/me/components/me-info.vue

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

+ 0 - 0
src/pagesStudy/components/ie-exam-item.vue → src/pagesStudy/components/ie-exam-record-item.vue


+ 4 - 4
src/pagesStudy/components/vhs-exam-item.vue

@@ -16,9 +16,9 @@
         <text class="text-primary">{{ data.fenshu }}</text>
         <text>分</text>
       </view>
-      <view class="px-20 py-8 bg-primary border border-solid border-primary rounded-full text-24 text-white"
-        @click="handleStartExam">
-        <text>{{ isFinished ? '查看分析' : '开始考试' }}</text>
+      <view class="px-20 py-8 border border-solid rounded-full text-24 text-white"
+        :class="[isFinished ? 'bg-success border-success' : 'bg-primary border-primary']" @click="handleStartExam">
+        <text>{{ isFinished ? '查看分析' : '继续考试' }}</text>
       </view>
     </view>
   </view>
@@ -41,7 +41,7 @@ const handleStartExam = () => {
   if (isFinished.value) {
     transferTo('/pagesStudy/pages/simulation-analysis/simulation-analysis', {
       data: {
-        examineeId: props.data.id,
+        examineeId: props.data.examineeId,
         paperType: EnumPaperType.SIMULATED
       }
     });

+ 69 - 0
src/pagesStudy/components/vhs-exam-record-item.vue

@@ -0,0 +1,69 @@
+<template>
+  <view class="bg-white rounded-5">
+    <view class="px-30 pt-32 pb-20">
+      <view class="text-28 text-fore-title font-bold ellipsis-2">{{ data.name }}</view>
+      <view class="flex items-center gap-16 mt-20">
+        <view class="tag-item bg-[#FFFBEB] text-[#F97316]">{{ data.subjectName }}</view>
+        <view class="tag-item bg-back text-fore-light">{{ data.subjectGroup }}</view>
+      </view>
+    </view>
+    <uv-line color="#F6F8FA" />
+    <view class="px-30 py-20 flex items-center justify-between">
+      <view class="text-24 text-fore-light">
+        <template v-if="data.score !== null">
+          <text>得分:</text>
+          <text class="text-primary">{{ data.score }}</text>
+          <text>分</text>
+        </template>
+      </view>
+      <view class="px-20 py-8 border border-solid rounded-full text-24 text-white"
+        :class="[isFinished ? 'bg-success border-success' : 'bg-primary border-primary']" @click="handleStartExam">
+        <text>{{ isFinished ? '查看分析' : '继续考试' }}</text>
+      </view>
+    </view>
+  </view>
+</template>
+<script lang="ts" setup>
+import { EnumPaperType, EnumSimulatedRecordStatus } from '@/common/enum';
+import { Study, Transfer } from '@/types';
+import { useTransferPage } from '@/hooks/useTransferPage';
+
+const { transferTo } = useTransferPage();
+const props = defineProps<{
+  data: Study.SimulatedRecord;
+  type?: number
+}>();
+const isFinished = computed(() => {
+  return props.data.state === EnumSimulatedRecordStatus.SUBMIT;
+});
+
+const handleStartExam = () => {
+  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.name,
+        // 难受
+        examineeId: props.data.id,
+      }
+    }
+    transferTo('/pagesStudy/pages/exam-start/exam-start', {
+      data: pageOptions,
+    });
+  }
+}
+
+</script>
+<style lang="scss" scoped>
+.tag-item {
+  @apply text-24 rounded-4 px-10 py-6 w-fit;
+}
+</style>

+ 1 - 4
src/pagesStudy/pages/exam-start/components/exam-subtitle.vue

@@ -20,7 +20,6 @@ const { virtualCurrentIndex, virtualTotalCount } = examData;
 
 const pageSubtitle = computed(() => {
   if (examPageOptions && examPageOptions.practiceInfo) {
-
     const { practiceInfo: { directed, questionType, name } } = examPageOptions;
     let titlePrefix = '';
     if (userStore.isVHS) {
@@ -39,10 +38,8 @@ const pageSubtitle = computed(() => {
     return titlePrefix + '-' + name;
   } else if (examPageOptions && examPageOptions.simulationInfo) {
     const { simulationInfo: { name } } = examPageOptions;
-    return name || '模拟考试';
+    return '模拟考试' + '-' + name || '模拟考试';
   }
-
-
   return '知识点练习';
 });
 </script>

+ 2 - 2
src/pagesStudy/pages/index/compoentns/ie-exam.vue

@@ -11,14 +11,14 @@
         <view class="h-0 w-160 border-0 border-b border-dashed border-border"></view>
       </view>
       <view v-for="value in list" :key="value.id" class="rounded-10 mb-20 bg-white px-20 py-38">
-        <ie-exam-item :data="value" />
+        <ie-exam-record-item :data="value" />
       </view>
     </view>
   </view>
 </template>
 <script lang="ts" setup>
 import IndexTest from './index-test.vue';
-import IeExamItem from '@/pagesStudy/components/ie-exam-item.vue';
+import IeExamRecordItem from '@/pagesStudy/components/ie-exam-record-item.vue';
 import { getSimulatedRecord } from '@/api/modules/study';
 import { Study } from '@/types';
 

+ 5 - 2
src/pagesStudy/pages/index/compoentns/vhs-exam.vue

@@ -12,9 +12,13 @@
         </view>
       </view>
 
-      <view class="px-30 pb-24 bg-back flex flex-col gap-20 sticky z-1 " :style="{ top: baseStickyTop + 20 + 'px' }">
+      <view v-if="list.length > 0" 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" />
       </view>
+      <view v-else class="bg-white">
+        <z-paging-empty-view :empty-view-fixed="false" />
+      </view>
     </view>
   </view>
 </template>
@@ -24,7 +28,6 @@ import { useTransferPage } from '@/hooks/useTransferPage';
 import { useNavbar } from '@/hooks/useNavbar';
 import { getVHSPaperList } from '@/api/modules/study';
 import { Study, Transfer } from '@/types';
-import { EnumPaperType } from '@/common/enum';
 
 const { transferTo } = useTransferPage();
 const { baseStickyTop } = useNavbar();

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

@@ -131,7 +131,6 @@ const handleDetail = (item: Study.Question) => {
   emit('detail', item);
 }
 setQuestionList(props.data.questions);
-console.log(flatQuestionList.value, 111)
 </script>
 <style lang="scss" scoped>
 .question-item {

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

@@ -61,7 +61,12 @@ const readonlyTitleMap = {
 }
 
 const paperName = computed(() => {
-  return titleMap[prevData.value.paperType as keyof typeof titleMap] + '-' + examineeData.value?.subjectName;
+  const prefix = titleMap[prevData.value.paperType as keyof typeof titleMap];
+  if (userStore.isVHS) {
+    return prefix + '-' + examineeData.value?.name || examineeData.value?.subjectName || '';
+  } else {
+    return prefix + '-' + examineeData.value?.subjectName;
+  }
 });
 const rightRate = computed(() => {
   const { totalCount = 0, wrongCount = 0 } = examineeData.value || {};

+ 2 - 2
src/pagesStudy/pages/study-history/components/ie-exam-history-student.vue

@@ -2,7 +2,7 @@
   <view class="pb-30">
     <view v-if="examType === EnumExamRecordType.SIMULATED" class="px-30">
       <view class="sibling-border-top px-20 py-30" v-for="(item, index) in simulatedRecordList" :key="index">
-        <ie-exam-item :data="item" />
+        <ie-exam-record-item :data="item" />
       </view>
     </view>
     <template v-else>
@@ -18,7 +18,7 @@
 <script lang="ts" setup>
 import { getSimulatedRecord, getPaperWorkList } from '@/api/modules/study';
 import { EnumExamRecordType, EnumPaperWorkState } from '@/common/enum';
-import IeExamItem from '@/pagesStudy/components/ie-exam-item.vue';
+import IeExamRecordItem from '@/pagesStudy/components/ie-exam-record-item.vue';
 import { Study } from '@/types';
 import PaperWorkItem from '@/pagesStudy/components/paper-work-item.vue';
 const props = defineProps({

+ 10 - 26
src/pagesStudy/pages/study-history/components/vhs-exam-history-student.vue

@@ -1,43 +1,27 @@
 <template>
   <view class="flex flex-col gap-20 px-30 pb-20 bg-back h-fit">
-    <view class="" v-for="(item, index) in []" :key="index">
-      <vhs-exam-item :data="item" />
+    <view class="" v-for="(item, index) in simulatedRecordList" :key="index">
+      <vhs-exam-record-item :data="item" />
     </view>
   </view>
 </template>
 <script lang="ts" setup>
-import { getSimulatedRecord, getPaperWorkList } from '@/api/modules/study';
-import { EnumExamRecordType, EnumPaperWorkState } from '@/common/enum';
-import VhsExamItem from '@/pagesStudy/components/vhs-exam-item.vue';
+import { getSimulatedRecord } from '@/api/modules/study';
+import VhsExamRecordItem from '@/pagesStudy/components/vhs-exam-record-item.vue';
 import { Study } from '@/types';
-import PaperWorkItem from '@/pagesStudy/components/paper-work-item.vue';
-const props = defineProps({
-  examType: {
-    type: String,
-    default: 'test'
-  }
-});
+
 const simulatedRecordList = ref<Study.SimulatedRecord[]>([]);
 const paperWorkRecordList = ref<Study.PaperWork[]>([]);
-const loadData = async (type: string) => {
+const loadData = async () => {
   simulatedRecordList.value = [];
   paperWorkRecordList.value = [];
-  if (type === EnumExamRecordType.SIMULATED) {
-    const { data } = await getSimulatedRecord();
-    simulatedRecordList.value = data;
-  } else {
-    const { rows } = await getPaperWorkList({ state: EnumPaperWorkState.COMPLETED });
-    paperWorkRecordList.value = rows;
-  }
+  const { data } = await getSimulatedRecord();
+  simulatedRecordList.value = data;
+  console.log(data, 123)
 }
 
-watch(() => props.examType, (newVal) => {
-  loadData(newVal);
-}, {
-  immediate: false
-});
 onShow(() => {
-  loadData(props.examType);
+  loadData();
 });
 </script>
 <style lang="scss" scoped></style>

+ 3 - 8
src/pagesStudy/pages/study-history/components/vhs-exam-history.vue

@@ -1,20 +1,15 @@
 <template>
   <view class="h-full">
-    <vhs-exam-history-student v-if="isStudent" :exam-type="examType" />
-    <vhs-exam-history-teacher v-else :exam-type="examType" />
+    <vhs-exam-history-student v-if="isStudent" />
+    <vhs-exam-history-teacher v-else />
   </view>
 </template>
 <script lang="ts" setup>
-import { EnumExamRecordType } from '@/common/enum';
 import VhsExamHistoryStudent from './vhs-exam-history-student.vue';
 import VhsExamHistoryTeacher from './vhs-exam-history-teacher.vue';
 import { useUserStore } from '@/store/userStore';
-const { isStudent } = storeToRefs(useUserStore());
-const examType = ref(EnumExamRecordType.SIMULATED);
 
-const handleChangeExamType = (type: EnumExamRecordType) => {
-  examType.value = type;
-}
+const { isStudent } = storeToRefs(useUserStore());
 </script>
 <style lang="scss" scoped>
 .exam-type-item {

+ 110 - 0
src/pagesSystem/pages/pay/pay.vue

@@ -0,0 +1,110 @@
+<template>
+  <ie-page bg-color="#F6F8FA">
+    <ie-navbar title="收银台" />
+    <view>
+      <view class="content">
+        <view class="money-info flex flex-col items-center justify-center">
+          <view class="">
+            <text class="unit">¥</text>
+            <text class="money">{{ formatPrice }}</text>
+          </view>
+          <view class="tip">待支付金额</view>
+        </view>
+        <view class="goods-info">
+          <view class="goods-info-item flex items-center justify-between">
+            <text class="tip">商品名称</text>
+            <text>会员卡</text>
+          </view>
+          <view class="goods-info-item flex items-center justify-between">
+            <text class="tip">商品金额</text>
+            <text>¥{{ formatPrice }}</text>
+          </view>
+        </view>
+      </view>
+      <view class="tip mt-[30px] px-[20px]">选择支付方式</view>
+      <view v-if="!isIOS" class="channel-list">
+        <uv-radio-group v-model="payType" placement="column" iconPlacement="right" shape="square" size="24"
+          iconSize="18">
+          <uv-radio :name="payType">
+            <view class="flex items-center" slot="label">
+              <image class="channel-icon" mode="widthFix" src="@/static/wechat-pay.png" />
+              <text>微信支付</text>
+            </view>
+          </uv-radio>
+        </uv-radio-group>
+      </view>
+      <view class="btn-wrap">
+        <uv-button type="primary" @click="handlePay">确认支付 ¥{{ formatPrice }}</uv-button>
+      </view>
+    </view>
+  </ie-page>
+</template>
+<script lang="ts" setup>
+import { usePay } from '@/hooks/usePay';
+const { ready, price, formatPrice, pay } = usePay();
+const isIOS = ref(false);
+const payType = ref('wechat');
+const handlePay = () => {
+  pay();
+}
+</script>
+<style lang="scss" scoped>
+.content {
+  padding: 0 20px;
+}
+
+.money-info {
+  padding: 30px 0;
+}
+
+.unit {
+  font-size: 20px;
+}
+
+.money {
+  font-size: 48px;
+  font-weight: bold;
+  letter-spacing: 2px;
+}
+
+.tip {
+  color: #7c7c7c;
+  font-size: 15px;
+}
+
+.goods-info {
+  margin-bottom: 26px;
+}
+
+.goods-info-item {
+  &+& {
+    margin-top: 10px;
+  }
+}
+
+.channel-list {
+  margin: 10px 10px 0 10px;
+  border-radius: 12px;
+  background-color: #ffffff;
+  padding: 12px;
+}
+
+.u-radio+.u-radio {
+  margin-top: 10px;
+}
+
+.u-radio:last-child {
+  border-bottom: none !important;
+}
+
+.channel-icon {
+  width: 40px;
+  height: 40px;
+  margin-right: 8px;
+}
+
+.btn-wrap {
+  margin-top: 50px;
+  padding: 0 20px;
+}
+</style>

+ 2 - 1
src/types/index.ts

@@ -3,6 +3,7 @@ import * as User from "./user";
 import * as News from "./news";
 import * as Transfer from "./transfer";
 import * as System from './system';
+import * as Pay from "./pay";
 import { VipCardInfo } from "./user";
 import { EnumExamMode, EnumExamType, EnumReviewMode } from "@/common/enum";
 
@@ -126,4 +127,4 @@ export interface ConfigItem {
 
 
 
-export { Study, User, News, Transfer, System };
+export { Study, User, News, Transfer, System, Pay };

+ 9 - 0
src/types/pay.ts

@@ -0,0 +1,9 @@
+export interface EcardPrice {
+  id: number;
+  price: number;
+  location: string;
+  outTime: string;
+  examType: string;
+  createdAt: string;
+  updatedAt: string;
+}

+ 2 - 0
src/types/study.ts

@@ -387,6 +387,8 @@ export interface SimulatedRecord {
   // 
   subjectName: string;
   state: EnumSimulatedRecordStatus;
+  //
+  subjectGroup: string;
 }
 
 /**

+ 2 - 1
src/uni_modules/uv-radio/components/uv-radio/uv-radio.vue

@@ -280,6 +280,7 @@
 		overflow: hidden;
 		flex-direction: row;
 		align-items: center;
+    gap: $uv-radio-label-wrap-padding-right;
 		&-label--left {
 			flex-direction: row
 		}
@@ -342,7 +343,7 @@
 		}
 		&__label-wrap {
 			flex: 1;
-			padding-left: $uv-radio-label-wrap-padding-right;
+			// padding-left: $uv-radio-label-wrap-padding-right;
 		}
 	}
 </style>