| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { removeUserInfo, removeToken } from '../../utils/storage'
- import EventEmitter from '../../utils/eventEmitter'
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- userinfo: app.globalData.userinfo
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onShow: function () {
- this.setData({
- userinfo: app.globalData.userinfo
- })
- },
- chooseImage () {
- wx.chooseImage({
- success: (res) => {
- const path = res.tempFilePaths[0]
- wx.navigateTo({
- url: `/pages/avatar-cropper/avatar-cropper?img_src=${path}`,
- })
- },
- })
- },
- logout () {
- removeUserInfo()
- removeToken()
- app.globalData.token = ''
- app.globalData.userinfo = {}
- EventEmitter.emit('logout')
- wx.navigateBack()
- }
- })
|