This commit is contained in:
clay
2022-05-06 17:43:19 +08:00
parent fdca595a49
commit 6276d6c528
2 changed files with 50 additions and 72 deletions

View File

@@ -28,18 +28,6 @@ export default {
} }
}, },
mounted() { mounted() {
//this.screenWeight = document.documentElement.clientWidth;
//this.screenHeight = document.documentElement.clientHeight;
//this.main = document.getElementById("main");
//this.page2 = document.getElementById("page2");
//this.obj = document.getElementsByTagName("div");
//for (let i = 0; i < this.obj.length; i++) {
// if (this.obj[i].className == 'page') {
// this.obj[i].style.height = this.screenHeight + "px";
// }
//}
//this.pageNum = document.querySelectorAll(".page").length;
// 浏览器兼容 // 浏览器兼容
if ((navigator.userAgent.toLowerCase().indexOf("firefox") != -1)) { if ((navigator.userAgent.toLowerCase().indexOf("firefox") != -1)) {
document.addEventListener("DOMMouseScroll", this.scrollFun, false); document.addEventListener("DOMMouseScroll", this.scrollFun, false);
@@ -77,16 +65,12 @@ export default {
// // 向下滚动 // // 向下滚动
// this.index = 2; // this.index = 2;
// this.toPage(this.index); // this.toPage(this.index);
window.scrollTo({top: window.innerHeight+20, behavior: 'smooth',}) console.log(window.innerHeight + 20);
console.log(window.innerWidth/2)
window.scrollTo({top: window.innerWidth/2, behavior: 'smooth',})
} else if (delta < 0 && window.pageYOffset <= window.innerHeight+200) { } else if (delta < 0 && window.pageYOffset <= window.innerHeight+200) {
// // 向上滚动 // // 向上滚动
//
//
//
//
window.scrollTo({top: 0, behavior: 'smooth',}) window.scrollTo({top: 0, behavior: 'smooth',})
// this.index = 1;
// this.toPage(this.index);
} }
// // 本次翻页结束,记录结束时间,用于下次判断 // // 本次翻页结束,记录结束时间,用于下次判断
this.endTime = new Date().getTime(); this.endTime = new Date().getTime();

View File

@@ -15,6 +15,7 @@
</el-row> </el-row>
<div style="background-color:#F8F8F8 ; padding-bottom: 19rem"> <div style="background-color:#F8F8F8 ; padding-bottom: 19rem">
<!--有三级菜单-->
<el-row v-show="showSecond"> <el-row v-show="showSecond">
<el-col v-if="$i18n.locale === 'cn'" :xs="2" :sm="2" :md="1.5" :lg="2" :xl="4"> <el-col v-if="$i18n.locale === 'cn'" :xs="2" :sm="2" :md="1.5" :lg="2" :xl="4">
@@ -76,21 +77,23 @@
</el-col> </el-col>
<el-col v-if="$i18n.locale === 'cn'" :xs="20" :sm="20" :md="15" :lg="14" :xl="12"> <!--<el-col v-if="$i18n.locale === 'cn'" :xs="20" :sm="20" :md="15" :lg="14" :xl="12">-->
<el-col :xs="20" :sm="20" :md="15" :lg="14" :xl="12">
<el-row> <el-row>
<el-col> <el-col>
<div class="tab"> <div class="tab">
<router-link to="/home">{{ $t('message.home') }}</router-link> <router-link to="/home">{{ $t('message.home') }}</router-link>
<span> > </span> <span> > </span>
<router-link to=""> <!--<span style="color: #1956BC;font-size: 1.4rem">-->
<!--<router-link to="">-->
<span v-if="$i18n.locale === 'cn'">{{ crumbs.one.title }}</span> <span v-if="$i18n.locale === 'cn'">{{ crumbs.one.title }}</span>
<span v-if="$i18n.locale === 'en'">{{ crumbs.one.englishTitle }}</span> <span v-if="$i18n.locale === 'en'">{{ crumbs.one.englishTitle }}</span>
</router-link> <!--</router-link>-->
<!--</span>-->
<span> > </span> <span> > </span>
<span style="color: #1956BC;font-size: 1.4rem"> <span style="color: #1956BC;font-size: 1.4rem">
<span v-if="$i18n.locale === 'cn'">{{ crumbs.two.title }}</span> <span v-if="$i18n.locale === 'cn'">{{ crumbs.two.title }}</span>
<span v-if="$i18n.locale === 'en'">{{ crumbs.two.englishTitle }}</span> <span v-if="$i18n.locale === 'en'">{{ crumbs.two.englishTitle }}</span>
<!--{{ crumbs.two.title }}-->
</span> </span>
</div> </div>
</el-col> </el-col>
@@ -105,45 +108,8 @@
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
<el-col v-if="$i18n.locale === 'en'" :xs="20" :sm="20" :md="15" :lg="14" :xl="13">
<el-row>
<el-col>
<div class="tab">
<router-link to="/home">{{ $t('message.home') }}</router-link>
<span> > </span>
<router-link to="">
<span v-if="$i18n.locale === 'cn'">{{ crumbs.one.title }}</span>
<span v-if="$i18n.locale === 'en'">{{ crumbs.one.englishTitle }}</span>
</router-link>
<span> > </span>
<span style="color: #1956BC;font-size: 1.4rem">
<span v-if="$i18n.locale === 'cn'">{{ crumbs.two.title }}</span>
<span v-if="$i18n.locale === 'en'">{{ crumbs.two.englishTitle }}</span>
<!--{{ crumbs.two.title }}-->
</span>
</div>
</el-col>
</el-row>
<el-row>
<el-col>
<Introduction :value="contextData" v-if="type == 1"/>
<List :value="contextData" v-if="type == 2"/>
<FileList :value="contextData" v-if="type == 4"/>
<DireData :value="contextData" v-if="type == 3"/>
<Details :value="detailsData" v-if="type == null"/>
</el-col>
</el-row>
</el-col>
<!--<el-col :xs="2" :sm="2" :md="1.5" :lg="2" :xl="4">-->
<!-- <div class="grid-content"></div>-->
<!--</el-col>-->
</el-row> </el-row>
<!--无三级菜单-->
<el-row v-show="!showSecond"> <el-row v-show="!showSecond">
<el-col :xs="2" :sm="2" :md="2" :lg="4" :xl="5"> <el-col :xs="2" :sm="2" :md="2" :lg="4" :xl="5">
<div class="grid-content"></div> <div class="grid-content"></div>
@@ -154,16 +120,16 @@
<div class="tab"> <div class="tab">
<router-link to="/">{{ $t('message.home') }}</router-link> <router-link to="/">{{ $t('message.home') }}</router-link>
<span> > </span> <span> > </span>
<router-link to=""> <span style="color: #1956BC;font-size: 1.4rem">
<!--<router-link to="">-->
<span v-if="$i18n.locale === 'cn'">{{ crumbs.one.title }}</span> <span v-if="$i18n.locale === 'cn'">{{ crumbs.one.title }}</span>
<span v-if="$i18n.locale === 'en'">{{ crumbs.one.englishTitle }}</span> <span v-if="$i18n.locale === 'en'">{{ crumbs.one.englishTitle }}</span>
</router-link> <!--</router-link>-->
<span> > </span>
<span style="color: #1956BC;font-size: 1.4rem">
<span v-if="$i18n.locale === 'cn'">{{ crumbs.two.title }}</span>
<span v-if="$i18n.locale === 'en'">{{ crumbs.two.englishTitle }}</span>
<!--{{ crumbs.two.title }}-->
</span> </span>
<!--<span> > </span>-->
<!-- <span v-if="$i18n.locale === 'cn'">{{ crumbs.two.title }}</span>-->
<!-- <span v-if="$i18n.locale === 'en'">{{ crumbs.two.englishTitle }}</span>-->
<!-- &lt;!&ndash;{{ crumbs.two.title }}&ndash;&gt;-->
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@@ -215,7 +181,8 @@ export default {
showSecond: true, showSecond: true,
contextData: {}, contextData: {},
type: 2, type: 2,
bgImage: null, crumbs: { bgImage: null,
crumbs: {
"two": { "two": {
"title": "学院领导", "title": "学院领导",
}, },
@@ -234,6 +201,7 @@ export default {
this.type = this.$route.query && this.$route.query.type this.type = this.$route.query && this.$route.query.type
if (this.type == 3 || this.type == 1 || this.type == 2) { if (this.type == 3 || this.type == 1 || this.type == 2) {
this.secondId = id this.secondId = id
this.getCrumbs();
this.showSecond = false this.showSecond = false
let info = getParentNode(this.secondId); let info = getParentNode(this.secondId);
console.log("获取到info", info) console.log("获取到info", info)
@@ -276,18 +244,32 @@ export default {
this.getNav() this.getNav()
}, 200); }, 200);
//this.getNav() //this.getNav()
crumbs(this.secondId).then(res => { this.getCrumbs();
this.crumbs = res.data
})
}, },
methods: { methods: {
/**
* 获得面包屑导航
*/
getCrumbs(){
crumbs(this.secondId).then(res => {
this.crumbs = res.data
})
},
/**
* 获得内容
* @param arcId
*/
getContext(arcId) { getContext(arcId) {
article(arcId).then(res => { article(arcId).then(res => {
this.detailsData = res.data.data this.detailsData = res.data.data
this.type = null this.type = null
}) })
}, },
/**
* 获得菜单下的信息
*/
getNav() { getNav() {
this.getCrumbs();
if (this.type == 3 || this.type == 1 || this.type == 2) { if (this.type == 3 || this.type == 1 || this.type == 2) {
console.log("进入二级") console.log("进入二级")
this.showSecond = false this.showSecond = false
@@ -312,6 +294,9 @@ export default {
this.getNodes() this.getNodes()
}, },
/**
* 获得节点信息
*/
getNodes() { getNodes() {
this.navList = [] this.navList = []
getNode({id: this.secondId}).then(res => { getNode({id: this.secondId}).then(res => {
@@ -340,6 +325,10 @@ export default {
} }
}) })
}, },
/**
* 获取三级菜单
* @param menu
*/
getContent(menu) { getContent(menu) {
console.log("getContent内部,menu:", menu) console.log("getContent内部,menu:", menu)
this.type = menu.type this.type = menu.type
@@ -375,6 +364,11 @@ export default {
} }
}) })
}, },
/**
* 菜单点击,路由切换
* @param nav
* @param index
*/
navClick(nav, index) { navClick(nav, index) {
//if (index != this.showIndex) { //if (index != this.showIndex) {
this.showIndex = index this.showIndex = index