From 037f138b351a5b3c8a25e6228312698b748225f6 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期五, 05 十二月 2025 13:14:33 +0800
Subject: [PATCH] fix: bug
---
apps/bMiniApp/src/subpackages/login/loginByForm/accountLoginForm.vue | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/apps/bMiniApp/src/subpackages/login/loginByForm/accountLoginForm.vue b/apps/bMiniApp/src/subpackages/login/loginByForm/accountLoginForm.vue
index 949c44f..3f3fa50 100644
--- a/apps/bMiniApp/src/subpackages/login/loginByForm/accountLoginForm.vue
+++ b/apps/bMiniApp/src/subpackages/login/loginByForm/accountLoginForm.vue
@@ -79,6 +79,7 @@
const formRef = ref(null);
const isAccount = ref(false);
const wxMiniAppUserLoginRes = ref<API.LoginCommandCallback>();
+const loginRes = ref(null);
const form = reactive({
loading: false,
@@ -104,7 +105,6 @@
async function handleLogin() {
try {
- let loginRes = await Taro.login();
if (props.policyChecked) {
const { valid } = await formRef.value.validate();
if (valid) {
@@ -112,7 +112,7 @@
await userStore.loginByPassword({
userName: form.userName,
password: form.userPassword,
- code: loginRes.code,
+ code: loginRes.value?.code,
});
handleLoginSuccess();
}
@@ -120,6 +120,7 @@
noAccess();
}
} catch (error) {
+ loginRes.value = await Taro.login();
} finally {
form.loading = false;
}
@@ -169,9 +170,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,
};
@@ -185,6 +186,8 @@
if (error?.info?.errorCode == 's401') {
isAccount.value = false;
}
+ } finally {
+ loginRes.value = await Taro.login();
}
});
</script>
--
Gitblit v1.9.1