// pages/wv_page/index.js const { encodeParam, decodeParam, recordAccess } = require('../../utils/util.js'); const { serverName, request } = require('../../utils/services'); const { newRequestFns, newServerName } = require('../../utils/newServices.js'); const app = getApp(); Page({ /** * 页面的初始数据 */ data: { forwardImg:'https://4dscene.4dage.com/cgaii/images/join/forwardImg.jpg' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { let id = (options.scene && decodeURIComponent(options.scene))|| options.id let relayUrl = options.relayUrl recordAccess({ id }) if (id){ this.getExhibitionDetail(id) } this.setData({ relayUrl }) }, forward: function(url){ this.setData({ url: url.detail.data.pop() }) }, getExhibitionDetail: function (sceneId) { let exhibitionId = sceneId newRequestFns["getExhibitionDetail"]({ exhibitionId: exhibitionId }, "", res => { let { data: exhibitionDetail } = res.data; this.setData({ url: exhibitionDetail.sceneLink, imageUrl: exhibitionDetail.imageUrl, sceneId: exhibitionDetail.id }) if (exhibitionDetail.name) { wx.setNavigationBarTitle({ title: exhibitionDetail.name }) } },fail => { wx.showToast({ title: '页面不存在', icon: 'none' }); setTimeout(() => { wx.switchTab({ url: '/pages/yuezhan/index', }) }, 1000); }) }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { let {sceneId, relayUrl} = this.data; return { path: `/pages/wv_page/index?&id=${sceneId}`, imageUrl: relayUrl || '' } } })