mp:1)引入 less-loader,解决 menu 的 less 样式;2)接入菜单列表接口

This commit is contained in:
YunaiV 2023-01-14 21:24:14 +08:00
parent f271ef8c47
commit 02ec5d455c
12 changed files with 808 additions and 512 deletions

View File

@ -51,7 +51,7 @@ public interface ErrorCodeConstants {
ErrorCode DRAFT_UPDATE_FAIL = new ErrorCode(1006007002, "更新草稿失败,原因:{}"); ErrorCode DRAFT_UPDATE_FAIL = new ErrorCode(1006007002, "更新草稿失败,原因:{}");
ErrorCode DRAFT_DELETE_FAIL = new ErrorCode(1006007002, "删除草稿失败,原因:{}"); ErrorCode DRAFT_DELETE_FAIL = new ErrorCode(1006007002, "删除草稿失败,原因:{}");
// TODO 要处理下 // ========== 公众号菜单 1006008000============
ErrorCode MENU_NOT_EXISTS = new ErrorCode(1006001002, "菜单不存在"); ErrorCode MENU_NOT_EXISTS = new ErrorCode(1006008000, "菜单不存在");
} }

View File

@ -32,3 +32,8 @@ tenant-id: {{adminTenentId}}
}] }]
}] }]
} }
### 请求 /mp/menu/list 接口 => 成功
GET {{baseUrl}}/mp/menu/list?accountId=1
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}

View File

@ -1,25 +1,26 @@
package cn.iocoder.yudao.module.mp.controller.admin.menu; package cn.iocoder.yudao.module.mp.controller.admin.menu;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.mp.controller.admin.menu.vo.MpMenuRespVO;
import cn.iocoder.yudao.module.mp.controller.admin.menu.vo.MpMenuSaveReqVO;
import cn.iocoder.yudao.module.mp.convert.menu.MpMenuConvert; import cn.iocoder.yudao.module.mp.convert.menu.MpMenuConvert;
import cn.iocoder.yudao.module.mp.dal.dataobject.menu.MpMenuDO; import cn.iocoder.yudao.module.mp.dal.dataobject.menu.MpMenuDO;
import cn.iocoder.yudao.module.mp.service.menu.MpMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.validation.annotation.Validated; import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.module.mp.controller.admin.menu.vo.*; @Api(tags = "管理后台 - 公众号菜单")
import cn.iocoder.yudao.module.mp.service.menu.MpMenuService;
@Api(tags = "管理后台 - 微信菜单")
@RestController @RestController
@RequestMapping("/mp/menu") @RequestMapping("/mp/menu")
@Validated @Validated
@ -29,14 +30,14 @@ public class MpMenuController {
private MpMenuService mpMenuService; private MpMenuService mpMenuService;
@PostMapping("/save") @PostMapping("/save")
@ApiOperation("保存微信菜单") @ApiOperation("保存公众号菜单")
@PreAuthorize("@ss.hasPermission('mp:menu:save')") @PreAuthorize("@ss.hasPermission('mp:menu:save')")
public CommonResult<Long> saveMenu(@Valid @RequestBody MpMenuSaveReqVO createReqVO) { public CommonResult<Long> saveMenu(@Valid @RequestBody MpMenuSaveReqVO createReqVO) {
return success(mpMenuService.saveMenu(createReqVO)); return success(mpMenuService.saveMenu(createReqVO));
} }
@DeleteMapping("/delete") @DeleteMapping("/delete")
@ApiOperation("删除微信菜单") @ApiOperation("删除公众号菜单")
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('mp:menu:delete')") @PreAuthorize("@ss.hasPermission('mp:menu:delete')")
public CommonResult<Boolean> deleteMenu(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteMenu(@RequestParam("id") Long id) {
@ -45,7 +46,7 @@ public class MpMenuController {
} }
@GetMapping("/get") @GetMapping("/get")
@ApiOperation("获得微信菜单") @ApiOperation("获得公众号菜单")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('mp:menu:query')") @PreAuthorize("@ss.hasPermission('mp:menu:query')")
public CommonResult<MpMenuRespVO> getMenu(@RequestParam("id") Long id) { public CommonResult<MpMenuRespVO> getMenu(@RequestParam("id") Long id) {
@ -53,4 +54,13 @@ public class MpMenuController {
return success(MpMenuConvert.INSTANCE.convert(menu)); return success(MpMenuConvert.INSTANCE.convert(menu));
} }
@GetMapping("/list")
@ApiOperation("获得公众号菜单列表")
@ApiImplicitParam(name = "accountId", value = "公众号账号的编号", required = true, example = "10", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('mp:menu:query')")
public CommonResult<List<MpMenuRespVO>> getMenuList(@RequestParam("accountId") Long accountId) {
List<MpMenuDO> list = mpMenuService.getMenuListByAccountId(accountId);
return success(MpMenuConvert.INSTANCE.convertList(list));
}
} }

View File

@ -1,12 +1,15 @@
package cn.iocoder.yudao.module.mp.controller.admin.menu.vo; package cn.iocoder.yudao.module.mp.controller.admin.menu.vo;
import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO;
import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpMessageDO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.*; import lombok.Data;
import me.chanjar.weixin.common.bean.menu.WxMenuButton; import me.chanjar.weixin.common.api.WxConsts;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
// TODO 芋艿完善 swagger 注解
/** /**
* 微信菜单 Base VO提供给添加修改详细的子 VO 使用 * 微信菜单 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
@ -18,4 +21,112 @@ public class MpMenuBaseVO {
@NotNull(message = "公众号账号的编号不能为空") @NotNull(message = "公众号账号的编号不能为空")
private Long accountId; private Long accountId;
/**
* 微信公众号 appid
*
* 冗余 {@link MpAccountDO#getAppId()}
*/
private String appId;
/**
* 菜单名称
*/
private String name;
/**
* 菜单标识
*
* 支持多 DB 类型时无法直接使用 key + @TableField("menuKey") 来实现转换原因是 "menuKey" AS key 而存在报错
*/
private String menuKey;
/**
* 父菜单编号
*/
private Long parentId;
/**
* 排序
*/
private Integer sort;
// ========== 按钮操作 ==========
/**
* 按钮类型
*
* 枚举 {@link WxConsts.MenuButtonType}
*/
private String type;
/**
* 网页链接
*
* 用户点击菜单可打开链接不超过 1024 字节
*
* 类型为 {@link WxConsts.XmlMsgType} VIEWMINIPROGRAM
*/
private String url;
/**
* 小程序的 appId
*
* 类型为 {@link WxConsts.MenuButtonType} MINIPROGRAM
*/
private String miniProgramAppId;
/**
* 小程序的页面路径
*
* 类型为 {@link WxConsts.MenuButtonType} MINIPROGRAM
*/
private String miniProgramPagePath;
// ========== 消息内容 ==========
/**
* 消息类型
*
* {@link #type} CLICKSCANCODE_WAITMSG
*
* 枚举 {@link WxConsts.XmlMsgType} 中的 TEXTIMAGEVOICEVIDEONEWS
*/
private String replyMessageType;
/**
* 回复的消息内容
*
* 消息类型为 {@link WxConsts.XmlMsgType} TEXT
*/
private String replyContent;
/**
* 回复的媒体 id
*
* 消息类型为 {@link WxConsts.XmlMsgType} IMAGEVOICEVIDEO
*/
private String replyMediaId;
/**
* 回复的媒体 URL
*
* 消息类型为 {@link WxConsts.XmlMsgType} IMAGEVOICEVIDEO
*/
private String replyMediaUrl;
/**
* 回复的标题
*
* 消息类型为 {@link WxConsts.XmlMsgType} VIDEO
*/
private String replyTitle;
/**
* 回复的描述
*
* 消息类型为 {@link WxConsts.XmlMsgType} VIDEO
*/
private String replyDescription;
/**
* 回复的图文消息数组
*
* 消息类型为 {@link WxConsts.XmlMsgType} NEWS
*/
private List<MpMessageDO.Article> replyArticles;
} }

View File

@ -1,14 +1,15 @@
package cn.iocoder.yudao.module.mp.convert.menu; package cn.iocoder.yudao.module.mp.convert.menu;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.mp.controller.admin.menu.vo.MpMenuRespVO;
import cn.iocoder.yudao.module.mp.controller.admin.menu.vo.MpMenuSaveReqVO;
import cn.iocoder.yudao.module.mp.dal.dataobject.menu.MpMenuDO;
import cn.iocoder.yudao.module.mp.service.message.bo.MpMessageSendOutReqBO; import cn.iocoder.yudao.module.mp.service.message.bo.MpMessageSendOutReqBO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.mp.controller.admin.menu.vo.*;
import cn.iocoder.yudao.module.mp.dal.dataobject.menu.MpMenuDO; import java.util.List;
@Mapper @Mapper
public interface MpMenuConvert { public interface MpMenuConvert {
@ -19,6 +20,8 @@ public interface MpMenuConvert {
MpMenuRespVO convert(MpMenuDO bean); MpMenuRespVO convert(MpMenuDO bean);
List<MpMenuRespVO> convertList(List<MpMenuDO> list);
@Mappings({ @Mappings({
@Mapping(source = "menu.appId", target = "appId"), @Mapping(source = "menu.appId", target = "appId"),
@Mapping(source = "menu.replyMessageType", target = "type"), @Mapping(source = "menu.replyMessageType", target = "type"),

View File

@ -4,6 +4,8 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mp.dal.dataobject.menu.MpMenuDO; import cn.iocoder.yudao.module.mp.dal.dataobject.menu.MpMenuDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper @Mapper
public interface MpMenuMapper extends BaseMapperX<MpMenuDO> { public interface MpMenuMapper extends BaseMapperX<MpMenuDO> {
@ -12,4 +14,8 @@ public interface MpMenuMapper extends BaseMapperX<MpMenuDO> {
MpMenuDO::getMenuKey, menuKey); MpMenuDO::getMenuKey, menuKey);
} }
default List<MpMenuDO> selectListByAccountId(Long accountId) {
return selectList(MpMenuDO::getAccountId, accountId);
}
} }

View File

@ -1,21 +1,21 @@
package cn.iocoder.yudao.module.mp.service.menu; package cn.iocoder.yudao.module.mp.service.menu;
import javax.validation.*; import cn.iocoder.yudao.module.mp.controller.admin.menu.vo.MpMenuSaveReqVO;
import cn.iocoder.yudao.module.mp.controller.admin.menu.vo.*;
import cn.iocoder.yudao.module.mp.dal.dataobject.menu.MpMenuDO; import cn.iocoder.yudao.module.mp.dal.dataobject.menu.MpMenuDO;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import javax.validation.Valid;
import java.util.List;
/** /**
* 微信菜单 Service 接口 * 公众号菜单 Service 接口
* *
* @author 芋道源码 * @author 芋道源码
*/ */
public interface MpMenuService { public interface MpMenuService {
/** /**
* 保存微信菜单 * 保存公众号菜单
* *
* @param createReqVO 创建信息 * @param createReqVO 创建信息
* @return 编号 * @return 编号
@ -23,17 +23,17 @@ public interface MpMenuService {
Long saveMenu(@Valid MpMenuSaveReqVO createReqVO); Long saveMenu(@Valid MpMenuSaveReqVO createReqVO);
/** /**
* 删除微信菜单 * 删除公众号菜单
* *
* @param id 编号 * @param id 编号
*/ */
void deleteMenu(Long id); void deleteMenu(Long id);
/** /**
* 获得微信菜单 * 获得公众号菜单
* *
* @param id 编号 * @param id 编号
* @return 微信菜单 * @return 公众号菜单
*/ */
MpMenuDO getMenu(Long id); MpMenuDO getMenu(Long id);
@ -47,4 +47,12 @@ public interface MpMenuService {
*/ */
WxMpXmlOutMessage reply(String appId, String key, String openid); WxMpXmlOutMessage reply(String appId, String key, String openid);
/**
* 获得公众号菜单列表
*
* @param accountId 公众号编号
* @return 公众号菜单列表
*/
List<MpMenuDO> getMenuListByAccountId(Long accountId);
} }

View File

@ -1,8 +1,10 @@
package cn.iocoder.yudao.module.mp.service.menu; package cn.iocoder.yudao.module.mp.service.menu;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.module.mp.controller.admin.menu.vo.MpMenuSaveReqVO;
import cn.iocoder.yudao.module.mp.convert.menu.MpMenuConvert; import cn.iocoder.yudao.module.mp.convert.menu.MpMenuConvert;
import cn.iocoder.yudao.module.mp.dal.dataobject.menu.MpMenuDO; import cn.iocoder.yudao.module.mp.dal.dataobject.menu.MpMenuDO;
import cn.iocoder.yudao.module.mp.dal.mysql.menu.MpMenuMapper;
import cn.iocoder.yudao.module.mp.framework.mp.core.MpServiceFactory; import cn.iocoder.yudao.module.mp.framework.mp.core.MpServiceFactory;
import cn.iocoder.yudao.module.mp.service.message.MpMessageService; import cn.iocoder.yudao.module.mp.service.message.MpMessageService;
import cn.iocoder.yudao.module.mp.service.message.bo.MpMessageSendOutReqBO; import cn.iocoder.yudao.module.mp.service.message.bo.MpMessageSendOutReqBO;
@ -13,20 +15,16 @@ import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.mp.controller.admin.menu.vo.*; import javax.annotation.Resource;
import java.util.List;
import cn.iocoder.yudao.module.mp.dal.mysql.menu.MpMenuMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.MENU_NOT_EXISTS;
/** /**
* 微信菜单 Service 实现类 * 公众号菜单 Service 实现类
* *
* @author 芋道源码 * @author 芋道源码
*/ */
@ -76,7 +74,6 @@ public class MpMenuServiceImpl implements MpMenuService {
private void validateMenuExists(Long id) { private void validateMenuExists(Long id) {
if (mpMenuMapper.selectById(id) == null) { if (mpMenuMapper.selectById(id) == null) {
// TODO 芋艿错误码不太对
throw exception(MENU_NOT_EXISTS); throw exception(MENU_NOT_EXISTS);
} }
} }
@ -105,4 +102,9 @@ public class MpMenuServiceImpl implements MpMenuService {
return mpMessageService.sendOutMessage(sendReqBO); return mpMessageService.sendOutMessage(sendReqBO);
} }
@Override
public List<MpMenuDO> getMenuListByAccountId(Long accountId) {
return mpMenuMapper.selectListByAccountId(accountId);
}
} }

View File

@ -90,6 +90,8 @@
"eslint-plugin-prettier": "^3.1.0", "eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-vue": "9.0.0", "eslint-plugin-vue": "9.0.0",
"fs-extra": "^8.1.0", "fs-extra": "^8.1.0",
"less": "^4.1.3",
"less-loader": "^7.3.0",
"lint-staged": "12.5.0", "lint-staged": "12.5.0",
"runjs": "4.4.2", "runjs": "4.4.2",
"sass": "1.32.13", "sass": "1.32.13",

View File

@ -0,0 +1,9 @@
import request from '@/utils/request'
// 获得公众号菜单列表
export function getMenuList(accountId) {
return request({
url: '/mp/menu/list?accountId=' + accountId,
method: 'get',
})
}

View File

@ -23,25 +23,40 @@ SOFTWARE.
--> -->
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="public-account-management clearfix" v-loading="saveLoading"> <!-- 搜索工作栏 -->
<el-form ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="公众号" prop="accountId">
<el-select v-model="accountId" placeholder="请选择公众号">
<el-option v-for="item in accounts" :key="parseInt(item.id)" :label="item.name" :value="parseInt(item.id)" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="public-account-management clearfix" v-loading="loading">
<!--左边配置菜单--> <!--左边配置菜单-->
<div class="left"> <div class="left">
<div class="weixin-hd"> <div class="weixin-hd">
<div class="weixin-title"> <div class="weixin-title">{{menuName}}</div>
{{menuName}}
</div>
</div> </div>
<div class="weixin-menu menu_main clearfix"> <div class="weixin-menu menu_main clearfix">
<div class="menu_bottom" v-for="(item, i) of menu.button" :key="i" > <div class="menu_bottom" v-for="(item, i) of menuList" :key="i" >
<!-- 一级菜单 --> <!-- 一级菜单 -->
<div @click="menuFun(i,item)" class="menu_item el-icon-s-fold" :class="{'active': isActive == i}">{{item.name}}</div> <div @click="menuClick(i, item)" class="menu_item el-icon-s-fold" :class="{'active': isActive === i}">{{item.name}}</div>
<!--以下为二级菜单--> <!-- 以下为二级菜单-->
<div class="submenu" v-if="isSubMenuFlag == i"> <div class="submenu" v-if="isSubMenuFlag === i">
<div class="subtitle menu_bottom" v-if="item.sub_button" v-for="(subItem, k) in item.sub_button" :key="k"> <div class="subtitle menu_bottom" v-if="item.children" v-for="(subItem, k) in item.children" :key="k">
<div class="menu_subItem" :class="{'active': isSubMenuActive == i + '' +k}" @click="subMenuFun(subItem, i, k)">{{subItem.name}}</div> <div class="menu_subItem" :class="{'active': isSubMenuActive === i + '' + k}" @click="subMenuClick(subItem, i, k)">
{{subItem.name}}
</div>
</div> </div>
<!-- 二级菜单加号 当长度 小于 5 才显示二级菜单的加号 --> <!-- 二级菜单加号 当长度 小于 5 才显示二级菜单的加号 -->
<div class="menu_bottom menu_addicon" v-if="!item.sub_button || item.sub_button.length < 5" @click="addSubMenu(i,item)"><i class="el-icon-plus"></i></div> <div class="menu_bottom menu_addicon" v-if="!item.children || item.children.length < 5" @click="addSubMenu(i,item)">
<i class="el-icon-plus" />
</div>
</div> </div>
</div> </div>
<!-- 一级菜单加号 --> <!-- 一级菜单加号 -->
@ -69,11 +84,11 @@ SOFTWARE.
<el-option v-for="item in menuOptions" :label="item.label" :value="item.value" :key="item.value"></el-option> <el-option v-for="item in menuOptions" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select> </el-select>
</div> </div>
<div class="configur_content" v-if="tempObj.type == 'view'"> <div class="configur_content" v-if="tempObj.type === 'view'">
<span>跳转链接</span> <span>跳转链接</span>
<el-input class="input_width" v-model="tempObj.url" placeholder="请输入链接" clearable></el-input> <el-input class="input_width" v-model="tempObj.url" placeholder="请输入链接" clearable></el-input>
</div> </div>
<div class="configur_content" v-if="tempObj.type == 'miniprogram'"> <div class="configur_content" v-if="tempObj.type === 'miniprogram'">
<div class="applet"> <div class="applet">
<span>小程序的appid</span> <span>小程序的appid</span>
<el-input class="input_width" v-model="tempObj.appid" placeholder="请输入小程序的appid" clearable></el-input> <el-input class="input_width" v-model="tempObj.appid" placeholder="请输入小程序的appid" clearable></el-input>
@ -123,12 +138,14 @@ SOFTWARE.
</template> </template>
<script> <script>
// import { save, saveAndRelease ,getList} from '@/api/wxmp/wxmenu' // import { save, saveAndRelease ,getList} from '@/api/wxmp/wxmenu'
import WxReplySelect from '@/views/mp/components/wx-news/main.vue' import WxReplySelect from '@/views/mp/components/wx-news/main.vue'
import WxNews from '@/views/mp/components/wx-news/main.vue'; import WxNews from '@/views/mp/components/wx-news/main.vue';
import WxMaterialSelect from '@/views/mp/components/wx-news/main.vue' import WxMaterialSelect from '@/views/mp/components/wx-news/main.vue'
import {getMenuList} from "@/api/mp/menu";
import {getSimpleAccounts} from "@/api/mp/account";
export default { export default {
name: 'mpMenu', name: 'mpMenu',
components: { components: {
WxReplySelect, WxReplySelect,
@ -136,20 +153,31 @@ SOFTWARE.
WxMaterialSelect WxMaterialSelect
}, },
data(){ data(){
return{ return {
showRightFlag:false,// //
menu:{ loading: true,
//
showSearch: true,
//
accountId: undefined,
menuList: {
children: [],
},
showRightFlag:false, //
menu:{ //
button:[ button:[
] ]
},//
isActive: -1,//
isSubMenuActive: -1,//
isSubMenuFlag: -1,//
tempObj:{},//
tempSelfObj:{
//tempObjmenu
}, },
visible2: false,// ""
isActive: -1,//
isSubMenuActive: -1, //
isSubMenuFlag: -1, //
tempObj:{}, //
tempSelfObj: {
// tempObjmenu
},
visible2: false, // ""
tableData:[], //, tableData:[], //,
menuName:'', menuName:'',
showConfigurContent:true, showConfigurContent:true,
@ -185,22 +213,66 @@ SOFTWARE.
value: 'location_select', value: 'location_select',
label: '选择地理位置' label: '选择地理位置'
}], }],
dialogNewsVisible:false, dialogNewsVisible: false,
saveLoading:false, hackResetWxReplySelect: false,
hackResetWxReplySelect:false
//
accounts: [],
} }
}, },
created() { created() {
this.getMenuFun() getSimpleAccounts().then(response => {
}, this.accounts = response.data;
mounted() { //
if (this.accounts.length > 0) {
}, this.setAccountId(this.accounts[0].id);
filters:{ }
//
this.getList();
})
}, },
computed: { computed: {
menuKeyLength:function() {
// menuObj 3
return this.menu.button.length;
}
}, },
methods:{ methods: {
// ======================== ========================
/** 设置账号编号 */
setAccountId(accountId) {
this.accountId = accountId;
// this.uploadData.accountId = accountId;
},
getList() {
this.loading = false;
getMenuList(this.accountId).then(response => {
this.menuList = this.handleTree(response.data, "id");
console.log(this.menuList)
}).finally(() => {
this.loading = false;
})
},
/** 搜索按钮操作 */
handleQuery() {
//
if (this.accountId) {
this.setAccountId(this.accountId)
}
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
//
if (this.accounts.length > 0) {
this.setAccountId(this.accounts[0].id)
}
this.handleQuery()
},
// TODO
deleteTempObj(){ deleteTempObj(){
this.$delete(this.tempObj,'repName') this.$delete(this.tempObj,'repName')
this.$delete(this.tempObj,'repUrl') this.$delete(this.tempObj,'repUrl')
@ -223,11 +295,6 @@ SOFTWARE.
item.content.articles = item.content.articles.slice(0,1) item.content.articles = item.content.articles.slice(0,1)
this.tempObj.content = item.content this.tempObj.content = item.content
}, },
getMenuFun(){
getList().then((res)=>{
this.menu.button = JSON.parse(res.msg).button;
});
},
handleClick(tab, event){ handleClick(tab, event){
this.tempObj.mediaType = tab.name this.tempObj.mediaType = tab.name
}, },
@ -237,11 +304,11 @@ SOFTWARE.
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.saveLoading = true this.loading = true
saveAndRelease({ saveAndRelease({
strWxMenu:this.menu strWxMenu:this.menu
}).then(response => { }).then(response => {
this.saveLoading = false this.loading = false
if(response.code == 200){ if(response.code == 200){
this.$message({ this.$message({
showClose: true, showClose: true,
@ -252,13 +319,13 @@ SOFTWARE.
this.$message.error(response.data.msg) this.$message.error(response.data.msg)
} }
}).catch(() => { }).catch(() => {
this.saveLoading = false this.loading = false
}) })
}).catch(() => { }).catch(() => {
}) })
}, },
// //
menuFun(i, item){ menuClick(i, item){
this.hackResetWxReplySelect = false// this.hackResetWxReplySelect = false//
this.$nextTick(() => { this.$nextTick(() => {
this.hackResetWxReplySelect = true// this.hackResetWxReplySelect = true//
@ -271,14 +338,14 @@ SOFTWARE.
this.isSubMenuFlag = i; // this.isSubMenuFlag = i; //
this.isSubMenuActive = -1; // this.isSubMenuActive = -1; //
this.nameMaxlength = 4 this.nameMaxlength = 4
if(item.sub_button&&item.sub_button.length>0){ if(item.sub_button && item.sub_button.length > 0){
this.showConfigurContent = false this.showConfigurContent = false
}else{ }else{
this.showConfigurContent = true this.showConfigurContent = true
} }
}, },
// //
subMenuFun(subItem, index, k){ subMenuClick(subItem, index, k){
this.hackResetWxReplySelect = false// this.hackResetWxReplySelect = false//
this.$nextTick(() => { this.$nextTick(() => {
this.hackResetWxReplySelect = true// this.hackResetWxReplySelect = true//
@ -301,7 +368,7 @@ SOFTWARE.
sub_button: [] sub_button: []
} }
this.$set(this.menu.button,menuKeyLength,addButton) this.$set(this.menu.button,menuKeyLength,addButton)
this.menuFun(this.menuKeyLength-1, addButton) this.menuClick(this.menuKeyLength-1, addButton)
}, },
// //
addSubMenu(i,item){ addSubMenu(i,item){
@ -320,7 +387,7 @@ SOFTWARE.
name: "子菜单名称" name: "子菜单名称"
} }
this.$set(item.sub_button,subMenuKeyLength,addButton); this.$set(item.sub_button,subMenuKeyLength,addButton);
this.subMenuFun(item.sub_button[subMenuKeyLength], i, subMenuKeyLength) this.subMenuClick(item.sub_button[subMenuKeyLength], i, subMenuKeyLength)
}, },
// //
deleteMenu(obj){ deleteMenu(obj){
@ -354,13 +421,7 @@ SOFTWARE.
}); });
} }
}, },
computed:{ }
// menuObj 3
menuKeyLength:function(){
return this.menu.button.length;
}
}
}
</script> </script>
<!--本组件样式--> <!--本组件样式-->
<style lang="less" scoped="scoped"> <style lang="less" scoped="scoped">

View File

@ -3340,6 +3340,13 @@
"resolved" "https://registry.npmmirror.com/cookie/-/cookie-0.5.0.tgz" "resolved" "https://registry.npmmirror.com/cookie/-/cookie-0.5.0.tgz"
"version" "0.5.0" "version" "0.5.0"
"copy-anything@^2.0.1":
"integrity" "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw=="
"resolved" "https://registry.npmmirror.com/copy-anything/-/copy-anything-2.0.6.tgz"
"version" "2.0.6"
dependencies:
"is-what" "^3.14.1"
"copy-concurrently@^1.0.0": "copy-concurrently@^1.0.0":
"integrity" "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==" "integrity" "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A=="
"resolved" "https://registry.npmmirror.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz" "resolved" "https://registry.npmmirror.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz"
@ -3696,6 +3703,13 @@
dependencies: dependencies:
"ms" "2.0.0" "ms" "2.0.0"
"debug@^3.2.6":
"integrity" "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ=="
"resolved" "https://registry.npmmirror.com/debug/-/debug-3.2.7.tgz"
"version" "3.2.7"
dependencies:
"ms" "^2.1.1"
"debug@^3.2.7": "debug@^3.2.7":
"integrity" "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==" "integrity" "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ=="
"resolved" "https://registry.npmmirror.com/debug/-/debug-3.2.7.tgz" "resolved" "https://registry.npmmirror.com/debug/-/debug-3.2.7.tgz"
@ -4215,7 +4229,7 @@
"resolved" "https://registry.npmmirror.com/entities/-/entities-2.2.0.tgz" "resolved" "https://registry.npmmirror.com/entities/-/entities-2.2.0.tgz"
"version" "2.2.0" "version" "2.2.0"
"errno@^0.1.3", "errno@~0.1.7": "errno@^0.1.1", "errno@^0.1.3", "errno@~0.1.7":
"integrity" "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==" "integrity" "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A=="
"resolved" "https://registry.npmmirror.com/errno/-/errno-0.1.8.tgz" "resolved" "https://registry.npmmirror.com/errno/-/errno-0.1.8.tgz"
"version" "0.1.8" "version" "0.1.8"
@ -5633,6 +5647,13 @@
dependencies: dependencies:
"safer-buffer" ">= 2.1.2 < 3" "safer-buffer" ">= 2.1.2 < 3"
"iconv-lite@^0.6.3":
"integrity" "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="
"resolved" "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.6.3.tgz"
"version" "0.6.3"
dependencies:
"safer-buffer" ">= 2.1.2 < 3.0.0"
"icss-utils@^4.0.0", "icss-utils@^4.1.1": "icss-utils@^4.0.0", "icss-utils@^4.1.1":
"integrity" "sha512-4aFq7wvWyMHKgxsH8QQtGpvbASCf+eM3wPRLI6R+MgAnTCZ6STYsRvttLvRWK0Nfif5piF394St3HeJDaljGPA==" "integrity" "sha512-4aFq7wvWyMHKgxsH8QQtGpvbASCf+eM3wPRLI6R+MgAnTCZ6STYsRvttLvRWK0Nfif5piF394St3HeJDaljGPA=="
"resolved" "https://registry.npmmirror.com/icss-utils/-/icss-utils-4.1.1.tgz" "resolved" "https://registry.npmmirror.com/icss-utils/-/icss-utils-4.1.1.tgz"
@ -5665,7 +5686,7 @@
"resolved" "https://registry.npmmirror.com/ignore/-/ignore-4.0.6.tgz" "resolved" "https://registry.npmmirror.com/ignore/-/ignore-4.0.6.tgz"
"version" "4.0.6" "version" "4.0.6"
"image-size@^0.5.1": "image-size@^0.5.1", "image-size@~0.5.0":
"integrity" "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==" "integrity" "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ=="
"resolved" "https://registry.npmmirror.com/image-size/-/image-size-0.5.5.tgz" "resolved" "https://registry.npmmirror.com/image-size/-/image-size-0.5.5.tgz"
"version" "0.5.5" "version" "0.5.5"
@ -6150,6 +6171,11 @@
dependencies: dependencies:
"call-bind" "^1.0.2" "call-bind" "^1.0.2"
"is-what@^3.14.1":
"integrity" "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA=="
"resolved" "https://registry.npmmirror.com/is-what/-/is-what-3.14.1.tgz"
"version" "3.14.1"
"is-windows@^1.0.2": "is-windows@^1.0.2":
"integrity" "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" "integrity" "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA=="
"resolved" "https://registry.npmmirror.com/is-windows/-/is-windows-1.0.2.tgz" "resolved" "https://registry.npmmirror.com/is-windows/-/is-windows-1.0.2.tgz"
@ -6402,6 +6428,32 @@
"picocolors" "^1.0.0" "picocolors" "^1.0.0"
"shell-quote" "^1.7.3" "shell-quote" "^1.7.3"
"less-loader@^7.3.0":
"integrity" "sha512-Mi8915g7NMaLlgi77mgTTQvK022xKRQBIVDSyfl3ErTuBhmZBQab0mjeJjNNqGbdR+qrfTleKXqbGI4uEFavxg=="
"resolved" "https://registry.npmmirror.com/less-loader/-/less-loader-7.3.0.tgz"
"version" "7.3.0"
dependencies:
"klona" "^2.0.4"
"loader-utils" "^2.0.0"
"schema-utils" "^3.0.0"
"less@^3.5.0 || ^4.0.0", "less@^4.1.3":
"integrity" "sha512-w16Xk/Ta9Hhyei0Gpz9m7VS8F28nieJaL/VyShID7cYvP6IL5oHeL6p4TXSDJqZE/lNv0oJ2pGVjJsRkfwm5FA=="
"resolved" "https://registry.npmmirror.com/less/-/less-4.1.3.tgz"
"version" "4.1.3"
dependencies:
"copy-anything" "^2.0.1"
"parse-node-version" "^1.0.1"
"tslib" "^2.3.0"
optionalDependencies:
"errno" "^0.1.1"
"graceful-fs" "^4.1.2"
"image-size" "~0.5.0"
"make-dir" "^2.1.0"
"mime" "^1.4.1"
"needle" "^3.1.0"
"source-map" "~0.6.0"
"levn@^0.4.1": "levn@^0.4.1":
"integrity" "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==" "integrity" "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ=="
"resolved" "https://registry.npmmirror.com/levn/-/levn-0.4.1.tgz" "resolved" "https://registry.npmmirror.com/levn/-/levn-0.4.1.tgz"
@ -6629,6 +6681,14 @@
"pify" "^4.0.1" "pify" "^4.0.1"
"semver" "^5.6.0" "semver" "^5.6.0"
"make-dir@^2.1.0":
"integrity" "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA=="
"resolved" "https://registry.npmmirror.com/make-dir/-/make-dir-2.1.0.tgz"
"version" "2.1.0"
dependencies:
"pify" "^4.0.1"
"semver" "^5.6.0"
"make-dir@^3.0.2", "make-dir@^3.1.0": "make-dir@^3.0.2", "make-dir@^3.1.0":
"integrity" "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==" "integrity" "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw=="
"resolved" "https://registry.npmmirror.com/make-dir/-/make-dir-3.1.0.tgz" "resolved" "https://registry.npmmirror.com/make-dir/-/make-dir-3.1.0.tgz"
@ -6819,6 +6879,11 @@
dependencies: dependencies:
"mime-db" "1.52.0" "mime-db" "1.52.0"
"mime@^1.4.1":
"integrity" "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
"resolved" "https://registry.npmmirror.com/mime/-/mime-1.6.0.tgz"
"version" "1.6.0"
"mime@^2.4.4": "mime@^2.4.4":
"integrity" "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==" "integrity" "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg=="
"resolved" "https://registry.npmmirror.com/mime/-/mime-2.6.0.tgz" "resolved" "https://registry.npmmirror.com/mime/-/mime-2.6.0.tgz"
@ -7111,6 +7176,15 @@
"resolved" "https://registry.npmmirror.com/natural-compare/-/natural-compare-1.4.0.tgz" "resolved" "https://registry.npmmirror.com/natural-compare/-/natural-compare-1.4.0.tgz"
"version" "1.4.0" "version" "1.4.0"
"needle@^3.1.0":
"integrity" "sha512-oUvzXnyLiVyVGoianLijF9O/RecZUf7TkBfimjGrLM4eQhXyeJwM6GeAWccwfQ9aa4gMCZKqhAOuLaMIcQxajQ=="
"resolved" "https://registry.npmmirror.com/needle/-/needle-3.2.0.tgz"
"version" "3.2.0"
dependencies:
"debug" "^3.2.6"
"iconv-lite" "^0.6.3"
"sax" "^1.2.4"
"negotiator@0.6.3": "negotiator@0.6.3":
"integrity" "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" "integrity" "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg=="
"resolved" "https://registry.npmmirror.com/negotiator/-/negotiator-0.6.3.tgz" "resolved" "https://registry.npmmirror.com/negotiator/-/negotiator-0.6.3.tgz"
@ -7607,6 +7681,11 @@
"json-parse-even-better-errors" "^2.3.0" "json-parse-even-better-errors" "^2.3.0"
"lines-and-columns" "^1.1.6" "lines-and-columns" "^1.1.6"
"parse-node-version@^1.0.1":
"integrity" "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA=="
"resolved" "https://registry.npmmirror.com/parse-node-version/-/parse-node-version-1.0.1.tgz"
"version" "1.0.1"
"parse5-htmlparser2-tree-adapter@^6.0.0": "parse5-htmlparser2-tree-adapter@^6.0.0":
"integrity" "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==" "integrity" "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA=="
"resolved" "https://registry.npmmirror.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz" "resolved" "https://registry.npmmirror.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz"
@ -8850,7 +8929,7 @@
dependencies: dependencies:
"ret" "~0.1.10" "ret" "~0.1.10"
"safer-buffer@^2.0.2", "safer-buffer@^2.1.0", "safer-buffer@>= 2.1.2 < 3", "safer-buffer@~2.1.0": "safer-buffer@^2.0.2", "safer-buffer@^2.1.0", "safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", "safer-buffer@~2.1.0":
"integrity" "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" "integrity" "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
"resolved" "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz" "resolved" "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz"
"version" "2.1.2" "version" "2.1.2"
@ -10017,7 +10096,7 @@
"resolved" "https://registry.npmmirror.com/tslib/-/tslib-2.4.1.tgz" "resolved" "https://registry.npmmirror.com/tslib/-/tslib-2.4.1.tgz"
"version" "2.4.1" "version" "2.4.1"
"tslib@2.3.0": "tslib@^2.3.0", "tslib@2.3.0":
"integrity" "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==" "integrity" "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
"resolved" "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz" "resolved" "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz"
"version" "2.3.0" "version" "2.3.0"