@@ -78,11 +78,7 @@ export class PlayModeManager {
7878 /**
7979 * 计算下一个随机模式
8080 */
81- private calculateNextShuffleMode (
82- currentMode : ShuffleModeType ,
83- targetMode ?: ShuffleModeType ,
84- ) : ShuffleModeType {
85- if ( targetMode ) return targetMode ;
81+ public calculateNextShuffleMode ( currentMode : ShuffleModeType ) : ShuffleModeType {
8682 if ( currentMode === "off" ) return "on" ;
8783 if ( currentMode === "on" ) return "heartbeat" ;
8884 return "off" ;
@@ -114,11 +110,7 @@ export class PlayModeManager {
114110 /**
115111 * 执行开启心动模式的操作
116112 */
117- private async applyHeartbeatMode (
118- signal : AbortSignal ,
119- previousMode : ShuffleModeType ,
120- playAction ?: ( ) => Promise < void > ,
121- ) {
113+ private async applyHeartbeatMode ( signal : AbortSignal , previousMode : ShuffleModeType ) {
122114 const statusStore = useStatusStore ( ) ;
123115 const musicStore = useMusicStore ( ) ;
124116 const dataStore = useDataStore ( ) ;
@@ -134,12 +126,6 @@ export class PlayModeManager {
134126 return ;
135127 }
136128
137- if ( previousMode === "heartbeat" ) {
138- if ( playAction ) await playAction ( ) ;
139- statusStore . showFullPlayer = true ;
140- return ;
141- }
142-
143129 this . loadingMessage = window . $message . loading ( "心动模式开启中..." , {
144130 duration : 0 , // 不自动关闭,必须手动 destroy
145131 } ) ;
@@ -194,15 +180,14 @@ export class PlayModeManager {
194180
195181 /**
196182 * 切换随机模式
197- * @param mode 可选,直接设置目标模式。如果不传则按 Off -> On -> Heartbeat -> Off 顺序轮转
198- * @param playAction 回调函数,用于在心动模式下触发播放。通常你应该传入 PlayerController.play,或者其他类似的方法
183+ * @param mode 要切换到的随机模式
199184 */
200- public async toggleShuffle ( mode ? : ShuffleModeType , playAction ?: ( ) => Promise < void > ) {
185+ public async toggleShuffle ( mode : ShuffleModeType ) {
201186 const statusStore = useStatusStore ( ) ;
202187 const signal = this . resetCurrentTask ( ) ;
203188
189+ const nextMode = mode ;
204190 const currentMode = statusStore . shuffleMode ;
205- const nextMode = this . calculateNextShuffleMode ( currentMode , mode ) ;
206191
207192 if ( nextMode === currentMode ) return ;
208193
@@ -220,7 +205,7 @@ export class PlayModeManager {
220205 await this . applyShuffleOn ( signal ) ;
221206 break ;
222207 case "heartbeat" :
223- await this . applyHeartbeatMode ( signal , previousMode , playAction ) ;
208+ await this . applyHeartbeatMode ( signal , previousMode ) ;
224209 break ;
225210 default :
226211 await this . applyShuffleOff ( ) ;
@@ -263,10 +248,10 @@ export class PlayModeManager {
263248 * 专门处理 SMTC 的随机按钮事件
264249 * @param playAction 播放回调
265250 */
266- public handleSmtcShuffle ( playAction ?: ( ) => Promise < void > ) {
251+ public handleSmtcShuffle ( ) {
267252 const statusStore = useStatusStore ( ) ;
268253 const nextMode = statusStore . shuffleMode === "off" ? "on" : "off" ;
269- this . toggleShuffle ( nextMode , playAction ) ;
254+ this . toggleShuffle ( nextMode ) ;
270255 }
271256
272257 /**
0 commit comments