Commit 1ec343aa by 张卓

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

parent fd9dc36e
......@@ -304,7 +304,7 @@ export default {
this.pageInfo = pageList.filter((item) => item.pageCode == 1)[0];
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')
wx.setNavigationBarTitle({title : app.globalData.shopInfo.shopName})
......@@ -471,30 +471,40 @@ export default {
let newHref = '/pages/home/main';
let title = app.globalData.shopInfo.shopName;
let hasInvitationStatus = 0;
await app.fenxiaoModel.getSpokesmanidByShare().then(data=>{
hasInvitationStatus = data.hasInvitationStatus;
})
await app.fenxiaoModel.getSpokesmanInfo().then(data=>{
let newData = {}
if (hasInvitationStatus == 1) {
newData = {
spokesmanGroupId: data.groupId,
spokesmanShopId: data.shopId,
spokesmanRelId: data.id,
userId: data.userId
}
}else {
newData = {
userId: data.userId
if(wx.getStorageSync("sessionid")) {
await app.fenxiaoModel.getSpokesmanidByShare().then(data=>{
hasInvitationStatus = data.hasInvitationStatus;
})
await app.fenxiaoModel.getSpokesmanInfo().then(data=>{
let newData = {}
if (hasInvitationStatus == 1) {
newData = {
spokesmanGroupId: data.groupId,
spokesmanShopId: data.shopId,
spokesmanRelId: data.id,
userId: data.userId
}
}else {
newData = {
userId: data.userId
}
}
}
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)
return {
title: title, // 默认是小程序的名称
path: newHref, // 默认是当前页面
// imageUrl: this.shareLogoUrl,
imageUrl: imageUrl,
success: function(res) {
// 转发成功之后的回调
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