Files
fini-ui/src/views/dashBoard/Header/index.vue
T

237 lines
5.4 KiB
Vue
Raw Normal View History

2023-04-12 14:40:19 +08:00
<template>
<div class="headerWrap">
<div class="left">
<div class="left-1">
2023-04-19 17:41:10 +08:00
<img src="@/assets/1x/1x/source5.png" alt="menu" @click="drawShow" class="menu">
<span>{{ $t(i18n.global.t('dashboard.Dashboard')) }}</span>
2023-04-12 14:40:19 +08:00
</div>
2023-04-17 16:01:46 +08:00
<div class="left-right">
<div class="search" @click="handlesearch">
2023-04-19 17:41:10 +08:00
<img src="@/assets/1x/1x/source2.png" alt="找不到图片">
</div>
<div class="langWrap">
<img src="@/assets/1x/source1.png" @click="handleShowLang" class="second">
<Lang ref="lang" class="lang" />
</div>
2023-04-12 14:40:19 +08:00
</div>
2023-04-12 23:41:18 +08:00
2023-04-19 17:41:10 +08:00
2023-04-12 14:40:19 +08:00
</div>
<div class="right">
<li class="time">{{ $t(i18n.global.t('dashboard.LastUpadated')) }}: {{ props.time }}</li>
<li class="show">
<span>Show Value</span>
<el-switch v-model="value" size="small" style="--el-switch-on-color: #750000" />
</li>
</div>
</div>
</template>
<script lang="ts">
export default {
name: "XHeader",
};
</script>
<script lang="ts" setup>
import { ref } from 'vue'
import i18n from '@/locales'
2023-04-19 17:41:10 +08:00
import { getCurrentInstance, onMounted, onUnmounted } from 'vue'
2023-04-12 14:40:19 +08:00
import Drawer from '@/views/login/modelComponents/Drawer.vue'
2023-04-12 23:41:18 +08:00
import Lang from "@/views/login/components/Lang.vue";
import { conforms } from 'lodash';
2023-04-12 14:40:19 +08:00
const { proxy } = (getCurrentInstance() as any)
const value = ref(true)
2023-04-14 14:52:32 +08:00
2023-04-12 23:41:18 +08:00
const lang = ref()
2023-04-19 17:41:10 +08:00
const handleShowLang = (e: any) => {
console.log(1111)
e.stopPropagation()
2023-04-12 23:41:18 +08:00
lang.value.showLang = !lang.value.showLang
}
onMounted(() => {
document.documentElement.onclick = function () {
if (!lang.value.showLang) return
lang.value.showLang = false
}
})
onUnmounted(() => {
document.documentElement.onclick = null
})
2023-04-12 14:40:19 +08:00
const props = defineProps({
2023-04-14 14:52:32 +08:00
time: [String, Number],
2023-04-19 17:41:10 +08:00
openDrawer: {
required: true,
type: Function
2023-04-14 14:52:32 +08:00
}
2023-04-12 14:40:19 +08:00
})
2023-04-19 17:41:10 +08:00
const handlesearch = () => {
2023-04-12 14:40:19 +08:00
proxy.$router.push("/home")
}
const handleDrawer = (done: () => void) => {
done();
}
2023-04-14 14:52:32 +08:00
const drawShow = () => {
console.log(1111);
props.openDrawer();
2023-04-12 14:40:19 +08:00
}
</script>
<style lang="scss" scoped>
2023-04-19 17:41:10 +08:00
.langWrap {
2023-04-12 23:41:18 +08:00
// position: absolute;
// // top:-20px;
// left: 260px;
// display: flex;
// align-items: end;
position: relative;
margin-left: 15px;
2023-04-19 17:41:10 +08:00
.second {
width: 32px;
height: 36px;
margin-top: 4px;
&:hover {
transform: scale(1.2);
2023-04-12 23:41:18 +08:00
}
}
2023-04-19 17:41:10 +08:00
}
.lang {
position: absolute;
top: 50px;
left: -50px;
@media screen and (max-width: 768px) {
left: -120px;
2023-04-12 23:41:18 +08:00
}
2023-04-19 17:41:10 +08:00
}
.left-right {
display: flex;
justify-content: space-between;
width: 6vw;
margin-right: 10rem;
}
2023-04-12 14:40:19 +08:00
.headerWrap {
display: flex;
justify-content: space-between;
padding-top: 40px;
transform: translateY(-20px);
2023-04-21 16:54:59 +08:00
height: 50px;
2023-04-19 17:41:10 +08:00
@media screen and (max-width: 768px) {
2023-04-12 14:40:19 +08:00
flex-direction: column;
2023-04-21 16:54:59 +08:00
2023-04-19 17:41:10 +08:00
.left-1 {
2023-04-12 14:40:19 +08:00
display: flex;
justify-content: space-between;
width: 40vw;
2023-04-18 17:04:41 +08:00
margin-left: 15px;
2023-04-17 16:01:46 +08:00
}
2023-04-19 17:41:10 +08:00
.left-right {
2023-04-17 16:01:46 +08:00
display: flex;
justify-content: space-between;
width: 25vw;
2023-04-18 17:04:41 +08:00
margin-right: 10px;
2023-04-12 14:40:19 +08:00
}
}
2023-04-19 17:41:10 +08:00
2023-04-12 14:40:19 +08:00
.left {
display: flex;
2023-04-12 23:41:18 +08:00
position: relative;
2023-04-19 17:41:10 +08:00
@media screen and (max-width: 768px) {
2023-04-12 14:40:19 +08:00
justify-content: space-between;
width: 100vw;
2023-04-19 17:41:10 +08:00
align-items: center;
2023-04-12 14:40:19 +08:00
}
2023-04-19 17:41:10 +08:00
.menu {
display: none;
@media screen and (max-width: 768px) {
display: block;
// margin-top: 3px;
vertical-align: middle;
}
}
2023-04-12 14:40:19 +08:00
span {
color: #2B4A60;
font-size: 45px;
font-weight: 900;
2023-04-19 17:41:10 +08:00
@media screen and (max-width: 768px) {
font-size: 25px;
// margin-top: 4px;
2023-04-12 14:40:19 +08:00
}
}
.search {
background-color: #fff;
width: 30px;
height: 30px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
margin-left: 15px;
margin-top: 6px;
cursor: pointer;
2023-04-19 17:41:10 +08:00
2023-04-12 14:40:19 +08:00
img {
width: 18px;
height: 18px;
}
}
}
.right {
font-size: 20px;
2023-04-19 17:41:10 +08:00
@media screen and (max-width: 768px) {
// width: 100vw;
color: red;
margin-top: 10px;
transform: translateX(-10px);
}
2023-04-12 14:40:19 +08:00
.time {
color: #435F70;
2023-04-19 17:41:10 +08:00
@media screen and (max-width: 768px) {
2023-04-12 14:40:19 +08:00
float: right;
2023-04-18 17:04:41 +08:00
font-size: 15px;
2023-04-12 14:40:19 +08:00
}
}
.show {
margin-top: 5px;
text-align: right;
color: #27485E;
font-weight: 600;
2023-04-19 17:41:10 +08:00
2023-04-12 14:40:19 +08:00
span {
margin-right: 15px;
}
:deep(.el-switch__action) {
background-color: #E86666;
}
2023-04-19 17:41:10 +08:00
@media screen and (max-width: 768px) {
2023-04-18 17:04:41 +08:00
font-size: 15px;
margin-top: 13px;
2023-04-19 17:41:10 +08:00
transform: translateX(175px);
2023-04-12 14:40:19 +08:00
}
}
}
}
</style>