sso登录

This commit is contained in:
qq787203167
2022-06-09 18:14:13 +08:00
parent 9f5761fcf2
commit 6a65b9c0df
2 changed files with 15 additions and 8 deletions
+2 -2
View File
@@ -114,7 +114,7 @@
import { mixinDevice } from '@/utils/mixin.js'
import { getFileAccessHttpUrl, getAction } from '@/api/manage'
import Vue from 'vue'
import { UI_CACHE_DB_DICT_DATA ,ACCESS_TOKEN} from '@/store/mutation-types'
import { UI_CACHE_DB_DICT_DATA, ACCESS_TOKEN } from '@/store/mutation-types'
import moment from 'moment'
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
import enUS from 'ant-design-vue/es/locale/en_US'
@@ -223,7 +223,7 @@
return that.Logout({}).then(() => {
// update-begin author:wangshuai date:20200601 for: 退出登录跳转登录页面
that.$router.push({ path: '/user/login' })
// window.location.href = 'https://signin-test.nio.com/oauth2/authorize?client_id=100679&redirect_uri=' + encodeURIComponent('http://grp.nioint.com/dashboard/analysis') + '&response_type=code'
// window.location.href = 'https://signin-test.nio.com/logout?client_id=100679&redirect_uri=' + encodeURIComponent('http://localhost:3000/dashboard/analysis') + '&response_type=code'
localStorage.removeItem('language')
// update-end author:wangshuai date:20200601 for: 退出登录跳转登录页面
//window.location.reload()
+13 -6
View File
@@ -42,8 +42,12 @@ router.beforeEach((to, from, next) => {
fullPath = to.path
}
let query = to.query
let status = {}
if (query.state) {
status = JSON.parse(query.state)
}
delete query.code
next({ path: fullPath, query: query })
next({ path: fullPath, query: status })
}
})
return
@@ -90,9 +94,10 @@ router.beforeEach((to, from, next) => {
if (to.fullPath == '/') {
fullPath = INDEX_MAIN_PAGE_PATH
} else {
fullPath = to.fullPath
fullPath = to.path
}
// window.location.href = 'https://signin-test.nio.com/oauth2/authorize?client_id=100679&redirect_uri=' + encodeURIComponent('http://grp.nioint.com' + fullPath) + '&response_type=code'
// window.location.href = 'https://signin-test.nio.com/oauth2/authorize?client_id=100679&redirect_uri='
// + encodeURIComponent('http://localhost:3000' + fullPath) + '&response_type=code&state=' + JSON.stringify(to.query)
})
})
} else {
@@ -107,11 +112,13 @@ router.beforeEach((to, from, next) => {
next({ path: '/user/login', query: { redirect: to.fullPath } })
let fullPath = ''
if (to.fullPath == '/') {
fullPath = INDEX_MAIN_PAGE_PATH + '?id=123'
fullPath = INDEX_MAIN_PAGE_PATH
} else {
fullPath = to.fullPath
fullPath = to.path
}
// window.location.href = 'https://signin-test.nio.com/oauth2/authorize?client_id=100679&redirect_uri=' + encodeURIComponent('http://grp.nioint.com' + fullPath) + '&response_type=code'
// http://grp.nioint.com
// window.location.href = 'https://signin-test.nio.com/oauth2/authorize?client_id=100679&redirect_uri='
// + encodeURIComponent('http://localhost:3000' + fullPath) + '&response_type=code&state=' + JSON.stringify(to.query)
NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
}
}