var config = require("../../config/config.js"); var app = getApp(); const Http = require("../../utils/HttpBasics"); Page({ /** * 页面的初始数据 */ data: { canIUse: wx.canIUse('official-account'), flag: 'hidden', score:'0' }, /** * 跳转到成长值的页面 */ gotograde:function(){ wx.navigateTo({ url: '/pages/grade/grade', }) }, // getrun:function(){ // let that = this; // wx.getWeRunData({ // success: function (res) { // console.log(res); // Http.post({ // url: config.api.getWeRunData, // data: { // encryptedData: res.encryptedData, // iv: res.iv // } // }).then(res => { // console.log(res); // that.setData({ // step: res.data.stepInfoList[30].step // }) // }) // } // }) // }, /** * */ // getxinghao:function(){ // wx.getSystemInfo({ // success:function(res){ // console.log(res); // wx.showModal({ // content: res.brand, // }) // } // }) // }, 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) }, gotoedit:function(){ wx.navigateTo({ url: `/pages/edit/edit?name=${this.data.name}&birthdate=${this.data.birthdate}&sex=${this.data.sex}&address=${this.data.address}`, }) }, /** * 生命周期函数--监听页面加载 */ 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, levelName: res.data.levelName }) if(res.data.address&&res.data.name&&res.data.sex&&res.data.birthdate){ that.setData({ address: res.data.address, name: res.data.name, sex: res.data.sex, birthdate: res.data.birthdate }) } }); // that.getrun(); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() {}, /** * 生命周期函数--监听页面卸载 */ onUnload: function() {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() {}, /** * 用户点击右上角分享 */ onShareAppMessage: function() {} });