提交 9f41a999 authored 作者: Anix's avatar Anix

Merge branch 'master' of https://gitee.com/gzcnki/exhibition_page

差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
This image diff could not be displayed because it is too large. You can view the blob instead.
This image diff could not be displayed because it is too large. You can view the blob instead.
This image diff could not be displayed because it is too large. You can view the blob instead.
This image diff could not be displayed because it is too large. You can view the blob instead.
This image diff could not be displayed because it is too large. You can view the blob instead.
This image diff could not be displayed because it is too large. You can view the blob instead.
This image diff could not be displayed because it is too large. You can view the blob instead.
差异被折叠。
差异被折叠。
差异被折叠。
...@@ -298,8 +298,11 @@ export default { ...@@ -298,8 +298,11 @@ export default {
}, },
mounted() { mounted() {
window.addEventListener("scroll", this.initHeight); window.addEventListener("scroll", this.initHeight);
this.$nextTick(() => { this.$nextTick(() => {
this.offsetTop = document.querySelector("#navbar").offsetTop; this.offsetTop = document.querySelector("#navbar").offsetTop;
let navBarHeight =document.querySelector("#navbar").offsetHeight
this.$store.commit('app/SET_NAVBAR_HEIGHT',navBarHeight)
}); });
}, },
methods: { methods: {
......
...@@ -11,6 +11,7 @@ const getters = { ...@@ -11,6 +11,7 @@ const getters = {
curPath: state => state.app.curPath, curPath: state => state.app.curPath,
navBarFixed: state => state.app.navBarFixed, navBarFixed: state => state.app.navBarFixed,
showLoginDialog: state => state.app.showLoginDialog, showLoginDialog: state => state.app.showLoginDialog,
navbarStyle: state => state.app.navbarStyle navbarStyle: state => state.app.navbarStyle,
navbarHeight: state => state.app.navbarHeight
} }
export default getters export default getters
...@@ -3,6 +3,7 @@ const getDefaultState = () => { ...@@ -3,6 +3,7 @@ const getDefaultState = () => {
curPath: null, curPath: null,
navBarFixed: false, navBarFixed: false,
showLoginDialog: null, showLoginDialog: null,
navbarHeight:null,
navbarStyle: '1',//1-默认蓝色;2-中国风;3-红色 navbarStyle: '1',//1-默认蓝色;2-中国风;3-红色
} }
} }
...@@ -25,6 +26,9 @@ const mutations = { ...@@ -25,6 +26,9 @@ const mutations = {
CHANGE_NAV_COLOR: (state, themeStyle) => { CHANGE_NAV_COLOR: (state, themeStyle) => {
state.navbarStyle = themeStyle state.navbarStyle = themeStyle
}, },
SET_NAVBAR_HEIGHT: (state, navbarHeight) => {
state.navbarHeight = navbarHeight
}
} }
export default { export default {
......
差异被折叠。
<template> <template>
<div class="boutique"> <div class="boutique">
<!-- <NavBar /> -->
<!-- <h1>精品展</h1> -->
<!-- <Footer /> -->
<div class="boutique-header"> <div class="boutique-header">
<img src="@/assets/imgs/boutique/banner.jpg" width="100%" /> <img src="@/assets/imgs/boutique/banner.jpg" width="100%" />
<!-- <div class="boutique-title">
<p>多彩贵州 &nbsp;博物盛筵</p>
<span>—— 精品展</span>
</div> -->
<ul class="tabs"> <ul class="tabs">
<li v-for="node in tabs" :key="node.tab" @click="handleTabClick(node)"> <li v-for="node in tabs" :key="node.tab" @click="handleTabClick(node)">
<div :class="{ active: activeTab === node.tab }"> <div :class="{ active: activeTab === node.tab }">
...@@ -19,10 +11,16 @@ ...@@ -19,10 +11,16 @@
</ul> </ul>
</div> </div>
<div class="boutique-content"> <div class="boutique-content" ref="boutiqueContent">
<div class="focus-content"> <div class="focus-content" v-if="activeTab">
<!-- <p>{{ content.title }}</p> --> <p
<div class="img-container"> v-if="activeTab == 'cjm'"
style="display: flex; justify-content: center"
>
长角苗民俗及文化遗产
</p>
<SMGZ v-else-if="activeTab == 'smgz'" />
<div v-else class="img-container">
<img <img
:src="require(`@/assets/imgs/boutique/${activeTab}.jpg`)" :src="require(`@/assets/imgs/boutique/${activeTab}.jpg`)"
alt="" alt=""
...@@ -36,9 +34,12 @@ ...@@ -36,9 +34,12 @@
<script> <script>
import NavBar from "@/components/NavBar"; import NavBar from "@/components/NavBar";
import Footer from "@/components/Footer"; import Footer from "@/components/Footer";
import SMGZ from "./components/SMGZ";
import { mapGetters } from "vuex";
export default { export default {
name: "Boutique", name: "Boutique",
components: { NavBar, Footer }, components: { NavBar, Footer, SMGZ},
data() { data() {
return { return {
tabs: [ tabs: [
...@@ -46,13 +47,15 @@ export default { ...@@ -46,13 +47,15 @@ export default {
{ tab: "smgz", name: "神秘贵州" }, { tab: "smgz", name: "神秘贵州" },
{ tab: "jyycc", name: "技艺与传承" }, { tab: "jyycc", name: "技艺与传承" },
{ tab: "ylgdyw", name: "夜郎国的疑问" }, { tab: "ylgdyw", name: "夜郎国的疑问" },
// { tab: "xxx", name: "生态博物馆" }, { tab: "cjm", name: "长角苗民俗及文化遗产" },
], ],
activeTab: "", activeTab: "",
// content: { title: "四渡赤水" } // content: { title: "四渡赤水" }
}; };
}, },
computed: { computed: {
...mapGetters(["navbarHeight"]),
content() { content() {
let obj = Object.create(null); let obj = Object.create(null);
...@@ -68,6 +71,9 @@ export default { ...@@ -68,6 +71,9 @@ export default {
activeTab: { activeTab: {
handler: function (value) { handler: function (value) {
let color = ""; let color = "";
if (!value) {
return;
}
switch (value) { switch (value) {
case "sdcs": case "sdcs":
color = "4"; color = "4";
...@@ -81,18 +87,26 @@ export default { ...@@ -81,18 +87,26 @@ export default {
case "ylgdyw": case "ylgdyw":
color = "7"; color = "7";
break; break;
case "cjm":
color = "1";
} }
this.$store.commit("app/CHANGE_NAV_COLOR", color); this.$store.commit("app/CHANGE_NAV_COLOR", color);
}, },
immediate: true, immediate: true,
}, },
}, },
mounted(){ mounted() {
this.activeTab ='sdcs' this.activeTab = "sdcs";
}, },
methods: { methods: {
handleTabClick(data) { handleTabClick(data) {
this.activeTab = data.tab; this.activeTab = data.tab;
let el = document.getElementsByClassName("boutique-header")[0];
let height = el.offsetHeight - this.navbarHeight ; //5像素偏移量
document.documentElement.scroll({
top: height,
behavior: "smooth", // 平滑移动
});
}, },
}, },
}; };
...@@ -100,24 +114,13 @@ export default { ...@@ -100,24 +114,13 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.boutique { .boutique {
// display: flex;
// justify-content: center;
// height: 100vh;
// align-items: center;
// background-color: #2069c4;
min-height: calc(100% - 300px); min-height: calc(100% - 300px);
.boutique-header { .boutique-header {
position: relative; position: relative;
// height: 620px;
overflow: hidden; overflow: hidden;
> img { > img {
height: 500px; height: 500px;
object-fit: cover; object-fit: cover;
// position: absolute;
// width: 100%;
// left: 0;
// top: 0;
// z-index: 0;
} }
} }
.boutique-title { .boutique-title {
...@@ -203,17 +206,17 @@ export default { ...@@ -203,17 +206,17 @@ export default {
} }
.boutique-content { .boutique-content {
.focus-content { .focus-content {
padding: 20px; // padding: 20px 0;
margin: 20px; // margin: 20px;
box-shadow: 1px 12px 10px 1px #ddd; box-shadow: 1px 12px 10px 1px #ddd;
margin-top: 0; margin-top: 0;
min-height: 600px; min-height: 600px;
display: flex; // display: flex;
justify-content: center; // justify-content: center;
align-items: center; // align-items: center;
font-size: 30px; font-size: 30px;
font-weight: 600; font-weight: 600;
background: rgb(239 247 255); // background: rgb(239 247 255);
> p { > p {
margin: 0; margin: 0;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论