feat: 使用租户域名,获得租户信息
parent
3a2f5cc77f
commit
ca8dc1ab48
|
@ -23,6 +23,11 @@ export function getTenantIdByName(name: string) {
|
||||||
return defHttp.get<TentantNameVO>({ url: Api.GetTenantIdByName + name })
|
return defHttp.get<TentantNameVO>({ url: Api.GetTenantIdByName + name })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 使用租户域名,获得租户信息
|
||||||
|
export function getTenantByWebsite(website: string) {
|
||||||
|
return defHttp.get({ url: `/system/tenant/get-by-website?website=${website}` })
|
||||||
|
}
|
||||||
|
|
||||||
// 登出
|
// 登出
|
||||||
export function loginOut() {
|
export function loginOut() {
|
||||||
return defHttp.delete({ url: Api.LoginOut })
|
return defHttp.delete({ url: Api.LoginOut })
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { useDesign } from '@/hooks/web/useDesign'
|
||||||
import * as authUtil from '@/utils/auth'
|
import * as authUtil from '@/utils/auth'
|
||||||
|
|
||||||
import { Verify } from '@/components/Verifition'
|
import { Verify } from '@/components/Verifition'
|
||||||
import { getTenantIdByName } from '@/api/base/login'
|
import { getTenantByWebsite, getTenantIdByName } from '@/api/base/login'
|
||||||
|
|
||||||
const FormItem = Form.Item
|
const FormItem = Form.Item
|
||||||
const InputPassword = Input.Password
|
const InputPassword = Input.Password
|
||||||
|
@ -67,11 +67,19 @@ async function getCode() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取租户ID
|
// 根据域名,获得租户信息 && 获取租户ID
|
||||||
async function getTenantId() {
|
async function getTenantId() {
|
||||||
if (tenantEnable === 'true') {
|
if (tenantEnable === 'true') {
|
||||||
const res = await getTenantIdByName(formData.tenantName)
|
const website = location.host
|
||||||
authUtil.setTenantId(res)
|
const tenant = await getTenantByWebsite(website)
|
||||||
|
if (tenant) {
|
||||||
|
formData.tenantName = tenant.name
|
||||||
|
authUtil.setTenantId(tenant.id)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const res = await getTenantIdByName(formData.tenantName)
|
||||||
|
authUtil.setTenantId(res)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue