From 88550d6f43aece6e20c7a52b6e47aff638fb02f3 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期四, 04 十二月 2025 16:23:36 +0800
Subject: [PATCH] feat: 通知

---
 apps/underTakeMiniApp/src/subpackages/login/loginByForm/accountLoginForm.vue |   12 +++++++-----
 1 files changed, 7 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..31411a0 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();
       }
@@ -166,9 +166,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 +182,8 @@
     if (error?.info?.errorCode == 's401') {
       isAccount.value = false;
     }
+  } finally {
+    loginRes.value = await Taro.login();
   }
 });
 </script>

--
Gitblit v1.9.1