feat(layout): 添加全屏切换功能 #96
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
<script setup lang='ts'>
|
||||
import { ref } from 'vue'
|
||||
import { useFullscreen } from '@vueuse/core'
|
||||
import { Maximize, Minimize } from 'lucide-vue-next'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { usePlayMusic } from './usePlayMusic'
|
||||
|
||||
const { playMusic, currentMusic, nextPlay } = usePlayMusic()
|
||||
|
||||
const { isFullscreen, toggle: toggleScreen } = useFullscreen()
|
||||
const { t } = useI18n()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const settingRef = ref()
|
||||
// const audio = ref(new Audio())
|
||||
// const localMusicListValue = ref(localMusicList)
|
||||
const fullScreenRef = ref()
|
||||
|
||||
function enterConfig() {
|
||||
router.push('/log-lottery/config')
|
||||
@@ -20,10 +21,32 @@ function enterConfig() {
|
||||
function enterHome() {
|
||||
router.push('/log-lottery')
|
||||
}
|
||||
onMounted(() => {
|
||||
settingRef.value.addEventListener('mouseenter', () => {
|
||||
fullScreenRef.value.style.display = 'block'
|
||||
})
|
||||
settingRef.value.addEventListener('mouseleave', () => {
|
||||
fullScreenRef.value.style.display = 'none'
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div ref="settingRef" class="flex flex-col gap-3">
|
||||
<div ref="fullScreenRef" class="tooltip tooltip-left hidden" @click="toggleScreen">
|
||||
<div
|
||||
v-if="isFullscreen"
|
||||
class="flex items-center justify-center w-10 h-10 p-0 m-0 cursor-pointer setting-container bg-slate-500/50 rounded-l-xl hover:bg-slate-500/80 hover:text-blue-400/90"
|
||||
>
|
||||
<Minimize />
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="flex items-center justify-center w-10 h-10 p-0 m-0 cursor-pointer setting-container bg-slate-500/50 rounded-l-xl hover:bg-slate-500/80 hover:text-blue-400/90"
|
||||
>
|
||||
<Maximize />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="route.path.includes('/config')" class="tooltip tooltip-left" :data-tip="t('tooltip.toHome')">
|
||||
<div
|
||||
class="flex items-center justify-center w-10 h-10 p-0 m-0 cursor-pointer setting-container bg-slate-500/50 rounded-l-xl hover:bg-slate-500/80 hover:text-blue-400/90"
|
||||
@@ -40,7 +63,6 @@ function enterHome() {
|
||||
<svg-icon name="setting" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tooltip tooltip-left" :data-tip="currentMusic.item ? `${currentMusic.item.name}\n\r ${t('tooltip.nextSong')}` : t('tooltip.noSongPlay')">
|
||||
<div
|
||||
class="flex items-center justify-center w-10 h-10 p-0 m-0 cursor-pointer setting-container bg-slate-500/50 rounded-l-xl hover:bg-slate-500/80 hover:text-blue-400/90"
|
||||
|
||||
@@ -64,11 +64,11 @@ export function useViewModel({ exportInputFileRef }: { exportInputFileRef: Ref<H
|
||||
async function getExcelTemplateContent() {
|
||||
const locale = i18n.global.locale.value
|
||||
if (locale === 'zhCn') {
|
||||
const templateData = await readLocalFileAsArraybuffer('log-lottery/人口登记表-zhCn.xlsx')
|
||||
const templateData = await readLocalFileAsArraybuffer('/log-lottery/人口登记表-zhCn.xlsx')
|
||||
return templateData
|
||||
}
|
||||
else {
|
||||
const templateData = await readLocalFileAsArraybuffer('log-lottery/personListTemplate-en.xlsx')
|
||||
const templateData = await readLocalFileAsArraybuffer('/log-lottery/personListTemplate-en.xlsx')
|
||||
return templateData
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user