通过歌曲菜单添加不喜欢歌曲时需要二次确认防止手抖
This commit is contained in:
@@ -5,10 +5,13 @@ import { toOldMusicInfo } from '@renderer/utils'
|
||||
import { addDislikeInfo, hasDislike } from '@renderer/core/dislikeList'
|
||||
import { playNext } from '@renderer/core/player'
|
||||
import { playMusicInfo } from '@renderer/store/player/state'
|
||||
import { dialog } from '@renderer/plugins/Dialog'
|
||||
import { useI18n } from '@renderer/plugins/i18n'
|
||||
|
||||
|
||||
export default ({ props }) => {
|
||||
const router = useRouter()
|
||||
const t = useI18n()
|
||||
|
||||
const handleSearch = index => {
|
||||
const info = props.list[index]
|
||||
@@ -29,6 +32,12 @@ export default ({ props }) => {
|
||||
|
||||
const handleDislikeMusic = async(index) => {
|
||||
const minfo = props.list[index]
|
||||
const confirm = await dialog.confirm({
|
||||
message: t('lists__dislike_music_tip', { name: minfo.name }),
|
||||
cancelButtonText: t('cancel_button_text_2'),
|
||||
confirmButtonText: t('confirm_button_text'),
|
||||
})
|
||||
if (!confirm) return
|
||||
await addDislikeInfo([{ name: minfo.name, singer: minfo.singer }])
|
||||
if (hasDislike(playMusicInfo.musicInfo)) {
|
||||
playNext(true)
|
||||
|
||||
@@ -52,7 +52,7 @@ export default ({ list, selectedList, removeAllSelect }) => {
|
||||
if (selectedList.value.length && !single) {
|
||||
// const confirm = await (selectedList.value.length > 1
|
||||
// ? dialog.confirm({
|
||||
// message: t('lists__remove music_tip', { len: selectedList.value.length }),
|
||||
// message: t('lists__remove_music_tip', { len: selectedList.value.length }),
|
||||
// confirmButtonText: t('lists__remove_tip_button'),
|
||||
// })
|
||||
// : Promise.resolve(true)
|
||||
|
||||
@@ -39,6 +39,12 @@ export default ({ props, list, selectedList, removeAllSelect }) => {
|
||||
|
||||
const handleDislikeMusic = async(index) => {
|
||||
const minfo = list.value[index]
|
||||
const confirm = await dialog.confirm({
|
||||
message: t('lists__dislike_music_tip', { name: minfo.name }),
|
||||
cancelButtonText: t('cancel_button_text_2'),
|
||||
confirmButtonText: t('confirm_button_text'),
|
||||
})
|
||||
if (!confirm) return
|
||||
await addDislikeInfo([{ name: minfo.name, singer: minfo.singer }])
|
||||
if (hasDislike(playMusicInfo.musicInfo)) {
|
||||
playNext(true)
|
||||
@@ -49,7 +55,7 @@ export default ({ props, list, selectedList, removeAllSelect }) => {
|
||||
if (selectedList.value.length && !single) {
|
||||
const confirm = await (selectedList.value.length > 1
|
||||
? dialog.confirm({
|
||||
message: t('lists__remove music_tip', { len: selectedList.value.length }),
|
||||
message: t('lists__remove_music_tip', { len: selectedList.value.length }),
|
||||
confirmButtonText: t('lists__remove_tip_button'),
|
||||
})
|
||||
: Promise.resolve(true)
|
||||
|
||||
Reference in New Issue
Block a user