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

212 lines
5.2 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">
<div class="menu">
2023-04-14 14:52:32 +08:00
<img src="@/assets/1x/1x/source5.png" alt="menu" class="menuicon" @click="drawShow" >
2023-04-12 14:40:19 +08:00
</div>
2023-04-12 23:41:18 +08:00
<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-12 14:40:19 +08:00
<img src="@/assets/1x/1x/source2.png" alt="找不到图片">
</div>
2023-04-12 23:41:18 +08:00
<div class="langWrap">
<img src="@/assets/1x/source1.png" @click="handleShowLang" class="second">
<Lang ref="lang" class="lang"/>
</div>
2023-04-17 16:01:46 +08:00
</div>
2023-04-12 23:41:18 +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-12 23:41:18 +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()
const handleShowLang=(e:any)=>{
console.log(1111)
e.stopPropagation()
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],
openDrawer:{
required:true,
type:Function
}
2023-04-12 14:40:19 +08:00
})
const handlesearch = ()=>{
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-12 23:41:18 +08:00
.langWrap{
// position: absolute;
// // top:-20px;
// left: 260px;
// display: flex;
// align-items: end;
position: relative;
margin-left: 15px;
.second {
width: 32px;
height: 36px;
2023-04-13 18:03:12 +08:00
margin-top: 4px;
2023-04-12 23:41:18 +08:00
&:hover {
transform: scale(1.2);
}
}
}
.lang{
position: absolute;
top:50px;
left: -50px;
}
2023-04-18 17:04:41 +08:00
.left-right{
display: flex;
justify-content: space-between;
width: 6vw;
margin-right: 10rem;
}
2023-04-12 23:41:18 +08:00
2023-04-12 14:40:19 +08:00
.headerWrap {
display: flex;
justify-content: space-between;
padding-top: 40px;
transform: translateY(-20px);
@media screen and (max-width: 768px){
flex-direction: column;
.left-1{
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
}
.left-right{
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
}
}
.left {
display: flex;
2023-04-12 23:41:18 +08:00
position: relative;
2023-04-12 14:40:19 +08:00
@media screen and (max-width: 768px){
justify-content: space-between;
width: 100vw;
align-items:center;
}
.menu{
display: none;
@media screen and (max-width: 768px){
display: block;
2023-04-18 17:04:41 +08:00
margin-top: 3px;
2023-04-12 14:40:19 +08:00
}
}
span {
color: #2B4A60;
font-size: 45px;
font-weight: 900;
@media screen and (max-width: 768px){
2023-04-18 17:04:41 +08:00
font-size: 26px;
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;
img {
width: 18px;
height: 18px;
}
}
}
.right {
font-size: 20px;
@media screen and (max-width: 768px){
width: 100vw;
2023-04-18 17:04:41 +08:00
margin-top: 10px;
transform: translateX(-10px);
2023-04-12 14:40:19 +08:00
}
.time {
color: #435F70;
@media screen and (max-width: 768px){
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;
span {
margin-right: 15px;
}
:deep(.el-switch__action) {
background-color: #E86666;
}
@media screen and (max-width: 768px){
2023-04-18 17:04:41 +08:00
font-size: 15px;
margin-top: 13px;
transform: translateX(200px);
2023-04-12 14:40:19 +08:00
}
}
}
}
</style>