|
@@ -2,9 +2,18 @@
|
|
|
<div
|
|
|
class="learn-comp"
|
|
|
>
|
|
|
+ <Teleport
|
|
|
+ to="body"
|
|
|
+ >
|
|
|
+ <transition name="fade-in-out">
|
|
|
+ <GameRule
|
|
|
+ v-if="!hasPlayedGameRule && isShowMask"
|
|
|
+ />
|
|
|
+ </transition>
|
|
|
+ </Teleport>
|
|
|
<video
|
|
|
- src=""
|
|
|
- autoplay
|
|
|
+ ref="video"
|
|
|
+ :src="($route.query.sceneIdxLevel2 === '1' && $route.query.sceneIdxLevel3 === '0') ? require(`@/assets/videos/learn-${$route.query.sceneIdxLevel2}-${$route.query.sceneIdxLevel3}.mp4`) : ``"
|
|
|
controls
|
|
|
:style="{
|
|
|
left: videoLeft + 'px',
|
|
@@ -18,9 +27,13 @@
|
|
|
|
|
|
<script>
|
|
|
import { onMounted, onUnmounted, watch, ref, reactive, computed } from "vue"
|
|
|
+import GameRule from "@/components/GameRule.vue"
|
|
|
|
|
|
export default {
|
|
|
name: 'HomeView',
|
|
|
+ components: {
|
|
|
+ GameRule,
|
|
|
+ },
|
|
|
setup() {
|
|
|
const videoLeft = ref(0)
|
|
|
const videoTop = ref(0)
|
|
@@ -59,13 +72,38 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ isShowMask: false, // 不用这个的话,蒙层的显示会没有渐变效果。
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState([
|
|
|
+ 'hasPlayedGameRule',
|
|
|
]),
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ hasPlayedGameRule: {
|
|
|
+ handler(vNew) {
|
|
|
+ if (vNew) {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.video.play()
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted() {
|
|
|
+ if (!this.hasPlayedGameRule) {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isShowMask = true
|
|
|
+ }, 0)
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.video.play()
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeUnmount() {
|
|
|
+ this.$refs.video.pause()
|
|
|
},
|
|
|
unmounted() {
|
|
|
},
|