feat: 调整登录逻辑

This commit is contained in:
duanshuwen
2025-08-05 18:37:38 +08:00
parent 0a15c0dac3
commit 931511b0cf
3 changed files with 9 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
<script setup> <script setup>
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"; import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { checkPhone } from "@/manager/LoginManager"; import { checkPhone } from "@/manager/LoginManager";
import { goLogin } from "@/hooks/useGoLogin";
import { goHome } from "@/hooks/useGoHome"; import { goHome } from "@/hooks/useGoHome";
onLaunch(async () => { onLaunch(async () => {
@@ -9,6 +10,12 @@ onLaunch(async () => {
const token = uni.getStorageSync("token"); const token = uni.getStorageSync("token");
// 检测是否绑定手机号和token // 检测是否绑定手机号和token
if (!token) {
goLogin();
return;
}
if (token) { if (token) {
const res = await checkPhone(); const res = await checkPhone();

1
hooks/useGoLogin.js Normal file
View File

@@ -0,0 +1 @@
export const goLogin = () => uni.reLaunch({ url: "/pages/login/index" });