From 50d09574099f39b71ac37739ff7c07ec568f2160 Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 18 Apr 2019 18:16:13 +0800 Subject: [PATCH 01/49] perf: optimize some small details --- src/api/user.js | 1 - src/layout/components/Navbar.vue | 4 +++- src/store/getters.js | 1 - src/store/modules/permission.js | 2 +- src/utils/validate.js | 1 + src/views/error-page/404.vue | 23 +++++++---------------- vue.config.js | 2 +- 7 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/api/user.js b/src/api/user.js index a8052005..de69f707 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -22,4 +22,3 @@ export function logout() { method: 'post' }) } - diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index d544f079..51972166 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -36,6 +36,9 @@ {{ $t('navbar.github') }} + + Docs + {{ $t('navbar.logOut') }} @@ -68,7 +71,6 @@ export default { computed: { ...mapGetters([ 'sidebar', - 'name', 'avatar', 'device' ]) diff --git a/src/store/getters.js b/src/store/getters.js index 3fb5b068..313210a0 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -11,7 +11,6 @@ const getters = { introduction: state => state.user.introduction, roles: state => state.user.roles, permission_routes: state => state.permission.routes, - addRoutes: state => state.permission.addRoutes, errorLogs: state => state.errorLog.logs } export default getters diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index bd35252c..aeb5ee53 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -51,7 +51,7 @@ const actions = { return new Promise(resolve => { let accessedRoutes if (roles.includes('admin')) { - accessedRoutes = asyncRoutes + accessedRoutes = asyncRoutes || [] } else { accessedRoutes = filterAsyncRoutes(asyncRoutes, roles) } diff --git a/src/utils/validate.js b/src/utils/validate.js index e04f292e..e81672bb 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -1,6 +1,7 @@ /** * Created by jiachenpan on 16/11/18. */ + /** * @param {string} path * @returns {Boolean} diff --git a/src/views/error-page/404.vue b/src/views/error-page/404.vue index 66cb3eae..1791f55a 100644 --- a/src/views/error-page/404.vue +++ b/src/views/error-page/404.vue @@ -8,22 +8,13 @@ 404
-
- OOPS! +
OOPS!
+
All rights reserved + wallstreetcn
-
- 版权所有 - 华尔街见闻 -
-
- {{ message }} -
-
- 请检查您输入的网址是否正确,请点击以下按钮返回主页或者发送错误报告 -
- - 返回首页 - +
{{ message }}
+
Please check that the URL you entered is correct, or click the button below to return to the homepage.
+ Back to home
@@ -35,7 +26,7 @@ export default { name: 'Page404', computed: { message() { - return '网管说这个页面你不能进......' + return 'The webmaster said that you can not enter this page...' } } } diff --git a/vue.config.js b/vue.config.js index bae56d78..7fa00992 100644 --- a/vue.config.js +++ b/vue.config.js @@ -86,7 +86,7 @@ module.exports = { .end() config - // https://webpack.js.org/configuration/devtool/#development + // https://webpack.js.org/configuration/devtool/#development .when(process.env.NODE_ENV === 'development', config => config.devtool('cheap-source-map') ) From ea91066b18e3989da206de41206016732b432b80 Mon Sep 17 00:00:00 2001 From: dingangang Date: Thu, 18 Apr 2019 18:36:20 +0800 Subject: [PATCH 02/49] fix[mock]: fixed mock-server hot reload bug in windows (#1939) --- mock/mock-server.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mock/mock-server.js b/mock/mock-server.js index b29b7c3f..ccce04d2 100644 --- a/mock/mock-server.js +++ b/mock/mock-server.js @@ -1,6 +1,9 @@ const chokidar = require('chokidar') const bodyParser = require('body-parser') const chalk = require('chalk') +const path = require('path') + +const mockDir = path.join(process.cwd(), 'mock') function registerRoutes(app) { let mockLastIndex @@ -18,7 +21,7 @@ function registerRoutes(app) { function unregisterRoutes() { Object.keys(require.cache).forEach(i => { - if (i.includes('/mock')) { + if (i.includes(mockDir)) { delete require.cache[require.resolve(i)] } }) @@ -40,9 +43,8 @@ module.exports = app => { var mockStartIndex = mockRoutes.mockStartIndex // watch files, hot reload mock server - chokidar.watch(('./mock'), { - ignored: 'mock/mock-server.js', - persistent: true, + chokidar.watch(mockDir, { + ignored: /mock-server/, ignoreInitial: true }).on('all', (event, path) => { if (event === 'change' || event === 'add') { From 7ca42be6036b755a4f9dc89891a3f77a184281f0 Mon Sep 17 00:00:00 2001 From: toruksmakto <42709228+toruksmakto@users.noreply.github.com> Date: Thu, 18 Apr 2019 19:54:34 +0800 Subject: [PATCH 03/49] perf[login.vue]: add tabindex for login form (#1933) --- src/views/login/index.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 9bff21a3..27f11ef5 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -19,6 +19,7 @@ :placeholder="$t('login.username')" name="username" type="text" + tabindex="1" auto-complete="on" /> @@ -35,6 +36,7 @@ :type="passwordType" :placeholder="$t('login.password')" name="password" + tabindex="2" auto-complete="on" @keyup.native="checkCapslock" @blur="capsTooltip = false" From 7dc9e681bf4906234556812730d30a944d7050bc Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 19 Apr 2019 17:24:15 +0800 Subject: [PATCH 04/49] docs: update readme --- README.zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index 0e15d8a4..0af0838d 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -161,7 +161,7 @@ cd vue-element-admin # 安装依赖 npm install -# 建议不要用 cnpm 安装 会有各种诡异的bug 可以通过如下操作解决 npm 下载速度慢的问题 +# 建议不要直接使用 cnpm 安装以来,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题 npm install --registry=https://registry.npm.taobao.org # 启动服务 From 120c78622d32641f9816db76b7f90a0d40ba9d83 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 19 Apr 2019 17:24:40 +0800 Subject: [PATCH 05/49] perf[jest]: clear jest test cache --- jest.config.js | 7 ++----- package.json | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/jest.config.js b/jest.config.js index 1ce813e1..143cdc86 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,12 +1,9 @@ module.exports = { - verbose: true, moduleFileExtensions: ['js', 'jsx', 'json', 'vue'], - transformIgnorePatterns: [ - 'node_modules/(?!(babel-jest|jest-vue-preprocessor)/)' - ], transform: { '^.+\\.vue$': 'vue-jest', - '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', + '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': + 'jest-transform-stub', '^.+\\.jsx?$': 'babel-jest' }, moduleNameMapper: { diff --git a/package.json b/package.json index 72e92927..6802c9b5 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "build:stage": "vue-cli-service build --mode staging", "preview": "node build/index.js --preview", "lint": "eslint --ext .js,.vue src", - "test:unit": "vue-cli-service test:unit", + "test:unit": "jest --clearCache && vue-cli-service test:unit", "test:ci": "npm run lint && npm run test:unit", "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml", "new": "plop" From d8dbf92b4714cd4f222d546413b6e15c63685e33 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 19 Apr 2019 17:25:11 +0800 Subject: [PATCH 06/49] tweak --- src/views/login/components/SocialSignin.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/login/components/SocialSignin.vue b/src/views/login/components/SocialSignin.vue index cbfb15d2..e9bf4f21 100644 --- a/src/views/login/components/SocialSignin.vue +++ b/src/views/login/components/SocialSignin.vue @@ -1,10 +1,12 @@ From f0ca1735d384e2779de3bda2091d3c327e133f20 Mon Sep 17 00:00:00 2001 From: anson Date: Tue, 23 Apr 2019 10:09:15 +0800 Subject: [PATCH 07/49] perf[Tinymce]: add width prop (#1951) --- src/components/Sticky/index.vue | 6 +++--- src/components/Tinymce/index.vue | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/Sticky/index.vue b/src/components/Sticky/index.vue index fa165bc7..97ce0e96 100644 --- a/src/components/Sticky/index.vue +++ b/src/components/Sticky/index.vue @@ -40,14 +40,14 @@ export default { mounted() { this.height = this.$el.getBoundingClientRect().height window.addEventListener('scroll', this.handleScroll) - window.addEventListener('resize', this.handleReize) + window.addEventListener('resize', this.handleResize) }, activated() { this.handleScroll() }, destroyed() { window.removeEventListener('scroll', this.handleScroll) - window.removeEventListener('resize', this.handleReize) + window.removeEventListener('resize', this.handleResize) }, methods: { sticky() { @@ -81,7 +81,7 @@ export default { } this.handleReset() }, - handleReize() { + handleResize() { if (this.isSticky) { this.width = this.$el.getBoundingClientRect().width + 'px' } diff --git a/src/components/Tinymce/index.vue b/src/components/Tinymce/index.vue index a05c3b9c..1e1c4ab5 100644 --- a/src/components/Tinymce/index.vue +++ b/src/components/Tinymce/index.vue @@ -38,9 +38,14 @@ export default { default: 'file edit insert view format table' }, height: { - type: Number, + type: [Number, String], required: false, default: 360 + }, + width: { + type: [Number, String], + required: false, + default: 'auto' } }, data() { @@ -91,6 +96,7 @@ export default { language: this.language, selector: `#${this.tinymceId}`, height: this.height, + width: this.width, body_class: 'panel-body ', object_resizing: false, toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar, From 3625f920411a831b60b1d650107e37b0517c3db0 Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 23 Apr 2019 11:25:53 +0800 Subject: [PATCH 08/49] fix[Tinymce]: fixed width bug --- src/components/Tinymce/index.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/Tinymce/index.vue b/src/components/Tinymce/index.vue index 1e1c4ab5..284851e5 100644 --- a/src/components/Tinymce/index.vue +++ b/src/components/Tinymce/index.vue @@ -1,5 +1,5 @@