小程序,链接

This commit is contained in:
shijingjing
2022-09-15 15:06:20 +08:00
parent 33330ac9d3
commit e4c3e61b31

View File

@@ -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() { toSend() {
// 文本 // 文本
const text = { const text = {
@@ -155,7 +136,7 @@ export default {
}, },
} }
}) })
data.push(imgs) // data.push(imgs)
// 视频 // 视频
const videos = this.videoList.map(v =>{ const videos = this.videoList.map(v =>{
return { return {
@@ -165,7 +146,7 @@ export default {
}, },
} }
}) })
data.push(videos) // data.push(videos)
// 文件 // 文件
const files = this.fileList.map(v => { const files = this.fileList.map(v => {
return { return {
@@ -175,21 +156,34 @@ export default {
}, },
} }
}) })
data.push(files) // data.push(files)
// 链接 // 链接
// const links = this.webpage.map(v =>{ const links = this.webpage.map(v =>{
// return { return {
// msgtype: "link", // 消息类型,必填 msgtype: "link",
// link: { link: {
// title: "", // H5消息标题 title: v.linkTitle,
// imgUrl: "", // H5消息封面图片URL imgUrl: v.linkPicUrl,
// desc: "", // H5消息摘要 desc: v.linkDesc,
// url: "", // H5消息页面url 必填 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) =>{ this.shareToExternalChat({ text: text, attachments: data }).then((res) =>{
console.log(res,'返回的数据'); console.log(res,'返回的数据');
}) })