From b601c07ea418d635b8e3c77ce36a20cecfd862fb Mon Sep 17 00:00:00 2001 From: surmon-china Date: Thu, 11 Oct 2018 23:38:30 +0800 Subject: [PATCH] update jsdoc info and optimize code --- .eslintrc.js | 10 ++++++++- CHANGELOG.md | 2 ++ api.config.js | 3 ++- components/archive/header.vue | 2 +- components/common/color-block/block.vue | 4 ++-- components/common/color-block/index.js | 3 ++- components/common/comment/index.js | 3 ++- components/common/empty/index.js | 3 ++- components/common/loading/index.js | 3 ++- components/common/wall-flower/index.js | 3 ++- components/layout/calendar.vue | 10 ++++----- components/layout/emoji-rain.vue | 4 +++- components/layout/footer.vue | 2 +- components/layout/header.vue | 4 +++- components/layout/index.js | 3 ++- components/layout/language-psm.vue | 2 +- components/layout/tool-box.vue | 20 ++++++++--------- components/layout/webrtc/main.vue | 4 +++- components/mobile/aside.vue | 6 ++--- components/mobile/index.js | 3 ++- environment.js | 19 +++++++++++++--- extend/html-cdn-loader.js | 9 ++++---- filters/html-filter.js | 3 ++- filters/index.js | 3 ++- filters/time-filter.js | 3 ++- i18n.config.js | 3 ++- middleware/change-page-col.js | 3 ++- nuxt.config.js | 3 ++- pages/about.vue | 13 ++++------- pages/app.vue | 6 +++-- pages/article/_article_id.vue | 5 +---- pages/category/_category_slug.vue | 2 +- pages/guestbook.vue | 10 ++++----- pages/index.vue | 1 + pages/music.vue | 29 ++++++++++++------------- pages/project.vue | 6 +++-- pages/search/_keyword.vue | 3 ++- pages/service.vue | 6 +++-- pages/sitemap.vue | 6 +++-- pages/tag/_tag_slug.vue | 4 +--- plugins/baidu-seo-push.js | 19 +++++++++------- plugins/copy-right.js | 9 +++++--- plugins/emoji-233333.js | 6 +++-- plugins/ga.js | 7 ++++-- plugins/gravatar.js | 3 ++- plugins/highlight.js | 5 +++-- plugins/image-popup.js | 7 ++++-- plugins/loaded-task.js | 6 +++-- plugins/marked.js | 5 +++-- plugins/particles.js | 5 +++-- plugins/socket.io.js | 12 +++++----- plugins/swiper.js | 3 ++- plugins/vue-extend.js | 3 ++- plugins/webrtc.js | 3 ++- server.js | 11 +++++----- servers/barrage.server.js | 6 ++++- servers/webrtc.server.js | 5 +++-- store/announcement.js | 3 ++- store/article.js | 5 +++-- store/category.js | 5 +++-- store/comment.js | 9 +++++--- store/index.js | 8 ++++--- store/option.js | 6 +++-- store/project.js | 3 ++- store/sitemap.js | 3 ++- store/tag.js | 3 ++- utils/article-tag-releted-parse.js | 13 ++--------- utils/console-slogan.js | 7 ++++-- utils/event-bus.js | 3 ++- utils/i18n-transfer.js | 3 ++- utils/local-storage.js | 3 ++- utils/music-player-builder.js | 3 ++- utils/scroll-to-anywhere.js | 3 ++- utils/ua-device.js | 3 ++- utils/ua-os-browser.js | 3 ++- utils/underscore-simple.js | 5 +++-- utils/update-analytics.js | 14 ++++-------- 77 files changed, 267 insertions(+), 184 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 41fdf3cf6..f7fa5d0bc 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,11 @@ +/** + * @file Api config / Commonjs module + * @module eslint.config + * @author Surmon +*/ + +const { isProdMode } = require('./environment') + module.exports = { root: true, env: { @@ -58,7 +66,7 @@ module.exports = { "no-control-regex": 2, // 禁止使用debugger语句 - "no-debugger": process.env.NODE_ENV === 'production' ? 'error' : 'off', + "no-debugger": isProdMode ? 'error' : 'off', // 函数参数禁止重名 "no-dupe-args": 2, diff --git a/CHANGELOG.md b/CHANGELOG.md index a34966f98..b7817d785 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ - 规范编码风格 - 增加壁纸功能 - 优化开发时正向代理服务 +- 优化组件结构 +- 重新抽象一些方法 ### v1.2.6 - 修复 APP 下载地址 diff --git a/api.config.js b/api.config.js index 1a741b8e8..241136996 100755 --- a/api.config.js +++ b/api.config.js @@ -1,6 +1,7 @@ /** * @file Api config / Commonjs module - * @author Surmon + * @module api.config + * @author Surmon */ const { isProdMode } = require('./environment') diff --git a/components/archive/header.vue b/components/archive/header.vue index f94742c0e..d184f4809 100755 --- a/components/archive/header.vue +++ b/components/archive/header.vue @@ -62,7 +62,7 @@ name: 'article-list-header', computed: { languageIsEn() { - return this.$store.state.option.language === 'en' + return this.$store.getters['option/langIsEn'] }, currentTag() { return this.$store.state.tag.data.data.find((tag, index, arr) => { diff --git a/components/common/color-block/block.vue b/components/common/color-block/block.vue index 9ab32499f..305c08ec8 100755 --- a/components/common/color-block/block.vue +++ b/components/common/color-block/block.vue @@ -14,11 +14,11 @@ name: 'color-block-box', props: { left: Number, + color: String, border: { type: String, default: 'right' - }, - color: String + } } } diff --git a/components/common/color-block/index.js b/components/common/color-block/index.js index dc95467ed..3b5c2cc17 100755 --- a/components/common/color-block/index.js +++ b/components/common/color-block/index.js @@ -1,6 +1,7 @@ /** * @file Color block component / ES module - * @author Surmon + * @module components/common/color-block + * @author Surmon */ import ColorBlockComponent from './block' diff --git a/components/common/comment/index.js b/components/common/comment/index.js index 5f33d8719..d0450f3c9 100755 --- a/components/common/comment/index.js +++ b/components/common/comment/index.js @@ -1,6 +1,7 @@ /** * @file Comment box component / ES module - * @author Surmon + * @module components/common/comment + * @author Surmon */ import vueComment from './comment' diff --git a/components/common/empty/index.js b/components/common/empty/index.js index 422b72948..b4b970aec 100755 --- a/components/common/empty/index.js +++ b/components/common/empty/index.js @@ -1,6 +1,7 @@ /** * @file Empty box component / ES module - * @author Surmon + * @module components/common/empty + * @author Surmon */ import EmptyComponent from './empty' diff --git a/components/common/loading/index.js b/components/common/loading/index.js index 1b857c42c..9f50dc64b 100755 --- a/components/common/loading/index.js +++ b/components/common/loading/index.js @@ -1,6 +1,7 @@ /** * @file Loading component / ES module - * @author Surmon + * @module components/common/loading + * @author Surmon */ import LoadingComponent from './loading' diff --git a/components/common/wall-flower/index.js b/components/common/wall-flower/index.js index a2b03a6b0..5cadc3a17 100755 --- a/components/common/wall-flower/index.js +++ b/components/common/wall-flower/index.js @@ -1,6 +1,7 @@ /** * @file Wall flower component / ES module - * @author Surmon + * @module components/common/wall-flower + * @author Surmon */ import WallFlowerComponent from './garden' diff --git a/components/layout/calendar.vue b/components/layout/calendar.vue index 0b4781b5b..1d53dbc1d 100755 --- a/components/layout/calendar.vue +++ b/components/layout/calendar.vue @@ -19,15 +19,15 @@
    -
  • {{ day }}
  • +
  • {{ day }}
    -
  • {{ day }}
  • +
  • {{ day }}
    -
  • +
  • {{ day.getDate() }} @@ -60,7 +60,7 @@ }, computed: { languageIsEn() { - return this.$store.state.option.language === 'en' + return this.$store.getters['option/langIsEn'] } }, methods: { @@ -172,7 +172,7 @@ margin-bottom: .5em; > li { - display: inline-block; + display: block; float: left; width: calc(100% / 7); text-align: center; diff --git a/components/layout/emoji-rain.vue b/components/layout/emoji-rain.vue index 720f8ad0d..2806bc6ee 100644 --- a/components/layout/emoji-rain.vue +++ b/components/layout/emoji-rain.vue @@ -7,6 +7,8 @@