sharePage.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // pages/share/sharePage.js
  2. import {
  3. postApi
  4. } from "../../apis/api"
  5. Page({
  6. data: {
  7. markers: [{
  8. id: 999,
  9. latitude: '',
  10. longitude: '',
  11. iconPath: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/red-circle.png?sign=6d208881376358fb4111aa6d7f1a7846&t=1647934972",
  12. height: 20,
  13. width: 20
  14. }],
  15. latitude: 31.891992,
  16. longitude: 120.551369,
  17. },
  18. async getVoyageDetail(voyageId) {
  19. let res = await postApi("/voyage/share", {
  20. voyageId
  21. })
  22. // res.data.result.transInfos.forEach(item => {
  23. // item.createTime = this.subTimeStr(item.createTime)
  24. // })
  25. // res.data.result.loadingInfos.forEach(item => {
  26. // item.createTime = this.subTimeStr(item.createTime)
  27. // })
  28. this.setData({
  29. ...res.data.result
  30. })
  31. },
  32. subTimeStr(str) {
  33. if (!str || typeof str != "string") return;
  34. let index = str.indexOf(" ");
  35. return str.substring(0, index);
  36. },
  37. onLoad(options) {
  38. this.getVoyageDetail(options.id)
  39. },
  40. })