提交 664acb4a authored 作者: JSHorse's avatar JSHorse

修复header优化而影响的其他页面

上级 7de7613c
<template> <template>
<div <div :class="{
:class="{
nav: true, nav: true,
'header-absolute': true, 'header-absolute': isAbsolute,
'header-fixed ': isFixed, 'header-fixed ': isFixed,
// 'header-absolute': isHome || isBoutique, // 'header-absolute': isHome || isBoutique,
//'show-themeColor': isFixed && isHome, //'show-themeColor': isFixed && isHome,
...@@ -12,9 +11,7 @@ ...@@ -12,9 +11,7 @@
isSMGZ: navbarStyle == '5' && isFixed, isSMGZ: navbarStyle == '5' && isFixed,
isJYYCC: navbarStyle == '6' && isFixed, isJYYCC: navbarStyle == '6' && isFixed,
isYLGDYW: navbarStyle == '7' && isFixed, isYLGDYW: navbarStyle == '7' && isFixed,
}" }" id="navbar">
id="navbar"
>
<div class="container"> <div class="container">
<div class="logo-container animate__animated animate__fadeInLeft"> <div class="logo-container animate__animated animate__fadeInLeft">
<img src="@/assets/imgs/home/logo3.png" /> <img src="@/assets/imgs/home/logo3.png" />
...@@ -22,24 +19,12 @@ ...@@ -22,24 +19,12 @@
</div> </div>
<div class="right"> <div class="right">
<div class="tabs animate__animated animate__fadeInUp"> <div class="tabs animate__animated animate__fadeInUp">
<div <div class="tab-item" :class="{
class="tab-item"
:class="{
activeHome: currentTab.name == item.name && isHome, activeHome: currentTab.name == item.name && isHome,
active: currentTab.name == item.name, active: currentTab.name == item.name,
}" }" v-for="(item, index) in pages" :key="index" @click="handleClickTab(item)" @mouseenter="handleEnterTabItem(item)" @mouseleave="handleLeaveTabItem(item)">
v-for="(item, index) in pages"
:key="index"
@click="handleClickTab(item)"
@mouseenter="handleEnterTabItem(item)"
@mouseleave="handleLeaveTabItem(item)"
>
<span @click="handleToPage(item.path)">{{ item.name }} </span> <span @click="handleToPage(item.path)">{{ item.name }} </span>
<i <i v-if="item.name == '陈列展览'" class="el-icon-arrow-down" style="transform: translate(30%, 30%); cursor: pointer"></i>
v-if="item.name == '陈列展览'"
class="el-icon-arrow-down"
style="transform: translate(30%, 30%); cursor: pointer"
></i>
</div> </div>
</div> </div>
<div class="tools animate__animated animate__fadeInRight"> <div class="tools animate__animated animate__fadeInRight">
...@@ -51,19 +36,10 @@ ...@@ -51,19 +36,10 @@
<!-- <i class="el-icon-arrow-down el-icon--right"></i> --> <!-- <i class="el-icon-arrow-down el-icon--right"></i> -->
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item <el-dropdown-item v-if="!hasToken" @click.native="handleToLogin" class="operation-item">登录
v-if="!hasToken"
@click.native="handleToLogin"
class="operation-item"
>登录
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item v-if="hasToken" class="operation-item" @click.native="handleToPersonal">
v-if="hasToken" 个人中心</el-dropdown-item>
class="operation-item"
@click.native="handleToPersonal"
>
个人中心</el-dropdown-item
>
<el-dropdown-item v-if="hasToken" @click.native="handleLogOut"> <el-dropdown-item v-if="hasToken" @click.native="handleLogOut">
<span>退出</span> <span>退出</span>
</el-dropdown-item> </el-dropdown-item>
...@@ -74,23 +50,11 @@ ...@@ -74,23 +50,11 @@
</div> </div>
</div> </div>
<transition name="el-zoom-in-top"> <transition name="el-zoom-in-top">
<div <div class="submenu" v-show="showSubMenu" @mouseenter="handleEnterSubmenu" @mouseleave="handleMouseLeaveSubMenu">
class="submenu"
v-show="showSubMenu"
@mouseenter="handleEnterSubmenu"
@mouseleave="handleMouseLeaveSubMenu"
>
<ul> <ul>
<li <li v-for="(item, index) in typeList" :key="index" @click="handleToPage('/display/', item.value, true)">
v-for="(item, index) in typeList"
:key="index"
@click="handleToPage('/display/', item.value, true)"
>
<span>{{ item.label }}</span> <span>{{ item.label }}</span>
<svg-icon <svg-icon icon-class="wenshi" v-if="index != typeList.length - 1"></svg-icon>
icon-class="wenshi"
v-if="index != typeList.length - 1"
></svg-icon>
</li> </li>
<!-- <li> <!-- <li>
<span @click="handleToPage('/display', true)">基本陈列</span> <span @click="handleToPage('/display', true)">基本陈列</span>
...@@ -104,92 +68,40 @@ ...@@ -104,92 +68,40 @@
</ul> </ul>
</div> </div>
</transition> </transition>
<el-dialog <el-dialog :visible.sync="loginVisible" append-to-body v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.5)" :element-loading-text="loadingText" :before-close="handleCloseLogin">
:visible.sync="loginVisible"
append-to-body
v-loading="loading"
element-loading-background="rgba(0, 0, 0, 0.5)"
:element-loading-text="loadingText"
:before-close="handleCloseLogin"
>
<div slot="title" class="login-title"> <div slot="title" class="login-title">
<div <div :class="['title-item', isLoginByUsername ? 'active' : '']" @click="handleChangeLoginWay('username')">
:class="['title-item', isLoginByUsername ? 'active' : '']"
@click="handleChangeLoginWay('username')"
>
账号登录 账号登录
</div> </div>
<div <div :class="['title-item', isLoginByUsername ? '' : 'active']" @click="handleChangeLoginWay('phone')">
:class="['title-item', isLoginByUsername ? '' : 'active']"
@click="handleChangeLoginWay('phone')"
>
手机号登录 手机号登录
</div> </div>
<div class="line"></div> <div class="line"></div>
</div> </div>
<div class="login"> <div class="login">
<el-form <el-form :model="loginForm" :label-position="labelPosition" ref="loginForm" :rules="loginRules">
:model="loginForm"
:label-position="labelPosition"
ref="loginForm"
:rules="loginRules"
>
<el-form-item :label-width="formLabelWidth" prop="account"> <el-form-item :label-width="formLabelWidth" prop="account">
<el-input <el-input v-model="loginForm.account" autocomplete="off" clearable :placeholder="isLoginByUsername ? '账号' : '手机号'"></el-input>
v-model="loginForm.account"
autocomplete="off"
clearable
:placeholder="isLoginByUsername ? '账号' : '手机号'"
></el-input>
</el-form-item> </el-form-item>
<el-form-item :label-width="formLabelWidth" prop="password"> <el-form-item :label-width="formLabelWidth" prop="password">
<el-input <el-input v-model="loginForm.password" autocomplete="off" type="password" clearable show-password placeholder="密码"></el-input>
v-model="loginForm.password"
autocomplete="off"
type="password"
clearable
show-password
placeholder="密码"
></el-input>
</el-form-item> </el-form-item>
<el-form-item :label-width="formLabelWidth"> <el-form-item :label-width="formLabelWidth">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="captcha"> <el-form-item prop="captcha">
<el-input <el-input ref="captcha" v-model="loginForm.captcha" placeholder="请输入验证码" name="captcha" tabindex="3" auto-complete="on" @keyup.enter.native="handleLoginSubmit" />
ref="captcha"
v-model="loginForm.captcha"
placeholder="请输入验证码"
name="captcha"
tabindex="3"
auto-complete="on"
@keyup.enter.native="handleLoginSubmit"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" class="captcha"> <el-col :span="12" class="captcha">
<img <img v-if="requestCodeSuccess" :src="captchaImgSrc" @click="handleGetCaptcha" />
v-if="requestCodeSuccess" <img v-else src="@/assets/404_images/checkcode.png" @click="handleGetCaptcha" />
:src="captchaImgSrc"
@click="handleGetCaptcha"
/>
<img
v-else
src="@/assets/404_images/checkcode.png"
@click="handleGetCaptcha"
/>
</el-col> </el-col>
</el-row> </el-row>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="opration"> <div class="opration">
<el-button <el-button round @click="handleLoginSubmit" size="small" class="loginBtn">登 陆</el-button>
round
@click="handleLoginSubmit"
size="small"
class="loginBtn"
>登 陆</el-button
>
<div class="register" @click="handleToRegister">注册</div> <div class="register" @click="handleToRegister">注册</div>
</div> </div>
</div> </div>
...@@ -212,7 +124,7 @@ export default { ...@@ -212,7 +124,7 @@ export default {
"showLoginDialog", "showLoginDialog",
"navbarStyle", "navbarStyle",
]), ]),
hasToken() { hasToken () {
return this.token; return this.token;
}, },
}, },
...@@ -261,19 +173,22 @@ export default { ...@@ -261,19 +173,22 @@ export default {
}, },
immediate: true, immediate: true,
}, },
navBarFixed(value) { navBarFixed (value) {
console.log("navBarFixed", value); console.log("navBarFixed", value);
}, },
showLoginDialog(value) { showLoginDialog (value) {
this.loginVisible = value; this.loginVisible = value;
}, },
loginVisible(value) { loginVisible (value) {
if (value) { if (value) {
this.handleGetCaptcha(); this.handleGetCaptcha();
} }
}, },
'$route.path' (cur) {
this.getAbsolute(cur)
}
}, },
data() { data () {
var validateAccout = (rule, value, callback) => { var validateAccout = (rule, value, callback) => {
if (value === "") { if (value === "") {
let text = this.isLoginByUsername ? "账号" : "手机号"; let text = this.isLoginByUsername ? "账号" : "手机号";
...@@ -375,9 +290,10 @@ export default { ...@@ -375,9 +290,10 @@ export default {
value: "", value: "",
}, },
], ],
isAbsolute: true
}; };
}, },
mounted() { mounted () {
window.addEventListener("scroll", this.initHeight); window.addEventListener("scroll", this.initHeight);
this.$nextTick(() => { this.$nextTick(() => {
...@@ -386,9 +302,21 @@ export default { ...@@ -386,9 +302,21 @@ export default {
this.$store.commit("app/SET_NAVBAR_HEIGHT", navBarHeight); this.$store.commit("app/SET_NAVBAR_HEIGHT", navBarHeight);
}); });
this.loadDisplayTypeList(); this.loadDisplayTypeList();
let path = this.$route.path
this.getAbsolute(path)
}, },
methods: { methods: {
initHeight() { getAbsolute (path) {
let arr = path.split('/')
console.log('path', path)
if (path.indexOf('/display') === 0 && arr.length === 4) {
this.isAbsolute = false
} else {
this.isAbsolute = true
}
},
initHeight () {
let scrollTop = let scrollTop =
window.pageYOffset || window.pageYOffset ||
document.documentElement.scrollTop || document.documentElement.scrollTop ||
...@@ -396,20 +324,20 @@ export default { ...@@ -396,20 +324,20 @@ export default {
this.isFixed = scrollTop > this.offsetTop ? true : false; this.isFixed = scrollTop > this.offsetTop ? true : false;
}, },
handleToRegister() { handleToRegister () {
this.$router.push("/register?redirect=" + this.$route.fullPath); this.$router.push("/register?redirect=" + this.$route.fullPath);
this.handleCloseLogin(); this.handleCloseLogin();
}, },
handleToLogin() { handleToLogin () {
this.loginVisible = true; this.loginVisible = true;
}, },
handleToPersonal() { handleToPersonal () {
this.$router.push("/personal"); this.$router.push("/personal");
}, },
async handleLogOut() { async handleLogOut () {
this.$confirm("是否确定退出?", "提示", { this.$confirm("是否确定退出?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
...@@ -428,11 +356,11 @@ export default { ...@@ -428,11 +356,11 @@ export default {
}); });
}, },
handleClickTab(tab) { handleClickTab (tab) {
this.currentTab = tab; this.currentTab = tab;
}, },
handleLoginSubmit() { handleLoginSubmit () {
this.$refs.loginForm.validate((valid) => { this.$refs.loginForm.validate((valid) => {
if (valid) { if (valid) {
// debugger // debugger
...@@ -473,7 +401,7 @@ export default { ...@@ -473,7 +401,7 @@ export default {
}); });
}, },
handleCloseLogin() { handleCloseLogin () {
this.loginVisible = false; this.loginVisible = false;
this.$refs["loginForm"].resetFields; this.$refs["loginForm"].resetFields;
if (this.showLoginDialog) { if (this.showLoginDialog) {
...@@ -481,7 +409,7 @@ export default { ...@@ -481,7 +409,7 @@ export default {
} }
}, },
handleGetCaptcha() { handleGetCaptcha () {
this.currdatetime = new Date().getTime(); this.currdatetime = new Date().getTime();
getVerify() getVerify()
.then((res) => { .then((res) => {
...@@ -494,7 +422,7 @@ export default { ...@@ -494,7 +422,7 @@ export default {
}); });
}, },
handleChangeLoginWay(type) { handleChangeLoginWay (type) {
this.isLoginByUsername = type === "username"; this.isLoginByUsername = type === "username";
let line = document.getElementsByClassName("line")[0]; let line = document.getElementsByClassName("line")[0];
if (this.isLoginByUsername) { if (this.isLoginByUsername) {
...@@ -504,7 +432,7 @@ export default { ...@@ -504,7 +432,7 @@ export default {
} }
}, },
handleToPage(path, type, isOpenNewPage) { handleToPage (path, type, isOpenNewPage) {
if (path) { if (path) {
if (isOpenNewPage) { if (isOpenNewPage) {
const newPage = this.$router.resolve({ const newPage = this.$router.resolve({
...@@ -520,40 +448,41 @@ export default { ...@@ -520,40 +448,41 @@ export default {
} }
}, },
handleEnterTabItem(item) { handleEnterTabItem (item) {
if (item.name == "陈列展览") { if (item.name == "陈列展览") {
this.showSubMenu = true; this.showSubMenu = true;
} }
}, },
handleLeaveTabItem(item) { handleLeaveTabItem (item) {
if (item.name == "陈列展览" && this.showSubMenu) { if (item.name == "陈列展览" && this.showSubMenu) {
this.showSubMenu = false; this.showSubMenu = false;
} }
}, },
handleEnterSubmenu() { handleEnterSubmenu () {
if (!this.showSubMenu) { if (!this.showSubMenu) {
this.showSubMenu = true; this.showSubMenu = true;
} }
}, },
handleMouseLeaveSubMenu() { handleMouseLeaveSubMenu () {
if (this.showSubMenu) { if (this.showSubMenu) {
this.showSubMenu = false; this.showSubMenu = false;
} }
}, },
async loadDisplayTypeList() { async loadDisplayTypeList () {
let res = await getDisplayExistDict(); let res = await getDisplayExistDict();
// debugger // debugger
this.typeList = [...this.typeList, ...res.data.typeList]; this.typeList = [...this.typeList, ...res.data.typeList];
}, },
}, },
destroyed() { destroyed () {
window.removeEventListener("scroll", this.initHeight); window.removeEventListener("scroll", this.initHeight);
}, },
}; };
</script> </script>
...@@ -608,8 +537,8 @@ export default { ...@@ -608,8 +537,8 @@ export default {
height: 120px; height: 120px;
width: 100%; width: 100%;
transition: all 0.5s ease; transition: all 0.5s ease;
// background-color: rgba($themeColor, 0.5); background-color: $themeColor;
background-color: rgba(0, 0, 0, 0.3); // background-color: rgba(0, 0, 0, 0.3);
position: relative; position: relative;
z-index: 99; z-index: 99;
// background-color: #fff; // background-color: #fff;
...@@ -639,7 +568,7 @@ export default { ...@@ -639,7 +568,7 @@ export default {
.name { .name {
font-size: 30px; font-size: 30px;
font-weight: bold; font-weight: bold;
font-family: "SourceHanSerifCN-Bold"; font-family: 'SourceHanSerifCN-Bold';
color: #fff; color: #fff;
margin-left: 8px; margin-left: 8px;
} }
...@@ -662,14 +591,14 @@ export default { ...@@ -662,14 +591,14 @@ export default {
color: #fff; color: #fff;
display: flex; display: flex;
align-items: center; align-items: center;
font-family: "Alibaba-PuHuiTi"; font-family: 'Alibaba-PuHuiTi';
position: relative; position: relative;
height: 100%; height: 100%;
text-align: center; text-align: center;
&::after { &::after {
position: absolute; position: absolute;
content: ""; content: '';
left: 50%; left: 50%;
bottom: 0; bottom: 0;
transform: translateX(-50%); transform: translateX(-50%);
......
...@@ -1279,7 +1279,7 @@ export default { ...@@ -1279,7 +1279,7 @@ export default {
height: 900px; height: 900px;
.vr-content { .vr-content {
width: 100%; width: 100%;
height: 100%; // height: 100%;
position: absolute; position: absolute;
// top: -100px; // top: -100px;
background-repeat: no-repeat; background-repeat: no-repeat;
......
...@@ -63,5 +63,11 @@ export default { ...@@ -63,5 +63,11 @@ export default {
}; };
</script> </script>
<style> <style lang="scss" scoped>
.botique {
margin-bottom: -$nav-height;
> div {
transform: translateY(-$nav-height);
}
}
</style> </style>
\ No newline at end of file
...@@ -711,7 +711,7 @@ ...@@ -711,7 +711,7 @@
.isFixed { .isFixed {
position: fixed; position: fixed;
left: 0; left: 0;
top: 100px; top: $nav-height;
z-index: 99; z-index: 99;
} }
/**公共样式结束 */ /**公共样式结束 */
......
...@@ -737,7 +737,7 @@ $titleFontFamily: SourceHanSerifCN-Bold; ...@@ -737,7 +737,7 @@ $titleFontFamily: SourceHanSerifCN-Bold;
.isFixed { .isFixed {
position: fixed; position: fixed;
left: 0; left: 0;
top: 100px; top: $nav-height;
z-index: 99; z-index: 99;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论