拓恒河湖长制全民护河平台WEB端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.2KB

  1. // pages/mine/index.js
  2. import {getUserData} from '../../api/login.js'
  3. import {messageSum} from '../../api/mine.js'
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. userInfo: {}, // 用户授权信息
  10. list: [
  11. {title: '个人信息', type: 'userinfo', path: '/package_mine/pages/userInfo/index'},
  12. {title: '护河身份', type: 'myid', path: '/package_mine/pages/myId/index'},
  13. {title: '我的兑换', type: 'exchange', path: '/package_mine/pages/exchange/index'},
  14. {title: '河湖问题反馈', type: 'feedback', path: '/package_mine/pages/records/index'},
  15. // {title: '我的美拍', type: 'beauty', path: '/package_mine/pages/beauties/index'},
  16. {title: '消息通知', type: 'notice', path: '/package_mine/pages/notice/index',showNumbers: true},
  17. ],
  18. myId: '', // 身份
  19. integral: 0, // 积分
  20. numbers: 0
  21. },
  22. /**
  23. * 生命周期函数--监听页面加载
  24. */
  25. onLoad: function (options) {
  26. this.getTabBar().setData({
  27. selected: 2
  28. })
  29. },
  30. onShow:function() {
  31. this.getUserInfo()
  32. this.getUnReadNums()
  33. },
  34. goRecords(e) {
  35. const path = e.currentTarget.dataset.path
  36. wx.navigateTo({
  37. url: path,
  38. })
  39. },
  40. // 获取
  41. getUserInfo() {
  42. const params = {}
  43. params.tenantId = wx.getStorageSync('tenant').tenantId
  44. params.openid = wx.getStorageSync('openid')
  45. getUserData(params).then(success=> {
  46. const userInfo = success.data
  47. wx.setStorage({
  48. key: 'userInfo',
  49. data:userInfo
  50. })
  51. this.setData({userInfo})
  52. })
  53. },
  54. getUnReadNums(){
  55. const openId = wx.getStorageSync('openid')
  56. messageSum({openId}).then(res=>{
  57. this.setData({
  58. numbers: res.data || 0
  59. })
  60. })
  61. },
  62. // 进入申请身份页面
  63. goApprove() {
  64. wx.navigateTo({
  65. url: '/package_mine/pages/IdList/index',
  66. })
  67. },
  68. handlePointDetail(){
  69. wx.navigateTo({
  70. url: '/package_mine/pages/history/index',
  71. })
  72. }
  73. })