setting.js 803 B

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