Skip to content

Commit 519909e

Browse files
committed
mp:增加【视频】消息的发送
1 parent 8766834 commit 519909e

File tree

2 files changed

+24
-32
lines changed

2 files changed

+24
-32
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<!-- 列表 -->
2929
<el-table v-loading="loading" :data="list">
3030
<el-table-column label="编号" align="center" prop="mediaId" />
31-
<el-table-column label="名字" align="center" prop="name" />
31+
<el-table-column label="文件名" align="center" prop="name" />
3232
<el-table-column label="语音" align="center">
3333
<template v-slot="scope">
3434
<wx-voice-player :url="scope.row.url" />
@@ -54,6 +54,7 @@
5454
<!-- 列表 -->
5555
<el-table v-loading="loading" :data="list">
5656
<el-table-column label="编号" align="center" prop="mediaId" />
57+
<el-table-column label="文件名" align="center" prop="name" />
5758
<el-table-column label="标题" align="center" prop="title" />
5859
<el-table-column label="介绍" align="center" prop="introduction" />
5960
<el-table-column label="视频" align="center">

src/views/mp/components/wx-reply/main.vue

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,16 @@
8181
</el-dialog>
8282
</el-row>
8383
</el-tab-pane>
84+
<!-- 类型 4:视频 -->
8485
<el-tab-pane name="video">
8586
<span slot="label"><i class="el-icon-share"></i> 视频</span>
8687
<el-row>
87-
<el-input v-model="objData.repName" placeholder="请输入标题"></el-input>
88+
<el-input v-model="objData.title" placeholder="请输入标题"></el-input>
8889
<div style="margin: 20px 0;"></div>
89-
<el-input v-model="objData.repDesc" placeholder="请输入描述"></el-input>
90+
<el-input v-model="objData.description" placeholder="请输入描述"></el-input>
9091
<div style="margin: 20px 0;"></div>
9192
<div style="text-align: center;">
92-
<a target="_blank" v-if="objData.url" :href="objData.url"><i class="icon-shipinbofang">&nbsp;播放视频</i></a>
93+
<wx-video-player v-if="objData.url" :url="objData.url" />
9394
</div>
9495
<div style="margin: 20px 0;"></div>
9596
<div style="text-align: center">
@@ -161,13 +162,15 @@
161162
import WxNews from '@/views/mp/components/wx-news/main.vue'
162163
import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue'
163164
import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue';
165+
import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue';
164166
165167
export default {
166168
name: "wxReplySelect",
167169
components: {
168170
WxNews,
169171
WxMaterialSelect,
170-
WxVoicePlayer
172+
WxVoicePlayer,
173+
WxVideoPlayer
171174
},
172175
props: {
173176
objData: { // 消息对象。
@@ -354,27 +357,22 @@
354357
|| this.objData.type === 'voice') {
355358
tempObjItem.mediaId = item.mediaId
356359
this.objData.mediaId = item.mediaId
357-
if (item.url) {
358-
tempObjItem.url = item.url;
359-
this.objData.url = item.url;
360-
} else { // 必须使用 $delete 删除,否则 vue 监听不到数据
361-
this.$delete(this.objData, 'url');
362-
}
360+
tempObjItem.url = item.url;
361+
this.objData.url = item.url;
363362
tempObjItem.name = item.name
364363
this.objData.name = item.name
365364
} else if (this.objData.type === 'video') {
366-
// getMaterialVideo({
367-
// mediaId:item.mediaId
368-
// }).then(response => {
369-
// if(response.code == 200){
370-
// let data = response.data
371-
// this.$set(this.objData,'repName',data.title)
372-
// this.$set(this.objData,'repDesc',data.description)
373-
// this.$set(this.objData,'url',data.downUrl)
374-
// tempObjItem.repDesc = data.description
375-
// tempObjItem.url = data.downUrl
376-
// }
377-
// })
365+
tempObjItem.mediaId = item.mediaId
366+
this.objData.mediaId = item.mediaId
367+
tempObjItem.url = item.url;
368+
this.objData.url = item.url;
369+
tempObjItem.name = item.name
370+
this.objData.name = item.name
371+
// title、introduction
372+
this.objData.title = item.title
373+
tempObjItem.title = this.objData.title
374+
this.objData.description = item.introduction // 消息使用的是 description,素材使用的是 introduction,所以转换下
375+
tempObjItem.description = this.objData.introduction
378376
}
379377
// 最终设置到临时缓存
380378
this.tempObj.set(this.objData.type, tempObjItem)
@@ -400,15 +398,8 @@
400398
this.dialogThumbVisible = false
401399
},
402400
deleteObj() {
403-
console.log('删除!');
404-
if (this.objData.type === 'news') {
405-
// TODO 芋艿,待实现
406-
} else if(this.objData.type === 'image'
407-
|| this.objData.type === 'voice') {
408-
this.selectMaterial({}) // 选择一个空的素材
409-
} else if(this.objData.type === 'video') {
410-
// TODO 芋艿,待实现
411-
}
401+
// this.$delete(this.objData, 'url'); TODO 芋艿:重新实现清空;还有 reset
402+
this.selectMaterial({}) // 选择一个空的素材
412403
},
413404
getPage(page, params) {
414405
this.tableLoading = true

0 commit comments

Comments
 (0)