From 31c16f2d3a350ca70bf31a0676d739b816c81ea7 Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Wed, 18 Jul 2018 13:57:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=AB=E9=80=9F=E9=80=89=E6=8B=A9=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=99=BB=E9=99=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 610c12b2a8679bfcad918e3d24d04a1a6af41c4c [formerly 610c12b2a8679bfcad918e3d24d04a1a6af41c4c [formerly 610c12b2a8679bfcad918e3d24d04a1a6af41c4c [formerly 610c12b2a8679bfcad918e3d24d04a1a6af41c4c [formerly cc710028c0810b73facbb1f00ba054da58bd88da [formerly 39767add7846a4a3f27fb79c47d121ceb1d3d6a0]]]]] Former-commit-id: 740804501e73b47382d505ce1fa24e7bba3beb3b Former-commit-id: a61192c10d96e687b6fe7ebd5e40e2a2cc816d8b Former-commit-id: e142163ddd0be72d2de796dc90a54de29e64da4d [formerly 1f32a6afe0a2302808606bcb9c9776e93d4d805b] Former-commit-id: 2bd41fd483228f0aff6255f5be5b72aa72e4b64e Former-commit-id: bfd7e5e99f4774d60e8433e4f519d1d44db187ad Former-commit-id: 8c4f66b40505956019099d80abbdaaa88808b011 Former-commit-id: aa887c968ab01b652512c95dc5b8503f68230c49 Former-commit-id: 0785746511cac0ba75c813f15e5b0914fbd916c1 --- public/index.html | 2 +- src/assets/style/theme/theme-base.scss | 2 +- .../components/header-user/index.vue | 9 ++- src/libs/db.js | 2 +- src/main.js | 8 +-- src/mock/login/index.js | 12 ++++ .../image/icon@2x.png.REMOVED.git-id | 1 + src/pages/error-page-is-low-ie/index.js | 3 + src/pages/error-page-is-low-ie/page.vue | 28 ++++++++ src/pages/login/index.js | 2 +- src/pages/login/{login.vue => page.vue} | 72 +++++++++++++++---- src/pages/login/style.scss | 24 +++++++ src/router/routes.js.REMOVED.git-id | 2 +- src/store/modules/d2admin.js.REMOVED.git-id | 2 +- 14 files changed, 139 insertions(+), 30 deletions(-) create mode 100644 src/pages/error-page-is-low-ie/image/icon@2x.png.REMOVED.git-id create mode 100644 src/pages/error-page-is-low-ie/index.js create mode 100644 src/pages/error-page-is-low-ie/page.vue rename src/pages/login/{login.vue => page.vue} (65%) diff --git a/public/index.html b/public/index.html index 6004dc20..57a0ef71 100644 --- a/public/index.html +++ b/public/index.html @@ -166,7 +166,7 @@
加载中
-
欢迎使用 D2Admin 开发,初次加载会比较慢,请耐心等待
+
欢迎使用 D2Admin 进行你的开发,初次加载会比较慢,请耐心等待
如果很久很久都没有加载成功,请清空缓存重新加载页面
Github仓库 diff --git a/src/assets/style/theme/theme-base.scss b/src/assets/style/theme/theme-base.scss index 9e63901a..ffed0627 100644 --- a/src/assets/style/theme/theme-base.scss +++ b/src/assets/style/theme/theme-base.scss @@ -2,7 +2,7 @@ .d2-layout-header-aside-group { height: 100%; width: 100%; - min-width: 1000px; + min-width: 900px; background-size: cover; background-position: center; overflow: hidden; diff --git a/src/layout/header-aside/components/header-user/index.vue b/src/layout/header-aside/components/header-user/index.vue index 7cb2a946..62de837b 100644 --- a/src/layout/header-aside/components/header-user/index.vue +++ b/src/layout/header-aside/components/header-user/index.vue @@ -1,6 +1,6 @@ @@ -53,11 +65,32 @@ import { mapMutations } from 'vuex' export default { data () { return { + // 快速选择用户 + dialogVisible: false, + users: [ + { + name: '管理员', + username: 'admin', + password: 'admin' + }, + { + name: '编辑', + username: 'editor', + password: 'editor' + }, + { + name: '用户', + username: 'user', + password: 'user' + } + ], + // 表单 formLogin: { username: 'admin', password: 'admin', code: 'v9am' }, + // 校验 rules: { username: [ { required: true, message: '请输入用户名', trigger: 'blur' } @@ -77,8 +110,21 @@ export default { }, methods: { ...mapMutations([ - 'd2adminUsernameSet' + 'd2adminUserInfoSet', + 'd2adminLoginSuccessLoad' ]), + /** + * @description 接收选择一个用户快速登陆的事件 + * @param {object} user 用户信息 + */ + handleUserBtnClick (user) { + this.formLogin.username = user.username + this.formLogin.password = user.password + this.submit() + }, + /** + * @description 提交表单 + */ // 提交登陆信息 submit () { this.$refs.loginForm.validate((valid) => { @@ -93,18 +139,19 @@ export default { } }) .then(res => { - console.group('登陆结果') - console.log('res: ', res) - console.groupEnd() // cookie 一天的有效期 const setting = { expires: 1 } // 设置 cookie 一定要存 uuid 和 token 两个 cookie,整个系统依赖这两个数据进行校验和存储 - Cookies.set('uuid', res.uuid, setting) - Cookies.set('token', res.token, setting) - // 设置 vuex - this.d2adminUsernameSet(res.name) + Cookies.set('uuid', res.data.uuid, setting) + Cookies.set('token', res.data.token, setting) + // 设置 vuex 用户信息 + this.d2adminUserInfoSet({ + name: res.data.name + }) + // 用户登陆后从数据库加载一系列的设置 + this.d2adminLoginSuccessLoad() // 跳转路由 this.$router.push({ name: 'index' @@ -127,4 +174,3 @@ export default { - diff --git a/src/pages/login/style.scss b/src/pages/login/style.scss index 01fa612c..42cf658c 100644 --- a/src/pages/login/style.scss +++ b/src/pages/login/style.scss @@ -63,4 +63,28 @@ width: 300px; margin-top: 20px; } + .user-btn { + @extend %flex-center-col; + @extend %unable-select; + padding: 10px 0px; + border-radius: 4px; + &:hover { + background-color: $color-bg; + i { + color: $color-text-normal; + } + span { + color: $color-text-normal; + } + } + i { + font-size: 36px; + color: $color-text-sub; + } + span { + font-size: 12px; + margin-top: 10px; + color: $color-text-sub; + } + } } \ No newline at end of file diff --git a/src/router/routes.js.REMOVED.git-id b/src/router/routes.js.REMOVED.git-id index ce1d1d83..91a2adb0 100644 --- a/src/router/routes.js.REMOVED.git-id +++ b/src/router/routes.js.REMOVED.git-id @@ -1 +1 @@ -51bf6b20922ac42bc614d4dafc3928f2f9017796 \ No newline at end of file +d1fc661cca201ded872328bf7926689075938e00 \ No newline at end of file diff --git a/src/store/modules/d2admin.js.REMOVED.git-id b/src/store/modules/d2admin.js.REMOVED.git-id index 63e5b434..68f2d485 100644 --- a/src/store/modules/d2admin.js.REMOVED.git-id +++ b/src/store/modules/d2admin.js.REMOVED.git-id @@ -1 +1 @@ -2831ac4870bc4916671225959f7721a1eeb52ebd \ No newline at end of file +cb5203e7da4a54f17ca8f08ae175eae15db544f0 \ No newline at end of file