index.js 1.6 KB

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