Commit 2b4a467d authored by 朱国瑞's avatar 朱国瑞

动态获取域名

parent f843f995
...@@ -194,9 +194,10 @@ export default { ...@@ -194,9 +194,10 @@ export default {
config: { config: {
apiKey: "DLAB-customername-12345687", apiKey: "DLAB-customername-12345687",
region: "apac", region: "apac",
completeUrl: "https://bfai-service-apac-uat.d-lab-services.danone.com/demo/#/complete", host: "https://bfai-service-apac-uat.d-lab-services.danone.com",
incompleteUrl: "https://bfai-service-apac-uat.d-lab-services.danone.com/demo/#/", completeUrl: "/demo/#/complete",
sdkUrl: "https://bfai-service-apac-uat.d-lab-services.danone.com/sdk/#/" incompleteUrl: "/demo/#/",
sdkUrl: "/sdk/#/"
}, },
usagetrackingkey: "", usagetrackingkey: "",
}; };
...@@ -918,6 +919,10 @@ export default { ...@@ -918,6 +919,10 @@ export default {
let apiKey = this.config.apiKey; let apiKey = this.config.apiKey;
let env = import.meta.env.VITE_TRACKING_ENV; let env = import.meta.env.VITE_TRACKING_ENV;
console.log(env); console.log(env);
let host = this.config.host;
let currentDomain = window.location.origin;
host = currentDomain;
// 获取当前域名
let aiParams = { let aiParams = {
env: env, env: env,
apiKey: this.usagetrackingkey ? this.usagetrackingkey : apiKey, apiKey: this.usagetrackingkey ? this.usagetrackingkey : apiKey,
...@@ -925,8 +930,8 @@ export default { ...@@ -925,8 +930,8 @@ export default {
}; };
localStorage.setItem("aiParams", JSON.stringify(aiParams)); localStorage.setItem("aiParams", JSON.stringify(aiParams));
let openDev = this.$route.query.openDev; let openDev = this.$route.query.openDev;
let completeUrl = this.config.completeUrl; let completeUrl = `${host}${this.config.completeUrl}`;
let incompleteUrl = this.config.incompleteUrl; let incompleteUrl = `${host}${this.config.incompleteUrl}`;
if (this.usagetrackingkey) { if (this.usagetrackingkey) {
completeUrl = completeUrl =
completeUrl + "?usagetrackingkey=" + this.usagetrackingkey; completeUrl + "?usagetrackingkey=" + this.usagetrackingkey;
...@@ -935,7 +940,7 @@ export default { ...@@ -935,7 +940,7 @@ export default {
localStorage.setItem("completeUrl", completeUrl); localStorage.setItem("completeUrl", completeUrl);
localStorage.setItem("incompleteUrl", incompleteUrl); localStorage.setItem("incompleteUrl", incompleteUrl);
let url = let url =
this.config.sdkUrl + "?lying=" + `${host}${this.config.sdkUrl}` + "?lying=" +
this.lying; this.lying;
if (openDev) { if (openDev) {
url = url + "&openDev=true"; url = url + "&openDev=true";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment