index.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // pages/index/index.js
  2. import {
  3. getApi,
  4. postApi
  5. } from "../../apis/api"
  6. import cloudApi from "../../apis/cloudApi"
  7. Page({
  8. data: {
  9. indexInfo: {},
  10. },
  11. async getIndexInfo() {
  12. if (wx.getStorageSync('isClient')) return
  13. let res = await postApi('/voyage/index', {
  14. loginAccountId: wx.getStorageSync('loginAccountId'),
  15. isClient: wx.getStorageSync('isClient'),
  16. })
  17. this.setData({
  18. indexInfo: res.data.result
  19. })
  20. },
  21. forbidTouchMove() {
  22. },
  23. onLoad() {
  24. wx.removeStorageSync('voyageDetailId')
  25. },
  26. onShow() {
  27. if (wx.getStorageSync('isClient')) return
  28. if (wx.getStorageSync('voyageDetailId')) return
  29. wx.removeStorageSync('voyageDetailId')
  30. let cargoOwnerId = wx.getStorageSync('cargoOwnerId')
  31. if (cargoOwnerId) {
  32. this.getIndexInfo()
  33. this.setData({
  34. cargoOwnerId
  35. })
  36. }
  37. let rolePermission = wx.getStorageSync('rolePermission')
  38. if (rolePermission.indexOf('VOYAGELIST') == -1) {
  39. wx.showToast({
  40. icon: "none",
  41. title: '暂无权限,请联系管理员',
  42. })
  43. return
  44. }
  45. const child = this.selectComponent('.voyages');
  46. child.getVoyageList()
  47. }
  48. })