setting.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const CONFIG = require('../../config.js')
  2. const WXAPI = require('apifm-wxapi')
  3. const AUTH = require('../../utils/auth')
  4. Page({
  5. data: {
  6. },
  7. onLoad: function (options) {
  8. this.setData({
  9. version: CONFIG.version
  10. })
  11. },
  12. onShow: function () {
  13. this.getUserApiInfo()
  14. },
  15. async getUserApiInfo() {
  16. const res = await WXAPI.userDetail(wx.getStorageSync('token'))
  17. if (res.code == 0) {
  18. let _data = {}
  19. _data.apiUserInfoMap = res.data
  20. if (res.data.base.mobile) {
  21. _data.userMobile = res.data.base.mobile
  22. }
  23. if (this.data.order_hx_uids && this.data.order_hx_uids.indexOf(res.data.base.id) != -1) {
  24. _data.canHX = true // 具有扫码核销的权限
  25. }
  26. const adminUserIds = wx.getStorageSync('adminUserIds')
  27. if (adminUserIds && adminUserIds.indexOf(res.data.base.id) != -1) {
  28. _data.isAdmin = true
  29. }
  30. if (res.data.peisongMember && res.data.peisongMember.status == 1) {
  31. _data.memberChecked = false
  32. } else {
  33. _data.memberChecked = true
  34. }
  35. this.setData(_data);
  36. }
  37. },
  38. clearStorage(){
  39. wx.clearStorageSync()
  40. wx.showToast({
  41. title: '已清除',
  42. icon: 'success'
  43. })
  44. },
  45. goadmin() {
  46. wx.navigateToMiniProgram({
  47. appId: 'wx5e5b0066c8d3f33d',
  48. path: 'pages/login/auto?token=' + wx.getStorageSync('token'),
  49. envVersion: 'trial' // develop trial release
  50. })
  51. },
  52. })