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