同时删除一首歌以上时将需要二次确认删除

pull/930/merge
lyswhut 2022-05-04 10:06:02 +08:00
parent c3c43a2645
commit 06b7f69b3c
5 changed files with 19 additions and 2 deletions

View File

@ -1,3 +1,7 @@
### 优化
- 同时删除一首歌以上时将需要二次确认删除
### 修复
- 修复某些情况下歌曲播放出错时不会自动切歌的问题

View File

@ -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",

View File

@ -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": "重命名",

View File

@ -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": "重命名",

View File

@ -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 {