This commit is contained in:
shijingjing
2022-09-15 14:08:56 +08:00
parent 3ea39d2a12
commit 1bd1415eb8

View File

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