// pages/home/tab4/index.js import { getFactoryPrice, userPushFollowMill } from '../../api/ztb' const event = require('../../../utils/event.js') const storage = require('../../../utils/storage') const app = getApp() Page({ /** * 页面的初始数据 */ data: { loopRequesting: false, form: { paperMillIds: [], }, model: { paperMillIds: [], cityId: '', enableSalesAgent: 1, pageNum: 1, listType: 0, pageSize: 1000 }, categoryListone: [], safeBottom: app.globalData.safeBottom, userInfo: null, loading: true }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ safeBottom: app.globalData.safeBottom, userInfo: app.globalData.userInfo }) this.getFactoryPriceFct(this.data.model) }, toMyInfo: function () { event.emit('EventMessage', { what: 1100, desc: 'attentionPaperList' }) wx.navigateBack() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, /** * 分享至朋友圈 */ onShareTimeline: function (){ }, backspace: function () { // console.log('点击返回被触发4') wx.redirectTo({ url: '/pages/home/tab3/index' }) }, getFactoryPriceFct: function (model) { getFactoryPrice(model).then(res => { this.setData({ categoryListone: res.data.records, loading: false }) }) }, checkboxChange: function (e) { console.log(e) this.setData({ 'form.paperMillIds': e.detail.value, 'form.follow': true }) }, bindtap: function (e) { console.log(e) }, submitForm: function () { userPushFollowMill(this.data.form).then(result => { this.data.loopRequesting = false setTimeout(() => this.toMyInfo(), 1000) }).catch(err => { this.data.loopRequesting = false }) } })