Browse Source

feat:大赛新增回填上一次报名的信息

zhubo@luojigou.vip 3 years ago
parent
commit
79de22265c
2 changed files with 34 additions and 3 deletions
  1. 8 0
      src/api/competition.js
  2. 26 3
      src/pages/competitionRegister/collectInformation.vue

+ 8 - 0
src/api/competition.js

@@ -156,4 +156,12 @@ export function getAgentProgramAddress() {
         url: `/agent/miniprogram/agent/program/address`,
         method: 'GET',
     })
+}
+
+// 查询上一次报名基本信息
+export function getAgentRegisterLastInfo() {
+    return request({
+        url: `/agent/miniprogram/agent/register/last/info`,
+        method: 'GET',
+    })
 }

+ 26 - 3
src/pages/competitionRegister/collectInformation.vue

@@ -177,7 +177,10 @@
 </template>
 
 <script>
-import { submitAgentRegister } from "@/api/competition.js";
+import {
+  submitAgentRegister,
+  getAgentRegisterLastInfo,
+} from "@/api/competition.js";
 import StepRegister from "./component/step-register.vue";
 import StepTabbar from "./component/step-tabbar.vue";
 import { areaList } from "@vant/area-data";
@@ -243,7 +246,12 @@ export default {
     },
   },
   onLoad(options) {
-    this.form.competitionChildId = options.competitionId;
+    if (options && options.competitionId) {
+      this.form.competitionChildId = options.competitionId;
+    }
+  },
+  async onReady() {
+    await this.getAgentRegisterLastInfo();
   },
   onShow() {
     uni.getStorage({
@@ -258,6 +266,21 @@ export default {
     });
   },
   methods: {
+    // 查询上一次报名基本信息
+    async getAgentRegisterLastInfo() {
+      const { data, msg, status } = await getAgentRegisterLastInfo();
+      if (status === 200 && data) {
+        // console.log(data, "getAgentRegisterLastInfo");
+        const obj = {
+          district: data.district,
+          unit: data.unit,
+          unitPrincipal: data.unitPrincipal,
+          detailAddress: data.detailAddress,
+        };
+        Object.assign(this.form, obj);
+        // console.log(this.form, "form");
+      }
+    },
     changeMaterialNumber(key, value) {
       key.number = value;
       this.$forceUpdate();
@@ -327,7 +350,7 @@ export default {
         this.show = true;
         uni.removeStorage({
           key: "formData",
-          success: function (res) {
+          success: function(res) {
             console.log("已经移除内存中的schoolList");
           },
         });