lingdu 1 주 전
부모
커밋
9028d70b76
2개의 변경된 파일40개의 추가작업 그리고 12개의 파일을 삭제
  1. 15 0
      src/api/2025.js
  2. 25 12
      src/view/fenghui/introduction.vue

+ 15 - 0
src/api/2025.js

@@ -18,4 +18,19 @@ export function saveData(data) {
         errorToast: '当前访问人数过多,请重试。',
         data
     });
+}
+
+/**
+ * 校验邀请码
+ * @param {code} string
+ * @param {userType} string
+ */
+export function checkCode(data) {
+    return ajax({
+        url: 'biz/signup/verifyCode',
+        method: 'POST',
+        urlType: 'Url2025',
+        errorToast: '当前访问人数过多,请重试。',
+        data
+    }); 
 }

+ 25 - 12
src/view/fenghui/introduction.vue

@@ -174,17 +174,18 @@
                 <div class="text" v-html="lang[langType].organizationSub4"></div>
             </van-col>
         </van-row>
-        <van-button class="btn_bottom" block type="primary" @click="showCheck = true, code = 'fore25'">
+        <van-button class="btn_bottom" block type="primary" @click="showCheck = true, code='fore25'">
             {{ lang[langType].signUp }}
         </van-button>
-        <van-button class="btn_bottom" block type="primary" @click="showCheck = true, code = 'chin25'">
+        <van-button class="btn_bottom" block type="primary" @click="showCheck = true, code='chin25'">
             {{ lang[langType].signUpZH }}
         </van-button>
-        <van-button class="btn_bottom" block type="primary" @click="showCheck = true, code = 'work25'">
+        <van-button class="btn_bottom" block type="primary" @click="showCheck = true, code='work25'">
             {{ lang[langType].signUpWK }}
         </van-button>
 
-        <van-dialog :confirmButtonText="lang[langType].confirm" :cancelButtonText="lang[langType].cancel" @confirm="checkVerificationCode" v-model:show="showCheck" :title="lang[langType].verificationCode"
+        <van-dialog :confirmButtonText="lang[langType].confirm" :cancelButtonText="lang[langType].cancel"
+            @confirm="checkVerificationCode" v-model:show="showCheck" :title="lang[langType].verificationCode"
             show-cancel-button>
             <van-field v-model="verificationCode" :placeholder="lang[langType].verificationCodeContent" />
         </van-dialog>
@@ -192,22 +193,34 @@
 </template>
 <script setup>
 import { defineProps, ref, defineEmits } from 'vue';
+import { checkCode } from '@/api/2025.js';
 import { showToast } from 'vant';
 import lang from './lang.js';
 const showCheck = ref(false);
 const verificationCode = ref('');
 const prprs = defineProps(['langType']);
 const emits = defineEmits(['checkVerificationCode']);
-let code = ''
+let code = '';
 
 const checkVerificationCode = () => {
-    if (code !== verificationCode.value.toLowerCase()) {
-        showToast({
-            message: lang[prprs.langType].verificationCodeError,
-            type: 'fail',
-        });
-        return
-    }
+    let userType = lang[prprs.langType].distinguishedGuest[code];
+    checkCode({
+        code: verificationCode.value.toLowerCase(),
+        userType
+    }).then((res) => {
+        if (!isNaN(res.code) && res.code !== 0) {
+            const messages = res.data
+            let message = lang[props.langType].upFileError;
+            if (messages.cnMessage && props.langType === 'zh') {
+                message = messages.cnMessage;
+            } else if (messages.enMessage && props.langType === 'en') {
+                message = messages.enMessage;
+            }
+            showToast(message);
+            showToast(lang[prprs.langType].verificationCodeError);
+            return;
+        }
+    })
     emits('checkVerificationCode', code);
 }
 </script>