index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import {
  2. imgServerUrl
  3. } from '../../config/config.js'
  4. import {
  5. showToast
  6. } from '../../utils/tips.js'
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. imgServerUrl: imgServerUrl,
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad: function(options) {
  18. },
  19. toclear() {
  20. wx.showModal({
  21. title: '清除缓存',
  22. content: '是否清除所有缓存内容',
  23. success(res) {
  24. if (res.confirm) {
  25. try {
  26. wx.clearStorage()
  27. wx.clearStorageSync()
  28. showToast('清除成功')
  29. } catch (e) {
  30. // Do something when catch error
  31. }
  32. } else if (res.cancel) {
  33. console.log('用户点击取消')
  34. }
  35. }
  36. })
  37. },
  38. toabout() {
  39. wx.navigateTo({
  40. url: '../about/index',
  41. })
  42. },
  43. login_out() {
  44. wx.showModal({
  45. title: '提示',
  46. content: '确定退出登录吗?',
  47. success: function(res) {
  48. if (res.confirm) {
  49. //清除登录缓存
  50. wx.removeStorageSync("user_id");
  51. wx.removeStorageSync("member_id");
  52. wx.removeStorageSync("user_token");
  53. } else if (res.cancel) {
  54. }
  55. }
  56. })
  57. }
  58. })