mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-12 12:13:51 +08:00
增加注册强制邀请码开关、微信内登录自动获取openid开关
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user