太湖公益
This commit is contained in:
@@ -129,6 +129,7 @@ $http.requestStart = function (options) {
|
||||
if (storeUserInfo.token) {
|
||||
options.header['token'] = storeUserInfo.token;
|
||||
};
|
||||
options.header['appType'] = 'sociology';
|
||||
return options;
|
||||
}
|
||||
//请求结束
|
||||
@@ -142,6 +143,7 @@ $http.requestEnd = function (options) {
|
||||
let loginPopupNum = 0;
|
||||
//所有接口数据处理(此方法需要开发者根据各自的接口返回类型修改,以下只是模板)
|
||||
$http.dataFactory = async function (res) {
|
||||
console.log('到这里之前123456', res,)
|
||||
// console.log("接口请求数据", {
|
||||
// url: res.url,
|
||||
// resolve: res.response,
|
||||
@@ -162,13 +164,16 @@ $http.dataFactory = async function (res) {
|
||||
return Promise.resolve(httpData);
|
||||
} else if (httpData.code == "401") {
|
||||
// token失效
|
||||
|
||||
|
||||
console.log('at line 287到这里是token失效中获取启动页状态:', uni.getStorageSync('token'), uni.getStorageSync('isJump'), uni.getStorageSync('guidePages'))
|
||||
// uni.getStorageSync('guidePages') == 2
|
||||
if (uni.getStorageSync('guidePages') == 2) {
|
||||
|
||||
|
||||
|
||||
|
||||
var jump = uni.getStorageSync('isJump') //以下解决多次跳转登录页的重点
|
||||
var jump = uni.getStorageSync('isJump') //以下解决多次跳转登录页的重点
|
||||
if (!jump) {
|
||||
//以下做token失效的操作
|
||||
uni.showToast({
|
||||
@@ -182,7 +187,12 @@ $http.dataFactory = async function (res) {
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
|
||||
url: "/pages/user/login/login"
|
||||
url: "/pages/user/login/login",
|
||||
success: function () {
|
||||
setTimeout(() => {
|
||||
uni.setStorageSync('isJump', null)
|
||||
}, 1000)
|
||||
},
|
||||
});
|
||||
}, 100);
|
||||
uni.setStorageSync('isJump', 'true')
|
||||
@@ -355,4 +365,4 @@ $http.requestError = function (e) {
|
||||
// });
|
||||
}
|
||||
}
|
||||
export default $http;
|
||||
export default $http;
|
||||
Reference in New Issue
Block a user