优化
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
const TokenKey = 'accessToken';
|
||||
const CompanyIdKey = 'companyId';
|
||||
const ReferrerUserIdKey = 'referrerUserId';
|
||||
const RegisterStoreIdKey = 'storeId';
|
||||
|
||||
const TokenPrefix = 'Bearer ';
|
||||
|
||||
function isLogin() {
|
||||
@@ -22,9 +25,37 @@ function setCompanyId(companyId: string) {
|
||||
uni.setStorageSync(CompanyIdKey, companyId);
|
||||
}
|
||||
|
||||
function getReferrerUserId() {
|
||||
return uni.getStorageSync(ReferrerUserIdKey);
|
||||
}
|
||||
|
||||
function setReferrerUserId(referrerUserId: string) {
|
||||
uni.setStorageSync(ReferrerUserIdKey, referrerUserId);
|
||||
}
|
||||
|
||||
function setRegisterStoreId(storeId: string) {
|
||||
uni.setStorageSync(RegisterStoreIdKey, storeId);
|
||||
}
|
||||
|
||||
function getRegisterStoreId() {
|
||||
return uni.getStorageSync(RegisterStoreIdKey);
|
||||
}
|
||||
|
||||
function clearToken() {
|
||||
uni.removeStorageSync(TokenKey);
|
||||
uni.removeStorageSync(CompanyIdKey);
|
||||
}
|
||||
|
||||
export { TokenPrefix, isLogin, getToken, setToken, getCompanyId, setCompanyId, clearToken };
|
||||
export {
|
||||
TokenPrefix,
|
||||
isLogin,
|
||||
getToken,
|
||||
setToken,
|
||||
getCompanyId,
|
||||
setCompanyId,
|
||||
getReferrerUserId,
|
||||
setReferrerUserId,
|
||||
getRegisterStoreId,
|
||||
setRegisterStoreId,
|
||||
clearToken
|
||||
};
|
||||
|
@@ -51,10 +51,17 @@ export function showToast(title: string, { icon, duration, complete }: ToastOpti
|
||||
}
|
||||
|
||||
export function goPath(path: string) {
|
||||
uni.navigateTo({
|
||||
url: path
|
||||
}).then(r => {
|
||||
});
|
||||
if(path.includes('home/index') || path.includes('mall/index') || path.includes('qrcode/index') || path.includes('mine/index')) {
|
||||
uni.switchTab({
|
||||
url: path
|
||||
}).then(r => {
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: path
|
||||
}).then(r => {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function goLogin() {
|
||||
|
Reference in New Issue
Block a user