Commit 04f9f97162567c15c95ae639b96d815b22574601
1 parent
d0cd4403
调整社交登录界面,和登录界面保持统一
Showing
2 changed files
with
64 additions
and
88 deletions
yudao-ui-admin/src/views/login.vue
| @@ -82,6 +82,7 @@ | @@ -82,6 +82,7 @@ | ||
| 82 | </el-button> | 82 | </el-button> |
| 83 | </el-form-item> | 83 | </el-form-item> |
| 84 | 84 | ||
| 85 | + <!-- 社交登录 --> | ||
| 85 | <el-form-item style="width:100%;"> | 86 | <el-form-item style="width:100%;"> |
| 86 | <div class="oauth-login" style="display:flex"> | 87 | <div class="oauth-login" style="display:flex"> |
| 87 | <div class="oauth-login-item" v-for="item in SysUserSocialTypeEnum" :key="item.type" @click="doSocialLogin(item)"> | 88 | <div class="oauth-login-item" v-for="item in SysUserSocialTypeEnum" :key="item.type" @click="doSocialLogin(item)"> |
| @@ -90,11 +91,7 @@ | @@ -90,11 +91,7 @@ | ||
| 90 | </div> | 91 | </div> |
| 91 | </div> | 92 | </div> |
| 92 | </el-form-item> | 93 | </el-form-item> |
| 93 | - | ||
| 94 | - | ||
| 95 | </el-form> | 94 | </el-form> |
| 96 | - | ||
| 97 | - | ||
| 98 | </div> | 95 | </div> |
| 99 | </div> | 96 | </div> |
| 100 | </div> | 97 | </div> |
yudao-ui-admin/src/views/socialLogin.vue
| 1 | <template> | 1 | <template> |
| 2 | - <div class="login"> | ||
| 3 | - <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form"> | ||
| 4 | - <h3 class="title">绑定账号</h3> | ||
| 5 | - <el-form-item prop="username"> | ||
| 6 | - <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号"> | ||
| 7 | - <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" /> | ||
| 8 | - </el-input> | ||
| 9 | - </el-form-item> | ||
| 10 | - <el-form-item prop="password"> | ||
| 11 | - <el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码" @keyup.enter.native="handleLogin"> | ||
| 12 | - <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" /> | ||
| 13 | - </el-input> | ||
| 14 | - </el-form-item> | ||
| 15 | - <el-form-item style="width:100%;"> | ||
| 16 | - <el-button :loading="loading" size="medium" type="primary" style="width:100%;" @click.native.prevent="handleLogin"> | ||
| 17 | - <span v-if="!loading">提 交</span> | ||
| 18 | - <span v-else>提 交 中...</span> | ||
| 19 | - </el-button> | ||
| 20 | - </el-form-item> | 2 | + <div class="container"> |
| 3 | + <div class="logo"></div> | ||
| 4 | + <!-- 登录区域 --> | ||
| 5 | + <div class="content"> | ||
| 6 | + <!-- 配图 --> | ||
| 7 | + <div class="pic"></div> | ||
| 8 | + <!-- 表单 --> | ||
| 9 | + <div class="field"> | ||
| 10 | + <!-- [移动端]标题 --> | ||
| 11 | + <h2 class="mobile-title"> | ||
| 12 | + <h3 class="title">芋道后台管理系统</h3> | ||
| 13 | + </h2> | ||
| 21 | 14 | ||
| 22 | - </el-form> | ||
| 23 | - <!-- 底部 --> | ||
| 24 | - <div class="el-login-footer"> | ||
| 25 | - <span>Copyright © 2020-2021 iocoder.cn All Rights Reserved.</span> | 15 | + <!-- 表单 --> |
| 16 | + <div class="form-cont"> | ||
| 17 | + <el-tabs class="form" v-model="loginForm.loginType " style=" float:none;"> | ||
| 18 | + <el-tab-pane label="绑定账号" name="uname"> | ||
| 19 | + </el-tab-pane> | ||
| 20 | + </el-tabs> | ||
| 21 | + <div> | ||
| 22 | + <el-form ref="loginForm" :model="loginForm" :rules="LoginRules" class="login-form"> | ||
| 23 | + <!-- 账号密码登录 --> | ||
| 24 | + <el-form-item prop="username"> | ||
| 25 | + <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号"> | ||
| 26 | + <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon"/> | ||
| 27 | + </el-input> | ||
| 28 | + </el-form-item> | ||
| 29 | + <el-form-item prop="password"> | ||
| 30 | + <el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码" | ||
| 31 | + @keyup.enter.native="handleLogin"> | ||
| 32 | + <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/> | ||
| 33 | + </el-input> | ||
| 34 | + </el-form-item> | ||
| 35 | + <el-form-item prop="code" v-if="captchaEnable"> | ||
| 36 | + <el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%" | ||
| 37 | + @keyup.enter.native="handleLogin"> | ||
| 38 | + <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon"/> | ||
| 39 | + </el-input> | ||
| 40 | + <div class="login-code"> | ||
| 41 | + <img :src="codeUrl" @click="getCode" class="login-code-img"/> | ||
| 42 | + </div> | ||
| 43 | + </el-form-item> | ||
| 44 | + <el-checkbox v-model="loginForm.rememberMe" style="margin:0 0 25px 0;">记住密码</el-checkbox> | ||
| 45 | + <!-- 下方的登录按钮 --> | ||
| 46 | + <el-form-item style="width:100%;"> | ||
| 47 | + <el-button :loading="loading" size="medium" type="primary" style="width:100%;" | ||
| 48 | + @click.native.prevent="handleLogin"> | ||
| 49 | + <span v-if="!loading">登 录</span> | ||
| 50 | + <span v-else>登 录 中...</span> | ||
| 51 | + </el-button> | ||
| 52 | + </el-form-item> | ||
| 53 | + </el-form> | ||
| 54 | + </div> | ||
| 55 | + </div> | ||
| 56 | + </div> | ||
| 57 | + </div> | ||
| 58 | + <!-- footer --> | ||
| 59 | + <div class="footer"> | ||
| 60 | + Copyright © 2020-2022 iocoder.cn All Rights Reserved. | ||
| 26 | </div> | 61 | </div> |
| 27 | </div> | 62 | </div> |
| 28 | </template> | 63 | </template> |
| @@ -36,6 +71,7 @@ export default { | @@ -36,6 +71,7 @@ export default { | ||
| 36 | data() { | 71 | data() { |
| 37 | return { | 72 | return { |
| 38 | loginForm: { | 73 | loginForm: { |
| 74 | + loginType: "uname", | ||
| 39 | username: "admin", | 75 | username: "admin", |
| 40 | password: "admin123", | 76 | password: "admin123", |
| 41 | rememberMe: false, // TODO 芋艿:后面看情况,去掉这块 | 77 | rememberMe: false, // TODO 芋艿:后面看情况,去掉这块 |
| @@ -87,10 +123,12 @@ export default { | @@ -87,10 +123,12 @@ export default { | ||
| 87 | const username = Cookies.get("username"); | 123 | const username = Cookies.get("username"); |
| 88 | const password = Cookies.get("password"); | 124 | const password = Cookies.get("password"); |
| 89 | const rememberMe = Cookies.get('rememberMe') | 125 | const rememberMe = Cookies.get('rememberMe') |
| 126 | + const loginType = Cookies.get('loginType'); | ||
| 90 | this.loginForm = { | 127 | this.loginForm = { |
| 91 | username: username === undefined ? this.loginForm.username : username, | 128 | username: username === undefined ? this.loginForm.username : username, |
| 92 | password: password === undefined ? this.loginForm.password : decrypt(password), | 129 | password: password === undefined ? this.loginForm.password : decrypt(password), |
| 93 | - rememberMe: rememberMe === undefined ? false : Boolean(rememberMe) | 130 | + rememberMe: rememberMe === undefined ? false : Boolean(rememberMe), |
| 131 | + loginType: loginType === undefined ? this.loginForm.loginType : loginType, | ||
| 94 | }; | 132 | }; |
| 95 | }, | 133 | }, |
| 96 | handleLogin() { | 134 | handleLogin() { |
| @@ -123,64 +161,5 @@ export default { | @@ -123,64 +161,5 @@ export default { | ||
| 123 | </script> | 161 | </script> |
| 124 | 162 | ||
| 125 | <style rel="stylesheet/scss" lang="scss"> | 163 | <style rel="stylesheet/scss" lang="scss"> |
| 126 | -.login { | ||
| 127 | - display: flex; | ||
| 128 | - justify-content: center; | ||
| 129 | - align-items: center; | ||
| 130 | - height: 100%; | ||
| 131 | - background-image: url("http://static.yudao.iocoder.cn/login-background.jpg"); | ||
| 132 | - background-size: cover; | ||
| 133 | -} | ||
| 134 | -.title { | ||
| 135 | - margin: 0px auto 30px auto; | ||
| 136 | - text-align: center; | ||
| 137 | - color: #707070; | ||
| 138 | -} | ||
| 139 | - | ||
| 140 | -.login-form { | ||
| 141 | - border-radius: 6px; | ||
| 142 | - background: #ffffff; | ||
| 143 | - width: 400px; | ||
| 144 | - padding: 25px 25px 5px 25px; | ||
| 145 | - .el-input { | ||
| 146 | - height: 38px; | ||
| 147 | - input { | ||
| 148 | - height: 38px; | ||
| 149 | - } | ||
| 150 | - } | ||
| 151 | - .input-icon { | ||
| 152 | - height: 39px; | ||
| 153 | - width: 14px; | ||
| 154 | - margin-left: 2px; | ||
| 155 | - } | ||
| 156 | -} | ||
| 157 | -.login-tip { | ||
| 158 | - font-size: 13px; | ||
| 159 | - text-align: center; | ||
| 160 | - color: #bfbfbf; | ||
| 161 | -} | ||
| 162 | -.login-code { | ||
| 163 | - width: 33%; | ||
| 164 | - height: 38px; | ||
| 165 | - float: right; | ||
| 166 | - img { | ||
| 167 | - cursor: pointer; | ||
| 168 | - vertical-align: middle; | ||
| 169 | - } | ||
| 170 | -} | ||
| 171 | -.el-login-footer { | ||
| 172 | - height: 40px; | ||
| 173 | - line-height: 40px; | ||
| 174 | - position: fixed; | ||
| 175 | - bottom: 0; | ||
| 176 | - width: 100%; | ||
| 177 | - text-align: center; | ||
| 178 | - color: #fff; | ||
| 179 | - font-family: Arial; | ||
| 180 | - font-size: 12px; | ||
| 181 | - letter-spacing: 1px; | ||
| 182 | -} | ||
| 183 | -.login-code-img { | ||
| 184 | - height: 38px; | ||
| 185 | -} | 164 | +@import "~@/assets/styles/login.scss"; |
| 186 | </style> | 165 | </style> |