Browse Source

修改

master
wen 2 years ago
parent
commit
e6ce3c3577
  1. 30
      src/views/login/index.vue

30
src/views/login/index.vue

@ -55,8 +55,8 @@
auto-complete="on" auto-complete="on"
/> />
</el-form-item> </el-form-item>
<div class="captcha_main" v-loading="captcha_loading"> <div class="captcha_main" @click="getCustomers" v-loading="captcha_loading">
<img class="captcha_img" :src="captchaimg" alt="验证码"/> <img v-if="!captcha_loading" class="captcha_img" :src="captchaimg" alt="验证码"/>
</div> </div>
</div> </div>
@ -104,6 +104,11 @@ export default {
} }
} }
return { return {
loading: false,
captcha_loading: true, //
passwordType: 'password',
redirect: undefined,
loginForm: { loginForm: {
username: '', username: '',
password: '', password: '',
@ -116,11 +121,7 @@ export default {
], ],
password: [{ required: true, trigger: 'blur', validator: validatePassword }], password: [{ required: true, trigger: 'blur', validator: validatePassword }],
captcha: [{ required: true, trigger: 'blur', validator: validateCaptcha }] captcha: [{ required: true, trigger: 'blur', validator: validateCaptcha }]
}, }
loading: false,
captcha_loading: false,
passwordType: 'password',
redirect: undefined
} }
}, },
watch: { watch: {
@ -136,10 +137,12 @@ export default {
// //
getCustomers() { getCustomers() {
let thiss = this; let thiss = this;
axios.post('/api/captcha', 'refresh').then(function (response) { this.captcha_loading = true;
axios.post('/api/captcha').then(function (response) {
let datamain = response.data; let datamain = response.data;
thiss.captchaimg = datamain.data; thiss.captchaimg = datamain.data;
console.log(response); thiss.captcha_loading = false;
//console.log(response);
}).catch(function (error) { }).catch(function (error) {
//console.log(error); //console.log(error);
this.$message({ this.$message({
@ -165,12 +168,9 @@ export default {
if (valid) { if (valid) {
this.loading = true this.loading = true
let thiss = this; let thiss = this;
axios.post('/api/login', this.loginForm, { axios.post('/api/login', this.loginForm, {headers: {'Content-Type': 'multipart/form-data'}
headers: {
'Content-Type': 'multipart/form-data'
}
}).then(function (response) { }).then(function (response) {
console.log(thiss.$router) console.log(response)
thiss.$router.push({path: '/usermange'}) thiss.$router.push({path: '/usermange'})
console.log('6666'); console.log('6666');
}).catch(function (error) { }).catch(function (error) {
@ -301,7 +301,7 @@ $cursor: #3c3535;
} }
.captcha_k{display:flex;} .captcha_k{display:flex;}
.captcha_k .captcha_main{width:100px;height:54px;margin: 0 0 0 15px;} .captcha_k .captcha_main{width:100px;height:54px;margin: 0 0 0 15px;}
.captcha_k .captcha_img{border-radius:6px;display:block;max-width:100%;height:100%;} .captcha_k .captcha_img{border-radius:6px;display:block;max-width:100%;height:100%;cursor:pointer;}
.captcha_k>.el-form-item{flex:1;} .captcha_k>.el-form-item{flex:1;}
} }
</style> </style>

Loading…
Cancel
Save