增加注册强制邀请码开关、微信内登录自动获取openid开关

This commit is contained in:
孟帅
2023-05-15 10:17:04 +08:00
parent a1ca9bfafc
commit 6187fedd4e
26 changed files with 157 additions and 96 deletions

View File

@@ -17,6 +17,7 @@ import {
logout,
mobileLogin,
} from '@/api/system/user';
import { isWechatBrowser } from '@/utils/is';
const Storage = createStorage({ storage: localStorage });
export interface UserInfoState {
@@ -59,6 +60,7 @@ export interface ConfigState {
export interface LoginConfigState {
loginRegisterSwitch: number;
loginCaptchaSwitch: number;
loginAutoOpenId: number;
loginProtocol: string;
loginPolicy: string;
}
@@ -218,6 +220,18 @@ export const useUserStore = defineStore({
});
});
},
// 是否允许获取微信openid
allowWxOpenId(): boolean {
if (!isWechatBrowser()) {
return false;
}
if (this.loginConfig?.loginAutoOpenId !== 1) {
return false;
}
return this.info?.openId === '';
},
// 登出
async logout() {
try {