From 7ccd828bcc341adb81815368f19b002878201730 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期五, 05 十二月 2025 17:22:30 +0800
Subject: [PATCH] release: @12333/underTakeMiniApp v1.1.15

---
 apps/underTakeMiniApp/src/subpackages/login/loginByForm/accountLoginForm.vue |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/apps/underTakeMiniApp/src/subpackages/login/loginByForm/accountLoginForm.vue b/apps/underTakeMiniApp/src/subpackages/login/loginByForm/accountLoginForm.vue
index ad613bb..c8af0c2 100644
--- a/apps/underTakeMiniApp/src/subpackages/login/loginByForm/accountLoginForm.vue
+++ b/apps/underTakeMiniApp/src/subpackages/login/loginByForm/accountLoginForm.vue
@@ -76,6 +76,7 @@
 const formRef = ref(null);
 const isAccount = ref(false);
 const wxMiniAppUserLoginRes = ref<API.LoginCommandCallback>();
+const loginRes = ref(null);
 
 const form = reactive({
   loading: false,
@@ -88,7 +89,7 @@
   userPassword: [{ required: true, message: '璇疯緭鍏ュ瘑鐮�' }],
 });
 
-async function handleLoginByHasAccount() {
+function handleLoginByHasAccount() {
   try {
     if (props.policyChecked) {
       userStore.loginSuccess(wxMiniAppUserLoginRes.value);
@@ -101,7 +102,6 @@
 
 async function handleLogin() {
   try {
-    let loginRes = await Taro.login();
     if (props.policyChecked) {
       const { valid } = await formRef.value.validate();
       if (valid) {
@@ -109,7 +109,7 @@
         await userStore.loginByPassword({
           userName: form.userName,
           password: form.userPassword,
-          code: loginRes.code,
+          code: loginRes.value?.code,
         });
         handleLoginSuccess();
       }
@@ -117,6 +117,7 @@
       noAccess();
     }
   } catch (error) {
+    loginRes.value = await Taro.login();
   } finally {
     form.loading = false;
   }
@@ -166,9 +167,9 @@
 
 onMounted(async () => {
   try {
-    let loginRes = await Taro.login();
+    loginRes.value = await Taro.login();
     const params: API.WxmpLoginCommand = {
-      code: loginRes.code,
+      code: loginRes.value?.code,
       type: AppLocalConfig.userType,
       enterpriseType: AppLocalConfig.enterpriseType,
     };
@@ -182,6 +183,8 @@
     if (error?.info?.errorCode == 's401') {
       isAccount.value = false;
     }
+  } finally {
+    loginRes.value = await Taro.login();
   }
 });
 </script>

--
Gitblit v1.9.1