index.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. let relayUrl = options.relayUrl
  22. recordAccess({
  23. id
  24. })
  25. if (id){
  26. this.getExhibitionDetail(id)
  27. }
  28. this.setData({
  29. relayUrl
  30. })
  31. },
  32. forward: function(url){
  33. this.setData({
  34. url: url.detail.data.pop()
  35. })
  36. },
  37. getExhibitionDetail: function (sceneId) {
  38. let exhibitionId = sceneId
  39. newRequestFns["getExhibitionDetail"]({
  40. exhibitionId: exhibitionId
  41. }, "", res => {
  42. let { data: exhibitionDetail } = res.data;
  43. this.setData({
  44. url: exhibitionDetail.sceneLink,
  45. imageUrl: exhibitionDetail.imageUrl,
  46. sceneId: exhibitionDetail.id
  47. })
  48. if (exhibitionDetail.name) {
  49. wx.setNavigationBarTitle({
  50. title: exhibitionDetail.name
  51. })
  52. }
  53. },fail => {
  54. wx.showToast({
  55. title: '页面不存在',
  56. icon: 'none'
  57. });
  58. setTimeout(() => {
  59. wx.switchTab({
  60. url: '/pages/yuezhan/index',
  61. })
  62. }, 1000);
  63. })
  64. },
  65. /**
  66. * 用户点击右上角分享
  67. */
  68. onShareAppMessage: function () {
  69. let {sceneId, relayUrl} = this.data;
  70. return {
  71. path: `/pages/wv_page/index?&id=${sceneId}`,
  72. imageUrl: relayUrl || ''
  73. }
  74. }
  75. })