inleft
2022-08-25 a23166e4fac771238a90ae5ddc5b1e53a1c7afb8
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
c6793e 9         <div class="mySecret" v-if="myLock">
I 10             <h1>越不正经的人越深情..</h1>
11             <h3>受庇护的文字..输入神秘代码以解除封印</h3>
a3ab3a 12
c6793e 13             <a-auto-complete v-model="secret" ref="mySearch" v-bind="search" @blur="pressEnter">
I 14                 <a-input-password @pressEnter="pressEnter">
15                     <a-icon slot="prefix" type="lock" style="color:rgba(0,0,0,.25)" />
16                 </a-input-password>
17             </a-auto-complete>
18             <span class="myTip">{{errorMsg}}</span>
19         </div>
20
21         <div v-else-if="showMsg">
22             <div class="mySecret">
944ca6 23                 <h1>怎样才能让你看到我呢</h1>
I 24                 <h1>只要你要,只要我有...</h1>
00e46d 25                 <span class="myTip">{{errorMsg}}</span>
944ca6 26             </div>
7b98c8 27         </div>
28d46d 28
7b98c8 29         <div v-else>
c6793e 30             <div v-if="articleFileType==fileType.fileTypeTalking_9">
I 31                 <div class="markdown-body  articleTitle">
32                     <h4>{{articelMeta.title}}</h4>
28d46d 33
c6793e 34                     <div class="introduceSamll" v-if="introduce.length==0">
I 35                         <p>空荡荡的..我好像忘记写点什么了OωO</p>
36                     </div>
37                     <div class="introduce" v-else>
38                         <pre style="white-space: pre-line;padding: 10px;max-width: 100%;">
39                         {{introduce}}
40                         </pre>
41                     </div>
bc9518 42                 </div>
a3ab3a 43             </div>
c6793e 44
I 45             <div class="introduce"
46                 v-else-if="articleFileType==fileType.fileTypeVideo_3 || articleFileType==fileType.fileTypeMp3_4">
47                 <div class="markdown-body  articleTitle">
48                     <h4>{{articelMeta.title}}</h4>
49                 </div>
a23166 50                 <div class="playBox"
I 51                     v-bind:class="{disabledPointer:articelMeta.videoUrlList==null||articelMeta.videoUrlList==0}">
c6793e 52                     <videoPlayBox ref="videoPlayBox" :showTar="true"></videoPlayBox>
a23166 53                 </div>
I 54                 <div class="introduceSamll" v-if="articelMeta.videoUrlList==null||articelMeta.videoUrlList==0">
55                     <p>该视频资源仍未上传</p>
c6793e 56                 </div>
I 57                 <div class="introduce">
58                     <pre style="white-space: pre-line;padding: 10px;max-width: 100%;">
59                     {{introduce}}
60                     </pre>
61                 </div>
a23166 62
c6793e 63             </div>
I 64
65             <div class="introduce" v-else-if="articleFileType==fileType.fileTypePictures_5">
66                 <div class="markdown-body  articleTitle">
67                     <h4>{{articelMeta.title}}</h4>
68                 </div>
a23166 69
I 70                 <div>
71                     <div class="introduceSamll"
72                         v-if="articelMeta.pictureUrlList==null ||articelMeta.pictureUrlList.length==0">
73                         <p>空荡荡的..好像忘记传图了</p>
c6793e 74                     </div>
a23166 75                     <div class="myPicture" @click="showPicture(articelMeta.pictureUrlList)" v-else>
I 76                         <div>
77                             <img :src="articelMeta.pictureUrlList[0]" :key="articelMeta.id" alt="" loading="lazy"
78                                 :onerror="img404">
79                         </div>
80                         <div style="text-align: center;">图组数量:{{articelMeta.pictureUrlList.length}}</div>
81                     </div>
c6793e 82                 </div>
I 83                 <div class="introduce">
84                     <pre style="white-space: pre-line;padding: 10px;max-width: 100%;">
85                     {{introduce}}
86                     </pre>
87                 </div>
88             </div>
89
90             <div v-viewer.static="options" class="markdown-body " v-else>
38a800 91                 <div class="articleTitle">
I 92                     <h4>{{articelMeta.title}}</h4>
93                 </div>
a23166 94                 <vue-markdown :source="source" v-if="source.length>0"></vue-markdown>
I 95
96                 <div class="introduceSamll" v-else-if="introduce.length==0">
97                     <p>空荡荡的..我好像忘记写点什么了OωO</p>
98                 </div>
99
100                 <div class="introduce" v-else>
101                     <pre style="white-space: pre-line;padding: 10px;max-width: 100%;">
102                     {{introduce}}
103                     </pre>
104                 </div>
7b98c8 105             </div>
56a4b8 106         </div>
c6793e 107
916b6b 108         <!-- <div class="articleInfoMiniData">
I 109             <div>
110                 <a-icon type="calendar" class="samllPadding" />
111                 <span>{{articelMeta.publishDate==null?'--':articelMeta.publishDate}}</span>
112             </div>
ec6f20 113             <div class="smallOption" @click="articleOptionHandle('dislike')">
I 114                 <a-icon type="dislike" style="margin-top: 2px;" />
0b0125 115             </div>
I 116             <div>
117                 <a-icon type="read" class="samllPadding" />
118                 <span>{{articelMeta.readCount==null?'--':articelMeta.readCount}}</span>
119             </div>
ec6f20 120             <div class="smallOption" @click="articleOptionHandle('like')">
I 121                 <a-icon type="like" class="samllPadding" />
122                 <span>{{articelMeta.likeCount==null?'0':articelMeta.likeCount}}</span>
0b0125 123             </div>
I 124             <div>
125                 <a-icon type="book" class="samllPadding" />
126                 <span>{{articelMeta.articleTypeName==null?'--':articelMeta.articleTypeName}}</span>
127             </div>
916b6b 128                 <a-icon type="folder-open" class="samllPadding" />
I 129         </div> -->
130
c6793e 131         <div class="jumpURL" v-if="articelMeta.jumpURL">
I 132             外链:<a target="_blank" :href="articelMeta.jumpURL" :title="articelMeta.jumpURL">{{articelMeta.jumpURL}}</a>
133         </div>
a23166 134
937681 135         <div class="articleInfoMiniData">
c6793e 136
937681 137             <div class="myTitleDeal">
I 138                 <a-icon type="left" />
139                 <a-tooltip placement="bottomLeft" :title="'上一篇: '+articelMeta.previousRecord.title"
140                     v-if="articelMeta.previousRecord !=null">
141                     <router-link
142                         :to="{path:'/mdDetail',query:{id:articelMeta.previousRecord.id,articleFileType:articleFileType,typeId:typeId}}"
143                         class="article-title">
144                         {{articelMeta.previousRecord.title}}
145                     </router-link>
146                 </a-tooltip>
147                 <span v-else class="myTip">到顶啦..</span>
148             </div>
c6793e 149
937681 150             <div style="display: -webkit-box;">
I 151                 <div class="myTitleDeal">
152                     <a-tooltip placement="bottomLeft" :title="'下一篇: '+articelMeta.nextRecord.title"
153                         v-if="articelMeta.nextRecord !=null">
154                         <router-link
155                             :to="{path:'/mdDetail',query:{id:articelMeta.nextRecord.id,articleFileType:articleFileType,typeId:typeId}}"
156                             class="article-title">
157                             {{articelMeta.nextRecord.title}}
158                         </router-link>
159                     </a-tooltip>
160                     <span v-else class="myTip">到底啦..</span>
161                 </div>
162                 <a-icon type="right" />
163             </div>
164         </div>
165
0b0125 166         <div class="articleComment">
I 167             <comment ref="myComment" :articleId="articleId" :isAllowedComment="isAllowedComment" />
168         </div>
169
56a4b8 170     </div>
I 171 </template>
172
173 <script>
174     import VueMarkdown from 'vue-markdown'
28d46d 175     import md5 from 'js-md5';
I 176
177     import {
178         queryBlogArticleDetail
179     } from '../../api/blogArticle.js'
c6793e 180
846bd0 181     import comment from "../mini/box12-comment.vue"
28d46d 182
I 183     import axios from 'axios'
105729 184     import myConstant from "../../config/myConstant.js"
c6793e 185     import optionsConfig from "../../config/v-viewer-Config.js"
I 186     import videoPlayBox from "../mini/box15-videoPlayBox.vue"
187     import {
188         api as viewerApi
189     } from "v-viewer"
190
af029b 191
56a4b8 192     export default {
I 193         components: {
846bd0 194             VueMarkdown,
c6793e 195             comment,
I 196             videoPlayBox
56a4b8 197         },
I 198         data() {
199             return {
5dfef8 200                 articleId: "",
80476f 201                 articleFileType: myConstant.fileType.fileTypeMarkDown_1,
937681 202                 typeId: null,
c6793e 203
I 204                 fileType: myConstant.fileType,
205                 articelMeta: '',
206                 isAllowedComment: 1,
207                 coverURL: "",
208                 introduce: "",
0b0125 209                 source: "",
c6793e 210
28d46d 211                 showMsg: false,
I 212                 myLock: false,
213                 errorMsg: '',
7b98c8 214                 secret: '',
I 215                 search: {
216                     placeholder: "",
0b0125 217                     autoFocus: false,
7b98c8 218                     backfill: true,
I 219                     value: '',
220                     disabled: false
221                 },
c6793e 222                 videoData: {
a23166 223                     pic: "",
c6793e 224                     url: "",
I 225                     type: "normal",
226                     title: "",
227                     introduce: "",
228                     id: ""
229                 },
230                 options: optionsConfig,
231                 img404: myConstant.img404,
56a4b8 232             }
I 233         },
7b98c8 234         created() {
5dfef8 235             this.articleId = this.$route.query.id;
944ca6 236             this.articleFileType = this.$route.query.articleFileType;
937681 237             this.typeId = this.$route.query.typeId;
7b98c8 238         },
I 239         watch: {
240             '$route'(to, from) {
28d46d 241                 if ("mdDetail" === to.name) {
c6793e 242                     if (this.articleId != this.$route.query.id) {
I 243                         this.articleId = this.$route.query.id;
244                         this.articleFileType = this.$route.query.articleFileType;
245                         this.typeId = this.$route.query.typeId;
246                     }
7b98c8 247                 }
28d46d 248             },
5dfef8 249             articleId: function(newValue, oldValue) {
28d46d 250                 if (newValue == undefined || newValue == null || newValue == "") {
I 251                     this.showMsg = true;
252                     this.errorMsg = "日志id参数缺失";
253                 } else {
254                     this.queryDetail();
5dfef8 255                     this.$refs.myComment.updateCommentList(this.articleId);
28d46d 256                 }
0b0125 257             },
7b98c8 258         },
56a4b8 259         methods: {
0b0125 260             articleOptionHandle(type) {
I 261                 this.$message.info(type)
262             },
c6793e 263             showPicture(param) {
I 264                 viewerApi({
265                     options: this.options,
266                     images: param
267                 })
268             },
28d46d 269             queryDetail() {
4b854c 270                 this.showMsg = true;
I 271                 this.errorMsg = "加载中..";
c6793e 272                 let _this = this;
944ca6 273
28d46d 274                 queryBlogArticleDetail({
5dfef8 275                     id: this.articleId,
937681 276                     authWord: this.secret == "" ? null : md5(this.secret),
I 277                     typeId: this.typeId,
278                     fileType: this.articleFileType
28d46d 279                 }).then((res) => {
I 280                     this.myLock = false;
281                     this.errorMsg = res.message;
282                     this.source = "";
283                     if (res.code != 200) {
284
285                         if (res.code == 1019001) {
286                             //日志需要授权
287                             this.errorMsg = "";
288                             this.myLock = true;
289                         } else if (res.code == 1019002) {
290                             //授权码错误
291                             this.errorMsg = "口令错误..神秘力量依然阻止了你的前进";
292                             this.myLock = true;
293                         } else {
294                             this.$notification.error({
295                                 message: '好像哪里不对劲..',
296                                 description: res.message,
297                                 placement: 'bottomRight'
298                             });
299                         }
300                         return
301                     }
0b0125 302                     // this.test = res.data.isAllowedComment == 1 ? true : false;
28d46d 303
0b0125 304                     this.isAllowedComment = res.data.isAllowedComment;
a3ab3a 305                     this.introduce = res.data.introduce;
bc9518 306                     this.articleFileType = res.data.articleFileType;
916b6b 307                     if (res.data.coverFileURL != null && res.data.coverFileURL != '') {
I 308                         this.coverURL = res.data.coverFileURL;
309                     } else {
a23166 310                         this.coverURL = myConstant.defaultBG;
916b6b 311                     }
a3ab3a 312
0b0125 313                     this.articelMeta = res.data;
a3ab3a 314
80476f 315                     if (res.data.articleFileType == this.fileType.fileTypeMarkDown_1 ||
I 316                         res.data.articleFileType == this.fileType.fileTypeHtml_2) {
937681 317                         if (res.data.articleFileURL != null && res.data.articleFileURL != '') {
I 318                             this.$axios
319                                 .get(res.data.articleFileURL)
320                                 .then((res) => {
321                                     this.source = res.data;
322                                 }).catch(() => [
323                                     this.$message.error("获取文件好像失败了..", 3)
324                                 ])
325                         }
c6793e 326                     } else if (res.data.articleFileType == this.fileType.fileTypeVideo_3) {
I 327                         if (res.data.videoUrlList == null || res.data.videoUrlList.length < 1) {
328                             this.$notification.error({
329                                 message: '该日志还没有上传视频资源..',
330                                 placement: 'bottomRight'
331                             });
332                         } else {
333                             this.videoData.url = res.data.videoUrlList[0];
334
a23166 335                             this.videoData.pic = res.data.coverFileURL;
c6793e 336                             this.videoData.title = res.data.title;
I 337                             this.videoData.introduce = res.data.introduce;
338                             this.videoData.id = res.data.id;
339                             if (this.lastArticleId != this.articleId) {
340                                 let tempParam = JSON.parse(JSON.stringify(this.videoData))
341
342                                 _this.$nextTick(function() {
343                                     _this.$refs.videoPlayBox.startPlay(tempParam)
344                                 })
345                             }
346                         }
347
348
a3ab3a 349                     }
c23efb 350
I 351                     //获取日志资源文件
352                     this.showMsg = false;
353                     this.errorMsg = "";
28d46d 354                 })
I 355             },
356             pressEnter() {
7b98c8 357                 if (this.secret == "") {
I 358                     return
359                 }
360                 this.search.disabled = true
28d46d 361                 this.source = "";
7b98c8 362                 this.$message
28d46d 363                     .loading('卍解..', 1)
7b98c8 364                     .then(() => {
28d46d 365                         this.queryDetail();
7b98c8 366                         this.search.disabled = false;
I 367                     })
368
56a4b8 369             }
I 370         },
c23efb 371
56a4b8 372     }
I 373 </script>
374
b505f3 375 <style lang="less">
I 376     @import '../../assets/md.less';
937681 377
a23166 378     .disabledPointer {
I 379         position: relative;
380         pointer-events: none;
381         filter: blur(0.9px) brightness(.8);
382     }
383
384     .disabledPointer:before {
385         content: "\ec2a";
386         z-index: 2;
387         font-size: 4rem;
388         font-family: 'iconfont';
389         position: absolute;
390         top: 50%;
391         left: 50%;
392         transform: translate(-50%, -50%);
393     }
394
38a800 395     .articleTitle {
80476f 396         h4 {
a23166 397             margin: 0px 0px 10px 0px;
38a800 398             -webkit-line-clamp: 1;
I 399         }
80476f 400
38a800 401         text-align: center;
I 402         width: 100%;
c6793e 403     }
I 404
405     .myPicture {
a23166 406         max-width: 70%;
I 407         margin: 0px auto;
c6793e 408         padding: 20px 0px 0px 0px;
I 409
410         img {
411             display: block;
412             width: 100%;
413             transition: all 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
414             border-radius: 16px;
415         }
38a800 416     }
56a4b8 417
916b6b 418     .headertop {
I 419         position: relative;
420         overflow: hidden;
421         border-radius: 14px;
422     }
423
424     .centerbg {
425         width: 100%;
426         margin: 0;
427         padding: 0;
428         background-repeat: no-repeat;
429         // background-attachment: fixed;
430         background-size: cover;
431         z-index: -1;
432         // background-image: url("http://t.inleft.com/blog//cover/这世界那么多人.jpg");
433         height: 222px;
434         background-size: 100% auto;
435         background-position: center;
436     }
437
438
439     .headertop::before {
440         content: '';
441         position: absolute;
442         top: 0;
443         bottom: 0;
444         left: 0;
445         right: 0;
446         z-index: 3;
447         background-attachment: fixed;
448     }
449
450     .headertop.filter-dot::before {
451         // background-image: url("https://blog-img-1258635493.cos.ap-chengdu.myqcloud.com/cdn/img/other/dot.gif");
452         // background-image: url("http://blog.inleft.com/photo/dot.gif");
453     }
454
455     // .headertop-bar::after {
456     //     content: '';
457     //     width: 150%;
458     //     height: 4.375rem;
459     //     background: linear-gradient(0deg, #fff, 84%, #ffffff4f);
460     //     left: -25%;
461     //     bottom: -2.875rem;
462     //     border-radius: 100%;
463     //     position: absolute;
464     //     z-index: 4;
465     // }
0b0125 466
I 467     .smallOption {
468         transition-function: ease-out;
469         transition-duration: 200ms;
470         -webkit-transition-function: ease-out;
471         -webkit-transition-duration: 200ms;
472         -moztransition-function: ease-out;
473         -moztransition-duration: 200ms;
474         -o-transition-function: ease-out;
475         -o-transition-duration: 200ms;
476     }
477
478     .smallOption:hover {
479         transform: scale(1.55, 1.55);
480         -webkit-transform: scale(1.55, 1.55);
481         -moz-transform: scale(1.55, 1.55);
482         -o-transform: scale(1.55, 1.55);
483     }
484
c6793e 485     .jumpURL {
I 486         box-shadow: 8px 8px 18px rgba(0, 0, 0, 0.1), -8px -8px 18px #ffffff;
487         padding: 10px 23px;
488         margin: 20px 0px;
489
490         a {
491             color: black;
492         }
493     }
494
0b0125 495     .articleInfoMiniData {
I 496         user-select: none;
497         box-shadow: 8px 8px 18px rgba(0, 0, 0, 0.1), -8px -8px 18px #ffffff;
916b6b 498         padding: 10px 23px;
937681 499         margin: 20px 0px;
0b0125 500         display: flex;
I 501         justify-content: space-between;
502         flex-wrap: wrap;
937681 503
I 504
505         a {
506             color: black;
507         }
508
509         .myTitleDeal {
510             max-width: 300px;
511             -webkit-line-clamp: 1;
512             text-overflow: ellipsis;
513             overflow: hidden;
514             word-wrap: break-word;
515             white-space: nowrap;
516             word-break: break-all;
517         }
0b0125 518     }
I 519
7b98c8 520     .mySecret {
c6793e 521         height: 315px;
I 522     }
523
524     .mySecret,
525     .introduce {
7b98c8 526         display: flex;
I 527         flex-direction: column;
528         justify-content: center;
529         padding-left: auto;
530         align-items: center;
531     }
00e46d 532
c6793e 533     .mySecretSamll,
I 534     .introduceSamll {
a3ab3a 535         padding: 30px 10px 10px;
944ca6 536         height: 115px;
I 537         display: flex;
538         flex-direction: column;
539         justify-content: center;
540         padding-left: auto;
541         align-items: center;
542     }
7b98c8 543
846bd0 544
I 545     .markdown-body,
546     .articleComment {
859ec7 547         min-height: 70%;
a3ab3a 548         padding: 30px 20px 20px 20px;
b505f3 549         box-shadow: 8px 8px 18px rgba(0, 0, 0, 0.1),
I 550             -8px -8px 18px #ffffff;
551     }
56a4b8 552
937681 553
I 554     @media screen and (max-width:768px) {
555         .articleInfoMiniData {
556             .myTitleDeal {
557                 max-width: 120px;
558             }
559         }
56a4b8 560     }
I 561 </style>