优化公众号添加菜单

This commit is contained in:
java110 2020-06-23 13:19:38 +08:00
parent 530be4864b
commit 6b415444a0
4 changed files with 37 additions and 17 deletions

View File

@ -57,7 +57,7 @@
},
{
limit: "maxLength",
param: "10",
param: "50",
errInfo: "菜单类型格式错误"
},
],
@ -76,8 +76,8 @@
'addWechatMenuInfo.menuValue': [
{
limit: "maxLength",
param: "50",
errInfo: "值不能超过50位"
param: "200",
errInfo: "值不能超过200位"
}
],
'addWechatMenuInfo.appId': [

View File

@ -51,7 +51,7 @@
},
{
limit: "maxLength",
param: "10",
param: "50",
errInfo: "菜单类型格式错误"
},
],
@ -70,8 +70,8 @@
'editWechatMenuInfo.menuValue': [
{
limit: "maxLength",
param: "50",
errInfo: "值不能超过50位"
param: "200",
errInfo: "值不能超过200位"
},
],
'editWechatMenuInfo.appId': [

View File

@ -30,7 +30,7 @@
$that.wechatAttrInfo.wId = _param.wId;
$that.wechatAttrInfo.wechatServerUrl = window.location.protocol
+ "//" + window.location.host
+ '/app/wechat/gateway?java110AppId=992019111758490006&wId='
+ '/app/wechat/gateway?java110AppId=992020061452450002&wId='
+ $that.wechatAttrInfo.wId;
$that._listListWechatAttrs(DEFAULT_PAGE, DEFAULT_ROWS);
});

View File

@ -45,10 +45,10 @@
function (json, res) {
var _wechatMenuManageInfo = JSON.parse(json);
vc.component.wechatMenuManageInfo.wechatMenus = _wechatMenuManageInfo.data;
if(_wechatMenuManageInfo.data.length > 0){
if (_wechatMenuManageInfo.data.length > 0) {
$that.wechatMenuManageInfo.curParentMenuId = _wechatMenuManageInfo.data[0].wechatMenuId;
$that._listSubWechatMenus();
}
}
}, function (errInfo, error) {
console.log('请求失败处理');
}
@ -57,8 +57,8 @@
_listSubWechatMenus: function () {
if($that.wechatMenuManageInfo.curParentMenuId == ''){
return ;
if ($that.wechatMenuManageInfo.curParentMenuId == '') {
return;
}
var param = {
@ -84,17 +84,17 @@
},
_openAddWechatMenuModal: function (_menuLevel) {
let _parentMenuId = '-1';
if(_menuLevel == '202'){
if (_menuLevel == '202') {
_parentMenuId = $that.wechatMenuManageInfo.curParentMenuId;
if(_parentMenuId == ''){
if (_parentMenuId == '') {
vc.toast("请先选择一级菜单");
return ;
return;
}
}else{
} else {
$that.wechatMenuManageInfo.curParentMenuId = '-1';
}
vc.emit('addWechatMenu', 'openAddWechatMenuModal', {
menuLevel:_menuLevel,
menuLevel: _menuLevel,
parentMenuId: _parentMenuId
});
},
@ -112,8 +112,28 @@
$that.wechatMenuManageInfo.curParentMenuId = _wechatMenu.wechatMenuId;
$that._listSubWechatMenus();
},
_publishMenu:function(){
_publishMenu: function () {
//发布菜单
var data = {
communityId: vc.getCurrentCommunity().communityId
};
//发送get请求
vc.http.apiPost('smallWeChat.publicWechatMenu',
JSON.stringify(data),
{
emulateJSON: true
},
function (json, res) {
var _wechatMenuManageInfo = JSON.parse(json);
console.log("_wechatMenuManageInfo", _wechatMenuManageInfo);
vc.toast(_wechatMenuManageInfo.msg);
}, function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
}
);
}