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