|
@@ -87,12 +87,20 @@
|
|
|
</button>
|
|
|
</nav>
|
|
|
|
|
|
+ <Teleport to="body">
|
|
|
+ <audio
|
|
|
+ ref="bgAudio"
|
|
|
+ loop
|
|
|
+ :src="bgMusicUrl"
|
|
|
+ />
|
|
|
+ </Teleport>
|
|
|
<button
|
|
|
- v-show="!$route.meta.hideNavBar"
|
|
|
+ v-show="!$route.meta.hideNavBar && bgMusicUrl"
|
|
|
class="music-switch"
|
|
|
:style="{
|
|
|
- backgroundImage: isShowNavBar ? `url(${require(`@/assets/images/icon_music_2_on.png`)})` : `url(${require(`@/assets/images/icon_music_2_off.png`)})`,
|
|
|
+ backgroundImage: bgMusicStatus ? `url(${require(`@/assets/images/icon_music_2_on.png`)})` : `url(${require(`@/assets/images/icon_music_2_off.png`)})`,
|
|
|
}"
|
|
|
+ @click="onClickBgMusicBtn"
|
|
|
/>
|
|
|
<Teleport
|
|
|
to="body"
|
|
@@ -102,13 +110,10 @@
|
|
|
ref="infoTooltip"
|
|
|
class="info-tooltip"
|
|
|
>
|
|
|
- <p>
|
|
|
- <span class="key">版本号:</span><span class="value">{{ versionNumber }}</span>
|
|
|
- </p>
|
|
|
- <p>
|
|
|
+ <p v-show="contactMethod">
|
|
|
<span class="key">联系方式:</span><span class="value">{{ contactMethod }}</span>
|
|
|
</p>
|
|
|
- <p>
|
|
|
+ <p v-show="email">
|
|
|
<span class="key">电子邮箱:</span><span class="value">{{ email }}</span>
|
|
|
</p>
|
|
|
<div
|
|
@@ -118,7 +123,7 @@
|
|
|
</div>
|
|
|
</Teleport>
|
|
|
<button
|
|
|
- v-show="!$route.meta.hideNavBar"
|
|
|
+ v-show="!$route.meta.hideNavBar && (contactMethod || email)"
|
|
|
ref="infoButton"
|
|
|
class="info"
|
|
|
:style="{
|
|
@@ -165,12 +170,14 @@
|
|
|
import HomeFadeIn from "@/components/HomeFadeIn.vue"
|
|
|
import {
|
|
|
computed,
|
|
|
+ getCurrentInstance,
|
|
|
+ nextTick,
|
|
|
onMounted,
|
|
|
reactive,
|
|
|
ref,
|
|
|
- getCurrentInstance,
|
|
|
- nextTick,
|
|
|
+ watch,
|
|
|
} from 'vue'
|
|
|
+import { useStore } from "vuex"
|
|
|
import { computePosition, offset, shift, arrow } from '@floating-ui/dom'
|
|
|
import { onClickOutside } from '@vueuse/core'
|
|
|
|
|
@@ -180,6 +187,7 @@ export default {
|
|
|
},
|
|
|
setup () {
|
|
|
const internalInstance = getCurrentInstance()
|
|
|
+ const store = useStore()
|
|
|
|
|
|
const isShowFadeInMask = ref(false)
|
|
|
const progress = ref(0)
|
|
@@ -265,25 +273,47 @@ export default {
|
|
|
const navBarHeight = internalInstance.appContext.config.globalProperties.$isMobile ? `${90 / 1080 * window.innerHeight}px` : '90px'
|
|
|
|
|
|
/**
|
|
|
+ * 背景音乐按钮相关
|
|
|
+ */
|
|
|
+ function onClickBgMusicBtn() {
|
|
|
+ store.commit('switchBgMusic')
|
|
|
+ }
|
|
|
+ const bgMusicStatus = computed(() => {
|
|
|
+ return store.state.bgMusicStatus
|
|
|
+ })
|
|
|
+ const bgAudio = ref(null)
|
|
|
+ const bgMusicUrl = ref('')
|
|
|
+ watch(bgMusicStatus, (v) => {
|
|
|
+ if (v) {
|
|
|
+ bgAudio.value.play()
|
|
|
+ } else {
|
|
|
+ bgAudio.value.pause()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ document.addEventListener('click', function onFirstClick() {
|
|
|
+ if (bgMusicUrl.value) {
|
|
|
+ bgAudio.value.play()
|
|
|
+ document.removeEventListener('click', onFirstClick)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
* 信息展示弹框tooltip相关
|
|
|
*/
|
|
|
const infoButton = ref(null)
|
|
|
const infoTooltip = ref(null)
|
|
|
const tooltipArrow = ref(null)
|
|
|
const isShowInfoTooltip = ref(false)
|
|
|
- const versionNumber = ref('v1.4.5')
|
|
|
- const contactMethod = ref('135-7826-7133')
|
|
|
- const email = ref('y.ddzyyagf@igbp.hk')
|
|
|
+ const contactMethod = ref('')
|
|
|
+ const email = ref('')
|
|
|
|
|
|
- // onMounted(() => {
|
|
|
- // api.getSiteInfo().then((res) => {
|
|
|
- // console.log(res, 'salfklsfljsdlf')
|
|
|
- // versionNumber.value = res.
|
|
|
- // contactMethod.value = res.phone
|
|
|
- // email.value = res.email
|
|
|
-
|
|
|
- // })
|
|
|
- // })
|
|
|
+ onMounted(() => {
|
|
|
+ api.getSiteInfo().then((res) => {
|
|
|
+ contactMethod.value = res.phone
|
|
|
+ email.value = res.email
|
|
|
+ // bgMusicUrl.value = res.filePath
|
|
|
+ })
|
|
|
+ })
|
|
|
|
|
|
function onClickInfoButton() {
|
|
|
isShowInfoTooltip.value = true
|
|
@@ -307,7 +337,6 @@ export default {
|
|
|
})
|
|
|
|
|
|
const { x: arrowX, y: arrowY } = middlewareData.arrow
|
|
|
- console.log(arrowX, 'sdfkjsdlkfjl;ksdjf')
|
|
|
const arrowPlacement = {
|
|
|
top: 'bottom',
|
|
|
right: 'left',
|
|
@@ -343,6 +372,9 @@ export default {
|
|
|
|
|
|
return {
|
|
|
activeNavItemIdx,
|
|
|
+ bgAudio,
|
|
|
+ bgMusicUrl,
|
|
|
+ bgMusicStatus,
|
|
|
contactMethod,
|
|
|
email,
|
|
|
infoButton,
|
|
@@ -351,10 +383,10 @@ export default {
|
|
|
isShowInfoTooltip,
|
|
|
isShowNavBar,
|
|
|
navBarHeight,
|
|
|
+ onClickBgMusicBtn,
|
|
|
onClickInfoButton,
|
|
|
progress,
|
|
|
tooltipArrow,
|
|
|
- versionNumber,
|
|
|
}
|
|
|
},
|
|
|
}
|
|
@@ -706,6 +738,26 @@ html, body {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ >button.music-switch {
|
|
|
+ position: fixed;
|
|
|
+ right: calc((82 + (36 + 80) * 2) / 1080 * 83vh);
|
|
|
+ bottom: calc(28 / 1080 * 83vh);
|
|
|
+ width: calc(36 / 1080 * 83vh);
|
|
|
+ height: calc(36 / 1080 * 83vh);
|
|
|
+ background-size: cover;
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-position: center center;
|
|
|
+ }
|
|
|
+ >button.info {
|
|
|
+ position: fixed;
|
|
|
+ right: calc((82 + (36 + 80) * 1) / 1080 * 83vh);
|
|
|
+ bottom: calc(28 / 1080 * 83vh);
|
|
|
+ width: calc(36 / 1080 * 83vh);
|
|
|
+ height: calc(36 / 1080 * 83vh);
|
|
|
+ background-size: cover;
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-position: center center;
|
|
|
+ }
|
|
|
>button.show-hide {
|
|
|
position: fixed;
|
|
|
right: calc(82 / 1080 * 83vh);
|