From ac8eddf3d7662a36c8ad3f3fde52af12e0a77150 Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 22 Jan 2019 16:35:53 +0800 Subject: [PATCH 01/11] update element-ui version --- README.md | 2 +- README.zh-CN.md | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cf67c757..bf0e08be 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ vue - element-ui + element-ui Build Status diff --git a/README.zh-CN.md b/README.zh-CN.md index d6cacf56..5dc9f1d7 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -7,7 +7,7 @@ vue - element-ui + element-ui Build Status diff --git a/package.json b/package.json index e5b0b9ec..83e93bce 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "driver.js": "0.8.1", "dropzone": "5.2.0", "echarts": "4.1.0", - "element-ui": "2.4.6", + "element-ui": "2.4.11", "file-saver": "1.3.8", "js-cookie": "2.2.0", "jsonlint": "1.6.3", From 8cf279fbe1e6b698b147a869290138934e003455 Mon Sep 17 00:00:00 2001 From: Yuga Sun Date: Wed, 23 Jan 2019 11:18:02 +0800 Subject: [PATCH 02/11] perf[Login Form]: optimize eye icon style (#1545) * optimiz: eye icon style for login form * change eye-open svg --- src/icons/svg/eye-open.svg | 1 + src/views/login/index.vue | 28 +++++++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 src/icons/svg/eye-open.svg diff --git a/src/icons/svg/eye-open.svg b/src/icons/svg/eye-open.svg new file mode 100644 index 00000000..88dcc98e --- /dev/null +++ b/src/icons/svg/eye-open.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 5e872595..a44c6ad3 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,11 +1,11 @@ From eb1d3381f48ff81632b22f944e1f53563ef22a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Thu, 24 Jan 2019 11:14:23 +0800 Subject: [PATCH 03/11] perf[Sticky]: export reset method (#1550) --- src/components/Sticky/index.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/Sticky/index.vue b/src/components/Sticky/index.vue index e0fb7c57..a287216d 100644 --- a/src/components/Sticky/index.vue +++ b/src/components/Sticky/index.vue @@ -56,10 +56,13 @@ export default { this.width = this.width + 'px' this.isSticky = true }, - reset() { + handleReset() { if (!this.active) { return } + this.reset() + }, + reset() { this.position = '' this.width = 'auto' this.active = false @@ -72,7 +75,7 @@ export default { this.sticky() return } - this.reset() + this.handleReset() }, handleReize() { if (this.isSticky) { From 8ef6c7ee7dc7cd78ccbc2545a1ec29fad5243cee Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 24 Jan 2019 13:48:19 +0800 Subject: [PATCH 04/11] perf[Sticky]: refine width default value --- src/components/Sticky/index.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Sticky/index.vue b/src/components/Sticky/index.vue index a287216d..5624a989 100644 --- a/src/components/Sticky/index.vue +++ b/src/components/Sticky/index.vue @@ -69,7 +69,8 @@ export default { this.isSticky = false }, handleScroll() { - this.width = this.$el.getBoundingClientRect().width + const width = this.$el.getBoundingClientRect().width + this.width = width || 'auto' const offsetTop = this.$el.getBoundingClientRect().top if (offsetTop < this.stickyTop) { this.sticky() From 23055c9b2c332930bddac1d25d099fde14390f76 Mon Sep 17 00:00:00 2001 From: xbigcat Date: Thu, 24 Jan 2019 15:32:35 +0800 Subject: [PATCH 05/11] perf[utils]: refine parseTime function (#1546) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 优化 parseTime 修复传入的时间戳是字符串类型,不能转换时间的问题 例:parseTime("1548221490638") * Update index.js --- src/utils/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index 0445827b..821392e9 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -11,7 +11,12 @@ export function parseTime(time, cFormat) { if (typeof time === 'object') { date = time } else { - if (('' + time).length === 10) time = parseInt(time) * 1000 + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { + time = parseInt(time) + } + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } date = new Date(time) } const formatObj = { From 3153a1b10bc32e1650c644d829f284d37ee044c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Fri, 25 Jan 2019 12:50:21 +0800 Subject: [PATCH 06/11] perf[UploadExcel]: optimized code (#1552) --- src/components/UploadExcel/index.vue | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/components/UploadExcel/index.vue b/src/components/UploadExcel/index.vue index 20e16398..a6b8dbce 100644 --- a/src/components/UploadExcel/index.vue +++ b/src/components/UploadExcel/index.vue @@ -82,8 +82,7 @@ export default { const reader = new FileReader() reader.onload = e => { const data = e.target.result - const fixedData = this.fixData(data) - const workbook = XLSX.read(btoa(fixedData), { type: 'base64' }) + const workbook = XLSX.read(data, { type: 'array' }) const firstSheetName = workbook.SheetNames[0] const worksheet = workbook.Sheets[firstSheetName] const header = this.getHeaderRow(worksheet) @@ -95,14 +94,6 @@ export default { reader.readAsArrayBuffer(rawFile) }) }, - fixData(data) { - let o = '' - let l = 0 - const w = 10240 - for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w))) - o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w))) - return o - }, getHeaderRow(sheet) { const headers = [] const range = XLSX.utils.decode_range(sheet['!ref']) From 9daeb1cb340136fdbbec021fe20941a97dc41d5b Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 29 Jan 2019 16:54:38 +0800 Subject: [PATCH 07/11] perf: adjust the import order to make it more elegant #1537 --- src/main.js | 2 +- src/store/modules/permission.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 1ce709c9..7739639d 100644 --- a/src/main.js +++ b/src/main.js @@ -10,8 +10,8 @@ import 'element-ui/lib/theme-chalk/index.css' import '@/styles/index.scss' // global css import App from './App' -import router from './router' import store from './store' +import router from './router' import i18n from './lang' // Internationalization import './icons' // icon diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 97de701e..13f60efb 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -36,7 +36,7 @@ function filterAsyncRouter(routes, roles) { const permission = { state: { - routers: constantRouterMap, + routers: [], addRouters: [] }, mutations: { From 727c1a45dd15bd668cfe584a2af8b5b0a9cd28ec Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 29 Jan 2019 18:00:59 +0800 Subject: [PATCH 08/11] perf[Sidebar]: use sass variables in vue template --- src/styles/variables.scss | 12 ++++++++++++ src/views/layout/components/Sidebar/index.vue | 10 +++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 09c3e9b0..87a5dd50 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -12,4 +12,16 @@ $panGreen: #30B08F; $menuBg:#304156; $subMenuBg:#1f2d3d; $menuHover:#001528; +$menuText:#bfcbd9; +$menuActiveText:#409EFF; $sideBarWidth: 180px; + +// the :export directive is the magic sauce for webpack +:export { + menuBg: $menuBg; + subMenuBg: $subMenuBg; + menuHover: $menuHover; + menuText:$menuText; + menuActiveText:$menuActiveText; + sideBarWidth: $sideBarWidth; +} diff --git a/src/views/layout/components/Sidebar/index.vue b/src/views/layout/components/Sidebar/index.vue index dff85f18..48407286 100644 --- a/src/views/layout/components/Sidebar/index.vue +++ b/src/views/layout/components/Sidebar/index.vue @@ -4,10 +4,10 @@ :show-timeout="200" :default-active="$route.path" :collapse="isCollapse" + :background-color="variables.menuBg" + :text-color="variables.menuText" + :active-text-color="variables.menuActiveText" mode="vertical" - background-color="#304156" - text-color="#bfcbd9" - active-text-color="#409EFF" > @@ -17,6 +17,7 @@