examine.js 2.5 KB

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