C端小程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

73 行
1.9 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. console.log("index ++ " + app.globalData.token);
  29. if (that.couponChannelListCallback) {
  30. that.couponChannelListCallback(res.data.token);
  31. }
  32. if (that.couponListCallback) {
  33. that.couponListCallback(res.data.token);
  34. }
  35. } else {
  36. // 由于是网络请求,可能会在 Page.onLoad 之后才返回
  37. // 所以此处加入 callback 以防止这种情况
  38. app.tokenCallback = token => {
  39. console.log("index + " + token);
  40. if (that.couponChannelListCallback) {
  41. that.couponChannelListCallback(res.data.token);
  42. }
  43. if (that.couponListCallback) {
  44. that.couponListCallback(res.data.token);
  45. }
  46. }
  47. }
  48. wx.showLoading({
  49. title: '加载中',
  50. })
  51. var scene = decodeURIComponent(options.scene);
  52. var that = this;
  53. setTimeout(function () {
  54. wx.hideLoading()
  55. }, 2200)
  56. },
  57. // 用户点击右上角分享
  58. onShareAppMessage: function () {
  59. return {
  60. title: '富茂链客',
  61. desc: '分享个小程序,希望你喜欢',
  62. success: function (res) {
  63. wx.showToast({
  64. title: "分享成功",
  65. duration: 1000,
  66. icon: "success"
  67. })
  68. }
  69. }
  70. }
  71. })