新增首页页面
BIN
src/assets/images/index/agreement.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
src/assets/images/index/bg.jpg
Normal file
|
After Width: | Height: | Size: 365 KiB |
BIN
src/assets/images/index/prize-btn.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
src/assets/images/index/rule-btn.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
src/assets/images/index/start-btn.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
src/assets/images/index/title.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
src/assets/images/music-off.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/assets/images/music-on.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/assets/images/qa/answer-box-1.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
src/assets/images/qa/answer-box-2.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
src/assets/images/qa/bg.jpg
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
src/assets/images/qa/question.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
@ -4,8 +4,8 @@ import { debounceTap } from "@/plugins";
|
|||||||
|
|
||||||
const emit = defineEmits(["IndexPage"]);
|
const emit = defineEmits(["IndexPage"]);
|
||||||
|
|
||||||
const count = ref(0);
|
|
||||||
const show = (event) => {
|
const start = (event) => {
|
||||||
debounceTap(event.target, () => {
|
debounceTap(event.target, () => {
|
||||||
Toast.success("开发中!");
|
Toast.success("开发中!");
|
||||||
});
|
});
|
||||||
@ -16,7 +16,11 @@ const show = (event) => {
|
|||||||
<div class="IndexPage">
|
<div class="IndexPage">
|
||||||
<div class="index-bg"></div>
|
<div class="index-bg"></div>
|
||||||
<div class="index-container">
|
<div class="index-container">
|
||||||
<Button @click="show">首页</Button>
|
<div class="index-title"></div>
|
||||||
|
<div class="index-rule-btn"></div>
|
||||||
|
<div class="index-prize-btn"></div>
|
||||||
|
<div class="index-start-btn" @click="start"></div>
|
||||||
|
<div class="index-agreement"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -24,14 +28,43 @@ const show = (event) => {
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.IndexPage {
|
.IndexPage {
|
||||||
@include pos(100%, 100vh, 0px, 0px);
|
@include pos(100%, 100vh, 0px, 0px);
|
||||||
background-color: rgb(0, 7, 198);
|
overflow: hidden;
|
||||||
|
|
||||||
.index-bg {
|
.index-bg {
|
||||||
@include pos(750px, 1624px, 0px, 50%);
|
@include pos(750px, 1624px, 0px, 50%);
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
|
@include bg_pos("index/bg.jpg");
|
||||||
}
|
}
|
||||||
|
|
||||||
.index-container {
|
.index-container {
|
||||||
@include pos(750px, 1624px, 0px, 50%);
|
@include pos(750px, 1624px, 0px, 50%);
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
|
|
||||||
|
.index-title {
|
||||||
|
@include pos(552px, 131px, 101px, 331px);
|
||||||
|
@include bg_pos("index/title.png");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-rule-btn {
|
||||||
|
@include pos(101px, 51px, 0px, 474px);
|
||||||
|
@include bg_pos("index/rule-btn.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-prize-btn {
|
||||||
|
@include pos(101px, 51px, 0px, 536px);
|
||||||
|
@include bg_pos("index/prize-btn.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-start-btn {
|
||||||
|
@include pos(278px, 79px, 226px, 1117px);
|
||||||
|
@include bg_pos("index/start-btn.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-agreement {
|
||||||
|
@include pos(736px, 172px, 7px, 1219px);
|
||||||
|
@include bg_pos("index/agreement.png");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,24 +1,3 @@
|
|||||||
<template>
|
|
||||||
<div class="QuestionPage">
|
|
||||||
<div class="question-bg"></div>
|
|
||||||
<div class="question-container">
|
|
||||||
<div class="question-content">
|
|
||||||
<div class="question">{{ currentId + 1 }}.{{ questionList[currentId].question }}</div>
|
|
||||||
<div class="answer-box">
|
|
||||||
<div class="answer" :class="activeId == item.aid ? 'active' : ''"
|
|
||||||
v-for="item in questionList[currentId].answer " @click="answerFn(item, $event)">{{ item.aid }}.{{
|
|
||||||
item.text }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 查看结果 -->
|
|
||||||
<Button v-if="showResultBtn" @click="showResult">查看结果</Button>
|
|
||||||
<!-- 下一页 -->
|
|
||||||
<Button v-show="currentId != 0" @click="prevePage">上一页</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup name="Question">
|
<script setup name="Question">
|
||||||
import { Button, Toast } from 'vant'
|
import { Button, Toast } from 'vant'
|
||||||
import gsap from 'gsap'
|
import gsap from 'gsap'
|
||||||
@ -97,10 +76,29 @@ const prevePage = (event) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="QuestionPage">
|
||||||
|
<div class="question-bg"></div>
|
||||||
|
<div class="question-container">
|
||||||
|
<div class="question-content">
|
||||||
|
<div class="question">{{ currentId + 1 }}.{{ questionList[currentId].question }}</div>
|
||||||
|
<div class="answer-box">
|
||||||
|
<div class="answer" :class="activeId == item.aid ? 'active' : ''"
|
||||||
|
v-for="item in questionList[currentId].answer " @click="answerFn(item, $event)">{{ item.aid }}.{{
|
||||||
|
item.text }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- 查看结果 -->
|
||||||
|
<Button v-if="showResultBtn" @click="showResult">查看结果</Button>
|
||||||
|
<!-- 下一页 -->
|
||||||
|
<Button v-show="currentId != 0" @click="prevePage">上一页</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<style lang='scss' scope>
|
<style lang='scss' scope>
|
||||||
.QuestionPage {
|
.QuestionPage {
|
||||||
@include pos(100%, 100%, 0px, 0px);
|
@include pos(100%, 100%, 0px, 0px);
|
||||||
@ -110,6 +108,8 @@ const prevePage = (event) => {
|
|||||||
.question-bg {
|
.question-bg {
|
||||||
@include pos(750px, 100%, 0px, 50%);
|
@include pos(750px, 100%, 0px, 50%);
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
|
@include bg_pos("qa/bg.jpg");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.question-container {
|
.question-container {
|
||||||
@ -118,7 +118,12 @@ const prevePage = (event) => {
|
|||||||
@include flexCen();
|
@include flexCen();
|
||||||
|
|
||||||
.question-content {
|
.question-content {
|
||||||
width: 80%;
|
@include box(100%, 100%);
|
||||||
|
@include flexCen();
|
||||||
|
|
||||||
|
.question {
|
||||||
|
@include box(713px, 428px);
|
||||||
|
@include bg_pos("qa/question.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
.answer-box {
|
.answer-box {
|
||||||
@ -127,14 +132,7 @@ const prevePage = (event) => {
|
|||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
// width: 80%;
|
// width: 80%;
|
||||||
|
|
||||||
.answer {
|
.answer {}
|
||||||
padding: 10px;
|
|
||||||
border-radius: 50px;
|
|
||||||
background-color: #fff;
|
|
||||||
color: rgb(68, 208, 112);
|
|
||||||
margin-bottom: 20px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.active {
|
.active {
|
||||||
background-color: #ff2020;
|
background-color: #ff2020;
|
||||||
@ -142,5 +140,8 @@ const prevePage = (event) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -11,7 +11,7 @@ import gsap from "gsap";
|
|||||||
import Loading from "@/components/Loading";
|
import Loading from "@/components/Loading";
|
||||||
import Index from "@/components/Index";
|
import Index from "@/components/Index";
|
||||||
import Question from "@/components/Question";
|
import Question from "@/components/Question";
|
||||||
import { bgm } from "@/plugins";
|
import { createBGM } from "@/plugins";
|
||||||
|
|
||||||
const showLoad = ref(false);
|
const showLoad = ref(false);
|
||||||
const loadFn = (item) => {
|
const loadFn = (item) => {
|
||||||
@ -36,7 +36,7 @@ const questionFn = (item) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
bgm();
|
// createBGM();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -48,13 +48,21 @@ onMounted(() => {
|
|||||||
|
|
||||||
#musicBtn {
|
#musicBtn {
|
||||||
@include pos(60px, 60px, 80px, 40px);
|
@include pos(60px, 60px, 80px, 40px);
|
||||||
@include bg_pos("music-icon.png");
|
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 音乐-on样式
|
||||||
|
.music-on {
|
||||||
|
@include bg_pos("music-on.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 音乐-off样式
|
||||||
|
.music-off {
|
||||||
|
@include bg_pos("music-off.png");
|
||||||
|
}
|
||||||
|
|
||||||
.home {
|
.home {
|
||||||
@include box(750px, 100vh);
|
@include box(750px, 100vh);
|
||||||
// position: relative;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ const sound = new Howl({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 背景音乐
|
// 背景音乐
|
||||||
export function bgm(autoPlay) {
|
export function createBGM() {
|
||||||
const musicNode = createVNode(
|
const musicNode = createVNode(
|
||||||
'div',
|
'div',
|
||||||
{
|
{
|
||||||
@ -21,18 +21,23 @@ export function bgm(autoPlay) {
|
|||||||
id: 'musicBtn',
|
id: 'musicBtn',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
let auduoEle = document.querySelector("#audio")
|
let auduoEle = document.querySelector("#audio")
|
||||||
|
let musicBox = document.querySelector("#musicBtn")
|
||||||
if (auduoEle.paused) {
|
if (auduoEle.paused) {
|
||||||
auduoEle.play()
|
auduoEle.play()
|
||||||
audioAni.play()
|
audioAni.play()
|
||||||
|
musicBox.classList.add('music-on')
|
||||||
|
musicBox.classList.remove('music-off')
|
||||||
} else {
|
} else {
|
||||||
|
gsap.set('#musicBtn', { rotation: '0deg' })
|
||||||
auduoEle.pause()
|
auduoEle.pause()
|
||||||
audioAni.pause()
|
audioAni.pause()
|
||||||
|
musicBox.classList.add('music-off')
|
||||||
|
musicBox.classList.remove('music-on')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const audioNode = createVNode(
|
const audioNode = createVNode(
|
||||||
'audio',
|
'audio',
|
||||||
{
|
{
|
||||||
@ -41,12 +46,12 @@ export function bgm(autoPlay) {
|
|||||||
src: new URL(`@/assets/media/bgm.mp3`, import.meta.url).href,
|
src: new URL(`@/assets/media/bgm.mp3`, import.meta.url).href,
|
||||||
autoPlay: true,
|
autoPlay: true,
|
||||||
loop: true,
|
loop: true,
|
||||||
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
render(musicNode, document.body);
|
render(musicNode, document.body);
|
||||||
render(audioNode, document.querySelector("#musicBtn"));
|
render(audioNode, document.querySelector("#musicBtn"));
|
||||||
|
document.querySelector("#musicBtn").classList.add('music-on')
|
||||||
let audioAni = gsap.timeline({ paused: true })
|
let audioAni = gsap.timeline({ paused: true })
|
||||||
audioAni.to('#musicBtn', { duration: 10, rotation: "+=360", repeat: -1, ease: 'none' })
|
audioAni.to('#musicBtn', { duration: 10, rotation: "+=360", repeat: -1, ease: 'none' })
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||