提交 85c73ad5 编写于 作者: 北漂燕郊杨哥's avatar 北漂燕郊杨哥

Merge branch 'ydh' into 'master'

ydh

See merge request !38
...@@ -277,7 +277,7 @@ let interval; ...@@ -277,7 +277,7 @@ let interval;
if (ret.data.code == 200) { if (ret.data.code == 200) {
uni.setStorageSync('userinfo', userInfo); uni.setStorageSync('userinfo', userInfo);
if (ret.data.token) { if (ret.data.token) {
uni.setStorageSync('sessionid', ret.data.token); uni.setStorageSync('token', ret.data.token);
} }
if (ret.data.type == 1) { //该用户已绑定 if (ret.data.type == 1) { //该用户已绑定
uni.setStorageSync('phone', ret.data.mobile); uni.setStorageSync('phone', ret.data.mobile);
...@@ -497,9 +497,10 @@ let interval; ...@@ -497,9 +497,10 @@ let interval;
}, res => { }, res => {
if (res.status == 0) { if (res.status == 0) {
clearInterval(interval); clearInterval(interval);
uni.setStorageSync('userinfo', res.data.userInfo); uni.setStorageSync('userinfo', res.data.userInfo);
if (res.data.sessid) { console.log("login success ret token:" +res.data.token)
uni.setStorageSync('sessionid', res.data.sessid); if (res.data.token) {
uni.setStorageSync('token', res.data.token);
} }
uni.setStorageSync('phone', that.phone); uni.setStorageSync('phone', that.phone);
uni.showToast({ uni.showToast({
......
...@@ -27,14 +27,18 @@ function http(api, params, callback, method, is_url) { ...@@ -27,14 +27,18 @@ function http(api, params, callback, method, is_url) {
let header = { let header = {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}; };
if (uni.getStorageSync('sessid')) {
header.Cookie = 'sessid=' + uni.getStorageSync('sessid');
}
if (uni.getStorageSync('sessionid')) { if (uni.getStorageSync('token')) {
header.sessionid = uni.getStorageSync('sessionid'); header.token = uni.getStorageSync('token');
} }
params.apply = client; params.apply = client;
var url = apiurl + api; var url = apiurl + api;
if (api.substring(0, 5) == 'https') { if (api.substring(0, 4) == 'http') {
url = api; url = api;
} }
console.log("url") console.log("url")
...@@ -91,6 +95,13 @@ function http(api, params, callback, method, is_url) { ...@@ -91,6 +95,13 @@ function http(api, params, callback, method, is_url) {
}, 1500); }, 1500);
} }
} }
if (res.data.status == 0) {
var sessid = uni.getStorageSync('sessid');
console.log("ret sessid old:"+sessid +" ret:"+res.data.data.sessid)
if (res.data.data.sessid && res.data.data.sessid != sessid) {
uni.setStorageSync('sessid', res.data.data.sessid);
}
}
callback(res.data); callback(res.data);
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册