feat: 调整登录逻辑
This commit is contained in:
7
App.vue
7
App.vue
@@ -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
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