|
- // pages/index/sw/index.js
- let config = require("../../config/config.js");
- let Http = require("../../utils/HttpBasics");
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- list: []
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {},
- //列表
- getList: function(page) {
- app.couponChannelListCallback = token => {
- Http.setToken(token);
- Http.get({
- url: config.api.couponChannelList,
- data: {
- pageNum: page,
- pageSize: 2,
- targetAd: 2
- }
- }).then(res => {
- console.log(res);
- console.log("限时抢购页面");
- this.setData({
- list: res.data.list
- });
- });
- };
- if (app.globalData.token && app.globalData.token != null) {
- console.log("couponChannelList init 1");
- app.couponChannelListCallback(app.globalData.token);
- }
- },
- onReady: function() {
- let that = this;
- that.getList(2);
- },
- //限时抢购的强请页面
- gotodetail: function(e) {
- console.log(e);
- console.log("姐姐在测试");
- console.log(e.currentTarget.dataset.couponid);
- console.log(e.currentTarget.dataset.targetad);
- wx.navigateTo({
- url: `/pages/coupon/detail/index?id=${
- e.currentTarget.dataset.couponid
- }&targetAd=${e.currentTarget.dataset.targetad}`,
- success: function(res) {
- // success
- },
- fail: function() {
- // fail
- },
- complete: function() {
- // complete
- }
- });
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- console.log("000");
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
- console.log("姐姐在搞上啦加载");
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function() {}
- });
|