Skip to content

Commit 49921e8

Browse files
committed
mp:增加发送【图文】消息
1 parent 0502eb1 commit 49921e8

File tree

3 files changed

+35
-20
lines changed

3 files changed

+35
-20
lines changed

src/api/mp/draft.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import request from '@/utils/request'
2+
3+
// 获得公众号草稿分页
4+
export function getDraftPage(query) {
5+
return request({
6+
url: '/mp/draft/page',
7+
method: 'get',
8+
params: query
9+
})
10+
}

src/views/mp/components/wx-material-select/main.vue

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103
import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue';
104104
import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue';
105105
import { getMaterialPage } from "@/api/mp/material";
106-
import {getFreePublishPage} from "@/api/mp/freePublish";
106+
import { getFreePublishPage } from "@/api/mp/freePublish";
107+
import {getDraftPage} from "@/api/mp/draft";
107108
108109
export default {
109110
name: "wxMaterialSelect",
@@ -136,8 +137,6 @@
136137
pageSize: 10,
137138
accountId: this.objData.accountId,
138139
},
139-
// tableOptionVoice: tableOptionVoice,
140-
// tableOptionVideo: tableOptionVideo,
141140
}
142141
},
143142
created() {
@@ -152,22 +151,7 @@
152151
if (this.objData.type === 'news' && this.newsType === '1') { // 【图文】+ 【已发布】
153152
this.getFreePublishPage();
154153
} else if (this.objData.type === 'news' && this.newsType === '2') { // 【图文】+ 【草稿】
155-
getPageNewsDraft(Object.assign({
156-
current: page.currentPage,
157-
size: page.pageSize,
158-
appId:this.appId,
159-
}, params)).then(response => {
160-
let tableData = response.data.items
161-
tableData.forEach(item => {
162-
item.mediaId = item.mediaId
163-
item.content.articles = item.content.newsItem
164-
})
165-
this.list = tableData
166-
this.page.total = response.data.totalCount
167-
this.page.currentPage = page.currentPage
168-
this.page.pageSize = page.pageSize
169-
this.loading = false
170-
})
154+
this.getDraftPage();
171155
} else { // 【素材】
172156
this.getMaterialPage();
173157
}
@@ -197,6 +181,21 @@
197181
}).finally(() => {
198182
this.loading = false
199183
})
184+
},
185+
getDraftPage() {
186+
getDraftPage((this.queryParams)).then(response => {
187+
// 将 thumbUrl 转成 picUrl,保证 wx-news 组件可以预览封面
188+
response.data.list.forEach(item => {
189+
const newsItem = item.content.newsItem;
190+
newsItem.forEach(article => {
191+
article.picUrl = article.thumbUrl;
192+
})
193+
})
194+
this.list = response.data.list
195+
this.total = response.data.total
196+
}).finally(() => {
197+
this.loading = false
198+
})
200199
}
201200
}
202201
};

src/views/mp/message/index.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,17 @@
9393
<wx-music :title="scope.row.title" :description="scope.row.description" :thumb-media-url="scope.row.thumbMediaUrl"
9494
:music-url="scope.row.musicUrl" :hq-music-url="scope.row.hqMusicUrl" />
9595
</div>
96+
<div v-else-if="scope.row.type === 'news'">
97+
<wx-news :articles="scope.row.articles" />
98+
</div>
9699
<div v-else>
97100
<el-tag type="danger" size="mini">未知消息类型</el-tag>
98101
</div>
99102
</template>
100103
</el-table-column>
101104
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
102105
<template slot-scope="scope">
106+
<!-- TODO 芋艿:增加消息按钮 -->
103107
<!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"-->
104108
<!-- v-hasPermi="['mp:message:update']">修改-->
105109
<!-- </el-button>-->
@@ -124,6 +128,7 @@ import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue';
124128
import WxMsg from '@/views/mp/components/wx-msg/main.vue';
125129
import WxLocation from '@/views/mp/components/wx-location/main.vue';
126130
import WxMusic from '@/views/mp/components/wx-music/main.vue';
131+
import WxNews from '@/views/mp/components/wx-news/main.vue';
127132
128133
export default {
129134
name: "WxFansMsg",
@@ -132,7 +137,8 @@ export default {
132137
WxVoicePlayer,
133138
WxMsg,
134139
WxLocation,
135-
WxMusic
140+
WxMusic,
141+
WxNews
136142
},
137143
data() {
138144
return {

0 commit comments

Comments
 (0)