游客模式
This commit is contained in:
@@ -6,10 +6,10 @@ if (process.env.NODE_ENV === 'development') {
|
||||
// socketUrl = "ws://localhost:6001/";
|
||||
// baseUrl = "https://twin-ui.com/demo/";
|
||||
// baseUrl = "http://59.110.212.44:9200/pb/";
|
||||
// baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
|
||||
baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
|
||||
// baseUrl = "https://api.nuttyreading.com/"; // 线上正式
|
||||
// baseUrl = "http://192.168.110.100:9100/pb/"; // 开发用电脑
|
||||
baseUrl = "http://192.168.110.110:9200/pb/";
|
||||
// baseUrl = "http://192.168.110.110:9200/pb/";
|
||||
// baseUrl = "http://192.168.110.38:9200/pb/"; // 吴春磊笔记本1
|
||||
// socketUrl = "ws://8.129.186.35:6001/";
|
||||
} else if (process.env.NODE_ENV === 'production') {
|
||||
|
||||
@@ -240,13 +240,13 @@ export const h5Login = function(type = "judge", callback) {
|
||||
appMutual("jumpLogin", null, function() {
|
||||
if (type == "force") {
|
||||
// 没登录跳转回登录页
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '用户信息失效,请重新登陆。'
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: "/pages/user/login"
|
||||
});
|
||||
// uni.showToast({
|
||||
// icon: 'none',
|
||||
// title: '用户信息失效,请重新登陆。'
|
||||
// })
|
||||
// uni.navigateTo({
|
||||
// url: "/pages/user/login"
|
||||
// });
|
||||
}else{
|
||||
uni.showModal({
|
||||
title:"提示",
|
||||
|
||||
@@ -125,9 +125,11 @@ $http.requestStart = function(options) {
|
||||
let storeUserInfo = store.state.userInfo;
|
||||
if (!storeUserInfo.token) { // nvue页面读取不到vuex里面数据,将取缓存
|
||||
storeUserInfo = uni.getStorageSync("userInfo");
|
||||
uni.setStorageSync('anonymous', '0000000000');
|
||||
}
|
||||
if (storeUserInfo.token) {
|
||||
options.header['token'] = storeUserInfo.token;
|
||||
uni.setStorageSync('anonymous', storeUserInfo.token);
|
||||
};
|
||||
return options;
|
||||
}
|
||||
@@ -161,8 +163,9 @@ $http.dataFactory = async function(res) {
|
||||
// 返回正确的结果(then接受数据)
|
||||
return Promise.resolve(httpData);
|
||||
} else if (httpData.code == "401") {
|
||||
console.log(uni.getStorageSync("anonymous"))
|
||||
// token失效
|
||||
if (uni.getStorageSync('guidePages') == 2) {
|
||||
if (uni.getStorageSync('guidePages') == 2 && uni.getStorageSync("anonymous") != '0000000000') {
|
||||
uni.showToast({
|
||||
title: '登录失效,请重新登录',
|
||||
icon: 'none'
|
||||
@@ -295,7 +298,7 @@ $http.dataFactory = async function(res) {
|
||||
});
|
||||
} else { //其他错误提示
|
||||
console.log(httpData.info || httpData.msg)
|
||||
if (res.isPrompt && res.data.loadAnimate != 'none') {
|
||||
if (res.isPrompt && res.data.loadAnimate != 'none') {
|
||||
uni.showToast({
|
||||
title: httpData.info || httpData.msg,
|
||||
icon: "none",
|
||||
@@ -334,4 +337,4 @@ $http.requestError = function(e) {
|
||||
// });
|
||||
}
|
||||
}
|
||||
export default $http;
|
||||
export default $http;
|
||||
Reference in New Issue
Block a user