mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-25 14:17:54 +08:00
页面测试通过哦
This commit is contained in:
parent
a93ec1d72c
commit
9aa2769032
16
app.js
16
app.js
@ -16,7 +16,6 @@ app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('view engine', 'jade');
|
||||
|
||||
app.use(logger('dev'));
|
||||
<<<<<<< HEAD
|
||||
// 反向代理(这里把需要进行反代的路径配置到这里即可)
|
||||
let opts = {
|
||||
preserveHostHdr: true,
|
||||
@ -25,25 +24,14 @@ let opts = {
|
||||
proxyReqPathResolver: function(req, res) {
|
||||
//这个代理会把匹配到的url(下面的 ‘/api’等)去掉,转发过去直接404,这里手动加回来,
|
||||
req.url = req.baseUrl+req.url;
|
||||
console.log(1,req)
|
||||
console.log(1,req,res)
|
||||
return require('url').parse(req.url).path;
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
app.use('/callComponent',proxy('http://192.168.0.104:8012',opts));
|
||||
app.use('/callComponent',proxy('http://8761wuxu2.nps.winqi.cn',opts));
|
||||
//app.listen(3000);
|
||||
=======
|
||||
|
||||
let option = createProxyMiddleware({
|
||||
target: 'http://hc.demo.winqi.cn:8012', // 目标代理地址
|
||||
changeOrigin: true,
|
||||
logLevel: "debug"
|
||||
});
|
||||
|
||||
app.use('/callComponent', option);
|
||||
|
||||
>>>>>>> 6c49b26acff4f813442e3b8b60bfae6077971f7a
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: false }));
|
||||
app.use(cookieParser());
|
||||
|
||||
@ -8,14 +8,19 @@
|
||||
breadCrumbs:[]
|
||||
},
|
||||
mounted:function(){
|
||||
this._freshBreadCrumbByUrl();
|
||||
//this._freshBreadCrumbByUrl();
|
||||
// 监听事件
|
||||
document.addEventListener('initVcFrameworkFinish', function (e) {
|
||||
// e.target matches elem
|
||||
vm.breadCrumbs = [];
|
||||
vm._freshBreadCrumbByUrl();
|
||||
}, false);
|
||||
},
|
||||
methods:{
|
||||
_freshBreadCrumbByUrl:function(){
|
||||
|
||||
var _tmpMenus = vc.getMenus();
|
||||
var _url = vc.getUrl();
|
||||
|
||||
var _url = vc.getUrl()+location.hash;
|
||||
/**
|
||||
正常情况下是走不到这里的,
|
||||
因为系统登录时,就已经加载菜单信息缓存到本地了
|
||||
|
||||
@ -20,9 +20,9 @@
|
||||
<span v-if="menu.label == undefined || menu.label == ''" class="fa arrow"></span>
|
||||
</a>
|
||||
<ul v-if="menu.childs != undefined && menu.childs.length >0" class="nav nav-second-level collapse" v-bind:class="{in: menu.active}">
|
||||
<li v-for="subMenu in menu.childs" v-if="subMenu.isShow == 'Y'"><a v-bind:href="subMenu.href">{{subMenu.name}}</a></li>
|
||||
<li v-for="subMenu in menu.childs" v-if="subMenu.isShow == 'Y'"><a v-on:click="_gotoPage(subMenu.href)" href="javascript:void(0)">{{subMenu.name}}</a></li>
|
||||
</ul>
|
||||
<a v-if="menu.childs == undefined || menu.childs.length ==0" v-bind:href="menu.href">
|
||||
<a v-if="menu.childs == undefined || menu.childs.length ==0" href="javascript:void(0)" v-on:click="_gotoPage(menu.href)">
|
||||
<i class="fa " v-bind:class="menu.icon"></i>
|
||||
<span class="nav-label">{{menu.name}}</span>
|
||||
</a>
|
||||
|
||||
@ -106,6 +106,9 @@
|
||||
|
||||
$("body").toggleClass("mini-navbar");
|
||||
vc.setMenuState('OFF');
|
||||
},
|
||||
_gotoPage:function(_href){
|
||||
vc.jumpToPage(_href);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -176,7 +176,7 @@
|
||||
let vcComponentChilds = _vcComponent.childNodes;
|
||||
for (var vcIndex = vcComponentChilds.length - 1; vcIndex >= 0; vcIndex--) {
|
||||
_vcComponent.removeChild(vcComponentChilds[vcIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
_componentUrl = _componentUrl.substring(_componentUrl.lastIndexOf('/') + 1, _componentUrl.length);
|
||||
|
||||
@ -336,7 +336,9 @@
|
||||
var _cacheComponent = vcFramework.getComponent(_componentName);
|
||||
//console.log('加载组件名称', _componentName);
|
||||
if (vcFramework.isNotNull(_cacheComponent)) {
|
||||
return _cacheComponent;
|
||||
_tree.setHtml(_cacheComponent.vcDiv);
|
||||
_tree.setJs(_cacheComponent.js);
|
||||
return _cacheComponent.vcDiv;
|
||||
}
|
||||
|
||||
var filePath = '/components/' + _componentName + '/' + _componentName;
|
||||
@ -370,7 +372,12 @@
|
||||
vcDiv.setAttributeNode(_divComponentAttr);
|
||||
vcDiv.appendChild(htmlComponentDoc);
|
||||
//vcDiv.appendChild(jsComponentDoc);
|
||||
vcFramework.putComponent(_componentName, vcDiv);
|
||||
let _componentObj = {
|
||||
html:_htmlBody,
|
||||
js:_jsBody,
|
||||
vcDiv:vcDiv
|
||||
};
|
||||
vcFramework.putComponent(_componentName, _componentObj);
|
||||
_tree.setHtml(vcDiv);
|
||||
_tree.setJs(_jsBody);
|
||||
return vcDiv;
|
||||
@ -439,7 +446,7 @@
|
||||
let vcType = _componentVcCreate.getAttribute(attrKey);
|
||||
if (!_componentVcCreate.hasAttribute(attrKey) && types[1].indexOf("=") > 0) {
|
||||
vcType = dealJsPropTypesDefault(types[1]);
|
||||
} else if (types[1].indexOf("vc.propTypes.string") > 0) {
|
||||
} else if (types[1].indexOf("vc.propTypes.string") >= 0) {
|
||||
vcType = "'" + vcType + "'";
|
||||
}
|
||||
propsJs = propsJs + "$props." + attrKey + "=" + vcType + ";\n";
|
||||
@ -543,6 +550,23 @@
|
||||
|
||||
})(window.vcFramework);
|
||||
|
||||
/**
|
||||
* vc-event 事件处理
|
||||
*
|
||||
*/
|
||||
|
||||
(function(vcFramework){
|
||||
|
||||
_initVcFrameworkEvent = function(){
|
||||
let vcFrameworkEvent = document.createEvent('Event');
|
||||
// 定义事件名为'build'.
|
||||
vcFrameworkEvent.initEvent('initVcFrameworkFinish', true, true);
|
||||
vcFramework.vcFrameworkEvent = vcFrameworkEvent;
|
||||
}
|
||||
|
||||
_initVcFrameworkEvent();
|
||||
})(window.vcFramework);
|
||||
|
||||
/**
|
||||
* vc-util
|
||||
*/
|
||||
@ -684,10 +708,11 @@
|
||||
Vue.http.post('/callComponent/' + componentCode + "/" + componentMethod, param, options)
|
||||
.then(function (res) {
|
||||
try {
|
||||
let _header = res.headers;
|
||||
if(vcFramework.notNull(_header['CONTEXTPATH'])){
|
||||
window.location.href = _header['CONTEXTPATH'];
|
||||
return ;
|
||||
let _header = res.headers.map;
|
||||
console.log('res', res);
|
||||
if (vcFramework.notNull(_header['location'])) {
|
||||
window.location.href = _header['location'];
|
||||
return;
|
||||
};
|
||||
successCallback(res.bodyText, res);
|
||||
} catch (e) {
|
||||
@ -695,9 +720,15 @@
|
||||
} finally {
|
||||
vcFramework.loading('close');
|
||||
}
|
||||
}, function (error) {
|
||||
}, function (res) {
|
||||
try {
|
||||
errorCallback(error.bodyText, error);
|
||||
if (res.status == 401) {
|
||||
let _header = res.headers.map;
|
||||
console.log('res', res);
|
||||
window.location.href = _header['location'];
|
||||
return;
|
||||
}
|
||||
errorCallback(res.bodyText, res);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} finally {
|
||||
@ -720,11 +751,7 @@
|
||||
Vue.http.get('/callComponent/' + componentCode + "/" + componentMethod, param)
|
||||
.then(function (res) {
|
||||
try {
|
||||
let _header = res.headers;
|
||||
if(vcFramework.notNull(_header['CONTEXTPATH'])){
|
||||
window.location.href = _header['CONTEXTPATH'];
|
||||
return ;
|
||||
};
|
||||
|
||||
successCallback(res.bodyText, res);
|
||||
if (vcFramework.constant.GET_CACHE_URL.includes(_getPath) && res.status == 200) {
|
||||
vcFramework.saveData(_getPath, JSON.parse(res.bodyText));
|
||||
@ -734,9 +761,16 @@
|
||||
} finally {
|
||||
vcFramework.loading('close');
|
||||
}
|
||||
}, function (error) {
|
||||
}, function (res) {
|
||||
try {
|
||||
errorCallback(error.bodyText, error);
|
||||
if (res.status == 401) {
|
||||
let _header = res.headers.map;
|
||||
console.log('res', res);
|
||||
window.location.href = _header['location'];
|
||||
return;
|
||||
|
||||
}
|
||||
errorCallback(res.bodyText, res);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} finally {
|
||||
@ -769,12 +803,14 @@
|
||||
|
||||
};
|
||||
|
||||
var vmOptions = vcFramework.vmOptions;
|
||||
//var vmOptions = vcFramework.vmOptions;
|
||||
//继承方法,合并 _vmOptions 的数据到 vmOptions中
|
||||
vcFramework.extends = function (_vmOptions) {
|
||||
let vmOptions = vcFramework.vmOptions;
|
||||
if (typeof _vmOptions !== "object") {
|
||||
throw "_vmOptions is not Object";
|
||||
}
|
||||
console.log('vmOptions',vmOptions);
|
||||
var nameSpace = DEFAULT_NAMESPACE;
|
||||
if (_vmOptions.hasOwnProperty("namespace")) {
|
||||
nameSpace = _vmOptions.namespace;
|
||||
@ -857,12 +893,31 @@
|
||||
|
||||
refreshVcFramework = function () {
|
||||
$that.$destroy();
|
||||
vcFramework._vmOptions = {};
|
||||
vcFramework._initMethod = [];
|
||||
vcFramework._initEvent = [];
|
||||
vcFramework._component = {};
|
||||
vcFramework._destroyedMethod = [];
|
||||
vcFramework._namespace = [];
|
||||
let _vmOptions = {
|
||||
el: '#component',
|
||||
data: {},
|
||||
watch: {},
|
||||
methods: {},
|
||||
destroyed: function () {
|
||||
window.vcFramework.destroyedMethod.forEach(function (eventMethod) {
|
||||
eventMethod();
|
||||
});
|
||||
//清理所有定时器
|
||||
|
||||
window.vcFramework.timers.forEach(function (timer) {
|
||||
clearInterval(timer);
|
||||
});
|
||||
|
||||
_timers = [];
|
||||
}
|
||||
|
||||
};
|
||||
vcFramework.vmOptions = _vmOptions;
|
||||
vcFramework.initMethod = [];
|
||||
vcFramework.initEvent = [];
|
||||
vcFramework.component = {};
|
||||
vcFramework.destroyedMethod = [];
|
||||
vcFramework.namespace = [];
|
||||
};
|
||||
//保存菜单
|
||||
vcFramework.setCurrentMenu = function (_menuId) {
|
||||
@ -1148,15 +1203,19 @@
|
||||
@param vc vue component对象
|
||||
@param vmOptions Vue参数
|
||||
**/
|
||||
(function (vcFramework, vmOptions) {
|
||||
(function (vcFramework) {
|
||||
vcFramework.initVue = function () {
|
||||
let vmOptions = vcFramework.vmOptions;
|
||||
console.log("vmOptions:", vmOptions);
|
||||
vcFramework.vue = new Vue(vmOptions);
|
||||
vcFramework.component = vcFramework.vue;
|
||||
//方便二次开发
|
||||
window.$that = vcFramework.vue;
|
||||
|
||||
//发布vue 创建完成 事件
|
||||
document.dispatchEvent(vcFramework.vcFrameworkEvent);
|
||||
}
|
||||
})(window.vcFramework, window.vcFramework.vmOptions);
|
||||
})(window.vcFramework);
|
||||
|
||||
/**
|
||||
* vcFramwork init
|
||||
@ -1263,4 +1322,5 @@
|
||||
vcFramework[_param.namespace] = vcFramework.vue[_param.namespace];
|
||||
});
|
||||
}
|
||||
})(window.vcFramework);
|
||||
})(window.vcFramework);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user