Commit 188d8802391a100c14e451a73864d8795cf9b71e
1 parent
431569fd
mp:增加【图片】素材的选择
Showing
23 changed files
with
187 additions
and
1076 deletions
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/material/MpMaterialController.http
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/material/MpMaterialController.java
| 1 | package cn.iocoder.yudao.module.mp.controller.admin.material; | 1 | package cn.iocoder.yudao.module.mp.controller.admin.material; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | -import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadPermanentReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadRespVO; | ||
| 6 | -import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadTemporaryReqVO; | 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | +import cn.iocoder.yudao.module.mp.controller.admin.material.vo.*; | ||
| 7 | import cn.iocoder.yudao.module.mp.convert.material.MpMaterialConvert; | 6 | import cn.iocoder.yudao.module.mp.convert.material.MpMaterialConvert; |
| 8 | import cn.iocoder.yudao.module.mp.dal.dataobject.material.MpMaterialDO; | 7 | import cn.iocoder.yudao.module.mp.dal.dataobject.material.MpMaterialDO; |
| 9 | import cn.iocoder.yudao.module.mp.service.material.MpMaterialService; | 8 | import cn.iocoder.yudao.module.mp.service.material.MpMaterialService; |
| 10 | import io.swagger.annotations.Api; | 9 | import io.swagger.annotations.Api; |
| 11 | import io.swagger.annotations.ApiOperation; | 10 | import io.swagger.annotations.ApiOperation; |
| 12 | import org.springframework.validation.annotation.Validated; | 11 | import org.springframework.validation.annotation.Validated; |
| 12 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 13 | import org.springframework.web.bind.annotation.PostMapping; | 13 | import org.springframework.web.bind.annotation.PostMapping; |
| 14 | import org.springframework.web.bind.annotation.RequestMapping; | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
| 15 | import org.springframework.web.bind.annotation.RestController; | 15 | import org.springframework.web.bind.annotation.RestController; |
| @@ -45,4 +45,11 @@ public class MpMaterialController { | @@ -45,4 +45,11 @@ public class MpMaterialController { | ||
| 45 | return success(MpMaterialConvert.INSTANCE.convert(material)); | 45 | return success(MpMaterialConvert.INSTANCE.convert(material)); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | + @ApiOperation("获得素材分页") | ||
| 49 | + @GetMapping("/page") | ||
| 50 | + public CommonResult<PageResult<MpMaterialRespVO>> getMaterialPage(@Valid MpMaterialPageReqVO pageReqVO) { | ||
| 51 | + PageResult<MpMaterialDO> pageResult = mpMaterialService.getMaterialPage(pageReqVO); | ||
| 52 | + return success(MpMaterialConvert.INSTANCE.convertPage(pageResult)); | ||
| 53 | + } | ||
| 54 | + | ||
| 48 | } | 55 | } |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/material/vo/MpMaterialPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mp.controller.admin.material.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import lombok.EqualsAndHashCode; | ||
| 8 | +import lombok.ToString; | ||
| 9 | + | ||
| 10 | +@ApiModel("管理后台 - 公众号素材的分页 Request VO") | ||
| 11 | +@Data | ||
| 12 | +@EqualsAndHashCode(callSuper = true) | ||
| 13 | +@ToString(callSuper = true) | ||
| 14 | +public class MpMaterialPageReqVO extends PageParam { | ||
| 15 | + | ||
| 16 | + @ApiModelProperty(value = "是否永久", example = "true") | ||
| 17 | + private Boolean permanent; | ||
| 18 | + | ||
| 19 | + @ApiModelProperty(value = "文件类型", example = "image", notes = "参见 WxConsts.MediaFileType 枚举") | ||
| 20 | + private String type; | ||
| 21 | + | ||
| 22 | +} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/material/vo/MpMaterialRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mp.controller.admin.material.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModel; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +@ApiModel("管理后台 - 公众号素材 Response VO") | ||
| 8 | +@Data | ||
| 9 | +public class MpMaterialRespVO { | ||
| 10 | + | ||
| 11 | + @ApiModelProperty(value = "主键", required = true, example = "1024") | ||
| 12 | + private Long id; | ||
| 13 | + | ||
| 14 | + @ApiModelProperty(value = "公众号账号的编号", required = true, example = "1") | ||
| 15 | + private Long accountId; | ||
| 16 | + @ApiModelProperty(value = "公众号账号的 appId", required = true, example = "wx1234567890") | ||
| 17 | + private String appId; | ||
| 18 | + | ||
| 19 | + @ApiModelProperty(value = "素材的 media_id", required = true, example = "123") | ||
| 20 | + private String mediaId; | ||
| 21 | + | ||
| 22 | + @ApiModelProperty(value = "文件类型", required = true, example = "image", notes = "参见 WxConsts.MediaFileType 枚举") | ||
| 23 | + private String type; | ||
| 24 | + | ||
| 25 | + @ApiModelProperty(value = "是否永久", required = true, example = "true", notes = "true - 永久;false - 临时") | ||
| 26 | + private Boolean permanent; | ||
| 27 | + | ||
| 28 | + @ApiModelProperty(value = "素材的 URL", required = true, example = "https://www.iocoder.cn/1.png") | ||
| 29 | + private String url; | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + @ApiModelProperty(value = "名字", example = "yunai.png") | ||
| 33 | + private String name; | ||
| 34 | + | ||
| 35 | + @ApiModelProperty(value = "公众号文件 URL", example = "https://mmbiz.qpic.cn/xxx.mp3", notes = "只有【永久素材】使用") | ||
| 36 | + private String mpUrl; | ||
| 37 | + | ||
| 38 | + @ApiModelProperty(value = "视频素材的标题", example = "我是标题", notes = "只有【永久素材】使用") | ||
| 39 | + private String title; | ||
| 40 | + @ApiModelProperty(value = "视频素材的描述", example = "我是介绍", notes = "只有【永久素材】使用") | ||
| 41 | + private String introduction; | ||
| 42 | +} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/material/MpMaterialConvert.java
| 1 | package cn.iocoder.yudao.module.mp.convert.material; | 1 | package cn.iocoder.yudao.module.mp.convert.material; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialRespVO; | ||
| 3 | import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadRespVO; | 5 | import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadRespVO; |
| 4 | import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO; | 6 | import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO; |
| 5 | import cn.iocoder.yudao.module.mp.dal.dataobject.material.MpMaterialDO; | 7 | import cn.iocoder.yudao.module.mp.dal.dataobject.material.MpMaterialDO; |
| @@ -20,8 +22,10 @@ public interface MpMaterialConvert { | @@ -20,8 +22,10 @@ public interface MpMaterialConvert { | ||
| 20 | @Mapping(target = "id", ignore = true), | 22 | @Mapping(target = "id", ignore = true), |
| 21 | @Mapping(source = "account.id", target = "accountId"), | 23 | @Mapping(source = "account.id", target = "accountId"), |
| 22 | @Mapping(source = "account.appId", target = "appId"), | 24 | @Mapping(source = "account.appId", target = "appId"), |
| 25 | + @Mapping(source = "name", target = "name") | ||
| 23 | }) | 26 | }) |
| 24 | - MpMaterialDO convert(String mediaId, String type, String url, MpAccountDO account); | 27 | + MpMaterialDO convert(String mediaId, String type, String url, MpAccountDO account, |
| 28 | + String name); | ||
| 25 | 29 | ||
| 26 | @Mappings({ | 30 | @Mappings({ |
| 27 | @Mapping(target = "id", ignore = true), | 31 | @Mapping(target = "id", ignore = true), |
| @@ -38,4 +42,6 @@ public interface MpMaterialConvert { | @@ -38,4 +42,6 @@ public interface MpMaterialConvert { | ||
| 38 | return new WxMpMaterial(name, file, title, introduction); | 42 | return new WxMpMaterial(name, file, title, introduction); |
| 39 | } | 43 | } |
| 40 | 44 | ||
| 45 | + PageResult<MpMaterialRespVO> convertPage(PageResult<MpMaterialDO> page); | ||
| 46 | + | ||
| 41 | } | 47 | } |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/material/MpMaterialDO.java
| @@ -69,9 +69,13 @@ public class MpMaterialDO extends BaseDO { | @@ -69,9 +69,13 @@ public class MpMaterialDO extends BaseDO { | ||
| 69 | /** | 69 | /** |
| 70 | * 名字 | 70 | * 名字 |
| 71 | * | 71 | * |
| 72 | - * 只有【永久素材】使用 | 72 | + * 永久素材:非空 |
| 73 | + * 临时素材:可能为空。 | ||
| 74 | + * 1. 为空的情况:用户主动发送的图片、语音等 | ||
| 75 | + * 2. 非空的情况:主动发送给用户的图片、语音等 | ||
| 73 | */ | 76 | */ |
| 74 | private String name; | 77 | private String name; |
| 78 | + | ||
| 75 | /** | 79 | /** |
| 76 | * 公众号文件 URL | 80 | * 公众号文件 URL |
| 77 | * | 81 | * |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/material/MpMaterialMapper.java
| 1 | package cn.iocoder.yudao.module.mp.dal.mysql.material; | 1 | package cn.iocoder.yudao.module.mp.dal.mysql.material; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialPageReqVO; | ||
| 4 | import cn.iocoder.yudao.module.mp.dal.dataobject.material.MpMaterialDO; | 7 | import cn.iocoder.yudao.module.mp.dal.dataobject.material.MpMaterialDO; |
| 5 | import org.apache.ibatis.annotations.Mapper; | 8 | import org.apache.ibatis.annotations.Mapper; |
| 6 | 9 | ||
| @@ -12,4 +15,10 @@ public interface MpMaterialMapper extends BaseMapperX<MpMaterialDO> { | @@ -12,4 +15,10 @@ public interface MpMaterialMapper extends BaseMapperX<MpMaterialDO> { | ||
| 12 | MpMaterialDO::getMediaId, mediaId); | 15 | MpMaterialDO::getMediaId, mediaId); |
| 13 | } | 16 | } |
| 14 | 17 | ||
| 18 | + default PageResult<MpMaterialDO> selectPage(MpMaterialPageReqVO pageReqVO) { | ||
| 19 | + return selectPage(pageReqVO, new LambdaQueryWrapperX<MpMaterialDO>() | ||
| 20 | + .eqIfPresent(MpMaterialDO::getPermanent, pageReqVO.getPermanent()) | ||
| 21 | + .eqIfPresent(MpMaterialDO::getType, pageReqVO.getType())); | ||
| 22 | + } | ||
| 23 | + | ||
| 15 | } | 24 | } |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/material/MpMaterialService.java
| 1 | package cn.iocoder.yudao.module.mp.service.material; | 1 | package cn.iocoder.yudao.module.mp.service.material; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialPageReqVO; | ||
| 3 | import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadPermanentReqVO; | 5 | import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadPermanentReqVO; |
| 4 | import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadTemporaryReqVO; | 6 | import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadTemporaryReqVO; |
| 5 | import cn.iocoder.yudao.module.mp.dal.dataobject.material.MpMaterialDO; | 7 | import cn.iocoder.yudao.module.mp.dal.dataobject.material.MpMaterialDO; |
| @@ -45,4 +47,12 @@ public interface MpMaterialService { | @@ -45,4 +47,12 @@ public interface MpMaterialService { | ||
| 45 | */ | 47 | */ |
| 46 | MpMaterialDO uploadPermanentMaterial(@Valid MpMaterialUploadPermanentReqVO reqVO) throws IOException; | 48 | MpMaterialDO uploadPermanentMaterial(@Valid MpMaterialUploadPermanentReqVO reqVO) throws IOException; |
| 47 | 49 | ||
| 50 | + /** | ||
| 51 | + * 获得素材分页 | ||
| 52 | + * | ||
| 53 | + * @param pageReqVO 分页请求 | ||
| 54 | + * @return 素材分页 | ||
| 55 | + */ | ||
| 56 | + PageResult<MpMaterialDO> getMaterialPage(MpMaterialPageReqVO pageReqVO); | ||
| 57 | + | ||
| 48 | } | 58 | } |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/material/MpMaterialServiceImpl.java
| @@ -4,7 +4,9 @@ import cn.hutool.core.io.FileTypeUtil; | @@ -4,7 +4,9 @@ import cn.hutool.core.io.FileTypeUtil; | ||
| 4 | import cn.hutool.core.io.FileUtil; | 4 | import cn.hutool.core.io.FileUtil; |
| 5 | import cn.hutool.core.util.ObjUtil; | 5 | import cn.hutool.core.util.ObjUtil; |
| 6 | import cn.hutool.core.util.StrUtil; | 6 | import cn.hutool.core.util.StrUtil; |
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 7 | import cn.iocoder.yudao.module.infra.api.file.FileApi; | 8 | import cn.iocoder.yudao.module.infra.api.file.FileApi; |
| 9 | +import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialPageReqVO; | ||
| 8 | import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadPermanentReqVO; | 10 | import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadPermanentReqVO; |
| 9 | import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadTemporaryReqVO; | 11 | import cn.iocoder.yudao.module.mp.controller.admin.material.vo.MpMaterialUploadTemporaryReqVO; |
| 10 | import cn.iocoder.yudao.module.mp.convert.material.MpMaterialConvert; | 12 | import cn.iocoder.yudao.module.mp.convert.material.MpMaterialConvert; |
| @@ -67,7 +69,7 @@ public class MpMaterialServiceImpl implements MpMaterialService { | @@ -67,7 +69,7 @@ public class MpMaterialServiceImpl implements MpMaterialService { | ||
| 67 | return null; | 69 | return null; |
| 68 | } | 70 | } |
| 69 | MpAccountDO account = mpAccountService.getRequiredAccount(accountId); | 71 | MpAccountDO account = mpAccountService.getRequiredAccount(accountId); |
| 70 | - material = MpMaterialConvert.INSTANCE.convert(mediaId, type, url, account) | 72 | + material = MpMaterialConvert.INSTANCE.convert(mediaId, type, url, account, null) |
| 71 | .setPermanent(false); | 73 | .setPermanent(false); |
| 72 | mpMaterialMapper.insert(material); | 74 | mpMaterialMapper.insert(material); |
| 73 | 75 | ||
| @@ -100,8 +102,8 @@ public class MpMaterialServiceImpl implements MpMaterialService { | @@ -100,8 +102,8 @@ public class MpMaterialServiceImpl implements MpMaterialService { | ||
| 100 | 102 | ||
| 101 | // 第二步,存储到数据库 | 103 | // 第二步,存储到数据库 |
| 102 | MpAccountDO account = mpAccountService.getRequiredAccount(reqVO.getAccountId()); | 104 | MpAccountDO account = mpAccountService.getRequiredAccount(reqVO.getAccountId()); |
| 103 | - MpMaterialDO material = MpMaterialConvert.INSTANCE.convert(mediaId, reqVO.getType(), url, account) | ||
| 104 | - .setPermanent(false); | 105 | + MpMaterialDO material = MpMaterialConvert.INSTANCE.convert(mediaId, reqVO.getType(), url, account, |
| 106 | + reqVO.getFile().getName()).setPermanent(false); | ||
| 105 | mpMaterialMapper.insert(material); | 107 | mpMaterialMapper.insert(material); |
| 106 | return material; | 108 | return material; |
| 107 | } | 109 | } |
| @@ -139,6 +141,11 @@ public class MpMaterialServiceImpl implements MpMaterialService { | @@ -139,6 +141,11 @@ public class MpMaterialServiceImpl implements MpMaterialService { | ||
| 139 | return material; | 141 | return material; |
| 140 | } | 142 | } |
| 141 | 143 | ||
| 144 | + @Override | ||
| 145 | + public PageResult<MpMaterialDO> getMaterialPage(MpMaterialPageReqVO pageReqVO) { | ||
| 146 | + return mpMaterialMapper.selectPage(pageReqVO); | ||
| 147 | + } | ||
| 148 | + | ||
| 142 | /** | 149 | /** |
| 143 | * 下载微信媒体文件的内容,并上传到文件服务 | 150 | * 下载微信媒体文件的内容,并上传到文件服务 |
| 144 | * | 151 | * |
yudao-ui-admin/src/api/mp/material.js
0 → 100644
yudao-ui-admin/src/api/wechatMp/wxFansMsgRes.js deleted
| 1 | -import request from '@/utils/request' | ||
| 2 | - | ||
| 3 | -// 创建回复粉丝消息历史表 | ||
| 4 | -export function createWxFansMsgRes(data) { | ||
| 5 | - return request({ | ||
| 6 | - url: '/wechatMp/wx-fans-msg-res/create', | ||
| 7 | - method: 'post', | ||
| 8 | - data: data | ||
| 9 | - }) | ||
| 10 | -} | ||
| 11 | - | ||
| 12 | -// 更新回复粉丝消息历史表 | ||
| 13 | -export function updateWxFansMsgRes(data) { | ||
| 14 | - return request({ | ||
| 15 | - url: '/wechatMp/wx-fans-msg-res/update', | ||
| 16 | - method: 'put', | ||
| 17 | - data: data | ||
| 18 | - }) | ||
| 19 | -} | ||
| 20 | - | ||
| 21 | -// 删除回复粉丝消息历史表 | ||
| 22 | -export function deleteWxFansMsgRes(id) { | ||
| 23 | - return request({ | ||
| 24 | - url: '/wechatMp/wx-fans-msg-res/delete?id=' + id, | ||
| 25 | - method: 'delete' | ||
| 26 | - }) | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -// 获得回复粉丝消息历史表 | ||
| 30 | -export function getWxFansMsgRes(id) { | ||
| 31 | - return request({ | ||
| 32 | - url: '/wechatMp/wx-fans-msg-res/get?id=' + id, | ||
| 33 | - method: 'get' | ||
| 34 | - }) | ||
| 35 | -} | ||
| 36 | - | ||
| 37 | -// 获得回复粉丝消息历史表 分页 | ||
| 38 | -export function getWxFansMsgResPage(query) { | ||
| 39 | - return request({ | ||
| 40 | - url: '/wechatMp/wx-fans-msg-res/page', | ||
| 41 | - method: 'get', | ||
| 42 | - params: query | ||
| 43 | - }) | ||
| 44 | -} | ||
| 45 | - | ||
| 46 | -// 导出回复粉丝消息历史表 Excel | ||
| 47 | -export function exportWxFansMsgResExcel(query) { | ||
| 48 | - return request({ | ||
| 49 | - url: '/wechatMp/wx-fans-msg-res/export-excel', | ||
| 50 | - method: 'get', | ||
| 51 | - params: query, | ||
| 52 | - responseType: 'blob' | ||
| 53 | - }) | ||
| 54 | -} |
yudao-ui-admin/src/api/wechatMp/wxMediaUpload.js deleted
| 1 | -import request from '@/utils/request' | ||
| 2 | - | ||
| 3 | -// 创建微信素材上传表 | ||
| 4 | -export function createWxMediaUpload(data) { | ||
| 5 | - return request({ | ||
| 6 | - url: '/wechatMp/wx-media-upload/create', | ||
| 7 | - method: 'post', | ||
| 8 | - data: data | ||
| 9 | - }) | ||
| 10 | -} | ||
| 11 | - | ||
| 12 | -// 更新微信素材上传表 | ||
| 13 | -export function updateWxMediaUpload(data) { | ||
| 14 | - return request({ | ||
| 15 | - url: '/wechatMp/wx-media-upload/update', | ||
| 16 | - method: 'put', | ||
| 17 | - data: data | ||
| 18 | - }) | ||
| 19 | -} | ||
| 20 | - | ||
| 21 | -// 删除微信素材上传表 | ||
| 22 | -export function deleteWxMediaUpload(id) { | ||
| 23 | - return request({ | ||
| 24 | - url: '/wechatMp/wx-media-upload/delete?id=' + id, | ||
| 25 | - method: 'delete' | ||
| 26 | - }) | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -// 获得微信素材上传表 | ||
| 30 | -export function getWxMediaUpload(id) { | ||
| 31 | - return request({ | ||
| 32 | - url: '/wechatMp/wx-media-upload/get?id=' + id, | ||
| 33 | - method: 'get' | ||
| 34 | - }) | ||
| 35 | -} | ||
| 36 | - | ||
| 37 | -// 获得微信素材上传表 分页 | ||
| 38 | -export function getWxMediaUploadPage(query) { | ||
| 39 | - return request({ | ||
| 40 | - url: '/wechatMp/wx-media-upload/page', | ||
| 41 | - method: 'get', | ||
| 42 | - params: query | ||
| 43 | - }) | ||
| 44 | -} | ||
| 45 | - | ||
| 46 | -// 导出微信素材上传表 Excel | ||
| 47 | -export function exportWxMediaUploadExcel(query) { | ||
| 48 | - return request({ | ||
| 49 | - url: '/wechatMp/wx-media-upload/export-excel', | ||
| 50 | - method: 'get', | ||
| 51 | - params: query, | ||
| 52 | - responseType: 'blob' | ||
| 53 | - }) | ||
| 54 | -} |
yudao-ui-admin/src/api/wechatMp/wxMenu.js deleted
| 1 | -import request from '@/utils/request' | ||
| 2 | - | ||
| 3 | -// 创建微信菜单 | ||
| 4 | -export function createWxMenu(data) { | ||
| 5 | - return request({ | ||
| 6 | - url: '/wechatMp/wx-menu/create', | ||
| 7 | - method: 'post', | ||
| 8 | - data: data | ||
| 9 | - }) | ||
| 10 | -} | ||
| 11 | - | ||
| 12 | -// 更新微信菜单 | ||
| 13 | -export function updateWxMenu(data) { | ||
| 14 | - return request({ | ||
| 15 | - url: '/wechatMp/wx-menu/update', | ||
| 16 | - method: 'put', | ||
| 17 | - data: data | ||
| 18 | - }) | ||
| 19 | -} | ||
| 20 | - | ||
| 21 | -// 删除微信菜单 | ||
| 22 | -export function deleteWxMenu(id) { | ||
| 23 | - return request({ | ||
| 24 | - url: '/wechatMp/wx-menu/delete?id=' + id, | ||
| 25 | - method: 'delete' | ||
| 26 | - }) | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -// 获得微信菜单 | ||
| 30 | -export function getWxMenu(id) { | ||
| 31 | - return request({ | ||
| 32 | - url: '/wechatMp/wx-menu/get?id=' + id, | ||
| 33 | - method: 'get' | ||
| 34 | - }) | ||
| 35 | -} | ||
| 36 | - | ||
| 37 | -// 获得微信菜单分页 | ||
| 38 | -export function getWxMenuPage(query) { | ||
| 39 | - return request({ | ||
| 40 | - url: '/wechatMp/wx-menu/page', | ||
| 41 | - method: 'get', | ||
| 42 | - params: query | ||
| 43 | - }) | ||
| 44 | -} | ||
| 45 | - | ||
| 46 | -// 导出微信菜单 Excel | ||
| 47 | -export function exportWxMenuExcel(query) { | ||
| 48 | - return request({ | ||
| 49 | - url: '/wechatMp/wx-menu/export-excel', | ||
| 50 | - method: 'get', | ||
| 51 | - params: query, | ||
| 52 | - responseType: 'blob' | ||
| 53 | - }) | ||
| 54 | -} |
yudao-ui-admin/src/api/wechatMp/wxNewsArticleItem.js deleted
| 1 | -import request from '@/utils/request' | ||
| 2 | - | ||
| 3 | -// 创建图文消息文章列表表 | ||
| 4 | -export function createWxNewsArticleItem(data) { | ||
| 5 | - return request({ | ||
| 6 | - url: '/wechatMp/wx-news-article-item/create', | ||
| 7 | - method: 'post', | ||
| 8 | - data: data | ||
| 9 | - }) | ||
| 10 | -} | ||
| 11 | - | ||
| 12 | -// 更新图文消息文章列表表 | ||
| 13 | -export function updateWxNewsArticleItem(data) { | ||
| 14 | - return request({ | ||
| 15 | - url: '/wechatMp/wx-news-article-item/update', | ||
| 16 | - method: 'put', | ||
| 17 | - data: data | ||
| 18 | - }) | ||
| 19 | -} | ||
| 20 | - | ||
| 21 | -// 删除图文消息文章列表表 | ||
| 22 | -export function deleteWxNewsArticleItem(id) { | ||
| 23 | - return request({ | ||
| 24 | - url: '/wechatMp/wx-news-article-item/delete?id=' + id, | ||
| 25 | - method: 'delete' | ||
| 26 | - }) | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -// 获得图文消息文章列表表 | ||
| 30 | -export function getWxNewsArticleItem(id) { | ||
| 31 | - return request({ | ||
| 32 | - url: '/wechatMp/wx-news-article-item/get?id=' + id, | ||
| 33 | - method: 'get' | ||
| 34 | - }) | ||
| 35 | -} | ||
| 36 | - | ||
| 37 | -// 获得图文消息文章列表表 分页 | ||
| 38 | -export function getWxNewsArticleItemPage(query) { | ||
| 39 | - return request({ | ||
| 40 | - url: '/wechatMp/wx-news-article-item/page', | ||
| 41 | - method: 'get', | ||
| 42 | - params: query | ||
| 43 | - }) | ||
| 44 | -} | ||
| 45 | - | ||
| 46 | -// 导出图文消息文章列表表 Excel | ||
| 47 | -export function exportWxNewsArticleItemExcel(query) { | ||
| 48 | - return request({ | ||
| 49 | - url: '/wechatMp/wx-news-article-item/export-excel', | ||
| 50 | - method: 'get', | ||
| 51 | - params: query, | ||
| 52 | - responseType: 'blob' | ||
| 53 | - }) | ||
| 54 | -} |
yudao-ui-admin/src/api/wechatMp/wxNewsTemplate.js deleted
| 1 | -import request from '@/utils/request' | ||
| 2 | - | ||
| 3 | -// 创建图文消息模板 | ||
| 4 | -export function createWxNewsTemplate(data) { | ||
| 5 | - return request({ | ||
| 6 | - url: '/wechatMp/wx-news-template/create', | ||
| 7 | - method: 'post', | ||
| 8 | - data: data | ||
| 9 | - }) | ||
| 10 | -} | ||
| 11 | - | ||
| 12 | -// 更新图文消息模板 | ||
| 13 | -export function updateWxNewsTemplate(data) { | ||
| 14 | - return request({ | ||
| 15 | - url: '/wechatMp/wx-news-template/update', | ||
| 16 | - method: 'put', | ||
| 17 | - data: data | ||
| 18 | - }) | ||
| 19 | -} | ||
| 20 | - | ||
| 21 | -// 删除图文消息模板 | ||
| 22 | -export function deleteWxNewsTemplate(id) { | ||
| 23 | - return request({ | ||
| 24 | - url: '/wechatMp/wx-news-template/delete?id=' + id, | ||
| 25 | - method: 'delete' | ||
| 26 | - }) | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -// 获得图文消息模板 | ||
| 30 | -export function getWxNewsTemplate(id) { | ||
| 31 | - return request({ | ||
| 32 | - url: '/wechatMp/wx-news-template/get?id=' + id, | ||
| 33 | - method: 'get' | ||
| 34 | - }) | ||
| 35 | -} | ||
| 36 | - | ||
| 37 | -// 获得图文消息模板分页 | ||
| 38 | -export function getWxNewsTemplatePage(query) { | ||
| 39 | - return request({ | ||
| 40 | - url: '/wechatMp/wx-news-template/page', | ||
| 41 | - method: 'get', | ||
| 42 | - params: query | ||
| 43 | - }) | ||
| 44 | -} | ||
| 45 | - | ||
| 46 | -// 导出图文消息模板 Excel | ||
| 47 | -export function exportWxNewsTemplateExcel(query) { | ||
| 48 | - return request({ | ||
| 49 | - url: '/wechatMp/wx-news-template/export-excel', | ||
| 50 | - method: 'get', | ||
| 51 | - params: query, | ||
| 52 | - responseType: 'blob' | ||
| 53 | - }) | ||
| 54 | -} |
yudao-ui-admin/src/api/wechatMp/wxReceiveText.js deleted
| 1 | -import request from '@/utils/request' | ||
| 2 | - | ||
| 3 | -// 创建回复关键字 | ||
| 4 | -export function createWxReceiveText(data) { | ||
| 5 | - return request({ | ||
| 6 | - url: '/wechatMp/wx-receive-text/create', | ||
| 7 | - method: 'post', | ||
| 8 | - data: data | ||
| 9 | - }) | ||
| 10 | -} | ||
| 11 | - | ||
| 12 | -// 更新回复关键字 | ||
| 13 | -export function updateWxReceiveText(data) { | ||
| 14 | - return request({ | ||
| 15 | - url: '/wechatMp/wx-receive-text/update', | ||
| 16 | - method: 'put', | ||
| 17 | - data: data | ||
| 18 | - }) | ||
| 19 | -} | ||
| 20 | - | ||
| 21 | -// 删除回复关键字 | ||
| 22 | -export function deleteWxReceiveText(id) { | ||
| 23 | - return request({ | ||
| 24 | - url: '/wechatMp/wx-receive-text/delete?id=' + id, | ||
| 25 | - method: 'delete' | ||
| 26 | - }) | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -// 获得回复关键字 | ||
| 30 | -export function getWxReceiveText(id) { | ||
| 31 | - return request({ | ||
| 32 | - url: '/wechatMp/wx-receive-text/get?id=' + id, | ||
| 33 | - method: 'get' | ||
| 34 | - }) | ||
| 35 | -} | ||
| 36 | - | ||
| 37 | -// 获得回复关键字分页 | ||
| 38 | -export function getWxReceiveTextPage(query) { | ||
| 39 | - return request({ | ||
| 40 | - url: '/wechatMp/wx-receive-text/page', | ||
| 41 | - method: 'get', | ||
| 42 | - params: query | ||
| 43 | - }) | ||
| 44 | -} | ||
| 45 | - | ||
| 46 | -// 导出回复关键字 Excel | ||
| 47 | -export function exportWxReceiveTextExcel(query) { | ||
| 48 | - return request({ | ||
| 49 | - url: '/wechatMp/wx-receive-text/export-excel', | ||
| 50 | - method: 'get', | ||
| 51 | - params: query, | ||
| 52 | - responseType: 'blob' | ||
| 53 | - }) | ||
| 54 | -} |
yudao-ui-admin/src/api/wechatMp/wxSubscribeText.js deleted
| 1 | -import request from '@/utils/request' | ||
| 2 | - | ||
| 3 | -// 创建关注欢迎语 | ||
| 4 | -export function createWxSubscribeText(data) { | ||
| 5 | - return request({ | ||
| 6 | - url: '/wechatMp/wx-subscribe-text/create', | ||
| 7 | - method: 'post', | ||
| 8 | - data: data | ||
| 9 | - }) | ||
| 10 | -} | ||
| 11 | - | ||
| 12 | -// 更新关注欢迎语 | ||
| 13 | -export function updateWxSubscribeText(data) { | ||
| 14 | - return request({ | ||
| 15 | - url: '/wechatMp/wx-subscribe-text/update', | ||
| 16 | - method: 'put', | ||
| 17 | - data: data | ||
| 18 | - }) | ||
| 19 | -} | ||
| 20 | - | ||
| 21 | -// 删除关注欢迎语 | ||
| 22 | -export function deleteWxSubscribeText(id) { | ||
| 23 | - return request({ | ||
| 24 | - url: '/wechatMp/wx-subscribe-text/delete?id=' + id, | ||
| 25 | - method: 'delete' | ||
| 26 | - }) | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -// 获得关注欢迎语 | ||
| 30 | -export function getWxSubscribeText(id) { | ||
| 31 | - return request({ | ||
| 32 | - url: '/wechatMp/wx-subscribe-text/get?id=' + id, | ||
| 33 | - method: 'get' | ||
| 34 | - }) | ||
| 35 | -} | ||
| 36 | - | ||
| 37 | -// 获得关注欢迎语分页 | ||
| 38 | -export function getWxSubscribeTextPage(query) { | ||
| 39 | - return request({ | ||
| 40 | - url: '/wechatMp/wx-subscribe-text/page', | ||
| 41 | - method: 'get', | ||
| 42 | - params: query | ||
| 43 | - }) | ||
| 44 | -} | ||
| 45 | - | ||
| 46 | -// 导出关注欢迎语 Excel | ||
| 47 | -export function exportWxSubscribeTextExcel(query) { | ||
| 48 | - return request({ | ||
| 49 | - url: '/wechatMp/wx-subscribe-text/export-excel', | ||
| 50 | - method: 'get', | ||
| 51 | - params: query, | ||
| 52 | - responseType: 'blob' | ||
| 53 | - }) | ||
| 54 | -} |
yudao-ui-admin/src/api/wechatMp/wxTextTemplate.js deleted
| 1 | -import request from '@/utils/request' | ||
| 2 | - | ||
| 3 | -// 创建文本模板 | ||
| 4 | -export function createWxTextTemplate(data) { | ||
| 5 | - return request({ | ||
| 6 | - url: '/wechatMp/wx-text-template/create', | ||
| 7 | - method: 'post', | ||
| 8 | - data: data | ||
| 9 | - }) | ||
| 10 | -} | ||
| 11 | - | ||
| 12 | -// 更新文本模板 | ||
| 13 | -export function updateWxTextTemplate(data) { | ||
| 14 | - return request({ | ||
| 15 | - url: '/wechatMp/wx-text-template/update', | ||
| 16 | - method: 'put', | ||
| 17 | - data: data | ||
| 18 | - }) | ||
| 19 | -} | ||
| 20 | - | ||
| 21 | -// 删除文本模板 | ||
| 22 | -export function deleteWxTextTemplate(id) { | ||
| 23 | - return request({ | ||
| 24 | - url: '/wechatMp/wx-text-template/delete?id=' + id, | ||
| 25 | - method: 'delete' | ||
| 26 | - }) | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -// 获得文本模板 | ||
| 30 | -export function getWxTextTemplate(id) { | ||
| 31 | - return request({ | ||
| 32 | - url: '/wechatMp/wx-text-template/get?id=' + id, | ||
| 33 | - method: 'get' | ||
| 34 | - }) | ||
| 35 | -} | ||
| 36 | - | ||
| 37 | -// 获得文本模板分页 | ||
| 38 | -export function getWxTextTemplatePage(query) { | ||
| 39 | - return request({ | ||
| 40 | - url: '/wechatMp/wx-text-template/page', | ||
| 41 | - method: 'get', | ||
| 42 | - params: query | ||
| 43 | - }) | ||
| 44 | -} | ||
| 45 | - | ||
| 46 | -// 导出文本模板 Excel | ||
| 47 | -export function exportWxTextTemplateExcel(query) { | ||
| 48 | - return request({ | ||
| 49 | - url: '/wechatMp/wx-text-template/export-excel', | ||
| 50 | - method: 'get', | ||
| 51 | - params: query, | ||
| 52 | - responseType: 'blob' | ||
| 53 | - }) | ||
| 54 | -} |
yudao-ui-admin/src/views/mp/components/wx-material-select/main.vue
| @@ -5,8 +5,8 @@ | @@ -5,8 +5,8 @@ | ||
| 5 | <template> | 5 | <template> |
| 6 | <!-- 类型:图片 --> | 6 | <!-- 类型:图片 --> |
| 7 | <div v-if="objData.type === 'image'"> | 7 | <div v-if="objData.type === 'image'"> |
| 8 | - <div class="waterfall" v-loading="tableLoading"> | ||
| 9 | - <div class="waterfall-item" v-for="item in tableData" :key="item.mediaId"> | 8 | + <div class="waterfall" v-loading="loading"> |
| 9 | + <div class="waterfall-item" v-for="item in list" :key="item.mediaId"> | ||
| 10 | <img class="material-img" :src="item.url"> | 10 | <img class="material-img" :src="item.url"> |
| 11 | <p class="item-name">{{item.name}}</p> | 11 | <p class="item-name">{{item.name}}</p> |
| 12 | <el-row class="ope-row"> | 12 | <el-row class="ope-row"> |
| @@ -16,16 +16,14 @@ | @@ -16,16 +16,14 @@ | ||
| 16 | </el-row> | 16 | </el-row> |
| 17 | </div> | 17 | </div> |
| 18 | </div> | 18 | </div> |
| 19 | - <div v-if="tableData.length <= 0 && !tableLoading" class="el-table__empty-block"> | 19 | + <!-- 分页组件 --> |
| 20 | + <div v-if="list.length <= 0 && !loading" class="el-table__empty-block"> | ||
| 20 | <span class="el-table__empty-text">暂无数据</span> | 21 | <span class="el-table__empty-text">暂无数据</span> |
| 21 | </div> | 22 | </div> |
| 22 | - <span slot="footer" class="dialog-footer"> | ||
| 23 | - <el-pagination @size-change="sizeChange" @current-change="currentChange" :current-page.sync="page.currentPage" | ||
| 24 | - :page-sizes="[10, 20]" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper" | ||
| 25 | - :total="page.total" class="pagination" /> | ||
| 26 | - </span> | 23 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
| 24 | + @pagination="getMaterialPage"/> | ||
| 27 | </div> | 25 | </div> |
| 28 | - <div v-else-if="objData.repType == 'voice'"> | 26 | + <div v-else-if="objData.type == 'voice'"> |
| 29 | <!-- TODO 芋艿:需要翻译 --> | 27 | <!-- TODO 芋艿:需要翻译 --> |
| 30 | <!-- <avue-crud ref="crud"--> | 28 | <!-- <avue-crud ref="crud"--> |
| 31 | <!-- :page="page"--> | 29 | <!-- :page="page"--> |
| @@ -45,7 +43,7 @@ | @@ -45,7 +43,7 @@ | ||
| 45 | <!-- </template>--> | 43 | <!-- </template>--> |
| 46 | <!-- </avue-crud>--> | 44 | <!-- </avue-crud>--> |
| 47 | </div> | 45 | </div> |
| 48 | - <div v-else-if="objData.repType == 'video'"> | 46 | + <div v-else-if="objData.type == 'video'"> |
| 49 | <!-- TODO 芋艿:需要翻译 --> | 47 | <!-- TODO 芋艿:需要翻译 --> |
| 50 | <!-- <avue-crud ref="crud"--> | 48 | <!-- <avue-crud ref="crud"--> |
| 51 | <!-- :page="page"--> | 49 | <!-- :page="page"--> |
| @@ -65,16 +63,16 @@ | @@ -65,16 +63,16 @@ | ||
| 65 | <!-- </template>--> | 63 | <!-- </template>--> |
| 66 | <!-- </avue-crud>--> | 64 | <!-- </avue-crud>--> |
| 67 | </div> | 65 | </div> |
| 68 | - <div v-else-if="objData.repType == 'news'"> | ||
| 69 | - <div class="waterfall" v-loading="tableLoading"> | ||
| 70 | - <div class="waterfall-item" v-for="item in tableData" :key="item.mediaId" v-if="item.content && item.content.articles"> | 66 | + <div v-else-if="objData.type == 'news'"> |
| 67 | + <div class="waterfall" v-loading="loading"> | ||
| 68 | + <div class="waterfall-item" v-for="item in list" :key="item.mediaId" v-if="item.content && item.content.articles"> | ||
| 71 | <WxNews :objData="item.content.articles"></WxNews> | 69 | <WxNews :objData="item.content.articles"></WxNews> |
| 72 | <el-row class="ope-row"> | 70 | <el-row class="ope-row"> |
| 73 | <el-button size="mini" type="success" @click="selectMaterial(item)">选择<i class="el-icon-circle-check el-icon--right"></i></el-button> | 71 | <el-button size="mini" type="success" @click="selectMaterial(item)">选择<i class="el-icon-circle-check el-icon--right"></i></el-button> |
| 74 | </el-row> | 72 | </el-row> |
| 75 | </div> | 73 | </div> |
| 76 | </div> | 74 | </div> |
| 77 | - <div v-if="tableData.length <=0 && !tableLoading" class="el-table__empty-block"> | 75 | + <div v-if="list.length <=0 && !loading" class="el-table__empty-block"> |
| 78 | <span class="el-table__empty-text">暂无数据</span> | 76 | <span class="el-table__empty-text">暂无数据</span> |
| 79 | </div> | 77 | </div> |
| 80 | <span slot="footer" class="dialog-footer"> | 78 | <span slot="footer" class="dialog-footer"> |
| @@ -93,12 +91,13 @@ | @@ -93,12 +91,13 @@ | ||
| 93 | </template> | 91 | </template> |
| 94 | 92 | ||
| 95 | <script> | 93 | <script> |
| 96 | - import { getPage, getMaterialVideo } from '@/api/wxmp/wxmaterial' | 94 | + |
| 97 | // import { tableOptionVoice } from '@/const/crud/wxmp/wxmaterial_voice' | 95 | // import { tableOptionVoice } from '@/const/crud/wxmp/wxmaterial_voice' |
| 98 | // import { tableOptionVideo } from '@/const/crud/wxmp/wxmaterial_video' | 96 | // import { tableOptionVideo } from '@/const/crud/wxmp/wxmaterial_video' |
| 99 | import WxNews from '@/views/mp/components/wx-news/main.vue'; | 97 | import WxNews from '@/views/mp/components/wx-news/main.vue'; |
| 100 | - import {getPage as getPageNews} from '@/api/wxmp/wxfreepublish' | ||
| 101 | - import {getPage as getPageNewsDraft} from '@/api/wxmp/wxdraft' | 98 | + import { getMaterialPage } from "@/api/mp/material"; |
| 99 | + // import {getPage as getPageNews} from '@/api/wxmp/wxfreepublish' | ||
| 100 | + // import {getPage as getPageNewsDraft} from '@/api/wxmp/wxdraft' | ||
| 102 | 101 | ||
| 103 | export default { | 102 | export default { |
| 104 | name: "wxMaterialSelect", | 103 | name: "wxMaterialSelect", |
| @@ -118,14 +117,16 @@ | @@ -118,14 +117,16 @@ | ||
| 118 | }, | 117 | }, |
| 119 | data() { | 118 | data() { |
| 120 | return { | 119 | return { |
| 121 | - tableLoading: false, | ||
| 122 | - tableData: [], | ||
| 123 | - page: { | ||
| 124 | - total: 0, // 总页数 | ||
| 125 | - currentPage: 1, // 当前页数 | ||
| 126 | - pageSize: 20, // 每页显示多少条 | ||
| 127 | - ascs:[],//升序字段 | ||
| 128 | - descs:[]//降序字段 | 120 | + // 遮罩层 |
| 121 | + loading: false, | ||
| 122 | + // 总条数 | ||
| 123 | + total: 0, | ||
| 124 | + // 数据列表 | ||
| 125 | + list: [], | ||
| 126 | + // 查询参数 | ||
| 127 | + queryParams: { | ||
| 128 | + pageNo: 1, | ||
| 129 | + pageSize: 10, | ||
| 129 | }, | 130 | }, |
| 130 | // tableOptionVoice: tableOptionVoice, | 131 | // tableOptionVoice: tableOptionVoice, |
| 131 | // tableOptionVideo: tableOptionVideo, | 132 | // tableOptionVideo: tableOptionVideo, |
| @@ -139,8 +140,8 @@ | @@ -139,8 +140,8 @@ | ||
| 139 | this.$emit('selectMaterial', item) | 140 | this.$emit('selectMaterial', item) |
| 140 | }, | 141 | }, |
| 141 | getPage(page, params) { | 142 | getPage(page, params) { |
| 142 | - this.tableLoading = true | ||
| 143 | - if(this.objData.repType == 'news'){ | 143 | + this.loading = true |
| 144 | + if(this.objData.type == 'news'){ // 【图文】 | ||
| 144 | if(this.newsType == '1'){ | 145 | if(this.newsType == '1'){ |
| 145 | getPageNews(Object.assign({ | 146 | getPageNews(Object.assign({ |
| 146 | current: page.currentPage, | 147 | current: page.currentPage, |
| @@ -152,11 +153,11 @@ | @@ -152,11 +153,11 @@ | ||
| 152 | item.mediaId = item.articleId | 153 | item.mediaId = item.articleId |
| 153 | item.content.articles = item.content.newsItem | 154 | item.content.articles = item.content.newsItem |
| 154 | }) | 155 | }) |
| 155 | - this.tableData = tableData | 156 | + this.list = tableData |
| 156 | this.page.total = response.data.totalCount | 157 | this.page.total = response.data.totalCount |
| 157 | this.page.currentPage = page.currentPage | 158 | this.page.currentPage = page.currentPage |
| 158 | this.page.pageSize = page.pageSize | 159 | this.page.pageSize = page.pageSize |
| 159 | - this.tableLoading = false | 160 | + this.loading = false |
| 160 | }) | 161 | }) |
| 161 | }else if(this.newsType == '2'){ | 162 | }else if(this.newsType == '2'){ |
| 162 | getPageNewsDraft(Object.assign({ | 163 | getPageNewsDraft(Object.assign({ |
| @@ -169,28 +170,28 @@ | @@ -169,28 +170,28 @@ | ||
| 169 | item.mediaId = item.mediaId | 170 | item.mediaId = item.mediaId |
| 170 | item.content.articles = item.content.newsItem | 171 | item.content.articles = item.content.newsItem |
| 171 | }) | 172 | }) |
| 172 | - this.tableData = tableData | 173 | + this.list = tableData |
| 173 | this.page.total = response.data.totalCount | 174 | this.page.total = response.data.totalCount |
| 174 | this.page.currentPage = page.currentPage | 175 | this.page.currentPage = page.currentPage |
| 175 | this.page.pageSize = page.pageSize | 176 | this.page.pageSize = page.pageSize |
| 176 | - this.tableLoading = false | 177 | + this.loading = false |
| 177 | }) | 178 | }) |
| 178 | } | 179 | } |
| 179 | - }else{ | ||
| 180 | - getPage(Object.assign({ | ||
| 181 | - current: page.currentPage, | ||
| 182 | - size: page.pageSize, | ||
| 183 | - appId:this.appId, | ||
| 184 | - type:this.objData.repType | ||
| 185 | - }, params)).then(response => { | ||
| 186 | - this.tableData = response.data.items | ||
| 187 | - this.page.total = response.data.totalCount | ||
| 188 | - this.page.currentPage = page.currentPage | ||
| 189 | - this.page.pageSize = page.pageSize | ||
| 190 | - this.tableLoading = false | ||
| 191 | - }) | 180 | + } else { // 【素材】 |
| 181 | + this.getMaterialPage(); | ||
| 192 | } | 182 | } |
| 193 | }, | 183 | }, |
| 184 | + getMaterialPage() { | ||
| 185 | + getMaterialPage({ | ||
| 186 | + ...this.queryParams, | ||
| 187 | + type: this.objData.type | ||
| 188 | + }).then(response => { | ||
| 189 | + this.list = response.data.list | ||
| 190 | + this.total = response.data.total | ||
| 191 | + }).finally(() => { | ||
| 192 | + this.loading = false | ||
| 193 | + }) | ||
| 194 | + }, | ||
| 194 | sizeChange(val) { | 195 | sizeChange(val) { |
| 195 | this.page.currentPage = 1 | 196 | this.page.currentPage = 1 |
| 196 | this.page.pageSize = val | 197 | this.page.pageSize = val |
yudao-ui-admin/src/views/mp/components/wx-msg/main.vue
| @@ -81,21 +81,21 @@ | @@ -81,21 +81,21 @@ | ||
| 81 | </div> | 81 | </div> |
| 82 | </div> | 82 | </div> |
| 83 | <div class="msg-send" v-loading="sendLoading"> | 83 | <div class="msg-send" v-loading="sendLoading"> |
| 84 | - <wx-reply-select :objData="objData" /> | 84 | + <wx-reply-select ref="replySelect" :objData="objData" /> |
| 85 | <el-button type="success" size="small" class="send-but" @click="sendMsg">发送(S)</el-button> | 85 | <el-button type="success" size="small" class="send-but" @click="sendMsg">发送(S)</el-button> |
| 86 | </div> | 86 | </div> |
| 87 | </div> | 87 | </div> |
| 88 | </template> | 88 | </template> |
| 89 | 89 | ||
| 90 | <script> | 90 | <script> |
| 91 | -import {getMessagePage, sendMessage} from '@/api/mp/message' | 91 | +import { getMessagePage, sendMessage } from '@/api/mp/message' |
| 92 | import WxReplySelect from '@/views/mp/components/wx-reply/main.vue' | 92 | import WxReplySelect from '@/views/mp/components/wx-reply/main.vue' |
| 93 | import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue'; | 93 | import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue'; |
| 94 | import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'; | 94 | import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'; |
| 95 | import WxNews from '@/views/mp/components/wx-news/main.vue'; | 95 | import WxNews from '@/views/mp/components/wx-news/main.vue'; |
| 96 | import WxLocation from '@/views/mp/components/wx-location/main.vue'; | 96 | import WxLocation from '@/views/mp/components/wx-location/main.vue'; |
| 97 | import WxMusic from '@/views/mp/components/wx-music/main.vue'; | 97 | import WxMusic from '@/views/mp/components/wx-music/main.vue'; |
| 98 | -import {getUser} from "@/api/mp/user"; | 98 | +import { getUser } from "@/api/mp/user"; |
| 99 | 99 | ||
| 100 | export default { | 100 | export default { |
| 101 | name: "wxMsg", | 101 | name: "wxMsg", |
| @@ -176,6 +176,7 @@ import {getUser} from "@/api/mp/user"; | @@ -176,6 +176,7 @@ import {getUser} from "@/api/mp/user"; | ||
| 176 | this.tableData = [...this.tableData , ...[response.data] ] | 176 | this.tableData = [...this.tableData , ...[response.data] ] |
| 177 | this.scrollToBottom() | 177 | this.scrollToBottom() |
| 178 | // 重置 objData 状态 | 178 | // 重置 objData 状态 |
| 179 | + this.$refs['replySelect'].deleteObj(); // 重置,避免 tab 的数据未清理 | ||
| 179 | this.objData = { | 180 | this.objData = { |
| 180 | type: 'text', | 181 | type: 'text', |
| 181 | content: '', | 182 | content: '', |
yudao-ui-admin/src/views/mp/components/wx-reply/main.vue
| @@ -29,7 +29,9 @@ | @@ -29,7 +29,9 @@ | ||
| 29 | <el-row style="text-align: center"> | 29 | <el-row style="text-align: center"> |
| 30 | <!-- 选择素材 --> | 30 | <!-- 选择素材 --> |
| 31 | <el-col :span="12" class="col-select"> | 31 | <el-col :span="12" class="col-select"> |
| 32 | - <el-button type="success" @click="openMaterial">素材库选择<i class="el-icon-circle-check el-icon--right"></i></el-button> | 32 | + <el-button type="success" @click="openMaterial"> |
| 33 | + 素材库选择<i class="el-icon-circle-check el-icon--right"></i> | ||
| 34 | + </el-button> | ||
| 33 | </el-col> | 35 | </el-col> |
| 34 | <!-- 文件上传 --> | 36 | <!-- 文件上传 --> |
| 35 | <el-col :span="12" class="col-add"> | 37 | <el-col :span="12" class="col-add"> |
| @@ -43,7 +45,7 @@ | @@ -43,7 +45,7 @@ | ||
| 43 | </div> | 45 | </div> |
| 44 | <!-- 点击选择素材,会打开下面的弹窗 --> | 46 | <!-- 点击选择素材,会打开下面的弹窗 --> |
| 45 | <el-dialog title="选择图片" :visible.sync="dialogImageVisible" width="90%" append-to-body> | 47 | <el-dialog title="选择图片" :visible.sync="dialogImageVisible" width="90%" append-to-body> |
| 46 | - <WxMaterialSelect :objData="objData" @selectMaterial="selectMaterial"></WxMaterialSelect> | 48 | + <wx-material-select :obj-data="objData" @selectMaterial="selectMaterial" /> |
| 47 | </el-dialog> | 49 | </el-dialog> |
| 48 | </el-row> | 50 | </el-row> |
| 49 | </el-tab-pane> | 51 | </el-tab-pane> |
| @@ -155,16 +157,16 @@ | @@ -155,16 +157,16 @@ | ||
| 155 | 157 | ||
| 156 | <script> | 158 | <script> |
| 157 | // import { getPage, getMaterialVideo } from '@/api/wxmp/wxmaterial' | 159 | // import { getPage, getMaterialVideo } from '@/api/wxmp/wxmaterial' |
| 160 | + import {getAccessToken} from '@/utils/auth' | ||
| 158 | import WxNews from '@/views/mp/components/wx-news/main.vue' | 161 | import WxNews from '@/views/mp/components/wx-news/main.vue' |
| 159 | - // import WxMaterialSelect from '@/components/wx-material-select/main.vue' | 162 | + import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue' |
| 160 | import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'; | 163 | import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'; |
| 161 | - import {getAccessToken} from '@/utils/auth' | ||
| 162 | 164 | ||
| 163 | export default { | 165 | export default { |
| 164 | name: "wxReplySelect", | 166 | name: "wxReplySelect", |
| 165 | components: { | 167 | components: { |
| 166 | WxNews, | 168 | WxNews, |
| 167 | - // WxMaterialSelect, | 169 | + WxMaterialSelect, |
| 168 | WxVoicePlayer | 170 | WxVoicePlayer |
| 169 | }, | 171 | }, |
| 170 | props: { | 172 | props: { |
| @@ -403,8 +405,7 @@ | @@ -403,8 +405,7 @@ | ||
| 403 | // TODO 芋艿,待实现 | 405 | // TODO 芋艿,待实现 |
| 404 | } else if(this.objData.type === 'image' | 406 | } else if(this.objData.type === 'image' |
| 405 | || this.objData.type === 'voice') { | 407 | || this.objData.type === 'voice') { |
| 406 | - this.$delete(this.objData, 'url') | ||
| 407 | - this.$delete(this.objData, 'mediaId') | 408 | + this.selectMaterial({}) // 选择一个空的素材 |
| 408 | } else if(this.objData.type === 'video') { | 409 | } else if(this.objData.type === 'video') { |
| 409 | // TODO 芋艿,待实现 | 410 | // TODO 芋艿,待实现 |
| 410 | } | 411 | } |
yudao-ui-admin/src/views/wechatMp/wxMediaUpload/index.vue deleted
| 1 | -<template> | ||
| 2 | - <div class="app-container"> | ||
| 3 | - | ||
| 4 | - <!-- 搜索工作栏 --> | ||
| 5 | - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> | ||
| 6 | - <el-form-item label="类型" prop="type"> | ||
| 7 | - <el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small"> | ||
| 8 | - <el-option label="请选择字典生成" value=""/> | ||
| 9 | - </el-select> | ||
| 10 | - </el-form-item> | ||
| 11 | - <el-form-item label="图片URL" prop="url"> | ||
| 12 | - <el-input v-model="queryParams.url" placeholder="请输入图片URL" clearable @keyup.enter.native="handleQuery"/> | ||
| 13 | - </el-form-item> | ||
| 14 | - <el-form-item label="素材ID" prop="mediaId"> | ||
| 15 | - <el-input v-model="queryParams.mediaId" placeholder="请输入素材ID" clearable @keyup.enter.native="handleQuery"/> | ||
| 16 | - </el-form-item> | ||
| 17 | - <el-form-item label="缩略图素材ID" prop="thumbMediaId"> | ||
| 18 | - <el-input v-model="queryParams.thumbMediaId" placeholder="请输入缩略图素材ID" clearable | ||
| 19 | - @keyup.enter.native="handleQuery"/> | ||
| 20 | - </el-form-item> | ||
| 21 | - <el-form-item label="微信账号ID" prop="wxAccountId"> | ||
| 22 | - <el-input v-model="queryParams.wxAccountId" placeholder="请输入微信账号ID" clearable | ||
| 23 | - @keyup.enter.native="handleQuery"/> | ||
| 24 | - </el-form-item> | ||
| 25 | - <el-form-item label="创建时间"> | ||
| 26 | - <el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" | ||
| 27 | - type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/> | ||
| 28 | - </el-form-item> | ||
| 29 | - <el-form-item> | ||
| 30 | - <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | ||
| 31 | - <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | ||
| 32 | - </el-form-item> | ||
| 33 | - </el-form> | ||
| 34 | - | ||
| 35 | - <!-- 操作工具栏 --> | ||
| 36 | - <el-row :gutter="10" class="mb8"> | ||
| 37 | - <el-col :span="1.5"> | ||
| 38 | - <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | ||
| 39 | - v-hasPermi="['wechatMp:wx-media-upload:create']">新增 | ||
| 40 | - </el-button> | ||
| 41 | - </el-col> | ||
| 42 | - <el-col :span="1.5"> | ||
| 43 | - <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" | ||
| 44 | - :loading="exportLoading" | ||
| 45 | - v-hasPermi="['wechatMp:wx-media-upload:export']">导出 | ||
| 46 | - </el-button> | ||
| 47 | - </el-col> | ||
| 48 | - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||
| 49 | - </el-row> | ||
| 50 | - | ||
| 51 | - <!-- 列表 --> | ||
| 52 | - <el-table v-loading="loading" :data="list"> | ||
| 53 | - <el-table-column label="主键" align="center" prop="id"/> | ||
| 54 | - <el-table-column label="类型" align="center" prop="type"/> | ||
| 55 | - <el-table-column label="图片URL" align="center" prop="url"/> | ||
| 56 | - <el-table-column label="素材ID" align="center" prop="mediaId"/> | ||
| 57 | - <el-table-column label="缩略图素材ID" align="center" prop="thumbMediaId"/> | ||
| 58 | - <el-table-column label="微信账号ID" align="center" prop="wxAccountId"/> | ||
| 59 | - <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | ||
| 60 | - <template slot-scope="scope"> | ||
| 61 | - <span>{{ parseTime(scope.row.createTime) }}</span> | ||
| 62 | - </template> | ||
| 63 | - </el-table-column> | ||
| 64 | - <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||
| 65 | - <template slot-scope="scope"> | ||
| 66 | - <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | ||
| 67 | - v-hasPermi="['wechatMp:wx-media-upload:update']">修改 | ||
| 68 | - </el-button> | ||
| 69 | - <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | ||
| 70 | - v-hasPermi="['wechatMp:wx-media-upload:delete']">删除 | ||
| 71 | - </el-button> | ||
| 72 | - </template> | ||
| 73 | - </el-table-column> | ||
| 74 | - </el-table> | ||
| 75 | - <!-- 分页组件 --> | ||
| 76 | - <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||
| 77 | - @pagination="getList"/> | ||
| 78 | - | ||
| 79 | - <!-- 对话框(添加 / 修改) --> | ||
| 80 | - <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> | ||
| 81 | - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | ||
| 82 | - <el-form-item label="类型" prop="type"> | ||
| 83 | - <el-select v-model="form.type" placeholder="请选择类型"> | ||
| 84 | - <el-option label="请选择字典生成" value=""/> | ||
| 85 | - </el-select> | ||
| 86 | - </el-form-item> | ||
| 87 | - <el-form-item label="图片URL" prop="url"> | ||
| 88 | - <el-input v-model="form.url" placeholder="请输入图片URL"/> | ||
| 89 | - </el-form-item> | ||
| 90 | - <el-form-item label="素材ID" prop="mediaId"> | ||
| 91 | - <el-input v-model="form.mediaId" placeholder="请输入素材ID"/> | ||
| 92 | - </el-form-item> | ||
| 93 | - <el-form-item label="缩略图素材ID" prop="thumbMediaId"> | ||
| 94 | - <el-input v-model="form.thumbMediaId" placeholder="请输入缩略图素材ID"/> | ||
| 95 | - </el-form-item> | ||
| 96 | - <el-form-item label="微信账号ID" prop="wxAccountId"> | ||
| 97 | - <el-input v-model="form.wxAccountId" placeholder="请输入微信账号ID"/> | ||
| 98 | - </el-form-item> | ||
| 99 | - </el-form> | ||
| 100 | - <div slot="footer" class="dialog-footer"> | ||
| 101 | - <el-button type="primary" @click="submitForm">确 定</el-button> | ||
| 102 | - <el-button @click="cancel">取 消</el-button> | ||
| 103 | - </div> | ||
| 104 | - </el-dialog> | ||
| 105 | - </div> | ||
| 106 | -</template> | ||
| 107 | - | ||
| 108 | -<script> | ||
| 109 | - import { | ||
| 110 | - createWxMediaUpload, | ||
| 111 | - updateWxMediaUpload, | ||
| 112 | - deleteWxMediaUpload, | ||
| 113 | - getWxMediaUpload, | ||
| 114 | - getWxMediaUploadPage, | ||
| 115 | - exportWxMediaUploadExcel | ||
| 116 | - } from "@/api/wechatMp/wxMediaUpload"; | ||
| 117 | - | ||
| 118 | - export default { | ||
| 119 | - name: "WxMediaUpload", | ||
| 120 | - components: {}, | ||
| 121 | - data() { | ||
| 122 | - return { | ||
| 123 | - // 遮罩层 | ||
| 124 | - loading: true, | ||
| 125 | - // 导出遮罩层 | ||
| 126 | - exportLoading: false, | ||
| 127 | - // 显示搜索条件 | ||
| 128 | - showSearch: true, | ||
| 129 | - // 总条数 | ||
| 130 | - total: 0, | ||
| 131 | - // 微信素材上传表 列表 | ||
| 132 | - list: [], | ||
| 133 | - // 弹出层标题 | ||
| 134 | - title: "", | ||
| 135 | - // 是否显示弹出层 | ||
| 136 | - open: false, | ||
| 137 | - dateRangeCreateTime: [], | ||
| 138 | - // 查询参数 | ||
| 139 | - queryParams: { | ||
| 140 | - pageNo: 1, | ||
| 141 | - pageSize: 10, | ||
| 142 | - type: null, | ||
| 143 | - url: null, | ||
| 144 | - mediaId: null, | ||
| 145 | - thumbMediaId: null, | ||
| 146 | - wxAccountId: null, | ||
| 147 | - }, | ||
| 148 | - // 表单参数 | ||
| 149 | - form: {}, | ||
| 150 | - // 表单校验 | ||
| 151 | - rules: {} | ||
| 152 | - }; | ||
| 153 | - }, | ||
| 154 | - created() { | ||
| 155 | - this.getList(); | ||
| 156 | - }, | ||
| 157 | - methods: { | ||
| 158 | - /** 查询列表 */ | ||
| 159 | - getList() { | ||
| 160 | - this.loading = true; | ||
| 161 | - // 处理查询参数 | ||
| 162 | - let params = {...this.queryParams}; | ||
| 163 | - this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); | ||
| 164 | - // 执行查询 | ||
| 165 | - getWxMediaUploadPage(params).then(response => { | ||
| 166 | - this.list = response.data.list; | ||
| 167 | - this.total = response.data.total; | ||
| 168 | - this.loading = false; | ||
| 169 | - }); | ||
| 170 | - }, | ||
| 171 | - /** 取消按钮 */ | ||
| 172 | - cancel() { | ||
| 173 | - this.open = false; | ||
| 174 | - this.reset(); | ||
| 175 | - }, | ||
| 176 | - /** 表单重置 */ | ||
| 177 | - reset() { | ||
| 178 | - this.form = { | ||
| 179 | - id: undefined, | ||
| 180 | - type: undefined, | ||
| 181 | - url: undefined, | ||
| 182 | - mediaId: undefined, | ||
| 183 | - thumbMediaId: undefined, | ||
| 184 | - wxAccountId: undefined, | ||
| 185 | - }; | ||
| 186 | - this.resetForm("form"); | ||
| 187 | - }, | ||
| 188 | - /** 搜索按钮操作 */ | ||
| 189 | - handleQuery() { | ||
| 190 | - this.queryParams.pageNo = 1; | ||
| 191 | - this.getList(); | ||
| 192 | - }, | ||
| 193 | - /** 重置按钮操作 */ | ||
| 194 | - resetQuery() { | ||
| 195 | - this.dateRangeCreateTime = []; | ||
| 196 | - this.resetForm("queryForm"); | ||
| 197 | - this.handleQuery(); | ||
| 198 | - }, | ||
| 199 | - /** 新增按钮操作 */ | ||
| 200 | - handleAdd() { | ||
| 201 | - this.reset(); | ||
| 202 | - this.open = true; | ||
| 203 | - this.title = "添加微信素材上传表 "; | ||
| 204 | - }, | ||
| 205 | - /** 修改按钮操作 */ | ||
| 206 | - handleUpdate(row) { | ||
| 207 | - this.reset(); | ||
| 208 | - const id = row.id; | ||
| 209 | - getWxMediaUpload(id).then(response => { | ||
| 210 | - this.form = response.data; | ||
| 211 | - this.open = true; | ||
| 212 | - this.title = "修改微信素材上传表 "; | ||
| 213 | - }); | ||
| 214 | - }, | ||
| 215 | - /** 提交按钮 */ | ||
| 216 | - submitForm() { | ||
| 217 | - this.$refs["form"].validate(valid => { | ||
| 218 | - if (!valid) { | ||
| 219 | - return; | ||
| 220 | - } | ||
| 221 | - // 修改的提交 | ||
| 222 | - if (this.form.id != null) { | ||
| 223 | - updateWxMediaUpload(this.form).then(response => { | ||
| 224 | - this.$modal.msgSuccess("修改成功"); | ||
| 225 | - this.open = false; | ||
| 226 | - this.getList(); | ||
| 227 | - }); | ||
| 228 | - return; | ||
| 229 | - } | ||
| 230 | - // 添加的提交 | ||
| 231 | - createWxMediaUpload(this.form).then(response => { | ||
| 232 | - this.$modal.msgSuccess("新增成功"); | ||
| 233 | - this.open = false; | ||
| 234 | - this.getList(); | ||
| 235 | - }); | ||
| 236 | - }); | ||
| 237 | - }, | ||
| 238 | - /** 删除按钮操作 */ | ||
| 239 | - handleDelete(row) { | ||
| 240 | - const id = row.id; | ||
| 241 | - this.$modal.confirm('是否确认删除微信素材上传表 编号为"' + id + '"的数据项?').then(function () { | ||
| 242 | - return deleteWxMediaUpload(id); | ||
| 243 | - }).then(() => { | ||
| 244 | - this.getList(); | ||
| 245 | - this.$modal.msgSuccess("删除成功"); | ||
| 246 | - }).catch(() => { | ||
| 247 | - }); | ||
| 248 | - }, | ||
| 249 | - /** 导出按钮操作 */ | ||
| 250 | - handleExport() { | ||
| 251 | - // 处理查询参数 | ||
| 252 | - let params = {...this.queryParams}; | ||
| 253 | - params.pageNo = undefined; | ||
| 254 | - params.pageSize = undefined; | ||
| 255 | - this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); | ||
| 256 | - // 执行导出 | ||
| 257 | - this.$modal.confirm('是否确认导出所有微信素材上传表 数据项?').then(() => { | ||
| 258 | - this.exportLoading = true; | ||
| 259 | - return exportWxMediaUploadExcel(params); | ||
| 260 | - }).then(response => { | ||
| 261 | - this.$download.excel(response, '微信素材上传表 .xls'); | ||
| 262 | - this.exportLoading = false; | ||
| 263 | - }).catch(() => { | ||
| 264 | - }); | ||
| 265 | - } | ||
| 266 | - } | ||
| 267 | - }; | ||
| 268 | -</script> |
yudao-ui-admin/src/views/wechatMp/wxMenu/index.vue deleted
| 1 | -<template> | ||
| 2 | - <div class="app-container"> | ||
| 3 | - | ||
| 4 | - <!-- 搜索工作栏 --> | ||
| 5 | - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> | ||
| 6 | - <el-form-item label="父ID" prop="parentId"> | ||
| 7 | - <el-input v-model="queryParams.parentId" placeholder="请输入父ID" clearable @keyup.enter.native="handleQuery"/> | ||
| 8 | - </el-form-item> | ||
| 9 | - <el-form-item label="菜单名称" prop="menuName"> | ||
| 10 | - <el-input v-model="queryParams.menuName" placeholder="请输入菜单名称" clearable @keyup.enter.native="handleQuery"/> | ||
| 11 | - </el-form-item> | ||
| 12 | - <el-form-item label="菜单类型 1文本消息;2图文消息;3网址链接;4小程序" prop="menuType"> | ||
| 13 | - <el-select v-model="queryParams.menuType" placeholder="请选择菜单类型 1文本消息;2图文消息;3网址链接;4小程序" clearable size="small"> | ||
| 14 | - <el-option label="请选择字典生成" value=""/> | ||
| 15 | - </el-select> | ||
| 16 | - </el-form-item> | ||
| 17 | - <el-form-item label="菜单等级" prop="menuLevel"> | ||
| 18 | - <el-input v-model="queryParams.menuLevel" placeholder="请输入菜单等级" clearable @keyup.enter.native="handleQuery"/> | ||
| 19 | - </el-form-item> | ||
| 20 | - <el-form-item label="模板ID" prop="tplId"> | ||
| 21 | - <el-input v-model="queryParams.tplId" placeholder="请输入模板ID" clearable @keyup.enter.native="handleQuery"/> | ||
| 22 | - </el-form-item> | ||
| 23 | - <el-form-item label="菜单URL" prop="menuUrl"> | ||
| 24 | - <el-input v-model="queryParams.menuUrl" placeholder="请输入菜单URL" clearable @keyup.enter.native="handleQuery"/> | ||
| 25 | - </el-form-item> | ||
| 26 | - <el-form-item label="排序" prop="menuSort"> | ||
| 27 | - <el-input v-model="queryParams.menuSort" placeholder="请输入排序" clearable @keyup.enter.native="handleQuery"/> | ||
| 28 | - </el-form-item> | ||
| 29 | - <el-form-item label="微信账号ID" prop="wxAccountId"> | ||
| 30 | - <el-input v-model="queryParams.wxAccountId" placeholder="请输入微信账号ID" clearable | ||
| 31 | - @keyup.enter.native="handleQuery"/> | ||
| 32 | - </el-form-item> | ||
| 33 | - <el-form-item label="小程序appid" prop="miniprogramAppid"> | ||
| 34 | - <el-input v-model="queryParams.miniprogramAppid" placeholder="请输入小程序appid" clearable | ||
| 35 | - @keyup.enter.native="handleQuery"/> | ||
| 36 | - </el-form-item> | ||
| 37 | - <el-form-item label="小程序页面路径" prop="miniprogramPagepath"> | ||
| 38 | - <el-input v-model="queryParams.miniprogramPagepath" placeholder="请输入小程序页面路径" clearable | ||
| 39 | - @keyup.enter.native="handleQuery"/> | ||
| 40 | - </el-form-item> | ||
| 41 | - <el-form-item label="创建时间"> | ||
| 42 | - <el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" | ||
| 43 | - type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/> | ||
| 44 | - </el-form-item> | ||
| 45 | - <el-form-item> | ||
| 46 | - <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | ||
| 47 | - <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | ||
| 48 | - </el-form-item> | ||
| 49 | - </el-form> | ||
| 50 | - | ||
| 51 | - <!-- 操作工具栏 --> | ||
| 52 | - <el-row :gutter="10" class="mb8"> | ||
| 53 | - <el-col :span="1.5"> | ||
| 54 | - <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | ||
| 55 | - v-hasPermi="['wechatMp:wx-menu:create']">新增 | ||
| 56 | - </el-button> | ||
| 57 | - </el-col> | ||
| 58 | - <el-col :span="1.5"> | ||
| 59 | - <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" | ||
| 60 | - :loading="exportLoading" | ||
| 61 | - v-hasPermi="['wechatMp:wx-menu:export']">导出 | ||
| 62 | - </el-button> | ||
| 63 | - </el-col> | ||
| 64 | - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||
| 65 | - </el-row> | ||
| 66 | - | ||
| 67 | - <!-- 列表 --> | ||
| 68 | - <el-table v-loading="loading" :data="list"> | ||
| 69 | - <el-table-column label="主键" align="center" prop="id"/> | ||
| 70 | - <el-table-column label="父ID" align="center" prop="parentId"/> | ||
| 71 | - <el-table-column label="菜单名称" align="center" prop="menuName"/> | ||
| 72 | - <el-table-column label="菜单类型 1文本消息;2图文消息;3网址链接;4小程序" align="center" prop="menuType"/> | ||
| 73 | - <el-table-column label="菜单等级" align="center" prop="menuLevel"/> | ||
| 74 | - <el-table-column label="模板ID" align="center" prop="tplId"/> | ||
| 75 | - <el-table-column label="菜单URL" align="center" prop="menuUrl"/> | ||
| 76 | - <el-table-column label="排序" align="center" prop="menuSort"/> | ||
| 77 | - <el-table-column label="微信账号ID" align="center" prop="wxAccountId"/> | ||
| 78 | - <el-table-column label="小程序appid" align="center" prop="miniprogramAppid"/> | ||
| 79 | - <el-table-column label="小程序页面路径" align="center" prop="miniprogramPagepath"/> | ||
| 80 | - <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | ||
| 81 | - <template slot-scope="scope"> | ||
| 82 | - <span>{{ parseTime(scope.row.createTime) }}</span> | ||
| 83 | - </template> | ||
| 84 | - </el-table-column> | ||
| 85 | - <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||
| 86 | - <template slot-scope="scope"> | ||
| 87 | - <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | ||
| 88 | - v-hasPermi="['wechatMp:wx-menu:update']">修改 | ||
| 89 | - </el-button> | ||
| 90 | - <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | ||
| 91 | - v-hasPermi="['wechatMp:wx-menu:delete']">删除 | ||
| 92 | - </el-button> | ||
| 93 | - </template> | ||
| 94 | - </el-table-column> | ||
| 95 | - </el-table> | ||
| 96 | - <!-- 分页组件 --> | ||
| 97 | - <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||
| 98 | - @pagination="getList"/> | ||
| 99 | - | ||
| 100 | - <!-- 对话框(添加 / 修改) --> | ||
| 101 | - <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> | ||
| 102 | - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | ||
| 103 | - <el-form-item label="父ID" prop="parentId"> | ||
| 104 | - <el-input v-model="form.parentId" placeholder="请输入父ID"/> | ||
| 105 | - </el-form-item> | ||
| 106 | - <el-form-item label="菜单名称" prop="menuName"> | ||
| 107 | - <el-input v-model="form.menuName" placeholder="请输入菜单名称"/> | ||
| 108 | - </el-form-item> | ||
| 109 | - <el-form-item label="菜单类型 1文本消息;2图文消息;3网址链接;4小程序" prop="menuType"> | ||
| 110 | - <el-select v-model="form.menuType" placeholder="请选择菜单类型 1文本消息;2图文消息;3网址链接;4小程序"> | ||
| 111 | - <el-option label="请选择字典生成" value=""/> | ||
| 112 | - </el-select> | ||
| 113 | - </el-form-item> | ||
| 114 | - <el-form-item label="菜单等级" prop="menuLevel"> | ||
| 115 | - <el-input v-model="form.menuLevel" placeholder="请输入菜单等级"/> | ||
| 116 | - </el-form-item> | ||
| 117 | - <el-form-item label="模板ID" prop="tplId"> | ||
| 118 | - <el-input v-model="form.tplId" placeholder="请输入模板ID"/> | ||
| 119 | - </el-form-item> | ||
| 120 | - <el-form-item label="菜单URL" prop="menuUrl"> | ||
| 121 | - <el-input v-model="form.menuUrl" placeholder="请输入菜单URL"/> | ||
| 122 | - </el-form-item> | ||
| 123 | - <el-form-item label="排序" prop="menuSort"> | ||
| 124 | - <el-input v-model="form.menuSort" placeholder="请输入排序"/> | ||
| 125 | - </el-form-item> | ||
| 126 | - <el-form-item label="微信账号ID" prop="wxAccountId"> | ||
| 127 | - <el-input v-model="form.wxAccountId" placeholder="请输入微信账号ID"/> | ||
| 128 | - </el-form-item> | ||
| 129 | - <el-form-item label="小程序appid" prop="miniprogramAppid"> | ||
| 130 | - <el-input v-model="form.miniprogramAppid" placeholder="请输入小程序appid"/> | ||
| 131 | - </el-form-item> | ||
| 132 | - <el-form-item label="小程序页面路径" prop="miniprogramPagepath"> | ||
| 133 | - <el-input v-model="form.miniprogramPagepath" placeholder="请输入小程序页面路径"/> | ||
| 134 | - </el-form-item> | ||
| 135 | - </el-form> | ||
| 136 | - <div slot="footer" class="dialog-footer"> | ||
| 137 | - <el-button type="primary" @click="submitForm">确 定</el-button> | ||
| 138 | - <el-button @click="cancel">取 消</el-button> | ||
| 139 | - </div> | ||
| 140 | - </el-dialog> | ||
| 141 | - </div> | ||
| 142 | -</template> | ||
| 143 | - | ||
| 144 | -<script> | ||
| 145 | - import { | ||
| 146 | - createWxMenu, | ||
| 147 | - updateWxMenu, | ||
| 148 | - deleteWxMenu, | ||
| 149 | - getWxMenu, | ||
| 150 | - getWxMenuPage, | ||
| 151 | - exportWxMenuExcel | ||
| 152 | - } from "@/api/wechatMp/wxMenu"; | ||
| 153 | - | ||
| 154 | - export default { | ||
| 155 | - name: "WxMenu", | ||
| 156 | - components: {}, | ||
| 157 | - data() { | ||
| 158 | - return { | ||
| 159 | - // 遮罩层 | ||
| 160 | - loading: true, | ||
| 161 | - // 导出遮罩层 | ||
| 162 | - exportLoading: false, | ||
| 163 | - // 显示搜索条件 | ||
| 164 | - showSearch: true, | ||
| 165 | - // 总条数 | ||
| 166 | - total: 0, | ||
| 167 | - // 微信菜单列表 | ||
| 168 | - list: [], | ||
| 169 | - // 弹出层标题 | ||
| 170 | - title: "", | ||
| 171 | - // 是否显示弹出层 | ||
| 172 | - open: false, | ||
| 173 | - dateRangeCreateTime: [], | ||
| 174 | - // 查询参数 | ||
| 175 | - queryParams: { | ||
| 176 | - pageNo: 1, | ||
| 177 | - pageSize: 10, | ||
| 178 | - parentId: null, | ||
| 179 | - menuName: null, | ||
| 180 | - menuType: null, | ||
| 181 | - menuLevel: null, | ||
| 182 | - tplId: null, | ||
| 183 | - menuUrl: null, | ||
| 184 | - menuSort: null, | ||
| 185 | - wxAccountId: null, | ||
| 186 | - miniprogramAppid: null, | ||
| 187 | - miniprogramPagepath: null, | ||
| 188 | - }, | ||
| 189 | - // 表单参数 | ||
| 190 | - form: {}, | ||
| 191 | - // 表单校验 | ||
| 192 | - rules: {} | ||
| 193 | - }; | ||
| 194 | - }, | ||
| 195 | - created() { | ||
| 196 | - this.getList(); | ||
| 197 | - }, | ||
| 198 | - methods: { | ||
| 199 | - /** 查询列表 */ | ||
| 200 | - getList() { | ||
| 201 | - this.loading = true; | ||
| 202 | - // 处理查询参数 | ||
| 203 | - let params = {...this.queryParams}; | ||
| 204 | - this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); | ||
| 205 | - // 执行查询 | ||
| 206 | - getWxMenuPage(params).then(response => { | ||
| 207 | - this.list = response.data.list; | ||
| 208 | - this.total = response.data.total; | ||
| 209 | - this.loading = false; | ||
| 210 | - }); | ||
| 211 | - }, | ||
| 212 | - /** 取消按钮 */ | ||
| 213 | - cancel() { | ||
| 214 | - this.open = false; | ||
| 215 | - this.reset(); | ||
| 216 | - }, | ||
| 217 | - /** 表单重置 */ | ||
| 218 | - reset() { | ||
| 219 | - this.form = { | ||
| 220 | - id: undefined, | ||
| 221 | - parentId: undefined, | ||
| 222 | - menuName: undefined, | ||
| 223 | - menuType: undefined, | ||
| 224 | - menuLevel: undefined, | ||
| 225 | - tplId: undefined, | ||
| 226 | - menuUrl: undefined, | ||
| 227 | - menuSort: undefined, | ||
| 228 | - wxAccountId: undefined, | ||
| 229 | - miniprogramAppid: undefined, | ||
| 230 | - miniprogramPagepath: undefined, | ||
| 231 | - }; | ||
| 232 | - this.resetForm("form"); | ||
| 233 | - }, | ||
| 234 | - /** 搜索按钮操作 */ | ||
| 235 | - handleQuery() { | ||
| 236 | - this.queryParams.pageNo = 1; | ||
| 237 | - this.getList(); | ||
| 238 | - }, | ||
| 239 | - /** 重置按钮操作 */ | ||
| 240 | - resetQuery() { | ||
| 241 | - this.dateRangeCreateTime = []; | ||
| 242 | - this.resetForm("queryForm"); | ||
| 243 | - this.handleQuery(); | ||
| 244 | - }, | ||
| 245 | - /** 新增按钮操作 */ | ||
| 246 | - handleAdd() { | ||
| 247 | - this.reset(); | ||
| 248 | - this.open = true; | ||
| 249 | - this.title = "添加微信菜单"; | ||
| 250 | - }, | ||
| 251 | - /** 修改按钮操作 */ | ||
| 252 | - handleUpdate(row) { | ||
| 253 | - this.reset(); | ||
| 254 | - const id = row.id; | ||
| 255 | - getWxMenu(id).then(response => { | ||
| 256 | - this.form = response.data; | ||
| 257 | - this.open = true; | ||
| 258 | - this.title = "修改微信菜单"; | ||
| 259 | - }); | ||
| 260 | - }, | ||
| 261 | - /** 提交按钮 */ | ||
| 262 | - submitForm() { | ||
| 263 | - this.$refs["form"].validate(valid => { | ||
| 264 | - if (!valid) { | ||
| 265 | - return; | ||
| 266 | - } | ||
| 267 | - // 修改的提交 | ||
| 268 | - if (this.form.id != null) { | ||
| 269 | - updateWxMenu(this.form).then(response => { | ||
| 270 | - this.$modal.msgSuccess("修改成功"); | ||
| 271 | - this.open = false; | ||
| 272 | - this.getList(); | ||
| 273 | - }); | ||
| 274 | - return; | ||
| 275 | - } | ||
| 276 | - // 添加的提交 | ||
| 277 | - createWxMenu(this.form).then(response => { | ||
| 278 | - this.$modal.msgSuccess("新增成功"); | ||
| 279 | - this.open = false; | ||
| 280 | - this.getList(); | ||
| 281 | - }); | ||
| 282 | - }); | ||
| 283 | - }, | ||
| 284 | - /** 删除按钮操作 */ | ||
| 285 | - handleDelete(row) { | ||
| 286 | - const id = row.id; | ||
| 287 | - this.$modal.confirm('是否确认删除微信菜单编号为"' + id + '"的数据项?').then(function () { | ||
| 288 | - return deleteWxMenu(id); | ||
| 289 | - }).then(() => { | ||
| 290 | - this.getList(); | ||
| 291 | - this.$modal.msgSuccess("删除成功"); | ||
| 292 | - }).catch(() => { | ||
| 293 | - }); | ||
| 294 | - }, | ||
| 295 | - /** 导出按钮操作 */ | ||
| 296 | - handleExport() { | ||
| 297 | - // 处理查询参数 | ||
| 298 | - let params = {...this.queryParams}; | ||
| 299 | - params.pageNo = undefined; | ||
| 300 | - params.pageSize = undefined; | ||
| 301 | - this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); | ||
| 302 | - // 执行导出 | ||
| 303 | - this.$modal.confirm('是否确认导出所有微信菜单数据项?').then(() => { | ||
| 304 | - this.exportLoading = true; | ||
| 305 | - return exportWxMenuExcel(params); | ||
| 306 | - }).then(response => { | ||
| 307 | - this.$download.excel(response, '微信菜单.xls'); | ||
| 308 | - this.exportLoading = false; | ||
| 309 | - }).catch(() => { | ||
| 310 | - }); | ||
| 311 | - } | ||
| 312 | - } | ||
| 313 | - }; | ||
| 314 | -</script> |