| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- 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) {
- }
- }
- })
- }
- })
|