feat: 调整登录逻辑
This commit is contained in:
7
App.vue
7
App.vue
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
|
||||
import { checkPhone } from "@/manager/LoginManager";
|
||||
import { goLogin } from "@/hooks/useGoLogin";
|
||||
import { goHome } from "@/hooks/useGoHome";
|
||||
|
||||
onLaunch(async () => {
|
||||
@@ -9,6 +10,12 @@ onLaunch(async () => {
|
||||
const token = uni.getStorageSync("token");
|
||||
|
||||
// 检测是否绑定手机号和token
|
||||
if (!token) {
|
||||
goLogin();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (token) {
|
||||
const res = await checkPhone();
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const goHome = () => uni.reLaunch({ url: "/pages/index/index" });
|
||||
export const goHome = () => uni.reLaunch({ url: "/pages/index/index" });
|
||||
|
||||
1
hooks/useGoLogin.js
Normal file
1
hooks/useGoLogin.js
Normal file
@@ -0,0 +1 @@
|
||||
export const goLogin = () => uni.reLaunch({ url: "/pages/login/index" });
|
||||
Reference in New Issue
Block a user