新增了游戏登陆页面
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;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html.dark {
|
||||
/* 自定义深色背景颜色 */
|
||||
--el-bg-color: #626aef;
|
||||
}
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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>
|
||||
@ -81,7 +84,7 @@
|
||||
<el-select
|
||||
style="width: 150px"
|
||||
placeholder="选择客户端"
|
||||
>
|
||||
>
|
||||
<el-option v-for="item in 3" :key="item" :label="'客户端'"></el-option>
|
||||
|
||||
</el-select>
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user