|
- // pages/index/sw/index.js
- let config = require("../../../config/config.js");
- let Http = require("../../../utils/HttpBasics");
- const app = getApp();
- Component({
- /**
- * 组件的属性列表
- */
- properties: {},
-
- /**
- * 组件的初始数据
- */
- data: {
- list: []
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- gotomore: function() {
- wx.navigateTo({
- url: "/pages/rushToBuy/index",
- success: function(res) {
- // success
- },
- fail: function() {
- // fail
- },
- complete: function() {
- // complete
- }
- });
- },
- 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}`
- });
- }
- },
- ready() {
- app.couponChannelListCallback = token => {
- Http.setToken(token);
- Http.get({
- url: config.api.couponChannelList,
- data: {
- pageNum: 1,
- pageSize: 5,
- targetAd: 2
- }
- }).then(res => {
- console.log(res);
- this.setData({
- list: res.data.list
- });
- });
- };
- if (app.globalData.token && app.globalData.token != null) {
- console.log("couponChannelList init 1");
- app.couponChannelListCallback(app.globalData.token);
- }
- }
- });
|