瀏覽代碼

国任重新登录功能开发

祁鹏飞 4 月之前
父節點
當前提交
8eb908bc9c
共有 1 個文件被更改,包括 54 次插入2 次删除
  1. 54 2
      src/views/insurancePolicy/index.vue

+ 54 - 2
src/views/insurancePolicy/index.vue

@@ -1416,6 +1416,16 @@
         <el-button size="small" type="primary" @click="handleGetPayCode">缴费二维码</el-button>
       </template>
     </el-dialog>
+    <el-dialog v-model="againLoginDialog" title="重新登录" width="400">
+      <el-form >
+        <el-form-item label="验证码">
+          <el-input v-model="captcha" placeholder="输入验证码"></el-input>
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button size="small" type="primary" @click="againLogin" :loading="againLoginLoading">确定登录</el-button>
+      </template>
+    </el-dialog>
     <el-dialog v-model="payCodeShow" title="支付码" width="400">
       <div style="display: flex; align-items: center; justify-content: center">
         <img style="width: 200px; height: 200px" :src="payCodeSrc" />
@@ -3217,9 +3227,8 @@ const handleSubmit = async (InsurancePolicyRefs: FormInstance | undefined, scope
     })
     return
   }
-  console.log(insurancePolicyForm.value)
   // return
-  await InsurancePolicyRefs.validate((valid: any) => {
+  InsurancePolicyRefs.validate((valid: any) => {
     if (valid) {
       // 设置当前报价项的加载状态
       quoteData.value[scope.$index].loading = true
@@ -3507,6 +3516,10 @@ const handleSubmit = async (InsurancePolicyRefs: FormInstance | undefined, scope
               quoteData.value[scope.$index].loading = false
               console.log('报价后的数据', quoteData.value)
             } else {
+              if(res.msg.includes('token过期,请重新登录')){
+                agreementId.value=data.order.agreementId
+                getGuoRenCaptcha()
+              }
               // ElMessage({
               //   message: res.msg,
               //   type: 'warning'
@@ -3738,6 +3751,45 @@ const ruleFilterCompany = (item: any) => {
   })
 }
 
+const againLoginLoading=ref(false)
+const againLoginDialog=ref(false)
+const captcha=ref('')
+const agreementId=ref('')
+const captchaId=ref('')
+const againLogin=async ()=>{
+  const params={
+    captcha: captcha.value,
+    agreementId: agreementId.value,
+  }
+  againLoginLoading.value=true
+  api.insurancePolicyApi.againLogin({
+   ...params,
+   captchaId:captchaId.value
+  }).then((res: any) => {
+    if (res.code == 200) {
+      againLoginDialog.value=false
+      captcha.value=''
+      agreementId.value=''
+      ElMessage.success('登录成功,请重新报价')
+    }
+  }).finally(()=> againLoginLoading.value=false )
+}
+
+const getGuoRenCaptcha=()=>{
+  const params={
+    captcha: captcha.value,
+    agreementId: agreementId.value,
+  }
+  api.insurancePolicyApi.getGuoRenCaptcha({
+   ...params,
+  }).then((res: any) => {
+    if (res.code == 200) {
+      againLoginDialog.value=true
+      captchaId.value = res.data.identifyId
+    }
+  })
+}
+
 // 组件挂载后执行初始化操作
 onMounted(() => {
   getAreaList()    // 获取地区列表