123456789101112131415161718192021222324252627282930 |
- // pages/me/me.js
- import * as requestAPI from '../../models/dataModel'
- Page({
- data: {
- isLogin: false,
- userName: ''
- },
- onLoad: function (options) {
- },
- onShow() {
- if(wx.getStorageSync('token') && !this.data.userName) {
- requestAPI.getUserInfo().then(res => {
- wx.setStorageSync('userName', res.data.data.sysUser.username);
- this.setData({
- userName: res.data.data.sysUser.username,
- isLogin: true
- })
- })
- }
- },
- login() {
- if(!this.data.isLogin) {
- wx.navigateTo({
- url: '/pages/login/login',
- })
- }
- }
- })
|