@@ -23,6 +23,12 @@ App({ | |||||
// console.log("req",res); | // console.log("req",res); | ||||
this.globalData.token = res.data.token; | this.globalData.token = res.data.token; | ||||
Http.setToken(res.data.token) | Http.setToken(res.data.token) | ||||
if (that.couponChannelListCallback) { | |||||
that.couponChannelListCallback(res.data.token); | |||||
} | |||||
if (that.couponListCallback) { | |||||
that.couponListCallback(res.data.token); | |||||
} | |||||
return Http.post({ | return Http.post({ | ||||
url: config.api.checkUserStatus, | url: config.api.checkUserStatus, | ||||
data: {} | data: {} | ||||
@@ -23,17 +23,16 @@ Page({ | |||||
} | } | ||||
}) | }) | ||||
.then(function(res) { | .then(function(res) { | ||||
console.log(res); | |||||
//返回主页 | |||||
wx.redirectTo({ | |||||
url: '../index/index', | |||||
}) | |||||
}, function(error) { | |||||
wx.showToast({ | |||||
title: '请授权个人信息', | |||||
icon: "none" | |||||
}) | |||||
} | |||||
) | |||||
console.log(res); | |||||
//返回主页 | |||||
wx.switchTab({ | |||||
url: '/pages/index/index', | |||||
}) | |||||
}, function(error) { | |||||
wx.showToast({ | |||||
title: '请授权个人信息', | |||||
icon: "none" | |||||
}) | |||||
}) | |||||
}, | }, | ||||
}) | }) |
@@ -1,5 +1,7 @@ | |||||
// pages/index/sw/index.js | // pages/index/sw/index.js | ||||
let config = require('../../../config/config.js') | |||||
let Http = require('../../../utils/HttpBasics') | let Http = require('../../../utils/HttpBasics') | ||||
const app = getApp() | |||||
Component({ | Component({ | ||||
/** | /** | ||||
* 组件的属性列表 | * 组件的属性列表 | ||||
@@ -12,8 +14,7 @@ Component({ | |||||
* 组件的初始数据 | * 组件的初始数据 | ||||
*/ | */ | ||||
data: { | data: { | ||||
tabs: [ | |||||
{ | |||||
tabs: [{ | |||||
key: 1, | key: 1, | ||||
name: "全部" | name: "全部" | ||||
}, | }, | ||||
@@ -39,9 +40,7 @@ Component({ | |||||
name: "其他" | name: "其他" | ||||
}, | }, | ||||
], | ], | ||||
list: [ | |||||
], | |||||
list: [], | |||||
current: '1', | current: '1', | ||||
current_scroll: '1', | current_scroll: '1', | ||||
}, | }, | ||||
@@ -50,29 +49,36 @@ Component({ | |||||
* 组件的方法列表 | * 组件的方法列表 | ||||
*/ | */ | ||||
methods: { | methods: { | ||||
handleChange({ detail }) { | |||||
handleChange({ | |||||
detail | |||||
}) { | |||||
this.setData({ | this.setData({ | ||||
current: detail.key | current: detail.key | ||||
}); | }); | ||||
}, | }, | ||||
handleChangeScroll({ detail }) { | |||||
handleChangeScroll({ | |||||
detail | |||||
}) { | |||||
this.setData({ | this.setData({ | ||||
current_scroll: detail.key | current_scroll: detail.key | ||||
}); | }); | ||||
}, | }, | ||||
}, | }, | ||||
ready() { | ready() { | ||||
Http.get({ | |||||
url: Http.config.api.couponList, | |||||
data: { | |||||
pageNum: 1, | |||||
pageSize: 10 | |||||
} | |||||
}).then(res => { | |||||
this.setData({ | |||||
list: res.list | |||||
app.couponListCallback = token => { | |||||
Http.get({ | |||||
url: Http.config.api.couponList, | |||||
data: { | |||||
pageNum: 1, | |||||
pageSize: 10 | |||||
} | |||||
}).then(res => { | |||||
console.log(res); | |||||
this.setData({ | |||||
list: res.data.list | |||||
}) | |||||
}) | }) | ||||
}) | |||||
} | |||||
} | } | ||||
}) | |||||
}) |
@@ -1,67 +1,71 @@ | |||||
// pages/index/sw/index.js | // pages/index/sw/index.js | ||||
let config = require('../../../config/config.js') | let config = require('../../../config/config.js') | ||||
let Http = require('../../../utils/HttpBasics') | let Http = require('../../../utils/HttpBasics') | ||||
const app = getApp() | |||||
Component({ | Component({ | ||||
/** | |||||
* 组件的属性列表 | |||||
*/ | |||||
properties: { | |||||
/** | |||||
* 组件的属性列表 | |||||
*/ | |||||
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", | |||||
// }, | |||||
] | |||||
}, | |||||
/** | |||||
* 组件的初始数据 | |||||
*/ | |||||
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: { | |||||
/** | |||||
* 组件的方法列表 | |||||
*/ | |||||
methods: { | |||||
}, | |||||
ready() { | |||||
Http.get({ | |||||
url: config.api.couponChannelList, | |||||
data: { | |||||
pageNum: 1, | |||||
pageSize: 10 | |||||
}, | |||||
ready() { | |||||
app.couponChannelListCallback = token => { | |||||
Http.setToken(token); | |||||
Http.get({ | |||||
url: config.api.couponChannelList, | |||||
data: { | |||||
pageNum: 1, | |||||
pageSize: 10 | |||||
} | |||||
}).then(res => { | |||||
this.setData({ | |||||
list: res.data.list | |||||
}) | |||||
}) | |||||
} | |||||
} | } | ||||
}).then(res => { | |||||
this.setData({ | |||||
list: res.list | |||||
}) | |||||
}) | |||||
} | |||||
}) | }) |