This commit is contained in:
张成
2025-10-08 18:53:38 +08:00
parent 43eb9715fa
commit 845658f193
39 changed files with 4820 additions and 93 deletions

View File

@@ -27,6 +27,9 @@
<script>
import config from '@/config'
import LoginForm from '@component/login-form'
import Main from '@component/main'
import ParentView from '@component/parent-view'
import Page404 from '@/views/error-page/404.vue'
import { mapActions } from 'vuex'
export default {
@@ -39,11 +42,35 @@ export default {
LoginForm,
},
methods: {
...mapActions(['handleLogin']),
...mapActions('user', ['handleLogin']),
async handleSubmit({ userName, password }) {
let user = { name: userName, password: password }
await this.handleLogin(user)
window.location.reload()
try {
let userFrom = { name: userName, password: password }
await this.handleLogin({
userFrom,
Main,
ParentView,
Page404
})
this.$Message.success('登录成功!')
window.location.reload()
} catch (error) {
console.error('登录失败:', error)
// 处理不同类型的错误
let errorMsg = '登录失败,请检查用户名和密码'
if (error) {
if (typeof error === 'string') {
errorMsg = error
} else if (error.message) {
errorMsg = error.message
} else if (error.data && error.data.message) {
errorMsg = error.data.message
}
}
this.$Message.error(errorMsg)
}
},
},
}