diff --git a/src/apps/AppCooperationPropaganda/massDispatch.vue b/src/apps/AppCooperationPropaganda/massDispatch.vue index 4b5c387c..26097bf2 100644 --- a/src/apps/AppCooperationPropaganda/massDispatch.vue +++ b/src/apps/AppCooperationPropaganda/massDispatch.vue @@ -141,42 +141,49 @@ export default { toSend() { // 文本 - const text = { - content: this.content + if(this.content.length) { + const text = { + content: this.content + } } const data = [] // 图片 - const imgs = this.picList.map(v =>{ - return { - msgtype: "image", - image: { - mediaid: v.mediaId, - imgUrl: v.imgPicUrl, - }, - } - }) - data.push(imgs) + if(this.picList.length) { + const imgs = this.picList.map(v =>{ + return { + msgtype: "image", + image: { + mediaid: v.mediaId, + imgUrl: v.imgPicUrl, + }, + } + }) + data.push(imgs) + } // 视频 - const videos = this.videoList.map(v =>{ - return { - msgtype: "video", - video:{ - mediaid: v.mediaId, - }, - } - }) - data.push(videos) + if(this.videoList.length) { + const videos = this.videoList.map(v =>{ + return { + msgtype: "video", + video:{ + mediaid: v.mediaId, + }, + } + }) + data.push(videos) + } // 文件 - const files = this.fileList.map(v => { - return { - msgtype: "file", - file:{ - mediaid: v.mediaId, - }, - } - }) - data.push(files) - + if(this.fileList.length) { + const files = this.fileList.map(v => { + return { + msgtype: "file", + file:{ + mediaid: v.mediaId, + }, + } + }) + data.push(files) + } // 链接 // const links = this.webpage.map(v =>{ // return { @@ -189,11 +196,8 @@ export default { // }, // } // }) - - - this.shareToExternalChat({ ...text, attachments: data }).then((res) =>{ - console.log(res,'返回的数据'); + console.log(res, '返回的数据'); }) }, },