From 63f5119bcc714c36fe8db21e5461d73eb5a0eaa0 Mon Sep 17 00:00:00 2001
From: inleft <inleft@qq.com>
Date: Mon, 21 Feb 2022 18:47:52 +0800
Subject: [PATCH] 统计数据添加,文章接口对接

---
 src/components/mini/box3-archive.vue     |    7 
 src/api/blogArticle.js                   |    8 +
 src/components/mini/box10-add.vue        |  108 +++++--------
 src/api/blogStatistics.js                |    8 +
 src/components/fixed/header.vue          |    5 
 src/components/mini/box-new-article.vue  |   21 ++
 src/components/mini/box2-class.vue       |   64 -------
 src/components/mini/tagTime.vue          |  209 ++++---------------------
 src/components/swichLabel/main1-show.vue |    5 
 src/config/router.config.js              |    2 
 src/components/group/MyModal.vue         |    5 
 11 files changed, 136 insertions(+), 306 deletions(-)

diff --git a/src/api/blogArticle.js b/src/api/blogArticle.js
index 6cef05a..fe82f26 100644
--- a/src/api/blogArticle.js
+++ b/src/api/blogArticle.js
@@ -29,3 +29,11 @@
 		params: parameter
 	})
 }
+
+export function blogAdd(parameter) {
+	return axios({
+		url: '/outside/blogArticle/add',
+		method: 'post',
+		data: parameter
+	})
+}
diff --git a/src/api/blogStatistics.js b/src/api/blogStatistics.js
index dc0fa78..0bf7414 100644
--- a/src/api/blogStatistics.js
+++ b/src/api/blogStatistics.js
@@ -27,3 +27,11 @@
 		method: 'get',
 	})
 }
+
+export function archiveGroup(parameter) {
+	return axios({
+		url: '/outside/blog/archiveGroup',
+		method: 'get',
+		params: parameter
+	})
+}
diff --git a/src/components/fixed/header.vue b/src/components/fixed/header.vue
index a657d5f..0fb4947 100644
--- a/src/components/fixed/header.vue
+++ b/src/components/fixed/header.vue
@@ -130,6 +130,11 @@
 </script>
 <style lang="less" scoped>
 	.menu {
+		-moz-user-select: none;
+		-webkit-user-select: none;
+		-ms-user-select: none;
+		-khtml-user-select: none;
+		user-select: none;
 		a {
 			margin-left: 10px;
 		}
diff --git a/src/components/group/MyModal.vue b/src/components/group/MyModal.vue
index b0e3233..6ccd798 100644
--- a/src/components/group/MyModal.vue
+++ b/src/components/group/MyModal.vue
@@ -21,6 +21,11 @@
 
 <script>
 	import box10 from "../mini/box10-add.vue"
+	
+	import {
+		blogAdd
+	} from '../../api/blogArticle.js'
+	
 	export default {
 		components: {
 			box10
diff --git a/src/components/mini/box-new-article.vue b/src/components/mini/box-new-article.vue
index 30b62c6..91ffc2d 100644
--- a/src/components/mini/box-new-article.vue
+++ b/src/components/mini/box-new-article.vue
@@ -2,7 +2,7 @@
 	<div>
 		<div class="recent-posts" id="recent-posts">
 			<div class="recent-post-item">
-
+				<div class="miniTag" v-if="isTop==1">置顶</div>
 				<div class="post_cover left_radius" v-if="id%2==0">
 					<router-link :to="{path:'/mdDetail',query:{id:id}}" :title="title">
 						<div class="block left_radius"></div>
@@ -20,8 +20,8 @@
 
 				<div class="recent-post-info">
 					<router-link :to="{path:'/mdDetail',query:{id:id}}" class="article-title">
-						<a-icon type="lock" style="color:rgba(0,0,0,.25)"  v-if="authStatus==3"/>
-						<a-icon type="stop" style="color:rgba(0,0,0,.25)"  v-if="authStatus==2"/>
+						<a-icon type="lock" style="color:rgba(0,0,0,.25)" v-if="authStatus==3" />
+						<a-icon type="stop" style="color:rgba(0,0,0,.25)" v-if="authStatus==2" />
 						{{title}}
 					</router-link>
 					<!-- <a class="article-title" href="/mdDetail" :title="title"> {{title}}</a> -->
@@ -54,6 +54,9 @@
 	export default {
 		props: {
 			"id": {
+				default: 0,
+			},
+			"isTop": {
 				default: 0,
 			},
 			"authStatus": {
@@ -97,6 +100,18 @@
 	@title-clolr: dimgray;
 	@card-hover-box-shadow: 0 0 0 rgba(0, 0, 0, 0.2), 0 0 0 rgba(255, 255, 255, 0.8), inset 9px 9px 15px rgba(0, 0, 0, 0.1), inset -9px -9px 15px rgba(255, 255, 255, 1);
 
+	.recent-post-item {
+		position: relative;
+	}
+
+	.miniTag {
+		z-index: 1;
+		position: absolute;
+		right: 8px;
+		top: 8px;
+		transform: rotate(30deg);
+		box-shadow: aliceblue;
+	}
 
 	// #recent-posts>.recent-post-item:not(:first-child) {
 	// 	margin-top: 1rem;
diff --git a/src/components/mini/box10-add.vue b/src/components/mini/box10-add.vue
index 437000d..70509ef 100644
--- a/src/components/mini/box10-add.vue
+++ b/src/components/mini/box10-add.vue
@@ -31,9 +31,7 @@
 				</a-upload> -->
 
 				<a-upload :customRequest="customRequest" name="file" :showUploadList="true" @change="handleChange"
-					:default-file-list="form.blogFileList" 
-					:beforeUpload="beforeUpload"
-					>
+					:default-file-list="form.blogFileList" :beforeUpload="beforeUpload">
 
 					<a-button>
 						<a-icon type="upload" />限 markdown/html
@@ -41,7 +39,7 @@
 				</a-upload>
 			</a-form-model-item>
 
-			<a-form-model-item label="日志内容" v-show="form.online" prop="content">
+			<a-form-model-item label="日志内容" v-show="form.online">
 				<a-input v-model="form.content" type="textarea" placeholder="限10k字数" />
 			</a-form-model-item>
 
@@ -187,9 +185,12 @@
 	import {
 		sysFileInfoUpload
 	} from '../../api/fileManage.js';
+
 	import {
 		queryBlogArticleType
 	} from '../../api/blogArticleType.js'
+
+
 	export default {
 		beforeMount() {
 			queryBlogArticleType({}).then((res) => {
@@ -202,25 +203,21 @@
 				if (this.form.online) {
 					console.log("内容未填");
 					this.$refs.myForm.validateField('content')
+					if (this.form.content == null || this.form.content == "") {
+						callback(new Error('内容未填'));
+					}
 				} else {
 					console.log("文件未传");
 					this.$refs.myForm.validateField('blogFileList')
+					if (this.form.blogFileList == null || this.form.blogFileList.length == 0) {
+						callback(new Error('文件未传'));
+					}
 				}
 				callback();
 			};
 
 			return {
 				blogArticleType: [],
-				// blogFileList: [],
-				// coverFileList: [
-				// 	// {
-				// 	// uid: '-1',
-				// 	// name: 'xxx.png',
-				// 	// status: 'done',
-				// 	// url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
-				// 	// thumbUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
-				// 	// } 
-				// ],
 				tags: [],
 				inputVisible: false,
 				inputValue: '',
@@ -254,7 +251,7 @@
 							trigger: 'blur'
 						},
 						{
-							min: 5,
+							min: 1,
 							max: 50,
 							message: '字数限制1~50',
 							trigger: 'blur'
@@ -269,48 +266,23 @@
 						validator: validateContent,
 						trigger: []
 					}],
-					content: [{
-						max: 10,
-						required: true,
-						message: '至少填一下上传内容',
-						trigger: 'blur'
-					}, ],
-					blogFileList: [{
-						max: 1,
-						required: true,
-						message: '文件未上传',
-					}],
+					// content: [{
+					// 	max: 10,
+					// 	required: true,
+					// 	message: '至少填一下上传内容',
+					// 	trigger: 'blur'
+					// }, ],
+					// blogFileList: [{
+					// 	max: 1,
+					// 	required: true,
+					// 	message: '文件未上传',
+					// }],
 					class: [{
 						required: true,
 						message: '至少选一个分类',
 						trigger: 'blur'
 					}, ],
-					// region: [{
-					// 	required: true,
-					// 	message: 'Please select Activity zone',
-					// 	trigger: 'change'
-					// }],
-					// date1: [{
-					// 	required: true,
-					// 	message: 'Please pick a date',
-					// 	trigger: 'change'
-					// }],
-					// type: [{
-					// 	type: 'array',
-					// 	required: true,
-					// 	message: 'Please select at least one activity type',
-					// 	trigger: 'change',
-					// }, ],
-					// resource: [{
-					// 	required: true,
-					// 	message: 'Please select activity resource',
-					// 	trigger: 'change'
-					// }, ],
-					// desc: [{
-					// 	required: true,
-					// 	message: 'Please input activity form',
-					// 	trigger: 'blur'
-					// }],
+
 				}
 			};
 		},
@@ -319,25 +291,25 @@
 				console.log(333);
 				console.log(this.blogFileList);
 				return new Promise((resolve, reject) => {
-					if(fileList.length>=2){
+					if (fileList.length >= 2) {
 						this.$message.error('这里最多上传一个文件');
 						return reject(false);
 					}
-				    // var testmsg=/^image\/(jpeg|png|jpg)$/.test(file.type)
-				    // // var testmsg=/^image\/(md|html|markdown)$/.test(file.type)
-				    // if (!testmsg) {
-				    //   this.$message.error('上传文件格式不对!');
-				    //   return reject(false);
-				    // }
-					
-				    const isLt2M = file.size / 1024 / 1024 <=2//图片大小不超过2MB
-				    if(!isLt2M) {
-				      this.$message.error('上传文件大小不能超过 2M!');
-				      return reject(false);
-				    }
-				    return resolve(true)
-				  });
-				
+					// var testmsg=/^image\/(jpeg|png|jpg)$/.test(file.type)
+					// // var testmsg=/^image\/(md|html|markdown)$/.test(file.type)
+					// if (!testmsg) {
+					//   this.$message.error('上传文件格式不对!');
+					//   return reject(false);
+					// }
+
+					const isLt2M = file.size / 1024 / 1024 <= 2 //图片大小不超过2MB
+					if (!isLt2M) {
+						this.$message.error('上传文件大小不能超过 2M!');
+						return reject(false);
+					}
+					return resolve(true)
+				});
+
 			},
 			handleChange(info) {
 				if (info.file.status !== 'uploading') {
diff --git a/src/components/mini/box2-class.vue b/src/components/mini/box2-class.vue
index 6c32839..0d6a7c6 100644
--- a/src/components/mini/box2-class.vue
+++ b/src/components/mini/box2-class.vue
@@ -12,7 +12,7 @@
 						<span>{{item.typeName}}</span>
 					</router-link>
 
-					<span>{{item.count==null?'--':item.count}}</span>
+					<span>{{item.count==null?'--':item.count+'篇'}}</span>
 				</div>
 			</div>
 			<div class="blog-log-list">
@@ -20,7 +20,7 @@
 					<router-link :to="{path:'/articleList',query:{typeId:item.id}}">
 						<span>{{item.typeName}}</span>
 					</router-link>
-					<span>{{item.count==null?'--':item.count}}</span>
+					<span>{{item.count==null?'--':item.count+'篇'}}</span>
 
 				</div>
 			</div>
@@ -35,6 +35,7 @@
 	} from '../../api/blogArticleType.js'
 	export default {
 		beforeMount() {
+			this.$message.info('loading',0.3);
 			queryBlogArticleType({}).then((res) => {
 				this.list1 = res.data.slice(0, 3)
 				this.list2 = res.data.slice(4)
@@ -44,65 +45,6 @@
 			return {
 				list1: [],
 				list2: [],
-				// list1: [{
-				// 	name: "日志",
-				// 	count: 10
-				// }, {
-				// 	name: "分类",
-				// 	count: 12
-				// }, {
-				// 	name: "标签",
-				// 	count: 14
-				// }],
-				// list2: [{
-				// 	name: "Tag",
-				// 	count: 133
-				// }, {
-				// 	name: "专题",
-				// 	count: 10
-				// }, {
-				// 	name: "偏好",
-				// 	count: 12
-				// }, {
-				// 	name: "星标",
-				// 	count: 14
-				// },{
-				// 	name: "Tag",
-				// 	count: 133
-				// }, {
-				// 	name: "专题",
-				// 	count: 10
-				// }, {
-				// 	name: "偏好",
-				// 	count: 12
-				// }, {
-				// 	name: "星标",
-				// 	count: 14
-				// },{
-				// 	name: "Tag",
-				// 	count: 133
-				// }, {
-				// 	name: "专题",
-				// 	count: 10
-				// }, {
-				// 	name: "偏好",
-				// 	count: 12
-				// }, {
-				// 	name: "星标",
-				// 	count: 14
-				// },{
-				// 	name: "Tag",
-				// 	count: 133
-				// }, {
-				// 	name: "专题",
-				// 	count: 10
-				// }, {
-				// 	name: "偏好",
-				// 	count: 12
-				// }, {
-				// 	name: "星标",
-				// 	count: 14
-				// }]
 			}
 		}
 	}
diff --git a/src/components/mini/box3-archive.vue b/src/components/mini/box3-archive.vue
index 78c36b7..f9bc2d1 100644
--- a/src/components/mini/box3-archive.vue
+++ b/src/components/mini/box3-archive.vue
@@ -1,19 +1,20 @@
 <template>
 	<div class="blog-container archive">
 		<span class="blog-pigeonhole">
-			<router-link to="/tagTime?type=1">
+			<router-link :to="{name:'tagTime'}">
 				归档信息
 			</router-link>
 		</span>
 		<div class="blog-scroll ">
 			<div v-for="yearData in myData">
-				<router-link to="/tagTime?type=2">
+				<router-link :to="{name:'tagTime',query:{year:yearData.year}}">
 					<p class="blog-pigeonhole-p">{{yearData.year}}年</p>
 				</router-link>
 				<div class="blog-pigeonhole-list">
 
 					<div class="blog-pigeonhole-item" v-for="item in yearData.list">
-						<router-link to="/tagTime?type=3">
+						<router-link :to="{name:'tagTime',
+						query:{year:yearData.year,month:item.month}}">
 							<span>{{item.month}}月</span>
 						</router-link>
 						<span>{{item.count}}篇</span>
diff --git a/src/components/mini/tagTime.vue b/src/components/mini/tagTime.vue
index 9f5f55f..e1f669e 100644
--- a/src/components/mini/tagTime.vue
+++ b/src/components/mini/tagTime.vue
@@ -10,11 +10,18 @@
 					{{yearData.year}}年
 				</a-divider>
 
-				<a-timeline-item v-for="monthData in yearData.monthList" color="white">
+				<a-timeline-item v-for="monthData in yearData.list" color="white">
 					<a-icon slot="dot" type="clock-circle-o" style="font-size: 18px;" />
 					<h3>{{monthData.month}}</h3>
 					<div v-for="article in monthData.list">
-						<span>{{article.name}} </span>{{article.remark}}
+						<router-link :to="{path:'/mdDetail',query:{id:article.id}}" class="article-title">
+							<span>
+								{{article.name}}
+							</span>
+							<a-icon type="lock" style="color:rgba(0,0,0,.25)" v-if="article.authStatus==3" />
+							<a-icon type="stop" style="color:rgba(0,0,0,.25)" v-if="article.authStatus==2" />
+
+						</router-link>
 					</div>
 				</a-timeline-item>
 			</div>
@@ -23,185 +30,47 @@
 </template>
 
 <script>
-	var tempList = [{
-			"year": "2022",
-			"monthList": [{
-					"month": "9月18日",
-					"list": [{
-							"name": "陈奕迅-Body Song 歌词1",
-							"remark": "随笔"
-						},
-						{
-							"name": "vue动态路由异步加载",
-	
-						}
-					]
-				},
-				{
-					"month": "9月08日",
-					"list": [{
-						"name": "陈奕迅-Body Song 歌词1",
-						"remark": "111"
-					}]
-				},
-				{
-					"month": "8月16日",
-					"list": [{
-							"name": "陈奕迅-Body Song 歌词1",
-							"remark": "111"
-						},
-						{
-							"name": "陈奕迅-Body Song 歌词1",
-	
-						},
-						{
-							"name": "陈奕迅-Body Song 歌词2",
-							"remark": "22"
-						}
-					]
-				},
-				{
-					"month": "4月09日",
-					"list": [{
-						"name": "陈奕迅-Body Song 歌词1",
-						"remark": "111"
-					}]
-				},
-				{
-					"month": "3月18日",
-					"list": [{
-						"name": "陈奕迅-Body Song 歌词1",
-						"remark": "111"
-					}]
-				},
-			]
-		},
-		{
-			"year": "2021",
-			"monthList": [{
-					"month": "9月18日",
-					"list": [{
-							"name": "陈奕迅-Body Song 歌词1",
-							"remark": "随笔"
-						},
-						{
-							"name": "vue动态路由异步加载",
-	
-						}
-					]
-				},
-				{
-					"month": "9月12日",
-					"list": [{
-						"name": "陈奕迅-Body Song 歌词1",
-						"remark": "111"
-					}]
-				},
-				{
-					"month": "9月09日",
-					"list": [{
-						"name": "陈奕迅-Body Song 歌词1",
-						"remark": "111"
-					}]
-				},
-				{
-					"month": "9月08日",
-					"list": [{
-						"name": "陈奕迅-Body Song 歌词1",
-						"remark": "111"
-					}]
-				},
-	
-			]
-		},
-		{
-			"year": "2020",
-			"monthList": [{
-					"month": "9月18日",
-					"list": [{
-							"name": "陈奕迅-Body Song 歌词1",
-							"remark": "随笔"
-						},
-						{
-							"name": "vue动态路由异步加载",
-	
-						}
-					]
-				},
-				{
-					"month": "9月08日",
-					"list": [{
-						"name": "陈奕迅-Body Song 歌词1",
-						"remark": "111"
-					}]
-				},
-				{
-					"month": "8月16日",
-					"list": [{
-							"name": "陈奕迅-Body Song 歌词1",
-							"remark": "111"
-						},
-						{
-							"name": "陈奕迅-Body Song 歌词1",
-	
-						},
-						{
-							"name": "陈奕迅-Body Song 歌词2",
-							"remark": "22"
-						}
-					]
-				}
-			]
-		}
-	]
-	
-	export default {
-		props: {
-			'type': Number,
-		},
-		mounted() {
-			console.log(this.$route.query)
-		},
+	import {
+		archiveGroup
+	} from '../../api/blogStatistics.js'
 
+	export default {
+		data() {
+			return {
+				year: "",
+				month: "",
+				list: []
+			}
+		},
+		created() {
+			this.year = this.$route.query.year;
+			this.month = this.$route.query.month;
+		},
 		watch: {
 			'$route'(to, from) {
-				var type = this.$route.query.type;
-				var list = [];
-				if (type == 1) {
-					list = tempList;
-				} else if (type == 2) {
-					list.push(tempList[0]);
-				} else if (type == 3) {
-					list.push(tempList[1]);
+				if ("tagTime" === to.name) {
+					this.year = this.$route.query.year;
+					this.month = this.$route.query.month;
+					this.$message.info('loading',0.3);
+					archiveGroup({
+						year: this.year,
+						month: this.month
+					}).then((res) => {
+						this.list = res.data;
+					})
 				}
-
-				this.list = list
-			}
+			},
 		},
-
-		data() {
-		
-
-			var list = [];
-			var type = this.$route.query.type;
-			if (type == 1) {
-				list = tempList;
-			} else if (type == 2) {
-				list.push(tempList[0]);
-			} else if (type == 3) {
-				list.push(tempList[1]);
-			}
-
-			return {
-				list: list
-			}
-		}
 	}
 </script>
 
 
 <style lang="less">
 	.ant-timeline-item-content {
+		a {
+			color: #555;
+		}
+
 		span {
 			line-height: 30px;
 		}
diff --git a/src/components/swichLabel/main1-show.vue b/src/components/swichLabel/main1-show.vue
index ffdb735..c0ff852 100644
--- a/src/components/swichLabel/main1-show.vue
+++ b/src/components/swichLabel/main1-show.vue
@@ -205,6 +205,11 @@
 	.blog-cell {
 		opacity: 0.8;
 		padding: 0px 14px 10px;
+		-moz-user-select: none;
+		-webkit-user-select: none;
+		-ms-user-select: none;
+		-khtml-user-select: none;
+		user-select: none;
 	}
 
 	/*左边部分*/
diff --git a/src/config/router.config.js b/src/config/router.config.js
index 762b1dd..bd96ebc 100644
--- a/src/config/router.config.js
+++ b/src/config/router.config.js
@@ -38,9 +38,9 @@
 						component: box1,
 					},
 					{
+						name:"tagTime",
 						path: '/tagTime',
 						component: tagTime,
-						props: true
 					},
 					{
 						path: '/tagInfo',

--
Gitblit v1.9.1