C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.7 KiB

  1. const Http = require("../../utils/HttpBasics")
  2. //获取应用实例
  3. const app = getApp()
  4. Page({
  5. data: {
  6. market: app.globalData.market,
  7. imgUrls: [
  8. 'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
  9. 'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
  10. 'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
  11. ],
  12. swiperCurrent: 0,
  13. scrollTop: 0
  14. },
  15. swiperChange: function (e) {
  16. this.setData({
  17. swiperCurrent: e.detail.current
  18. })
  19. },
  20. /**
  21. * 生命周期函数--监听页面初次渲染完成
  22. */
  23. onReady: function () {
  24. },
  25. onLoad: function (options) {
  26. var that = this;
  27. if (app.globalData.token && app.globalData.token != null) {
  28. } else {
  29. // 由于是网络请求,可能会在 Page.onLoad 之后才返回
  30. // 所以此处加入 callback 以防止这种情况
  31. app.tokenCallback = token => {
  32. console.log("index + " + token);
  33. if (that.couponChannelListCallback) {
  34. that.couponChannelListCallback(res.data.token);
  35. }
  36. if (that.couponListCallback) {
  37. that.couponListCallback(res.data.token);
  38. }
  39. }
  40. }
  41. wx.showLoading({
  42. title: '加载中',
  43. })
  44. var scene = decodeURIComponent(options.scene);
  45. var that = this;
  46. setTimeout(function () {
  47. wx.hideLoading()
  48. }, 2200)
  49. },
  50. // 用户点击右上角分享
  51. onShareAppMessage: function () {
  52. return {
  53. title: '富茂链客',
  54. desc: '分享个小程序,希望你喜欢',
  55. success: function (res) {
  56. wx.showToast({
  57. title: "分享成功",
  58. duration: 1000,
  59. icon: "success"
  60. })
  61. }
  62. }
  63. }
  64. })