|
|
@@ -4,13 +4,13 @@
|
|
|
['', 'login-form-right', 'login-form-left'][direction]
|
|
|
]">
|
|
|
<el-form ref="form" size="large" :model="form" :rules="rules" class="login-form ele-bg-white"
|
|
|
- @keyup.enter.native="submit">
|
|
|
+ @keyup.enter.native="submit">
|
|
|
<h4>{{ $t('login.title') }}</h4>
|
|
|
<el-form-item prop="loginName">
|
|
|
- <el-input clearable v-model="form.loginName" prefix-icon="el-icon-user" placeholder="请输入登录账号" />
|
|
|
+ <el-input clearable v-model="form.loginName" prefix-icon="el-icon-user" placeholder="请输入登录账号"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="loginPwd">
|
|
|
- <el-input show-password v-model="form.loginPwd" prefix-icon="el-icon-lock" placeholder="请输入登录密码" />
|
|
|
+ <el-input show-password v-model="form.loginPwd" prefix-icon="el-icon-lock" placeholder="请输入登录密码"/>
|
|
|
</el-form-item>
|
|
|
<!-- <el-form-item prop="code">
|
|
|
<div class="login-input-group">
|
|
|
@@ -53,7 +53,7 @@
|
|
|
</div>
|
|
|
<!-- 多语言切换 -->
|
|
|
<div style="position: absolute; right: 30px; top: 20px">
|
|
|
- <i18n-icon :icon-style="{ fontSize: '22px', color: '#fff', cursor: 'pointer' }" />
|
|
|
+ <i18n-icon :icon-style="{ fontSize: '22px', color: '#fff', cursor: 'pointer' }"/>
|
|
|
</div>
|
|
|
<!-- 实际项目去掉这段 -->
|
|
|
<div class="hidden-xs-only" style="position: absolute; right: 30px; bottom: 20px; z-index: 9">
|
|
|
@@ -68,17 +68,19 @@
|
|
|
|
|
|
<script>
|
|
|
import I18nIcon from '@/layout/components/i18n-icon.vue';
|
|
|
-import { getToken } from '@/utils/token-util';
|
|
|
-import { login, getCaptcha } from '@/api/login';
|
|
|
-
|
|
|
+import {getToken} from '@/utils/token-util';
|
|
|
+import {login, getCaptcha} from '@/api/login';
|
|
|
+import xyy from '@/assets/xyy.jpg'
|
|
|
+import {getPathAddress} from "@/api/system/file";
|
|
|
|
|
|
export default {
|
|
|
// eslint-disable-next-line vue/multi-word-component-names
|
|
|
name: 'Login',
|
|
|
- components: { I18nIcon },
|
|
|
+ components: {I18nIcon},
|
|
|
data() {
|
|
|
return {
|
|
|
// 登录框方向, 0居中, 1居右, 2居左
|
|
|
+ xyy,
|
|
|
direction: 0,
|
|
|
// 加载状态
|
|
|
loading: false,
|
|
|
@@ -134,9 +136,11 @@ export default {
|
|
|
}
|
|
|
this.loading = true;
|
|
|
login(this.form)
|
|
|
- .then((res) => {
|
|
|
+ .then(async (res) => {
|
|
|
localStorage.setItem('userId', res.data.userId);
|
|
|
// 用户信息
|
|
|
+ const filePath = await getPathAddress()
|
|
|
+ res.data.avatarAddress = res.data.avatar && res.data.avatar.length ? filePath + res.data.avatar[0].storePath : xyy
|
|
|
this.$store.commit('user/setUserInfo', res.data);
|
|
|
this.loading = false;
|
|
|
this.$message.success(res.message);
|
|
|
@@ -158,7 +162,8 @@ export default {
|
|
|
},
|
|
|
/* 跳转到首页 */
|
|
|
goHome() {
|
|
|
- this.$router.push(this.$route?.query?.from ?? '/').catch(() => { });
|
|
|
+ this.$router.push(this.$route?.query?.from ?? '/').catch(() => {
|
|
|
+ });
|
|
|
},
|
|
|
/* 更换图形验证码 */
|
|
|
changeCaptcha() {
|
|
|
@@ -221,7 +226,7 @@ export default {
|
|
|
margin: 0 0 25px 0;
|
|
|
}
|
|
|
|
|
|
- &>.el-form-item {
|
|
|
+ & > .el-form-item {
|
|
|
margin-bottom: 25px;
|
|
|
}
|
|
|
}
|