index.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // pages/wv_page/index.js
  2. const { encodeParam, decodeParam, recordAccess } = require('../../utils/util.js');
  3. const { serverName, request } = require('../../utils/services');
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. forwardImg:'https://4dscene.4dage.com/cgaii/images/join/forwardImg.jpg'
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function (options) {
  16. let id = (options.scene && decodeURIComponent(options.scene))|| options.id
  17. recordAccess({
  18. id
  19. })
  20. if (id){
  21. this.getExhibitionDetail(id)
  22. }
  23. },
  24. forward: function(url){
  25. this.setData({
  26. url: url.detail.data.pop()
  27. })
  28. },
  29. getExhibitionDetail: function (sceneId) {
  30. let exhibitionId = sceneId
  31. request["getExhibitionDetail"]({
  32. exhibitionId: exhibitionId
  33. }, "", res => {
  34. let { data: exhibitionDetail } = res.data;
  35. let { product } = exhibitionDetail
  36. this.setData({
  37. url: product.showLink,
  38. imageUrl: exhibitionDetail.imageUrl,
  39. relayUrl: exhibitionDetail.relayUrl,
  40. sceneId: exhibitionDetail.id
  41. })
  42. if (exhibitionDetail.name) {
  43. wx.setNavigationBarTitle({
  44. title: exhibitionDetail.name
  45. })
  46. }
  47. })
  48. },
  49. /**
  50. * 用户点击右上角分享
  51. */
  52. onShareAppMessage: function () {
  53. let {sceneId, imageUrl, relayUrl, forwardImg} = this.data;
  54. console.log(imageUrl || forwardImg)
  55. return {
  56. path: `/pages/wv_page/index?&id=${sceneId}`,
  57. imageUrl: relayUrl || imageUrl || forwardImg
  58. }
  59. }
  60. })