init: 管理会计OS初始代码
包含前后端完整代码: - 前端:Vue3+Vite+ElementPlus - 后端:FastAPI+SQLAlchemy - 模块:驾驶舱/KPI/战略地图/预警/预算/成本/预测/改善行动 - 当前版本:v1.0.0
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<div class="login-page">
|
||||
<div class="login-card">
|
||||
<h1>管理会计OS</h1>
|
||||
<p class="subtitle">博海网络科技</p>
|
||||
<el-form ref="formRef" :model="form" label-width="0" @keyup.enter="handleLogin">
|
||||
<el-form-item><el-input v-model="form.username" placeholder="用户名" size="large" /></el-form-item>
|
||||
<el-form-item><el-input v-model="form.password" type="password" placeholder="密码" size="large" show-password /></el-form-item>
|
||||
<el-form-item><el-button type="primary" size="large" style="width:100%" :loading="loading" @click="handleLogin">登 录</el-button></el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { authApi } from '../api/index'
|
||||
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
const form = reactive({ username: 'admin', password: 'admin123' })
|
||||
|
||||
async function handleLogin() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res: any = await authApi.login(form)
|
||||
localStorage.setItem('cma_token', res.token)
|
||||
localStorage.setItem('cma_user', JSON.stringify(res.user))
|
||||
router.push('/dashboard')
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.response?.data?.detail || '登录失败')
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.login-page { display: flex; align-items: center; justify-content: center; height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
|
||||
.login-card { background: #fff; padding: 40px; border-radius: 12px; width: 380px; text-align: center; }
|
||||
.login-card h1 { margin: 0 0 4px; font-size: 24px; }
|
||||
.subtitle { color: #999; margin-bottom: 24px; }
|
||||
@media screen and (max-width: 768px) {
|
||||
.login-page { padding: 20px; }
|
||||
.login-card { width: 100%; max-width: 380px; padding: 30px 24px; }
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user