index.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // pages/webview/index.js
  2. var api = require('../../config/api.js');
  3. var util = require('../../utils/util.js');
  4. const URL = 'https://www.4dkankan.com/mallscene.html?m='
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. rnd:'',
  11. temp:''
  12. },
  13. /**
  14. * 生命周期函数--监听页面加载
  15. */
  16. onLoad: function (options) {
  17. this.getBrandDetail(options.id)
  18. // this.setData({
  19. // url: (URL + options.url) || '',
  20. // m: options.url,
  21. // img: options.img,
  22. // imgServer: util.imgServer
  23. // })
  24. },
  25. /**
  26. * 生命周期函数--监听页面初次渲染完成
  27. */
  28. onReady: function () {
  29. },
  30. getBrandDetail: function (id) {
  31. util.request(api.BrandDetail, { id: id }).then( (res) => {
  32. if (res.errno === 0) {
  33. this.setData({
  34. url: res.data.brand.sceneUrl + "#" + id,
  35. id: id,
  36. newPicUrl: res.data.brand.newPicUrl
  37. })
  38. wx.onAppHide(() => {
  39. this.setData({
  40. url: res.data.brand.sceneUrl + '&rnd='+Math.random() + "#" + id,
  41. })
  42. })
  43. }
  44. console.log(this.data.url)
  45. });
  46. },
  47. /**
  48. * 生命周期函数--监听页面显示
  49. */
  50. onShow: function () {
  51. // this.getCartList()
  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 { id, newPicUrl } = this.data
  78. return {
  79. title: '看店4DKanKan:宅家中,云逛街,轻松买',
  80. imageUrl: newPicUrl,
  81. url: `/pages/webview/index?id=${id}`,
  82. }
  83. }
  84. })