mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-21 08:26:48 +08:00
tt
This commit is contained in:
83
hotgo-web/src/components/GlobalHeader/AvatarDropdown.vue
Normal file
83
hotgo-web/src/components/GlobalHeader/AvatarDropdown.vue
Normal file
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<a-dropdown v-if="name" placement="bottomRight">
|
||||
<span class="ant-pro-account-avatar">
|
||||
<a-avatar size="small" :src="avatar" class="antd-pro-global-header-index-avatar" />
|
||||
<span>{{ name }}</span>
|
||||
</span>
|
||||
<template v-slot:overlay>
|
||||
<a-menu class="ant-pro-drop-down menu" :selected-keys="[]">
|
||||
<!-- <a-menu-item v-if="menu" key="center" @click="handleToCenter">
|
||||
<a-icon type="user" />
|
||||
个人中心
|
||||
</a-menu-item> -->
|
||||
<a-menu-item v-if="menu" key="settings" @click="handleToSettings">
|
||||
<a-icon type="setting" />
|
||||
个人中心
|
||||
</a-menu-item>
|
||||
<a-menu-divider v-if="menu" />
|
||||
<a-menu-item key="logout" @click="handleLogout">
|
||||
<a-icon type="logout" />
|
||||
退出登录
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
<span v-else>
|
||||
<a-spin size="small" :style="{ marginLeft: 8, marginRight: 8 }" />
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Modal } from 'ant-design-vue'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'AvatarDropdown',
|
||||
props: {
|
||||
menu: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'avatar',
|
||||
'name'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
handleToCenter () {
|
||||
this.$router.push({ path: '/account/center' })
|
||||
},
|
||||
handleToSettings () {
|
||||
this.$router.push({ path: '/account/settings' })
|
||||
},
|
||||
handleLogout (e) {
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定注销并退出系统吗?',
|
||||
onOk: () => {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// setTimeout(Math.random() > 0.5 ? resolve : reject, 1500)
|
||||
// }).catch(() => console.log('Oops errors!'))
|
||||
return this.$store.dispatch('Logout').then(() => {
|
||||
this.$router.push({ name: 'login' })
|
||||
})
|
||||
},
|
||||
onCancel () {}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.ant-pro-drop-down {
|
||||
/deep/ .action {
|
||||
margin-right: 8px;
|
||||
}
|
||||
/deep/ .ant-dropdown-menu-item {
|
||||
min-width: 160px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
115
hotgo-web/src/components/GlobalHeader/PlatformVersion.vue
Normal file
115
hotgo-web/src/components/GlobalHeader/PlatformVersion.vue
Normal file
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<ant-modal
|
||||
:visible="open"
|
||||
:modal-title="formTitle"
|
||||
:adjust-size="true"
|
||||
:isShowTitle="false"
|
||||
:closeAble="true"
|
||||
:footer="null"
|
||||
modalWidth="600"
|
||||
modalHeight="350"
|
||||
@cancel="cancel"
|
||||
>
|
||||
|
||||
<a-row slot="content">
|
||||
<a-col :span="8">
|
||||
<div class="copyright-icon"><a-icon type="key" /></div>
|
||||
</a-col>
|
||||
<a-col :span="16">
|
||||
<div class="copyright-content">
|
||||
<div class="copyright-text">
|
||||
<h2>平台授权信息.</h2>
|
||||
<h3>非常感谢您对我们产品的认可与支持!</h3>
|
||||
{{ versionContent[0] }}<br>
|
||||
{{ versionContent[1] }}<br>
|
||||
{{ versionContent[2] }}<br>
|
||||
授权产品名称:AiDex<br>
|
||||
当前平台版本:V1.2.1
|
||||
</div>
|
||||
<a-button type="primary" icon="close-circle" @click="cancel">
|
||||
关闭页面
|
||||
</a-button>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</ant-modal>
|
||||
</template>
|
||||
<script>
|
||||
import AntModal from '@/components/pt/dialog/AntModal'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'CreateForm',
|
||||
components: {
|
||||
AntModal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
formTitle: '',
|
||||
open: false,
|
||||
versionContent: []
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
},
|
||||
created () {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'platformVersion'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
methods: {
|
||||
cancel () {
|
||||
this.open = false
|
||||
this.$emit('close')
|
||||
},
|
||||
showVersion () {
|
||||
this.open = true
|
||||
this.formTitle = '授权信息'
|
||||
if (this.platformVersion !== null && this.platformVersion !== '') {
|
||||
const licenseInfo = JSON.parse(this.platformVersion)
|
||||
const customName = licenseInfo.customName
|
||||
const versionDes = licenseInfo.versionDes
|
||||
const version = licenseInfo.version
|
||||
let deadLine = licenseInfo.deadLine
|
||||
if (version === '2') {
|
||||
const beforeYear = deadLine.split('-')[0]
|
||||
let myDate = new Date()
|
||||
myDate = myDate.getFullYear()
|
||||
if ((beforeYear - myDate) >= 10) {
|
||||
deadLine = '无限制'
|
||||
}
|
||||
}
|
||||
this.versionContent.push('授权对象:' + customName)
|
||||
this.versionContent.push('版本信息:' + versionDes)
|
||||
this.versionContent.push('到期时间:' + deadLine)
|
||||
} else {
|
||||
this.versionContent.push('授权对象:未知')
|
||||
this.versionContent.push('版本信息:未知')
|
||||
this.versionContent.push('到期时间:未知')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
.copyright-content{
|
||||
padding: 30px 10px 20px;
|
||||
}
|
||||
.copyright-icon{
|
||||
text-align: center;
|
||||
font-size: 80px;
|
||||
padding: 20px 30px 10px;
|
||||
color: #85c1fb;
|
||||
}
|
||||
.copyright-text{
|
||||
margin-bottom: 20px;
|
||||
h2{
|
||||
font-size:22px;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
251
hotgo-web/src/components/GlobalHeader/RightContent.vue
Normal file
251
hotgo-web/src/components/GlobalHeader/RightContent.vue
Normal file
@@ -0,0 +1,251 @@
|
||||
<template>
|
||||
<div :class="wrpCls" style="margin-right:16px">
|
||||
<a-space size="middle">
|
||||
<a-tooltip>
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link" style="color:#fff;">
|
||||
切换工作台
|
||||
<a-icon type="down"/>
|
||||
</a>
|
||||
<a-menu slot="overlay" class="setUl" style="left:-10px;top:12px; width:200px">
|
||||
<a-menu-item
|
||||
:key="item.id"
|
||||
v-for="(item) in portalConfigs"
|
||||
:style="{'background-color': defaultPortal.id === item.id ? '#f0f5ff' : '' }"
|
||||
style="position: relative;">
|
||||
<a-icon
|
||||
v-if="defaultPortal.id === item.id"
|
||||
style="left: 10px;"
|
||||
type="check"
|
||||
:style="{'color': defaultPortal.id === item.id ? '#2f54eb' : '#999999' }"/>
|
||||
<a class="homeTit" target="_blank" @click="toIndex(item)">{{ item.name }}</a>
|
||||
<a-icon style="right: 8px;" type="delete" target="_blank" @click="toDesignIndex(item,'delete')"/>
|
||||
<a-icon style="right: 28px;" type="edit" target="_blank" @click="toDesignIndex(item)"/>
|
||||
</a-menu-item>
|
||||
<a-menu-divider/>
|
||||
<a-menu-item class="menu-operation" key="3" v-if="portalConfigs.length <=15">
|
||||
<a target="_blank" @click="toDesignIndex()">
|
||||
<a-icon type="plus"/>
|
||||
添加工作台</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</a-tooltip>
|
||||
<a-tooltip v-if="userType === '1'">
|
||||
<template slot="title">
|
||||
控制台
|
||||
</template>
|
||||
<a-icon type="desktop" @click="toConsole" :style="{ fontSize: '18px'}"/>
|
||||
</a-tooltip>
|
||||
<a-tooltip @click="toNotice" style="cursor:pointer">
|
||||
<template slot="title">
|
||||
消息
|
||||
</template>
|
||||
<a-badge :count="msgCount">
|
||||
<a-icon type="sound" :style="{ fontSize: '18px'}"/>
|
||||
</a-badge>
|
||||
</a-tooltip>
|
||||
<a-tooltip>
|
||||
<template slot="title">
|
||||
换肤
|
||||
</template>
|
||||
<a-icon type="setting" @click="showColorSetting()" :style="{ fontSize: '18px'}"/>
|
||||
</a-tooltip>
|
||||
<a-tooltip>
|
||||
<template slot="title">
|
||||
{{ fullScreen ? '退出全屏' : '切为全屏' }}
|
||||
</template>
|
||||
<a-icon
|
||||
:type="fullScreen ? 'fullscreen-exit' : 'fullscreen'"
|
||||
@click="toggleFullScreen"
|
||||
:style="{ fontSize: '18px'}"/>
|
||||
</a-tooltip>
|
||||
<avatar-dropdown :menu="showMenu" :current-user="currentUser" :class="prefixCls"/>
|
||||
<!-- 暂只支持中文,国际化可自行扩展 -->
|
||||
<select-lang :class="prefixCls"/>
|
||||
</a-space>
|
||||
<platform-version
|
||||
v-if="modalVisible"
|
||||
ref="platformVersionModal"
|
||||
@close="modalVisible = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AvatarDropdown from './AvatarDropdown'
|
||||
import SelectLang from '@/components/SelectLang'
|
||||
import PlatformVersion from './PlatformVersion'
|
||||
import {
|
||||
mapGetters
|
||||
} from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'RightContent',
|
||||
components: {
|
||||
AvatarDropdown,
|
||||
SelectLang,
|
||||
PlatformVersion
|
||||
},
|
||||
props: {
|
||||
prefixCls: {
|
||||
type: String,
|
||||
default: 'ant-pro-global-header-index-action'
|
||||
},
|
||||
isMobile: {
|
||||
type: Boolean,
|
||||
default: () => false
|
||||
},
|
||||
topMenu: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
modalVisible: false,
|
||||
showMenu: true,
|
||||
showPortalDefined: false,
|
||||
currentUser: {},
|
||||
fullScreen: false,
|
||||
msgCount: 0,
|
||||
docUrl: 'https://docs.geekera.cn/AiDex-Antdv/',
|
||||
githubUrl: 'https://github.com/fuzui/AiDex-Antdv'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
wrpCls() {
|
||||
return {
|
||||
'ant-pro-global-header-index-right': true,
|
||||
[`ant-pro-global-header-index-${(this.isMobile || !this.topMenu) ? 'light' : this.theme}`]: true
|
||||
}
|
||||
},
|
||||
...mapGetters([
|
||||
'userType',
|
||||
'portalConfigs',
|
||||
'defaultPortal',
|
||||
'sysNoticeList'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
this.currentUser = {
|
||||
name: 'RuoYi'
|
||||
}
|
||||
}, 1500)
|
||||
this.msgCount = this.sysNoticeList.length
|
||||
},
|
||||
methods: {
|
||||
showColorSetting() {
|
||||
this.$emit('showSetting')
|
||||
},
|
||||
toConsole() {
|
||||
this.$message.success(
|
||||
'尚未实现',
|
||||
3
|
||||
)
|
||||
},
|
||||
toNotice() {
|
||||
this.$router.push({
|
||||
path: '/system/notice/NoticeReadIndex'
|
||||
})
|
||||
this.msgCount = 0
|
||||
},
|
||||
toIndex(item) {
|
||||
this.$router.push({
|
||||
name: 'index',
|
||||
params: {
|
||||
key: item.id
|
||||
}
|
||||
})
|
||||
if (item.applicationRange === 'U') {
|
||||
// 当选中小页时用户自定义时,修改选中小页为默认小页
|
||||
this.defaultPortal.id = item.id
|
||||
}
|
||||
this.$emit('reloadTab', item)
|
||||
},
|
||||
toDesignIndex(item, type) {
|
||||
this.$message.success(
|
||||
'尚未实现',
|
||||
3
|
||||
)
|
||||
},
|
||||
// 全屏切换
|
||||
toggleFullScreen() {
|
||||
if (!document.fullscreenElement) {
|
||||
document.documentElement.requestFullscreen()
|
||||
} else {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen()
|
||||
}
|
||||
}
|
||||
this.fullScreen = !this.fullScreen
|
||||
},
|
||||
versionInfo() {
|
||||
this.modalVisible = true
|
||||
this.$nextTick(() => (
|
||||
this.$refs.platformVersionModal.showVersion()
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped="scoped">
|
||||
.ant-pro-global-header {
|
||||
.anticon {
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-modal-confirm-content {
|
||||
p {
|
||||
height: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.setUl {
|
||||
.ant-dropdown-menu-item {
|
||||
padding: 5px 32px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ant-dropdown-menu-item > .anticon:first-child {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ant-dropdown-menu-item i {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
font-size: 12px;
|
||||
color: #969696;
|
||||
}
|
||||
|
||||
.ant-dropdown-menu-item > a.homeTit {
|
||||
width: 150px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.menu-operation {
|
||||
text-align: center;
|
||||
|
||||
i {
|
||||
position: relative;
|
||||
top: 0px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-operation:hover {
|
||||
i {
|
||||
color: #1890ff
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user