【新增】新增sso

This commit is contained in:
zhoulingpo
2023-05-17 16:30:34 +08:00
parent 8182a35447
commit 52b3f0fd0a
2 changed files with 20 additions and 4 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
const isDev = process.env.NODE_ENV && process.env.NODE_ENV === 'development'
console.log(isDev,"process.env.")
let myUrl=encodeURI('http://10.0.1.14:8080/checkPage')
let myUrl='http%3A%2F%2F127.0.0.1%3A8080%2FcheckPage'
const routes = [
{
path: '/system',
@@ -19,7 +19,7 @@ const routes = [
{
path: '/',
redirect: () => {
window.location.href ='https://iamuat.faw-vw.com/esc-sso/oauth2.0/authorize/old?isADSSO=true&response_type=code&client_id=&redirect_uri='+myUrl
window.location.href ='https://iamuat.faw-vw.com/esc-sso/oauth2.0/authorize?isADSSO=true&response_type=code&client_id=43da19911e74a14dd5d9&redirect_uri='+myUrl
}
// window.location.href = "https://sso-qa.saicmotortest.com/idp/oauth2/authorize?redirect_uri=https://www.baidu.com/&state=gsrm&client_id=GSRM&response_type=code"
+18 -2
View File
@@ -11,6 +11,21 @@ export default {
}
},
methods:{
// 调用获取水印的前缀接口 获取前缀
getMarket () {
return new Promise((resolve,reject)=>{
this.$api.setting.getOneSetting( this.basMessage['mark'].value).then(res=>{
if(res.data){
resolve(res.data.configValue)
}else{
resolve('')
}
}).catch(()=>{
reject('')
})
})
},
getLogin(){
this.$api.sso.ssoLogin({code:this.code}).then(res=>{
res.data.roleIdList=res.data.roleEOList.map(item=>{
@@ -52,6 +67,7 @@ export default {
}
this.$message.success('登录成功')
this.getMarket().then((resx)=>{
debugger
this.$store.commit('setMarketpre', resx)
this.$router.push(params)
}).catch((resx)=>{
@@ -68,8 +84,8 @@ export default {
this.code=this.$route.query.code || ''
// isADSSO=true&client_id=XXXX&response_type=code&redirect_uri=http%3A%2F%2FXXX.XXXX.XXXX.XXX%3A8080%2FXXXX%2FXXXX&state=http%3A%2F%2Fwww.app1.com%2Ftodu%2F1w2341123
if(this.code==''){
let myUrl=encodeURI('http://10.0.1.14:8080/checkPage')
window.open('https://iamuat.faw-vw.com/esc-sso/oauth2.0/authorize/old?isADSSO=true&response_type=code&client_id=&redirect_uri='+myUrl)
let myUrl='http%3A%2F%2F127.0.0.1%3A8080%2FcheckPage'
window.open('https://iamuat.faw-vw.com/esc-sso/oauth2.0/authorize?isADSSO=true&response_type=code&client_id=&redirect_uri=43da19911e74a14dd5d9'+myUrl)
}else{
this.getLogin()
}