加入小程序登录时 加入token 鉴权问题

This commit is contained in:
wuxw 2019-12-27 01:39:02 +08:00
parent f0bb174fec
commit 7c7c990bb4
5 changed files with 11 additions and 11 deletions

3
app.js
View File

@ -62,7 +62,7 @@ App({
success: function () {
// 直接从Storage中获取用户信息
let userStorageInfo = wx.getStorageSync('userInfo');
console.log('用户信息',userStorageInfo);
if (userStorageInfo) {
that.globalData.userInfo = JSON.parse(userStorageInfo);
} else {
@ -114,6 +114,7 @@ App({
console.log(res.userInfo);
wx.setStorageSync('userInfo', JSON.stringify(res.userInfo));
wx.setStorageSync('loginFlag', res.sessionKey);
wx.setStorageSync('token', res.token);
callback();
} else {
that.showInfo(res.errmsg);

View File

@ -9,7 +9,6 @@
"pages/enterCommunity/enterCommunity",
"pages/myBooks/myBooks",
"pages/detail/detail",
"pages/comment/comment",
"pages/notice/index",
"pages/notice/detail/detail",
"pages/repairList/repairList",

View File

@ -19,14 +19,14 @@ const appInfo = {
};
const urlInfo = {
areaUrl: baseUrl +"appApi/area.listAreas",
GetNoticeListUrl: baseUrl + 'appApi/api.queryNotices',
areaUrl: baseUrl +"app/area.listAreas",
GetNoticeListUrl: baseUrl + 'app/api.queryNotices',
//报修接口
saveOwnerRepair: baseUrl + 'appApi/ownerRepair.saveOwnerRepair',
saveOwnerRepair: baseUrl + 'app/ownerRepair.saveOwnerRepair',
//查看报修
listOwnerRepairs: baseUrl + 'appApi/ownerRepair.listOwnerRepairs',
listOwnerRepairs: baseUrl + 'app/ownerRepair.listOwnerRepairs',
//家庭成员
saveOwner: baseUrl + 'appApi/owner.saveOwner',
saveOwner: baseUrl + 'app/owner.saveOwner',
}

View File

@ -46,8 +46,7 @@ Page({
let curLocation = wx.getStorageSync("currentLocation");
this.setData({
province: curLocation.province,
city: curLocation.city
city: curLocation.city
})
},

View File

@ -58,11 +58,12 @@ const getHeaders = function(){
transaction_id: wxuuid(),
req_time: getDateYYYYMMDDHHMISS(),
sign:'1234567',
user_id:'-1'
user_id:'-1',
cookie: '_java110_token_=' + wx.getStorageSync('token')
}
}
module.exports = {
formatTime: formatTime,
getHeaders: getHeaders