examine.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. // pages/voyageManage/myDaily/examine/examine.js
  2. const {
  3. postApi
  4. } = require("../../../../apis/api")
  5. const app = getApp()
  6. Page({
  7. data: {
  8. media: {},
  9. voyageId: 0,
  10. markers: [],
  11. latitude: 31.891992,
  12. longitude: 120.551369,
  13. trans: '',
  14. isMarkVisable: false
  15. },
  16. previewImage(e) {
  17. let {
  18. src
  19. } = e.currentTarget.dataset
  20. wx.previewImage({
  21. current: src, // 当前显示图片的http链接
  22. urls: [src] // 需要预览的图片http链接列表
  23. })
  24. },
  25. async noPass() {
  26. this.checkMedia({
  27. audit: 2
  28. })
  29. },
  30. async checkMedia(postData) {
  31. let res = await postApi('/dayReport/audit', {
  32. ...postData,
  33. mediaId: this.data.media.id
  34. })
  35. wx.showToast({
  36. title: res.data.msg,
  37. })
  38. if (res.data.status == 0) {
  39. setTimeout(() => {
  40. wx.switchTab({
  41. url: '/pages/voyageManage/voyageManage',
  42. })
  43. }, 1500)
  44. }
  45. },
  46. showMark() {
  47. this.setData({
  48. isMarkVisable: true
  49. })
  50. },
  51. async markMedia(e) {
  52. let {
  53. type
  54. } = e.currentTarget.dataset
  55. this.checkMedia({
  56. type,
  57. audit: 1
  58. })
  59. },
  60. onLoad(options) {
  61. this.setData({
  62. voyageId: options.id,
  63. trans: options.trans,
  64. })
  65. },
  66. onReady() {
  67. let media = app.globalData.currentExamineMedia
  68. let {
  69. latitude,
  70. longitude
  71. } = media
  72. let markers = [{
  73. id: 1,
  74. latitude,
  75. longitude,
  76. // latitude: Number(latitude),
  77. // longitude: Number(longitude),
  78. iconPath: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/red-circle.png?sign=6d208881376358fb4111aa6d7f1a7846&t=1647934972",
  79. height: 20,
  80. width: 20
  81. }]
  82. let points = [{
  83. latitude,
  84. longitude
  85. }]
  86. this.setData({
  87. media,
  88. points,
  89. markers,
  90. })
  91. },
  92. share(e) {
  93. console.log(e)
  94. },
  95. onShareAppMessage(res) {
  96. let {
  97. type
  98. } = res.target.dataset
  99. let path
  100. let {
  101. shipName: title
  102. } = this.data.media
  103. if (type == 1) {
  104. let {
  105. media,
  106. longitude,
  107. latitude
  108. } = this.data
  109. let shareImageUrl = media.viewUrl
  110. path = `/pages/share/share?shareImageUrl=${(shareImageUrl.replace(/\?/g, 'qwerdfb000mmmccc')).replace(/=/g, 'mmmcccqwerdfb')}&latitude=${latitude}&longitude=${longitude}`
  111. } else {
  112. let id = this.data.voyageId
  113. path = `/pages/sharePage/sharePage?id=${id}`
  114. }
  115. return {
  116. title,
  117. path
  118. }
  119. },
  120. })