初始化
This commit is contained in:
9
frontend/public/config/index-development.js
Normal file
9
frontend/public/config/index-development.js
Normal file
@@ -0,0 +1,9 @@
|
||||
window.ENV = 'development'
|
||||
var developmentConfig = {
|
||||
baseURL: 'http://gcpaas.gccloud.com/bigScreenServer',
|
||||
fileUrlPrefix: 'http://gcpaas.gccloud.com/bigScreenServer' + '/static'
|
||||
}
|
||||
// 必须的
|
||||
window.CONFIG={}
|
||||
window.CONFIG = configDeepMerge(window.CONFIG, developmentConfig)
|
||||
|
||||
8
frontend/public/config/index-production.js
Normal file
8
frontend/public/config/index-production.js
Normal file
@@ -0,0 +1,8 @@
|
||||
window.ENV = 'production'
|
||||
var productionConfig = {
|
||||
baseURL: 'http://gcpaas.gccloud.com/bigScreenServer',
|
||||
fileUrlPrefix: 'http://gcpaas.gccloud.com/bigScreenServer' + '/static'
|
||||
}
|
||||
// 必须的
|
||||
window.CONFIG = {}
|
||||
window.CONFIG = configDeepMerge(window.CONFIG , productionConfig)
|
||||
32
frontend/public/config/starter.js
Normal file
32
frontend/public/config/starter.js
Normal file
@@ -0,0 +1,32 @@
|
||||
(function(window) {
|
||||
window.SITE_CONFIG = {
|
||||
demoEnv:false
|
||||
}
|
||||
})(window);
|
||||
|
||||
/**
|
||||
* 对象属性合并,与 Object.assign 语法不同
|
||||
* @param target
|
||||
* @param source
|
||||
* @returns {{}}
|
||||
*/
|
||||
function configDeepMerge(target, source) {
|
||||
var merged = {};
|
||||
for (var each in source) {
|
||||
if (target.hasOwnProperty(each) && source.hasOwnProperty(each)) {
|
||||
if (typeof target[each] == "object" && typeof source[each] == "object") {
|
||||
merged[each] = configDeepMerge(target[each], source[each]);
|
||||
} else {
|
||||
merged[each] = source[each];
|
||||
}
|
||||
} else if (source.hasOwnProperty(each)) {
|
||||
merged[each] = source[each];
|
||||
}
|
||||
}
|
||||
for (var each in target) {
|
||||
if (!(each in source) && target.hasOwnProperty(each)) {
|
||||
merged[each] = target[each];
|
||||
}
|
||||
}
|
||||
return merged;
|
||||
}
|
||||
Reference in New Issue
Block a user