From 345be496336ca89d3e41840f627efc2ac3dbc27d Mon Sep 17 00:00:00 2001 From: jmal Date: Mon, 9 Nov 2020 17:59:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 2 +- src/components/backtop/AlBackTop.vue | 29 +++++----- src/layout/components/AppMain.vue | 5 +- src/router/index.js | 14 +++-- src/styles/article.scss | 14 ++--- src/styles/markdown.scss | 29 ++++++---- src/views/markdown/index.vue | 2 +- src/views/public/article/ArticleTop.vue | 9 +++- src/views/public/article/SidebarNav.vue | 17 +++--- src/views/public/article/index.vue | 46 +++++++++++++--- src/views/public/articles/index.vue | 63 ++++++++++++++++++---- src/views/setting/articles/blogManager.vue | 12 +++-- 12 files changed, 179 insertions(+), 63 deletions(-) diff --git a/src/App.vue b/src/App.vue index 30dc7fb..5f746a8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,6 @@ diff --git a/src/components/backtop/AlBackTop.vue b/src/components/backtop/AlBackTop.vue index 7a3e819..20c7ee4 100644 --- a/src/components/backtop/AlBackTop.vue +++ b/src/components/backtop/AlBackTop.vue @@ -64,19 +64,19 @@ this.throttledScrollHandler = throttle(300, this.onScroll); this.container.addEventListener('scroll', this.throttledScrollHandler); - window.onbeforeunload = function () { - let scrollPos; - if (typeof window.pageYOffset != 'undefined') { - scrollPos = window.pageYOffset; - } - else if (typeof document.compatMode != 'undefined' && document.compatMode !== 'BackCompat') { - scrollPos = document.documentElement.scrollTop; - } - else if (typeof document.body != 'undefined') { - scrollPos = document.body.scrollTop; - } - document.cookie = "scrollTop=" + scrollPos; //存储滚动条位置到cookies中 - } + // window.onbeforeunload = function () { + // let scrollPos; + // if (typeof window.pageYOffset != 'undefined') { + // scrollPos = window.pageYOffset; + // } + // else if (typeof document.compatMode != 'undefined' && document.compatMode !== 'BackCompat') { + // scrollPos = document.documentElement.scrollTop; + // } + // else if (typeof document.body != 'undefined') { + // scrollPos = document.body.scrollTop; + // } + // document.cookie = "scrollTop=" + scrollPos; //存储滚动条位置到cookies中 + // } }, @@ -103,6 +103,9 @@ this.scrollToTop(); this.$emit('click', e); }, + nextPageScrollTop() { + this.el.scrollTop = document.body.clientHeight * 0.7 - 150 + }, scrollToTop() { const el = this.el; const beginTime = Date.now(); diff --git a/src/layout/components/AppMain.vue b/src/layout/components/AppMain.vue index f6a3286..019c1e0 100644 --- a/src/layout/components/AppMain.vue +++ b/src/layout/components/AppMain.vue @@ -1,7 +1,10 @@ diff --git a/src/router/index.js b/src/router/index.js index edcc715..058e2c1 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -200,6 +200,8 @@ export const constantRoutes = [ path: '', name: 'article', component: () => import('@/views/public/article/index'), + hidden: true, + meta: { keepAlive: true } } ] }, @@ -209,7 +211,7 @@ export const constantRoutes = [ children: [ { path: `${document.location.protocol}//${window.location.host}/articles`, - meta: { title: '关联博客', icon: 'link' } + meta: { title: '关联博客', icon: 'link', keepAlive: true } } ] }, @@ -261,7 +263,7 @@ export const constantRoutes = [ path: '', name: 'articles', component: () => import('@/views/public/articles/index'), - meta: { title: '文档列表', icon: 'md-list' } + meta: { title: '文档列表', icon: 'md-list', keepAlive: true } } ] }, @@ -330,7 +332,13 @@ export const dynamicRouters = [ const createRouter = () => new Router({ mode: 'history', // require service support - scrollBehavior: () => ({ y: 0 }), + // scrollBehavior (to, from, savedPosition) { + // if (savedPosition) { + // return savedPosition + // } else { + // return { x: 0, y: 0 } + // } + // }, routes: constantRoutes }) diff --git a/src/styles/article.scss b/src/styles/article.scss index 1537d29..90d36e9 100644 --- a/src/styles/article.scss +++ b/src/styles/article.scss @@ -59,7 +59,7 @@ @media not all, screen and (-webkit-min-device-pixel-ratio: 1.5), not all, not all { .blog-description.font-mono { font-family: Consolas,Menlo,Monaco,"lucida console","Liberation Mono","Courier New","andale mono",monospaceX,monospace,sans-serif; - font-size: 1.1125rem; + font-size: 1rem; } } @@ -76,9 +76,7 @@ } @media (min-width: 576px) { - .navbar>.container-fluid { - max-width: 540px; - } + } @media screen and (max-width: 768px) { @@ -88,6 +86,10 @@ margin-bottom: .5rem; } + //.blog-description { + // font-size: .8125rem; + //} + .cover-wrapper .cover .cover-body { padding-bottom: 68px; .title { @@ -102,9 +104,7 @@ } @media (min-width: 768px){ - .navbar>.container-fluid { - max-width: 720px; - } + } @media (min-width: 992px) { diff --git a/src/styles/markdown.scss b/src/styles/markdown.scss index 8e3cea2..369b88e 100644 --- a/src/styles/markdown.scss +++ b/src/styles/markdown.scss @@ -218,6 +218,12 @@ transform: translateY(-100%); } +.animateLeft { + transform: translateX(-10rem); +} +.animateRight { + transform: translateX(0rem); +} .body-wrapper { position: relative; @@ -500,19 +506,19 @@ /deep/ .right-menu > div.titleList { .h-1 { padding-left: 10px; - font-size: 1.3rem; + font-size: 1.125rem; } .h-2 { padding-left: 20px; - font-size: 1.25rem; + font-size: 1.1rem; } .h-3 { padding-left: 30px; - font-size: 1.125rem; + font-size: 1rem; } .h-4 { padding-left: 40px; - font-size: 0.95rem; + font-size: 0.925rem; } .h-5 { padding-left: 50px; @@ -663,10 +669,11 @@ #toggle-nav { display: none; - position: fixed; top: .625rem; left: .625rem; - z-index: 891; + font-size: .75rem; + position: fixed; + z-index: 899; -webkit-transition: 0.5s ease all; -moz-transition: 0.5s ease all; -ms-transition: 0.5s ease all; @@ -675,10 +682,10 @@ } #sidebar-nav { - width: 20rem; + width: 17.5rem; height: 100%; - position: absolute; - left: -20rem; + position: fixed; + left: -17.5rem; top: 0; bottom: 0; overflow-y: auto; @@ -748,5 +755,9 @@ } #toggle-nav { display: block; + .nav-button { + backdrop-filter: saturate(180%) blur(20px); + background-color: #ffffffb3; + } } } diff --git a/src/views/markdown/index.vue b/src/views/markdown/index.vue index a6d4e65..f30dde3 100644 --- a/src/views/markdown/index.vue +++ b/src/views/markdown/index.vue @@ -1,5 +1,5 @@