refactor: 完成项目目录重构与代码迁移
本次提交完成了整体项目的目录梳理与代码迁移: 1. 将根级controlplane、webhost等目录的代码迁移至desktop/对应子目录,统一桌面端架构 2. 移动并整理了插件目录结构,将插件统一放入根级plugins/ 3. 调整了前端项目的路径与配置,统一前后端开发构建流程 4. 清理了废弃的旧版app/目录与冗余的构建中间文件 5. 更新了.gitignore与README.md,适配新的项目结构
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
<div class="card">
|
||||
<div class="brand">
|
||||
<span class="logo">37</span>
|
||||
<div class="brand-meta">
|
||||
<h1>{{ appName }}</h1>
|
||||
<p>中心机统一账户登录</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<n-form class="form" label-placement="top" @keydown.enter.prevent="doLogin">
|
||||
<n-form-item label="账号">
|
||||
<n-input
|
||||
v-model:value="account"
|
||||
placeholder="请输入账号"
|
||||
autocomplete="username"
|
||||
size="large"
|
||||
@keyup.enter="doLogin"
|
||||
>
|
||||
<template #prefix><n-icon><User /></n-icon></template>
|
||||
</n-input>
|
||||
</n-form-item>
|
||||
<n-form-item label="密码">
|
||||
<n-input
|
||||
v-model:value="password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
autocomplete="current-password"
|
||||
size="large"
|
||||
show-password-on="click"
|
||||
@keyup.enter="doLogin"
|
||||
>
|
||||
<template #prefix><n-icon><Lock /></n-icon></template>
|
||||
</n-input>
|
||||
</n-form-item>
|
||||
<n-button type="primary" size="large" block class="primary" :loading="busy" @click="doLogin">
|
||||
{{ busy ? '登录中…' : '登 录' }}
|
||||
</n-button>
|
||||
</n-form>
|
||||
|
||||
<div class="foot">内网管理面 · 请使用管理员账号登录</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { User, Lock } from '@element-plus/icons-vue'
|
||||
import { adminLogin } from '../api'
|
||||
import { store } from '../store.js'
|
||||
import { message } from '../naive'
|
||||
|
||||
const props = defineProps({ appName: { type: String, default: '37du 自动化工作台' } })
|
||||
const emit = defineEmits(['ok'])
|
||||
|
||||
const account = ref('')
|
||||
const password = ref('')
|
||||
const busy = ref(false)
|
||||
|
||||
async function doLogin() {
|
||||
if (busy.value) return
|
||||
const acct = account.value.trim()
|
||||
if (!acct || !password.value) { message.warning('请输入账号与密码'); return }
|
||||
busy.value = true
|
||||
try {
|
||||
const r = await adminLogin(acct, password.value)
|
||||
if (!r.ok) throw new Error('登录失败')
|
||||
if (!r.is_admin) { throw new Error('该账号无管理权限') }
|
||||
store.current = acct
|
||||
store.token = r.token || ''
|
||||
store.isAdmin = true
|
||||
try { localStorage.setItem('cp_account', acct); localStorage.setItem('cp_token', store.token) } catch (_) {}
|
||||
message.success(`欢迎,${acct}`)
|
||||
emit('ok', r)
|
||||
} catch (e) {
|
||||
message.error(e.message || String(e))
|
||||
} finally {
|
||||
busy.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.login {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
box-sizing: border-box;
|
||||
background: linear-gradient(180deg, #f7f8fa 0%, #eef0f4 100%);
|
||||
font-family: var(--font-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif);
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 380px;
|
||||
box-sizing: border-box;
|
||||
background: #ffffff;
|
||||
border: 1px solid var(--cp-border, #e5e7ec);
|
||||
border-radius: 16px;
|
||||
padding: 34px 32px 28px;
|
||||
box-shadow: 0 16px 40px -24px rgba(30, 42, 76, .25);
|
||||
}
|
||||
|
||||
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
|
||||
.logo {
|
||||
width: 42px; height: 42px; border-radius: 12px; flex: none;
|
||||
display: grid; place-items: center;
|
||||
background: linear-gradient(135deg, #3b6cff 0%, #22c7e8 130%);
|
||||
color: #fff; font-size: 15px; font-weight: 800; letter-spacing: .4px;
|
||||
box-shadow: 0 8px 18px -8px rgba(59, 108, 255, .55);
|
||||
}
|
||||
.brand-meta h1 { margin: 0; font-size: 17px; font-weight: 700; color: var(--cp-ink, #1c2433); letter-spacing: .2px; }
|
||||
.brand-meta p { margin: 3px 0 0; font-size: 12px; color: var(--cp-ink-3, #8a93a6); }
|
||||
|
||||
.form :deep(.n-form-item) { margin-bottom: 20px; }
|
||||
.form :deep(.n-form-item-label) { font-size: 12.5px; font-weight: 600; color: var(--cp-ink-2, #4a5270); padding-bottom: 6px; }
|
||||
.form :deep(.n-input) { border-radius: 8px; }
|
||||
.form :deep(.n-input__inner) { font-size: 14px; }
|
||||
|
||||
.primary.n-button--primary-type { height: 44px; border-radius: 8px; font-size: 14px; letter-spacing: .1em; }
|
||||
|
||||
.foot { margin-top: 20px; text-align: center; font-size: 11.5px; color: var(--cp-ink-3, #8a93a6); }
|
||||
</style>
|
||||
Reference in New Issue
Block a user