Bladeren bron

调整免费试用接口,新增代理提现页面

wyling 3 jaren geleden
bovenliggende
commit
77013af521

+ 4 - 2
src/api/modules/test.ts

@@ -14,7 +14,7 @@ interface topicQuery {
  * 获取题目列表
  * @returns
  */
-export async function getTopicList(params: any) {
+export async function getTopicList(params: any, isVip: Boolean = true) {
   const getUserAnswer = (type: string) => {
     switch (type) {
       case "判断题":
@@ -39,7 +39,9 @@ export async function getTopicList(params: any) {
   };
 
   let res = await request({
-    url: "/student/qustion/info/list",
+    url: isVip
+      ? "/student/qustion/info/list"
+      : "/student/qustion/info/normalList",
     params,
   });
 

+ 43 - 12
src/hooks/index.ts

@@ -12,18 +12,6 @@ export const useExpireTime = () => {
   };
 };
 
-/**
- * 获取路由query
- * @returns
- */
-export const useRouteQuery = () => {
-  const route = useRoute();
-  const query = route.query;
-  return {
-    query,
-  };
-};
-
 /**
  * 路由转发汇总class模式书写,需要注意this指向
  * @returns
@@ -41,6 +29,12 @@ export class RouterBus {
   goBuyVip = () => {
     this.router.push("/buyVip");
   };
+  /**
+   * 分成提现页
+   */
+  goCashOut = () => {
+    this.router.push("/cashOut");
+  };
   /**
    * 模拟考试页
    */
@@ -48,3 +42,40 @@ export class RouterBus {
     this.router.push({ path: "/mockTest", query: this.route.query });
   };
 }
+
+// function deepClone<T>(target: T, hash = new Map()): T {
+//   //地址存在则说明存在循环引用,直接返回新构造的引用地址
+//   if (hash.has(target)) return hash.get(target);
+//   //按类型处理数据
+//   switch (Object.prototype.toString.apply(target).slice(8, -1)) {
+//     case "Object": {
+//       const result: T = Object.assign({}, target);
+//       hash.set(target, result);
+//       for (let key in target) {
+//         result[key] = deepClone(target[key], hash);
+//       }
+//       return result;
+//     }
+//     case "Array": {
+//       const result: T = Object.assign([], target);
+//       hash.set(target, result);
+//       for (let key in target) {
+//         result[key] = deepClone(target[key], hash);
+//       }
+//       return result;
+//     }
+//     case "Map": {
+//       return new Map([...(target as any)]);
+//     }
+//     default:
+//       return target;
+//   }
+// }
+
+// let a = { a: 1, b: { a: 1 }, c: [{}, 2, 3] };
+// a.b = a;
+// a.c[1] = a;
+// let b = deepClone(a);
+// a.c[2] = 10;
+// a.a = 22;
+// console.log({ a, b });

+ 202 - 0
src/views/cashOut/index.vue

@@ -0,0 +1,202 @@
+<template>
+  <div class="header-back">
+    <m-nav-bar :transparent="true" title="提现页面" style="color: #ffffff" />
+    <div class="user-data">
+      <div class="left">
+        <m-user-avatar />
+        <div class="name">
+          <m-user-name />
+          <span
+            >可提现余额<span class="grade">{{ "5341.12" }}</span
+            >元</span
+          >
+        </div>
+      </div>
+      <m-button
+        @click="goMockTest"
+        class="continue"
+        width="90px"
+        height="30px"
+        text="我要提现"
+      />
+    </div>
+  </div>
+  <div class="summary content-box">
+    <van-search class="search" shape="round" placeholder="请输入下级代理昵称" />
+  </div>
+  <div class="test-scores content-box">
+    <table class="table">
+      <tr>
+        <th>头像</th>
+        <th>昵称</th>
+        <th>代理等级</th>
+        <th>分成比例</th>
+        <th>分成金额</th>
+      </tr>
+      <tr v-for="(item, index) in testScoresList" :key="index">
+        <td>
+          <van-image
+            round
+            width="50px"
+            height="50px"
+            src="https://img01.yzcdn.cn/vant/cat.jpeg"
+          />
+        </td>
+        <td>{{ "item.type" }}</td>
+        <td>{{ "一级" }}</td>
+        <td>{{ "50%" }}</td>
+        <td>{{ "5000元" }}</td>
+      </tr>
+    </table>
+  </div>
+</template>
+
+<script lang="ts">
+import { getTestScoresList, getTestScoresInfo } from "@/api";
+import { ref, onBeforeMount } from "vue";
+import { RouterBus } from "@/hooks";
+/**
+ * 考试成绩数据结构
+ */
+interface TestScores {
+  createTime: string; //考试时间
+  kskm: string; //科目
+  score: number; //分数
+  type: string; //车型
+}
+/**
+ * 模拟考成绩列表
+ */
+const useTestScoresList = () => {
+  const testScoresList = ref<TestScores[]>([]);
+  onBeforeMount(async () => {
+    let res = await getTestScoresList();
+    testScoresList.value = res.rows;
+  });
+  return {
+    testScoresList,
+  };
+};
+/**
+ * 成绩信息数据结构
+ */
+interface TestScoresInfo {
+  avgScore: number; //平均成绩
+  forecastScore: number; //预测成绩
+  maxScore: number; //最大成绩
+}
+/**
+ * 最大成绩,平均成绩,预测成绩
+ */
+const useTestScoresInfo = () => {
+  const testScoresInfo = ref<TestScoresInfo>({
+    avgScore: 0,
+    forecastScore: 0,
+    maxScore: 0,
+  });
+  onBeforeMount(async () => {
+    let res = await getTestScoresInfo();
+    testScoresInfo.value = res.data;
+  });
+  return {
+    testScoresInfo,
+  };
+};
+</script>
+
+<script lang="ts" setup>
+const { testScoresList } = useTestScoresList();
+const { testScoresInfo } = useTestScoresInfo();
+const { goMockTest } = new RouterBus();
+</script>
+
+<style scoped lang="scss">
+.header-back {
+  width: 375px;
+  padding-bottom: 82px;
+  background: linear-gradient(180deg, #498ef5 0%, #4da8e6 100%);
+  border-radius: 0px 0px 82px 82px;
+  .user-data {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 19px 17px 24px;
+    .left {
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+      .name {
+        display: flex;
+        flex-direction: column;
+        font-size: 13px;
+        color: #ffffff;
+        justify-content: space-between;
+        margin-left: 6px;
+        .grade {
+          font-size: 24px;
+          padding: 4px;
+        }
+      }
+    }
+    .continue {
+      font-size: 13px;
+      font-family: PingFang SC;
+      font-weight: 400;
+      line-height: 19px;
+      color: #ffffff;
+      background: #01c18d;
+    }
+  }
+}
+.content-box {
+  width: 345px;
+  background: #ffffff;
+  box-shadow: 0px 0px 8px rgba(124, 129, 136, 0.2);
+  border-radius: 10px;
+  position: relative;
+  left: 50%;
+  transform: translateX(-50%);
+  top: -82px;
+  margin-top: 10px;
+}
+.summary {
+  display: flex;
+  justify-content: space-around;
+  box-sizing: border-box;
+  overflow: hidden;
+  .search {
+    width: 100%;
+  }
+}
+.test-scores {
+  font-size: 13px;
+  font-family: PingFang SC;
+  font-weight: 400;
+  line-height: 19px;
+  color: #0a1a33;
+  padding: 15px;
+  box-sizing: border-box;
+  .table {
+    width: 100%;
+    border-collapse: collapse;
+    font-size: 13px;
+    th {
+      padding: 5px;
+      color: #0a1a33;
+    }
+    td {
+      text-align: center;
+      padding: 5px;
+      color: #8a9099;
+    }
+    tr {
+      &:nth-of-type(n) {
+        background: #ffffff;
+      }
+      &:nth-of-type(2n) {
+        background: rgba(73, 142, 245, 0.15);
+      }
+    }
+  }
+}
+</style>

+ 5 - 3
src/views/exercise/hooks.ts

@@ -92,7 +92,10 @@ export function useAudioSet(currentSubject: ComputedRef<any>) {
         audioPlay(currentSubject.value.explainMp3);
         break;
       case "读题+答案":
-        audioPlay([currentSubject.value.issuemp3, currentSubject.value.answermp3]);
+        audioPlay([
+          currentSubject.value.issuemp3,
+          currentSubject.value.answermp3,
+        ]);
         break;
       default:
         break;
@@ -120,7 +123,7 @@ export function useAudioSet(currentSubject: ComputedRef<any>) {
   return {
     aotuPlayFlag,
     aotuPlaySet,
-    subjectAudioPlay
+    subjectAudioPlay,
   };
 }
 
@@ -241,7 +244,6 @@ export const useSubjectShowLogic = () => {
         await loadNewSubject();
         //启用按钮
         nextBtnState.value = true;
-        nextSubject();
       }
     }
   };

+ 21 - 13
src/views/exerciseFree/hooks.ts

@@ -92,7 +92,10 @@ export function useAudioSet(currentSubject: ComputedRef<any>) {
         audioPlay(currentSubject.value.explainMp3);
         break;
       case "读题+答案":
-        audioPlay([currentSubject.value.issuemp3, currentSubject.value.answermp3]);
+        audioPlay([
+          currentSubject.value.issuemp3,
+          currentSubject.value.answermp3,
+        ]);
         break;
       default:
         break;
@@ -120,7 +123,7 @@ export function useAudioSet(currentSubject: ComputedRef<any>) {
   return {
     aotuPlayFlag,
     aotuPlaySet,
-    subjectAudioPlay
+    subjectAudioPlay,
   };
 }
 
@@ -131,11 +134,14 @@ const useSubjectList = () => {
   const pageSize = ref(100); //当前请求每页数据
   const query = useRoute().query; //路由query参数
   onBeforeMount(async () => {
-    const res = await API.getTopicList({
-      ...query,
-      pageNum: pageNum.value,
-      pageSize: pageSize.value,
-    });
+    const res = await API.getTopicList(
+      {
+        ...query,
+        pageNum: pageNum.value,
+        pageSize: pageSize.value,
+      },
+      false
+    );
     subjectList.value = res.list;
     subjectTotal.value = res.total;
   });
@@ -143,11 +149,14 @@ const useSubjectList = () => {
   const loadNewSubject = async () => {
     if (subjectList.value.length == subjectTotal.value) return;
     pageNum.value++;
-    const res = await API.getTopicList({
-      ...query,
-      pageNum: pageNum.value,
-      pageSize: pageSize.value,
-    });
+    const res = await API.getTopicList(
+      {
+        ...query,
+        pageNum: pageNum.value,
+        pageSize: pageSize.value,
+      },
+      false
+    );
     subjectList.value = subjectList.value.concat(res.list);
   };
   const currentSubjectIndex = ref(0); //当前题目下标
@@ -241,7 +250,6 @@ export const useSubjectShowLogic = () => {
         await loadNewSubject();
         //启用按钮
         nextBtnState.value = true;
-        nextSubject();
       }
     }
   };

+ 2 - 2
src/views/home/children/test/index.vue

@@ -47,7 +47,7 @@ const carTypeList = ref([
         query: {
           name: "科目一",
           cert: "C1/C2/C3",
-          vehicle: "轿车",
+          vehicle: "车",
           subject1: 1,
         },
       },
@@ -56,7 +56,7 @@ const carTypeList = ref([
         query: {
           name: "科目四",
           cert: "C1/C2/C3",
-          vehicle: "轿车",
+          vehicle: "车",
           subject4: 1,
         },
       },

+ 2 - 2
src/views/home/children/user/index.vue

@@ -9,7 +9,7 @@
       </template>
     </van-cell>
     <van-cell-group class="group">
-      <van-cell title="我要提现" value="" is-link center>
+      <van-cell title="我要提现" value="" is-link center @click="goCashOut">
         <template #icon>
           <m-icon type="hyyxq" class="cell-icon" />
         </template>
@@ -58,7 +58,7 @@ import { useExpireTime, RouterBus } from "@/hooks";
 <script lang="ts" setup>
 import { loopPrepareOrder } from "@/api";
 const { expireTime } = useExpireTime();
-const { goBuyVip } = new RouterBus();
+const { goBuyVip, goCashOut } = new RouterBus();
 </script>
 
 <style scoped lang="scss">

+ 1 - 6
src/views/home/index.vue

@@ -7,7 +7,6 @@
         <m-icon :type="props.active ? 'jiakao' : 'jiakaohui'" />
       </template>
     </van-tabbar-item>
-    <!-- <van-tabbar-item to="/find" icon="search">发现</van-tabbar-item> -->
     <van-tabbar-item to="/home/user" icon="friends-o"
       >我的
       <template #icon="props">
@@ -17,11 +16,7 @@
   </van-tabbar>
 </template>
 
-<script lang="ts" setup>
-import { useRouter } from "vue-router";
-const router = useRouter();
-router.push("/home/test");
-</script>
+<script lang="ts" setup></script>
 
 <style scoped lang="scss">
 .my-swipe {

+ 5 - 1
src/views/testScores/index.vue

@@ -1,6 +1,10 @@
 <template>
   <div class="header-back">
-    <m-nav-bar :transparent="true" title="模拟考试" style="color: #ffffff" />
+    <m-nav-bar
+      :transparent="true"
+      title="模拟考试成绩"
+      style="color: #ffffff"
+    />
     <div class="user-data">
       <div class="left">
         <m-user-avatar />