From bf03315b7ebfa802f81026581cf906df030d5353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=87=E7=BA=AF?= Date: Thu, 3 Sep 2020 19:11:47 +0800 Subject: [PATCH] =?UTF-8?q?fixbug:=201.=20=E5=8E=BB=E6=8E=89=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E6=89=93=E5=8C=85=E6=97=B6=E4=B8=BA=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E9=85=8D=E7=BD=AEBannerPlugin=202.=20fes-core=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2Icon=E7=BB=84=E4=BB=B6=203.=20setDefaultPage=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E7=9B=B4=E6=8E=A5=E8=B7=B3=E8=BD=AC=E5=88=B0defaultPa?= =?UTF-8?q?ge=EF=BC=8C=E8=80=8C=E4=B8=8D=E6=98=AFredirect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-cli/build/configs/webpack.config.js | 6 +++--- packages/fes-cli/package.json | 2 +- packages/fes-cli/template/fes.config.js | 9 ++++----- packages/fes-cli/template/package.json | 5 ++++- packages/fes-cli/template/src/app.js | 11 ++++------- packages/fes-core/package.json | 2 +- packages/fes-core/src/instance/app.js | 5 +---- packages/fes-core/src/views/layout/left.vue | 2 +- packages/fes-core/src/views/layout/root.vue | 10 ++++++++-- packages/fes-core/src/views/styles/layout.scss | 5 ++--- packages/fes-core/src/views/styles/polyfill.scss | 5 +---- packages/fes-template/fes.config.js | 7 +++---- packages/fes-template/src/app.js | 11 ++++------- 13 files changed, 37 insertions(+), 43 deletions(-) diff --git a/packages/fes-cli/build/configs/webpack.config.js b/packages/fes-cli/build/configs/webpack.config.js index 237e05362..407e99d1e 100644 --- a/packages/fes-cli/build/configs/webpack.config.js +++ b/packages/fes-cli/build/configs/webpack.config.js @@ -392,9 +392,9 @@ module.exports = function webpackConfig(configs, webpack, mode) { return `chunk-${joinedHash}`; }), - /* config.plugin('Copyright') */ - isBuild - && new webpack.BannerPlugin(''), + // /* config.plugin('Copyright') */ + // isBuild + // && new webpack.BannerPlugin(''), /* config.plugin('case-sensitive-paths') */ new CaseSensitivePathsPlugin(), diff --git a/packages/fes-cli/package.json b/packages/fes-cli/package.json index fd8e71be7..65b665fff 100644 --- a/packages/fes-cli/package.json +++ b/packages/fes-cli/package.json @@ -1,6 +1,6 @@ { "name": "@webank/fes-cli", - "version": "0.1.2", + "version": "0.1.3", "description": "一个好用的前端管理台快速开发框架", "preferGlobal": true, "scripts": { diff --git a/packages/fes-cli/template/fes.config.js b/packages/fes-cli/template/fes.config.js index e2fe8d4c1..b805c841b 100644 --- a/packages/fes-cli/template/fes.config.js +++ b/packages/fes-cli/template/fes.config.js @@ -11,18 +11,17 @@ module.exports = { }, // 测试环境 --env=sit 触发使用 develop: { - api: '' + api: 'http://test.xxx.com' }, - // 生产环境 --env=prod 触发使用 + // 生产环境 --env=sit 触发使用 prod: { - api: '' + api: 'http://xxx.com' } }, // 配置角色-路由访问权限,使用FesApp.setRole('unLogin')来修改当前用户的角色,控制路由访问权限 roles: { unLogin: ['/home'], - service: ['/list', '/home'], - admin: ['/list', '/api/fes'] + admin: ['/list', '*'] }, // map map: { diff --git a/packages/fes-cli/template/package.json b/packages/fes-cli/template/package.json index 4822c03e1..48b007e04 100644 --- a/packages/fes-cli/template/package.json +++ b/packages/fes-cli/template/package.json @@ -52,6 +52,9 @@ "husky": "^3.0.9", "lint-staged": "^9.4.2" }, - "dependencies": {}, + "dependencies": { + "@webank/fes-core": "^0.1.0", + "@webank/fes-ui": "^0.1.0" + }, "peerDependencies": {} } diff --git a/packages/fes-cli/template/src/app.js b/packages/fes-cli/template/src/app.js index 560670308..5cf4d2957 100644 --- a/packages/fes-cli/template/src/app.js +++ b/packages/fes-cli/template/src/app.js @@ -3,9 +3,6 @@ import './assets/styles/main.scss'; export default function () { this.FesApp.set('FesName', '$i18n.title'); - setTimeout(() => { - this.FesApp.setRole('admin', false); - }, 1000); // 设置退出逻辑 this.on('fes_logout', () => { @@ -26,10 +23,10 @@ export default function () { console.log(`您浏览到了${route.path}`); }); - // // 设置当前角色 - // if (!this.FesStorage.get('userLogin') === true) { - // this.setRole('unLogin') - // } + // 设置当前角色 + if (!this.FesStorage.get('userLogin') === true) { + this.setRole('unLogin'); + } // 设置AJAX配置 this.FesApi.option({ diff --git a/packages/fes-core/package.json b/packages/fes-core/package.json index 74f36938d..7cb0a4bb9 100644 --- a/packages/fes-core/package.json +++ b/packages/fes-core/package.json @@ -1,6 +1,6 @@ { "name": "@webank/fes-core", - "version": "0.1.0", + "version": "0.1.1", "description": "一个好用的前端管理台快速开发框架", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/packages/fes-core/src/instance/app.js b/packages/fes-core/src/instance/app.js index 1b95949a7..122095c94 100644 --- a/packages/fes-core/src/instance/app.js +++ b/packages/fes-core/src/instance/app.js @@ -205,10 +205,7 @@ class App { async setDefaultPage() { const defaultPage = await this.getDefaultPage(true); - this.router.addRoutes([{ - path: '/', - redirect: () => defaultPage - }]); + this.router.push(defaultPage); } async setRole(roleId, redirect = true, update = true) { diff --git a/packages/fes-core/src/views/layout/left.vue b/packages/fes-core/src/views/layout/left.vue index 2467670a7..dd59e8e47 100644 --- a/packages/fes-core/src/views/layout/left.vue +++ b/packages/fes-core/src/views/layout/left.vue @@ -16,7 +16,7 @@

{{fesFesx.FesRoleName}}

- +
diff --git a/packages/fes-core/src/views/layout/root.vue b/packages/fes-core/src/views/layout/root.vue index 9a7a635f5..8ccb32d12 100644 --- a/packages/fes-core/src/views/layout/root.vue +++ b/packages/fes-core/src/views/layout/root.vue @@ -3,8 +3,14 @@
- - + + + + + + + +
diff --git a/packages/fes-core/src/views/styles/layout.scss b/packages/fes-core/src/views/styles/layout.scss index 8c3f1d6d5..559a944bf 100644 --- a/packages/fes-core/src/views/styles/layout.scss +++ b/packages/fes-core/src/views/styles/layout.scss @@ -380,7 +380,6 @@ $dark-selected-color: #ffffff; } .layout-left-user-name { - // flex: 1; padding: 0 20px; p { margin: 10px 0; @@ -389,12 +388,12 @@ $dark-selected-color: #ffffff; } .layout-left-user-logout { - // flex: 1; height: 70px; line-height: 70px; text-align: center; - .ui-icon-logout { + .ui-icon { cursor: pointer; + vertical-align: middle; } } diff --git a/packages/fes-core/src/views/styles/polyfill.scss b/packages/fes-core/src/views/styles/polyfill.scss index 06bb089dd..305eb3ad2 100644 --- a/packages/fes-core/src/views/styles/polyfill.scss +++ b/packages/fes-core/src/views/styles/polyfill.scss @@ -16,7 +16,4 @@ } input[type=text]::-ms-clear { display: none; -} -.layout-left-user-logout i { - vertical-align: bottom; -} +} \ No newline at end of file diff --git a/packages/fes-template/fes.config.js b/packages/fes-template/fes.config.js index e2015d6f7..b805c841b 100644 --- a/packages/fes-template/fes.config.js +++ b/packages/fes-template/fes.config.js @@ -11,18 +11,17 @@ module.exports = { }, // 测试环境 --env=sit 触发使用 develop: { - api: 'http://h.adm-test.webank.io' + api: 'http://test.xxx.com' }, // 生产环境 --env=sit 触发使用 prod: { - api: 'http://adm.webank.io' + api: 'http://xxx.com' } }, // 配置角色-路由访问权限,使用FesApp.setRole('unLogin')来修改当前用户的角色,控制路由访问权限 roles: { unLogin: ['/home'], - service: ['/list', '/home'], - admin: ['/list', '/api/fes'] + admin: ['/list', '*'] }, // map map: { diff --git a/packages/fes-template/src/app.js b/packages/fes-template/src/app.js index 560670308..5cf4d2957 100644 --- a/packages/fes-template/src/app.js +++ b/packages/fes-template/src/app.js @@ -3,9 +3,6 @@ import './assets/styles/main.scss'; export default function () { this.FesApp.set('FesName', '$i18n.title'); - setTimeout(() => { - this.FesApp.setRole('admin', false); - }, 1000); // 设置退出逻辑 this.on('fes_logout', () => { @@ -26,10 +23,10 @@ export default function () { console.log(`您浏览到了${route.path}`); }); - // // 设置当前角色 - // if (!this.FesStorage.get('userLogin') === true) { - // this.setRole('unLogin') - // } + // 设置当前角色 + if (!this.FesStorage.get('userLogin') === true) { + this.setRole('unLogin'); + } // 设置AJAX配置 this.FesApi.option({