diff --git a/pages/heartNew/heartNew.js b/pages/heartNew/heartNew.js index 3402473..57d24a0 100644 --- a/pages/heartNew/heartNew.js +++ b/pages/heartNew/heartNew.js @@ -58,6 +58,7 @@ Page({ gid: "", // indexNew isVolunteer: false, // 通过接口获取判断是否已注册过志愿者 defaultGridId: '', // 默认网格id 用于默认注册未注册的用户 + detailId: '', // 通过分享进入 团购详情的id }, /** @@ -571,16 +572,16 @@ Page({ //2021.04.07 志愿者独立小程序 indexNew indexNew (options) { this.getResidentConfig() - // if (options.shareType) { - // const para = { - // shareType: options.shareType, - // id: options.id, - // detailId: options.detailId, - // type: options.type ? options.type : "", - // defaultGridId: options.defaultGridId ? options.defaultGridId : "", - // } - // wx.setStorageSync("shareObj", JSON.stringify(para)) - // } + if (options.shareType) { + const para = { + shareType: options.shareType, + // id: options.id, + detailId: options.detailId, + // type: options.type ? options.type : "", + // defaultGridId: options.defaultGridId ? options.defaultGridId : "", + } + wx.setStorageSync("shareObj", JSON.stringify(para)) + } // if (options.scene) { // if (options.scene == 'module_ma_code_zyzqn' || options.scene == 'module_ma_code_lbzx') { // this.setData({ @@ -670,19 +671,24 @@ Page({ // } else if (that.data.sceneFrom == 'module_ma_code_lbzx') { // //that.toLaoBingZaiXian(1) // } - // if (wx.getStorageSync("shareObj")) { - // const para = JSON.parse(wx.getStorageSync("shareObj")) - // if (para.shareType === "heartDetail") { - // wx.navigateTo({ - // url: `/subpages/heart/pages/heartDetail/heartDetail?id=${para.id}` - // }) - // } else if (para.shareType === 'newsDetail') { - // wx.navigateTo({ - // url: `/subpages/home/pages/newsDetail/newsDetail?id=${para.detailId}` - // }) - // } - // wx.removeStorageSync("shareObj") - // } + if (wx.getStorageSync("shareObj")) { + const para = JSON.parse(wx.getStorageSync("shareObj")) + // if (para.shareType === "heartDetail") { + // wx.navigateTo({ + // url: `/subpages/heart/pages/heartDetail/heartDetail?id=${para.id}` + // }) + // } else if (para.shareType === 'newsDetail') { + // wx.navigateTo({ + // url: `/subpages/home/pages/newsDetail/newsDetail?id=${para.detailId}` + // }) + // } + if (para.shareType === 'groupBuyDetail') { + wx.navigateTo({ + url: `/subpages/heart/pages/groupBuyDetail/groupBuyDetail?id=${para.detailId}` + }) + } + wx.removeStorageSync("shareObj") + } that.onLoadConfig() } // } @@ -721,7 +727,7 @@ Page({ app.globalData.infoCompleted = state wx.removeStorageSync("token") wx.setStorageSync("token", res.data.token) - that.onLoadConfig() + that.getUserState() }) } } diff --git a/subpages/heart/pages/groupBuyDetail/groupBuyDetail.js b/subpages/heart/pages/groupBuyDetail/groupBuyDetail.js index e809786..8ab6416 100644 --- a/subpages/heart/pages/groupBuyDetail/groupBuyDetail.js +++ b/subpages/heart/pages/groupBuyDetail/groupBuyDetail.js @@ -92,9 +92,12 @@ Page({ /** * 用户点击右上角分享 */ - // onShareAppMessage: function () { - - // }, + onShareAppMessage: function () { + return { + title: '拼团购-团购详情', + path: `/pages/heartNew/heartNew?shareType=groupBuyDetail&detailId=${this.data.noticeId}` + } + }, //列表照片的放大查看 previewImage (e) {