From 0e2e8ca254f4228a5571beaddfb4da0657908b80 Mon Sep 17 00:00:00 2001 From: yige Date: Sat, 26 Sep 2020 19:03:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=8B=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/LeftContent.vue | 6 +- components/Swiper.vue | 414 -------------------------------- layouts/common.styl | 4 + pages/_terms/index.vue | 26 -- pages/_terms/page/_page.vue | 26 -- pages/index.vue | 26 -- pages/links.vue | 63 +++++ pages/page/_page.vue | 26 -- pages/search/index.vue | 24 -- pages/tag/_terms/index.vue | 26 -- pages/tag/_terms/page/_page.vue | 24 -- plugins/browser.js | 64 ++--- plugins/vue.js | 2 - 13 files changed, 100 insertions(+), 631 deletions(-) delete mode 100644 components/Swiper.vue create mode 100644 pages/links.vue diff --git a/components/LeftContent.vue b/components/LeftContent.vue index 5fca18c..196ba08 100644 --- a/components/LeftContent.vue +++ b/components/LeftContent.vue @@ -116,16 +116,12 @@ a(href='https://wintc.top/', target='_blank') 沐码小站 li a(href='https://johnsonlee.site/', target='_blank') Johnson Blog - li - a(href='https://www.lzhpo.com/', target='_blank') 会打篮球的程序猿 li a(href='https://www.lfhacks.com/', target='_blank') LFhacks li a(href='https://www.ixiqin.com/', target='_blank') 西秦公子 li - a(href='https://8code.net/', target='_blank') 前端视角 - li - a(href='http://www.zzfly.net/', target='_blank') 烟花易冷 + nuxt-link(to='/links', title='更多友链') 更多友链 #tags.widget.tags .widgetTitle label 标签 diff --git a/components/Swiper.vue b/components/Swiper.vue deleted file mode 100644 index 4f49c6b..0000000 --- a/components/Swiper.vue +++ /dev/null @@ -1,414 +0,0 @@ - - - - - diff --git a/layouts/common.styl b/layouts/common.styl index 54257b4..44bd288 100644 --- a/layouts/common.styl +++ b/layouts/common.styl @@ -209,6 +209,10 @@ input:-moz-placeholder .links margin-bottom 20px + font-weight 300 + + li + margin-top 5px .widgetTitle font-size 18px diff --git a/pages/_terms/index.vue b/pages/_terms/index.vue index 45635c5..924634c 100644 --- a/pages/_terms/index.vue +++ b/pages/_terms/index.vue @@ -2,11 +2,6 @@ .pageList .articleContent(ref='articleImgs', v-if='Articels') article.articleList(v-for='(post, index) in Articels', :key='index') - .articleImgs(v-if='post.postImages.length') - nuxt-link(:to='"/post/" + post.ID') - Swiper(:style='"height: " + imageHeight + "px"') - Slide(v-for='(imgUrl, inx) in post.postImages', :key='inx') - img(:src='imgUrl') .articleAbstract nuxt-link(:to='"/post/" + post.ID') .articleTitle(v-html='post.post_title') @@ -80,8 +75,6 @@ export default { Articels[n].postmetum = {} Articels[n].postmetum.meta_value = 0 } - - Articels[n].postImages = [] } } else if (data.status === 404) { Info = '未找到文章。' @@ -100,25 +93,6 @@ export default { }, mounted () { this.$finishLoad() - this.analyseImages() - }, - methods: { - async analyseImages () { // 图片大小分析及处理 - const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width - this.imageHeight = articleImgsWidth * 0.5625 - for (const n in this.Articels) { - if (this.Articels[n].postimages.length !== 0) { - for (const i in this.Articels[n].postimages) { - const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info') - const widthValue = data.ImageWidth.value - const heightValue = data.ImageHeight.value - if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) { - this.Articels[n].postImages.push(this.Articels[n].postimages[i].guid + '?x-oss-process=image/resize,m_lfit,w_' + articleImgsWidth) - } - } - } - } - } } } diff --git a/pages/_terms/page/_page.vue b/pages/_terms/page/_page.vue index f948989..542e9bd 100644 --- a/pages/_terms/page/_page.vue +++ b/pages/_terms/page/_page.vue @@ -2,11 +2,6 @@ .pageList .articleContent(ref='articleImgs', v-if='Articels') article.articleList(v-for='(post, index) in Articels', :key='index') - .articleImgs(v-if='post.postImages.length') - nuxt-link(:to='"/post/" + post.ID') - Swiper(:style='"height: " + imageHeight + "px"') - Slide(v-for='(imgUrl, inx) in post.postImages', :key='inx') - img(:src='imgUrl') .articleAbstract nuxt-link(:to='"/post/" + post.ID') .articleTitle(v-html='post.post_title') @@ -77,8 +72,6 @@ export default { Articels[n].postmetum = {} Articels[n].postmetum.meta_value = 0 } - - Articels[n].postImages = [] } } else if (data.status === 404) { Info = '未找到文章。' @@ -97,25 +90,6 @@ export default { }, mounted () { this.$finishLoad() - this.analyseImages() - }, - methods: { - async analyseImages () { // 图片大小分析及处理 - const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width - this.imageHeight = articleImgsWidth * 0.5625 - for (const n in this.Articels) { - if (this.Articels[n].postimages.length !== 0) { - for (const i in this.Articels[n].postimages) { - const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info') - const widthValue = data.ImageWidth.value - const heightValue = data.ImageHeight.value - if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) { - this.Articels[n].postImages.push(this.Articels[n].postimages[i].guid + '?x-oss-process=image/resize,m_lfit,w_' + articleImgsWidth) - } - } - } - } - } } } diff --git a/pages/index.vue b/pages/index.vue index 834bb71..a2fb403 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -2,11 +2,6 @@ .pageList .articleContent(ref='articleImgs', v-if='Articels') article.articleList(v-for='(post, index) in Articels', :key='index') - .articleImgs(v-if='post.postImages.length') - nuxt-link(:to='"/post/" + post.ID') - Swiper(:style='"height: " + imageHeight + "px"') - Slide(v-for='(imgUrl, inx) in post.postImages', :key='inx') - img(:src='imgUrl') .articleAbstract nuxt-link(:to='"/post/" + post.ID') .articleTitle(v-html='post.post_title') @@ -78,8 +73,6 @@ export default { Articels[n].postmetum = {} Articels[n].postmetum.meta_value = 0 } - - Articels[n].postImages = [] } } else if (data.status === 404) { Info = '未找到文章。' @@ -98,25 +91,6 @@ export default { }, mounted () { this.$finishLoad() - this.analyseImages() - }, - methods: { - async analyseImages () { // 图片大小分析及处理 - const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width - this.imageHeight = articleImgsWidth * 0.5625 - for (const n in this.Articels) { - if (this.Articels[n].postimages.length !== 0) { - for (const i in this.Articels[n].postimages) { - const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info') - const widthValue = data.ImageWidth.value - const heightValue = data.ImageHeight.value - if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) { - this.Articels[n].postImages.push(this.Articels[n].postimages[i].guid + '?x-oss-process=image/resize,m_lfit,w_' + articleImgsWidth) - } - } - } - } - } } } diff --git a/pages/links.vue b/pages/links.vue new file mode 100644 index 0000000..5a5c8a5 --- /dev/null +++ b/pages/links.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/pages/page/_page.vue b/pages/page/_page.vue index 3943316..a3e819d 100644 --- a/pages/page/_page.vue +++ b/pages/page/_page.vue @@ -2,11 +2,6 @@ .pageList .articleContent(ref='articleImgs', v-if='Articels') article.articleList(v-for='(post, index) in Articels', :key='index') - .articleImgs(v-if='post.postImages.length') - nuxt-link(:to='"/post/" + post.ID') - Swiper(:style='"height: " + imageHeight + "px"') - Slide(v-for='(imgUrl, inx) in post.postImages', :key='inx') - img(:src='imgUrl') .articleAbstract nuxt-link(:to='"/post/" + post.ID') .articleTitle(v-html='post.post_title') @@ -77,8 +72,6 @@ export default { Articels[n].postmetum = {} Articels[n].postmetum.meta_value = 0 } - - Articels[n].postImages = [] } } else if (data.status === 404) { Info = '未找到文章。' @@ -97,25 +90,6 @@ export default { }, mounted () { this.$finishLoad() - this.analyseImages() - }, - methods: { - async analyseImages () { // 图片大小分析及处理 - const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width - this.imageHeight = articleImgsWidth * 0.5625 - for (const n in this.Articels) { - if (this.Articels[n].postimages.length !== 0) { - for (const i in this.Articels[n].postimages) { - const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info') - const widthValue = data.ImageWidth.value - const heightValue = data.ImageHeight.value - if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) { - this.Articels[n].postImages.push(this.Articels[n].postimages[i].guid + '?x-oss-process=image/resize,m_lfit,w_' + articleImgsWidth) - } - } - } - } - } } } diff --git a/pages/search/index.vue b/pages/search/index.vue index e1b7b0a..5aa5c74 100644 --- a/pages/search/index.vue +++ b/pages/search/index.vue @@ -2,11 +2,6 @@ .pageList .articleContent(ref='articleImgs', v-if='Articels') article.articleList(v-for='(post, index) in Articels', :key='index') - .articleImgs(v-if='post.postImages.length') - nuxt-link(:to='"/post/" + post.ID') - Swiper(:style='"height: " + imageHeight + "px"') - Slide(v-for='(imgUrl, inx) in post.postImages', :key='inx') - img(:src='imgUrl') .articleAbstract nuxt-link(:to='"/post/" + post.ID') .articleTitle(v-html='post.post_title') @@ -97,25 +92,6 @@ export default { }, mounted () { this.$finishLoad() - this.analyseImages() - }, - methods: { - async analyseImages () { // 图片大小分析及处理 - const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width - this.imageHeight = articleImgsWidth * 0.5625 - for (const n in this.Articels) { - if (this.Articels[n].postimages.length !== 0) { - for (const i in this.Articels[n].postimages) { - const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info') - const widthValue = data.ImageWidth.value - const heightValue = data.ImageHeight.value - if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) { - this.Articels[n].postImages.push(this.Articels[n].postimages[i].guid + '?x-oss-process=image/resize,m_lfit,w_' + articleImgsWidth) - } - } - } - } - } } } diff --git a/pages/tag/_terms/index.vue b/pages/tag/_terms/index.vue index 098f8af..bccdeb8 100644 --- a/pages/tag/_terms/index.vue +++ b/pages/tag/_terms/index.vue @@ -2,11 +2,6 @@ .pageList .articleContent(ref='articleImgs', v-if='Articels') article.articleList(v-for='(post, index) in Articels', :key='index') - .articleImgs(v-if='post.postImages.length') - nuxt-link(:to='"/post/" + post.ID') - Swiper(:style='"height: " + imageHeight + "px"') - Slide(v-for='(imgUrl, inx) in post.postImages', :key='inx') - img(:src='imgUrl') .articleAbstract nuxt-link(:to='"/post/" + post.ID') .articleTitle(v-html='post.post_title') @@ -77,8 +72,6 @@ export default { Articels[n].postmetum = {} Articels[n].postmetum.meta_value = 0 } - - Articels[n].postImages = [] } } else if (data.status === 404) { Info = '未找到文章。' @@ -97,25 +90,6 @@ export default { }, mounted () { this.$finishLoad() - this.analyseImages() - }, - methods: { - async analyseImages () { // 图片大小分析及处理 - const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width - this.imageHeight = articleImgsWidth * 0.5625 - for (const n in this.Articels) { - if (this.Articels[n].postimages.length !== 0) { - for (const i in this.Articels[n].postimages) { - const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info') - const widthValue = data.ImageWidth.value - const heightValue = data.ImageHeight.value - if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) { - this.Articels[n].postImages.push(this.Articels[n].postimages[i].guid + '?x-oss-process=image/resize,m_lfit,w_' + articleImgsWidth) - } - } - } - } - } } } diff --git a/pages/tag/_terms/page/_page.vue b/pages/tag/_terms/page/_page.vue index 098f8af..3f73a32 100644 --- a/pages/tag/_terms/page/_page.vue +++ b/pages/tag/_terms/page/_page.vue @@ -2,11 +2,6 @@ .pageList .articleContent(ref='articleImgs', v-if='Articels') article.articleList(v-for='(post, index) in Articels', :key='index') - .articleImgs(v-if='post.postImages.length') - nuxt-link(:to='"/post/" + post.ID') - Swiper(:style='"height: " + imageHeight + "px"') - Slide(v-for='(imgUrl, inx) in post.postImages', :key='inx') - img(:src='imgUrl') .articleAbstract nuxt-link(:to='"/post/" + post.ID') .articleTitle(v-html='post.post_title') @@ -97,25 +92,6 @@ export default { }, mounted () { this.$finishLoad() - this.analyseImages() - }, - methods: { - async analyseImages () { // 图片大小分析及处理 - const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width - this.imageHeight = articleImgsWidth * 0.5625 - for (const n in this.Articels) { - if (this.Articels[n].postimages.length !== 0) { - for (const i in this.Articels[n].postimages) { - const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info') - const widthValue = data.ImageWidth.value - const heightValue = data.ImageHeight.value - if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) { - this.Articels[n].postImages.push(this.Articels[n].postimages[i].guid + '?x-oss-process=image/resize,m_lfit,w_' + articleImgsWidth) - } - } - } - } - } } } diff --git a/plugins/browser.js b/plugins/browser.js index 8e9ab97..4a37ceb 100644 --- a/plugins/browser.js +++ b/plugins/browser.js @@ -2,11 +2,11 @@ import '~/layouts/common.styl' import vditor from 'vditor' import 'vditor/dist/index.css' -const $tags = document.getElementById('tags') -let floatTop = null -if ($tags) { - floatTop = $tags.offsetTop + $tags.scrollHeight + 30 -} +// const $tags = document.getElementById('tags') +// let floatTop = null +// if ($tags) { +// floatTop = $tags.offsetTop + $tags.scrollHeight + 30 +// } function addEvent (obj, type, fn) { if (obj.attachEvent) { @@ -25,35 +25,35 @@ window.onload = function () { alert('您的浏览器版本过低,继续访问将会出现问题,请升级浏览器版本!') // eslint-disable-line } - // 底部返回顶部按钮 - const top = document.getElementById('gotop') - if (top) { - // 滚动一屏幕时显示回到顶部 - addEvent(window, 'scroll', function () { - const currentPosition = document.documentElement.scrollTop || document.body.scrollTop - currentPosition > window.screen.availHeight ? top.style.display = 'block' : top.style.display = 'none' + // // 底部返回顶部按钮 + // const top = document.getElementById('gotop') + // if (top) { + // // 滚动一屏幕时显示回到顶部 + // addEvent(window, 'scroll', function () { + // const currentPosition = document.documentElement.scrollTop || document.body.scrollTop + // currentPosition > window.screen.availHeight ? top.style.display = 'block' : top.style.display = 'none' - // 左部导航自动浮动 - if (currentPosition > floatTop && document.body.clientWidth > 768) { - document.getElementById('navication').style.position = 'fixed' - } else { - document.getElementById('navication').style.position = 'static' - } - }) + // // 左部导航自动浮动 + // if (currentPosition > floatTop && document.body.clientWidth > 768) { + // document.getElementById('navication').style.position = 'fixed' + // } else { + // document.getElementById('navication').style.position = 'static' + // } + // }) - top.onclick = function () { - var timer = setInterval(function () { // eslint-disable-line - let currentPosition = document.documentElement.scrollTop || document.body.scrollTop - currentPosition -= 100 - if (currentPosition > 0) { - window.scrollTo(0, currentPosition) - } else { - window.scrollTo(0, 0) - clearInterval(timer) - } - }, 10) - } - } + // top.onclick = function () { + // var timer = setInterval(function () { // eslint-disable-line + // let currentPosition = document.documentElement.scrollTop || document.body.scrollTop + // currentPosition -= 100 + // if (currentPosition > 0) { + // window.scrollTo(0, currentPosition) + // } else { + // window.scrollTo(0, 0) + // clearInterval(timer) + // } + // }, 10) + // } + // } let _hmt = _hmt || [] // eslint-disable-line const hm = document.createElement('script') diff --git a/plugins/vue.js b/plugins/vue.js index cc5be80..e1cf542 100644 --- a/plugins/vue.js +++ b/plugins/vue.js @@ -31,7 +31,6 @@ import { import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' import hljs from 'highlight.js' import { Loading } from 'element-ui' -import Swiper from '../components/Swiper' import Slide from '../components/Slide' library.add( @@ -60,7 +59,6 @@ library.add( ) Vue.component('Icon', FontAwesomeIcon) -Vue.component('Swiper', Vue.extend(Swiper)) Vue.component('Slide', Vue.extend(Slide)) Vue.use(Loading.directive)