diff --git a/src/permission.js b/src/permission.js index 44a27a1..4ff43ea 100644 --- a/src/permission.js +++ b/src/permission.js @@ -19,9 +19,12 @@ if(ticket==undefined||ticket==null||ticket=="null"){ ticket = getCookie("ticket") } - // 如果有token - if (ticket && getToken()) { + if(ticket){ setTicket(ticket) + } + debugger + // 如果有token + if (getToken()) { // 登录后进入登录页 if (to.path === '/login') { next({ path: '/' }) @@ -45,18 +48,11 @@ next() } } - } else { - // 如果没有ticket, 跳转到单点登录地址 - if(!ticket){ - const ssoServerLogin = `${defaultSettings.ssoServer}/login` - const appId = defaultSettings.appId - const currentUrl = getCurrentUrl() - console.log('to sso login:'+ ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl) - window.location.href = ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl; + } else { // 没有token + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() }else{ - if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 - next() - } else { + if(ticket){ // 有ticket // 不在白名单,传ticket给后台, 换token store.dispatch('AppLogin', ticket).then(() => { Message.success('自动登录成功') @@ -65,6 +61,17 @@ next(`/login`) // 否则全部重定向到登录页 }) NProgress.done() + }else{ // 没有ticket + const ssoServerLogin = `${defaultSettings.ssoServer}/login` + const appId = defaultSettings.appId + const currentUrl = getCurrentUrl() + // 不是localhost 跳转到单点登录 + if(!(currentUrl.indexOf('localhost')!==-1||currentUrl.indexOf('111.198.10.15')!==-1)) { + console.log('to sso login:'+ ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl) + window.location.href = ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl; + }else{// 如果是localhost 直接下一步 + next(`/login`) + } } } } diff --git a/src/permission.js b/src/permission.js index 44a27a1..4ff43ea 100644 --- a/src/permission.js +++ b/src/permission.js @@ -19,9 +19,12 @@ if(ticket==undefined||ticket==null||ticket=="null"){ ticket = getCookie("ticket") } - // 如果有token - if (ticket && getToken()) { + if(ticket){ setTicket(ticket) + } + debugger + // 如果有token + if (getToken()) { // 登录后进入登录页 if (to.path === '/login') { next({ path: '/' }) @@ -45,18 +48,11 @@ next() } } - } else { - // 如果没有ticket, 跳转到单点登录地址 - if(!ticket){ - const ssoServerLogin = `${defaultSettings.ssoServer}/login` - const appId = defaultSettings.appId - const currentUrl = getCurrentUrl() - console.log('to sso login:'+ ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl) - window.location.href = ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl; + } else { // 没有token + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() }else{ - if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 - next() - } else { + if(ticket){ // 有ticket // 不在白名单,传ticket给后台, 换token store.dispatch('AppLogin', ticket).then(() => { Message.success('自动登录成功') @@ -65,6 +61,17 @@ next(`/login`) // 否则全部重定向到登录页 }) NProgress.done() + }else{ // 没有ticket + const ssoServerLogin = `${defaultSettings.ssoServer}/login` + const appId = defaultSettings.appId + const currentUrl = getCurrentUrl() + // 不是localhost 跳转到单点登录 + if(!(currentUrl.indexOf('localhost')!==-1||currentUrl.indexOf('111.198.10.15')!==-1)) { + console.log('to sso login:'+ ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl) + window.location.href = ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl; + }else{// 如果是localhost 直接下一步 + next(`/login`) + } } } } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index c91fe57..d955346 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -181,9 +181,11 @@ const currentUrl = getCurrentUrl() // 获取ticket const ticket = getTicket() - console.log('logout:'+`${ssoServerLogout}?ticket=${ticket}&redirect_url=${currentUrl}`) - window.location.href = `${ssoServerLogout}?ticket=${ticket}&redirect_url=${currentUrl}` - removeTicket() + if(!(currentUrl.indexOf('localhost')!==-1||currentUrl.indexOf('111.198.10.15')!==-1)) { + console.log('logout:'+`${ssoServerLogout}?ticket=${ticket}&redirect_url=${currentUrl}`) + window.location.href = `${ssoServerLogout}?ticket=${ticket}&redirect_url=${currentUrl}` + removeTicket() + } resolve() }).catch(error => { reject(error) diff --git a/src/permission.js b/src/permission.js index 44a27a1..4ff43ea 100644 --- a/src/permission.js +++ b/src/permission.js @@ -19,9 +19,12 @@ if(ticket==undefined||ticket==null||ticket=="null"){ ticket = getCookie("ticket") } - // 如果有token - if (ticket && getToken()) { + if(ticket){ setTicket(ticket) + } + debugger + // 如果有token + if (getToken()) { // 登录后进入登录页 if (to.path === '/login') { next({ path: '/' }) @@ -45,18 +48,11 @@ next() } } - } else { - // 如果没有ticket, 跳转到单点登录地址 - if(!ticket){ - const ssoServerLogin = `${defaultSettings.ssoServer}/login` - const appId = defaultSettings.appId - const currentUrl = getCurrentUrl() - console.log('to sso login:'+ ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl) - window.location.href = ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl; + } else { // 没有token + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() }else{ - if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 - next() - } else { + if(ticket){ // 有ticket // 不在白名单,传ticket给后台, 换token store.dispatch('AppLogin', ticket).then(() => { Message.success('自动登录成功') @@ -65,6 +61,17 @@ next(`/login`) // 否则全部重定向到登录页 }) NProgress.done() + }else{ // 没有ticket + const ssoServerLogin = `${defaultSettings.ssoServer}/login` + const appId = defaultSettings.appId + const currentUrl = getCurrentUrl() + // 不是localhost 跳转到单点登录 + if(!(currentUrl.indexOf('localhost')!==-1||currentUrl.indexOf('111.198.10.15')!==-1)) { + console.log('to sso login:'+ ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl) + window.location.href = ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl; + }else{// 如果是localhost 直接下一步 + next(`/login`) + } } } } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index c91fe57..d955346 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -181,9 +181,11 @@ const currentUrl = getCurrentUrl() // 获取ticket const ticket = getTicket() - console.log('logout:'+`${ssoServerLogout}?ticket=${ticket}&redirect_url=${currentUrl}`) - window.location.href = `${ssoServerLogout}?ticket=${ticket}&redirect_url=${currentUrl}` - removeTicket() + if(!(currentUrl.indexOf('localhost')!==-1||currentUrl.indexOf('111.198.10.15')!==-1)) { + console.log('logout:'+`${ssoServerLogout}?ticket=${ticket}&redirect_url=${currentUrl}`) + window.location.href = `${ssoServerLogout}?ticket=${ticket}&redirect_url=${currentUrl}` + removeTicket() + } resolve() }).catch(error => { reject(error) diff --git a/src/utils/request.js b/src/utils/request.js index 42ffe1f..8e082ac 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -58,15 +58,27 @@ const ssoServerLogin = `${defaultSettings.ssoServer}/login` const appId = defaultSettings.appId const currentUrl = getCurrentUrl() - console.log('402 to sso login:'+ ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl) - window.location.href = ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl; + if(!(currentUrl.indexOf('localhost')!==-1||currentUrl.indexOf('111.198.10.15')!==-1)) { + console.log('402 to sso login:'+ ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl) + window.location.href = ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl; + } } else { - Message({ - showClose: true, - message: res.message, - type: 'error', - duration: 3000 - }) + if(res.message){ + Message({ + showClose: true, + message: res.message, + type: 'error', + duration: 3000 + }) + }else{ + Message({ + showClose: true, + message: '错误代码:'+res.code, + type: 'error', + duration: 3000 + }) + } + return Promise.reject(res) } // return Promise.reject(res) diff --git a/src/permission.js b/src/permission.js index 44a27a1..4ff43ea 100644 --- a/src/permission.js +++ b/src/permission.js @@ -19,9 +19,12 @@ if(ticket==undefined||ticket==null||ticket=="null"){ ticket = getCookie("ticket") } - // 如果有token - if (ticket && getToken()) { + if(ticket){ setTicket(ticket) + } + debugger + // 如果有token + if (getToken()) { // 登录后进入登录页 if (to.path === '/login') { next({ path: '/' }) @@ -45,18 +48,11 @@ next() } } - } else { - // 如果没有ticket, 跳转到单点登录地址 - if(!ticket){ - const ssoServerLogin = `${defaultSettings.ssoServer}/login` - const appId = defaultSettings.appId - const currentUrl = getCurrentUrl() - console.log('to sso login:'+ ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl) - window.location.href = ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl; + } else { // 没有token + if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 + next() }else{ - if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 - next() - } else { + if(ticket){ // 有ticket // 不在白名单,传ticket给后台, 换token store.dispatch('AppLogin', ticket).then(() => { Message.success('自动登录成功') @@ -65,6 +61,17 @@ next(`/login`) // 否则全部重定向到登录页 }) NProgress.done() + }else{ // 没有ticket + const ssoServerLogin = `${defaultSettings.ssoServer}/login` + const appId = defaultSettings.appId + const currentUrl = getCurrentUrl() + // 不是localhost 跳转到单点登录 + if(!(currentUrl.indexOf('localhost')!==-1||currentUrl.indexOf('111.198.10.15')!==-1)) { + console.log('to sso login:'+ ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl) + window.location.href = ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl; + }else{// 如果是localhost 直接下一步 + next(`/login`) + } } } } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index c91fe57..d955346 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -181,9 +181,11 @@ const currentUrl = getCurrentUrl() // 获取ticket const ticket = getTicket() - console.log('logout:'+`${ssoServerLogout}?ticket=${ticket}&redirect_url=${currentUrl}`) - window.location.href = `${ssoServerLogout}?ticket=${ticket}&redirect_url=${currentUrl}` - removeTicket() + if(!(currentUrl.indexOf('localhost')!==-1||currentUrl.indexOf('111.198.10.15')!==-1)) { + console.log('logout:'+`${ssoServerLogout}?ticket=${ticket}&redirect_url=${currentUrl}`) + window.location.href = `${ssoServerLogout}?ticket=${ticket}&redirect_url=${currentUrl}` + removeTicket() + } resolve() }).catch(error => { reject(error) diff --git a/src/utils/request.js b/src/utils/request.js index 42ffe1f..8e082ac 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -58,15 +58,27 @@ const ssoServerLogin = `${defaultSettings.ssoServer}/login` const appId = defaultSettings.appId const currentUrl = getCurrentUrl() - console.log('402 to sso login:'+ ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl) - window.location.href = ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl; + if(!(currentUrl.indexOf('localhost')!==-1||currentUrl.indexOf('111.198.10.15')!==-1)) { + console.log('402 to sso login:'+ ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl) + window.location.href = ssoServerLogin + "?&appId="+appId+"&redirect_url=" + currentUrl; + } } else { - Message({ - showClose: true, - message: res.message, - type: 'error', - duration: 3000 - }) + if(res.message){ + Message({ + showClose: true, + message: res.message, + type: 'error', + duration: 3000 + }) + }else{ + Message({ + showClose: true, + message: '错误代码:'+res.code, + type: 'error', + duration: 3000 + }) + } + return Promise.reject(res) } // return Promise.reject(res) diff --git a/src/views/caseManage/createCase.vue b/src/views/caseManage/createCase.vue index cd9465a..de1db64 100644 --- a/src/views/caseManage/createCase.vue +++ b/src/views/caseManage/createCase.vue @@ -180,7 +180,7 @@ 查询 - 确定 + 确定 说明:双击添加位置, 当前坐标:{{ currentPosition.lng }},{{ currentPosition.lat }} @@ -648,9 +648,9 @@ }, // 确定, 保存坐标并返回 confirmPos() { + this.form.lng = this.currentPosition.lng + this.form.lat = this.currentPosition.lat if(this.currentPosition.lng!='0'){ - this.form.lng = this.currentPosition.lng - this.form.lat = this.currentPosition.lat // 进行逆地址解析 matchReverse(this.currentPosition.lng,this.currentPosition.lat).then(res=>{ if(res.data.length>0){ @@ -665,10 +665,11 @@ }).catch(()=>{ console.log('逆地址解析失败') }) - this.showMap = false - this.clearMap() - console.log(this.form) + } + this.showMap = false + this.clearMap() + console.log(this.form) }, // 清除地图 clearMap() {