feat(auth): 添加登录功能模块

- 引入新的登录中间件模块
- 在应用中间件链中注册登录处理器
- 修改前端登录接口调用路径
- 添加服务器选择下拉组件
- 实现服务器ID状态管理
- 更新登录表单数据绑定结构
This commit is contained in:
2025-12-25 01:33:46 +08:00
parent 6e50c39c62
commit af3a7c83e8
2 changed files with 6 additions and 3 deletions

View File

@@ -9,10 +9,11 @@ const servers = ref([])
const account = ref('')
const password = ref('')
const agree = ref(false)
const srvId = ref('')
async function handleLogin() {
if (!agree.value) return ElMessage.error('请勾选同意用户协议')
const {data} = await request.post('/api/server/list', {
const {data} = await request.post('/api/login', {
username: account,
password
})
@@ -43,10 +44,10 @@ onMounted(() => {
<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="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 v-for="item in servers" :value="item.id">{{ item.name }}</option>
</select>
</el-select>
<div id="agree" class="agree flex gap-4">
<el-checkbox v-model="agree"/>
我已阅读并同意 <a @click="protectProtocol">用户协议及隐私协议</a>