|
@@ -3,30 +3,31 @@ import { parseHrefParam } from "../plugins/utils";
|
|
const MD5 = require("js-md5");
|
|
const MD5 = require("js-md5");
|
|
|
|
|
|
// domain
|
|
// domain
|
|
-let domain;
|
|
|
|
-if (process.env.VUE_APP_SELF_DEFINE_DOMAIN === "true") {
|
|
|
|
- domain = window.localStorage.getItem("domain_in_url");
|
|
|
|
-}
|
|
|
|
-if (!domain) {
|
|
|
|
- const ipFormat = new RegExp(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/);
|
|
|
|
- const hostname = window.location.hostname;
|
|
|
|
- const paramCode = parseHrefParam(window.location.href, "code");
|
|
|
|
|
|
+export function getOrgCode() {
|
|
|
|
+ let domain;
|
|
|
|
+ if (process.env.VUE_APP_SELF_DEFINE_DOMAIN === "true") {
|
|
|
|
+ domain = window.localStorage.getItem("domain_in_url");
|
|
|
|
+ }
|
|
|
|
+ if (!domain) {
|
|
|
|
+ const ipFormat = new RegExp(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/);
|
|
|
|
+ const hostname = window.location.hostname;
|
|
|
|
+ const paramCode = parseHrefParam(window.location.href, "code");
|
|
|
|
|
|
- if (ipFormat.test(hostname) || paramCode) {
|
|
|
|
- domain = paramCode || window.sessionStorage.getItem("ipDomainCode");
|
|
|
|
- if (domain) {
|
|
|
|
- window.sessionStorage.setItem("ipDomainCode", domain);
|
|
|
|
|
|
+ if (ipFormat.test(hostname) || paramCode) {
|
|
|
|
+ domain = paramCode || window.sessionStorage.getItem("ipDomainCode");
|
|
|
|
+ if (domain) {
|
|
|
|
+ window.sessionStorage.setItem("ipDomainCode", domain);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ domain = hostname.split(".")[0];
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- domain = hostname.split(".")[0];
|
|
|
|
}
|
|
}
|
|
|
|
+ console.log(domain);
|
|
|
|
+ return domain;
|
|
}
|
|
}
|
|
-console.log(domain);
|
|
|
|
-export const ORG_CODE = domain;
|
|
|
|
|
|
|
|
const ADMIN_CODE = "admin";
|
|
const ADMIN_CODE = "admin";
|
|
-
|
|
|
|
-export const IS_ADMIN_SYSTEM = ADMIN_CODE === ORG_CODE;
|
|
|
|
|
|
+export const IS_ADMIN_SYSTEM = ADMIN_CODE === getOrgCode();
|
|
|
|
|
|
export const PLATFORM = "WEB";
|
|
export const PLATFORM = "WEB";
|
|
|
|
|