| 
							- // pages/index/sw/index.js
 - let config = require("../../../config/config.js");
 - let Http = require("../../../utils/HttpBasics");
 - // let Http = require("../../../utils/HttpBasics");
 - const app = getApp();
 - const imgurl = require("../../../utils/imgurl");
 - Component({
 -   /**
 -    * 组件的属性列表
 -    */
 -   properties: {},
 - 
 -   /**
 -    * 组件的初始数据
 -    */
 -   data: {
 -     jianUrl: imgurl.jian.url,
 -     barginicon: imgurl.barginicon.url,
 -     wangmeimeibargin: imgurl.wangmeimeibargin.url,
 -     list: [],
 -     total:''
 -   },
 - 
 -   /**
 -    * 组件的方法列表
 -    */
 -   methods: {
 -     gotoBargainList(){
 -       wx.navigateTo({
 -         url: "/pages/bargain/bargain"
 -       })
 -     },
 -     getList() {
 -       let that = this;
 -       Http.get({
 -         url: config.api.couponChannelList,
 -         data: {
 -           pageNum: 1,
 -           pageSize: 5,
 -           targetAd: 6
 -         }
 -       }).then(res => {
 -         that.setData({
 -           list: res.data.list,
 -           total: res.data.total
 -         });
 -       })
 -         .catch(err => {
 -           console.log(err)
 -           wx.showToast({
 -             title: err.errMsg,
 -             icon: 'none',
 -             duration: 2000,
 -             mask: false
 -           });
 -         })
 -     },
 -     gotomore: function() {
 -       wx.navigateTo({
 -         url: "/pages/bargain/bargain"
 -       });
 -     },
 -     gotodetail: function(e) {
 -       wx.navigateTo({
 -         url: `/pages/coupon/detail/index?couponChannelId=${
 -           e.currentTarget.dataset.couponchannelid
 -         }&couponId=${
 -           e.currentTarget.dataset.couponid
 -         }&targetAd=${
 -           e.currentTarget.dataset.targetad
 -         }`
 -       });
 -     }
 -   },
 -   ready() {
 -     app.couponChannelListCallback = token => {
 -       Http.setToken(token);
 -       this.getList();
 -     };
 -     if (app.globalData.token && app.globalData.token != null) {
 -       app.couponChannelListCallback(app.globalData.token);
 -     }
 -   }
 - });
 
 
  |