|
@@ -6,9 +6,9 @@ import NProgress from 'nprogress' // progress bar
|
|
|
import '@/components/NProgress/nprogress.less' // progress bar custom style
|
|
|
import notification from 'ant-design-vue/es/notification'
|
|
|
import { setDocumentTitle, domTitle } from '@/utils/domUtil'
|
|
|
-import { userInfo } from '@/api/headerInfo/index.js'
|
|
|
-import { fileBimView } from '@/api/document/index.js'
|
|
|
-import { ACCESS_TOKEN,TENANT_ID } from '@/store/mutation-types'
|
|
|
+import { get4SLoginToken } from '@/api/user.js'
|
|
|
+import { fileBimView } from '@/api/document/index.js'
|
|
|
+import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types'
|
|
|
import { i18nRender } from '@/locales'
|
|
|
|
|
|
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
|
@@ -99,25 +99,17 @@ router.beforeEach(async (to, from, next) => {
|
|
|
})
|
|
|
} else {
|
|
|
if (to.path === '/4S') {
|
|
|
- const {
|
|
|
- data: { name, fs_password },
|
|
|
- } = await userInfo()
|
|
|
- axios
|
|
|
- .post(`http://newlinker.net:18001/login/pc?username=${name}&password=${fs_password}`)
|
|
|
- .then(({ data }) => {
|
|
|
- if (data.code === 200) {
|
|
|
- window.open('https://www.newlinker.net:8090?token=' + data.data.token)
|
|
|
- } else {
|
|
|
- return
|
|
|
- }
|
|
|
- })
|
|
|
+ const res = await get4SLoginToken()
|
|
|
+ if (res.target_url) {
|
|
|
+ window.location.href = res.target_url
|
|
|
+ }
|
|
|
}
|
|
|
- if(to.path === '/IOT') {
|
|
|
+ if (to.path === '/IOT') {
|
|
|
let {
|
|
|
data: { bim_view },
|
|
|
} = await fileBimView('1207')
|
|
|
localStorage.setItem(bim_view.lightweightName, JSON.stringify([bim_view]))
|
|
|
- window.open(`/modelViewIOT?id=${bim_view.lightweightName}`, '_blank')
|
|
|
+ next({ path: `/modelViewIOT?id=${bim_view.lightweightName}` })
|
|
|
}
|
|
|
next()
|
|
|
}
|
|
@@ -127,10 +119,10 @@ router.beforeEach(async (to, from, next) => {
|
|
|
// 在免登录名单,直接进入
|
|
|
next()
|
|
|
} else {
|
|
|
- if(window.location.href.startsWith("http://localhost")){
|
|
|
+ if (window.location.href.startsWith('http://localhost')) {
|
|
|
next({ path: '/user/login' })
|
|
|
- }else{
|
|
|
- window.location.href = `https://dev.autocde.com/login?redirect=${to.fullPath}`;
|
|
|
+ } else {
|
|
|
+ window.location.href = `https://dev.autocde.com/login?redirect=${to.fullPath}`
|
|
|
}
|
|
|
NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
|
|
|
}
|