feat: 调整项目结构

This commit is contained in:
duanshuwen committed 2025-09-21 17:25:09 +08:00
1 parent 0b66462d16
commit 9f23854ad5
410 files changed
+3806 -1668

No files matched your search

+1
View File
@@ -0,0 +1 @@
export const goHome = () => uni.reLaunch({ url: "/pages/index/index" });
+40
View File
@@ -0,0 +1,40 @@
import { loginAuth, bindPhone } from "@/manager/LoginManager";
import { clientId } from "@/constant/base";
import { useAppStore } from "@/store";
// 跳转登录
export const goLogin = () => uni.navigateTo({ url: "/pages/login/index" });
// 登录成功后,返回上一页
export const goBack = () => uni.navigateBack({ delta: 1 });
// 登录逻辑
export const onLogin = async (e) => {
return new Promise(async (resolve) => {
await loginAuth().then(async () => {
const { code } = e.detail;
console.info("onLogin code: ", code);
// 绑定手机号
const params = { wechatPhoneCode: code, clientId: clientId };
const res = await bindPhone(params);
if (res.data) {
resolve();
}
});
});
};
// 检测token
export const checkToken = () => {
return new Promise((resolve) => {
const appStore = useAppStore();
console.log("appStore.hasToken: ", appStore.hasToken);
if (!appStore.hasToken) {
console.log("没有token,跳转到登录页");
goLogin();
return;
}
resolve();
});
};