From 06b7f69b3c2193c3cbafabe0c82cef137e597e3f Mon Sep 17 00:00:00 2001 From: lyswhut Date: Wed, 4 May 2022 10:06:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=97=B6=E5=88=A0=E9=99=A4=E4=B8=80?= =?UTF-8?q?=E9=A6=96=E6=AD=8C=E4=BB=A5=E4=B8=8A=E6=97=B6=E5=B0=86=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E4=BA=8C=E6=AC=A1=E7=A1=AE=E8=AE=A4=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 4 ++++ src/lang/en-us.json | 1 + src/lang/zh-cn.json | 1 + src/lang/zh-tw.json | 1 + .../list/components/MusicList/useMusicActions.js | 14 ++++++++++++-- 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/publish/changeLog.md b/publish/changeLog.md index 719f07c4..ff070a6d 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -1,3 +1,7 @@ +### 优化 + +- 同时删除一首歌以上时将需要二次确认删除 + ### 修复 - 修复某些情况下歌曲播放出错时不会自动切歌的问题 diff --git a/src/lang/en-us.json b/src/lang/en-us.json index a5a797b4..25f3978a 100644 --- a/src/lang/en-us.json +++ b/src/lang/en-us.json @@ -120,6 +120,7 @@ "lists__new_list_btn": "Create list", "lists__new_list_input": "New list...", "lists__remove": "Remove", + "lists__remove music_tip": "Do you really want to remove the selected {len} songs?", "lists__remove_tip": "Do you really want to remove {name}?", "lists__remove_tip_button": "Yes, that's right", "lists__rename": "Rename", diff --git a/src/lang/zh-cn.json b/src/lang/zh-cn.json index 339f50f7..222eef4c 100644 --- a/src/lang/zh-cn.json +++ b/src/lang/zh-cn.json @@ -120,6 +120,7 @@ "lists__new_list_btn": "新建列表", "lists__new_list_input": "新列表...", "lists__remove": "删除", + "lists__remove music_tip": "你真的要移除所选的 {len} 首歌曲吗?", "lists__remove_tip": "你真的想要移除 {name} 吗?", "lists__remove_tip_button": "是的 没错", "lists__rename": "重命名", diff --git a/src/lang/zh-tw.json b/src/lang/zh-tw.json index c431b61e..b0ac4288 100644 --- a/src/lang/zh-tw.json +++ b/src/lang/zh-tw.json @@ -120,6 +120,7 @@ "lists__new_list_btn": "新建列表", "lists__new_list_input": "新列表...", "lists__remove": "刪除", + "lists__remove music_tip": "你真的要移除所選的 {len} 首歌曲嗎?", "lists__remove_tip": "你真的想要移除 {name} 嗎?", "lists__remove_tip_button": "是的 沒錯", "lists__rename": "重命名", diff --git a/src/renderer/views/list/components/MusicList/useMusicActions.js b/src/renderer/views/list/components/MusicList/useMusicActions.js index 2c0f39fe..5b517456 100644 --- a/src/renderer/views/list/components/MusicList/useMusicActions.js +++ b/src/renderer/views/list/components/MusicList/useMusicActions.js @@ -1,10 +1,12 @@ -import { useCommit, useRouter } from '@renderer/utils/vueTools' +import { useCommit, useRouter, useI18n } from '@renderer/utils/vueTools' import musicSdk from '@renderer/utils/music' import { openUrl, clipboardWriteText } from '@renderer/utils' +import { dialog } from '@renderer/plugins/Dialog' export default ({ props, list, setting, selectedList, removeAllSelect }) => { const router = useRouter() + const { t } = useI18n() const listRemove = useCommit('list', 'listRemove') const listRemoveMultiple = useCommit('list', 'listRemoveMultiple') @@ -31,8 +33,16 @@ export default ({ props, list, setting, selectedList, removeAllSelect }) => { clipboardWriteText(setting.value.download.fileName.replace('歌名', minfo.name).replace('歌手', minfo.singer)) } - const handleRemoveMusic = (index, single) => { + const handleRemoveMusic = async(index, single) => { if (selectedList.value.length && !single) { + const confirm = await (selectedList.value.length > 1 + ? dialog.confirm({ + message: t('lists__remove music_tip', { len: selectedList.value.length }), + confirmButtonText: t('lists__remove_tip_button'), + }) + : Promise.resolve(true) + ) + if (!confirm) return listRemoveMultiple({ listId: props.listId, ids: selectedList.value.map(m => m.songmid) }) removeAllSelect() } else {