Эх сурвалжийг харах

新增登录时候跳转注册

yuanmingze 3 сар өмнө
parent
commit
a2f2736ca7

+ 0 - 1
src/components/ModernDialog.vue

@@ -167,7 +167,6 @@ const handleClose = () => {
       .btn--fail {
         /* 让边框略淡一些,视觉层次更好 */
         border-width: 1px;
-        background-color: #fe783d;
       }
     }
   }

+ 1 - 1
src/router/routes.ts

@@ -16,7 +16,7 @@ export const routes: RouteRecordRaw[] = [
     path: '/register',
     name: 'Register',
     component: () => import('@/views/register/index.vue'),
-    meta: { title: '登录', requiresAuth: false },
+    meta: { title: '注册', requiresAuth: false },
   },
   {
     path: '/agreement',

+ 23 - 0
src/views/login/index.vue

@@ -64,6 +64,17 @@
         cancelText="返回继续登录"
         @cancel="onCancel"
       />
+
+      <!-- 注册弹窗 -->
+      <ModernDialog
+        v-model:show="loginDialog"
+        title="提示"
+        :message="loginMessage"
+        cancelText="返回"
+        @cancel="loginCancel"
+        confirmText="立即注册"
+        @confirm="loginConfirm"
+      />
     </div>
   </div>
 </template>
@@ -168,6 +179,15 @@ const startCountDown = () => {
   }, 1000)
 }
 
+const loginDialog = ref(false)
+const loginMessage = ref('')
+const loginCancel = () => {
+  loginDialog.value = false
+}
+
+const loginConfirm = () => {
+  registerUrl()
+}
 /* 登录逻辑 */
 const loginBtn = useDebounceFn(async () => {
   if (!formData.mobile) {
@@ -193,6 +213,9 @@ const loginBtn = useDebounceFn(async () => {
     if (res?.access_token) {
       userStore.setAccessToken(res.access_token)
       router.replace({ path: '/invoice-information' })
+    } else if (res.code == 401) {
+      loginMessage.value = res.msg
+      loginDialog.value = true
     }
   } catch (err: any) {
     const { code, message } = err || {}