mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 13:17:46 +00:00
chore: format codes
This commit is contained in:
parent
6922c716e2
commit
9351f6bc89
73 changed files with 2321 additions and 2321 deletions
132
src/views/mv.vue
132
src/views/mv.vue
|
|
@ -13,8 +13,8 @@
|
|||
{{ mv.data.name }}
|
||||
<div class="like-button">
|
||||
<button-icon @click.native="likeMV">
|
||||
<svg-icon icon-class="heart-solid" v-if="mv.subed"></svg-icon>
|
||||
<svg-icon icon-class="heart" v-else></svg-icon>
|
||||
<svg-icon v-if="mv.subed" icon-class="heart-solid"></svg-icon>
|
||||
<svg-icon v-else icon-class="heart"></svg-icon>
|
||||
</button-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -25,107 +25,107 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="more-video">
|
||||
<div class="section-title">{{ $t("mv.moreVideo") }}</div>
|
||||
<div class="section-title">{{ $t('mv.moreVideo') }}</div>
|
||||
<MvRow :mvs="simiMvs" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mvDetail, mvUrl, simiMv, likeAMV } from "@/api/mv";
|
||||
import { isAccountLoggedIn } from "@/utils/auth";
|
||||
import NProgress from "nprogress";
|
||||
import "@/assets/css/plyr.css";
|
||||
import Plyr from "plyr";
|
||||
import { mvDetail, mvUrl, simiMv, likeAMV } from '@/api/mv';
|
||||
import { isAccountLoggedIn } from '@/utils/auth';
|
||||
import NProgress from 'nprogress';
|
||||
import '@/assets/css/plyr.css';
|
||||
import Plyr from 'plyr';
|
||||
|
||||
import ButtonIcon from "@/components/ButtonIcon.vue";
|
||||
import MvRow from "@/components/MvRow.vue";
|
||||
import { mapActions } from "vuex";
|
||||
import ButtonIcon from '@/components/ButtonIcon.vue';
|
||||
import MvRow from '@/components/MvRow.vue';
|
||||
import { mapActions } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: "mv",
|
||||
name: 'mv',
|
||||
components: {
|
||||
MvRow,
|
||||
ButtonIcon,
|
||||
},
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
this.getData(to.params.id);
|
||||
next();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
mv: {
|
||||
url: "",
|
||||
url: '',
|
||||
data: {
|
||||
name: "",
|
||||
artistName: "",
|
||||
playCount: "",
|
||||
publishTime: "",
|
||||
name: '',
|
||||
artistName: '',
|
||||
playCount: '',
|
||||
publishTime: '',
|
||||
},
|
||||
},
|
||||
player: null,
|
||||
simiMvs: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
...mapActions(["showToast"]),
|
||||
getData(id) {
|
||||
mvDetail(id).then((data) => {
|
||||
this.mv = data;
|
||||
let requests = data.data.brs.map((br) => {
|
||||
return mvUrl({ id, r: br.br });
|
||||
});
|
||||
Promise.all(requests).then((results) => {
|
||||
let sources = results.map((result) => {
|
||||
return {
|
||||
src: result.data.url.replace(/^http:/, "https:"),
|
||||
type: "video/mp4",
|
||||
size: result.data.r,
|
||||
};
|
||||
});
|
||||
this.player.source = {
|
||||
type: "video",
|
||||
title: this.mv.data.name,
|
||||
sources: sources,
|
||||
poster: this.mv.data.cover.replace(/^http:/, "https:"),
|
||||
};
|
||||
NProgress.done();
|
||||
});
|
||||
});
|
||||
simiMv(id).then((data) => {
|
||||
this.simiMvs = data.mvs;
|
||||
});
|
||||
},
|
||||
likeMV() {
|
||||
if (!isAccountLoggedIn()) {
|
||||
this.showToast("此操作需要登录网易云账号");
|
||||
return;
|
||||
}
|
||||
likeAMV({
|
||||
mvid: this.mv.data.id,
|
||||
t: this.mv.subed ? 0 : 1,
|
||||
}).then((data) => {
|
||||
if (data.code === 200) this.mv.subed = !this.mv.subed;
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
let videoOptions = {
|
||||
settings: ["quality"],
|
||||
settings: ['quality'],
|
||||
autoplay: false,
|
||||
quality: {
|
||||
default: 1080,
|
||||
options: [1080, 720, 480, 240],
|
||||
},
|
||||
};
|
||||
if (this.$route.query.autoplay === "true") videoOptions.autoplay = true;
|
||||
if (this.$route.query.autoplay === 'true') videoOptions.autoplay = true;
|
||||
this.player = new Plyr(this.$refs.videoPlayer, videoOptions);
|
||||
this.player.volume = this.$store.state.player.volume;
|
||||
this.player.on("playing", () => {
|
||||
this.player.on('playing', () => {
|
||||
this.$store.state.player.pause();
|
||||
});
|
||||
this.getData(this.$route.params.id);
|
||||
console.log("网易云你这mv音频码率也太糊了吧🙄");
|
||||
console.log('网易云你这mv音频码率也太糊了吧🙄');
|
||||
},
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
this.getData(to.params.id);
|
||||
next();
|
||||
methods: {
|
||||
...mapActions(['showToast']),
|
||||
getData(id) {
|
||||
mvDetail(id).then(data => {
|
||||
this.mv = data;
|
||||
let requests = data.data.brs.map(br => {
|
||||
return mvUrl({ id, r: br.br });
|
||||
});
|
||||
Promise.all(requests).then(results => {
|
||||
let sources = results.map(result => {
|
||||
return {
|
||||
src: result.data.url.replace(/^http:/, 'https:'),
|
||||
type: 'video/mp4',
|
||||
size: result.data.r,
|
||||
};
|
||||
});
|
||||
this.player.source = {
|
||||
type: 'video',
|
||||
title: this.mv.data.name,
|
||||
sources: sources,
|
||||
poster: this.mv.data.cover.replace(/^http:/, 'https:'),
|
||||
};
|
||||
NProgress.done();
|
||||
});
|
||||
});
|
||||
simiMv(id).then(data => {
|
||||
this.simiMvs = data.mvs;
|
||||
});
|
||||
},
|
||||
likeMV() {
|
||||
if (!isAccountLoggedIn()) {
|
||||
this.showToast('此操作需要登录网易云账号');
|
||||
return;
|
||||
}
|
||||
likeAMV({
|
||||
mvid: this.mv.data.id,
|
||||
t: this.mv.subed ? 0 : 1,
|
||||
}).then(data => {
|
||||
if (data.code === 200) this.mv.subed = !this.mv.subed;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue