3434 <!-- 倒计时 -->
3535 <CountDown
3636 :start =" 0 "
37- :duration =" ( musicStore .songLyric .yrcData [0 ].startTime || 0 ) / 1000 "
37+ :duration =" musicStore .songLyric .yrcData [0 ].startTime || 0 "
3838 :seek =" playSeek "
3939 :playing =" statusStore .playStatus "
4040 />
5050 // on: statusStore.lyricIndex === index,
5151 // 当播放时间大于等于当前歌词的开始时间
5252 on:
53- (playSeek >= item.startTime / 1000 && playSeek < item.endTime / 1000 ) ||
53+ (playSeek >= item.startTime && playSeek < item.endTime) ||
5454 statusStore.lyricIndex === index,
5555 'is-bg': item.isBG,
5656 'is-duet': item.isDuet,
5757 },
5858 ]"
5959 :style =" {
6060 filter: settingStore.lyricsBlur
61- ? (playSeek >= item.startTime / 1000 && playSeek < item.endTime / 1000 ) ||
61+ ? (playSeek >= item.startTime && playSeek < item.endTime) ||
6262 statusStore.lyricIndex === index
6363 ? 'blur(0)'
6464 : `blur(${Math.min(Math.abs(statusStore.lyricIndex - index) * 1.8, 10)}px)`
7575 'content-text': true,
7676 'content-long':
7777 settingStore.showYrcLongEffect &&
78- ( text.endTime - item.startTime) / 1000 >= 1.5 &&
79- playSeek <= text.endTime / 1000 ,
78+ text.endTime - item.startTime >= 1500 &&
79+ playSeek <= text.endTime,
8080 'end-with-space': text.word.endsWith(' ') || text.startTime === 0,
8181 }"
8282 >
105105 v-if ="
106106 settingStore.countDownShow &&
107107 item.startTime > 0 &&
108- ((musicStore.songLyric.yrcData[index + 1]?.startTime || 0) - item.endTime) /
109- 1000 >=
110- 10
108+ (musicStore.songLyric.yrcData[index + 1]?.startTime || 0) - item.endTime >= 10000
111109 "
112110 class =" count-down-content"
113111 >
114112 <CountDown
115- :start =" item .endTime / 1000 "
113+ :start =" item .endTime "
116114 :duration ="
117- ((musicStore .songLyric .yrcData [index + 1 ]?.startTime || 0 ) - item .endTime ) /
118- 1000
115+ (musicStore .songLyric .yrcData [index + 1 ]?.startTime || 0 ) - item .endTime
119116 "
120117 :seek =" playSeek "
121118 :playing =" statusStore .playStatus "
130127 <!-- 倒计时 -->
131128 <CountDown
132129 :start =" 0 "
133- :duration =" ( musicStore .songLyric .lrcData [0 ].startTime || 0 ) / 1000 "
130+ :duration =" musicStore .songLyric .lrcData [0 ].startTime || 0 "
134131 :seek =" playSeek "
135132 :playing =" statusStore .playStatus "
136133 />
171168</template >
172169
173170<script setup lang="ts">
174- // import type { LyricContentType } from "@/types/main";
175171import { LyricWord } from " @applemusic-like-lyrics/lyric" ;
176172import { NScrollbar } from " naive-ui" ;
177173import { useMusicStore , useSettingStore , useStatusStore } from " @/stores" ;
178174import player from " @/utils/player" ;
179- import { getLyricLanguage } from " @/utils/lyric " ;
175+ import { getLyricLanguage } from " @/utils/format " ;
180176import { isElectron } from " @/utils/env" ;
181177import LyricMenu from " ./LyricMenu.vue" ;
182178
@@ -238,14 +234,14 @@ const getYrcStyle = (wordData: LyricWord, lyricIndex: number) => {
238234
239235 // 判断当前行是否处于激活状态
240236 const isLineActive =
241- (currentSeek >= currentLine .startTime / 1000 && currentSeek < currentLine .endTime / 1000 ) ||
237+ (currentSeek >= currentLine .startTime && currentSeek < currentLine .endTime ) ||
242238 statusStore .lyricIndex === lyricIndex ;
243239
244240 // 如果当前歌词行不是激活状态,返回固定样式,避免不必要的计算
245241 if (! isLineActive ) {
246242 if (settingStore .showYrcAnimation ) {
247243 // 判断单词是否已经唱过:已唱过保持填充状态(0%),未唱到保持未填充状态(100%)
248- const hasPlayed = currentSeek >= wordData .endTime / 1000 ;
244+ const hasPlayed = currentSeek >= wordData .endTime ;
249245 return {
250246 WebkitMaskPositionX: hasPlayed ? " 0%" : " 100%" ,
251247 };
@@ -257,30 +253,28 @@ const getYrcStyle = (wordData: LyricWord, lyricIndex: number) => {
257253 // 激活状态的样式计算
258254 if (settingStore .showYrcAnimation ) {
259255 // 如果播放状态不是加载中,且当前单词的时间加上持续时间减去播放进度大于 0
260- if (statusStore .playLoading === false && wordData .endTime / 1000 - currentSeek > 0 ) {
256+ if (statusStore .playLoading === false && wordData .endTime - currentSeek > 0 ) {
261257 return {
262258 transitionDuration: ` 0s, 0s, 0.35s ` ,
263259 transitionDelay: ` 0ms ` ,
264260 WebkitMaskPositionX: ` ${
265261 100 -
266262 Math .max (
267- ((currentSeek - wordData .startTime / 1000 ) /
268- ((wordData .endTime - wordData .startTime ) / 1000 )) *
269- 100 ,
263+ ((currentSeek - wordData .startTime ) / (wordData .endTime - wordData .startTime )) * 100 ,
270264 0 ,
271265 )
272266 }% ` ,
273267 };
274268 }
275269 // 预计算时间差,避免重复计算
276- const timeDiff = wordData .startTime - currentSeek * 1000 ;
270+ const timeDiff = wordData .startTime - currentSeek ;
277271 return {
278272 transitionDuration: ` ${wordData .endTime - wordData .startTime }ms, ${(wordData .endTime - wordData .startTime ) * 0.8 }ms, 0.35s ` ,
279273 transitionDelay: ` ${timeDiff }ms, ${timeDiff + (wordData .endTime - wordData .startTime ) * 0.5 }ms, 0ms ` ,
280274 };
281275 } else {
282276 // 无动画模式:根据单词时间判断透明度
283- return statusStore .playLoading === false && wordData .startTime / 1000 >= currentSeek
277+ return statusStore .playLoading === false && wordData .startTime >= currentSeek
284278 ? { opacity: 0 }
285279 : { opacity: 1 };
286280 }
@@ -290,8 +284,8 @@ const getYrcStyle = (wordData: LyricWord, lyricIndex: number) => {
290284const jumpSeek = (time : number ) => {
291285 if (! time ) return ;
292286 lrcMouseStatus .value = false ;
293- const offsetSeconds = statusStore .getSongOffset (musicStore .playSong ?.id );
294- player .setSeek (time / 1000 - offsetSeconds );
287+ const offsetMs = statusStore .getSongOffset (musicStore .playSong ?.id );
288+ player .setSeek (time - offsetMs );
295289 player .play ();
296290};
297291
0 commit comments