[update] 头部菜单增加企业端单点登录

This commit is contained in:
lideqin
2024-02-29 14:05:03 +08:00
parent 7e15063416
commit 9c90a0d898
5 changed files with 47 additions and 2 deletions
+33
View File
@@ -1,5 +1,7 @@
<template>
<div class="user-wrapper" :class="theme">
<!-- 1.增加企业端单点登录 -->
<a-button type="link" class="single-login-btn" @click="singleLoginEnterTerminal" v-has="'enterpriseTerminal:singleSignLogin'">企业端</a-button>
<header-notice class="action"/>
<a-dropdown>
<span class="action action-full ant-dropdown-link user-dropdown-menu">
@@ -76,6 +78,8 @@ import { getFileAccessHttpUrl, getAction } from '@/api/manage'
import Vue from 'vue'
import { UI_CACHE_DB_DICT_DATA } from '@/store/mutation-types'
import UserAuthorizationCode from './UserAuthorizationCode'
import { ssLoginEnterTerminal } from '@/api/api'
import {notification} from "ant-design-vue";
export default {
name: 'UserMenu',
@@ -237,6 +241,24 @@ export default {
let userEmail = this.userInfo().email
let uId = this.userInfo().id
this.$refs.userAuthorizationCode.show(username, userEmail, uId)
},
// 单点登录企业端
async singleLoginEnterTerminal () {
let res = await ssLoginEnterTerminal()
if (res.success) {
// 单点登录成功,跳转到企业端首页,并用token登录
console.log(res)
const token = res.result.token
window.open(`${window._CONFIG.enterpriseTerminal}dashboard/analysis?token=${token}`, '_self')
} else {
notification['error']({
message: '登录失败',
description: res.message,
duration: 4,
})
// window.open(`${window._CONFIG.enterpriseTerminal}user/login`, '_self')
return
}
}
}
}
@@ -267,6 +289,17 @@ export default {
width: 100%;
text-align: center;
}
.single-login-btn {
color: #FFFFFF;
}
.single-login-btn:hover {
color: #FFFFFF;
}
.single-login-btn:focus {
color: #FFFFFF;
}
</style>
<style scoped>