diff --git a/src/App.vue b/src/App.vue
index eba3185..209c7e0 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -95,6 +95,9 @@ const token = pubsub.subscribe("zp", (msg, data) => {
case "zp.showSearch":
showSearch.value = true;
break;
+ case "zp.hideSearch":
+ showSearch.value = false;
+ break;
case "zp.toggleSearch":
showSearch.value = !showSearch.value;
break;
diff --git a/src/lib/useHotkey.js b/src/lib/useHotkey.js
index 5912903..3920905 100644
--- a/src/lib/useHotkey.js
+++ b/src/lib/useHotkey.js
@@ -10,7 +10,7 @@ export default function useHotkey(){
"enter,ctrl+enter,⌘+enter",
].join(","),
throttle((e, h) => {
- switch (h.key) {
+ switch (h.key) {
// space,ctrl+p,⌘+p
case "space":
case "ctrl+p":
@@ -26,6 +26,15 @@ export default function useHotkey(){
case "⌘+right":
pubsub.publish("zp.next");
break;
+ // ctrl+up,⌘+up,ctrl+down,⌘+down
+ case "ctrl+up":
+ case "⌘+up":
+ pubsub.publish("zp.setVolume",{step: 5});
+ break;
+ case "ctrl+down":
+ case "⌘+down":
+ pubsub.publish("zp.setVolume",{step: -5});
+ break;
// enter,ctrl+enter,⌘+enter
case "enter":
case "ctrl+enter":
@@ -36,4 +45,23 @@ export default function useHotkey(){
e.preventDefault();
}, 500)
);
+ hotkeys(
+ [
+ "ctrl+up,⌘+up,ctrl+down,⌘+down",
+ ].join(","),
+ throttle((e, h) => {
+ switch (h.key) {
+ // ctrl+up,⌘+up,ctrl+down,⌘+down
+ case "ctrl+up":
+ case "⌘+up":
+ pubsub.publish("zp.setVolume",{step: 5});
+ break;
+ case "ctrl+down":
+ case "⌘+down":
+ pubsub.publish("zp.setVolume",{step: -5});
+ break;
+ }
+ e.preventDefault();
+ }, 50)
+ );
};
diff --git a/src/store/index.js b/src/store/index.js
index f93d5b9..3dcce23 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -14,6 +14,8 @@ export default createStore({
songId: 0, //歌曲id
playing: false, //是否播放
playMode: 0, //播放模式:0-3,顺序,循环,单曲,随机。
+ volume: 100, //音量,最大100
+ muted: false, //静音
lastPlayed: [], //最近播放
playingList: [], //当前播放
searchHistory: [], //搜索历史
diff --git a/src/views/common/Search.vue b/src/views/common/Search.vue
index acbed15..9a24055 100644
--- a/src/views/common/Search.vue
+++ b/src/views/common/Search.vue
@@ -44,7 +44,8 @@ const result = ref({});
}
"
v-model:value="keywords"
- @keyup.enter="search"
+ @keydown.enter="search"
+ @keyup.esc="pubsub.publish('zp.hideSearch');"
@input="handleInput"
style="width: 190px"
>
diff --git a/src/views/common/SongCtrl.vue b/src/views/common/SongCtrl.vue
index 181c42d..fff3e4b 100644
--- a/src/views/common/SongCtrl.vue
+++ b/src/views/common/SongCtrl.vue
@@ -178,6 +178,9 @@ watch(playing, (val, old) => {
// console.log(audioEl.value.duration);
if (audioEl.value) {
currentTime = audioEl.value.currentTime;
+ audioEl.value.volume = store.state.settings.muted
+ ? 0
+ : store.state.settings.volume / 100;
pubsub.publish("zp.progress", {
progress: audioEl.value.currentTime,
total: audioEl.value.duration,
diff --git a/src/views/common/SongStatus.vue b/src/views/common/SongStatus.vue
index 4aa8c6e..7757efd 100644
--- a/src/views/common/SongStatus.vue
+++ b/src/views/common/SongStatus.vue
@@ -1,25 +1,29 @@
@@ -43,61 +84,72 @@ watch(
:size="[6]"
style="padding-top: 2px; padding-right: 8px"
>
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
+
diff --git a/src/views/common/Vol.vue b/src/views/common/Vol.vue
new file mode 100644
index 0000000..7a440a5
--- /dev/null
+++ b/src/views/common/Vol.vue
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+