mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-11-10 14:57:09 +08:00
refactor(tenant): 优化租户相关代码
This commit is contained in:
@@ -68,6 +68,7 @@ const storeSetup = () => {
|
||||
siteConfig.SITE_TITLE = resMap.get('SITE_TITLE')
|
||||
siteConfig.SITE_COPYRIGHT = resMap.get('SITE_COPYRIGHT')
|
||||
siteConfig.SITE_BEIAN = resMap.get('SITE_BEIAN')
|
||||
siteConfig.TENANT_ENABLED = resMap.get('TENANT_ENABLED') === 'true'
|
||||
document.title = resMap.get('SITE_TITLE')
|
||||
document
|
||||
.querySelector('link[rel="shortcut icon"]')
|
||||
@@ -122,6 +123,10 @@ const storeSetup = () => {
|
||||
const getForRecord = () => {
|
||||
return siteConfig.SITE_BEIAN
|
||||
}
|
||||
|
||||
const getTenantEnabled = () => {
|
||||
return siteConfig.TENANT_ENABLED
|
||||
}
|
||||
return {
|
||||
...toRefs(settingConfig),
|
||||
...toRefs(siteConfig),
|
||||
@@ -138,6 +143,7 @@ const storeSetup = () => {
|
||||
getTitle,
|
||||
getCopyright,
|
||||
getForRecord,
|
||||
getTenantEnabled,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,22 +50,22 @@ const storeSetup = () => {
|
||||
}
|
||||
|
||||
// 登录
|
||||
const accountLogin = async (req: AccountLoginReq) => {
|
||||
const res = await accountLoginApi({ ...req, clientId: import.meta.env.VITE_CLIENT_ID, authType: AuthTypeConstants.ACCOUNT })
|
||||
const accountLogin = async (req: AccountLoginReq, tenantCode?: string) => {
|
||||
const res = await accountLoginApi({ ...req, clientId: import.meta.env.VITE_CLIENT_ID, authType: AuthTypeConstants.ACCOUNT }, tenantCode)
|
||||
setToken(res.data.token)
|
||||
token.value = res.data.token
|
||||
}
|
||||
|
||||
// 邮箱登录
|
||||
const emailLogin = async (req: EmailLoginReq) => {
|
||||
const res = await emailLoginApi({ ...req, clientId: import.meta.env.VITE_CLIENT_ID, authType: AuthTypeConstants.EMAIL })
|
||||
const emailLogin = async (req: EmailLoginReq, tenantCode?: string) => {
|
||||
const res = await emailLoginApi({ ...req, clientId: import.meta.env.VITE_CLIENT_ID, authType: AuthTypeConstants.EMAIL }, tenantCode)
|
||||
setToken(res.data.token)
|
||||
token.value = res.data.token
|
||||
}
|
||||
|
||||
// 手机号登录
|
||||
const phoneLogin = async (req: PhoneLoginReq) => {
|
||||
const res = await phoneLoginApi({ ...req, clientId: import.meta.env.VITE_CLIENT_ID, authType: AuthTypeConstants.PHONE })
|
||||
const phoneLogin = async (req: PhoneLoginReq, tenantCode?: string) => {
|
||||
const res = await phoneLoginApi({ ...req, clientId: import.meta.env.VITE_CLIENT_ID, authType: AuthTypeConstants.PHONE }, tenantCode)
|
||||
setToken(res.data.token)
|
||||
token.value = res.data.token
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user