跳转加loading
This commit is contained in:
+50
-2
@@ -62,17 +62,28 @@ import VConsole from 'vuex'
|
||||
|
||||
|
||||
import isMobile from "./store/isMobile";
|
||||
import { Loading } from 'element-ui';
|
||||
let loading = Loading.service({
|
||||
text: '加载中...',
|
||||
background: '#fff'
|
||||
});
|
||||
function closeLoading(){
|
||||
loading.close()
|
||||
loading = null
|
||||
}
|
||||
// 路由拦截
|
||||
router.beforeEach(function (to, from, next) {
|
||||
let fromName = from.name
|
||||
if(fromName === undefined || fromName === null){
|
||||
window.sessionStorage.clear()
|
||||
}
|
||||
|
||||
console.log(to)
|
||||
console.log(from)
|
||||
let toName = to.name
|
||||
if (toName === 'CheckPage' || toName === 'loginStandDetails' || toName === 'error'
|
||||
|| toName === 'LoginVerifyPhone') {
|
||||
next()
|
||||
closeLoading()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -150,13 +161,16 @@ router.beforeEach(function (to, from, next) {
|
||||
window.sessionStorage.clear()
|
||||
localStorage.setItem("routerName","phoneHome")
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else if(toName === 'phoneHome' && token != null && (fromName === undefined || fromName === null)){
|
||||
localStorage.removeItem('token')
|
||||
token = localStorage.getItem("token")
|
||||
window.sessionStorage.clear()
|
||||
next()
|
||||
closeLoading()
|
||||
}else if(toName === 'phoneHome' && token != null){
|
||||
next()
|
||||
closeLoading()
|
||||
} else if(toName === 'processCenter'){
|
||||
// hwh5.close();
|
||||
//关闭当前窗口
|
||||
@@ -183,17 +197,21 @@ router.beforeEach(function (to, from, next) {
|
||||
window.sessionStorage.clear()
|
||||
localStorage.setItem("routerName","phoneHome")
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else if(toName === 'databaseSearch' || toName === 'standDynamics' ||
|
||||
toName === 'domesticStand' || toName === 'domesticDetails' || toName === 'zlzxDetails'){
|
||||
localStorage.setItem("routerName",toName)
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else {
|
||||
if(fromName === 'phoneHome'){
|
||||
next()
|
||||
closeLoading()
|
||||
}else {
|
||||
localStorage.removeItem("param");
|
||||
localStorage.setItem('param',JSON.stringify(param4))
|
||||
next('/phoneIndex')
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
}else {
|
||||
@@ -202,14 +220,17 @@ router.beforeEach(function (to, from, next) {
|
||||
fromName === 'domesticStand' || fromName === 'domesticDetails' || toName === 'zlzxDetails'){
|
||||
localStorage.setItem("routerName",toName)
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(toName === 'databaseSearch' || toName === 'standDynamics' || toName === 'zlzxDetails' ||
|
||||
toName === 'domesticStand' || toName === 'domesticDetails'){
|
||||
next()
|
||||
closeLoading()
|
||||
}else if (toName.slice(0,5) !== 'phone') {
|
||||
if(toName === 'LoginVerify'){
|
||||
if(toName === 'phoneHome'){
|
||||
@@ -219,13 +240,18 @@ router.beforeEach(function (to, from, next) {
|
||||
window.sessionStorage.clear()
|
||||
localStorage.setItem("routerName","phoneHome")
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else{
|
||||
next('/blankPage')
|
||||
closeLoading()
|
||||
}
|
||||
}else {
|
||||
if(toName === 'blankPage' || toName === 'processedPage') {
|
||||
next()
|
||||
closeLoading()
|
||||
}else {
|
||||
|
||||
console.log('-bussLibrary4-')
|
||||
extractedVerify()
|
||||
}
|
||||
}
|
||||
@@ -239,14 +265,19 @@ router.beforeEach(function (to, from, next) {
|
||||
window.sessionStorage.clear()
|
||||
localStorage.setItem("routerName","phoneHome")
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else{
|
||||
next('/blankPage')
|
||||
closeLoading()
|
||||
}
|
||||
}else {
|
||||
console.log('-phoneBussLibrary4-')
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,6 +286,7 @@ router.beforeEach(function (to, from, next) {
|
||||
if ((token === null || token === '' ) && toName === 'OtherStandardDetails') {
|
||||
if (document.cookie) {
|
||||
next()
|
||||
closeLoading()
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -262,6 +294,7 @@ router.beforeEach(function (to, from, next) {
|
||||
if(webLoginType != null && webLoginType === 'idm' ){
|
||||
if(code){
|
||||
next()
|
||||
closeLoading()
|
||||
}else {
|
||||
if (taskId !== undefined && taskId !== null && prcId !== undefined && prcId !== null) {
|
||||
extractedVerify(token)
|
||||
@@ -270,9 +303,11 @@ router.beforeEach(function (to, from, next) {
|
||||
extractedLocalStorage("standardSearch/All",userName)
|
||||
localStorage.setItem('external', "external")
|
||||
next('/LoginVerifyNoEncryption')
|
||||
closeLoading()
|
||||
}else {
|
||||
if (toName === 'LoginVerifyNoEncryption') {
|
||||
next()
|
||||
closeLoading()
|
||||
}else {
|
||||
if(path === '/standardSearch/All'){
|
||||
extractedLocalStorage('standardSearch/All','');
|
||||
@@ -290,6 +325,7 @@ router.beforeEach(function (to, from, next) {
|
||||
extractedVerify(token)
|
||||
} else {
|
||||
next('/Login')
|
||||
closeLoading()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -324,8 +360,10 @@ router.beforeEach(function (to, from, next) {
|
||||
if ((hisCount && hisCount > 0)) { // 业务系统 当前节点已完成
|
||||
if(isMobile()){
|
||||
next('/processedPage')
|
||||
closeLoading()
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
} else { // 业务系统 当前节点未完成
|
||||
// commitStatus 大于0 表示当前节点存在未完成干活流程
|
||||
@@ -379,6 +417,7 @@ router.beforeEach(function (to, from, next) {
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next({path: routerPath + '?' +param})
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,6 +428,7 @@ router.beforeEach(function (to, from, next) {
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,7 +436,9 @@ router.beforeEach(function (to, from, next) {
|
||||
let paramPhone = 'taskIds=' + taskId + '&prcId=' + prcId + '&prcNum=' + prcNum +
|
||||
'&taskAssignee=' + toName + '&prcName=' + prcName + '&prcType=' + prcType
|
||||
let phoneRouter = 'phone' + toName.charAt(0).toUpperCase() + toName.slice(1)
|
||||
next({path: phoneRouter + '?' + paramPhone})
|
||||
console.log(phoneRouter);
|
||||
next({path: phoneRouter + '?' + paramPhone})
|
||||
closeLoading()
|
||||
}
|
||||
function extracted2(routerPath,param2) {
|
||||
if (token === null || token === '') {
|
||||
@@ -405,6 +447,7 @@ router.beforeEach(function (to, from, next) {
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next({path: routerPath + '?' + param2})
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
function extracted4(routerPath,param4) {
|
||||
@@ -414,6 +457,7 @@ router.beforeEach(function (to, from, next) {
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next({path: routerPath + '?' + param4})
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -421,16 +465,20 @@ router.beforeEach(function (to, from, next) {
|
||||
if(path === '/loginVerify'){
|
||||
if(webLoginType != null && webLoginType === 'dev'){
|
||||
next('/Login')
|
||||
closeLoading()
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}else {
|
||||
if((fromName === undefined || fromName === null) && (path.indexOf("/standardSearch/All&userName") !== -1 || (path.indexOf("/standardSearch/All") !== -1 && userName !== undefined))) {
|
||||
extractedLocalStorage("standardSearch/All",userName)
|
||||
localStorage.setItem('external', "external")
|
||||
next('/LoginVerifyNoEncryption')
|
||||
closeLoading()
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user