CounterFireGames/src/views/AboutView.vue
2023-11-21 13:13:46 +08:00

180 lines
4.4 KiB
Vue

<template>
<div class="map-container">
<swiper
:direction="'vertical'"
:slidesPerView="1"
:mousewheel="true"
:speed="400"
:pagination="{
clickable: true,
}"
:modules="modules"
class="mySwiper"
@swiper="onSwiper"
>
<swiper-slide><IntroductionBanner></IntroductionBanner></swiper-slide>
<swiper-slide><TeamVision></TeamVision></swiper-slide>
<swiper-slide><Roadmap></Roadmap></swiper-slide>
<swiper-slide> <LatestNew></LatestNew></swiper-slide>
<swiper-slide> <AboutFooter @goToSlide="goToSlide"></AboutFooter></swiper-slide>
</swiper>
<div class="please" v-if="!isLandscape && isMobileDevice">
<div class="content">
<div class="logo">
<img src="../assets/img/planet/planetGuide_logo.png" alt="" />
</div>
<div>
<div class="phone-logo">
<img src="../assets/img/planet/planetGuide_phoneIcon.png" alt="" />
</div>
<div class="please-text">
Please rotate to horizontal to experience COUNTER FIRE
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
// 引入想要效果模块
import { ref, reactive, onMounted, onUnmounted } from "vue";
import IntroductionBanner from "../components/about/IntroductionBanner.vue";
import TeamVision from "../components/about/TeamVision.vue";
import Roadmap from "../components/about/Roadmap.vue";
import LatestNew from "../components/about/LatestNew.vue";
import AboutFooter from "../components/about/AboutFooter.vue";
import { Swiper, SwiperSlide } from "swiper/vue";
import { Pagination, Navigation, Mousewheel } from "swiper/modules";
// 引入样式
import "swiper/css";
import "swiper/css/autoplay";
import "swiper/css/effect-fade";
const modules = [Mousewheel];
// 嫌麻烦,直接引入了所有 Swiper 样式,包括所有模块样式
// import 'swiper/css/bundle'
const onSlideChange = () => {};
const isLandscape = ref(false);
const swiperInstance = ref();
// 检测是否为移动设备
const isMobileDevice =
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
);
// 更新横屏或竖屏状态
const updateOrientation = () => {
const orientation = window.orientation;
isLandscape.value = orientation === 90 || orientation === -90;
};
function goToSlide(position) {
if (swiperInstance.value) {
swiperInstance.value.slideTo(position);
}
}
function onSwiper(swiper) {
swiperInstance.value = swiper;
}
onMounted(() => {
if (isMobileDevice) {
// 如果是移动设备,则添加事件监听器
window.addEventListener("orientationchange", updateOrientation);
// 初始化时进行一次检测
updateOrientation();
}
console.log(isLandscape.value, "-=-=-");
});
onUnmounted(() => {
if (isMobileDevice) {
// 如果是移动设备,则移除事件监听器
window.removeEventListener("orientationchange", updateOrientation);
}
});
</script>
<style lang="scss" scoped>
.map-container {
width: 100%;
height: 100%;
overflow: hidden;
background-color: black;
.please {
position: fixed;
z-index: 8888;
background-color: black;
left: 0;
bottom: 0;
top: 0;
width: 100%;
height: 100vh;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
background: url("../assets/img/planet/planetGuide-bg.png") no-repeat;
background-size: 100% 100%;
.content {
display: flex;
flex-direction: column;
height: 60vh;
justify-content: space-between;
align-items: center;
}
.logo {
width: 853px;
height: 248px;
img {
width: 100%;
}
}
.phone-logo {
width: 226px;
height: 226px;
margin: 0 auto;
img {
width: 100%;
}
}
.please-text {
font-size: 22px;
width: 80%;
font-family: "Poppins";
font-weight: 400;
margin: 0 auto;
margin-top: 80px;
text-align: center;
color: #d8d8d8;
}
}
.swiper {
width: 100%;
height: 100%;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
/* Center slide text vertically */
display: flex;
justify-content: center;
align-items: center;
}
.swiper-slide img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
}
</style>