|
@@ -44,19 +44,6 @@ export default function({ $axios, redirect, req, ...args }) {
|
|
|
|
|
|
|
|
$axios.onResponse((res) => {
|
|
$axios.onResponse((res) => {
|
|
|
const data = res.data;
|
|
const data = res.data;
|
|
|
- // 不跳转到login的页面reg list
|
|
|
|
|
- const excludePath = [ '/user/register', '/cert/type/:id', '/type/vip/', '/cert/', '/user/:id' ];
|
|
|
|
|
- const includePath = [ '/user/register', '/cert/type/:id', '/type/vip/', '/cert/', '/user/:id' ];
|
|
|
|
|
- const needLogin = (path) => {
|
|
|
|
|
- let result = false;
|
|
|
|
|
- excludePath.forEach((reg) => {
|
|
|
|
|
- reg = reg.replace(/:id/, '');
|
|
|
|
|
- if (RegExp(reg).test(path)) {
|
|
|
|
|
- result = false;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- return result;
|
|
|
|
|
- };
|
|
|
|
|
/**
|
|
/**
|
|
|
* 设备判断
|
|
* 设备判断
|
|
|
*/
|
|
*/
|
|
@@ -85,16 +72,29 @@ export default function({ $axios, redirect, req, ...args }) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
console.log('res:::::::::')
|
|
console.log('res:::::::::')
|
|
|
- console.log(res);
|
|
|
|
|
|
|
+ // console.log(res);
|
|
|
console.log(res.config)
|
|
console.log(res.config)
|
|
|
|
|
+ console.log(data)
|
|
|
// req && req.url && needLogin(req.url)
|
|
// req && req.url && needLogin(req.url)
|
|
|
|
|
+ let needLogin = false
|
|
|
|
|
+ if (res.config && res.config.data) {
|
|
|
|
|
+ const queryData = res.config.data
|
|
|
|
|
+ //将多cookie切割为多个名/值对
|
|
|
|
|
+ const arrQuery = queryData.split("&");
|
|
|
|
|
+ //遍历cookie数组,处理每个cookie对
|
|
|
|
|
+ for(let i=0; i<arrQuery.length; i++){
|
|
|
|
|
+ const arr = arrQuery[i].split("=");
|
|
|
|
|
+ //找到名称为x_app的cookie,并返回它的值
|
|
|
|
|
+ if ("needLogin" === arr[0] && (arr[1] === 'true' || arr[1] === true)){
|
|
|
|
|
+ needLogin = true;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if (data.status === 1 || data.filename) {
|
|
if (data.status === 1 || data.filename) {
|
|
|
- } else if (res.config && res.config.data && res.config.data.needLogin && data.status === -99) {
|
|
|
|
|
- // alert('not login ..');
|
|
|
|
|
|
|
+ } else if (needLogin && data.status === -99) {
|
|
|
const deviceType = getDeviceType();
|
|
const deviceType = getDeviceType();
|
|
|
- // alert('deviceType ..' + deviceType);
|
|
|
|
|
if (deviceType === 'ios' || deviceType === 'android') {
|
|
if (deviceType === 'ios' || deviceType === 'android') {
|
|
|
- // alert('redirect to login:' + 'proginn://login')
|
|
|
|
|
if (process.server) {
|
|
if (process.server) {
|
|
|
redirect('proginn://login')
|
|
redirect('proginn://login')
|
|
|
} else {
|
|
} else {
|