Commit 6325dd288cd6db11a241ac443db7b3e64eb6e2ae
1 parent
9cf88d19
mp:前端增加 message 消息的展示
Showing
5 changed files
with
97 additions
and
28 deletions
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/MpMessageBaseVO.java
| ... | ... | @@ -10,6 +10,7 @@ import me.chanjar.weixin.common.api.WxConsts; |
| 10 | 10 | |
| 11 | 11 | import java.util.List; |
| 12 | 12 | |
| 13 | +// TODO 芋艿:VO 的注解 | |
| 13 | 14 | /** |
| 14 | 15 | * 粉丝消息表 Base VO,提供给添加、修改、详细的子 VO 使用 |
| 15 | 16 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| ... | ... | @@ -158,6 +159,21 @@ public class MpMessageBaseVO { |
| 158 | 159 | @TableField(typeHandler = MpMessageDO.ArticleTypeHandler.class) |
| 159 | 160 | private List<MpMessageDO.Article> articles; |
| 160 | 161 | |
| 162 | + /** | |
| 163 | + * 音乐链接 | |
| 164 | + * | |
| 165 | + * 消息类型为 {@link WxConsts.XmlMsgType} 的 MUSIC | |
| 166 | + */ | |
| 167 | + private String musicUrl; | |
| 168 | + /** | |
| 169 | + * 高质量音乐链接 | |
| 170 | + * | |
| 171 | + * WIFI 环境优先使用该链接播放音乐 | |
| 172 | + * | |
| 173 | + * 消息类型为 {@link WxConsts.XmlMsgType} 的 MUSIC | |
| 174 | + */ | |
| 175 | + private String hqMusicUrl; | |
| 176 | + | |
| 161 | 177 | // ========= 事件推送 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_event_pushes.html |
| 162 | 178 | |
| 163 | 179 | /** | ... | ... |
yudao-ui-admin/src/views/mp/components/wx-msg/card.scss
| ... | ... | @@ -84,3 +84,18 @@ |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | + | |
| 88 | +/** joolun 额外加的 */ | |
| 89 | +.avue-comment__main { | |
| 90 | + flex: unset!important; | |
| 91 | + border-radius: 5px!important; | |
| 92 | + margin: 0 8px!important; | |
| 93 | +} | |
| 94 | +.avue-comment__header { | |
| 95 | + border-top-left-radius: 5px; | |
| 96 | + border-top-right-radius: 5px; | |
| 97 | +} | |
| 98 | +.avue-comment__body { | |
| 99 | + border-bottom-right-radius: 5px; | |
| 100 | + border-bottom-left-radius: 5px; | |
| 101 | +} | ... | ... |
yudao-ui-admin/src/views/mp/components/wx-msg/main.vue
| ... | ... | @@ -68,22 +68,13 @@ |
| 68 | 68 | <div v-else-if="item.type === 'location'"> |
| 69 | 69 | <wx-location :label="item.label" :location-y="item.locationY" :location-x="item.locationX" /> |
| 70 | 70 | </div> |
| 71 | - | |
| 72 | 71 | <div v-else-if="item.type === 'news'" style="width: 300px"> <!-- TODO 芋艿:待测试;详情页也存在类似的情况 --> |
| 73 | 72 | <wx-news :articles="item.articles" /> |
| 74 | 73 | </div> |
| 75 | - | |
| 76 | -<!-- <div v-if="item.repType == 'music'">--> | |
| 77 | -<!-- <el-link type="success" :underline="false" target="_blank" :href="item.repUrl">--> | |
| 78 | -<!-- <div class="avue-card__body" style="padding:10px;background-color: #fff;border-radius: 5px">--> | |
| 79 | -<!-- <div class="avue-card__avatar"><img :src="item.repThumbUrl" alt=""></div>--> | |
| 80 | -<!-- <div class="avue-card__detail">--> | |
| 81 | -<!-- <div class="avue-card__title" style="margin-bottom:unset">{{item.repName}}</div>--> | |
| 82 | -<!-- <div class="avue-card__info" style="height: unset">{{item.repDesc}}</div>--> | |
| 83 | -<!-- </div>--> | |
| 84 | -<!-- </div>--> | |
| 85 | -<!-- </el-link>--> | |
| 86 | -<!-- </div>--> | |
| 74 | + <div v-else-if="item.type === 'music'"> | |
| 75 | + <wx-music :title="item.title" :description="item.description" :thumb-media-url="item.thumbMediaUrl" | |
| 76 | + :music-url="item.musicUrl" :hq-music-url="item.hqMusicUrl" /> | |
| 77 | + </div> | |
| 87 | 78 | </div> |
| 88 | 79 | </div> |
| 89 | 80 | </div> |
| ... | ... | @@ -103,6 +94,7 @@ |
| 103 | 94 | import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'; |
| 104 | 95 | import WxNews from '@/views/mp/components/wx-news/main.vue'; |
| 105 | 96 | import WxLocation from '@/views/mp/components/wx-location/main.vue'; |
| 97 | + import WxMusic from '@/views/mp/components/wx-music/main.vue'; | |
| 106 | 98 | |
| 107 | 99 | export default { |
| 108 | 100 | name: "wxMsg", |
| ... | ... | @@ -111,7 +103,8 @@ |
| 111 | 103 | WxVideoPlayer, |
| 112 | 104 | WxVoicePlayer, |
| 113 | 105 | WxNews, |
| 114 | - WxLocation | |
| 106 | + WxLocation, | |
| 107 | + WxMusic | |
| 115 | 108 | }, |
| 116 | 109 | props: { |
| 117 | 110 | wxUserId: { |
| ... | ... | @@ -245,19 +238,6 @@ |
| 245 | 238 | .msg-send { |
| 246 | 239 | padding: 10px; |
| 247 | 240 | } |
| 248 | -.avue-comment__main { | |
| 249 | - flex: unset!important; | |
| 250 | - border-radius: 5px!important; | |
| 251 | - margin: 0 8px!important; | |
| 252 | -} | |
| 253 | -.avue-comment__header { | |
| 254 | - border-top-left-radius: 5px; | |
| 255 | - border-top-right-radius: 5px; | |
| 256 | -} | |
| 257 | -.avue-comment__body { | |
| 258 | - border-bottom-right-radius: 5px; | |
| 259 | - border-bottom-left-radius: 5px; | |
| 260 | -} | |
| 261 | 241 | .avatar-div { |
| 262 | 242 | text-align: center; |
| 263 | 243 | width: 80px; | ... | ... |
yudao-ui-admin/src/views/mp/components/wx-music/main.vue
0 → 100644
| 1 | +<!-- | |
| 2 | + 【微信消息 - 音乐】 | |
| 3 | +--> | |
| 4 | +<template> | |
| 5 | + <div> | |
| 6 | + <el-link type="success" :underline="false" target="_blank" :href="hqMusicUrl ? hqMusicUrl : musicUrl"> | |
| 7 | + <div class="avue-card__body" style="padding:10px;background-color: #fff;border-radius: 5px"> | |
| 8 | + <div class="avue-card__avatar"> | |
| 9 | + <img :src="thumbMediaUrl" alt=""/> | |
| 10 | + </div> | |
| 11 | + <div class="avue-card__detail"> | |
| 12 | + <div class="avue-card__title" style="margin-bottom:unset">{{ title }}</div> | |
| 13 | + <div class="avue-card__info" style="height: unset">{{ description }}</div> | |
| 14 | + </div> | |
| 15 | + </div> | |
| 16 | + </el-link> | |
| 17 | + </div> | |
| 18 | +</template> | |
| 19 | + | |
| 20 | +<script> | |
| 21 | + | |
| 22 | +export default { | |
| 23 | + name: "wxMusic", | |
| 24 | + props: { | |
| 25 | + title: { | |
| 26 | + required: false, | |
| 27 | + type: String | |
| 28 | + }, | |
| 29 | + description: { | |
| 30 | + required: false, | |
| 31 | + type: String | |
| 32 | + }, | |
| 33 | + musicUrl: { | |
| 34 | + required: false, | |
| 35 | + type: String | |
| 36 | + }, | |
| 37 | + hqMusicUrl: { | |
| 38 | + required: false, | |
| 39 | + type: String | |
| 40 | + }, | |
| 41 | + thumbMediaUrl: { | |
| 42 | + required: true, | |
| 43 | + type: String | |
| 44 | + }, | |
| 45 | + } | |
| 46 | +}; | |
| 47 | +</script> | |
| 48 | + | |
| 49 | +<style lang="scss" scoped> | |
| 50 | +/* 因为 joolun 实现依赖 avue 组件,该页面使用了 card.scc */ | |
| 51 | +@import '../wx-msg/card.scss'; | |
| 52 | +</style> | ... | ... |
yudao-ui-admin/src/views/mp/message/index.vue
| ... | ... | @@ -89,6 +89,10 @@ |
| 89 | 89 | <div v-else-if="scope.row.type === 'location'"> |
| 90 | 90 | <wx-location :label="scope.row.label" :location-y="scope.row.locationY" :location-x="scope.row.locationX" /> |
| 91 | 91 | </div> |
| 92 | + <div v-else-if="scope.row.type === 'music'"> | |
| 93 | + <wx-music :title="scope.row.title" :description="scope.row.description" :thumb-media-url="scope.row.thumbMediaUrl" | |
| 94 | + :music-url="scope.row.musicUrl" :hq-music-url="scope.row.hqMusicUrl" /> | |
| 95 | + </div> | |
| 92 | 96 | <div v-else> |
| 93 | 97 | <el-tag type="danger" size="mini">未知消息类型</el-tag> |
| 94 | 98 | </div> |
| ... | ... | @@ -119,6 +123,7 @@ import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue'; |
| 119 | 123 | import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'; |
| 120 | 124 | import WxMsg from '@/views/mp/components/wx-msg/main.vue'; |
| 121 | 125 | import WxLocation from '@/views/mp/components/wx-location/main.vue'; |
| 126 | +import WxMusic from '@/views/mp/components/wx-music/main.vue'; | |
| 122 | 127 | |
| 123 | 128 | export default { |
| 124 | 129 | name: "WxFansMsg", |
| ... | ... | @@ -126,7 +131,8 @@ export default { |
| 126 | 131 | WxVideoPlayer, |
| 127 | 132 | WxVoicePlayer, |
| 128 | 133 | WxMsg, |
| 129 | - WxLocation | |
| 134 | + WxLocation, | |
| 135 | + WxMusic | |
| 130 | 136 | }, |
| 131 | 137 | data() { |
| 132 | 138 | return { | ... | ... |