var config = require("../../config/config.js"); var app = getApp(); const Http = require("../../utils/HttpBasics"); Page({ /** * 页面的初始数据 */ data: { canIUse: wx.canIUse('official-account'), // user: { // avatar: // "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" // } flag: 'hidden', score:'0' }, navigateTo() { wx.navigateTo({ url: `/pages/login/index` }); }, showVersion: function() { /** * 长按显示版本号 */ let that = this; if (that.data.flag == 'hidden') { that.setData({ flag: 'show' }); } console.log(that.data.flag) }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() {}, /** * 生命周期函数--监听页面显示 */ onShow: function() { let that = this; let num = wx.getStorageSync('couponNum'); wx.hideTabBarRedDot({ index: 2 }); console.log("我是渲染") if (num == 'couponNum1') { wx.setStorage({ key: 'couponNum', data: "couponNum1", }) that.setData({ couponNum: "couponNum1" }) } else if (num == 'couponNum') { that.setData({ couponNum: "couponNum" }) }; Http.get({ url: config.api.getScore, data: {} }).then(res=>{ console.log(res); that.setData({ score: res.data.score }) }) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() {}, /** * 生命周期函数--监听页面卸载 */ onUnload: function() {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() {}, /** * 用户点击右上角分享 */ onShareAppMessage: function() {} });