From 0a353e2f43b08c9aa50d95c61c2a2189c748cdd1 Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Thu, 31 May 2018 18:03:52 +0800 Subject: [PATCH] no message --- pages/activity_detail/activity_detail.js | 103 ++++++++++++++++++++++- 1 file changed, 99 insertions(+), 4 deletions(-) diff --git a/pages/activity_detail/activity_detail.js b/pages/activity_detail/activity_detail.js index 101ea79..675e956 100644 --- a/pages/activity_detail/activity_detail.js +++ b/pages/activity_detail/activity_detail.js @@ -43,6 +43,7 @@ Page({ name: '朋友圈', icon: '../../images/moments_ico.png' }], + qrImageUrl: "", }, /** @@ -53,7 +54,26 @@ Page({ activityNo: options.activityNo == undefined ? "" : options.activityNo, groupNo: options.groupNo == undefined ? "" : options.groupNo, }); - + var that = this; + wx.request({ + url: getApp().gw.hostUrl + '/mall/wxa/activity/group/wxa_code', + method: 'get', + data: { + groupNo: that.data.groupNo, + width: 80, + page: 'index/index' + }, + header: { + 'Content-Type': 'application/x-www-form-urlencoded', + 'sessionId': wx.getStorageSync('sessionId') + }, + success: function (res) { + console.log(res) + if (res.statusCode == 200) { + that.data.qrImageUrl = res.data.msg; + } + } + }) }, /** * 生命周期函数--监听页面初次渲染完成 @@ -312,7 +332,7 @@ Page({ this.groupOpenOrJoin(url); } else { //团长与参与人立即预约 - + this.openActionsheet(); } } else if (that.data.status == 90){ //拼团失败 @@ -433,10 +453,85 @@ Page({ }, + //打败Actionsheet,进行分享 + openActionsheet: function () { + if (this.data.qrImageUrl.length == 0) { + wx.showLoading({ + title: '正在获取', + mask: true, + }); + var that = this; + wx.request({ + url: getApp().gw.hostUrl + '/mall/wxa/activity/group/wxa_code', + method: 'get', + data: { + groupNo: that.data.groupNo, + width: 80, + page: 'index/index' + }, + header: { + 'Content-Type': 'application/x-www-form-urlencoded', + 'sessionId': wx.getStorageSync('sessionId') + }, + success: function (res) { + wx.hideLoading(); + if (res.statusCode == 200) { + that.setData({ + qrImageUrl: res.data.msg, + show: true + }); + } else { + wx.showToast({ + title: '获取信息失败!', + icon: 'none', + duration: 1000 + }); + } + }, + fail: function (res) { + wx.hideLoading(); + wx.showToast({ + title: '网络错误!', + icon: 'none', + duration: 1000 + }); + } + }); + } else { + this.setData({ + 'show': true + }); + } + }, + + closeActionSheet: function () { + this.setData({ + 'show': false + }); + }, + + clickAction({ detail }) { + // 如果是分享按钮被点击, 不处理关闭 + const { index } = detail; + if (index === 0) { + return + } else if (index == 1) { + // this.showMomentImage(); + } + this.setData({ + [`show`]: false, + [`actions[${index}].loading`]: false + }); + }, + /** * 用户点击右上角分享 */ onShareAppMessage: function () { - - } + return { + title: '1号家政', + imageUrl: this.data.qrImageUrl, + path: '/pages/index/index', + }; + }, }) \ No newline at end of file