mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-27 02:34:15 +08:00
fix: commitMP3 and countrycode to countryCode (#41)
* feat: add config to resolve path alias. * feat: use vue-i18n for language switch * feat: add .editorconfig for ide * fix: add no-referrer to avoid CROB * fix: setCookie and fix typo * feat: integrate vue-i18n * feat: player component i18n support * fix: duplicate key warning in explore page * fix: like songs number changed in library page * fire: remove todo * fix: same text search on enter will cause error * fix: scrobble error params type * feat: prettier task supported * fix: prettier ignore config update * fix: conflict * fix: commitMP3 and countrycode to countryCode * lint: prettier
This commit is contained in:
parent
c042faa001
commit
e3043e7918
|
@ -15,7 +15,10 @@
|
||||||
/>
|
/>
|
||||||
<div class="no" v-if="isAlbum">
|
<div class="no" v-if="isAlbum">
|
||||||
<button v-show="focus && track.playable && !isPlaying" @click="playTrack">
|
<button v-show="focus && track.playable && !isPlaying" @click="playTrack">
|
||||||
<svg-icon icon-class="play" style="height:14px;width:14px"></svg-icon>
|
<svg-icon
|
||||||
|
icon-class="play"
|
||||||
|
style="height: 14px; width: 14px"
|
||||||
|
></svg-icon>
|
||||||
</button>
|
</button>
|
||||||
<span v-show="(!focus || !track.playable) && !isPlaying">{{
|
<span v-show="(!focus || !track.playable) && !isPlaying">{{
|
||||||
track.no
|
track.no
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { updateMediaSessionMetaData } from "@/utils/mediaSession";
|
import { updateMediaSessionMetaData } from "@/utils/mediaSession";
|
||||||
import { getTrackDetail, scrobble, getMP3 } from "@/api/track";
|
import { getTrackDetail, scrobble, getMP3 } from "@/api/track";
|
||||||
import { isLoggedIn } from "@/utils/auth";
|
import { isLoggedIn } from "@/utils/auth";
|
||||||
|
import { updateHttps } from "@/utils/common";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
switchTrack({ state, dispatch, commit }, basicTrack) {
|
switchTrack({ state, dispatch, commit }, basicTrack) {
|
||||||
|
@ -43,7 +44,11 @@ export default {
|
||||||
|
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
getMP3(track.id).then((data) => {
|
getMP3(track.id).then((data) => {
|
||||||
commitMP3(data.data[0].url.replace(/^http:/, "https:"));
|
// 未知情况下会没有返回数据导致报错,增加防范逻辑
|
||||||
|
if (data.data[0]) {
|
||||||
|
const url = updateHttps(data.data[0].url);
|
||||||
|
commitMP3(url);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
commitMP3(`https://music.163.com/song/media/outer/url?id=${track.id}`);
|
commitMP3(`https://music.163.com/song/media/outer/url?id=${track.id}`);
|
||||||
|
|
|
@ -70,3 +70,8 @@ export function throttle(fn, time) {
|
||||||
}, time);
|
}, time);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function updateHttps(url) {
|
||||||
|
if (!url) return "";
|
||||||
|
return url.replace(/^http:/, "https:");
|
||||||
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<input
|
<input
|
||||||
id="countryCode"
|
id="countryCode"
|
||||||
:placeholder="
|
:placeholder="
|
||||||
inputFocus === 'phone' ? '' : $t('login.countrycode')
|
inputFocus === 'phone' ? '' : $t('login.countryCode')
|
||||||
"
|
"
|
||||||
v-model="countryCode"
|
v-model="countryCode"
|
||||||
@focus="inputFocus = 'phone'"
|
@focus="inputFocus = 'phone'"
|
||||||
|
@ -262,7 +262,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
input#countryCode {
|
input#countryCode {
|
||||||
flex: 2;
|
flex: 3;
|
||||||
}
|
}
|
||||||
input#phoneNumber {
|
input#phoneNumber {
|
||||||
flex: 12;
|
flex: 12;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user