This commit is contained in:
lnn19986213 2024-04-15 12:37:03 +08:00
parent 280c65b88e
commit f431431a1e
7 changed files with 88 additions and 39 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
src/assets/headLeft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
src/assets/headLeftC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
src/assets/headRight.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
src/assets/headRightC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
src/assets/headerBg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

View File

@ -1,22 +1,24 @@
<template> <template>
<div class="header"> <div class="header">
<img class="title" src="../assets/img_07.png" alt="" /> <!-- <img class="title" src="../assets/img_07.png" alt="" /> -->
<div class="time"> <div class="time">
<div id="clock">加载中...</div>
<div id="date-display"></div> <div id="date-display"></div>
<div id="clock" style="margin-top: 4px;">加载中...</div>
</div> </div>
<div class="header-menu"> <div class="header-menu">
<ul class="header-menu-item header-menu-left"> <div class="header-menu-item header-menu-left">
<li v-for="item in data.urlLeft.slice(0, 3)" :key="item.name"> <div :class="data.nowTab == item.url ? 'leftItemC' : 'leftItem'" v-for="item in data.urlLeft.slice(0, 3)"
<span class="header-menu-on" @click="to(item.url)">{{ item.name }}</span> :key="item.name">
</li> <div class="itemText" @click="to(item.url)">{{ item.name }}</div>
</ul> </div>
<ul class="header-menu-item header-menu-right"> </div>
<li v-for="item in data.urlLeft.slice(3, 6)" :key="item.name"> <div class="header-menu-item header-menu-right">
<span class="header-menu-on" @click="to(item.url)">{{ item.name }}</span> <div :class="data.nowTab == item.url ? 'rightItemC' : 'rightItem'" v-for="item in data.urlLeft.slice(3, 6)"
</li> :key="item.name">
</ul> <div class="itemText" @click="to(item.url)">{{ item.name }}</div>
</div>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -40,18 +42,18 @@ const updateClock = () => {
// //
const timeString = `${hours}:${minutes}:${seconds}`; const timeString = `${hours}:${minutes}:${seconds}`;
const formattedDate = year + "-" + month + "-" + day; const formattedDate = year + "/" + month + "/" + day;
// //
document.getElementById("clock").textContent = timeString; document.getElementById("clock").textContent = timeString;
// div // div
document.getElementById("date-display").innerText = formattedDate; document.getElementById("date-display").innerText = formattedDate;
}; };
const to =(url)=>{ const to = (url) => {
router.push({ router.push({
path: `${url}`, path: `${url}`,
}); });
data.nowTab = url
} }
const router = useRouter(); const router = useRouter();
const routers = useRoute(); const routers = useRoute();
@ -60,49 +62,52 @@ const data = reactive({
urlLeft: [ urlLeft: [
{ {
name: "主页", name: "主页",
url:'/home/index', url: '/home/index',
}, },
{ {
name: "养老", name: "养老",
url:'/home/yl', url: '/home/yl',
}, },
{ {
name: "卫生", name: "卫生",
url:'/home/hygiene', url: '/home/hygiene',
}, },
{ {
name: "教育", name: "教育",
url:'/home/education', url: '/home/education',
}, },
{ {
name: "就业救助", name: "就业救助",
url:'/home/work', url: '/home/work',
}, },
{ {
name: "智能分析", name: "智能分析",
url:'/home/analyze', url: '/home/analyze',
}, },
], ],
nowTab: "0", nowTab: "/home/index",
}); });
onMounted(() => { onMounted(() => {
// updateClock // updateClock
updateClock(); updateClock();
data.nowTab = router.currentRoute.value.fullPath
// updateClock // updateClock
setInterval(updateClock, 1000); setInterval(updateClock, 1000);
}); });
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.header { .header {
// background-image: url(../assets/header.png); background-image: url(../assets/headerBg.png);
// background-size: 100% 100%; background-size: 100% 100%;
display: flex; display: flex;
height: 80px; height: 112px;
width: 100%; width: 100%;
background-color: beige; // background-color: beige;
position: relative; position: relative;
.title { .title {
position: absolute; position: absolute;
left: 50%; left: 50%;
@ -111,15 +116,19 @@ onMounted(() => {
width: 146px; width: 146px;
height: 55px; height: 55px;
} }
.time { .time {
width: 200px; width: 200px;
height: 100%; height: 70%;
display: flex; display: flex;
padding-left: 20px; padding-left: 20px;
flex-direction: column; flex-direction: column;
color: #fff;
// align-items: center; // align-items: center;
justify-content: center; justify-content: center;
font-size: 18px;
} }
&-menu { &-menu {
// position: absolute; // position: absolute;
// left:20%; // left:20%;
@ -147,26 +156,66 @@ onMounted(() => {
top: 0; top: 0;
display: flex; display: flex;
cursor: pointer; cursor: pointer;
&-item { &-item {
height: 80px; height: 80px;
width: 600px;
display: flex; display: flex;
position: absolute; position: absolute;
justify-content: space-around; align-items: center;
li {
display: inline-block;
margin: 0px;
height: 80px;
line-height: 80px;
text-align: center;
font-size: 30px;
}
} }
&-left { &-left {
left: 10%; left: 8%;
} }
&-right { &-right {
left: 60%; right: 8%;
}
.leftItem {
background-image: url(../assets/headLeft.png);
background-size: 100% 100%;
display: flex;
height: 62px;
width: 160px;
margin: 0 -14px;
}
.leftItemC {
background-image: url(../assets/headLeftC.png);
background-size: 100% 100%;
display: flex;
height: 62px;
width: 160px;
margin: 0 -14px;
}
.rightItem {
background-image: url(../assets/headRight.png);
background-size: 100% 100%;
display: flex;
height: 62px;
width: 160px;
margin: 0 -14px;
}
.rightItemC {
background-image: url(../assets/headRightC.png);
background-size: 100% 100%;
display: flex;
height: 62px;
width: 160px;
margin: 0 -14px;
}
.itemText {
width: 150px;
height: 62px;
margin: 0 auto;
text-align: center;
line-height: 62px;
font-size: 18px;
color: #fff;
} }
} }
} }