prevention/pages/mine/mine.js

48 lines
1.1 KiB
JavaScript

// pages/mine/mine.js
import {getFlightData, getTaskTotal} from '../../api/mine.js'
Page({
/**
* 页面的初始数据
*/
data: {
userInfo: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let userInfo = wx.getStorageSync('userInfo')
this.setData({userInfo: userInfo})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
// 退出登录
outLogin: function(event) {
wx.showModal({
title: '确认',
content: '确认要退出登录吗?',
success (res) {
if (res.confirm) {
wx.removeStorageSync('token')
wx.removeStorageSync('userInfo')
wx.reLaunch({
url: '/pages/login/login',
})
} else if (res.cancel) {
wx.switchTab({
url: '/pages/mine/mine',
})
}
}
})
}
})