inleft
2022-08-12 e4f0862bd8af0ac1c7aab59904b69dd071526aff
commit | author | age
859ec7 1 <template>
I 2     <div>
e4f086 3         <div class="boxMain ">
I 4             <videoPlayBox ref="videoPlayBox" @swichPlay="swichPlay"></videoPlayBox>
af029b 5         </div>
e4f086 6         <div style="padding: 20px 20px 5px;margin-bottom: 20px;" class="myShadow fadeInLeft">
af029b 7             <pre>{{introduce}}</pre>
I 8         </div>
e4f086 9         <div class="articleComment fadeInRight">
af029b 10             <comment ref="myComment" :articleId="articleId" :isAllowedComment="isAllowedComment" :foldReply="true" />
I 11         </div>
859ec7 12     </div>
I 13
14 </template>
15
16 <script>
17     import {
18         history
19     } from '../../api/blogArticleComment.js'
20     import videoPlayBox from "../mini/box15-videoPlayBox.vue"
21     import comment from "../mini/box12-comment.vue"
af029b 22
I 23     import {
24         queryBlogArticleDetail
25     } from '../../api/blogArticle.js'
859ec7 26
I 27     export default {
28         components: {
29             videoPlayBox,
30             comment,
31         },
32         watch: {
33             // '$route'(to, from) {
34             //     if ("mdDetail" === to.name) {
35             //         this.articleId = this.$route.query.id;
36             //         this.articleFileType = this.$route.query.articleFileType;
37             //     }
38             // },
39             articleId: function(newValue, oldValue) {
40                 if (newValue == undefined || newValue == null || newValue == "") {
41                     this.errorMsg = "日志id参数缺失";
42                 } else {
43                     this.$nextTick(function() {
44                         this.$refs.myComment.updateCommentList(this.articleId);
45                     })
46                 }
47             },
48         },
49         data() {
50             return {
51                 articleId: "",
af029b 52                 lastArticleId: "",
I 53                 isAllowedComment: false,
54                 introduce: "",
55                 secret: "",
56                 myLock: false,
57                 videoData: {
58                     img: "http://t.inleft.com/share/media_photo/idea_beijing.jpg",
59                     url: "",
0dd41b 60                     type: "normal",
I 61                     title: "",
e4f086 62                     introduce: "",
0dd41b 63                     id: ""
af029b 64                 }
859ec7 65             }
I 66         },
67         methods: {
e4f086 68             swichPlay(videoData) {
I 69                 this.introduce = videoData.introduce;
70                 this.$refs.myComment.updateCommentList(videoData.id);
71             },
af029b 72             showVideo(item) {
0dd41b 73                 //防止重复加载
af029b 74                 this.lastArticleId = this.articleId;
I 75                 this.articleId = item.id
0dd41b 76
I 77                 if (this.articleId == this.lastArticleId) {
78                     return
79                 }
80
81                 this.isAllowedComment = item.isAllowedComment;
82                 this.introduce = item.introduce;
83                 this.loadData();
859ec7 84             },
af029b 85             loadData() {
e4f086 86
I 87                 if (this.$refs.videoPlayBox.isPlaying) {
88                     this.$message.info("上个视频正在播放中")
89                 }
af029b 90
I 91                 if (this.myLock) {
92                     this.$message.info("正在努力加载中..", 3)
93                     return
94                 }
95
96                 let _this = this;
97                 queryBlogArticleDetail({
98                     id: this.articleId,
99                     authWord: this.secret == "" ? null : md5(this.secret)
100                 }).then((res) => {
0dd41b 101                     this.myLock = !this.myLock;
af029b 102
I 103                     if (res.code != 200) {
104
105                         if (res.code == 1019001) {
106                             //日志需要授权
107                             this.$message.error(res.message)
108                         } else if (res.code == 1019002) {
109
110                             this.$message.error(res.message)
111                         } else {
112                             this.$notification.error({
113                                 message: '好像哪里不对劲..',
114                                 description: res.message,
115                                 placement: 'bottomRight'
116                             });
117                         }
118                         return
119                     }
120
121                     this.isAllowedComment = res.data.isAllowedComment;
122                     this.videoData.url = res.data.articleFileURL;
123                     this.videoData.img = res.data.coverFileURL;
0dd41b 124                     this.videoData.title = res.data.title;
e4f086 125                     this.videoData.introduce = res.data.introduce;
0dd41b 126                     this.videoData.id = res.data.id;
I 127
128
af029b 129                     if (res.data.articleFileURL != null &&
I 130                         res.data.articleFileURL != "" &&
131                         res.data.articleFileURL.endsWith("m3u8")) {
132                         this.videoData.type = "customHls";
133                     } else {
134                         this.videoData.type = "normal";
135                     }
136
0dd41b 137                     this.myLock = !this.myLock;
af029b 138                     if (this.lastArticleId != this.articleId) {
e4f086 139                         let tempParam = JSON.parse(JSON.stringify(this.videoData))
I 140                         _this.$refs.videoPlayBox.startPlay(tempParam)
af029b 141                     }
I 142                 })
143
144             }
859ec7 145         },
I 146     }
147 </script>
148 <style scoped>
149     a {
150         color: black;
151     }
152
af029b 153     pre {
I 154         font-family: 'HYTangMeiRen';
155         src: url("http://t.inleft.com/share/z%E5%AD%97%E4%BD%93%E5%BA%93/hytmr55%E6%B1%89%E4%BB%AA%E5%94%90%E7%BE%8E%E4%BA%BA%E5%AD%97%E4%BD%93.woff") format("truetype");
156     }
157
859ec7 158     .boxMain {
e4f086 159         user-select: none;
859ec7 160         display: flex;
I 161         justify-content: center;
af029b 162         padding: 5px 20px;
I 163     }
164
165     .myShadow {
166
167         box-shadow: 8px 8px 18px rgba(0, 0, 0, 0.1),
168             -8px -8px 18px #ffffff;
859ec7 169     }
I 170 </style>