|
|
@ -1,10 +1,6 @@ |
|
|
|
<!-- 顶栏右侧区域 --> |
|
|
|
<template> |
|
|
|
<div class="ele-admin-header-tool"> |
|
|
|
<!-- 网站首页 --> |
|
|
|
<div class="ele-admin-header-tool-item" v-if="domain" @click="openUrl(`https://${domain}`)"> |
|
|
|
<HomeOutlined /> |
|
|
|
</div> |
|
|
|
<!-- 消息通知 --> |
|
|
|
<div class="ele-admin-header-tool-item" @click="openUrl(`/user/notice`)"> |
|
|
|
<header-notice/> |
|
|
@ -20,21 +16,17 @@ |
|
|
|
<fullscreen-exit-outlined v-if="fullscreen"/> |
|
|
|
<fullscreen-outlined v-else/> |
|
|
|
</div> |
|
|
|
<!-- 语言切换 --> |
|
|
|
<div v-if="lang.length > 0" class="ele-admin-header-tool-item"> |
|
|
|
<i18n-icon/> |
|
|
|
</div> |
|
|
|
<!-- 用户信息 --> |
|
|
|
<div class="ele-admin-header-tool-item"> |
|
|
|
<a-dropdown placement="bottom" :overlay-style="{ minWidth: '280px' }"> |
|
|
|
<div class="ele-admin-header-avatar"> |
|
|
|
<a-avatar :src="website?.websiteLogo"> |
|
|
|
<template v-if="!website?.websiteLogo" #icon> |
|
|
|
<a-avatar :src="loginUser?.avatar"> |
|
|
|
<template v-if="!loginUser?.avatar" #icon> |
|
|
|
<user-outlined/> |
|
|
|
</template> |
|
|
|
</a-avatar> |
|
|
|
<span :class="{ 'hidden-sm-and-down': styleResponsive }"> |
|
|
|
{{ website?.websiteName }} |
|
|
|
{{ loginUser.nickname }} |
|
|
|
</span> |
|
|
|
<down-outlined style="margin-left: 6px"/> |
|
|
|
</div> |
|
|
@ -50,13 +42,9 @@ |
|
|
|
}}</span> |
|
|
|
</div> |
|
|
|
<div class="text-gray-400"> |
|
|
|
租户ID:<span class="ele-text-secondary">{{ |
|
|
|
loginUser.tenantId |
|
|
|
用户ID:<span class="ele-text-secondary" @click="copyText(loginUser.userId)">{{ |
|
|
|
loginUser.userId |
|
|
|
}}</span> |
|
|
|
<copy-outlined |
|
|
|
style="margin-left: 10px" |
|
|
|
@click="copyText(loginUser.tenantId)" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<div class="text-gray-400"> |
|
|
|
昵称:<span class="ele-text-secondary">{{ |
|
|
@ -68,6 +56,11 @@ |
|
|
|
loginUser.mobile |
|
|
|
}}</span> |
|
|
|
</div> |
|
|
|
<div class="text-gray-400"> |
|
|
|
租户:<span class="ele-text-secondary" @click="copyText(loginUser.tenantId)">{{ |
|
|
|
loginUser.tenantId |
|
|
|
}}</span> |
|
|
|
</div> |
|
|
|
<div class="text-gray-400"> |
|
|
|
角色: |
|
|
|
<template |
|
|
@ -135,7 +128,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
import {computed, createVNode, ref, watch} from 'vue'; |
|
|
|
import {computed, createVNode, ref} from 'vue'; |
|
|
|
import {useRouter} from 'vue-router'; |
|
|
|
import {useI18n} from 'vue-i18n'; |
|
|
|
import {Modal} from 'ant-design-vue/es'; |
|
|
@ -148,7 +141,7 @@ import { |
|
|
|
HomeOutlined |
|
|
|
} from '@ant-design/icons-vue'; |
|
|
|
import {storeToRefs} from 'pinia'; |
|
|
|
import {copyText, navTo, openNew, openUrl} from '@/utils/common'; |
|
|
|
import {copyText, openNew, openUrl} from '@/utils/common'; |
|
|
|
import {useThemeStore} from '@/store/modules/theme'; |
|
|
|
import HeaderNotice from './header-notice.vue'; |
|
|
|
import PasswordModal from './password-modal.vue'; |
|
|
@ -158,13 +151,8 @@ import {logout} from '@/utils/page-tab-util'; |
|
|
|
import type {Menu} from '@/api/system/menu/model'; |
|
|
|
import {isExternalLink} from 'ele-admin-pro'; |
|
|
|
import {listRoles} from '@/api/system/role'; |
|
|
|
import {getSiteInfo} from "@/api/layout"; |
|
|
|
import I18nIcon from './i18n-icon.vue'; |
|
|
|
import {CmsWebsite} from "@/api/cms/cmsWebsite/model"; |
|
|
|
import {listCmsLangLog} from "@/api/cms/cmsLangLog"; |
|
|
|
import {CmsLangLog} from "@/api/cms/cmsLangLog/model"; |
|
|
|
import {getCmsWebsiteSetting} from "@/api/cms/cmsWebsiteSetting"; |
|
|
|
import {useWebsiteSettingStore} from "@/store/modules/setting"; |
|
|
|
|
|
|
|
// 是否开启响应式布局 |
|
|
|
const themeStore = useThemeStore(); |
|
|
@ -184,7 +172,6 @@ defineProps<{ |
|
|
|
const {push} = useRouter(); |
|
|
|
const {t} = useI18n(); |
|
|
|
const userStore = useUserStore(); |
|
|
|
const setting = useWebsiteSettingStore(); |
|
|
|
// 是否显示修改密码弹窗 |
|
|
|
const passwordVisible = ref(false); |
|
|
|
|
|
|
@ -195,10 +182,7 @@ const domain = ref(localStorage.getItem('Domain')) |
|
|
|
// 当前用户信息 |
|
|
|
const loginUser = computed(() => userStore.info ?? {}); |
|
|
|
const menuList = ref<Menu[]>([]); |
|
|
|
const parentId = ref<number>(); |
|
|
|
const bordered = ref<boolean>(false); |
|
|
|
const website = ref<CmsWebsite>(); |
|
|
|
const lang = ref<CmsLangLog[]>([]); |
|
|
|
|
|
|
|
/* 用户信息下拉点击 */ |
|
|
|
const onUserDropClick = ({key}) => { |
|
|
@ -250,28 +234,6 @@ const toggleFullscreen = () => { |
|
|
|
}; |
|
|
|
|
|
|
|
const reload = () => { |
|
|
|
// 获取网站信息 |
|
|
|
getSiteInfo().then((data) => { |
|
|
|
website.value = data; |
|
|
|
// 网站ID |
|
|
|
localStorage.setItem('WebsiteId', `${data.websiteId}`); |
|
|
|
// 读取网站设置 |
|
|
|
if(data.setting){ |
|
|
|
setting.setSetting(data.setting); |
|
|
|
} |
|
|
|
getCmsWebsiteSetting(Number(data.websiteId)).then((settingInfo) => { |
|
|
|
if (settingInfo) { |
|
|
|
setting.setSetting(settingInfo); |
|
|
|
if (settingInfo.editor) { |
|
|
|
localStorage.setItem('Editor', `${settingInfo.editor}`) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(() => { |
|
|
|
// 首页加载分配资源 |
|
|
|
localStorage.removeItem('WebsiteId') |
|
|
|
localStorage.setItem('NotActive', '1') |
|
|
|
}); |
|
|
|
|
|
|
|
// 查询商户角色的roleId |
|
|
|
if (!localStorage.getItem('RoleIdByMerchant')) { |
|
|
@ -283,15 +245,6 @@ const reload = () => { |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 国际化 |
|
|
|
listCmsLangLog({}).then(list => { |
|
|
|
lang.value = list; |
|
|
|
if (list.length > 0 && !i18n) { |
|
|
|
localStorage.setItem('i18n-lang', `${list[0].code}`); |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
reload(); |
|
|
|