Skip to content

Commit

Permalink
Merge pull request #3 from LOG1997/dev
Browse files Browse the repository at this point in the history
Dev to main
  • Loading branch information
LOG1997 authored Jan 17, 2024
2 parents 2c6aa42 + 44a35a5 commit 4bd0061
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/dog.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Log-Lottery</title>
</head>
Expand Down
1 change: 1 addition & 0 deletions public/dog.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 13 additions & 7 deletions src/components/PlayMusic/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ const settingRef = ref()
// const audio = ref(new Audio())
const globalConfig = useStore().globalConfig
const { getMusicList: localMusicList,getCurrentMusic:currentMusic } = storeToRefs(globalConfig);
const localMusicListValue = ref(localMusicList)
// const localMusicListValue = ref(localMusicList)
const play = async (item: any) => {
if(!item){
return
}
// if (!audio.value.paused && !skip) {
// audio.value.pause()
Expand All @@ -37,6 +40,9 @@ const play = async (item: any) => {
audio.value.play()
}
const playMusic=(item:any,skip = false)=>{
if(!item){
return
}
if(!currentMusic.value.paused&&!skip){
globalConfig.setCurrentMusic(item,true)
Expand All @@ -46,13 +52,13 @@ return
}
const nextPlay = () => {
// 播放下一首
if (localMusicListValue.value.length > 1) {
let index = localMusicListValue.value.findIndex((item: any) => item.name == currentMusic.value.item.name)
if (localMusicList.value.length >= 1) {
let index = localMusicList.value.findIndex((item: any) => item.name == currentMusic.value.item.name)
index++
if (index >= localMusicListValue.value.length) {
if (index >= localMusicList.value.length) {
index = 0
}
globalConfig.setCurrentMusic(localMusicListValue.value[index],false)
globalConfig.setCurrentMusic(localMusicList.value[index],false)
}
}
// 监听播放成后开始下一首
Expand All @@ -68,7 +74,7 @@ const enterHome = () => {
}
onMounted(() => {
globalConfig.setCurrentMusic(localMusicListValue.value[0],true)
globalConfig.setCurrentMusic(localMusicList.value[0],true)
onPlayEnd()
// 不使用空格控制audio
})
Expand Down Expand Up @@ -101,7 +107,7 @@ watch(currentMusic, (val: any) => {
</div>
</div>

<div class="tooltip tooltip-left" :data-tip="currentMusic ? currentMusic.item.name+'\n\r &nbsp; 右键下一曲' : '播放/暂停'">
<div class="tooltip tooltip-left" :data-tip="currentMusic.item ? currentMusic.item.name+'\n\r &nbsp; 右键下一曲' : '没有音乐可以播放'">
<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"
@click="playMusic(currentMusic.item)" @click.right.prevent="nextPlay">
<svg-icon :name="currentMusic.paused ? 'play' : 'pause'"></svg-icon>
Expand Down
4 changes: 3 additions & 1 deletion todo.todo
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

-- 导出表格

-- 手机端访问提示跳转PC端
-- 手机端访问提示跳转PC端

不同抽奖3D图形,球体、螺旋体...

0 comments on commit 4bd0061

Please sign in to comment.