baseUrl 调整

This commit is contained in:
joylink_fanyuhong 2021-12-30 09:34:50 +08:00
parent 3c2563e3d1
commit 5816fbf205
41 changed files with 130 additions and 91 deletions

View File

@ -5,10 +5,10 @@ NODE_ENV = 'development'
# base api # base api
# VUE_APP_BASE_API = 'https://joylink.club/jlcloud' # VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
# VUE_APP_BASE_API = 'http://192.168.3.4:9000' # VUE_APP_BASE_API = 'http://192.168.3.4:9000'
VUE_APP_BASE_API = 'http://192.168.3.6:9000' # VUE_APP_BASE_API = 'http://192.168.3.6:9000'
VUE_APP_VOICE_API = 'http://119.3.163.89/oss/joylink' # VUE_APP_VOICE_API = 'http://119.3.163.89/oss/joylink'
VUE_APP_UPLOAD_API = 'http://joylink.club/jlfile' # VUE_APP_UPLOAD_API = 'http://joylink.club/jlfile'
VUE_APP_BASE_SITE='https://test.joylink.club/cbtc' # VUE_APP_BASE_SITE='https://test.joylink.club/cbtc'
# VUE_APP_VOICE_API = 'http://192.168.8.110:9008' # VUE_APP_VOICE_API = 'http://192.168.8.110:9008'

View File

@ -3,7 +3,7 @@ NODE_ENV = 'production'
VUE_APP_PRO = 'local' VUE_APP_PRO = 'local'
# base api # base api
VUE_APP_BASE_API = 'http://160.20.60.15:9000' # VUE_APP_BASE_API = 'http://160.20.60.15:9000'
VUE_APP_VOICE_API = 'http://160.20.60.15/oss/joylink' # VUE_APP_VOICE_API = 'http://160.20.60.15/oss/joylink'
VUE_APP_UPLOAD_API = 'http://160.20.60.15' # VUE_APP_UPLOAD_API = 'http://160.20.60.15'
VUE_APP_BASE_SITE='http://160.20.60.15' # VUE_APP_BASE_SITE='http://160.20.60.15'

View File

@ -3,7 +3,7 @@ NODE_ENV = 'production'
VUE_APP_PRO = 'ntyl' VUE_APP_PRO = 'ntyl'
# base api # base api
VUE_APP_BASE_API = 'https://joylink.club/jlcloud' # VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink' # VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink'
VUE_APP_UPLOAD_API = 'https://upload.joylink.club' # VUE_APP_UPLOAD_API = 'https://upload.joylink.club'
VUE_APP_BASE_SITE='https://joylink.club/cbtc' # VUE_APP_BASE_SITE='https://joylink.club/cbtc'

View File

@ -2,7 +2,7 @@
NODE_ENV = 'production' NODE_ENV = 'production'
# base api # base api
VUE_APP_BASE_API = 'https://api.joylink.club/jlcloud' # VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink' # VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink'
VUE_APP_UPLOAD_API = 'https://upload.joylink.club' # VUE_APP_UPLOAD_API = 'https://upload.joylink.club'
VUE_APP_BASE_SITE='https://joylink.club/cbtc' # VUE_APP_BASE_SITE='https://joylink.club/cbtc'

View File

@ -2,7 +2,7 @@
NODE_ENV = 'test' NODE_ENV = 'test'
# base api # base api
VUE_APP_BASE_API = 'https://test.joylink.club/jlcloud' # VUE_APP_BASE_API = 'https://test.joylink.club/jlcloud'
VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink' # VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink'
VUE_APP_UPLOAD_API = 'https://upload.joylink.club' # VUE_APP_UPLOAD_API = 'https://upload.joylink.club'
VUE_APP_BASE_SITE='https://test.joylink.club/cbtc' # VUE_APP_BASE_SITE='https://test.joylink.club/cbtc'

View File

@ -1,9 +1,9 @@
import request from '@/utils/request'; import request from '@/utils/request';
import store from '@/store/index';
const publicPath = process.env.VUE_APP_PRO == 'local' ? '' : '/cbtc'; const publicPath = process.env.VUE_APP_PRO == 'local' ? '' : '/cbtc';
export const JL3D_LOCAL_STATIC = publicPath+"/static"; export const JL3D_LOCAL_STATIC = publicPath+"/static";
const BASE_UPLOAD_API = process.env.VUE_APP_UPLOAD_API; const BASE_UPLOAD_API = store.state.user.uploadUrl;
export const BASE_ASSET_API = this.$store.user.state.resourcesUrl; export const BASE_ASSET_API = this.$store.user.state.resourcesUrl;
// console.log(JL3D_LOCAL_STATIC); // console.log(JL3D_LOCAL_STATIC);
// console.log(BASE_UPLOAD_API); // console.log(BASE_UPLOAD_API);

View File

@ -10,7 +10,7 @@ export const meansUrl = `/api/upload/MEANS?appId=${productIdentify}`;
// export const regulationUrl = `/api/upload/regulation?appId=${productIdentify}`; // export const regulationUrl = `/api/upload/regulation?appId=${productIdentify}`;
export function getUrl(relatedUrl) { export function getUrl(relatedUrl) {
return `${process.env.VUE_APP_UPLOAD_API}${relatedUrl}`; return `${this.$store.state.user.uploadUrl}${relatedUrl}`;
} }
export function uploadFile(url, data) { export function uploadFile(url, data) {

View File

@ -75,7 +75,7 @@ export default {
loading: true, loading: true,
name: 'file', name: 'file',
size: 3, size: 3,
action: `${process.env.VUE_APP_UPLOAD_API}/api/upload/PICTURE?appId=00001&appSecret=joylink00001`, action: `${this.$store.state.user.uploadUrl}/api/upload/PICTURE?appId=00001&appSecret=joylink00001`,
response: (res) => { response: (res) => {
return `${this.$store.user.state.resourcesUrl}${res.data}`; return `${this.$store.user.state.resourcesUrl}${res.data}`;
}, },

View File

@ -1,6 +1,5 @@
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import store from '@/store/index';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
// 定于仿真socket接口 // 定于仿真socket接口
@ -43,7 +42,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
let header = {'X-Token': getToken() }; let header = {'X-Token': getToken() };
let connectmsg = { let connectmsg = {
type:'init', type:'init',
baseurl:getBaseUrl(), baseurl:store.state.user.baseUrl,
topic:this.topic, topic:this.topic,
token:getToken(), token:getToken(),
}; };

View File

@ -20,9 +20,9 @@ import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import { getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata'; import { getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { sendCommandNew } from '@/api/jmap/training'; import { sendCommandNew } from '@/api/jmap/training';
import store from '@/store/index';
var clock = new THREE.Clock(); var clock = new THREE.Clock();
@ -176,7 +176,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
let connectmsg = { let connectmsg = {
type:'init', type:'init',
baseurl:getBaseUrl(), baseurl:store.state.user.baseUrl,
topic:'/user/queue/simulation/jl3d/'+group, topic:'/user/queue/simulation/jl3d/'+group,
token:getToken(), token:getToken(),
}; };

View File

@ -15,7 +15,7 @@ import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import { getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata'; import { getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl' import store from '@/store/index';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { sendCommandNew } from '@/api/jmap/training'; import { sendCommandNew } from '@/api/jmap/training';
@ -174,7 +174,7 @@ export function Jl3dOtherVR(dom,group,skinCode) {
let connectmsg = { let connectmsg = {
type:'init', type:'init',
baseurl:getBaseUrl(), baseurl:store.state.user.baseUrl,
topic:'/user/queue/simulation/jl3d/'+group, topic:'/user/queue/simulation/jl3d/'+group,
token:getToken(), token:getToken(),
}; };

View File

@ -10,9 +10,9 @@ import { ModelManagerVR } from '@/jlmap3d/jl3dmaintainer/jl3dTrainRescue/trainre
import { VRButton } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/VRButton.js'; import { VRButton } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/VRButton.js';
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { sendCommandNew } from '@/api/jmap/training'; import { sendCommandNew } from '@/api/jmap/training';
import store from '@/store/index';
var clock = new THREE.Clock(); var clock = new THREE.Clock();
@ -170,7 +170,7 @@ export function Jl3dTrainRescueVr(dom,group,skinCode) {
let connectmsg = { let connectmsg = {
type:'init', type:'init',
baseurl:getBaseUrl(), baseurl:store.state.user.baseUrl,
topic:'/user/queue/simulation/jl3d/'+group, topic:'/user/queue/simulation/jl3d/'+group,
token:getToken(), token:getToken(),
}; };

View File

@ -2,8 +2,8 @@ import StompClient from '@/utils/sock';
// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation'; // import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp'; // import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import store from '@/store/index';
// 定于仿真socket接口 // 定于仿真socket接口
export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) { export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
@ -45,7 +45,7 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
let header = {'X-Token': getToken() }; let header = {'X-Token': getToken() };
let connectmsg = { let connectmsg = {
type:'init', type:'init',
baseurl:getBaseUrl(), baseurl:store.state.user.baseUrl,
topic:this.topic, topic:this.topic,
token:getToken(), token:getToken(),
}; };

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import store from '@/store/index'; import store from '@/store/index';

View File

@ -1,8 +1,8 @@
import { AssetModel } from '@/jlmap3d/main/loaders/model/Assetmodel'; import { AssetModel } from '@/jlmap3d/main/loaders/model/Assetmodel';
import { Assetmaterial } from '@/jlmap3d/main/loaders/model/Assetmaterial'; import { Assetmaterial } from '@/jlmap3d/main/loaders/model/Assetmaterial';
import { getBaseUrl } from '@/utils/baseUrl'; import store from '@/store/index';
import { Loading } from 'element-ui'; import { Loading } from 'element-ui';
const BASE_API = getBaseUrl(); const BASE_API = store.state.user.baseUrl;
import { JL3D_LOCAL_STATIC,BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js'; import { JL3D_LOCAL_STATIC,BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
let signal5 = { let signal5 = {

View File

@ -1,6 +1,6 @@
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl' import store from '@/store/index';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
// 定于仿真socket接口 // 定于仿真socket接口
@ -45,7 +45,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
let header = {'X-Token': getToken() }; let header = {'X-Token': getToken() };
let connectmsg = { let connectmsg = {
type:'init', type:'init',
baseurl:getBaseUrl(), baseurl:store.state.user.baseUrl,
topic:this.topic, topic:this.topic,
token:getToken(), token:getToken(),
}; };

View File

@ -2,7 +2,7 @@ import StompClient from '@/utils/sock';
// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation'; // import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp'; // import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
import { getBaseUrl } from '@/utils/baseUrl' import store from '@/store/index';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
// 定于仿真socket接口 // 定于仿真socket接口
@ -46,7 +46,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let header = {'X-Token': getToken() }; let header = {'X-Token': getToken() };
let connectmsg = { let connectmsg = {
type:'init', type:'init',
baseurl:getBaseUrl(), baseurl:store.state.user.baseUrl,
topic:this.topic, topic:this.topic,
token:getToken(), token:getToken(),
}; };

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import store from '@/store/index'; import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import store from '@/store/index'; import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import store from '@/store/index'; import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import store from '@/store/index'; import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import store from '@/store/index'; import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import store from '@/store/index'; import store from '@/store/index';

View File

@ -1,6 +1,5 @@
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import store from '@/store/index'; import store from '@/store/index';

View File

@ -4,13 +4,9 @@ import {
import { import {
Assetmaterial Assetmaterial
} from '@/jlmap3d/main/loaders/model/Assetmaterial'; } from '@/jlmap3d/main/loaders/model/Assetmaterial';
import {
getBaseUrl
} from '@/utils/baseUrl';
import { import {
Loading Loading
} from 'element-ui'; } from 'element-ui';
const BASE_API = getBaseUrl();
import { import {
JL3D_LOCAL_STATIC, JL3D_LOCAL_STATIC,
BASE_ASSET_API BASE_ASSET_API

View File

@ -142,7 +142,7 @@ export default {
// } else { // } else {
// href = 'https://joylink.club/docs'; // href = 'https://joylink.club/docs';
// } // }
href = process.env.VUE_APP_BASE_SITE + '/docs/'; href = this.$store.state.user.baseSite + '/docs/';
window.open(href, '_blank'); window.open(href, '_blank');
}, },
goEmpty() {}, goEmpty() {},

View File

@ -7,7 +7,7 @@ import 'nprogress/nprogress.css';
import { setToken, getToken, removeToken, getSessionStorage } from '@/utils/auth'; import { setToken, getToken, removeToken, getSessionStorage } from '@/utils/auth';
import { getBaseUrlByProject } from '@/api/projectServer'; import { getBaseUrlByProject } from '@/api/projectServer';
import localStore from 'storejs'; import localStore from 'storejs';
import { getBaseUrl } from '@/utils/baseUrl'; import { handlerUrl } from '@/utils/baseUrl';
const whiteList = ['/login', '/design/login', '/gzzbxy/relay', '/authorization', '/AUSline', '/AUStool', '/demo', '/thirdLogin']; // 不重定向白名单 const whiteList = ['/login', '/design/login', '/gzzbxy/relay', '/authorization', '/AUSline', '/AUStool', '/demo', '/thirdLogin']; // 不重定向白名单
@ -90,16 +90,13 @@ router.beforeEach( async (to, from, next) => {
if (!store.state.user.baseUrl && project && loginInfo[project]) { if (!store.state.user.baseUrl && project && loginInfo[project]) {
try { try {
const resp = await getBaseUrlByProject(ProjectCode[project]); const resp = await getBaseUrlByProject(ProjectCode[project]);
if (resp && resp.data && resp.data.domainName) { const urlData = handlerUrl(resp.data);
store.dispatch('setBaseUrl', resp.data.domainName); store.dispatch('setBaseUrl', urlData.BASE_API);
} else { store.dispatch('setResourcesUrl', urlData.VOICE_API);
store.dispatch('setBaseUrl', getBaseUrl()); store.dispatch('setUploadUrl', urlData.UPLOAD_API);
} store.dispatch('setBaseSite', urlData.BASE_SITE);
if (resp && resp.data && resp.data.resourcesDomainName) {
store.dispatch('setResourcesUrl', resp.data.resourcesDomainName);
}
} catch (e) { } catch (e) {
store.dispatch('setBaseUrl', getBaseUrl()); console.error(e);
} }
} }
document.title = loginInfo[project || 'login'] ? loginInfo[project || 'login'].browserTitle || loginInfo[project || 'login'].title : ''; document.title = loginInfo[project || 'login'] ? loginInfo[project || 'login'].browserTitle || loginInfo[project || 'login'].title : '';

View File

@ -22,7 +22,9 @@ const user = {
companyName: '', companyName: '',
companyProjectList: [], companyProjectList: [],
baseUrl:'', baseUrl:'',
resourcesUrl: process.env.VUE_APP_VOICE_API resourcesUrl: '',
uploadUrl: '',
baseSite: ''
}, },
mutations: { mutations: {
@ -85,6 +87,12 @@ const user = {
}, },
setResourcesUrl: (state, resourcesUrl) => { setResourcesUrl: (state, resourcesUrl) => {
state.resourcesUrl = resourcesUrl; state.resourcesUrl = resourcesUrl;
},
setUploadUrl: (state, uploadUrl) => {
state.uploadUrl = uploadUrl;
},
setBaseSite: (state, baseSite) => {
state.baseSite = baseSite;
} }
}, },
@ -220,6 +228,12 @@ const user = {
setResourcesUrl({commit}, resourcesUrl) { setResourcesUrl({commit}, resourcesUrl) {
commit('setResourcesUrl', resourcesUrl); commit('setResourcesUrl', resourcesUrl);
}, },
setUploadUrl({commit}, uploadUrl) {
commit('setUploadUrl', uploadUrl);
},
setBaseSite({commit}, baseSite) {
commit('setBaseSite', baseSite);
},
setToken({commit}, token) { setToken({commit}, token) {
commit('SET_TOKEN', token); commit('SET_TOKEN', token);
} }

View File

@ -1,6 +1,29 @@
export function getBaseUrl() { import store from '@/store/index';
// export function getBaseUrl() {
// let BASE_API;
// if (process.env.NODE_ENV === 'development') {
// // BASE_API = 'https://joylink.club/jlcloud';
// // BASE_API = 'https://test.joylink.club/jlcloud';
// // BASE_API = 'http://114.116.51.125/jlcloud';
// // BASE_API = 'http://192.168.8.152:9000'; // 袁琪
// // BASE_API = 'http://192.168.8.172:9200'; // 旭强
// // BASE_API = 'http://192.168.8.109:9000'; // 张赛
// // BASE_API = 'http://192.168.8.140:9000'; // 杜康
// // BASE_API = 'http://b29z135112.zicp.vip';
// // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
// } else {
// BASE_API = process.env.VUE_APP_BASE_API;
// }
// return BASE_API;
// }
export function handlerUrl(data) {
let BASE_API; let BASE_API;
let VOICE_API;
let UPLOAD_API;
let BASE_SITE;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// const data = null;
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://114.116.51.125/jlcloud'; // BASE_API = 'http://114.116.51.125/jlcloud';
@ -11,8 +34,34 @@ export function getBaseUrl() {
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
} else { BASE_API = data && data.domainName ? data.domainName : BASE_API;
BASE_API = process.env.VUE_APP_BASE_API; VOICE_API = data && data.resourcesDomainName ? data.resourcesDomainName : 'https://joylink.club/oss/joylink';
UPLOAD_API = 'http://joylink.club/jlfile';
BASE_SITE = 'https://test.joylink.club/cbtc';
} else if (process.env.NODE_ENV === 'test') {
BASE_API = data && data.domainName ? data.domainName : 'https://test.joylink.club/jlcloud';
VOICE_API = data && data.resourcesDomainName ? data.resourcesDomainName : 'https://joylink.club/oss/joylink';
UPLOAD_API = 'http://joylink.club/jlfile';
BASE_SITE = 'https://test.joylink.club/cbtc';
} else if (process.env.NODE_ENV === 'production' && process.env.VUE_APP_PRO === 'local') {
BASE_API = 'http://160.20.60.15:9000';
VOICE_API = 'http://160.20.60.15/oss/joylink';
UPLOAD_API = 'http://160.20.60.15';
BASE_SITE = 'http://160.20.60.15';
} else if (process.env.NODE_ENV === 'production' && process.env.VUE_APP_PRO === 'ntyl') {
BASE_API = 'https://joylink.club/jlcloud';
VOICE_API = 'https://joylink.club/oss/joylink';
UPLOAD_API = 'http://joylink.club/jlfile';
BASE_SITE = 'https://joylink.club/cbtc';
} else if (process.env.NODE_ENV === 'production') {
BASE_API = data && data.domainName ? data.domainName : 'https://joylink.club/jlcloud';
// store.dispatch('setBaseUrl', data && data.domainName ? data.domainName : BASE_API);
VOICE_API = data && data.resourcesDomainName ? data.resourcesDomainName : 'https://joylink.club/oss/joylink';
// store.dispatch('setResourcesUrl', data && data.resourcesDomainName ? data.resourcesDomainName : VOICE_API);
UPLOAD_API = 'http://joylink.club/jlfile';
// store.dispatch('setUploadUrl', UPLOAD_API);
BASE_SITE = 'https://joylink.club/cbtc';
// store.dispatch('setBaseSite', BASE_SITE);
} }
return BASE_API; return {BASE_API, VOICE_API, UPLOAD_API, BASE_SITE};
} }

View File

@ -1,9 +1,9 @@
import Vue from 'vue'; import Vue from 'vue';
import { getBaseUrl } from '@/utils/baseUrl'; import store from '@/store/index';
// 创建或者打开数据库 // 创建或者打开数据库
export function openIndexedDB() { export function openIndexedDB() {
const baseUrl = getBaseUrl(); const baseUrl = store.state.user.baseUrl;
const indexedDBName = baseUrl.replace(/http.?:\/\/(.*)[\/|:].*/, '$1'); const indexedDBName = baseUrl.replace(/http.?:\/\/(.*)[\/|:].*/, '$1');
const request = window.indexedDB.open(indexedDBName, 1); const request = window.indexedDB.open(indexedDBName, 1);
request.onerror = function (event) { request.onerror = function (event) {

View File

@ -4,17 +4,17 @@ import qs from 'qs';
import { i18n } from '@/main.js'; import { i18n } from '@/main.js';
import { MessageBox } from 'element-ui'; import { MessageBox } from 'element-ui';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { getBaseUrl } from '@/utils/baseUrl'; import { handlerUrl } from '@/utils/baseUrl';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
import Vue from 'vue'; import Vue from 'vue';
import router from '../router/index'; import router from '../router/index';
const BASE_API = getBaseUrl(); const urlData = handlerUrl();
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
baseURL: BASE_API, // api的base_url baseURL: urlData.BASE_API, // api的base_url
withCredentials: true, // 跨域请求时是否需要使用凭证 withCredentials: true, // 跨域请求时是否需要使用凭证
timeout: 600000 // 请求超时时间 timeout: 600000 // 请求超时时间
}); });

View File

@ -1,16 +1,15 @@
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { checkLoginLine } from '@/api/login'; import { checkLoginLine } from '@/api/login';
import { getBaseUrl } from '@/utils/baseUrl';
import { MessageBox } from 'element-ui'; import { MessageBox } from 'element-ui';
import store from '@/store/index'; import store from '@/store/index';
import Stomp from 'stompjs'; import Stomp from 'stompjs';
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isTest = process.env.NODE_ENV === 'test'; const isTest = process.env.NODE_ENV === 'test';
const websocketUrl = `${getBaseUrl()}/joylink-websocket?token=`;
const reconnectInterval = [1000, 3000, 5000, 10000, 30000, 60000]; const reconnectInterval = [1000, 3000, 5000, 10000, 30000, 60000];
var StompClient = function (headers) { var StompClient = function (headers) {
const websocketUrl = `${store.state.user.baseUrl}/joylink-websocket?token=`;
this.url = websocketUrl + getToken(); this.url = websocketUrl + getToken();
this.headers = headers || {}; this.headers = headers || {};
this.subscribeMap = new Map(); // 已订阅,对象{dest:'', handler:function, sub: Object} this.subscribeMap = new Map(); // 已订阅,对象{dest:'', handler:function, sub: Object}

View File

@ -26,7 +26,7 @@ export default {
}, // }, //
computed: { computed: {
action() { action() {
return `${process.env.VUE_APP_UPLOAD_API}${pictureUrl}`; return `${this.$store.state.user.uploadUrl}${pictureUrl}`;
}, },
draft() { draft() {
return this.$route.query.draft; return this.$route.query.draft;

View File

@ -57,7 +57,7 @@ export default {
}, },
computed: { computed: {
action() { action() {
return `${process.env.VUE_APP_UPLOAD_API}${meansUrl}`; return `${this.$store.state.user.uploadUrl}${meansUrl}`;
}, },
form() { form() {
const form = { const form = {

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js'); // importScripts('sockjs.js');
// import { getToken } from '@/utils/auth'; // import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client'; // import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token='; // const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js'); // importScripts('sockjs.js');
// import { getToken } from '@/utils/auth'; // import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client'; // import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token='; // const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js'); // importScripts('sockjs.js');
// import { getToken } from '@/utils/auth'; // import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client'; // import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token='; // const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js'); // importScripts('sockjs.js');
// import { getToken } from '@/utils/auth'; // import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client'; // import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token='; // const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js'); // importScripts('sockjs.js');
// import { getToken } from '@/utils/auth'; // import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client'; // import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token='; // const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js'); // importScripts('sockjs.js');
// import { getToken } from '@/utils/auth'; // import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client'; // import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token='; // const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js'); // importScripts('sockjs.js');
// import { getToken } from '@/utils/auth'; // import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client'; // import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token='; // const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';