commit | author | age
|
56a4b8
|
1 |
<template> |
0b0125
|
2 |
<div class="article-meta"> |
7b98c8
|
3 |
<div> |
I |
4 |
<a-button @click="back" style="position: absolute;"> |
|
5 |
<a-icon type="left" /> |
|
6 |
</a-button> |
|
7 |
</div> |
|
8 |
|
00e46d
|
9 |
<div v-if="showMsg && !myLock"> |
105729
|
10 |
<div class="mySecretSamll" v-if="articleFileType==myConstant.fileTypeShort"> |
af029b
|
11 |
<p>碎碎念只有那么一点了,但是下面依旧可以碎碎念</p> |
944ca6
|
12 |
</div> |
I |
13 |
<div class="mySecret" v-else> |
|
14 |
<h1>怎样才能让你看到我呢</h1> |
|
15 |
<h1>只要你要,只要我有...</h1> |
00e46d
|
16 |
<span class="myTip">{{errorMsg}}</span> |
944ca6
|
17 |
</div> |
7b98c8
|
18 |
</div> |
28d46d
|
19 |
|
7b98c8
|
20 |
<div v-else> |
I |
21 |
<div class="mySecret" v-if="myLock"> |
|
22 |
<h1>越不正经的人越深情..</h1> |
|
23 |
<h3>受庇护的文字..输入神秘代码以解除封印</h3> |
28d46d
|
24 |
|
I |
25 |
<a-auto-complete v-model="secret" ref="mySearch" v-bind="search" @blur="pressEnter"> |
|
26 |
<a-input-password @pressEnter="pressEnter"> |
7b98c8
|
27 |
<a-icon slot="prefix" type="lock" style="color:rgba(0,0,0,.25)" /> |
I |
28 |
</a-input-password> |
|
29 |
</a-auto-complete> |
28d46d
|
30 |
<span class="myTip">{{errorMsg}}</span> |
7b98c8
|
31 |
</div> |
I |
32 |
|
|
33 |
<div class="markdown-body article-detail" v-else> |
|
34 |
<vue-markdown :source="source"></vue-markdown> |
|
35 |
</div> |
56a4b8
|
36 |
</div> |
af029b
|
37 |
<div class="articleInfoMiniData"> |
ec6f20
|
38 |
<div class="smallOption" @click="articleOptionHandle('dislike')"> |
I |
39 |
<a-icon type="dislike" style="margin-top: 2px;" /> |
0b0125
|
40 |
</div> |
I |
41 |
<div> |
|
42 |
<a-icon type="read" class="samllPadding" /> |
|
43 |
<span>{{articelMeta.readCount==null?'--':articelMeta.readCount}}</span> |
|
44 |
</div> |
ec6f20
|
45 |
<div class="smallOption" @click="articleOptionHandle('like')"> |
I |
46 |
<a-icon type="like" class="samllPadding" /> |
|
47 |
<span>{{articelMeta.likeCount==null?'0':articelMeta.likeCount}}</span> |
0b0125
|
48 |
</div> |
I |
49 |
<div> |
|
50 |
<!-- <a-icon type="folder-open" class="samllPadding" /> --> |
|
51 |
<a-icon type="book" class="samllPadding" /> |
|
52 |
<span>{{articelMeta.articleTypeName==null?'--':articelMeta.articleTypeName}}</span> |
|
53 |
</div> |
|
54 |
<div> |
|
55 |
<a-icon type="calendar" class="samllPadding" /> |
|
56 |
<span>{{articelMeta.publishDate==null?'--':articelMeta.publishDate}}</span> |
|
57 |
</div> |
846bd0
|
58 |
</div> |
0b0125
|
59 |
<div class="articleComment"> |
I |
60 |
<comment ref="myComment" :articleId="articleId" :isAllowedComment="isAllowedComment" /> |
|
61 |
</div> |
|
62 |
|
56a4b8
|
63 |
</div> |
28d46d
|
64 |
|
56a4b8
|
65 |
</template> |
I |
66 |
|
|
67 |
<script> |
|
68 |
import VueMarkdown from 'vue-markdown' |
28d46d
|
69 |
import md5 from 'js-md5'; |
I |
70 |
|
|
71 |
import { |
|
72 |
queryBlogArticleDetail |
|
73 |
} from '../../api/blogArticle.js' |
846bd0
|
74 |
import comment from "../mini/box12-comment.vue" |
28d46d
|
75 |
|
I |
76 |
import axios from 'axios' |
105729
|
77 |
import myConstant from "../../config/myConstant.js" |
af029b
|
78 |
|
56a4b8
|
79 |
export default { |
I |
80 |
components: { |
846bd0
|
81 |
VueMarkdown, |
I |
82 |
comment |
56a4b8
|
83 |
}, |
I |
84 |
data() { |
|
85 |
return { |
af029b
|
86 |
myConstant: myConstant, |
0b0125
|
87 |
articelMeta: "", |
I |
88 |
isAllowedComment: 1, |
5dfef8
|
89 |
articleId: "", |
105729
|
90 |
articleFileType: myConstant.fileTypeMarkDown, |
0b0125
|
91 |
source: "", |
28d46d
|
92 |
showMsg: false, |
I |
93 |
myLock: false, |
|
94 |
errorMsg: '', |
7b98c8
|
95 |
secret: '', |
I |
96 |
search: { |
|
97 |
placeholder: "", |
0b0125
|
98 |
autoFocus: false, |
7b98c8
|
99 |
backfill: true, |
I |
100 |
value: '', |
|
101 |
disabled: false |
|
102 |
}, |
56a4b8
|
103 |
} |
I |
104 |
}, |
7b98c8
|
105 |
created() { |
5dfef8
|
106 |
this.articleId = this.$route.query.id; |
944ca6
|
107 |
this.articleFileType = this.$route.query.articleFileType; |
7b98c8
|
108 |
}, |
I |
109 |
watch: { |
|
110 |
'$route'(to, from) { |
28d46d
|
111 |
if ("mdDetail" === to.name) { |
5dfef8
|
112 |
this.articleId = this.$route.query.id; |
944ca6
|
113 |
this.articleFileType = this.$route.query.articleFileType; |
7b98c8
|
114 |
} |
28d46d
|
115 |
}, |
5dfef8
|
116 |
articleId: function(newValue, oldValue) { |
28d46d
|
117 |
if (newValue == undefined || newValue == null || newValue == "") { |
I |
118 |
this.showMsg = true; |
|
119 |
this.errorMsg = "日志id参数缺失"; |
|
120 |
} else { |
|
121 |
this.queryDetail(); |
5dfef8
|
122 |
this.$refs.myComment.updateCommentList(this.articleId); |
28d46d
|
123 |
} |
0b0125
|
124 |
}, |
7b98c8
|
125 |
}, |
56a4b8
|
126 |
methods: { |
0b0125
|
127 |
articleOptionHandle(type) { |
I |
128 |
this.$message.info(type) |
|
129 |
}, |
28d46d
|
130 |
queryDetail() { |
4b854c
|
131 |
this.showMsg = true; |
I |
132 |
this.errorMsg = "加载中.."; |
944ca6
|
133 |
|
af029b
|
134 |
if (this.articleFileType == myConstant.fileTypeShort || |
I |
135 |
this.articleFileType == myConstant.fileTypeVideo || |
|
136 |
this.articleFileType == myConstant.fileTypeMp3) { |
|
137 |
this.errorMsg = "该类型日志在这里没有更多啦.."; |
944ca6
|
138 |
return |
I |
139 |
} |
|
140 |
|
28d46d
|
141 |
queryBlogArticleDetail({ |
5dfef8
|
142 |
id: this.articleId, |
28d46d
|
143 |
authWord: this.secret == "" ? null : md5(this.secret) |
I |
144 |
}).then((res) => { |
|
145 |
this.showMsg = true; |
|
146 |
this.myLock = false; |
|
147 |
this.errorMsg = res.message; |
|
148 |
this.source = ""; |
|
149 |
if (res.code != 200) { |
|
150 |
|
|
151 |
if (res.code == 1019001) { |
|
152 |
//日志需要授权 |
|
153 |
this.errorMsg = ""; |
|
154 |
this.myLock = true; |
|
155 |
} else if (res.code == 1019002) { |
|
156 |
//授权码错误 |
|
157 |
this.errorMsg = "口令错误..神秘力量依然阻止了你的前进"; |
|
158 |
this.myLock = true; |
|
159 |
} else { |
|
160 |
this.$notification.error({ |
|
161 |
message: '好像哪里不对劲..', |
|
162 |
description: res.message, |
|
163 |
placement: 'bottomRight' |
|
164 |
}); |
|
165 |
} |
|
166 |
return |
|
167 |
} |
0b0125
|
168 |
// this.test = res.data.isAllowedComment == 1 ? true : false; |
28d46d
|
169 |
|
0b0125
|
170 |
this.isAllowedComment = res.data.isAllowedComment; |
I |
171 |
this.articelMeta = res.data; |
28d46d
|
172 |
this.$axios |
I |
173 |
.get(res.data.articleFileURL) |
|
174 |
.then((res) => { |
|
175 |
this.source = res.data; |
|
176 |
}) |
c23efb
|
177 |
|
I |
178 |
//获取日志资源文件 |
|
179 |
this.showMsg = false; |
|
180 |
this.errorMsg = ""; |
28d46d
|
181 |
}) |
I |
182 |
}, |
|
183 |
pressEnter() { |
7b98c8
|
184 |
if (this.secret == "") { |
I |
185 |
return |
|
186 |
} |
|
187 |
this.search.disabled = true |
28d46d
|
188 |
this.source = ""; |
7b98c8
|
189 |
this.$message |
28d46d
|
190 |
.loading('卍解..', 1) |
7b98c8
|
191 |
.then(() => { |
28d46d
|
192 |
this.queryDetail(); |
7b98c8
|
193 |
this.search.disabled = false; |
I |
194 |
}) |
|
195 |
|
|
196 |
}, |
56a4b8
|
197 |
back: function() { |
af029b
|
198 |
this.$router.back(-1); |
56a4b8
|
199 |
} |
I |
200 |
}, |
c23efb
|
201 |
|
56a4b8
|
202 |
} |
I |
203 |
</script> |
|
204 |
|
b505f3
|
205 |
<style lang="less"> |
I |
206 |
@import '../../assets/md.less'; |
56a4b8
|
207 |
|
0b0125
|
208 |
|
I |
209 |
.smallOption { |
|
210 |
transition-function: ease-out; |
|
211 |
transition-duration: 200ms; |
|
212 |
-webkit-transition-function: ease-out; |
|
213 |
-webkit-transition-duration: 200ms; |
|
214 |
-moztransition-function: ease-out; |
|
215 |
-moztransition-duration: 200ms; |
|
216 |
-o-transition-function: ease-out; |
|
217 |
-o-transition-duration: 200ms; |
|
218 |
} |
|
219 |
|
|
220 |
.smallOption:hover { |
|
221 |
transform: scale(1.55, 1.55); |
|
222 |
-webkit-transform: scale(1.55, 1.55); |
|
223 |
-moz-transform: scale(1.55, 1.55); |
|
224 |
-o-transform: scale(1.55, 1.55); |
|
225 |
} |
|
226 |
|
|
227 |
.articleInfoMiniData { |
|
228 |
user-select: none; |
|
229 |
box-shadow: 8px 8px 18px rgba(0, 0, 0, 0.1), -8px -8px 18px #ffffff; |
|
230 |
padding: 10px 50px; |
|
231 |
display: flex; |
|
232 |
justify-content: space-between; |
|
233 |
flex-wrap: wrap; |
|
234 |
} |
|
235 |
|
7b98c8
|
236 |
.mySecret { |
I |
237 |
height: 715px; |
|
238 |
display: flex; |
|
239 |
flex-direction: column; |
|
240 |
justify-content: center; |
|
241 |
padding-left: auto; |
|
242 |
align-items: center; |
|
243 |
} |
00e46d
|
244 |
|
944ca6
|
245 |
.mySecretSamll { |
I |
246 |
height: 115px; |
|
247 |
display: flex; |
|
248 |
flex-direction: column; |
|
249 |
justify-content: center; |
|
250 |
padding-left: auto; |
|
251 |
align-items: center; |
|
252 |
} |
7b98c8
|
253 |
|
846bd0
|
254 |
|
I |
255 |
.markdown-body, |
|
256 |
.articleComment { |
859ec7
|
257 |
min-height: 70%; |
I |
258 |
padding: 35px 20px 30px 20px; |
b505f3
|
259 |
box-shadow: 8px 8px 18px rgba(0, 0, 0, 0.1), |
I |
260 |
-8px -8px 18px #ffffff; |
|
261 |
} |
56a4b8
|
262 |
|
I |
263 |
/* #test{ |
|
264 |
padding-left: 25%; |
|
265 |
padding-right: 25%; |
|
266 |
} */ |
|
267 |
/* h3 { |
|
268 |
margin: 40px 0 0; |
|
269 |
} |
|
270 |
|
|
271 |
ul { |
|
272 |
list-style-type: none; |
|
273 |
padding: 0; |
|
274 |
} |
|
275 |
|
|
276 |
li { |
|
277 |
display: inline-block; |
|
278 |
margin: 0 10px; |
|
279 |
} |
|
280 |
|
|
281 |
a { |
|
282 |
color: #42b983; |
|
283 |
} |
|
284 |
|
|
285 |
*/ |
|
286 |
|
|
287 |
|
|
288 |
/* 自己也可以再调整调整 (贡献一版 我们调整的一版样式) */ |
|
289 |
/* .markdown-body { |
|
290 |
padding: 20px; |
|
291 |
min-width: 200px; |
|
292 |
max-width: 900px; |
|
293 |
font-size: 12px; |
|
294 |
|
|
295 |
h2 { |
|
296 |
font-size: 18px; |
|
297 |
margin: 1em 0 15px; |
|
298 |
padding-top: 0.8em; |
|
299 |
padding-bottom: 0.8em; |
|
300 |
} |
|
301 |
|
|
302 |
h3 { |
|
303 |
font-size: 14px; |
|
304 |
margin: 22px 0 16px; |
|
305 |
} |
|
306 |
|
|
307 |
h4 { |
|
308 |
font-size: 13px; |
|
309 |
margin: 20px 0 16px; |
|
310 |
} |
|
311 |
|
|
312 |
h5 { |
|
313 |
font-size: 12px; |
|
314 |
margin: 16px 0 16px; |
|
315 |
font-weight: 700; |
|
316 |
} |
|
317 |
|
|
318 |
p { |
|
319 |
font-size: 12px; |
|
320 |
line-height: 24px; |
|
321 |
color: #666666; |
|
322 |
margin-top: 0px; |
|
323 |
margin: 8px 0; |
|
324 |
margin: 14px 0 14px; |
|
325 |
} |
|
326 |
|
|
327 |
pre { |
|
328 |
background-color: #eee; |
|
329 |
margin-bottom: 8px; |
|
330 |
margin-top: 8px; |
|
331 |
margin: 12px 0 12px; |
|
332 |
} |
|
333 |
|
|
334 |
blockquote { |
|
335 |
margin-bottom: 8px; |
|
336 |
margin-top: 8px; |
|
337 |
margin: 14px 0 14px; |
|
338 |
background-color: #eee; |
|
339 |
padding: 16px 16px; |
|
340 |
} |
|
341 |
|
|
342 |
tr { |
|
343 |
background-color: #f5f5f5; |
|
344 |
} |
|
345 |
|
|
346 |
code { |
|
347 |
background-color: #eee; |
|
348 |
} |
|
349 |
|
|
350 |
ul, |
|
351 |
ol, |
|
352 |
li { |
|
353 |
list-style: unset; |
|
354 |
font-size: 12px; |
|
355 |
line-height: 20px; |
|
356 |
color: #666666; |
|
357 |
margin-top: 0px; |
|
358 |
margin: 8px 0; |
|
359 |
} |
|
360 |
|
|
361 |
blockquote { |
|
362 |
border-color: #48b6e2; |
|
363 |
} |
|
364 |
|
|
365 |
table { |
|
366 |
display: table; |
|
367 |
width: 100%; |
|
368 |
max-width: 100%; |
|
369 |
margin-bottom: 20px; |
|
370 |
} |
|
371 |
} */ |
|
372 |
</style> |