index.js 647 B

123456789101112131415161718192021222324252627282930313233
  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. let res = await postApi('/voyage/index', {
  13. cargoOwnerId: wx.getStorageSync('cargoOwnerId')
  14. })
  15. this.setData({
  16. indexInfo: res.data.result
  17. })
  18. },
  19. forbidTouchMove() {
  20. },
  21. onShow() {
  22. let cargoOwnerId = wx.getStorageSync('cargoOwnerId')
  23. if (cargoOwnerId) {
  24. this.getIndexInfo()
  25. this.setData({
  26. cargoOwnerId
  27. })
  28. }
  29. const child = this.selectComponent('.voyages');
  30. child.getVoyageList()
  31. }
  32. })