Merge branch 'master' into electron

master
kunkka 4 years ago
commit 47311b20ad

@ -1,6 +1,5 @@
build build
coverage coverage
dist dist
NeteaseCloudMusicApi-master napi
NeteaseCloudMusicApi-master.zip

@ -13,6 +13,7 @@ export function mvDetail(mvid) {
method: "get", method: "get",
params: { params: {
mvid, mvid,
timestamp: new Date().getTime(),
}, },
}); });
} }
@ -27,7 +28,6 @@ export function mvDetail(mvid) {
* @param {number} params.id * @param {number} params.id
* @param {number=} params.r * @param {number=} params.r
*/ */
export function mvUrl(params) { export function mvUrl(params) {
return request({ return request({
url: "/mv/url", url: "/mv/url",
@ -35,6 +35,7 @@ export function mvUrl(params) {
params, params,
}); });
} }
/** /**
* 相似 mv * 相似 mv
* 说明 : 调用此接口 , 传入 mvid 可获取相似 mv * 说明 : 调用此接口 , 传入 mvid 可获取相似 mv
@ -47,3 +48,22 @@ export function simiMv(mvid) {
params: { mvid }, params: { mvid },
}); });
} }
/**
* 收藏/取消收藏 MV
* 说明 : 调用此接口,可收藏/取消收藏 MV
* - mvid: mv id
* - t: 1 为收藏,其他为取消收藏
* @param {Object} params
* @param {number} params.mvid
* @param {number=} params.t
*/
export function likeAMV(params) {
params.timestamp = new Date().getTime();
return request({
url: "/mv/sub",
method: "post",
params,
});
}

@ -74,7 +74,7 @@ export default {
artistName = mv.creator[0].userName; artistName = mv.creator[0].userName;
artistID = mv.creator[0].userId; artistID = mv.creator[0].userId;
} }
return `<a href="/artist/${artistID}">${artistName}</a>`; return `<a href="/#/artist/${artistID}">${artistName}</a>`;
} else if (this.subtitle === "publishTime") { } else if (this.subtitle === "publishTime") {
return mv.publishTime; return mv.publishTime;
} }

@ -35,6 +35,8 @@ export default {
withAlbums: "Albums", withAlbums: "Albums",
artist: "Artist", artist: "Artist",
videos: "Music Videos", videos: "Music Videos",
following: "Following",
follow: "Follow"
}, },
album: { album: {
released: "Released", released: "Released",

@ -32,6 +32,8 @@ export default {
withAlbums: "张专辑", withAlbums: "张专辑",
artist: "歌手", artist: "歌手",
videos: "个MV", videos: "个MV",
following: "已关注",
follow: "关注"
}, },
album: { album: {
released: "发行于", released: "发行于",

@ -17,8 +17,8 @@
{{ $t("play") }} {{ $t("play") }}
</ButtonTwoTone> </ButtonTwoTone>
<ButtonTwoTone @click.native="followArtist" color="grey"> <ButtonTwoTone @click.native="followArtist" color="grey">
<span v-if="artist.followed">Following</span> <span v-if="artist.followed">{{ $t("artist.following") }}</span>
<span v-else>Follow</span> <span v-else>{{ $t("artist.follow") }}</span>
</ButtonTwoTone> </ButtonTwoTone>
</div> </div>
</div> </div>
@ -84,7 +84,7 @@
<div class="section-title">MVs</div> <div class="section-title">MVs</div>
<MvRow :mvs="mvs" subtitle="publishTime" /> <MvRow :mvs="mvs" subtitle="publishTime" />
</div> </div>
<div class="eps"> <div class="eps" v-if="eps.length !== 0">
<div class="section-title">{{ $t("artist.EPsSingles") }}</div> <div class="section-title">{{ $t("artist.EPsSingles") }}</div>
<CoverRow <CoverRow
:type="'album'" :type="'album'"
@ -305,7 +305,6 @@ export default {
font-weight: 600; font-weight: 600;
&:hover { &:hover {
opacity: 1; opacity: 1;
// background: var(--color-primary-bg);
} }
} }
} }

@ -11,6 +11,12 @@
}}</router-link> }}</router-link>
- -
{{ mv.data.name }} {{ mv.data.name }}
<div class="like-button" v-show="accountLogin">
<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>
</button-icon>
</div>
</div> </div>
<div class="info"> <div class="info">
{{ mv.data.playCount | formatPlayCount }} Views · {{ mv.data.playCount | formatPlayCount }} Views ·
@ -26,17 +32,20 @@
</template> </template>
<script> <script>
import { mvDetail, mvUrl, simiMv, likeAMV } from "@/api/mv";
import { isAccountLoggedIn } from "@/utils/auth";
import NProgress from "nprogress"; import NProgress from "nprogress";
import { mvDetail, mvUrl, simiMv } from "@/api/mv";
import Plyr from "plyr";
import "@/assets/css/plyr.css"; import "@/assets/css/plyr.css";
import Plyr from "plyr";
import ButtonIcon from "@/components/ButtonIcon.vue";
import MvRow from "@/components/MvRow.vue"; import MvRow from "@/components/MvRow.vue";
export default { export default {
name: "mv", name: "mv",
components: { components: {
MvRow, MvRow,
ButtonIcon,
}, },
data() { data() {
return { return {
@ -53,6 +62,11 @@ export default {
simiMvs: [], simiMvs: [],
}; };
}, },
computed: {
accountLogin() {
return isAccountLoggedIn();
},
},
methods: { methods: {
getData(id) { getData(id) {
mvDetail(id).then((data) => { mvDetail(id).then((data) => {
@ -81,6 +95,14 @@ export default {
this.simiMvs = data.mvs; this.simiMvs = data.mvs;
}); });
}, },
likeMV() {
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() { mounted() {
let videoOptions = { let videoOptions = {
@ -154,4 +176,13 @@ export default {
opacity: 0.88; opacity: 0.88;
} }
} }
.like-button {
display: inline-block;
.svg-icon {
height: 18px;
width: 18px;
color: var(--color-primary);
}
}
</style> </style>

Loading…
Cancel
Save