File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -951,13 +951,23 @@ class PlayerController {
951951 /**
952952 * 切换随机模式
953953 * @param mode 可选,直接设置目标模式。如果不传则按 Off -> On -> Heartbeat -> Off 顺序轮转
954+ * @note 当播放列表包含本地歌曲时,跳过心动模式,只在 Off 和 On 之间切换
954955 */
955956 public async toggleShuffle ( mode ?: ShuffleModeType ) {
957+ const dataStore = useDataStore ( ) ;
956958 const statusStore = useStatusStore ( ) ;
957959 const currentMode = statusStore . shuffleMode ;
958960
961+ // 检查播放列表是否包含本地歌曲
962+ const hasLocalSongs = dataStore . playList . some ( ( song ) => song . path ) ;
963+
959964 // 预判下一个模式
960- const nextMode = mode ?? this . playModeManager . calculateNextShuffleMode ( currentMode ) ;
965+ let nextMode = mode ?? this . playModeManager . calculateNextShuffleMode ( currentMode ) ;
966+
967+ // 如果播放列表包含本地歌曲,跳过心动模式
968+ if ( hasLocalSongs && nextMode === "heartbeat" ) {
969+ nextMode = "off" ;
970+ }
961971
962972 // 已经是心动模式,再次触发心动模式并播放
963973 if ( currentMode === "heartbeat" && nextMode === "heartbeat" ) {
You can’t perform that action at this time.
0 commit comments