修改了导航样式

This commit is contained in:
zhangyong 2025-05-06 18:30:28 +08:00
parent a57d13d5da
commit 1efab811d8
6 changed files with 72 additions and 89 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -4,21 +4,32 @@
<a class="nav-icon" href="https://www.aimzhu.com" @click="gotoHomePage"> <a class="nav-icon" href="https://www.aimzhu.com" @click="gotoHomePage">
<img :src="logoSrc" alt="首页logo"> <img :src="logoSrc" alt="首页logo">
</a> </a>
<!-- <router-link to="/HomePage" @click="gotoHomePage">
<img :src="logoSrc" alt="首页logo">
</router-link> -->
<div class="nav router-container" :class="routerColor"> <div class="nav router-container" :class="routerColor">
<ul> <ul>
<!-- <li><router-link to="/HomePage" replace @click="activateHomePage" :class="{ activeHomePage: $route.path === '/HomePage' }">首页</router-link></li>
<li><router-link to="/HomePage" replace @click="activateHomePage" :class="{ activeHomePage: $route.path === '/HomePage' }">首页</router-link></li>
<li><router-link to="/ShouFei" @click="activate" :class="{ active: $route.path === '/ShouFei' }">收费介绍</router-link></li> <li><router-link to="/ShouFei" @click="activate" :class="{ active: $route.path === '/ShouFei' }">收费介绍</router-link></li>
<li><router-link to="/KeFu" @click="activate" :class="{ active: $route.path === '/KeFu' }">客服中心</router-link></li> <li><router-link to="/KeFu" @click="activate" :class="{ active: $route.path === '/KeFu' }">客服中心</router-link></li>
<li><router-link to="/ZhengShu" @click="activate" :class="{ active: $route.path === '/ZhengShu' }">证书展示</router-link></li> <li><router-link to="/ZhengShu" @click="activate" :class="{ active: $route.path === '/ZhengShu' }">证书展示</router-link></li>
<!-- <li><router-link to="/DaiLiShang" @click="activate" :class="{ active: $route.path === '/DaiLiShang' }">代理商展示</router-link></li> --> <li><router-link to="/DaiLiShang" @click="activate" :class="{ active: $route.path === '/DaiLiShang' }">代理商展示</router-link></li>
<!-- <li><router-link to="/TransactionCenter" @click="activate" :class="{ active: $route.path === '/TransactionCenter' }">交易中心</router-link></li> --> <li><router-link to="/TransactionCenter" @click="activate" :class="{ active: $route.path === '/TransactionCenter' }">交易中心</router-link></li>
<li><router-link to="/HelpCenter" @click="activate" :class="{ active: $route.path === '/HelpCenter' }">帮助中心</router-link></li> <li><router-link to="/HelpCenter" @click="activate" :class="{ active: $route.path === '/HelpCenter' }">帮助中心</router-link></li>
<!-- <li><router-link to="/AboutUs" @click="aa()" class="acss">关于我们</router-link></li> --> <li><router-link to="/AboutUs" @click="aa()" class="acss">关于我们</router-link></li> -->
<li>
<router-link
to="/HomePage"
replace
:style="getNavStyle('/HomePage')"
@click="activateHomePage"
>首页</router-link>
</li>
<li v-for="route in otherRoutes" :key="route.path">
<router-link
:to="route.path"
:style="getNavStyle(route.path)"
@click="activate"
>{{ route.name }}</router-link>
</li>
</ul> </ul>
</div> </div>
@ -35,9 +46,8 @@
</div> </div>
<div class="login-register"> <div class="login-register">
<a id="login" href="https://www.aimzhu.com/operator/" :class="loginClass">登录</a> <a id="login" href="https://www.aimzhu.com/operator/" :class="loginClass">登录</a>
<!-- <a id="login" href=" http://192.168.0.115:8091/operator" :class="loginClass">登录</a> -->
<a id="register" href="https://www.aimzhu.com/Register.html">免费注册</a> <a id="register" href="https://www.aimzhu.com/Register.html">免费注册</a>
<!-- <a id="register" href="http://192.168.0.121:5502/src/components/Register.html">免费注册</a> -->
</div> </div>
</div> </div>
@ -49,14 +59,15 @@
export default { export default {
data() { data() {
return { return {
// logoSrc: '/src/assets/img/headicon1.png', otherRoutes: [
// logoSrc: '/assets/img/headicon1.png', { path: '/ShouFei', name: '收费介绍' },
{ path: '/KeFu', name: '客服中心' },
{ path: '/ZhengShu', name: '证书展示' },
{ path: '/HelpCenter', name: '帮助中心' }
],
logoSrc: '/assets/img/headicon21.png', logoSrc: '/assets/img/headicon21.png',
isFixed: false, isFixed: false,
shouldReloadHomePage: false, // shouldReloadHomePage: false, //
// isHomePage: true, //
// logoSrc: import('/assets/img/headicon1.png'), // logo
currentRoute: '/HomePage', // currentRoute: '/HomePage', //
HeaderNav: true, HeaderNav: true,
phoneIcon: '/assets/img/nav-phone1.png', phoneIcon: '/assets/img/nav-phone1.png',
@ -64,6 +75,21 @@ export default {
}, },
methods:{ methods:{
getNavStyle(path) {
//
if (this.shouldApplyWhite) {
return { color: '#fff' };
}
//
if (this.$route.path === path) {
return { color: '#48b2e1' }; //
}
//
return { color: '#333' }; //
},
gotoHomePage() { gotoHomePage() {
this.$router.push('/HomePage'); this.$router.push('/HomePage');
// window.location.reload(); // // window.location.reload(); //
@ -71,38 +97,28 @@ export default {
}, },
activateHomePage() { activateHomePage() {
this.isFixed = false; // this.isFixed = false; //
// this.logoSrc = '/assets/img/headicon1.png';
this.logoSrc = '/assets/img/headicon21.png'; this.logoSrc = '/assets/img/headicon21.png';
this.phoneIcon = '/assets/img/nav-phone1.png'; this.phoneIcon = '/assets/img/nav-phone1.png';
// his.shouldReloadHomePage = true; //
//
// if (this.$route.path !== '/HomePage') {
// this.shouldRefreshHome = true; //
// }
}, },
// refreshHomePage() {
// window.location.href = window.location.href
// alert(11)
// },
activate() { activate() {
this.isFixed = true; // this.isFixed = true; //
// this.logoSrc = '/assets/img/headicon2.png';
this.logoSrc = '/assets/img/headicon21.png'; this.logoSrc = '/assets/img/headicon21.png';
this.phoneIcon = '/assets/img/nav-phone2.png'; this.phoneIcon = '/assets/img/nav-phone2.png';
}, },
handleScroll() { handleScroll() {
if (this.$route.path === '/HomePage') { if (this.isHomePage) {
this.isFixed = window.scrollY > 0; // const wasFixed = this.isFixed;
// this.logoSrc = ('window.scrollY > 0' ? '/src/assets/img/headicon2.png': '/src/assets/img/headicon1.png') this.isFixed = window.scrollY > 0;
//
this.phoneIcon = this.isFixed
? '/assets/img/nav-phone2.png'
: '/assets/img/nav-phone1.png';
if(window.scrollY > 0) { //
// this.logoSrc = '/assets/img/headicon2.png'; if (wasFixed !== this.isFixed) {
this.logoSrc = '/assets/img/headicon21.png'; this.$forceUpdate();
this.phoneIcon = '/assets/img/nav-phone2.png';
} else {
// this.logoSrc = '/assets/img/headicon1.png';
this.logoSrc = '/assets/img/headicon21.png';
this.phoneIcon = '/assets/img/nav-phone1.png';
} }
} }
}, },
@ -128,29 +144,15 @@ export default {
} }
}, },
// '$route': {
// immediate: true, //
// handler(newRoute) {
// // show
// this.HeaderNav = newRoute.name !== 'MobilePage' && !newRoute.path.includes('MobilePage');
// this.currentRoute = newRoute.path; //
// }
// }
// $route(to, from) {
// //
// if (to.path === '/HomePage' && this.shouldRefreshHome) {
// this.activateHomePage(); //
// window.location.reload(); //
// this.shouldRefreshHome = false; //
// } else {
// this.activate(); //
// }
// }
}, },
computed: { computed: {
isHomePage() {
return this.$route.path === '/HomePage';
},
shouldApplyWhite() {
return this.isHomePage && !this.isFixed;
},
navClass() { navClass() {
return { return {
'fixed-nav': this.isFixed || this.$route.path === '/HomePage', 'fixed-nav': this.isFixed || this.$route.path === '/HomePage',
@ -160,7 +162,6 @@ export default {
return { return {
'border-login': this.isFixed, 'border-login': this.isFixed,
'line-height-login': this.isFixed, 'line-height-login': this.isFixed,
}; };
}, },
phoneColor() { phoneColor() {
@ -187,7 +188,7 @@ export default {
border: 0px solid transparent !important ; border: 0px solid transparent !important ;
} }
.border-login { .border-login {
border: .0094rem solid #42210B; border: .0094rem solid #2f3390;
} }
.line-height-login { .line-height-login {
line-height: .3rem; line-height: .3rem;
@ -195,6 +196,7 @@ export default {
.activeHomePage { .activeHomePage {
color: #333; color: #333;
/* color: #FFF; */
} }
.active { .active {
color: #F7931E; color: #F7931E;
@ -219,6 +221,7 @@ export default {
} }
.phoneMessageColor { .phoneMessageColor {
color: #42210B !important; color: #42210B !important;
/* color: #FFF !important; */
} }
.header-nav { .header-nav {
position: absolute; position: absolute;
@ -243,21 +246,15 @@ export default {
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-around; justify-content: space-around;
width: 100%; width: 100%;
/* width: 1500px; */
/* width: 18.75rem; */
height: 1rem; height: 1rem;
margin: 0 auto; margin: 0 auto;
/* border: 1px solid red; */
} }
.header-nav .nav-icon { .header-nav .nav-icon {
/* width: 3.25rem;
height: .575rem; */
width: 1.7875rem; width: 1.7875rem;
height: .575rem; height: .575rem;
margin-left: .625rem; margin-left: .625rem;
margin-top: .2125rem; margin-top: .2125rem;
/* border: 1px solid blue; */
} }
.header-nav .nav { .header-nav .nav {
display: flex; display: flex;
@ -272,31 +269,17 @@ export default {
width: 100%; width: 100%;
} }
.header-nav .nav ul li { .header-nav .nav ul li {
/* margin-right: .25rem;
margin-left: .25rem; */
/* width: 1rem; */
/* padding: 0 0.2rem; */
/* margin: 0 .5rem; */
font-size: .1875rem; font-size: .1875rem;
color: #42210B; /* color: #42210B; */
color: #FFF !important;
text-align: center; text-align: center;
} }
/* .header-nav .nav ul li:first-child {
margin-left: 0.1px;
}
.header-nav .nav ul li:last-child {
margin-right: 0.1px;
} */
.header-nav .nav ul li a { .header-nav .nav ul li a {
width: 1rem; width: 1rem;
} }
/* .header-nav .nav ul li a {
color: #FFF;
font-weight: 400;
} */
.header-nav .nav ul .router-link-active { .header-nav .nav ul .router-link-active {
color: #42210B!; /* color: #42210B!; */
/* color: #FFF; */ color: #48b2e1;
} }
.header-nav .phone { .header-nav .phone {
display: flex; display: flex;
@ -305,14 +288,12 @@ export default {
align-content: center; align-content: center;
width: 2.2rem; width: 2.2rem;
height: 1rem; height: 1rem;
/* background-color: pink; */
} }
.header-nav .phone .phoneBox { .header-nav .phone .phoneBox {
display: flex; display: flex;
justify-content: start; justify-content: start;
width: 2.2rem; width: 2.2rem;
height: 0.6rem; height: 0.6rem;
/* background-color: skyblue; */
} }
.header-nav .phone .phoneBox .leftIcon { .header-nav .phone .phoneBox .leftIcon {
width: 0.6rem; width: 0.6rem;
@ -341,6 +322,7 @@ export default {
margin: auto .125rem auto auto ; margin: auto .125rem auto auto ;
border-radius: .25rem; border-radius: .25rem;
font-size: .175rem; font-size: .175rem;
color: #363994;
background-color: rgba(255,255,255,.4); background-color: rgba(255,255,255,.4);
} }
#register { #register {
@ -351,13 +333,14 @@ export default {
margin: .3375rem .375rem; margin: .3375rem .375rem;
border-radius: .25rem; border-radius: .25rem;
font-size: .175rem; font-size: .175rem;
background-color: #42210B; /* background-color: #42210B; */
background: linear-gradient(to right,#12a1e6,#31dcf9);
color: #FFF; color: #FFF;
} }
#login:hover { #login:hover {
background-color: #42210B; background-color: #FFF;
color: #fff; color: #2f3390;
cursor: pointer; cursor: pointer;
} }
#register:hover { #register:hover {

View File

@ -399,7 +399,7 @@ export default {
width: 100%; width: 100%;
height: 100vh; height: 100vh;
/* background-color: pink; */ /* background-color: pink; */
background: url(/assets/img/home-bj2.png) no-repeat; background: url(/assets/img/home-bj2.jpg) no-repeat;
background-size: cover; background-size: cover;
} }
.home-page .box-top .headline { .home-page .box-top .headline {