mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 07:11:52 +08:00
mp:自定义菜单的图文选择
This commit is contained in:
parent
64fa3a7e47
commit
b5815a62fc
@ -57,6 +57,10 @@ public class MpMenuBaseVO {
|
|||||||
@NotEmpty(message = "小程序的页面路径不能为空", groups = MiniProgramButtonGroup.class)
|
@NotEmpty(message = "小程序的页面路径不能为空", groups = MiniProgramButtonGroup.class)
|
||||||
private String miniProgramPagePath;
|
private String miniProgramPagePath;
|
||||||
|
|
||||||
|
@ApiModelProperty(value ="跳转图文的媒体编号", example = "jCQk93AIIgp8ixClWcW_NXXqBKInNWNmq2XnPeDZl7IMVqWiNeL4FfELtggRXd83")
|
||||||
|
@NotEmpty(message = "跳转图文的媒体编号不能为空", groups = ViewLimitedButtonGroup.class)
|
||||||
|
private String articleId;
|
||||||
|
|
||||||
// ========== 消息内容 ==========
|
// ========== 消息内容 ==========
|
||||||
|
|
||||||
@ApiModelProperty(value = "消息类型", example = "text",
|
@ApiModelProperty(value = "消息类型", example = "text",
|
||||||
@ -65,7 +69,7 @@ public class MpMenuBaseVO {
|
|||||||
private String replyMessageType;
|
private String replyMessageType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "回复的消息内容", example = "欢迎关注")
|
@ApiModelProperty(value = "回复的消息内容", example = "欢迎关注")
|
||||||
@NotEmpty(message = "回复的消息内容不能为空", groups = {TextMessageGroup.class})
|
@NotEmpty(message = "回复的消息内容不能为空", groups = TextMessageGroup.class)
|
||||||
private String replyContent;
|
private String replyContent;
|
||||||
|
|
||||||
@ApiModelProperty(value = "回复的媒体 id", example = "123456")
|
@ApiModelProperty(value = "回复的媒体 id", example = "123456")
|
||||||
@ -96,7 +100,7 @@ public class MpMenuBaseVO {
|
|||||||
*
|
*
|
||||||
* 消息类型为 {@link WxConsts.XmlMsgType} 的 NEWS
|
* 消息类型为 {@link WxConsts.XmlMsgType} 的 NEWS
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "回复的图文消息不能为空", groups = NewsMessageGroup.class)
|
@NotNull(message = "回复的图文消息不能为空", groups = {NewsMessageGroup.class, ViewLimitedButtonGroup.class})
|
||||||
@Valid
|
@Valid
|
||||||
private List<MpMessageDO.Article> replyArticles;
|
private List<MpMessageDO.Article> replyArticles;
|
||||||
|
|
||||||
|
@ -96,6 +96,11 @@ public class MpMenuDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String miniProgramPagePath;
|
private String miniProgramPagePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转图文的媒体编号
|
||||||
|
*/
|
||||||
|
private String articleId;
|
||||||
|
|
||||||
// ========== 消息内容 ==========
|
// ========== 消息内容 ==========
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,6 +72,9 @@ public class MpUtils {
|
|||||||
group = ScanCodeWaitMsgButtonGroup.class;
|
group = ScanCodeWaitMsgButtonGroup.class;
|
||||||
validateMessage(validator, messageType, button); // 需要额外校验回复的消息格式
|
validateMessage(validator, messageType, button); // 需要额外校验回复的消息格式
|
||||||
break;
|
break;
|
||||||
|
case "article_" + WxConsts.MenuButtonType.VIEW_LIMITED:
|
||||||
|
group = ViewLimitedButtonGroup.class;
|
||||||
|
break;
|
||||||
case WxConsts.MenuButtonType.SCANCODE_PUSH: // 不用校验,直接 return 即可
|
case WxConsts.MenuButtonType.SCANCODE_PUSH: // 不用校验,直接 return 即可
|
||||||
case WxConsts.MenuButtonType.PIC_SYSPHOTO:
|
case WxConsts.MenuButtonType.PIC_SYSPHOTO:
|
||||||
case WxConsts.MenuButtonType.PIC_PHOTO_OR_ALBUM:
|
case WxConsts.MenuButtonType.PIC_PHOTO_OR_ALBUM:
|
||||||
@ -156,4 +159,9 @@ public class MpUtils {
|
|||||||
* SCANCODE_WAITMSG 类型的按钮,参数校验 Group
|
* SCANCODE_WAITMSG 类型的按钮,参数校验 Group
|
||||||
*/
|
*/
|
||||||
public interface ScanCodeWaitMsgButtonGroup {}
|
public interface ScanCodeWaitMsgButtonGroup {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIEW_LIMITED 类型的按钮,参数校验 Group
|
||||||
|
*/
|
||||||
|
public interface ViewLimitedButtonGroup {}
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,9 @@
|
|||||||
type: Array // title - 标题;description - 描述;picUrl - 图片连接;url - 跳转链接
|
type: Array // title - 标题;description - 描述;picUrl - 图片连接;url - 跳转链接
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
// created() {
|
||||||
console.log(this.articles)
|
// console.log(this.articles)
|
||||||
},
|
// },
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -113,21 +113,23 @@ SOFTWARE.
|
|||||||
</div>
|
</div>
|
||||||
<div class="configur_content" v-if="tempObj.type === 'article_view_limited'">
|
<div class="configur_content" v-if="tempObj.type === 'article_view_limited'">
|
||||||
<el-row>
|
<el-row>
|
||||||
<div class="select-item" v-if="tempObj && tempObj.content && tempObj.content.articles">
|
<div class="select-item" v-if="tempObj && tempObj.replyArticles">
|
||||||
<WxNews :objData="tempObj.content.articles"></WxNews>
|
<wx-news :articles="tempObj.replyArticles" />
|
||||||
<el-row class="ope-row">
|
<el-row class="ope-row">
|
||||||
<el-button type="danger" icon="el-icon-delete" circle @click="deleteTempObj" />
|
<el-button type="danger" icon="el-icon-delete" circle @click="deleteMaterial" />
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!tempObj.content || !tempObj.content.articles">
|
<div v-else>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24" style="text-align: center">
|
<el-col :span="24" style="text-align: center">
|
||||||
<el-button type="success" @click="openMaterial">素材库选择<i class="el-icon-circle-check el-icon--right"></i></el-button>
|
<el-button type="success" @click="openMaterial">
|
||||||
|
素材库选择<i class="el-icon-circle-check el-icon--right"></i>
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog title="选择图文" :visible.sync="dialogNewsVisible" width="90%">
|
<el-dialog title="选择图文" :visible.sync="dialogNewsVisible" width="90%">
|
||||||
<WxMaterialSelect :objData="{repType:'news'}" @selectMaterial="selectMaterial"></WxMaterialSelect>
|
<wx-material-select :objData="{type: 'news', accountId: this.accountId}" @selectMaterial="selectMaterial" />
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
@ -148,7 +150,7 @@ SOFTWARE.
|
|||||||
<script>
|
<script>
|
||||||
import WxReplySelect from '@/views/mp/components/wx-reply/main.vue'
|
import WxReplySelect from '@/views/mp/components/wx-reply/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-material-select/main.vue'
|
||||||
import { deleteMenu, getMenuList, saveMenu } from "@/api/mp/menu";
|
import { deleteMenu, getMenuList, saveMenu } from "@/api/mp/menu";
|
||||||
import { getSimpleAccounts } from "@/api/mp/account";
|
import { getSimpleAccounts } from "@/api/mp/account";
|
||||||
|
|
||||||
@ -359,10 +361,9 @@ export default {
|
|||||||
this.$delete( item, 'miniProgramPagePath')
|
this.$delete( item, 'miniProgramPagePath')
|
||||||
this.$delete( item, 'url')
|
this.$delete( item, 'url')
|
||||||
this.$delete( item, 'reply')
|
this.$delete( item, 'reply')
|
||||||
// TODO 芋艿:需要搞的属性弄下
|
this.$delete( item, 'articleId')
|
||||||
|
this.$delete( item, 'replyArticles')
|
||||||
this.$delete( item, 'article_id')
|
// 关闭配置面板
|
||||||
this.$delete( item, 'textContent')
|
|
||||||
this.showConfigureContent = false
|
this.showConfigureContent = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,24 +472,37 @@ export default {
|
|||||||
openMaterial() {
|
openMaterial() {
|
||||||
this.dialogNewsVisible = true
|
this.dialogNewsVisible = true
|
||||||
},
|
},
|
||||||
selectMaterial(item){
|
selectMaterial(item) {
|
||||||
if(item.content.articles.length>1){
|
const articleId = item.articleId;
|
||||||
|
const articles = item.content.newsItem;
|
||||||
|
// 提示,针对多图文
|
||||||
|
if (articles.length > 1) {
|
||||||
this.$alert('您选择的是多图文,将默认跳转第一篇', '提示', {
|
this.$alert('您选择的是多图文,将默认跳转第一篇', '提示', {
|
||||||
confirmButtonText: '确定'
|
confirmButtonText: '确定'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.dialogNewsVisible = false
|
this.dialogNewsVisible = false
|
||||||
this.tempObj.article_id = item.articleId
|
|
||||||
this.tempObj.mediaName = item.name
|
// 设置菜单的回复
|
||||||
this.tempObj.url = item.url
|
this.tempObj.articleId = articleId;
|
||||||
item.mediaType = this.tempObj.mediaType
|
this.tempObj.replyArticles = [];
|
||||||
item.content.articles = item.content.articles.slice(0,1)
|
articles.forEach(article => {
|
||||||
this.tempObj.content = item.content
|
this.tempObj.replyArticles.push({
|
||||||
|
title: article.title,
|
||||||
|
description: article.digest,
|
||||||
|
picUrl: article.picUrl,
|
||||||
|
url: article.url,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// this.tempObj.mediaName = item.name
|
||||||
|
// this.tempObj.url = item.url
|
||||||
|
// item.mediaType = this.tempObj.mediaType
|
||||||
|
// item.content.articles = item.content.articles.slice(0,1)
|
||||||
|
// this.tempObj.content = item.content
|
||||||
},
|
},
|
||||||
deleteTempObj() {
|
deleteMaterial() {
|
||||||
this.$delete(this.tempObj,'repName')
|
this.$delete(this.tempObj,'articleId')
|
||||||
this.$delete(this.tempObj,'repUrl')
|
this.$delete(this.tempObj,'replyArticles')
|
||||||
this.$delete(this.tempObj,'content')
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user