examtest_mp/pages/my/index.js

61 lines
1.2 KiB
JavaScript

// pages/my/index.js
const api = require("../../utils/request.js");
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: userinfo,
})
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
})
}
}
})