feat: 登录逻辑的调整

This commit is contained in:
2025-10-12 13:55:35 +08:00
parent 14945914ea
commit 2abce21c49
7 changed files with 58 additions and 15 deletions

View File

@@ -106,6 +106,7 @@ const handleLogout = () => {
if (res.confirm) {
uni.clearStorageSync();
appStore.setHasToken(false);
appStore.setTokenExpired(true);
emits("closeDrawer");
uni.$emit(NOTICE_EVENT_LOGOUT);
}

View File

@@ -29,15 +29,25 @@
>
微信一键登录
</button>
<button
v-if="isAgree"
v-if="isAgree && !appStore.tokenExpired"
class="login-btn"
open-type="getPhoneNumber"
type="primary"
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
>
微信一键登录
</button>
<button
v-if="isAgree && appStore.tokenExpired"
class="login-btn"
type="primary"
@click="handleLogin"
>
微信一键登录
</button>
</view>
<!-- 协议勾选 -->
@@ -79,6 +89,8 @@ import CheckBox from "@/components/CheckBox/index.vue";
import AgreePopup from "./components/AgreePopup/index.vue";
import { zniconsMap } from "@/static/fonts/znicons.js";
import { getCurrentConfig } from "@/constant/base";
import { useAppStore } from "@/store";
const appStore = useAppStore();
const isAgree = ref(false);
const visible = ref(false);
@@ -113,6 +125,20 @@ const getPhoneNumber = (e) => {
.catch(() => {});
};
const handleLogin = () => {
console.log("handleLogin");
onLogin()
.then(() => {
uni.showToast({
title: "登录成功",
icon: "success",
});
appStore.setTokenExpired(false);
goBack();
})
.catch(() => {});
};
// 处理同意协议点击事件
const handleAgreeClick = (type) => {
visible.value = true;