commit | author | age
|
859ec7
|
1 |
<template> |
1cf6d9
|
2 |
<div class="boxMain"> |
I |
3 |
<div class=" playBox" v-bind:class="{ fadeInLeft: this.$attrs.showFade,fade: !this.$attrs.showFade }"> |
e4f086
|
4 |
<videoPlayBox ref="videoPlayBox" @swichPlay="swichPlay"></videoPlayBox> |
af029b
|
5 |
</div> |
1cf6d9
|
6 |
<div v-bind:class="{ fadeInRight: this.$attrs.showFade,fade: !this.$attrs.showFade }"> |
I |
7 |
<div class="introduce myShadow" v-if="introduce!=''"> |
|
8 |
<pre style="white-space: pre-line;">{{introduce}}</pre> |
|
9 |
</div> |
|
10 |
<div class="articleComment "> |
|
11 |
<comment ref="myComment" :articleId="articleId" :isAllowedComment="isAllowedComment" |
|
12 |
:foldReply="true" /> |
|
13 |
</div> |
af029b
|
14 |
</div> |
859ec7
|
15 |
</div> |
I |
16 |
|
|
17 |
</template> |
|
18 |
|
|
19 |
<script> |
|
20 |
import { |
|
21 |
history |
|
22 |
} from '../../api/blogArticleComment.js' |
|
23 |
import videoPlayBox from "../mini/box15-videoPlayBox.vue" |
|
24 |
import comment from "../mini/box12-comment.vue" |
af029b
|
25 |
|
I |
26 |
import { |
|
27 |
queryBlogArticleDetail |
|
28 |
} from '../../api/blogArticle.js' |
859ec7
|
29 |
|
I |
30 |
export default { |
|
31 |
components: { |
|
32 |
videoPlayBox, |
|
33 |
comment, |
|
34 |
}, |
|
35 |
watch: { |
|
36 |
// '$route'(to, from) { |
|
37 |
// if ("mdDetail" === to.name) { |
|
38 |
// this.articleId = this.$route.query.id; |
|
39 |
// this.articleFileType = this.$route.query.articleFileType; |
|
40 |
// } |
|
41 |
// }, |
|
42 |
articleId: function(newValue, oldValue) { |
|
43 |
if (newValue == undefined || newValue == null || newValue == "") { |
|
44 |
this.errorMsg = "日志id参数缺失"; |
|
45 |
} else { |
1cf6d9
|
46 |
if (this.newValue != this.oldValue) { |
I |
47 |
this.$nextTick(function() { |
|
48 |
this.$refs.myComment.updateCommentList(this.articleId); |
|
49 |
}) |
|
50 |
} |
859ec7
|
51 |
} |
I |
52 |
}, |
|
53 |
}, |
|
54 |
data() { |
|
55 |
return { |
|
56 |
articleId: "", |
af029b
|
57 |
lastArticleId: "", |
I |
58 |
isAllowedComment: false, |
|
59 |
introduce: "", |
|
60 |
secret: "", |
|
61 |
myLock: false, |
1cf6d9
|
62 |
showFade: true, |
af029b
|
63 |
videoData: { |
I |
64 |
img: "http://t.inleft.com/share/media_photo/idea_beijing.jpg", |
|
65 |
url: "", |
0dd41b
|
66 |
type: "normal", |
I |
67 |
title: "", |
e4f086
|
68 |
introduce: "", |
0dd41b
|
69 |
id: "" |
af029b
|
70 |
} |
859ec7
|
71 |
} |
I |
72 |
}, |
|
73 |
methods: { |
e4f086
|
74 |
swichPlay(videoData) { |
I |
75 |
this.introduce = videoData.introduce; |
1cf6d9
|
76 |
this.articleId = videoData.id |
e4f086
|
77 |
this.$refs.myComment.updateCommentList(videoData.id); |
I |
78 |
}, |
af029b
|
79 |
showVideo(item) { |
0dd41b
|
80 |
//防止重复加载 |
af029b
|
81 |
this.lastArticleId = this.articleId; |
I |
82 |
this.articleId = item.id |
0dd41b
|
83 |
|
I |
84 |
if (this.articleId == this.lastArticleId) { |
|
85 |
return |
|
86 |
} |
|
87 |
|
|
88 |
this.isAllowedComment = item.isAllowedComment; |
|
89 |
this.introduce = item.introduce; |
|
90 |
this.loadData(); |
859ec7
|
91 |
}, |
af029b
|
92 |
loadData() { |
e4f086
|
93 |
|
I |
94 |
if (this.$refs.videoPlayBox.isPlaying) { |
1cf6d9
|
95 |
this.$message.info("视频源已切换..", 6) |
e4f086
|
96 |
} |
af029b
|
97 |
|
I |
98 |
if (this.myLock) { |
|
99 |
this.$message.info("正在努力加载中..", 3) |
|
100 |
return |
|
101 |
} |
|
102 |
|
|
103 |
let _this = this; |
|
104 |
queryBlogArticleDetail({ |
|
105 |
id: this.articleId, |
|
106 |
authWord: this.secret == "" ? null : md5(this.secret) |
|
107 |
}).then((res) => { |
0dd41b
|
108 |
this.myLock = !this.myLock; |
af029b
|
109 |
|
I |
110 |
if (res.code != 200) { |
|
111 |
|
|
112 |
if (res.code == 1019001) { |
|
113 |
//日志需要授权 |
|
114 |
this.$message.error(res.message) |
|
115 |
} else if (res.code == 1019002) { |
|
116 |
|
|
117 |
this.$message.error(res.message) |
|
118 |
} else { |
|
119 |
this.$notification.error({ |
|
120 |
message: '好像哪里不对劲..', |
|
121 |
description: res.message, |
|
122 |
placement: 'bottomRight' |
|
123 |
}); |
|
124 |
} |
|
125 |
return |
|
126 |
} |
|
127 |
|
|
128 |
this.isAllowedComment = res.data.isAllowedComment; |
|
129 |
this.videoData.url = res.data.articleFileURL; |
|
130 |
this.videoData.img = res.data.coverFileURL; |
0dd41b
|
131 |
this.videoData.title = res.data.title; |
e4f086
|
132 |
this.videoData.introduce = res.data.introduce; |
0dd41b
|
133 |
this.videoData.id = res.data.id; |
I |
134 |
|
|
135 |
|
af029b
|
136 |
if (res.data.articleFileURL != null && |
I |
137 |
res.data.articleFileURL != "" && |
|
138 |
res.data.articleFileURL.endsWith("m3u8")) { |
|
139 |
this.videoData.type = "customHls"; |
|
140 |
} else { |
|
141 |
this.videoData.type = "normal"; |
|
142 |
} |
|
143 |
|
0dd41b
|
144 |
this.myLock = !this.myLock; |
af029b
|
145 |
if (this.lastArticleId != this.articleId) { |
e4f086
|
146 |
let tempParam = JSON.parse(JSON.stringify(this.videoData)) |
I |
147 |
_this.$refs.videoPlayBox.startPlay(tempParam) |
af029b
|
148 |
} |
I |
149 |
}) |
|
150 |
|
|
151 |
} |
859ec7
|
152 |
}, |
I |
153 |
} |
|
154 |
</script> |
|
155 |
<style scoped> |
|
156 |
a { |
|
157 |
color: black; |
|
158 |
} |
|
159 |
|
af029b
|
160 |
pre { |
I |
161 |
font-family: 'HYTangMeiRen'; |
|
162 |
src: url("http://t.inleft.com/share/z%E5%AD%97%E4%BD%93%E5%BA%93/hytmr55%E6%B1%89%E4%BB%AA%E5%94%90%E7%BE%8E%E4%BA%BA%E5%AD%97%E4%BD%93.woff") format("truetype"); |
|
163 |
} |
|
164 |
|
859ec7
|
165 |
.boxMain { |
e4f086
|
166 |
user-select: none; |
1cf6d9
|
167 |
grid-template-columns: repeat(2, 1fr); |
I |
168 |
display: grid; |
|
169 |
clear: both; |
|
170 |
gap: 2rem; |
|
171 |
max-height: 100%; |
|
172 |
} |
|
173 |
|
|
174 |
.playBox { |
859ec7
|
175 |
display: flex; |
I |
176 |
justify-content: center; |
1cf6d9
|
177 |
padding: 20px 0px; |
af029b
|
178 |
} |
I |
179 |
|
|
180 |
.myShadow { |
|
181 |
|
|
182 |
box-shadow: 8px 8px 18px rgba(0, 0, 0, 0.1), |
|
183 |
-8px -8px 18px #ffffff; |
859ec7
|
184 |
} |
1cf6d9
|
185 |
|
I |
186 |
.introduce { |
|
187 |
padding: 20px 20px 5px; |
|
188 |
margin-bottom: 20px; |
|
189 |
} |
|
190 |
|
|
191 |
@media screen and (max-width: 1023px) { |
|
192 |
.boxMain { |
|
193 |
grid-template-columns: repeat(1, 1fr); |
|
194 |
gap: 0rem; |
|
195 |
} |
|
196 |
|
|
197 |
} |
|
198 |
|
859ec7
|
199 |
</style> |