// packageH/blindBox/blindBoxHelping/blindBoxHelping.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { assist_id: '', member_id: '', currentTime: parseInt(new Date().getTime() / 1000), contactShow: false, friendsShow: false, assist: {}, activity: {}, member: {} }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ assist_id: options.assist_id, member_id: options.member_id }); if(options.member_id){ // 绑定上下级 app._setMid(options.member_id); } if (options.scene) { let scene = decodeURIComponent(options.scene); if (scene) { var info_arr = []; info_arr = scene.split(","); // console.log(info_arr,"info_arr") for (let i = 0; i < info_arr.length; i++) { let chil_arr = []; chil_arr = info_arr[i].split("="); if (chil_arr[0] == "id") { this.setData({ assist_id: chil_arr[1], }); } else if (chil_arr[0] == "mid") { app._setMid(chil_arr[1]); this.setData({ member_id: chil_arr[1], }); } } } } this.getData(); }, callPhone() { wx.makePhoneCall({ phoneNumber: this.data.activity.cservice_phone //仅为示例,并非真实的电话号码 }); }, imgHeight(e) { console.log(e); this.setData({ heightImg: e.detail.height }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { let that = this; let assist_id = this.data.assist.id; let member_id = this.data.assist.member_id; let _path = '/packageH/blindBox/blindBoxHelping/blindBoxHelping?assist_id=' + assist_id + '&member_id=' + member_id; return { title: that.data.activity.activity_name ? that.data.activity.activity_name : '', path: _path, imageUrl: that.data.activity.activity_img_src ? that.data.activity.activity_img_src : '' }; }, getData() { let that = this; let urlStr = app.getNetAddresss('plugin.blind-box.api.assist.get-assist'); app._postNetWork({ url: urlStr, data: { id: that.data.assist_id, member_id: that.data.member_id }, success: (resdata) => { let res = resdata.data; wx.hideLoading({ success: (res) => {}, }); if (res.result == 1) { that.setData({ assist: res.data.assist, activity: res.data.assist.activity, member: res.data.assist.member }); } else { console.log(res); wx.showToast({ title: res.msg, duration: 1000, icon: 'none' }); } }, fail: function (res) { console.log(res.msg); } }); }, // 助力 heplAssist() { let that = this; let urlStr = app.getNetAddresss('plugin.blind-box.api.assist.assist'); app._postNetWork({ url: urlStr, data: { id: that.data.assist_id, }, success: (resdata) => { let res = resdata.data; wx.hideLoading({ success: (res) => {}, }); if (res.result == 1) { that.setData({ friendsShow: true }); that.getData(); } else { console.log(res); wx.showToast({ title: res.msg, duration: 1000, icon: 'none' }); } }, fail: function (res) { console.log(res.msg); } }); }, gotoDetails() { wx.navigateTo({ url: '/packageH/blindBox/blindBoxDetail/blindBoxDetail?id=' + this.data.activity.id, }); }, generateAssist() { this.addJoinLog(); let that = this; let urlStr = app.getNetAddresss('plugin.blind-box.api.assist.generate-assist'); app._postNetWork({ url: urlStr, data: { id: that.data.activity.id, }, success: (resdata) => { let res = resdata.data; wx.hideLoading({ success: (res) => {}, }); if (res.result == 1) { wx.navigateTo({ url: '/packageH/blindBox/blindBoxDetail/blindBoxDetail?id=' + that.data.activity.id, }); } else { wx.showToast({ title: res.msg, duration: 1000, icon: 'none' }); } }, fail: function (res) { console.log(res.msg); } }); }, addJoinLog() { let that = this; let urlStr = app.getNetAddresss('plugin.blind-box.api.index.join-log'); app._postNetWork({ url: urlStr, data: { id: that.data.activity.id, }, success: (resdata) => { // let res = resdata.data; wx.hideLoading({ success: (res) => {}, }); }, fail: function (res) { console.log(res.msg); } }); }, goOrder() { wx.navigateTo({ url: '/packageA/member/myOrder_v2/myOrder_v2?status=0', }); }, contactShowTap() { this.setData({ contactShow: true }); }, friendsShowClose() { this.setData({ friendsShow: false }); }, previewImage: function (e) { console.log('浏览图片'); var current = this.data.activity.cservice_code_src; //这里获取到的是一张本地的图片 wx.previewImage({ current: current, //需要预览的图片链接列表 urls: [current] //当前显示图片的链接 }); }, contactShowClose() { this.setData({ contactShow: false }); } });