Browse Source

解决冲突

master
wen 2 years ago
parent
commit
b34bd75b4f
  1. 104
      src/views/login/index.vue

104
src/views/login/index.vue

@ -312,107 +312,3 @@ $cursor: #3c3535;
.captcha_k>.el-form-item{flex:1;} .captcha_k>.el-form-item{flex:1;}
} }
</style> </style>
<<<<<<< HEAD
<script>
//import { validUsername } from '@/utils/validate'
import axios from 'axios'
export default {
data() {
const validateUsername = (rule, value, callback) => {
if (value.length < 3) {
callback(new Error('请输入正确的用户名'))
} else {
callback()
}
}
const validatePassword = (rule, value, callback) => {
if (value.length < 6) {
callback(new Error('请输入正确的密码'))
} else {
callback()
}
}
return {
loginForm: {
username: '',
password: ''
},
loginRules: {
username: [
{ required: true, trigger: 'blur', validator: validateUsername }
],
password: [{ required: true, trigger: 'blur', validator: validatePassword }]
},
loading: false,
passwordType: 'password',
redirect: undefined
}
},
watch: {
$route: {
handler: function(route) {
this.redirect = route.query && route.query.redirect
},
immediate: true
}
},
methods: {
showPwd() {
if (this.passwordType === 'password') {
this.passwordType = 'text'
} else {
this.passwordType = 'password'
}
this.$nextTick(() => {
this.$refs.password.focus()
})
},
handleLogin() {
this.$refs.loginForm.validate(valid => {
// console.log(valid);
if (valid) {
this.loading = true
let thiss = this;
axios.post('/api/mkdir', {
firstName: 'Fred',
lastName: 'Flintstone'
})
.then(function (response) {
console.log(thiss.$router)
thiss.$router.push({ path: '/usermange'})
console.log(response + 'ffef');
})
.catch(function (error) {
console.log(error);
});
this.$message({
showClose: true,
message: '错了哦,这是一条错误消息',
type: 'error'
});
// this.$store.dispatch('user/login', this.loginForm).then(() => {
// this.$router.push({ path: this.redirect || '/' })
// this.loading = false
// }).catch(() => {
// this.loading = false
// })
} else {
console.log('error submit!!')
return false
}
})
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
}
}
</script>
=======
>>>>>>> b9f48174581e5575baa49552e095a17d28ecf1a8

Loading…
Cancel
Save