|
@@ -34,6 +34,11 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
|
|
|
+ <el-form-item class="verification-code" prop="verification_code_image_text">
|
|
|
+ <el-input v-model="loginForm.verification_code_image_text" />
|
|
|
+ <el-image v-if="image_content_base64.length > 0" :src="`data:image/jpg;base64,${image_content_base64}`" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
<el-button
|
|
@@ -62,7 +67,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { GetVerificationCodeImage } from '@/api/app';
|
|
|
import { getConfigInformation } from '@/utils/index';
|
|
|
+import md5 from 'md5';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
@@ -85,14 +92,19 @@ export default {
|
|
|
loginForm: {
|
|
|
user_name: '',
|
|
|
password: '',
|
|
|
- user_type: ''
|
|
|
+ user_type: '',
|
|
|
+ is_password_md5: 'true',
|
|
|
+ verification_code_image_id: '',
|
|
|
+ verification_code_image_text: ''
|
|
|
},
|
|
|
loginRules: {
|
|
|
user_name: [{ trigger: 'blur', validator: validateUsername }],
|
|
|
- password: [{ trigger: 'blur', validator: validatePassword }]
|
|
|
+ password: [{ trigger: 'blur', validator: validatePassword }],
|
|
|
+ verification_code_image_text: [{ required: true, trigger: 'blur', message: '验证码不能为空' }]
|
|
|
},
|
|
|
loading: false,
|
|
|
- redirect: null
|
|
|
+ redirect: null,
|
|
|
+ image_content_base64: ''
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -104,6 +116,11 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.getConfig();
|
|
|
+
|
|
|
+ GetVerificationCodeImage().then(({ image_id, image_content_base64 }) => {
|
|
|
+ this.loginForm.verification_code_image_id = image_id;
|
|
|
+ this.image_content_base64 = image_content_base64;
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
async getConfig() {
|
|
@@ -114,8 +131,10 @@ export default {
|
|
|
if (valid) {
|
|
|
this.loginForm.user_type = user_type;
|
|
|
this.loading = true;
|
|
|
+ const loginForm = { ...this.loginForm };
|
|
|
+ loginForm.password = md5(loginForm.password).toUpperCase();
|
|
|
this.$store
|
|
|
- .dispatch('user/login', { loginForm: this.loginForm })
|
|
|
+ .dispatch('user/login', { loginForm })
|
|
|
.then(() => {
|
|
|
this.$router.push({ path: this.redirect || '/' });
|
|
|
this.loading = false;
|
|
@@ -159,6 +178,21 @@ export default {
|
|
|
padding: 160px 35px 0;
|
|
|
margin: 0 auto;
|
|
|
overflow: hidden;
|
|
|
+
|
|
|
+ .verification-code {
|
|
|
+ .el-input {
|
|
|
+ width: 120px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-image {
|
|
|
+ margin-left: 24px;
|
|
|
+ vertical-align: bottom;
|
|
|
+
|
|
|
+ &__inner {
|
|
|
+ vertical-align: middle;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.login-button {
|