Commit 9f7b646f6c8c61c4238d99e1655c72de3e6bf66f

Authored by YunaiV
1 parent 02ccf52d

mp:增加发送【图文】消息

yudao-ui-admin/src/api/mp/draft.js 0 → 100644
  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 +}
yudao-ui-admin/src/views/mp/components/wx-material-select/main.vue
@@ -103,7 +103,8 @@ @@ -103,7 +103,8 @@
103 import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'; 103 import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue';
104 import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue'; 104 import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue';
105 import { getMaterialPage } from "@/api/mp/material"; 105 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";
107 108
108 export default { 109 export default {
109 name: "wxMaterialSelect", 110 name: "wxMaterialSelect",
@@ -136,8 +137,6 @@ @@ -136,8 +137,6 @@
136 pageSize: 10, 137 pageSize: 10,
137 accountId: this.objData.accountId, 138 accountId: this.objData.accountId,
138 }, 139 },
139 - // tableOptionVoice: tableOptionVoice,  
140 - // tableOptionVideo: tableOptionVideo,  
141 } 140 }
142 }, 141 },
143 created() { 142 created() {
@@ -152,22 +151,7 @@ @@ -152,22 +151,7 @@
152 if (this.objData.type === 'news' && this.newsType === '1') { // 【图文】+ 【已发布】 151 if (this.objData.type === 'news' && this.newsType === '1') { // 【图文】+ 【已发布】
153 this.getFreePublishPage(); 152 this.getFreePublishPage();
154 } else if (this.objData.type === 'news' && this.newsType === '2') { // 【图文】+ 【草稿】 153 } 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();
171 } else { // 【素材】 155 } else { // 【素材】
172 this.getMaterialPage(); 156 this.getMaterialPage();
173 } 157 }
@@ -197,6 +181,21 @@ @@ -197,6 +181,21 @@
197 }).finally(() => { 181 }).finally(() => {
198 this.loading = false 182 this.loading = false
199 }) 183 })
  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 + })
200 } 199 }
201 } 200 }
202 }; 201 };
yudao-ui-admin/src/views/mp/message/index.vue
@@ -93,6 +93,9 @@ @@ -93,6 +93,9 @@
93 <wx-music :title="scope.row.title" :description="scope.row.description" :thumb-media-url="scope.row.thumbMediaUrl" 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" /> 94 :music-url="scope.row.musicUrl" :hq-music-url="scope.row.hqMusicUrl" />
95 </div> 95 </div>
  96 + <div v-else-if="scope.row.type === 'news'">
  97 + <wx-news :articles="scope.row.articles" />
  98 + </div>
96 <div v-else> 99 <div v-else>
97 <el-tag type="danger" size="mini">未知消息类型</el-tag> 100 <el-tag type="danger" size="mini">未知消息类型</el-tag>
98 </div> 101 </div>
@@ -100,6 +103,7 @@ @@ -100,6 +103,7 @@
100 </el-table-column> 103 </el-table-column>
101 <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> 104 <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
102 <template slot-scope="scope"> 105 <template slot-scope="scope">
  106 + <!-- TODO 芋艿:增加消息按钮 -->
103 <!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"--> 107 <!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"-->
104 <!-- v-hasPermi="['mp:message:update']">修改--> 108 <!-- v-hasPermi="['mp:message:update']">修改-->
105 <!-- </el-button>--> 109 <!-- </el-button>-->
@@ -124,6 +128,7 @@ import WxVoicePlayer from &#39;@/views/mp/components/wx-voice-play/main.vue&#39;; @@ -124,6 +128,7 @@ import WxVoicePlayer from &#39;@/views/mp/components/wx-voice-play/main.vue&#39;;
124 import WxMsg from '@/views/mp/components/wx-msg/main.vue'; 128 import WxMsg from '@/views/mp/components/wx-msg/main.vue';
125 import WxLocation from '@/views/mp/components/wx-location/main.vue'; 129 import WxLocation from '@/views/mp/components/wx-location/main.vue';
126 import WxMusic from '@/views/mp/components/wx-music/main.vue'; 130 import WxMusic from '@/views/mp/components/wx-music/main.vue';
  131 +import WxNews from '@/views/mp/components/wx-news/main.vue';
127 132
128 export default { 133 export default {
129 name: "WxFansMsg", 134 name: "WxFansMsg",
@@ -132,7 +137,8 @@ export default { @@ -132,7 +137,8 @@ export default {
132 WxVoicePlayer, 137 WxVoicePlayer,
133 WxMsg, 138 WxMsg,
134 WxLocation, 139 WxLocation,
135 - WxMusic 140 + WxMusic,
  141 + WxNews
136 }, 142 },
137 data() { 143 data() {
138 return { 144 return {