var app = getApp(); var util = require("../../utils/util.js") let wxParse = require("../../wxParse/wxParse.js"); Page({ /** * 页面的初始数据 */ data: { activityId: null, user: {}, bottomLeft: app.bottomLeft, appAssetsUrl: app.appAssetsUrl, appAssetsUrl2: app.appAssetsUrl2, detail: {}, member: {}, content: '', schoolInfo: {}, vipMessage: '', roleList: ['平台管理员', '校园代理人', '行家', '行家;平台管理员', '行家;校园代理人'], }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if (options.activityId) { this.setData({ activityId: options.activityId }) } this.setData({ detail: wx.getStorageSync('activityDetail'), user: wx.getStorageSync('USER') }) this.loadVipSel() console.log(this.data.detail.activityAppletsDetailsList,'detail.activityAppletsDetailsList') }, // 查看地图 goLocal() { let that = this let [latitude, longitude] = [this.data.detail.coordinate.split(',')[0], this.data.detail.coordinate.split(',')[1]] console.log(Number(latitude), Number(longitude)) wx.openLocation({ latitude: Number(longitude), longitude: Number(latitude), name: that.data.title, address: that.data.address, success: function () { console.log("success"); }, }); }, loadVipSel() { let _this = this; wx.showLoading({ title: '努力加载中...', }) app._post_form('wgfillinfo/apiSelectwgfillinfo', 'application/json', null, function (res) { if (res.code === 0) { setTimeout(function () { wxParse.wxParse('vipMessage', 'html', res.wgFillInfo.vipMessage, _this, 5) }, 300) } } ) }, // 查看二维码 seeCode() { this.popup3.showPopup(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { //获得popup组件 this.popup3 = this.selectComponent("#popup3"); // 二维码 }, /** * 生命周期函数--监听页面显示 */ onShow: function () {}, /** * 生命周期函数--监听页面隐藏 */ onHide: function () {}, /** * 生命周期函数--监听页面卸载 */ onUnload: function () {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, submit() { wx.showLoading({ title: '提交中...', }) if (this.data.activityId) { app._put_form('activity/updateActivity', '', { ...this.data.detail, id: this.data.activityId }, res => { if (res.code === 0) { wx.showToast({ title: '修改成功', }) wx.removeStorageSync('activityDetail') wx.switchTab({ url: '/pages/home/index/index', }) } }, err => {}, complete => { setTimeout(() => { wx.hideLoading() }, 300) }) } else { app._post_form('activity/saveActivity', '', this.data.detail, res => { if (res.code === 0) { wx.showToast({ title: '添加成功', }) wx.removeStorageSync('activityDetail') wx.switchTab({ url: '/pages/home/index/index', }) } }, err => {}, complete => { setTimeout(() => { wx.hideLoading() }, 300) }) } }, /** * 用户点击右上角分享 */ onShareAppMessage() {}, //取消事件 _error(e) { this.popup3.hidePopup(); }, //确认事件 _success(e) { this.popup3.hidePopup(); } })