index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // pages/yuezhan/html_detail/index.js.js
  2. const WxParse = require('../../../common/component/wxParse/wxParse.js');
  3. const { recordAccess } = require('../../../utils/util.js');
  4. const { serverName, request } = require('../../../utils/services');
  5. const app = getApp();
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. forwardImg: 'https://4dscene.4dage.com/cgaii/images/join/forwardImg.jpg'
  12. },
  13. /**
  14. * 生命周期函数--监听页面加载
  15. */
  16. onLoad: function (options) {
  17. recordAccess(options)
  18. console.log(options)
  19. let { imageUrl, relayUrl, id: sceneId, isShare } = options;
  20. this.setData({
  21. imageUrl,
  22. relayUrl,
  23. sceneId
  24. })
  25. let {
  26. bannerHtml
  27. } = app.globalData
  28. if (isShare){
  29. this.getHtml()
  30. }else{
  31. WxParse.wxParse('description', 'html', bannerHtml, this, 5);
  32. }
  33. },
  34. getHtml:function(){
  35. let {sceneId} = this.data
  36. request["getBannerDetail"]({
  37. bannerId: sceneId
  38. }, "", res => {
  39. let { description} = res.data.data
  40. WxParse.wxParse('description', 'html', description, this, 5);
  41. })
  42. },
  43. /**
  44. * 生命周期函数--监听页面初次渲染完成
  45. */
  46. onReady: function () {
  47. },
  48. /**
  49. * 生命周期函数--监听页面显示
  50. */
  51. onShow: function () {
  52. },
  53. /**
  54. * 生命周期函数--监听页面隐藏
  55. */
  56. onHide: function () {
  57. },
  58. /**
  59. * 生命周期函数--监听页面卸载
  60. */
  61. onUnload: function () {
  62. },
  63. /**
  64. * 页面相关事件处理函数--监听用户下拉动作
  65. */
  66. onPullDownRefresh: function () {
  67. },
  68. /**
  69. * 页面上拉触底事件的处理函数
  70. */
  71. onReachBottom: function () {
  72. },
  73. /**
  74. * 用户点击右上角分享
  75. */
  76. onShareAppMessage: function () {
  77. let { sceneId, imageUrl, relayUrl, forwardImg } = this.data;
  78. return {
  79. path: `/pages/yuezhan/html_detail/index?id=${sceneId}&isShare=1&imageUrl=${imageUrl}&relayUrl=${relayUrl}`,
  80. imageUrl: relayUrl || imageUrl || forwardImg
  81. }
  82. }
  83. })