|
- // pages/index/sw/index.js
- let config = require("../../../config/config.js");
- let Http = require("../../../utils/HttpBasics");
- const app = getApp();
- Component({
- /**
- * 组件的属性列表
- */
- properties: {},
-
- /**
- * 组件的初始数据
- */
- data: {
- list: [
- // {
- // img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg",
- // name: "海鲜焗饭",
- // time: "2天12小时25分钟",
- // oPrice: "59.00",
- // pPrice: "1.00",
- // },
- // {
- // img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg",
- // name: "海鲜焗饭",
- // time: "2天12小时25分钟",
- // oPrice: "59.00",
- // pPrice: "1.00",
- // },
- // {
- // img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg",
- // name: "海鲜焗饭",
- // time: "2天12小时25分钟",
- // oPrice: "59.00",
- // pPrice: "1.00",
- // },
- // {
- // img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg",
- // name: "海鲜焗饭",
- // time: "2天12小时25分钟",
- // oPrice: "59.00",
- // pPrice: "1.00",
- // },
- ]
- },
-
- /**
- * 组件的方法列表
- */
- methods: {},
- ready() {
- app.couponChannelListCallback = token => {
- console.log("couponChannelList init");
- Http.setToken(token);
- Http.get({
- url: config.api.couponChannelList,
- data: {
- pageNum: 1,
- pageSize: 10
- }
- }).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);
- }
- }
- });
|