From 80476fae71f08bf4408c7509eff254031a4eeac6 Mon Sep 17 00:00:00 2001
From: inleft <inleft@qq.com>
Date: Wed, 24 Aug 2022 18:47:09 +0800
Subject: [PATCH] 路由修正,常量提取

---
 src/components/mini/mdDetail.vue |   48 +++++++++++++++++++++++++++---------------------
 1 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/src/components/mini/mdDetail.vue b/src/components/mini/mdDetail.vue
index 1fc7e24..7c8734a 100644
--- a/src/components/mini/mdDetail.vue
+++ b/src/components/mini/mdDetail.vue
@@ -1,10 +1,5 @@
 <template>
 	<div class="article-meta">
-		<!-- <div>
-			<a-button @click="()=>this.$router.back(-1)" style="position: absolute;">
-				<a-icon type="left" />
-			</a-button>
-		</div> -->
 
 		<div class="headertop filter-dot headertop-bar " v-if="coverURL.length>0">
 			<figure class="centerbg" v-bind:style="{'background-image':'url('+this.coverURL+')'}">
@@ -12,7 +7,7 @@
 		</div>
 
 		<div v-if="showMsg && !myLock">
-			<div class="mySecretSamll" v-if="articleFileType==myConstant.fileTypeShort">
+			<div class="mySecretSamll" v-if="articleFileType==fileType.fileTypeTalking_9">
 				<p>碎碎念只有那么一点了</p>
 				<p>但是下面依旧可以碎碎念</p>
 			</div>
@@ -37,19 +32,22 @@
 				<span class="myTip">{{errorMsg}}</span>
 			</div>
 
-			<div class="mySecret" v-else-if="articleFileType==myConstant.fileTypeVideo
-				|| articleFileType==myConstant.fileTypeMp3
-				|| articleFileType==myConstant.fileTypeShort">
+			<div class="mySecret" v-else-if="articleFileType==fileType.fileTypeVideo_3
+				|| articleFileType==fileType.fileTypeVideo_3
+				|| articleFileType==fileType.fileTypeTalking_9">
 
 				<div class="mySecretSamll" v-if="introduce.length==0">
-					<p>碎碎念只有那么一点了</p>
+					<p>碎碎念只有那么一点了22</p>
 					<p>但是下面依旧可以碎碎念</p>
 				</div>
-				<pre style="white-space: pre-line;">
-				{{introduce}}
+				<pre style="white-space: pre-line;padding: 10px;max-width: 100%;">
+					{{introduce}}
 				</pre>
 			</div>
 			<div v-viewer.static class="markdown-body article-detail" v-else>
+				<div class="articleTitle">
+					<h4>{{articelMeta.title}}</h4>
+				</div>
 				<vue-markdown :source="source"></vue-markdown>
 			</div>
 		</div>
@@ -119,6 +117,7 @@
 	import {
 		queryBlogArticleDetail
 	} from '../../api/blogArticle.js'
+	
 	import comment from "../mini/box12-comment.vue"
 
 	import axios from 'axios'
@@ -131,12 +130,12 @@
 		},
 		data() {
 			return {
-				myConstant: myConstant,
+				fileType: myConstant.fileType,
 				articelMeta: '',
 				isAllowedComment: 1,
 				introduce: "",
 				articleId: "",
-				articleFileType: myConstant.fileTypeMarkDown,
+				articleFileType: myConstant.fileType.fileTypeMarkDown_1,
 				typeId: null,
 				source: "",
 				showMsg: false,
@@ -154,6 +153,8 @@
 			}
 		},
 		created() {
+			console.log(111);
+			console.log(this.$route.params);
 			this.articleId = this.$route.query.id;
 			this.articleFileType = this.$route.query.articleFileType;
 			this.typeId = this.$route.query.typeId;
@@ -183,11 +184,6 @@
 			queryDetail() {
 				this.showMsg = true;
 				this.errorMsg = "加载中..";
-
-				// if (this.articleFileType == myConstant.fileTypeShort) {
-				// 	this.errorMsg = "该类型日志在这里没有更多啦..";
-				// 	return
-				// }
 
 				queryBlogArticleDetail({
 					id: this.articleId,
@@ -231,8 +227,8 @@
 
 					this.articelMeta = res.data;
 
-					if (res.data.articleFileType == myConstant.fileTypeMarkDown ||
-						res.data.articleFileType == myConstant.fileTypeHtml) {
+					if (res.data.articleFileType == this.fileType.fileTypeMarkDown_1 ||
+						res.data.articleFileType == this.fileType.fileTypeHtml_2) {
 						if (res.data.articleFileURL != null && res.data.articleFileURL != '') {
 							this.$axios
 								.get(res.data.articleFileURL)
@@ -271,6 +267,16 @@
 <style lang="less">
 	@import '../../assets/md.less';
 
+	.articleTitle {
+		h4 {
+			margin: 0px 0px 20px 0px;
+			-webkit-line-clamp: 1;
+		}
+
+		text-align: center;
+		width: 100%;
+
+	}
 
 	.headertop {
 		position: relative;

--
Gitblit v1.9.1