登录页

This commit is contained in:
2025-01-08 17:19:39 +08:00
parent a140df1d13
commit fc5f51495a
5 changed files with 21 additions and 22 deletions
+5
View File
@@ -30,6 +30,11 @@ export function getOriginDomain(): string {
* @return 10140
*/
export function getDomainPart1(): any {
const host = window.location.host;
console.log(host);
if (host === 'admin.gxtyzx.cn') {
return 10150;
}
const split = getHost();
if (split[0] == '127') {
return undefined;
+11 -11
View File
@@ -10,8 +10,8 @@ import { API_BASE_URL, TOKEN_HEADER_NAME, LAYOUT_PATH } from '@/config/setting';
import { getToken, setToken } from './token-util';
import { logout } from './page-tab-util';
import type { ApiResult } from '@/api';
import { getHostname, getTenantId } from '@/utils/domain';
import { getMerchantId } from "@/utils/merchant";
import { getHostname } from '@/utils/domain';
import { getMerchantId } from '@/utils/merchant';
const service = axios.create({
baseURL: API_BASE_URL
@@ -22,7 +22,6 @@ const service = axios.create({
*/
service.interceptors.request.use(
(config) => {
const TENANT_ID = localStorage.getItem('TenantId');
const token = getToken();
// 添加 token 到 header
if (token && config.headers) {
@@ -43,15 +42,16 @@ service.interceptors.request.use(
if (getHostname()) {
config.headers.common['Domain'] = getHostname();
}
config.headers.common['TenantId'] = 10150;
// 解析二级域名获取租户ID
if (getTenantId()) {
config.headers.common['TenantId'] = getTenantId();
return config;
}
if (TENANT_ID) {
config.headers.common['TenantId'] = TENANT_ID;
return config;
}
// if (getTenantId()) {
// config.headers.common['TenantId'] = getTenantId();
// return config;
// }
// if (TENANT_ID) {
// config.headers.common['TenantId'] = TENANT_ID;
// return config;
// }
}
return config;
},