MicroCommunityWeb/public/pages/dev/configMenu/configMenu.js
2020-05-02 17:39:37 +08:00

94 lines
3.4 KiB
JavaScript

/**
入驻小区
**/
(function(vc){
vc.extends({
data:{
configMenuInfo:{
$step:{},
index:0,
infos:[]
}
},
_initMethod:function(){
vc.component._initStep();
},
_initEvent:function(){
vc.on("configMenu", "notify", function(_info){
vc.component.configMenuInfo.infos[vc.component.configMenuInfo.index] = _info;
});
},
methods:{
_initStep:function(){
vc.component.configMenuInfo.$step = $("#step");
vc.component.configMenuInfo.$step.step({
index: 0,
time: 500,
title: ["选择菜单组","菜单信息","权限信息"]
});
vc.component.configMenuInfo.index = vc.component.configMenuInfo.$step.getIndex();
},
_prevStep:function(){
vc.component.configMenuInfo.$step.prevStep();
vc.component.configMenuInfo.index = vc.component.configMenuInfo.$step.getIndex();
vc.emit('viewMenuGroupInfo', 'onIndex', vc.component.configMenuInfo.index);
vc.emit('addMenuView', 'onIndex', vc.component.configMenuInfo.index);
vc.emit('addPrivilegeView', 'onIndex', vc.component.configMenuInfo.index);
},
_nextStep:function(){
var _currentData = vc.component.configMenuInfo.infos[vc.component.configMenuInfo.index];
if( _currentData == null || _currentData == undefined){
vc.toast("请选择或填写必选信息");
return ;
}
vc.component.configMenuInfo.$step.nextStep();
vc.component.configMenuInfo.index = vc.component.configMenuInfo.$step.getIndex();
vc.emit('viewMenuGroupInfo', 'onIndex', vc.component.configMenuInfo.index);
vc.emit('addMenuView', 'onIndex', vc.component.configMenuInfo.index);
vc.emit('addPrivilegeView', 'onIndex', vc.component.configMenuInfo.index);
},
_finishStep:function(){
var _currentData = vc.component.configMenuInfo.infos[vc.component.configMenuInfo.index];
if( _currentData == null || _currentData == undefined){
vc.toast("请选择或填写必选信息");
return ;
}
var param = {
data:vc.component.configMenuInfo.infos
}
vc.http.post(
'configMenuBinding',
'binding',
JSON.stringify(param),
{
emulateJSON:true
},
function(json,res){
if(res.status == 200){
vc.toast('处理成功');
//关闭model
vc.jumpToPage("/admin.html#/pages/dev/menuManage?" + vc.objToGetParam(JSON.parse(json)));
return ;
}
vc.toast(json);
},
function(errInfo,error){
console.log('请求失败处理');
vc.toast(errInfo);
});
}
}
});
})(window.vc);