修复租户登录问题

This commit is contained in:
tangweijie 2026-01-21 17:27:51 +08:00
parent 38c8c34839
commit f2764b3961
2 changed files with 11 additions and 0 deletions

View File

@ -69,6 +69,11 @@ service.interceptors.request.use(
config.headers['visit-tenant-id'] = visitTenantId
}
}
// 监狱系统:即使 tenantEnable 为 false也尝试获取并设置租户 ID
const tenantId = getTenantId()
if (tenantId) {
config.headers['tenant-id'] = tenantId
}
const method = config.method?.toUpperCase()
// 防止 GET 请求缓存
if (method === 'GET') {

View File

@ -226,6 +226,12 @@ const getTenantId = async () => {
if (loginData.tenantEnable === 'true') {
const res = await LoginApi.getTenantIdByName(loginData.loginForm.tenantName)
authUtil.setTenantId(res)
} else {
// 使ID
const tenantName = loginData.loginForm.tenantName
if (tenantName) {
authUtil.setTenantId(Number(tenantName))
}
}
}
//