myDaily.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const {
  2. postApi
  3. } = require("../../../apis/api")
  4. // pages/voyageManage/myDaily/myDaily.js
  5. const app = getApp()
  6. Page({
  7. data: {
  8. medias: [],
  9. voyageId: 0,
  10. trans: '',
  11. currentIndex: -1
  12. },
  13. check(e) {
  14. this.setData({
  15. currentIndex: e.currentTarget.dataset.index,
  16. })
  17. },
  18. async getMedias() {
  19. let res = await postApi("/dayReport/getMedia", {
  20. loginAccountId: wx.getStorageSync('loginAccountId'),
  21. voyageId: this.data.voyageId
  22. })
  23. this.setData({
  24. medias: res.data.result
  25. })
  26. },
  27. onLoad(options) {
  28. this.setData({
  29. voyageId: options.id,
  30. trans: options.trans
  31. })
  32. this.getMedias()
  33. },
  34. examineMedia() {
  35. if (this.data.currentIndex == -1) {
  36. wx.showToast({
  37. title: '请选择一张图片',
  38. icon: "error"
  39. })
  40. return
  41. }
  42. app.globalData.currentExamineMedia = this.data.medias[this.data.currentIndex]
  43. wx.navigateTo({
  44. url: `/pages/voyageManage/myDaily/examine/examine?id=${this.data.voyageId}&trans=${this.data.trans}`,
  45. })
  46. },
  47. onShareAppMessage() {
  48. }
  49. })