import { imgServerUrl } from '../../config/config.js' import { showToast } from '../../utils/tips.js' var app = getApp() Page({ /** * 页面的初始数据 */ data: { imgServerUrl: imgServerUrl, }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { }, toclear() { wx.showModal({ title: '清除缓存', content: '是否清除所有缓存内容', success(res) { if (res.confirm) { try { wx.clearStorage({ success: function(res) { wx.clearStorageSync() app.globalData.userId = ''; app.globalData.userToken = ''; app.globalData.memberId = ''; app.globalData.userInfo = null; showToast('清除成功') } }) } catch (e) { // Do something when catch error } } else if (res.cancel) { console.log('用户点击取消') } } }) }, toabout() { wx.navigateTo({ url: '../about/index', }) }, login_out() { wx.showModal({ title: '提示', content: '确定退出登录吗?', success: function(res) { if (res.confirm) { //清除登录缓存 wx.removeStorageSync("user_id"); wx.removeStorageSync("member_id"); wx.removeStorageSync("user_token"); wx.removeStorageSync("userInfo"); app.globalData.userId = ''; app.globalData.userToken = ''; app.globalData.memberId = ''; app.globalData.userInfo = null; showToast('退出成功'); setTimeout(function () { wx.navigateBack(); }, 500) } else if (res.cancel) { } } }) } })