index.js 701 B

123456789101112131415161718192021222324252627282930313233343536
  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. console.log(res)
  16. this.setData({
  17. indexInfo: res.data.result
  18. })
  19. },
  20. forbidTouchMove() {
  21. },
  22. onLoad() {
  23. let cargoOwnerId = wx.getStorageSync('cargoOwnerId')
  24. if (cargoOwnerId) {
  25. this.getIndexInfo()
  26. const child = this.selectComponent('.voyages');
  27. child.getVoyageList()
  28. } else {
  29. wx.redirectTo({
  30. url: '/pages/login/login',
  31. })
  32. }
  33. }
  34. })