Browse Source

feat:给游戏添加背景音乐,增加展板积分等

aamin 1 năm trước cách đây
mục cha
commit
a6594f4a51

BIN
game/src/assets/audio/1.mp3


BIN
game/src/assets/audio/2.mp3


BIN
game/src/assets/audio/3.mp3


+ 8 - 0
game/src/views/ExamPaper1.vue

@@ -1,5 +1,11 @@
 <template>
   <div class="exam-paper">
+    <!-- <audio
+      :src="MusicBg"
+      loop
+      autoplay
+      style="display: none;"
+    /> -->
     <img
       class="title"
       src="@/assets/images/exam-paper-title-1.png"
@@ -34,6 +40,8 @@ import { useStore } from "vuex"
 import dayjs from 'dayjs'
 import { shuffle } from 'lodash'
 
+// import MusicBg from '@/assets/audio/1.mp3'
+
 const route = useRoute()
 const router = useRouter()
 const store = useStore()

+ 8 - 0
game/src/views/ExamPaper2.vue

@@ -1,5 +1,11 @@
 <template>
   <div class="exam-paper-2">
+    <audio
+      :src="MusicBg"
+      loop
+      autoplay
+      style="display: none;"
+    />
     <img
       class="title"
       src="@/assets/images/exam-paper-title-2.png"
@@ -144,6 +150,8 @@ import { shuffle } from 'lodash'
 import { addScore, getScore, getExamQuestionList, notifyQuit } from '@/api.js'
 import GameRule from '@/components/GameRule.vue'
 import NotifyComp from '@/components/NotifyComp.vue'
+import MusicBg from '@/assets/audio/1.mp3'
+
 
 const route = useRoute()
 const router = useRouter()

+ 8 - 0
game/src/views/PairUp.vue

@@ -1,5 +1,11 @@
 <template>
   <div class="game-view">
+    <audio
+      :src="MusicBg"
+      loop
+      autoplay
+      style="display: none;"
+    />
     <img
       class="title"
       src="@/assets/images/pair-up-title.png"
@@ -120,6 +126,8 @@ import PairUpOver from '@/components/PairUpOver.vue'
 import { addScore, getScore, notifyQuit } from '@/api.js'
 import GameRule from '@/components/GameRule.vue'
 import NotifyComp from '@/components/NotifyComp.vue'
+import MusicBg from '@/assets/audio/2.mp3'
+
 
 const route = useRoute()
 const router = useRouter()

+ 8 - 0
game/src/views/PlantTree.vue

@@ -1,5 +1,11 @@
 <template>
   <div class="game-view">
+    <audio
+      :src="MusicBg"
+      loop
+      autoplay
+      style="display: none;"
+    />
     <img
       class="title"
       src="@/assets/images/plant-tree-title.png"
@@ -162,6 +168,8 @@ import { addScore, getScore, notifyQuit } from '@/api.js'
 import GameRule from '@/components/GameRule.vue'
 import NotifyComp from '@/components/NotifyComp.vue'
 
+import MusicBg from '@/assets/audio/3.mp3'
+
 const route = useRoute()
 const router = useRouter()
 const store = useStore()

+ 16 - 10
hot/src/views/Home.vue

@@ -8,7 +8,7 @@
         <div class="audioIcon" v-if="audio && !isOneAduio" @click="audioSta = !audioSta"
           :title="audioSta ? '关闭音频' : '打开音频'">
           <img :src="require(`@/assets/images/pc/audio${audioSta ? 'Ac' : ''}.png`)
-            " alt="" />
+        " alt="" />
         </div>
 
         <!-- 如果只有一个模块 -->
@@ -21,14 +21,14 @@
           <div @click="myType = item.type" class="tabRow" :class="{ tabRowAc: myType === item.type }"
             v-for="item in flooTab" :key="item.id">
             <img :src="require(`@/assets/images/pc/icon${item.id}${myType === item.type ? 'Ac' : ''
-              }.png`)
-              " alt="" />
+        }.png`)
+        " alt="" />
             {{ item.name }}
             <span v-if="data[item.type] &&
-              data[item.type].length &&
-              data[item.type].length > 1
-              ">{{ item.type === myType ? myInd + 1 + "/" : null
-  }}{{ data[item.type].length }}</span>
+        data[item.type].length &&
+        data[item.type].length > 1
+        ">{{ item.type === myType ? myInd + 1 + "/" : null
+              }}{{ data[item.type].length }}</span>
           </div>
         </div>
 
@@ -56,7 +56,8 @@
           <div @click="cutMyInd(-1, myInd === 0)" class="leftJJ awccJJ" :class="{ noClick: myInd === 0 }"
             v-if="data[myType] && data[myType].length > 1"></div>
           <div @click="cutMyInd(1, myInd === data[myType].length - 1)" class="rightJJ awccJJ"
-            :class="{ noClick: myInd === data[myType].length - 1 }" v-if="data[myType] && data[myType].length > 1"></div>
+            :class="{ noClick: myInd === data[myType].length - 1 }" v-if="data[myType] && data[myType].length > 1">
+          </div>
         </div>
       </div>
 
@@ -130,8 +131,14 @@ export default {
     };
   },
   watch: {
-    myType() {
+    myType(val) {
       this.myInd = 0;
+      if (val === 'img') {
+        // 点开展板,累计积分
+        if (window.parent && window.parent.window.parent.window && window.parent.window.parent.window.addScoreFu) {
+          window.parent.window.parent.window.addScoreFu('观看展板')
+        }
+      }
     },
     // 音频的开启和关闭
     audioSta(val) {
@@ -571,4 +578,3 @@ export default {
   }
 }
 </style>
-

BIN
scene/public/static/images/marker-256x256.png


BIN
scene/public/static/images/reticule-256x256.png


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
zhengquan/public/scene/hot/css/app.5a6ac8a4.css


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
zhengquan/public/scene/hot/index.html


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 2
zhengquan/public/scene/hot/js/app.0f737a6d.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 1
zhengquan/public/scene/hot/js/app.0f737a6d.js.map


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 0
zhengquan/public/scene/hot/js/app.d11131db.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 0
zhengquan/public/scene/hot/js/app.d11131db.js.map


+ 4 - 0
zhengquan/src/views/Scene/ScenePage.vue

@@ -556,6 +556,8 @@ onMounted(() => {
 
   // 查看视频记录积分
   window.addScoreFu = (v: string) => {
+
+    console.log('收到反馈', v)
     // 获取游戏规则
     axios({
       method: 'get',
@@ -566,6 +568,8 @@ onMounted(() => {
     }).then((res: any) => {
 
       const score = res.data.data.find((item: any) => { return item.name == v }).score
+
+      console.log('收到反馈',score)
       axios({
         method: 'post',
         url: `${baseAPIUrl.value}/api/cms/game/point/add`,