let common = getApp().globalData.commonFun; let util = getApp().globalData.utilFun; const WxParse = require('../../wxParse/wxParse.js'); Page({ /** * 页面的初始数据 */ data: { swiper_index: 0, //显示内容 id: "", obj: {} }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { wx.showLoading({ title: '加载中...', mask: true }) this.setData({ id: options.id }) this.getData() }, getData() { let that = this let url = `api/product-detail?id=${this.data.id}` util.httpRequest(url).then((res) => { wx.hideLoading() if (res.code == '200') { let wxData = WxParse.wxParse('article', 'html', res.data.advantage, that, 5); let wxSet = WxParse.wxParse('brticle', 'html', res.data.ask, that, 5); let wxGet = WxParse.wxParse('crticle', 'html', res.data.attr, that, 5); that.store(wxData); that.store(wxSet); that.store(wxGet); res.data.tag = res.data.tag.split(",") this.setData({ obj: res.data }) console.log(this.data.obj) } }) }, // 跳转到初审 first() { if (!wx.getStorageSync("userInfo")) { wx.showModal({ title: '提示', content: '前去登录', success(res) { if (res.confirm) { wx.switchTab({ url: `../../pages/my/my`, }) } else if (res.cancel) { console.log('用户点击取消') } } }) } else { wx.navigateTo({ url: `../../pages/toExamine/pages/first/first?id=${this.data.obj.id}&title=${this.data.obj.title}&type=${this.data.obj.product_type}&det_type=4`, }) } }, bidirectional(e) { //双向绑定 let name = e.currentTarget.dataset.name; let value = e.currentTarget.dataset.value; this.setData({ [name]: value }) }, swiperFun(e) { //切换事件 this.setData({ swiper_index: e.detail.current }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { }, /** * 生命周期函数--监听页面显示 */ onShow: function() { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { }, store(path) { this.setData(path) }, })