diff --git a/src/iconfont/index.ts b/src/iconfont/index.ts index 5eaba6db..76d85498 100644 --- a/src/iconfont/index.ts +++ b/src/iconfont/index.ts @@ -1,7 +1,7 @@ import $script from 'scriptjs' import { noop } from '@/utils/index' -const ICONFONT_URL = 'font_2132275_73mcnctm9yy' +const ICONFONT_URL = 'font_2132275_ypy5tdama8' // repair electron packaging '//' protocol problem $script(`https://at.alicdn.com/t/${ICONFONT_URL}.js`, noop) diff --git a/src/pages/footer/components/music-controller/index.tsx b/src/pages/footer/components/music-controller/index.tsx index b058ccdb..c54b95f4 100644 --- a/src/pages/footer/components/music-controller/index.tsx +++ b/src/pages/footer/components/music-controller/index.tsx @@ -7,7 +7,8 @@ import { FooterActions, FooterMutations, Direction, - BasicEffect + BasicEffect, + PlayMode } from '@/interface' import { Platform } from '@/config/build' import { asyncIpc, asyncIpcOrigin } from '@/electron/event/ipc-browser' @@ -58,6 +59,12 @@ export const MusicControl = defineComponent({ return formatTime(currentTime.value, 's') }) + const changePlayMode = () => { + useMutations( + FooterMutations.CHANGE_PLAYMODE, + playMode.value === PlayMode.RANDOM ? PlayMode.TURN : PlayMode.RANDOM + ) + } const prevMusic = () => { useActions(FooterActions.CUTOVER_TRACK, Direction.PREV) } @@ -243,7 +250,7 @@ export const MusicControl = defineComponent({ >
- + - - + + = { next = index === state.musicStack.length - 1 ? 0 : index + 1 } break + case PlayMode.RANDOM: + next = renderRandom(state.musicStack.length, index) } const nextMusic = state.musicStack[next] @@ -297,5 +299,8 @@ export const mutations: MutationTree = { if (state.audioElement) { state.effect = new AudioEffect(state.audioElement) } + }, + [FooterMutations.CHANGE_PLAYMODE](state, mode: PlayMode) { + state.playMode = mode } } diff --git a/src/pages/header/component/setting.tsx b/src/pages/header/component/setting.tsx index bc8a15b8..023b9db5 100644 --- a/src/pages/header/component/setting.tsx +++ b/src/pages/header/component/setting.tsx @@ -72,13 +72,13 @@ export const Setting = defineComponent({ } return () => ( -
+
- + { + if (extent <= 1) return extent + const random = (): number => { + const n = Math.floor(Math.random() * extent) + if (n !== index) { + return n + } + return random() + } + return random() +}