环境token
This commit is contained in:
parent
554750b145
commit
82fa044116
@ -182,9 +182,9 @@
|
|||||||
<view class="dot">:</view>
|
<view class="dot">:</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="desc time" wx:if="{{order.order_service_status==2}}"><text class="red">接诊后有效</text></view>
|
<view class="desc time" wx:if="{{order.order_service_status==2}}"><text class="red">接诊后有效</text></view>
|
||||||
<view class="desc time" wx:elif="{{order.order_service_status==3}}"><text class="red">{{filter.transforDay(equity.order_service_package.start_time,'dotdateminute')+'-'+filter.transforDay(equity.order_service_package.finish_time,'dotdateminute')}}</text></view>
|
<view class="desc time" wx:elif="{{order.order_service_status==3 || order.order_service_status==4}}"><text class="red">{{filter.transforDay(equity.order_service_package.start_time,'dotdateminute')+'-'+filter.transforDay(equity.order_service_package.finish_time,'dotdateminute')}}</text></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="row" style="align-items: flex-start;" wx:if="{{ order.order_service_status==3 || order.order_service_status==4}}">
|
<view class="row" style="align-items: flex-start;" wx:if="{{ order.order_service_status==3 }}">
|
||||||
<view class="namebox">
|
<view class="namebox">
|
||||||
<view class="name">当月时间</view>
|
<view class="name">当月时间</view>
|
||||||
<view class="dot">:</view>
|
<view class="dot">:</view>
|
||||||
|
|||||||
@ -80,7 +80,13 @@ Page({
|
|||||||
user_type: 1,
|
user_type: 1,
|
||||||
wx_code: res
|
wx_code: res
|
||||||
}).then((data)=>{
|
}).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('CLIENT_USER_ID',data.client_user_id);
|
||||||
wx.setStorageSync('USER_ID',data.user_id);
|
wx.setStorageSync('USER_ID',data.user_id);
|
||||||
let url=this.data.redirectUrl?this.data.redirectUrl:'/pages/index/index';
|
let url=this.data.redirectUrl?this.data.redirectUrl:'/pages/index/index';
|
||||||
|
|||||||
@ -128,7 +128,12 @@ Page({
|
|||||||
user_type:1,
|
user_type:1,
|
||||||
wx_code:res
|
wx_code:res
|
||||||
}).then((data)=>{
|
}).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('CLIENT_USER_ID',data.client_user_id);
|
||||||
wx.setStorageSync('USER_ID',data.user_id);
|
wx.setStorageSync('USER_ID',data.user_id);
|
||||||
let url=this.data.redirectUrl?this.data.redirectUrl:'/pages/index/index';
|
let url=this.data.redirectUrl?this.data.redirectUrl:'/pages/index/index';
|
||||||
|
|||||||
@ -20,7 +20,15 @@ function request(url, method, data, loding = false) {
|
|||||||
mask: true
|
mask: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
let token = wx.getStorageSync('AUTH_TOKEN');
|
let token='';
|
||||||
|
const { envVersion } = wx.getAccountInfoSync().miniProgram;
|
||||||
|
if(envVersion=='release'){
|
||||||
|
token = wx.getStorageSync('AUTH_TOKEN');
|
||||||
|
}else{
|
||||||
|
token = wx.getStorageSync('DEV_AUTH_TOKEN');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
let freelist = ["/login/wechat_mobile_login", '/login/mobile_login','/code/phone','/patient/index',"/popup","/sign/im"];//接口白名单
|
let freelist = ["/login/wechat_mobile_login", '/login/mobile_login','/code/phone','/patient/index',"/popup","/sign/im"];//接口白名单
|
||||||
let currentUrl=getCurrentPageUrl();
|
let currentUrl=getCurrentPageUrl();
|
||||||
@ -53,7 +61,14 @@ function request(url, method, data, loding = false) {
|
|||||||
|
|
||||||
var Authorization_token = res.header.Authorization;
|
var Authorization_token = res.header.Authorization;
|
||||||
if (Authorization_token) {
|
if (Authorization_token) {
|
||||||
wx.setStorageSync('AUTH_TOKEN', Authorization_token); //当token快过期时,服务器会返回新token,本地刷新
|
const { envVersion } = wx.getAccountInfoSync().miniProgram;
|
||||||
|
if(envVersion=='release'){
|
||||||
|
wx.setStorageSync('AUTH_TOKEN', Authorization_token);
|
||||||
|
}else{
|
||||||
|
wx.setStorageSync('DEV_AUTH_TOKEN', Authorization_token);
|
||||||
|
|
||||||
|
}
|
||||||
|
//当token快过期时,服务器会返回新token,本地刷新
|
||||||
}
|
}
|
||||||
if (loding) {
|
if (loding) {
|
||||||
wx.hideLoading()
|
wx.hideLoading()
|
||||||
@ -90,7 +105,14 @@ function request(url, method, data, loding = false) {
|
|||||||
}else if (Number(res.data.code) == 401 || Number(res.data.code) == 403 || Number(res.data.code) == 405 || Number(res.data.code) == 406) {
|
}else if (Number(res.data.code) == 401 || Number(res.data.code) == 403 || Number(res.data.code) == 405 || Number(res.data.code) == 406) {
|
||||||
let redirectUrl=formatUrl();
|
let redirectUrl=formatUrl();
|
||||||
if(!isLock){
|
if(!isLock){
|
||||||
wx.setStorageSync('AUTH_TOKEN','');
|
const { envVersion } = wx.getAccountInfoSync().miniProgram;
|
||||||
|
if(envVersion=='release'){
|
||||||
|
wx.setStorageSync('AUTH_TOKEN','');
|
||||||
|
}else{
|
||||||
|
wx.setStorageSync('DEV_AUTH_TOKEN','');
|
||||||
|
|
||||||
|
}
|
||||||
|
// wx.setStorageSync('AUTH_TOKEN','');
|
||||||
isLock=true;
|
isLock=true;
|
||||||
wx.reLaunch({
|
wx.reLaunch({
|
||||||
url: '/patient/pages/login/login?redirectUrl='+redirectUrl
|
url: '/patient/pages/login/login?redirectUrl='+redirectUrl
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user