34 lines
801 B
JavaScript
34 lines
801 B
JavaScript
|
|
module.exports = {
|
||
|
|
setToken: function(data) {
|
||
|
|
uni.setStorageSync("token", data);
|
||
|
|
},
|
||
|
|
setTokenExpiresTime: function(data) {
|
||
|
|
uni.setStorageSync("tokenExpiresTime", data);
|
||
|
|
},
|
||
|
|
setUserInfo: function(data) {
|
||
|
|
uni.setStorageSync("userId", data.userId);
|
||
|
|
uni.setStorageSync("userInfo", data);
|
||
|
|
},
|
||
|
|
getToken: function() {
|
||
|
|
return uni.getStorageSync("token");
|
||
|
|
},
|
||
|
|
getTokenExpiresTime: function() {
|
||
|
|
return uni.getStorageSync("tokenExpiresTime");
|
||
|
|
},
|
||
|
|
getUserId: function() {
|
||
|
|
return uni.getStorageSync("userId");
|
||
|
|
},
|
||
|
|
getUserInfo: function() {
|
||
|
|
return uni.getStorageSync("userInfo");
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* 退出登陆
|
||
|
|
*/
|
||
|
|
exitLogin: function() {
|
||
|
|
uni.removeStorageSync('token');
|
||
|
|
uni.removeStorageSync('tokenExpiresTime');
|
||
|
|
uni.removeStorageSync('userId');
|
||
|
|
uni.removeStorageSync('userInfo');
|
||
|
|
}
|
||
|
|
}
|