Skip to content

Commit

Permalink
feat: #92
Browse files Browse the repository at this point in the history
  • Loading branch information
hq committed Mar 1, 2024
1 parent fb48adb commit 5a26fe4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 65 deletions.
2 changes: 0 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"log": "conventional-changelog -p eslint -i CHANGELOG.md -s -r 0",
"envinfo": "npx envinfo --system --npmPackages '{vite,@vitejs/*}' --binaries --browsers",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps"
"postuninstall": "electron-builder install-app-deps",
"prepare": "husky"
},
"gitHooks": {
"pre-commit": "lint-staged"
Expand All @@ -44,7 +45,7 @@
"license": "MIT",
"lint-staged": {
"*.{js,jsx,vue,ts,tsx}": [
"yanr lint",
"yarn lint",
"git add"
],
"*.{css,less}": [
Expand Down Expand Up @@ -137,7 +138,7 @@
"express": "^4.17.1",
"file-saver": "^2.0.5",
"http-proxy-middleware": "^1.0.6",
"husky": "^4.3.0",
"husky": "^9.0.11",
"lerna": "^3.22.1",
"less": "^3.0.4",
"lint-staged": "^9.5.0",
Expand Down
16 changes: 14 additions & 2 deletions src/pages/footer/components/volume-history/history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useFooterModule } from '@/modules'
import { Table } from '@/components-business/table'
import { on, off } from '@/utils/index'
import classnames from 'classnames'
import { SongsDetail } from '@/interface'
import { FooterMutations, SongsDetail } from '@/interface'
import { TeleportToAny } from '@/components/teleport-layout/index'
import { Button } from 'ant-design-vue'
import { playMusic } from '@/shared/music-shared'
Expand All @@ -37,7 +37,7 @@ export const MusicHistory = defineComponent({
const transition = ref(visible.value)
const isPlayListVisible = ref(true)

const { useState } = useFooterModule()
const { useState, useMutations } = useFooterModule()

const { musicStack, musciHistory } = toRefs(useState())

Expand Down Expand Up @@ -91,6 +91,18 @@ export const MusicHistory = defineComponent({
>
历史记录
</Button>
<Button
type="link"
onClick={() => {
if (isPlayListVisible.value) {
useMutations(FooterMutations.REMOVE_STACK)
} else {
useMutations(FooterMutations.REMOVE_HISTORY)
}
}}
>
删除全部
</Button>
</Button.Group>
</div>
{isPlayListVisible.value ? (
Expand Down
8 changes: 8 additions & 0 deletions src/pages/footer/sage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,17 @@ export const mutations: IMutations = {
state.musicStack = []
},
[FooterMutations.REMOVE_STACK](state, id) {
if (!id) {
state.musicStack = []
return
}
remove(state.musicStack, music => music.id === id)
},
[FooterMutations.REMOVE_HISTORY](state, id) {
if (!id) {
state.musciHistory = []
return
}
remove(state.musciHistory, music => music.id === id)
},
[FooterMutations.SET_DURATION](state, duration) {
Expand Down
65 changes: 7 additions & 58 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8700,13 +8700,6 @@ __metadata:
languageName: node
linkType: hard

"compare-versions@npm:^3.6.0":
version: 3.6.0
resolution: "compare-versions@npm:3.6.0"
checksum: 7492a50cdaa2c27f5254eee7c4b38856e1c164991bab3d98d7fd067fe4b570d47123ecb92523b78338be86aa221668fd3868bfe8caa5587dc3ebbe1a03d52b5d
languageName: node
linkType: hard

"component-emitter@npm:^1.2.1":
version: 1.3.0
resolution: "component-emitter@npm:1.3.0"
Expand Down Expand Up @@ -12383,15 +12376,6 @@ __metadata:
languageName: node
linkType: hard

"find-versions@npm:^3.2.0":
version: 3.2.0
resolution: "find-versions@npm:3.2.0"
dependencies:
semver-regex: ^2.0.0
checksum: f010e00f9dedd5b83206762d668b4b3b86bbb81f3c2d957e2559969b9eadb6124297c4a2a1d51c5efea3d79557b19660a2758c77bb6a5ba5ce7750fba9847082
languageName: node
linkType: hard

"flat-cache@npm:^2.0.1":
version: 2.0.1
resolution: "flat-cache@npm:2.0.1"
Expand Down Expand Up @@ -14042,24 +14026,12 @@ __metadata:
languageName: node
linkType: hard

"husky@npm:^4.3.0":
version: 4.3.0
resolution: "husky@npm:4.3.0"
dependencies:
chalk: ^4.0.0
ci-info: ^2.0.0
compare-versions: ^3.6.0
cosmiconfig: ^7.0.0
find-versions: ^3.2.0
opencollective-postinstall: ^2.0.2
pkg-dir: ^4.2.0
please-upgrade-node: ^3.2.0
slash: ^3.0.0
which-pm-runs: ^1.0.0
"husky@npm:^9.0.11":
version: 9.0.11
resolution: "husky@npm:9.0.11"
bin:
husky-run: bin/run.js
husky-upgrade: lib/upgrader/bin.js
checksum: 3e05ae0c751e54d013aeef2c1676e8375d0420d56cc63545890c4035d91054f028bd55b28e81c8c72e46a983ebb95bbc8961f2518f6136afcbf142d6e4fe4443
husky: bin.mjs
checksum: 1aebc3334dc7ac6288ff5e1fb72cfb447cfa474e72cf7ba692e8c5698c573ab725c28c6a5088c9f8e6aca5f47d40fa7261beffbc07a4d307ca21656dc4571f07
languageName: node
linkType: hard

Expand Down Expand Up @@ -18825,15 +18797,6 @@ __metadata:
languageName: node
linkType: hard

"opencollective-postinstall@npm:^2.0.2":
version: 2.0.3
resolution: "opencollective-postinstall@npm:2.0.3"
bin:
opencollective-postinstall: index.js
checksum: 0a68c5cef135e46d11e665d5077398285d1ce5311c948e8327b435791c409744d4a6bb9c55bd6507fb5f2ef34b0ad920565adcdaf974cbdae701aead6f32b396
languageName: node
linkType: hard

"optionator@npm:^0.8.1":
version: 0.8.3
resolution: "optionator@npm:0.8.3"
Expand Down Expand Up @@ -19663,7 +19626,7 @@ __metadata:
languageName: node
linkType: hard

"please-upgrade-node@npm:^3.1.1, please-upgrade-node@npm:^3.2.0":
"please-upgrade-node@npm:^3.1.1":
version: 3.2.0
resolution: "please-upgrade-node@npm:3.2.0"
dependencies:
Expand Down Expand Up @@ -20495,7 +20458,7 @@ __metadata:
file-saver: ^2.0.5
github-markdown-css: ^4.0.0
http-proxy-middleware: ^1.0.6
husky: ^4.3.0
husky: ^9.0.11
js-base64: ^3.7.5
js-cookie: ^2.2.1
lerna: ^3.22.1
Expand Down Expand Up @@ -21737,13 +21700,6 @@ __metadata:
languageName: node
linkType: hard

"semver-regex@npm:^2.0.0":
version: 2.0.0
resolution: "semver-regex@npm:2.0.0"
checksum: da7d6f5ceae80e2097933b1e4ea2815c2cfa2c50c6501db1a3d435a6063c0f23d66bc25fe8d06755048f3d7588d85339db6471446b2c91fea907e5c2ada5b0df
languageName: node
linkType: hard

"semver@npm:2 || 3 || 4 || 5, semver@npm:2.x || 3.x || 4 || 5, semver@npm:^5.4.1, semver@npm:^5.5.0, semver@npm:^5.5.1, semver@npm:^5.6.0, semver@npm:^5.7.0, semver@npm:^5.7.1":
version: 5.7.1
resolution: "semver@npm:5.7.1"
Expand Down Expand Up @@ -25220,13 +25176,6 @@ __metadata:
languageName: node
linkType: hard

"which-pm-runs@npm:^1.0.0":
version: 1.0.0
resolution: "which-pm-runs@npm:1.0.0"
checksum: 30cf7aee31f264558070e92414316c169367bb2b84a0a32777d30392fea0892fcf9955b81c3fe7f52165ae5a33f0acfd3bc0916416cb07e6d414c90255c228ca
languageName: node
linkType: hard

"which-typed-array@npm:^1.1.11, which-typed-array@npm:^1.1.13":
version: 1.1.13
resolution: "which-typed-array@npm:1.1.13"
Expand Down

0 comments on commit 5a26fe4

Please sign in to comment.