环境token

This commit is contained in:
zoujiandong
2024-05-07 10:37:29 +08:00
parent 554750b145
commit 82fa044116
4 changed files with 40 additions and 7 deletions
+7 -1
View File
@@ -80,7 +80,13 @@ Page({
user_type: 1,
wx_code: res
}).then((data)=>{
 wx.setStorageSync('AUTH_TOKEN', data.token);
const { envVersion } = wx.getAccountInfoSync().miniProgram;
if(envVersion=='release'){
 wx.setStorageSync('AUTH_TOKEN', data.token);
}else{
 wx.setStorageSync('DEV_AUTH_TOKEN', data.token);
}
 wx.setStorageSync('CLIENT_USER_ID',data.client_user_id);
 wx.setStorageSync('USER_ID',data.user_id);
let url=this.data.redirectUrl?this.data.redirectUrl:'/pages/index/index';
+6 -1
View File
@@ -128,7 +128,12 @@ Page({
user_type:1,
wx_code:res
}).then((data)=>{
 wx.setStorageSync('AUTH_TOKEN', data.token);
const { envVersion } = wx.getAccountInfoSync().miniProgram;
if(envVersion=='release'){
 wx.setStorageSync('AUTH_TOKEN', data.token);
}else{
 wx.setStorageSync('DEV_AUTH_TOKEN', data.token);
}
 wx.setStorageSync('CLIENT_USER_ID',data.client_user_id);
 wx.setStorageSync('USER_ID',data.user_id);
let url=this.data.redirectUrl?this.data.redirectUrl:'/pages/index/index';