setting.js 755 B

123456789101112131415161718192021222324252627282930313233343536
  1. // miniprogram/pages/setting/setting.js
  2. const app = getApp()
  3. Page({
  4. data: {
  5. userInfo: null,
  6. hasUserInfo: false,
  7. notiForm: 0,
  8. notiFormType: ['数字', '红点', '不显示']
  9. },
  10. logout: function () {
  11. app.globalData.hasUserInfo = false
  12. app.globalData.userNotFound = true
  13. wx.navigateBack()
  14. },
  15. onLoad: function () {
  16. if (app.globalData.hasUserInfo) {
  17. this.setData({
  18. userInfo: app.globalData.userInfo,
  19. hasUserInfo: true,
  20. notiForm: app.globalData.notiForm
  21. })
  22. } else {
  23. wx.showToast({
  24. title: '请先登录',
  25. icon: 'none'
  26. })
  27. }
  28. },
  29. onUnload: function () {
  30. app.globalData.notiForm = this.data.notiForm
  31. }
  32. })