mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-20 08:26:37 +08:00
42 lines
835 B
Vue
42 lines
835 B
Vue
<template>
|
|
<h2> 登录-欢迎</h2>
|
|
<el-input v-model="loginForm.userName" placeholder="用户名" />
|
|
<el-input v-model="loginForm.password" placeholder="密码" show-password />
|
|
<el-button class="login-btn" type="primary" @click="login" >登录</el-button>
|
|
</template>
|
|
<script setup>
|
|
import { reactive } from 'vue';
|
|
import { useRouter } from 'vue-router';
|
|
import useUserStore from '@/stores/user.js'
|
|
const userStore=useUserStore();
|
|
const router=useRouter();
|
|
const loginForm=reactive({
|
|
userName:"",
|
|
password:"",
|
|
uuid:"",
|
|
code:""
|
|
})
|
|
|
|
const login=async ()=>{
|
|
const response= await userStore.login(loginForm);
|
|
if( response.code==undefined)
|
|
{
|
|
router.push("/index")
|
|
}
|
|
}
|
|
|
|
</script>
|
|
<style scoped>
|
|
h2{
|
|
text-align: center;
|
|
}
|
|
.el-input
|
|
{
|
|
margin:0rem 0 0.5rem 0;
|
|
|
|
}
|
|
.login-btn
|
|
{
|
|
width: 100%;
|
|
}
|
|
</style> |