Files
sist_web/src/views/index/index.vue
2022-10-04 23:03:23 +08:00

153 lines
3.2 KiB
Vue

<template>
<div>
<el-row>
<el-col>
<Carousel/>
</el-col>
</el-row>
<el-row>
<el-col>
<NewsCenter/>
</el-col>
</el-row>
<el-row>
<el-col>
<Announcements/>
</el-col>
</el-row>
<el-row>
<el-col>
<AcademyAndSciences/>
</el-col>
</el-row>
<el-row>
<el-col>
<UndergraduateAndGraduate/>
</el-col>
</el-row>
<el-row v-if="$i18n.locale === 'cn'">
<el-col>
<PartyBuildingActivities/>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col>-->
<!-- <ResearchTrends/>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-row>-->
<!-- <el-col>-->
<!-- <TeachingStudent/>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row v-show="width>=1100">
<el-col>
<Bottom/>
</el-col>
</el-row>
</div>
</template>
<script>
import NewsCenter from "./components/news_center";
import Carousel from "./components/carousel";
import Announcements from "./components/announcements";
import AcademyAndSciences from "@/views/index/components/academy_and_sciences";
import PartyBuildingActivities from "./components/party_building_activities.vue";
import UndergraduateAndGraduate from "@/views/index/components/undergraduate_and_graduate";
import ResearchTrends from "./components/scientific_research_trends.vue";
import SlideshowCard from "./components/slideshow_card.vue";
import TeachingStudent from "./components/teaching_student.vue";
import Bottom from "./components/bottom.vue";
import {getConfig} from "@/api";
import {setAppLanguage, setLanguage} from "@/utils/sist";
export default {
name: "index",
components: {
UndergraduateAndGraduate,
AcademyAndSciences,
Announcements,
NewsCenter,
PartyBuildingActivities,
ResearchTrends,
SlideshowCard,
TeachingStudent,
Bottom,
Carousel
},
data() {
return {
width: document.documentElement.clientWidth,
imageUrl: null,
iftop: false,
timer: true
};
},
beforeDestroy() { //及时释放
window.removeEventListener("scroll", this.handleScroll);
},
created() {
setLanguage(this);
getConfig("sist_bg").then(res => {
this.imageUrl = res.data;
});
},
mounted() {
window.addEventListener("scroll", this.handleScroll);
const that = this;
window.onresize = () => {
return (() => {
//这里写要操作的函数
window.screenWidth = document.body.clientWidth;
that.width = window.screenWidth > 992;
})();
};
},
methods: {
handleScroll() {
this.iftop = window.pageYOffset > 400;
this.$emit("input", window.pageYOffset);
},
backTop() {
window.scrollTo({top: 0, behavior: "smooth"});
}
}
};
</script>
<style scoped lang="scss">
.bgc {
position: relative;
.top {
img {
width: 100%;
}
}
.next {
//width: 100%;
width: 3.4vw;
left: 50%;
bottom: 2.3vw;
position: absolute;
margin-left: -1.7vw;
cursor: pointer;
img {
width: 100%;
}
}
}
.interval {
margin-top: 5rem;
}
</style>