// pages/my/index.js const api = require("../../utils/request.js"); const app = getApp() Page({ data: { total:0, avg_score:0, pass_rate:0, nowWork:'点击选择', infoView:false }, onLoad: function (options) { }, onReady: function () { }, onShow: function () { this.setData({ infoView:false }) let userinfo = wx.getStorageSync('userinfo'); if(userinfo.username){ userinfo.username = userinfo.username.replace(/(\d{3})(\d{4})(\d{4})/,"$1****$3") } this.setData({ userinfo: getApp().globalData.userinfo, avatar:app.globalData.mediahost + getApp().globalData.userinfo.avatar }) api.request('/examtest/examtest/fx/', 'GET').then(res => { this.setData(res.data) }) }, getMyInfo:function(e){ this.setData({ userInfo :e.detail.userInfo }) // let info = e.detail.userInfo; // this.setData({name : info.nickName,src:info.avatarUrl}) }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, closeView(){ this.setData({ infoView:false }) }, register: function() { var that = this if (that.data.userinfo&&that.data.userinfo.role_name=='游客'){ wx.reLaunch({ url: '/pages/login/login', }) }else{ that.setData({ infoView :true }) } }, //修改基本信息: onButtonClick() { let userinfo = wx.getStorageSync('userinfo'); wx.navigateTo({ url: '/pages/login/registe/registe' // 目标页面路径 }); }, })