This commit is contained in:
24kycj
2024-11-05 09:23:42 +08:00
parent e109b28eec
commit d375616372
23 changed files with 316 additions and 703 deletions
+11 -4
View File
@@ -34,6 +34,7 @@
<script>
import { validUsername } from '@/utils/validate'
import { getToken, setToken, removeToken } from '@/utils/auth'
export default {
name: 'login',
@@ -78,12 +79,18 @@ export default {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true
this.$store.dispatch('Login', this.loginForm).then(() => {
setToken('data.token')
this.$store.commit('SET_TOKEN', 'data.token')
setTimeout(() => {
this.loading = false
this.$router.push({ path: '/' })
}).catch(() => {
this.loading = false
})
}, 2000);
// this.$store.dispatch('Login', this.loginForm).then(() => {
// this.loading = false
// this.$router.push({ path: '/' })
// }).catch(() => {
// this.loading = false
// })
} else {
console.log('error submit!!')
return false