|
100 | 100 | <n-flex class="left">
|
101 | 101 | <n-button
|
102 | 102 | :disabled="djData === 'empty'"
|
| 103 | + :focusable="false" |
103 | 104 | type="primary"
|
104 | 105 | class="play"
|
105 | 106 | tag="div"
|
106 | 107 | circle
|
107 | 108 | strong
|
108 | 109 | secondary
|
109 |
| - @click="playAllSongs" |
| 110 | + @click="playAllSongs(djData, 'dj')" |
110 | 111 | >
|
111 | 112 | <template #icon>
|
112 | 113 | <n-icon size="32">
|
|
115 | 116 | </template>
|
116 | 117 | </n-button>
|
117 | 118 | <n-button
|
| 119 | + :focusable="false" |
118 | 120 | class="like"
|
119 | 121 | size="large"
|
120 | 122 | tag="div"
|
|
133 | 135 | {{ isLikeOrDislike(djId) ? "订阅电台" : "取消订阅" }}
|
134 | 136 | </n-button>
|
135 | 137 | <n-dropdown :options="moreOptions" trigger="hover" placement="bottom-start">
|
136 |
| - <n-button class="more" size="large" tag="div" circle strong secondary> |
| 138 | + <n-button :focusable="false" class="more" size="large" tag="div" circle strong secondary> |
137 | 139 | <template #icon>
|
138 | 140 | <n-icon>
|
139 | 141 | <SvgIcon icon="format-list-bulleted" />
|
|
197 | 199 | </div>
|
198 | 200 | <div v-else class="title">
|
199 | 201 | <n-text class="key">参数不完整</n-text>
|
200 |
| - <n-button class="back" strong secondary @click="router.go(-1)"> 返回上一页 </n-button> |
| 202 | + <n-button :focusable="false" class="back" strong secondary @click="router.go(-1)"> |
| 203 | + 返回上一页 |
| 204 | + </n-button> |
201 | 205 | </div>
|
202 | 206 | </template>
|
203 | 207 |
|
204 | 208 | <script setup>
|
205 | 209 | import { NIcon } from "naive-ui";
|
206 | 210 | import { useRouter } from "vue-router";
|
207 | 211 | import { storeToRefs } from "pinia";
|
208 |
| -import { musicData, siteData, siteSettings, siteStatus } from "@/stores"; |
| 212 | +import { siteData, siteSettings } from "@/stores"; |
209 | 213 | import { getDjDetail, getDjProgram, likeDj } from "@/api/dj";
|
210 | 214 | import { fuzzySearch } from "@/utils/helper";
|
211 | 215 | import { isLogin } from "@/utils/auth";
|
212 | 216 | import { getTimestampTime } from "@/utils/timeTools";
|
213 |
| -import { fadePlayOrPause, initPlayer } from "@/utils/Player"; |
| 217 | +import { playAllSongs } from "@/utils/Player"; |
214 | 218 | import debounce from "@/utils/debounce";
|
215 | 219 | import formatData from "@/utils/formatData";
|
216 | 220 | import SvgIcon from "@/components/Global/SvgIcon";
|
217 | 221 |
|
218 | 222 | const router = useRouter();
|
219 | 223 | const data = siteData();
|
220 |
| -const music = musicData(); |
221 |
| -const status = siteStatus(); |
222 | 224 | const settings = siteSettings();
|
223 | 225 | const { userLikeData } = storeToRefs(data);
|
224 | 226 | const { loadSize } = storeToRefs(settings);
|
225 |
| -const { playList, playSongData } = storeToRefs(music); |
226 |
| -const { playIndex, playMode, playHeartbeatMode } = storeToRefs(status); |
227 | 227 |
|
228 | 228 | // 电台数据
|
229 | 229 | const djId = ref(router.currentRoute.value.query.id);
|
@@ -290,34 +290,6 @@ const getDjProgramData = async (id, limit = loadSize.value, offset = 0) => {
|
290 | 290 | }
|
291 | 291 | };
|
292 | 292 |
|
293 |
| -// 播放电台全部节目 |
294 |
| -const playAllSongs = async () => { |
295 |
| - if (!djData.value) return false; |
296 |
| - // 关闭心动模式 |
297 |
| - playHeartbeatMode.value = false; |
298 |
| - // 更改模式和电台 |
299 |
| - playMode.value = "dj"; |
300 |
| - playList.value = djData.value.slice(); |
301 |
| - // 是否处于电台内 |
302 |
| - const songId = music.getPlaySongData?.id; |
303 |
| - const existingIndex = djData.value.findIndex((song) => song.id === songId); |
304 |
| - // 若不处于 |
305 |
| - if (existingIndex === -1 || !songId) { |
306 |
| - console.log("不在电台内"); |
307 |
| - playSongData.value = djData.value[0]; |
308 |
| - playIndex.value = 0; |
309 |
| - // 初始化播放器 |
310 |
| - await initPlayer(true); |
311 |
| - } else { |
312 |
| - console.log("处于电台内"); |
313 |
| - playSongData.value = djData.value[existingIndex]; |
314 |
| - playIndex.value = existingIndex; |
315 |
| - // 播放 |
316 |
| - fadePlayOrPause(); |
317 |
| - } |
318 |
| - $message.info("已开始播放", { showIcon: false }); |
319 |
| -}; |
320 |
| - |
321 | 293 | // 节目模糊搜索
|
322 | 294 | const localSearch = debounce((val) => {
|
323 | 295 | const searchValue = val?.trim();
|
|
0 commit comments