Merge pull request 'dj' (#7) from dj into master

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/7
This commit is contained in:
2024-03-05 14:14:28 +00:00

View File

@@ -15,7 +15,8 @@
</el-form-item>
<el-form-item prop="code" label="验证码">
<div class="code">
<el-input v-model="loginForm.code" :prefix-icon="key" @keyup.enter.native="handleLogin(formInstance)"></el-input>
<el-input v-model="loginForm.code" :prefix-icon="key"
@keyup.enter.native="handleLogin(formInstance)"></el-input>
<img :src="codeImg" alt="" @click="getCode">
</div>
</el-form-item>
@@ -32,6 +33,7 @@ import { getCodeImg } from '../../api/login';
import {useAuthStore} from '@/stores/userstore'
import {ElLoading} from 'element-plus'
import {User, Lock, Key} from '@element-plus/icons-vue'
const router = useRouter()
const authStore = useAuthStore()
const loginForm = reactive({
@@ -66,14 +68,14 @@ const handleLogin = (instance) => {
if (!instance) return
instance.validate(async (valid, fields) => {
if (!valid) return
// 发送请求
await authStore.userLogin(loginForm).then(res => {
if (res) {
ElLoading.service({
lock: true,
text: '登录中...',
background: 'rgba(0, 0, 0, 0.7)',
})
// 发送请求
await authStore.userLogin(loginForm).then(res=>{
if(res) {
router.push('/')
} else {
getCode()
@@ -85,7 +87,11 @@ const handleLogin = (instance) => {
getCode()
onBeforeUnmount(() => {
ElLoading.service({text: '正在加载系统资源',background: '#409eff',lock: true}).close()
ElLoading.service({
lock: true,
text: '登录中...',
background: 'rgba(0, 0, 0, 0.7)',
}).close()
})
</script>
@@ -115,15 +121,18 @@ onBeforeUnmount(() => {
}
}
}
.code {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
.el-input {
// width: ;
flex: 2;
}
img {
height: 32px;
flex: 1;