小程序,链接
This commit is contained in:
@@ -120,25 +120,6 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
// msgtype: "miniprogram", // 消息类型,必填
|
||||
// miniprogram: {
|
||||
// appid: "", // 小程序的appid
|
||||
// title: "", // 小程序消息的title
|
||||
// imgUrl : "", //小程序消息的封面图。必须带http或者https协议头
|
||||
// page: "", //小程序消息打开后的路径,注意要以.html作为后缀,否则在微信端打开会提示找不到页面
|
||||
// },
|
||||
// },
|
||||
|
||||
// {
|
||||
// msgtype: "file", // 消息类型,必填,从3.1.12版本开始支持
|
||||
// file:{
|
||||
// mediaid:"", // 文件的素材id,必填
|
||||
// },
|
||||
// },
|
||||
|
||||
toSend() {
|
||||
// 文本
|
||||
const text = {
|
||||
@@ -155,7 +136,7 @@ export default {
|
||||
},
|
||||
}
|
||||
})
|
||||
data.push(imgs)
|
||||
// data.push(imgs)
|
||||
// 视频
|
||||
const videos = this.videoList.map(v =>{
|
||||
return {
|
||||
@@ -165,7 +146,7 @@ export default {
|
||||
},
|
||||
}
|
||||
})
|
||||
data.push(videos)
|
||||
// data.push(videos)
|
||||
// 文件
|
||||
const files = this.fileList.map(v => {
|
||||
return {
|
||||
@@ -175,21 +156,34 @@ export default {
|
||||
},
|
||||
}
|
||||
})
|
||||
data.push(files)
|
||||
// data.push(files)
|
||||
|
||||
// 链接
|
||||
// const links = this.webpage.map(v =>{
|
||||
// return {
|
||||
// msgtype: "link", // 消息类型,必填
|
||||
// link: {
|
||||
// title: "", // H5消息标题
|
||||
// imgUrl: "", // H5消息封面图片URL
|
||||
// desc: "", // H5消息摘要
|
||||
// url: "", // H5消息页面url 必填
|
||||
// },
|
||||
// }
|
||||
// })
|
||||
const links = this.webpage.map(v =>{
|
||||
return {
|
||||
msgtype: "link",
|
||||
link: {
|
||||
title: v.linkTitle,
|
||||
imgUrl: v.linkPicUrl,
|
||||
desc: v.linkDesc,
|
||||
url: v.linkUrl,
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
// 小程序
|
||||
const miniapps = this.miniapp.map(v =>{
|
||||
return {
|
||||
msgtype: "miniprogram",
|
||||
miniprogram: {
|
||||
appid: v.mpAppid, // 小程序的appid
|
||||
title: v.mpTitle, // 小程序消息的title
|
||||
imgUrl : v.sysFile.accessUrl, //小程序消息的封面图。必须带http或者https协议头
|
||||
page: v.mpPage, //小程序消息打开后的路径,注意要以.html作为后缀,否则在微信端打开会提示找不到页面
|
||||
},
|
||||
}
|
||||
})
|
||||
data = [ ...imgs, ...videos, ...files, ...links, ...miniapps ]
|
||||
this.shareToExternalChat({ text: text, attachments: data }).then((res) =>{
|
||||
console.log(res,'返回的数据');
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user