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