Commit 4eae3da0 by 梁建民

福利中心

parent 9956ccc5
......@@ -12,13 +12,22 @@ Page({
data: {
integralsList: {},
integral: '',
code: ''
code: '',
token: '',
user_id: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let token = options.token;
let user_id = options.user_id;
this.setData({
token: token,
user_id: user_id
});
},
......@@ -82,19 +91,65 @@ Page({
* 获取数据
*/
getData: function () {
//区分app拉起页面
if (this.data.token) {
wx.showNavigationBarLoading();
wx.request({
url: apis.integralsList,
data: {
source: 1,
token: this.data.token
},
header: {
"Content-Type": "applciation/json"
},
method: 'GET',
success: (res) => {
wx.hideNavigationBarLoading();
if (res.data.errcode === 0) {
//注入token
wx.setStorage({
key: "access_token",
data: this.data.token
});
//注入用户id
wx.setStorage({
key: "user_id",
data: this.data.user_id
});
this.setData({
integralsList: res.data.data,
integral: res.data.integral,
code: res.data.code
});
} else {
wx.reLaunch({
url: '/pages/person/auth/index',
});
}
},
fail: (err) => {
http.getData(apis.integralsList, 'GET', null, (res) => {
if (res.errcode === 0) {
}
})
this.setData({
integralsList: res.data,
integral: res.integral,
code: res.code
});
}
}, true, false, true);
} else {
http.getData(apis.integralsList, 'GET', null, (res) => {
if (res.errcode === 0) {
this.setData({
integralsList: res.data,
integral: res.integral,
code: res.code
});
}
}, true, false, true);
}
},
/**
* 查看规则
......
......@@ -347,6 +347,20 @@
"pathName": "pages/person/helpfriend/index",
"query": "exchange_id=34",
"scene": null
},
{
"id": -1,
"name": "pages/person/welfare/index",
"pathName": "pages/person/welfare/index",
"query": "token=21212",
"scene": null
},
{
"id": -1,
"name": "pages/person/welfare/index",
"pathName": "pages/person/welfare/index",
"query": "token= eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vYXV0aGFwaS5pY3NhbGVzLmNvbS92MS9nZXR3eFVzZXJJbmZvIiwiaWF0IjoxNTcwODQzMDU0LCJleHAiOjE1NzA4NTM4NTQsIm5iZiI6MTU3MDg0MzA1NCwianRpIjoiWXMwdVRTalhnTVF6OWVRTSIsInN1YiI6MjAsInBydiI6Ijg3ZTBhZjFlZjlmZDE1ODEyZmRlYzk3MTUzYTE0ZTBiMDQ3NTQ2YWEifQ.ClJB0cBhwPar5LK_2TczezcX27n4enis4n_JtFS4wLc",
"scene": null
}
]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment