|
@@ -1,15 +1,15 @@
|
|
<template>
|
|
<template>
|
|
<div class="index">
|
|
<div class="index">
|
|
- <Preface />
|
|
|
|
- <Chapter1 />
|
|
|
|
- <Chapter2 />
|
|
|
|
- <Chapter3 />
|
|
|
|
- <Chapter4 />
|
|
|
|
- <Epilogue />
|
|
|
|
|
|
+ <Preface :style="{ height: heightList[0] + 'px' }" />
|
|
|
|
+ <Chapter1 :style="{ height: heightList[1] + 'px' }" />
|
|
|
|
+ <Chapter2 :style="{ height: heightList[2] + 'px' }" />
|
|
|
|
+ <Chapter3 :style="{ height: heightList[3] + 'px' }" />
|
|
|
|
+ <Chapter4 :style="{ height: heightList[4] + 'px' }" />
|
|
|
|
+ <Epilogue :style="{ height: heightList[5] + 'px' }" />
|
|
|
|
|
|
<div class="index-footer">
|
|
<div class="index-footer">
|
|
<span class="index__tips"
|
|
<span class="index__tips"
|
|
- >动植物图片来自江苏省泗洪洪泽湖湿地国家级自然保护区管理处</span
|
|
|
|
|
|
+ >动植物图片由江苏省泗洪洪泽湖湿地国家级自然保护区管理处提供</span
|
|
>
|
|
>
|
|
<img class="index__logo" src="@/assets/images/logo2-min.png" />
|
|
<img class="index__logo" src="@/assets/images/logo2-min.png" />
|
|
</div>
|
|
</div>
|
|
@@ -17,9 +17,9 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-// import { ref, onMounted, nextTick } from "vue";
|
|
|
|
-// import { useRoute } from "vue-router";
|
|
|
|
-// import { useMobile } from "@/utils";
|
|
|
|
|
|
+import { ref, onMounted, nextTick } from "vue";
|
|
|
|
+import { useRoute } from "vue-router";
|
|
|
|
+import { useMobile } from "@/utils";
|
|
import Preface from "./components/Preface/index.vue";
|
|
import Preface from "./components/Preface/index.vue";
|
|
import Chapter1 from "./components/Chapter1/index.vue";
|
|
import Chapter1 from "./components/Chapter1/index.vue";
|
|
import Chapter2 from "./components/Chapter2/index.vue";
|
|
import Chapter2 from "./components/Chapter2/index.vue";
|
|
@@ -27,42 +27,50 @@ import Chapter3 from "./components/Chapter3/index.vue";
|
|
import Chapter4 from "./components/Chapter4/index.vue";
|
|
import Chapter4 from "./components/Chapter4/index.vue";
|
|
import Epilogue from "./components/Epilogue/index.vue";
|
|
import Epilogue from "./components/Epilogue/index.vue";
|
|
|
|
|
|
-// const route = useRoute();
|
|
|
|
-// const { isMobile } = useMobile();
|
|
|
|
|
|
+const route = useRoute();
|
|
|
|
+const { isMobile } = useMobile();
|
|
|
|
|
|
-// const BG_HEIGHT = [2743, 3082, 4937, 3417, 2218, 1409];
|
|
|
|
-// const MOBILE_BG_HEIGHT = [2118, 1467, 2550, 1868, 1303, 663];
|
|
|
|
-// const heightList = ref([]);
|
|
|
|
|
|
+const BG_HEIGHT = [2743, 3082, 4937, 3417, 2218, 1409];
|
|
|
|
+const MOBILE_BG_HEIGHT = [2118, 1467, 2550, 1868, 1303, 663];
|
|
|
|
+const heightList = ref([]);
|
|
|
|
|
|
-// onMounted(() => {
|
|
|
|
-// const height = [];
|
|
|
|
|
|
+onMounted(() => {
|
|
|
|
+ const height = [];
|
|
|
|
|
|
-// (isMobile.value ? MOBILE_BG_HEIGHT : BG_HEIGHT).forEach((h) =>
|
|
|
|
-// height.push(
|
|
|
|
-// (Math.round((h / (isMobile.value ? 750 : 1920)) * 1000) / 1000) *
|
|
|
|
-// document.documentElement.clientWidth
|
|
|
|
-// )
|
|
|
|
-// );
|
|
|
|
|
|
+ (isMobile.value ? MOBILE_BG_HEIGHT : BG_HEIGHT).forEach((h) =>
|
|
|
|
+ height.push(
|
|
|
|
+ (Math.round((h / (isMobile.value ? 750 : 1920)) * 1000) / 1000) *
|
|
|
|
+ document.documentElement.clientWidth
|
|
|
|
+ )
|
|
|
|
+ );
|
|
|
|
|
|
-// heightList.value = height;
|
|
|
|
|
|
+ heightList.value = height;
|
|
|
|
|
|
-// if (route.query.index) {
|
|
|
|
-// let top = 0;
|
|
|
|
-// let i = Number(route.query.index);
|
|
|
|
|
|
+ if (route.query.index) {
|
|
|
|
+ let top = 0;
|
|
|
|
+ let i = Number(route.query.index);
|
|
|
|
|
|
-// while (i > 0) {
|
|
|
|
-// i--;
|
|
|
|
-// top += height[i];
|
|
|
|
-// }
|
|
|
|
|
|
+ if (i === 1) {
|
|
|
|
+ window.scrollTo({
|
|
|
|
+ top: 0,
|
|
|
|
+ behavior: "smooth",
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ while (i > 0) {
|
|
|
|
+ i--;
|
|
|
|
+ top += height[i];
|
|
|
|
+ }
|
|
|
|
|
|
-// nextTick(() => {
|
|
|
|
-// window.scrollTo({
|
|
|
|
-// top,
|
|
|
|
-// behavior: "smooth",
|
|
|
|
-// });
|
|
|
|
-// });
|
|
|
|
-// }
|
|
|
|
-// });
|
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ window.scrollTo({
|
|
|
|
+ top,
|
|
|
|
+ behavior: "smooth",
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+});
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|