103 lines
2.0 KiB
Vue
103 lines
2.0 KiB
Vue
|
<template>
|
|||
|
<div class="login-container">
|
|||
|
<div class="login-box">
|
|||
|
<h2>登录系统</h2>
|
|||
|
<form @submit.prevent="handleLogin">
|
|||
|
<div class="form-group">
|
|||
|
<label>用户名</label>
|
|||
|
<input type="text" v-model="username" required>
|
|||
|
</div>
|
|||
|
<div class="form-group">
|
|||
|
<label>密码</label>
|
|||
|
<input type="password" v-model="password" required>
|
|||
|
</div>
|
|||
|
<div class="form-group">
|
|||
|
<label>用户类型</label>
|
|||
|
<select v-model="userType">
|
|||
|
<option value="admin">管理员</option>
|
|||
|
<option value="staff">员工</option>
|
|||
|
<option value="customer">顾客</option>
|
|||
|
</select>
|
|||
|
</div>
|
|||
|
<button type="submit">登录</button>
|
|||
|
</form>
|
|||
|
<!-- 添加注册链接 -->
|
|||
|
<div class="form-footer">
|
|||
|
<p>还没有账号?<router-link to="/register">立即注册</router-link></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</template>
|
|||
|
|
|||
|
<script>
|
|||
|
export default {
|
|||
|
// eslint-disable-next-line vue/multi-word-component-names
|
|||
|
name: 'Login',
|
|||
|
data () {
|
|||
|
return {
|
|||
|
username: '',
|
|||
|
password: '',
|
|||
|
userType: 'customer'
|
|||
|
}
|
|||
|
},
|
|||
|
methods: {
|
|||
|
handleLogin () {
|
|||
|
// 实现登录逻辑
|
|||
|
console.log('登录信息:', this.username, this.password, this.userType)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
</script>
|
|||
|
|
|||
|
<style scoped>
|
|||
|
.login-container {
|
|||
|
display: flex;
|
|||
|
justify-content: center;
|
|||
|
align-items: center;
|
|||
|
height: 100vh;
|
|||
|
background-color: #f5f5f5;
|
|||
|
}
|
|||
|
|
|||
|
.login-box {
|
|||
|
width: 400px;
|
|||
|
padding: 20px;
|
|||
|
background: white;
|
|||
|
border-radius: 8px;
|
|||
|
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
|||
|
}
|
|||
|
|
|||
|
.form-group {
|
|||
|
margin-bottom: 15px;
|
|||
|
}
|
|||
|
|
|||
|
input, select {
|
|||
|
width: 100%;
|
|||
|
padding: 8px;
|
|||
|
margin-top: 5px;
|
|||
|
}
|
|||
|
|
|||
|
button {
|
|||
|
width: 100%;
|
|||
|
padding: 10px;
|
|||
|
background: #4CAF50;
|
|||
|
color: white;
|
|||
|
border: none;
|
|||
|
border-radius: 4px;
|
|||
|
cursor: pointer;
|
|||
|
}
|
|||
|
|
|||
|
.form-footer {
|
|||
|
margin-top: 15px;
|
|||
|
text-align: center;
|
|||
|
}
|
|||
|
|
|||
|
.form-footer a {
|
|||
|
color: #4CAF50;
|
|||
|
text-decoration: none;
|
|||
|
}
|
|||
|
|
|||
|
.form-footer a:hover {
|
|||
|
text-decoration: underline;
|
|||
|
}
|
|||
|
</style>
|