mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-07 01:46:44 +08:00
跳转登录去掉多加的/,同时清除一下token
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import config from '@/config/index.js'
|
import config from '@/config/index.js'
|
||||||
import {getToken} from '@/utils/token.js'
|
import {getToken,removeToken} from '@/utils/token.js'
|
||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
|
|
||||||
const ReLoginUrl="/login";
|
const ReLoginUrl="/login";
|
||||||
@@ -34,6 +34,7 @@ const formRequest=function(method,url,data){
|
|||||||
success:function(rs,statusCode){
|
success:function(rs,statusCode){
|
||||||
if(rs.statusCode==200){
|
if(rs.statusCode==200){
|
||||||
if(rs.data.status==401 || rs.data.status==402){
|
if(rs.data.status==401 || rs.data.status==402){
|
||||||
|
removeToken();
|
||||||
let loginPath=config.loginPath;
|
let loginPath=config.loginPath;
|
||||||
if(loginPath.startsWith('http')){
|
if(loginPath.startsWith('http')){
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
@@ -41,7 +42,7 @@ const formRequest=function(method,url,data){
|
|||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
//window.open(loginPath)
|
//window.open(loginPath)
|
||||||
let returnUrl=window.location.protocol+'//'+window.location.host+"/"+config.context;
|
let returnUrl=window.location.protocol+'//'+window.location.host+config.context;
|
||||||
location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
|
location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
|
||||||
// #endif
|
// #endif
|
||||||
}else{
|
}else{
|
||||||
@@ -84,13 +85,14 @@ const jsonRequest=function(method,url,data){
|
|||||||
success:function(rs,statusCode){
|
success:function(rs,statusCode){
|
||||||
if(rs.statusCode==200){
|
if(rs.statusCode==200){
|
||||||
if(rs.data.status==401 || rs.data.status==402){
|
if(rs.data.status==401 || rs.data.status==402){
|
||||||
|
removeToken();
|
||||||
let loginPath=config.loginPath;
|
let loginPath=config.loginPath;
|
||||||
if(loginPath.startsWith('http')){
|
if(loginPath.startsWith('http')){
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
plus.runtime.openURL(loginPath) //这里默认使用外部浏览器打开而不是内部web-view组件打开
|
plus.runtime.openURL(loginPath) //这里默认使用外部浏览器打开而不是内部web-view组件打开
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
let returnUrl=window.location.protocol+'//'+window.location.host+"/"+config.context;
|
let returnUrl=window.location.protocol+'//'+window.location.host+config.context;
|
||||||
location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
|
location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
|
||||||
// #endif
|
// #endif
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ const formRequest=function(method,url,data){
|
|||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
//window.open(loginPath)
|
//window.open(loginPath)
|
||||||
location.href=loginPath
|
let returnUrl=window.location.protocol+'//'+window.location.host+config.context;
|
||||||
|
location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
|
||||||
// #endif
|
// #endif
|
||||||
}else{
|
}else{
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
@@ -91,7 +92,8 @@ const jsonRequest=function(method,url,data){
|
|||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
//window.open(loginPath)
|
//window.open(loginPath)
|
||||||
location.href=loginPath
|
let returnUrl=window.location.protocol+'//'+window.location.host+config.context;
|
||||||
|
location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
|
||||||
// #endif
|
// #endif
|
||||||
}else{
|
}else{
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import config from '../config/index.js'
|
import config from '../config/index.js'
|
||||||
import {getToken} from '@/utils/token.js'
|
import {getToken,removeToken} from '@/utils/token.js'
|
||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
|
|
||||||
const ReLoginUrl="/login";
|
const ReLoginUrl="/login";
|
||||||
@@ -33,6 +33,7 @@ const formRequest=function(method,url,data){
|
|||||||
success:function(rs,statusCode){
|
success:function(rs,statusCode){
|
||||||
if(rs.statusCode==200){
|
if(rs.statusCode==200){
|
||||||
if(rs.data.status==401 || rs.data.status==402){
|
if(rs.data.status==401 || rs.data.status==402){
|
||||||
|
removeToken();
|
||||||
let loginPath=config.loginPath;
|
let loginPath=config.loginPath;
|
||||||
if(loginPath.startsWith('http')){
|
if(loginPath.startsWith('http')){
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
@@ -40,7 +41,7 @@ const formRequest=function(method,url,data){
|
|||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
//window.open(loginPath)
|
//window.open(loginPath)
|
||||||
let returnUrl=window.location.protocol+'//'+window.location.host+"/"+config.context;
|
let returnUrl=window.location.protocol+'//'+window.location.host+config.context;
|
||||||
location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
|
location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
|
||||||
// #endif
|
// #endif
|
||||||
}else{
|
}else{
|
||||||
@@ -83,6 +84,7 @@ const jsonRequest=function(method,url,data){
|
|||||||
success:function(rs,statusCode){
|
success:function(rs,statusCode){
|
||||||
if(rs.statusCode==200){
|
if(rs.statusCode==200){
|
||||||
if(rs.data.status==401 || rs.data.status==402){
|
if(rs.data.status==401 || rs.data.status==402){
|
||||||
|
removeToken();
|
||||||
let loginPath=config.loginPath;
|
let loginPath=config.loginPath;
|
||||||
if(loginPath.startsWith('http')){
|
if(loginPath.startsWith('http')){
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
@@ -90,7 +92,7 @@ const jsonRequest=function(method,url,data){
|
|||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
//window.open(loginPath)
|
//window.open(loginPath)
|
||||||
let returnUrl=window.location.protocol+'//'+window.location.host+"/"+config.context;
|
let returnUrl=window.location.protocol+'//'+window.location.host+config.context;
|
||||||
location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
|
location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
|
||||||
// #endif
|
// #endif
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Reference in New Issue
Block a user