新增“不喜欢歌曲”功能&新增“收藏歌曲”、“取消收藏”、“不喜欢该歌曲”快捷键设置
This commit is contained in:
@@ -60,6 +60,10 @@ export default {
|
||||
type: String,
|
||||
default: 'auto',
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: 'auto',
|
||||
},
|
||||
},
|
||||
emits: ['after-enter', 'after-leave', 'close'],
|
||||
data() {
|
||||
@@ -147,6 +151,7 @@ export default {
|
||||
maxWidth: this.maxWidth,
|
||||
minWidth: this.minWidth,
|
||||
width: this.width,
|
||||
height: this.height,
|
||||
maxHeight: this.maxHeight,
|
||||
}
|
||||
},
|
||||
|
||||
@@ -180,6 +180,7 @@ export default {
|
||||
const {
|
||||
handleSearch,
|
||||
handleOpenMusicDetail,
|
||||
handleDislikeMusic,
|
||||
} = useMusicActions({ props })
|
||||
|
||||
const {
|
||||
@@ -199,6 +200,7 @@ export default {
|
||||
handleSearch,
|
||||
handleShowMusicAddModal,
|
||||
handleOpenMusicDetail,
|
||||
handleDislikeMusic,
|
||||
})
|
||||
|
||||
const handleListItemClick = (event, index) => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { computed, ref, reactive, nextTick } from '@common/utils/vueTools'
|
||||
import musicSdk from '@renderer/utils/musicSdk'
|
||||
import { useI18n } from '@renderer/plugins/i18n'
|
||||
import { hasDislike } from '@renderer/core/dislikeList'
|
||||
|
||||
export default ({
|
||||
props,
|
||||
@@ -13,6 +14,7 @@ export default ({
|
||||
handleSearch,
|
||||
handleShowMusicAddModal,
|
||||
handleOpenMusicDetail,
|
||||
handleDislikeMusic,
|
||||
}) => {
|
||||
const itemMenuControl = reactive({
|
||||
play: true,
|
||||
@@ -21,6 +23,7 @@ export default ({
|
||||
download: true,
|
||||
search: true,
|
||||
sourceDetail: true,
|
||||
dislike: true,
|
||||
})
|
||||
const t = useI18n()
|
||||
const menuLocation = reactive({ x: 0, y: 0 })
|
||||
@@ -58,6 +61,11 @@ export default ({
|
||||
action: 'sourceDetail',
|
||||
disabled: !itemMenuControl.sourceDetail,
|
||||
},
|
||||
{
|
||||
name: t('list__dislike'),
|
||||
action: 'dislike',
|
||||
disabled: !itemMenuControl.dislike,
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
@@ -67,6 +75,8 @@ export default ({
|
||||
// this.listMenu.itemMenuControl.playLater =
|
||||
itemMenuControl.download = assertApiSupport(musicInfo.source)
|
||||
|
||||
itemMenuControl.dislike = !hasDislike(musicInfo)
|
||||
|
||||
if (props.checkApiSource) {
|
||||
itemMenuControl.playLater =
|
||||
itemMenuControl.play =
|
||||
@@ -110,6 +120,9 @@ export default ({
|
||||
break
|
||||
case 'sourceDetail':
|
||||
handleOpenMusicDetail(index)
|
||||
case 'dislike':
|
||||
handleDislikeMusic(index)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ import { useRouter } from '@common/utils/vueRouter'
|
||||
import musicSdk from '@renderer/utils/musicSdk'
|
||||
import { openUrl } from '@common/utils/electron'
|
||||
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'
|
||||
|
||||
|
||||
export default ({ props }) => {
|
||||
@@ -24,8 +27,18 @@ export default ({ props }) => {
|
||||
openUrl(url)
|
||||
}
|
||||
|
||||
const handleDislikeMusic = async(index) => {
|
||||
const minfo = props.list[index]
|
||||
await addDislikeInfo([{ name: minfo.name, singer: minfo.singer }])
|
||||
if (!playMusicInfo.isTempPlay && hasDislike(playMusicInfo.musicInfo)) {
|
||||
playNext(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
handleSearch,
|
||||
handleOpenMusicDetail,
|
||||
handleDislikeMusic,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user