新增了游戏登陆页面

This commit is contained in:
SummerColdWind 2024-07-29 22:05:00 +08:00
parent c751071b8a
commit e4371366c7
5 changed files with 76 additions and 14 deletions

9
src/api/login.js Normal file
View File

@ -0,0 +1,9 @@
import request from "@/utils/request.js";
export const gameLoginInterface = (username, password) => {
return request.post('/api/login/login', {
username: username,
password: password,
})
}

View File

@ -2,3 +2,8 @@
margin: 0;
padding: 0;
}
html.dark {
/* 自定义深色背景颜色 */
--el-bg-color: #626aef;
}

View File

@ -1,11 +1,67 @@
<script setup>
import {ref} from "vue";
import {gameLoginInterface} from '@/api/login.js'
const form = ref({
username: '',
password: '',
})
const rules = {
username: [
{required: true, message: '用户名不能为空', trigger: 'blur'}
],
password: [
{required: true, message: '密码不能为空', trigger: 'blur'}
],
}
const loginForm = ref(null)
const gameLogin = async () => {
await loginForm.value.validate()
const res = await gameLoginInterface(form.value.context)
console.log(res.data)
}
</script>
<template>
登陆游戏
<div class="login-page">
<el-form
:model="form"
:rules="rules"
ref="loginForm"
>
<el-form-item label="账号" prop="username">
<el-input
v-model="form.username"
></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input
v-model="form.password"
></el-input>
</el-form-item>
<el-form-item class="center-content">
<el-button type="warning" @click="gameLogin">开启本地监听</el-button>
<el-button type="primary" @click="gameLogin">确认</el-button>
</el-form-item>
</el-form>
</div>
</template>
<style scoped>
.el-form {
max-width: 300px;
}
.center-content {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
</style>

View File

@ -8,8 +8,11 @@
<h3>DDTD后台管理</h3>
<el-menu
router
background-color="#545c64"
text-color="#fff"
active-text-color="#ffd04b"
>
<el-menu-item index="/login">
<el-menu-item index="/gameLogin">
<el-icon>
<User/>
</el-icon>

View File

@ -1,11 +0,0 @@
<script setup>
</script>
<template>
</template>
<style scoped>
</style>