feat(auth): 添加登录功能模块
- 引入新的登录中间件模块 - 在应用中间件链中注册登录处理器 - 修改前端登录接口调用路径 - 添加服务器选择下拉组件 - 实现服务器ID状态管理 - 更新登录表单数据绑定结构
This commit is contained in:
@@ -5,6 +5,7 @@ import koaStatic from 'koa-static';
|
|||||||
import registry from "./registry.js";
|
import registry from "./registry.js";
|
||||||
import * as log4js from "../log4js.js";
|
import * as log4js from "../log4js.js";
|
||||||
import auth from "./auth.js";
|
import auth from "./auth.js";
|
||||||
|
import login from "./login.js";
|
||||||
|
|
||||||
const app = new Koa();
|
const app = new Koa();
|
||||||
const router = new Router();
|
const router = new Router();
|
||||||
@@ -22,6 +23,7 @@ app.proxy = true;
|
|||||||
app.use(auth)
|
app.use(auth)
|
||||||
app.use(router.routes());
|
app.use(router.routes());
|
||||||
app.use(registry)
|
app.use(registry)
|
||||||
|
app.use(login)
|
||||||
app.use(router.allowedMethods());
|
app.use(router.allowedMethods());
|
||||||
app.use(koaStatic('/www'))
|
app.use(koaStatic('/www'))
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ const servers = ref([])
|
|||||||
const account = ref('')
|
const account = ref('')
|
||||||
const password = ref('')
|
const password = ref('')
|
||||||
const agree = ref(false)
|
const agree = ref(false)
|
||||||
|
const srvId = ref('')
|
||||||
|
|
||||||
async function handleLogin() {
|
async function handleLogin() {
|
||||||
if (!agree.value) return ElMessage.error('请勾选同意用户协议')
|
if (!agree.value) return ElMessage.error('请勾选同意用户协议')
|
||||||
const {data} = await request.post('/api/server/list', {
|
const {data} = await request.post('/api/login', {
|
||||||
username: account,
|
username: account,
|
||||||
password
|
password
|
||||||
})
|
})
|
||||||
@@ -43,10 +44,10 @@ onMounted(() => {
|
|||||||
<b class="title mb-20">神临苍月</b>
|
<b class="title mb-20">神临苍月</b>
|
||||||
<input class="w100" type="text" id="account" v-model="account" placeholder="请输入账号" @keyup="v=>account=v.replace(/[\W]/g, '')" autocomplete="off"/>
|
<input class="w100" type="text" id="account" v-model="account" placeholder="请输入账号" @keyup="v=>account=v.replace(/[\W]/g, '')" autocomplete="off"/>
|
||||||
<input class="w100" type="password" id="password" v-model="password" placeholder="请输入密码"/>
|
<input class="w100" type="password" id="password" v-model="password" placeholder="请输入密码"/>
|
||||||
<select id="serverId" style="border: none; display: none; margin-bottom: 10px;">
|
<el-select id="serverId" v-model="srvId" style="border: none; display: none; margin-bottom: 10px;">
|
||||||
<option value="0">请选择区服</option>
|
<option value="0">请选择区服</option>
|
||||||
<option v-for="item in servers" :value="item.id">{{ item.name }}区</option>
|
<option v-for="item in servers" :value="item.id">{{ item.name }}区</option>
|
||||||
</select>
|
</el-select>
|
||||||
<div id="agree" class="agree flex gap-4">
|
<div id="agree" class="agree flex gap-4">
|
||||||
<el-checkbox v-model="agree"/>
|
<el-checkbox v-model="agree"/>
|
||||||
我已阅读并同意 <a @click="protectProtocol">用户协议及隐私协议</a>
|
我已阅读并同意 <a @click="protectProtocol">用户协议及隐私协议</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user