my.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. Page({
  2. data: {
  3. name: wx.getStorageSync('username'),
  4. avatar: wx.getStorageSync('avatar'),
  5. role: wx.getStorageSync('role'),
  6. current: 1,
  7. list: [{
  8. id: 1,
  9. text: '修改密码',
  10. imgUrl: 'http://resource.bike.hanyiyun.com/bike_yunwei/pwd.png',
  11. isShow:true,
  12. },
  13. {
  14. id: 2,
  15. text: '地勤人员',
  16. imgUrl: 'http://resource.bike.hanyiyun.com/bike_yunwei/worker.png',
  17. isShow:true,
  18. },
  19. {
  20. id: 7,
  21. text: '用户反馈',
  22. imgUrl: 'http://resource.bike.hanyiyun.com/yunwei/feedBack.png',
  23. isShow:true,
  24. },
  25. {
  26. id: 8,
  27. text: '用户报修',
  28. imgUrl: 'http://resource.bike.hanyiyun.com/yunwei/repair.png',
  29. isShow:true,
  30. },
  31. {
  32. id: 3,
  33. text: '中控管理',
  34. imgUrl: 'http://resource.bike.hanyiyun.com/yunwei/control.png',
  35. isShow:true,
  36. },
  37. {
  38. id: 4,
  39. text: '数据统计',
  40. imgUrl: 'http://resource.bike.hanyiyun.com/yunwei/statistics.png',
  41. isShow:wx.getStorageSync('role')=='管理员' || '技术管理员' ? true : false
  42. },
  43. // {
  44. // id: 5,
  45. // text: '热力地图',
  46. // imgUrl: 'http://resource.bike.hanyiyun.com/yunwei/hot.png'
  47. // },
  48. {
  49. id: 6,
  50. text: '停车区管理',
  51. imgUrl: 'http://resource.bike.hanyiyun.com/bike_yunwei/parkMange.png',
  52. isShow:true,
  53. },
  54. ]
  55. },
  56. onLoad: function () {
  57. console.log(wx.getStorageSync('allArea'))
  58. },
  59. scanCode: function () {
  60. wx.reLaunch({
  61. url: '/pages/logs/logs?scan=' + 1,
  62. })
  63. },
  64. skipNext(e) {
  65. let idx = e.currentTarget.dataset.id;
  66. let url = '';
  67. switch (idx) {
  68. case 1:
  69. url = "/pages/password/password";
  70. break;
  71. case 2:
  72. url = "/pages/personnel/personnel";
  73. break;
  74. case 3:
  75. url = "/pages/control/control";
  76. break;
  77. case 4:
  78. url = "/pages/lineChart/lineChart";
  79. break;
  80. case 5:
  81. url = "/pages/chart/chart";
  82. break;
  83. case 6:
  84. url = "/pages/park/park";
  85. break;
  86. case 7:
  87. url = "/pages/feedback/feedback";
  88. break;
  89. case 8:
  90. url = "/pages/repairs/repairs";
  91. break;
  92. default:
  93. break;
  94. }
  95. wx.navigateTo({
  96. url
  97. })
  98. },
  99. //退出登录
  100. quit() {
  101. wx.removeStorageSync('username');
  102. wx.removeStorageSync('avatar');
  103. wx.removeStorageSync('token');
  104. wx.removeStorageSync('role');
  105. wx.removeStorageSync('curVal');
  106. wx.removeStorageSync('curId');
  107. wx.reLaunch({
  108. url: '/pages/login/login',
  109. })
  110. },
  111. onShow: function () {
  112. this.setData({
  113. name: wx.getStorageSync('username'),
  114. avatar: wx.getStorageSync('avatar'),
  115. role: wx.getStorageSync('role'),
  116. })
  117. },
  118. onShareAppMessage: function () {
  119. return {
  120. title: '轻松出行,方便你我',
  121. path: '/pages/login/login',
  122. success: function (res) { }
  123. }
  124. }
  125. })