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