// 转发微信 朋友圈
transArticle(data, type) {
let token=uni.getStorageSync(ACCESS_TOKEN);
if (!token) {
this.$tip.toast('请先登录')
return
}
// 文章标题
const contentTitle = data.title;
const imageUrl = this.$config.apiUrl + '/' + data.imageHref;
const summary = data.summary ? data.summary : '暂无简介';
const href = `${this.$config.apiUrl}/articleDetail?articleId=${data.id}&title=${encodeURIComponent(contentTitle)}&imageUrl=${imageUrl}&summary=${summary}`;
this.handleArticle(data, type)
uniShare({
content: { //公共的分享参数配置 类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
type: 0,
href,
title: contentTitle,
summary,
imageUrl,
},
menus: [
{
"img": "",
"text": "微信好友",
"share": { //当前项的分享参数配置。可覆盖公共的配置如下:分享到微信小程序,配置了type=5
"provider": "weixin",
"scene": "WXSceneSession"
}
},
{
"img": "",
"text": "朋友圈",
"share": {
"provider": "weixin",
"scene": "WXSenceTimeline"
}
}
],
cancelText: "",
}, e => {
console.log(e);
})
},
uniapp转发文章
最新推荐文章于 2023-07-20 21:15:22 发布