From ce2791d2a730845a564ce0e16563b03fea0970db Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期三, 15 五月 2024 16:24:28 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
---
UI-Project/src/views/LoginView.vue | 55 +++++++++++++++++++++++++++++++------------------------
1 files changed, 31 insertions(+), 24 deletions(-)
diff --git a/UI-Project/src/views/LoginView.vue b/UI-Project/src/views/LoginView.vue
index 43eea2f..40d2d9b 100644
--- a/UI-Project/src/views/LoginView.vue
+++ b/UI-Project/src/views/LoginView.vue
@@ -5,21 +5,21 @@
import {ElMessage} from 'element-plus'
import request from '@/utils/request'
import userInfo from '@/stores/userInfo'
-
+
const store = userInfo()
let ruleFormRef = ref<FormInstance>()
const router = useRouter()
const route = useRoute()
-
+
const userForm = reactive({
userName: '',
password: '',
})
-
+
if (typeof route.query.id != 'undefined') {
userForm.userId = <string>route.query.id
}
-
+
const validateUser = (rule: any, value: any, callback: any) => {
if (value === '') {
callback(new Error('璇疯緭鍏ヤ綘鐨勮处鍙�'))
@@ -27,7 +27,7 @@
callback()
}
}
-
+
const validatePass = (rule: any, value: any, callback: any) => {
if (value === '') {
callback(new Error('璇疯緭鍏ヤ綘鐨勫瘑鐮�'))
@@ -35,12 +35,12 @@
callback()
}
}
-
+
const rules = reactive<FormRules<typeof userForm>>({
userId: [{validator: validateUser, trigger: 'blur'}],
pass: [{validator: validatePass, trigger: 'blur'}],
})
-
+
//鐧婚檰鏂规硶
const submitForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
@@ -48,38 +48,45 @@
if (valid) {
loginLoadings.value = true
request
- .post('/userinfo/login', userForm)
+ // .post('/loadGlass/userinfo/login', userForm)
+ .post('/loadGlass/sys/user/login', userForm)
.then((res) => {
if (res['code'] == 200) {
store.$patch({user: res.data})
console.log(res.data)
-
+
router.push('/main')
ElMessage.success(`鐧诲綍鎴愬姛`)
} else {
ElMessage.error(res['msg'])
+ store.$patch({
+ user: null,
+ })
loginLoadings.value = false
return false
}
})
.catch((error) => {
ElMessage.error('鏈嶅姟鍣ㄨ繛鎺ュけ璐�')
+ store.$patch({
+ user: null,
+ })
loginLoadings.value = false
return false
})
}
})
}
-
+
function register() {
router.push({
path: '/register',
})
}
-
+
let loginLoadings = ref(false)
let registerLoadings = ref(false)
-
+
const keyDown = (e) => {
// 鍥炶溅鍒欐墽琛岀櫥褰曟柟娉� enter閿殑ASCII鏄�13
if (e.keyCode == 13 || e.keyCode == 100) {
@@ -93,7 +100,7 @@
window.removeEventListener('keydown', keyDown)
})
</script>
-
+
<template>
<div class="mainDiv">
<div id="main-login">
@@ -148,29 +155,29 @@
@click="register"
plain>娉ㄥ唽
</el-button>
-
+
</el-form-item>
</div>
</el-form>
</div>
</div>
-
+
</div>
</template>
-
+
<style scoped>
.mainDiv {
overflow: hidden;
min-width: 718px;
background-image: url('../../src/assets/background.jpg');
}
-
+
#main-login {
margin: 150px auto 0 auto;
height: 70vh;
width: 80vw;
}
-
+
#img-div {
width: 55%;
height: 100%;
@@ -179,12 +186,12 @@
align-items: center;
float: left;
}
-
+
#img-pic {
max-height: 90%;
max-width: 100%;
}
-
+
#div-login {
margin-top: 5%;
/* margin-top: 20%; */
@@ -197,22 +204,22 @@
border-radius: 4px;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0), 0 6px 5px 0 rgba(0, 0, 0, 0.19);
}
-
+
#center {
margin-top: -30px;
}
-
+
.el-form {
width: 60%;
margin: 20% auto auto;
}
-
+
#submitForm {
display: flex;
justify-content: space-evenly;
margin-top: 2rem;
}
-
+
:deep(.el-form-item__content) {
flex: unset;
}
--
Gitblit v1.8.0