From b5815a62fc05fc91501de4a9c461f84433cebe3e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 15 Jan 2023 21:21:33 +0800 Subject: [PATCH] =?UTF-8?q?mp=EF=BC=9A=E8=87=AA=E5=AE=9A=E4=B9=89=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E7=9A=84=E5=9B=BE=E6=96=87=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/menu/vo/MpMenuBaseVO.java | 8 ++- .../mp/dal/dataobject/menu/MpMenuDO.java | 5 ++ .../mp/framework/mp/core/util/MpUtils.java | 8 +++ .../src/views/mp/components/wx-news/main.vue | 6 +- yudao-ui-admin/src/views/mp/menu/index.vue | 60 ++++++++++++------- 5 files changed, 59 insertions(+), 28 deletions(-) diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/menu/vo/MpMenuBaseVO.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/menu/vo/MpMenuBaseVO.java index 12d34152d..0f23d3455 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/menu/vo/MpMenuBaseVO.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/menu/vo/MpMenuBaseVO.java @@ -57,6 +57,10 @@ public class MpMenuBaseVO { @NotEmpty(message = "小程序的页面路径不能为空", groups = MiniProgramButtonGroup.class) private String miniProgramPagePath; + @ApiModelProperty(value ="跳转图文的媒体编号", example = "jCQk93AIIgp8ixClWcW_NXXqBKInNWNmq2XnPeDZl7IMVqWiNeL4FfELtggRXd83") + @NotEmpty(message = "跳转图文的媒体编号不能为空", groups = ViewLimitedButtonGroup.class) + private String articleId; + // ========== 消息内容 ========== @ApiModelProperty(value = "消息类型", example = "text", @@ -65,7 +69,7 @@ public class MpMenuBaseVO { private String replyMessageType; @ApiModelProperty(value = "回复的消息内容", example = "欢迎关注") - @NotEmpty(message = "回复的消息内容不能为空", groups = {TextMessageGroup.class}) + @NotEmpty(message = "回复的消息内容不能为空", groups = TextMessageGroup.class) private String replyContent; @ApiModelProperty(value = "回复的媒体 id", example = "123456") @@ -96,7 +100,7 @@ public class MpMenuBaseVO { * * 消息类型为 {@link WxConsts.XmlMsgType} 的 NEWS */ - @NotNull(message = "回复的图文消息不能为空", groups = NewsMessageGroup.class) + @NotNull(message = "回复的图文消息不能为空", groups = {NewsMessageGroup.class, ViewLimitedButtonGroup.class}) @Valid private List replyArticles; diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/menu/MpMenuDO.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/menu/MpMenuDO.java index eb04a1b38..ab2f04147 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/menu/MpMenuDO.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/menu/MpMenuDO.java @@ -96,6 +96,11 @@ public class MpMenuDO extends BaseDO { */ private String miniProgramPagePath; + /** + * 跳转图文的媒体编号 + */ + private String articleId; + // ========== 消息内容 ========== /** diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/framework/mp/core/util/MpUtils.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/framework/mp/core/util/MpUtils.java index 74199f124..880d8c8f5 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/framework/mp/core/util/MpUtils.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/framework/mp/core/util/MpUtils.java @@ -72,6 +72,9 @@ public class MpUtils { group = ScanCodeWaitMsgButtonGroup.class; validateMessage(validator, messageType, button); // 需要额外校验回复的消息格式 break; + case "article_" + WxConsts.MenuButtonType.VIEW_LIMITED: + group = ViewLimitedButtonGroup.class; + break; case WxConsts.MenuButtonType.SCANCODE_PUSH: // 不用校验,直接 return 即可 case WxConsts.MenuButtonType.PIC_SYSPHOTO: case WxConsts.MenuButtonType.PIC_PHOTO_OR_ALBUM: @@ -156,4 +159,9 @@ public class MpUtils { * SCANCODE_WAITMSG 类型的按钮,参数校验 Group */ public interface ScanCodeWaitMsgButtonGroup {} + + /** + * VIEW_LIMITED 类型的按钮,参数校验 Group + */ + public interface ViewLimitedButtonGroup {} } diff --git a/yudao-ui-admin/src/views/mp/components/wx-news/main.vue b/yudao-ui-admin/src/views/mp/components/wx-news/main.vue index bccffc2b4..b8ff20ac0 100644 --- a/yudao-ui-admin/src/views/mp/components/wx-news/main.vue +++ b/yudao-ui-admin/src/views/mp/components/wx-news/main.vue @@ -42,9 +42,9 @@ type: Array // title - 标题;description - 描述;picUrl - 图片连接;url - 跳转链接 } }, - created() { - console.log(this.articles) - }, + // created() { + // console.log(this.articles) + // }, }; diff --git a/yudao-ui-admin/src/views/mp/menu/index.vue b/yudao-ui-admin/src/views/mp/menu/index.vue index 3f377c72c..9c9c2f666 100644 --- a/yudao-ui-admin/src/views/mp/menu/index.vue +++ b/yudao-ui-admin/src/views/mp/menu/index.vue @@ -113,21 +113,23 @@ SOFTWARE.
-
- +
+ - +
-
+
- 素材库选择 + + 素材库选择 +
- +
@@ -148,7 +150,7 @@ SOFTWARE.