From 4b854c29227ef08ea178a3bba527a40ca2f84674 Mon Sep 17 00:00:00 2001 From: inleft <inleft@qq.com> Date: Mon, 21 Feb 2022 02:03:17 +0800 Subject: [PATCH] 统计接口对接,列表接口参数对接 --- src/components/mini/box3-archive.vue | 99 +++++++++++++----------- src/assets/main.css | 2 src/components/mini/mdDetail.vue | 2 src/components/mini/box10-add.vue | 9 + src/api/blogStatistics.js | 7 + src/components/fixed/header.vue | 2 src/components/mini/box-new-article.vue | 18 +++- src/components/mini/box2-class.vue | 24 ++++- src/config/router.config.js | 4 src/components/group/articleListScorll.vue | 34 +++++++- 10 files changed, 132 insertions(+), 69 deletions(-) diff --git a/src/api/blogStatistics.js b/src/api/blogStatistics.js index 6343018..dc0fa78 100644 --- a/src/api/blogStatistics.js +++ b/src/api/blogStatistics.js @@ -20,3 +20,10 @@ params: parameter }) } + +export function archive() { + return axios({ + url: '/outside/blog/archive', + method: 'get', + }) +} diff --git a/src/assets/main.css b/src/assets/main.css index 3f24f3b..55b8e19 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -191,7 +191,7 @@ .password-animate .left-arm.show, .password-animate .right-arm.show { - bottom: -1.7em !important; + bottom: -1.3em !important; } .password-animate .left-arm, diff --git a/src/components/fixed/header.vue b/src/components/fixed/header.vue index 7073389..a657d5f 100644 --- a/src/components/fixed/header.vue +++ b/src/components/fixed/header.vue @@ -2,7 +2,7 @@ <a-row type="flex" justify="start"> <a-col v-bind="showSmall"> <div class="menu"> - <router-link to="/main1">Home</router-link> + <router-link to="/">Home</router-link> <router-link to="/main2">乐谱搜索</router-link> <router-link to="/main3">我的网盘</router-link> <router-link to="/main4">友人帐</router-link> diff --git a/src/components/group/articleListScorll.vue b/src/components/group/articleListScorll.vue index 6d83f3d..c18502a 100644 --- a/src/components/group/articleListScorll.vue +++ b/src/components/group/articleListScorll.vue @@ -63,6 +63,7 @@ }, data() { return { + typeId: "", data: [], loading: false, busy: false, @@ -72,9 +73,29 @@ current: 1, }; }, + watch: { + '$route'(to, from) { + if ("articleList" === to.name) { + this.typeId = this.$route.query.typeId; + } + }, + typeId: function(newValue, oldValue) { + this.busy = true; + this.$message.info('loading',0.3); + this.onChange(1); + } + + }, + activated() { + window.addEventListener('scroll', this); + }, + deactivated() { + window.removeEventListener('scroll', this); + }, beforeMount() { queryBlogArticleList({ - pageNo: this.current + pageNo: this.current, + typeId: this.typeId }).then((res) => { this.total = Number(res.data.total) this.pageSize = Number(res.data.size); @@ -83,11 +104,11 @@ }) }, methods: { - onChange(current) { this.current = current; queryBlogArticleList({ - pageNo: this.current + pageNo: current, + typeId: this.typeId }).then((res) => { this.busy = false; this.total = Number(res.data.total) @@ -99,9 +120,10 @@ loadMore() { this.loading = true; this.busy = true; - + queryBlogArticleList({ - pageNo: this.current + 1 + pageNo: this.current + 1, + typeId: this.typeId }).then((res) => { this.total = Number(res.data.total) @@ -109,7 +131,7 @@ this.data = this.data.concat(res.data.records); this.busy = false; if (res.data.records.length == 0) { - this.$message.warning('别滑了,别滑了,到底了..'); + //this.$message.warning('别滑了,别滑了,到底了..'); this.busy = true; this.loading = false; return; diff --git a/src/components/mini/box-new-article.vue b/src/components/mini/box-new-article.vue index 1355304..30b62c6 100644 --- a/src/components/mini/box-new-article.vue +++ b/src/components/mini/box-new-article.vue @@ -6,20 +6,24 @@ <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> - <img class="post_bg" :src="coverFileURL" :onerror="img404" :alt="title"> + <img class="post_bg" :src="coverFileURL" :onerror="img404" :alt="title"> </router-link> </div> <div class="post_cover right_radius" v-else> <router-link :to="{path:'/mdDetail',query:{id:id}}" :title="title"> <div class="block right_radius"></div> - <img class="post_bg" :src="coverFileURL" :onerror="img404" :alt="title"> + <img class="post_bg" :src="coverFileURL" :onerror="img404" :alt="title"> <!-- <img class="post_bg" src="https://unpkg.zhimg.com/ahzo@1.0.3/blogpic/1.jpg" onerror="this.onerror=null,this.src="/img/404.jpg"" :alt="title"> --> </router-link> </div> <div class="recent-post-info"> - <router-link :to="{path:'/mdDetail',query:{id:id}}" class="article-title"> {{title}} </router-link> + <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"/> + {{title}} + </router-link> <!-- <a class="article-title" href="/mdDetail" :title="title"> {{title}}</a> --> <div class="article-meta-wrap" style="display: flex;"> <span class="post-meta-date"> @@ -31,7 +35,8 @@ <span class="article-meta__separator" style="margin: 0px 3px ;"> | </span> <span class="article-meta"> <a-icon type="book" /> - <router-link :to="{path:'/mdDetail',query:{id:id}}" class="article-meta__categories"> {{articleTypeName}} + <router-link :to="{path:'/mdDetail',query:{id:id}}" class="article-meta__categories"> + {{articleTypeName}} </router-link> <!-- <a class="article-meta__categories" href="#"> {{tag}}</a> --> </span> @@ -51,6 +56,9 @@ "id": { default: 0, }, + "authStatus": { + default: 1, + }, "title": { default: "", }, @@ -69,7 +77,7 @@ }, data() { return { - img404:"this.onerror='';this.src=\"https://unpkg.zhimg.com/ahzo@1.0.3/blogpic/1.jpg\"", + img404: "this.onerror='';this.src=\"https://unpkg.zhimg.com/ahzo@1.0.3/blogpic/1.jpg\"", // "title": "使用KeyStore生成证书", // "publishTime": "2022-01-14", // "tag": "随手记", diff --git a/src/components/mini/box10-add.vue b/src/components/mini/box10-add.vue index 3b34f34..437000d 100644 --- a/src/components/mini/box10-add.vue +++ b/src/components/mini/box10-add.vue @@ -13,8 +13,11 @@ <a-form-model-item label="模式切换" prop="common"> <a-switch v-model="form.online" /> - <span class="myTip"> - 本地文件/由系统生成文件 + <span class="myTip" v-if="form.online"> + 由系统生成文件 + </span> + <span class="myTip" v-else> + 本地文件上传 </span> </a-form-model-item> @@ -65,7 +68,7 @@ </span> </a-form-model-item> - <a-form-model-item label=" 文件类型"> + <a-form-model-item label=" 日志类型"> <a-radio-group v-model="form.blogType"> <a-radio value="Markdown"> markdown diff --git a/src/components/mini/box2-class.vue b/src/components/mini/box2-class.vue index 2bb7ccf..6c32839 100644 --- a/src/components/mini/box2-class.vue +++ b/src/components/mini/box2-class.vue @@ -1,10 +1,14 @@ <template> <div class="blog-container "> - <span class="blog-pigeonhole">分类</span> + <span class="blog-pigeonhole"> + <router-link :to="{path:'/articleList'}"> + 分类 + </router-link> + </span> <div class="blog-scroll "> <div class="blog-log-list"> <div class="blog-log-item" v-for="item in list1"> - <router-link to='/main1'> + <router-link :to="{path:'/articleList',query:{typeId:item.id}}"> <span>{{item.typeName}}</span> </router-link> @@ -13,7 +17,7 @@ </div> <div class="blog-log-list"> <div class="blog-log-item" v-for="item in list2"> - <router-link to="/box1"> + <router-link :to="{path:'/articleList',query:{typeId:item.id}}"> <span>{{item.typeName}}</span> </router-link> <span>{{item.count==null?'--':item.count}}</span> @@ -32,14 +36,14 @@ export default { beforeMount() { queryBlogArticleType({}).then((res) => { - this.list1=res.data.slice(0,3) - this.list2=res.data.slice(4) + this.list1 = res.data.slice(0, 3) + this.list2 = res.data.slice(4) }) }, data() { return { - list1:[], - list2:[], + list1: [], + list2: [], // list1: [{ // name: "日志", // count: 10 @@ -107,6 +111,12 @@ </script> <style lang="less"> + .blog-pigeonhole { + a { + color: black; + } + } + /*日志部分*/ .blog-log-list { line-height: 1.6; diff --git a/src/components/mini/box3-archive.vue b/src/components/mini/box3-archive.vue index 64cad96..78c36b7 100644 --- a/src/components/mini/box3-archive.vue +++ b/src/components/mini/box3-archive.vue @@ -16,7 +16,7 @@ <router-link to="/tagTime?type=3"> <span>{{item.month}}月</span> </router-link> - <span>{{item.count}}篇</span> + <span>{{item.count}}篇</span> </div> </div> @@ -27,53 +27,62 @@ </template> <script> + import { + archive + } from '../../api/blogStatistics.js' export default { + beforeMount() { + archive({}).then((res) => { + this.myData = res.data; + }) + }, data() { return { - "myData": [{ - "year": "2022", - "list": [{ - "month": "12", - "count": 10 - }, - { - "month": "10", - "count": 11 - }, - { - "month": "9", - "count": 9 - } - ] - }, - { - "year": "2021", - "list": [{ - "month": "12", - "count": 8 - }, - { - "month": "10", - "count": 7 - }, - { - "month": "7", - "count": 4 - }, - { - "month": "6", - "count": 3 - }, - { - "month": "5", - "count": 2 - }, - { - "month": "4", - "count": 1 - } - ] - } + "myData": [ + // { + // "year": "2022", + // "list": [{ + // "month": "12", + // "count": 10 + // }, + // { + // "month": "10", + // "count": 11 + // }, + // { + // "month": "9", + // "count": 9 + // } + // ] + // }, + // { + // "year": "2021", + // "list": [{ + // "month": "12", + // "count": 8 + // }, + // { + // "month": "10", + // "count": 7 + // }, + // { + // "month": "7", + // "count": 4 + // }, + // { + // "month": "6", + // "count": 3 + // }, + // { + // "month": "5", + // "count": 2 + // }, + // { + // "month": "4", + // "count": 1 + // } + // ] + // } ], } } diff --git a/src/components/mini/mdDetail.vue b/src/components/mini/mdDetail.vue index e75b1c7..4c98a31 100644 --- a/src/components/mini/mdDetail.vue +++ b/src/components/mini/mdDetail.vue @@ -92,6 +92,8 @@ }, methods: { queryDetail() { + this.showMsg = true; + this.errorMsg = "加载中.."; queryBlogArticleDetail({ id: this.acticleId, authWord: this.secret == "" ? null : md5(this.secret) diff --git a/src/config/router.config.js b/src/config/router.config.js index 4c358b9..762b1dd 100644 --- a/src/config/router.config.js +++ b/src/config/router.config.js @@ -29,6 +29,7 @@ component: main1, children: [{ path: '/', + name:"articleList", component: articleList, props: true }, @@ -56,10 +57,11 @@ ] }, { - path: '/main1', + path: '/articleList', component: main1, children: [{ path: '/', + name:"articleList", component: articleList, }] }, -- Gitblit v1.9.1