新增了游戏登陆页面
This commit is contained in:
parent
c751071b8a
commit
e4371366c7
9
src/api/login.js
Normal file
9
src/api/login.js
Normal 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,
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -2,3 +2,8 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html.dark {
|
||||||
|
/* 自定义深色背景颜色 */
|
||||||
|
--el-bg-color: #626aef;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,11 +1,67 @@
|
|||||||
<script setup>
|
<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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<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>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
.el-form {
|
||||||
|
max-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center-content {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -8,8 +8,11 @@
|
|||||||
<h3>DDTD后台管理</h3>
|
<h3>DDTD后台管理</h3>
|
||||||
<el-menu
|
<el-menu
|
||||||
router
|
router
|
||||||
|
background-color="#545c64"
|
||||||
|
text-color="#fff"
|
||||||
|
active-text-color="#ffd04b"
|
||||||
>
|
>
|
||||||
<el-menu-item index="/login">
|
<el-menu-item index="/gameLogin">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<User/>
|
<User/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
<script setup>
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
Loading…
Reference in New Issue
Block a user