登录逻辑调整

This commit is contained in:
2024-06-06 17:36:31 +08:00
parent 351e675c6d
commit 8f06cf703d
6 changed files with 48 additions and 24 deletions

View File

@@ -1,5 +1,7 @@
// 小程序更新检测
import { isLogin } from '@/utils';
export function mpUpdate() {
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate((res) => {
@@ -50,7 +52,20 @@ export function showToast(title: string, { icon, duration, complete }: ToastOpti
});
}
export function goPath(path: string) {
export function goPath(path: string, needAuth: boolean = false) {
if(needAuth && !isLogin()) {
uni.showModal({
title: '提示',
content: '您还未登录,请先登录',
showCancel: true,
success: (res) => {
if(res.confirm) {
goLogin();
}
}
});
return;
}
if(path.includes('home/index') || path.includes('mall/index') || path.includes('qrcode/index') || path.includes('mine/index')) {
uni.switchTab({
url: path