feat:订单接口替换
This commit is contained in:
1 parent
bfbb15502e
commit
2af8d5fd0b
9 files changed
+315
-206
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import storageConstant from "../constant/storage-constant";
|
||||
import { jump } from "../router/index";
|
||||
|
||||
export const useToken = () => {
|
||||
const tokenKey = storageConstant.TOKEN;
|
||||
@@ -15,3 +16,34 @@ export const useDefaultHeader = () => {
|
||||
Authorization: token,
|
||||
};
|
||||
};
|
||||
|
||||
export const useStaticCheckLogin = () => {
|
||||
const tokenKey = storageConstant.TOKEN;
|
||||
const tokenStorage = uni.getStorageSync(tokenKey);
|
||||
if (tokenStorage) return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
export const useCheckLogin = async (): Promise<boolean> => {
|
||||
const tokenKey = storageConstant.TOKEN;
|
||||
const tokenStorage = uni.getStorageSync(tokenKey);
|
||||
if (tokenStorage) return true;
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "您还未登录,请先登录",
|
||||
confirmColor: "#0094ff",
|
||||
cancelText: "取消",
|
||||
confirmText: "去登录",
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
jump("/pages/test/login", {}, 3);
|
||||
return;
|
||||
}
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
},
|
||||
});
|
||||
return false;
|
||||
};
|
||||
Reference in new issue
Block a user