Commit 1ec343aa by 张卓

小程序原生支持多主题自定义分享图片和标题

parent fd9dc36e
...@@ -304,7 +304,7 @@ export default { ...@@ -304,7 +304,7 @@ export default {
this.pageInfo = pageList.filter((item) => item.pageCode == 1)[0]; this.pageInfo = pageList.filter((item) => item.pageCode == 1)[0];
this.pageData = JSON.parse(this.pageInfo.pageData); this.pageData = JSON.parse(this.pageInfo.pageData);
console.log("36", this.pageData); console.log("36", this.pageData,this.pageInfo.pageSettingData);
console.log(app.globalData.shopInfo,'app') console.log(app.globalData.shopInfo,'app')
wx.setNavigationBarTitle({title : app.globalData.shopInfo.shopName}) wx.setNavigationBarTitle({title : app.globalData.shopInfo.shopName})
...@@ -471,6 +471,7 @@ export default { ...@@ -471,6 +471,7 @@ export default {
let newHref = '/pages/home/main'; let newHref = '/pages/home/main';
let title = app.globalData.shopInfo.shopName; let title = app.globalData.shopInfo.shopName;
let hasInvitationStatus = 0; let hasInvitationStatus = 0;
if(wx.getStorageSync("sessionid")) {
await app.fenxiaoModel.getSpokesmanidByShare().then(data=>{ await app.fenxiaoModel.getSpokesmanidByShare().then(data=>{
hasInvitationStatus = data.hasInvitationStatus; hasInvitationStatus = data.hasInvitationStatus;
}) })
...@@ -490,11 +491,20 @@ export default { ...@@ -490,11 +491,20 @@ export default {
} }
newHref = concatUrl(newHref,newData) newHref = concatUrl(newHref,newData)
}) })
}
let imageUrl = '';
//多主题自定义分享标题和图片
if(this.pageInfo.pageSettingData&&JSON.parse(this.pageInfo.pageSettingData).shareTitle) {
title = JSON.parse(this.pageInfo.pageSettingData).shareTitle
}
if(this.pageInfo.pageSettingData&&JSON.parse(this.pageInfo.pageSettingData).shareImg) {
imageUrl = JSON.parse(this.pageInfo.pageSettingData).shareImg
}
console.log(newHref,3333555666,title,res) console.log(newHref,3333555666,title,res)
return { return {
title: title, // 默认是小程序的名称 title: title, // 默认是小程序的名称
path: newHref, // 默认是当前页面 path: newHref, // 默认是当前页面
// imageUrl: this.shareLogoUrl, imageUrl: imageUrl,
success: function(res) { success: function(res) {
// 转发成功之后的回调 // 转发成功之后的回调
if (res.errMsg == "shareAppMessage:ok") { if (res.errMsg == "shareAppMessage:ok") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment