|
@@ -112,7 +112,8 @@ import { getSecondRPM, browser, getGradeCh } from "@/common/common";
|
|
|
import videoTcplayer from "@/components/video-tcplayer";
|
|
|
import MEmpty from "@/components/MEmpty";
|
|
|
import { postMessage } from "@/helpers/native-message";
|
|
|
-import { api_userMusicRemove, api_openUserMusicPage, api_userMusicStar, api_openUserMusicDetail } from "./api";
|
|
|
+import { sessionStorage as storage } from "js-storage";
|
|
|
+import { api_userMusicRemove, api_openUserMusicPage, api_userMusicStar, api_openUserMusicDetail, api_verification } from "./api";
|
|
|
import LoginModel from "./login-model";
|
|
|
const audioDom = new Audio();
|
|
|
audioDom.controls = true;
|
|
@@ -153,45 +154,7 @@ export default {
|
|
|
},
|
|
|
async mounted() {
|
|
|
document.title = "作品详情";
|
|
|
- try {
|
|
|
- const res = await api_openUserMusicDetail(this.id);
|
|
|
-
|
|
|
- this.musicDetail = res.data || {};
|
|
|
-
|
|
|
- this.getStarList();
|
|
|
- // 判断是视频还是音频
|
|
|
- if (res.data.videoUrl.lastIndexOf("mp4") !== -1) {
|
|
|
- this.playType = "Video";
|
|
|
- } else {
|
|
|
- this.playType = "Audio";
|
|
|
- // 初始化
|
|
|
- this.$nextTick(() => {
|
|
|
- this.initAudio();
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
- //
|
|
|
- if (e.code === 999) {
|
|
|
- this.messageStatus = true;
|
|
|
- this.message = e.msg;
|
|
|
- // this.$dialog
|
|
|
- // .alert({
|
|
|
- // message: e.msg,
|
|
|
- // theme: "round-button",
|
|
|
- // confirmButtonColor: "#2DC7AA",
|
|
|
- // })
|
|
|
- // .then(() => {
|
|
|
- // if (browser().isApp) {
|
|
|
- // postMessage({
|
|
|
- // api: "goBack",
|
|
|
- // });
|
|
|
- // } else {
|
|
|
- // this.$router.back();
|
|
|
- // }
|
|
|
- // });
|
|
|
- // return;
|
|
|
- }
|
|
|
- }
|
|
|
+ this.__init();
|
|
|
|
|
|
// window.onpagehide = function() {
|
|
|
// if (audioDom) {
|
|
@@ -235,6 +198,36 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ async __init() {
|
|
|
+ if (!this.loginTag) {
|
|
|
+ storage.remove("token");
|
|
|
+ window.localStorage.removeItem("userInfo"); // 删除用户信息
|
|
|
+ window.localStorage.removeItem("Authorization"); // 删除用户信息
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const res = await api_openUserMusicDetail(this.id);
|
|
|
+
|
|
|
+ this.musicDetail = res.data || {};
|
|
|
+
|
|
|
+ this.getStarList();
|
|
|
+ // 判断是视频还是音频
|
|
|
+ if (res.data.videoUrl.lastIndexOf("mp4") !== -1) {
|
|
|
+ this.playType = "Video";
|
|
|
+ } else {
|
|
|
+ this.playType = "Audio";
|
|
|
+ // 初始化
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.initAudio();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ //
|
|
|
+ if (e.code === 999) {
|
|
|
+ this.messageStatus = true;
|
|
|
+ this.message = e.msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
onDetail(item) {
|
|
|
if (audioDom) {
|
|
|
audioDom.currentTime = 0;
|
|
@@ -392,7 +385,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- $router(to) {
|
|
|
+ $route(to) {
|
|
|
this.id = to.query.id;
|
|
|
this.playType = "";
|
|
|
this.params.page = 1;
|