Files
BYW-VoiceHub/patches/0019-refactor-cleanup-PlaylistSelection-NeteaseUpload-Bil.patch
T

179 lines
6.8 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
From d247cfbda34cff40acd3392c4a3220d0dd202ef9 Mon Sep 17 00:00:00 2001
From: HenryDu8133 <813367384@qq.com>
Date: Sun, 6 Sep 2026 11:50:33 +0800
Subject: [PATCH 19/58] =?UTF-8?q?refactor(cleanup):=20=E6=B8=85=E7=90=86?=
=?UTF-8?q?=E7=AC=AC=E4=BA=8C=E8=BD=AE=E9=9D=9E=E9=85=B7=E7=8B=97=E7=BB=84?=
=?UTF-8?q?=E4=BB=B6=E6=AE=8B=E7=95=99=EF=BC=88PlaylistSelection/NeteaseUp?=
=?UTF-8?q?load/BilibiliIframe=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- RequestForm.vue:删除 PlaylistSelectionModal.vue / NeteaseUploadDialog.vue 2 行无效 import
(2 组件在合并阶段已物理删除,grep 确认无 ref / 赋值 / template 渲染段残留)
- AudioPlayer.vue:彻底清理 BilibiliIframeModal 相关 8 处残留:
① 封面点击事件 @click 三元嵌套语法 bug 修复 → 简化为 !isMobile ? toggleLyrics()
② 删除 v-if=false 的「观看视频」Icon 按钮(保留歌词按钮)
③ 删除 ClientOnly 包裹的 BilibiliIframeModal 渲染段
④ 删除 BilibiliIframeModal.vue / getBilibiliUrl 2 行 import
⑤ 删除 showBilibiliIframe ref 定义
⑥ 删除 resolveFallbackUrl 中 if(false) 包裹的 bilibili 死代码分支
⑦ 删除整个 openBilibiliVideo 函数(含 iframe 预览 + 新窗口跳转逻辑)
⑧ handlePlayerClick 移动端逻辑简化为直接 toggleLyrics(移除 bilibili 平台分支)
- 验证:
・IDE GetDiagnostics 0 error / 0 warning
・grep 本轮 3 Modal 关键字在 app/components 下 0 命中(仅 utils/url.ts 保留 getBilibiliUrl
工具函数定义,未被 import,不影响 build)
・上一轮 4 Modal(NeteaseLogin/PodcastEpisodes/BilibiliEpisodes/RecentSongs)
grep 0 命中(持续干净)
---
app/components/Songs/RequestForm.vue | 2 -
app/components/UI/AudioPlayer.vue | 61 ++--------------------------
2 files changed, 3 insertions(+), 60 deletions(-)
diff --git a/app/components/Songs/RequestForm.vue b/app/components/Songs/RequestForm.vue
index cadb028..d28fc42 100644
--- a/app/components/Songs/RequestForm.vue
+++ b/app/components/Songs/RequestForm.vue
@@ -849,9 +849,7 @@ import Icon from '../UI/Icon.vue'
import { convertToHttps, validateUrl } from '~/utils/url'
import ImportSongsModal from './ImportSongsModal.vue'
-import PlaylistSelectionModal from './PlaylistSelectionModal.vue'
import UserSearchModal from '../Common/UserSearchModal.vue'
-import NeteaseUploadDialog from './NeteaseUploadDialog.vue'
const props = defineProps({
loading: {
diff --git a/app/components/UI/AudioPlayer.vue b/app/components/UI/AudioPlayer.vue
index cbfc967..1f4c7e6 100644
--- a/app/components/UI/AudioPlayer.vue
+++ b/app/components/UI/AudioPlayer.vue
@@ -26,13 +26,7 @@
<!-- 封面 -->
<div
class="cover-container"
- @click.stop="
- isMobile
- ? false
- ? openBilibiliVideo()
- : toggleLyrics()
- : null
- "
+ @click.stop="!isMobile ? toggleLyrics() : null"
>
<template v-if="activeSong && activeSong.cover && !coverError">
<img
@@ -107,15 +101,7 @@
<!-- 控制按钮区域 -->
<div class="controls-frame">
<!-- 左侧歌词按钮 -->
- <span
- v-if="false"
- class="lyrics-btn music-icon"
- title="观看视频"
- @click="openBilibiliVideo"
- >
- <Icon name="video" size="20" />
- </span>
- <span v-else class="lyrics-btn music-icon" title="歌词" @click="toggleLyrics">
+ <span class="lyrics-btn music-icon" title="歌词" @click="toggleLyrics">
<Icon name="music" size="20" />
</span>
@@ -210,16 +196,6 @@
<LyricsModal :is-visible="showFullscreenLyrics" @close="showFullscreenLyrics = false" />
</ClientOnly>
- <!-- 哔哩哔哩 iframe 预览模态 -->
- <ClientOnly>
- <BilibiliIframeModal
- :show="showBilibiliIframe"
- :bvid="activeSong?.musicId?.split(':')[0]"
- :page="activeSong?.musicId?.split(':')[2] ? parseInt(activeSong.musicId.split(':')[2]) : 1"
- @close="showBilibiliIframe = false"
- />
- </ClientOnly>
-
<ConfirmDialog
:show="showFallbackOpenDialog"
title="打开投稿链接"
@@ -238,7 +214,6 @@ import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
import AppleMusicLyrics from './AppleMusicLyrics.vue'
import LyricsModal from './LyricsModal.vue'
import AudioElement from './AudioPlayer/AudioElement.vue'
-import BilibiliIframeModal from './BilibiliIframeModal.vue'
import Icon from './Icon.vue'
import ConfirmDialog from './ConfirmDialog.vue'
import { useAudioPlayerControl } from '~/composables/useAudioPlayerControl'
@@ -246,7 +221,6 @@ import { useAudioPlayerSync } from '~/composables/useAudioPlayerSync'
import { useAudioQuality } from '~/composables/useAudioQuality'
import { useAudioPlayerEnhanced } from '~/composables/useAudioPlayerEnhanced'
import { useMediaSession } from '~/composables/useMediaSession'
-import { getBilibiliUrl } from '~/utils/url'
// 添加 router 导入
const router = useRouter()
@@ -286,7 +260,6 @@ const showLyrics = ref(false)
const showFullscreenLyrics = ref(false)
const coverError = ref(false)
const useAppleMusicStyle = ref(true) // 默认使用Apple Music风格
-const showBilibiliIframe = ref(false) // 显示哔哩哔哩 iframe 预览
// 时长显示模式:'remaining' 显示剩余时长,'total' 显示总时长
const timeDisplayMode = ref('remaining')
@@ -367,13 +340,6 @@ const resolveFallbackUrl = () => {
const playUrl = normalizeHttpUrl(song.playUrl)
if (playUrl) return playUrl
- if (false) {
- const bilibiliUrl = getBilibiliUrl(song)
- if (bilibiliUrl && bilibiliUrl !== '#') {
- return bilibiliUrl
- }
- }
-
return null
}
@@ -962,23 +928,6 @@ const toggleLyrics = () => {
showFullscreenLyrics.value = true
}
-const openBilibiliVideo = () => {
- const song = activeSong.value
- if (!song) return
-
- // 如果播放器有错误,显示 iframe 预览
- if (control.hasError.value) {
- showBilibiliIframe.value = true
- return
- }
-
- // 否则在新窗口打开
- const url = getBilibiliUrl(song)
- if (url && url !== '#') {
- window.open(url, '_blank')
- }
-}
-
const handleLyricSeek = async (time) => {
// 如果当前处于暂停状态,先开始播放
if (!control.isPlaying.value) {
@@ -1152,11 +1101,7 @@ const checkMobile = () => {
// 移动端点击播放条处理
const handlePlayerClick = () => {
if (isMobile.value) {
- if (activeSong.value?.musicPlatform === 'bilibili') {
- openBilibiliVideo()
- } else {
- toggleLyrics()
- }
+ toggleLyrics()
}
}
--
2.45.1.windows.1