feat: 创建fund-admin前端项目 - Vue3+ElementPlus管理后台

This commit is contained in:
zhangjf 2026-02-15 13:39:53 +08:00
parent 61475dd320
commit 246a8c17f4
28 changed files with 3412 additions and 0 deletions

24
fund-admin/.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

3
fund-admin/.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}

5
fund-admin/README.md Normal file
View File

@ -0,0 +1,5 @@
# Vue 3 + Vite
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).

13
fund-admin/index.html Normal file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>fund-admin</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

2009
fund-admin/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

23
fund-admin/package.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "fund-admin",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.2",
"axios": "^1.13.5",
"element-plus": "^2.13.2",
"pinia": "^3.0.4",
"vue": "^3.5.25",
"vue-router": "^4.6.4"
},
"devDependencies": {
"@vitejs/plugin-vue": "^6.0.2",
"vite": "^7.3.1"
}
}

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

18
fund-admin/src/App.vue Normal file
View File

@ -0,0 +1,18 @@
<template>
<router-view />
</template>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB',
'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style>

View File

@ -0,0 +1,23 @@
import request from '../utils/request'
export const login = (data) => {
return request({
url: '/sys/auth/login',
method: 'post',
data
})
}
export const getUserInfo = () => {
return request({
url: '/sys/auth/info',
method: 'get'
})
}
export const logout = () => {
return request({
url: '/sys/auth/logout',
method: 'post'
})
}

View File

@ -0,0 +1,69 @@
import request from '../utils/request'
export const getCustomerList = (params) => {
return request({
url: '/cust/customer/list',
method: 'get',
params
})
}
export const getCustomerById = (id) => {
return request({
url: `/cust/customer/${id}`,
method: 'get'
})
}
export const createCustomer = (data) => {
return request({
url: '/cust/customer',
method: 'post',
data
})
}
export const updateCustomer = (id, data) => {
return request({
url: `/cust/customer/${id}`,
method: 'put',
data
})
}
export const deleteCustomer = (id) => {
return request({
url: `/cust/customer/${id}`,
method: 'delete'
})
}
export const getContactList = (customerId) => {
return request({
url: `/cust/customer-contact/list/${customerId}`,
method: 'get'
})
}
export const createContact = (data) => {
return request({
url: '/cust/customer-contact',
method: 'post',
data
})
}
export const updateContact = (id, data) => {
return request({
url: `/cust/customer-contact/${id}`,
method: 'put',
data
})
}
export const deleteContact = (id) => {
return request({
url: `/cust/customer-contact/${id}`,
method: 'delete'
})
}

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

After

Width:  |  Height:  |  Size: 496 B

View File

@ -0,0 +1,43 @@
<script setup>
import { ref } from 'vue'
defineProps({
msg: String,
})
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<div class="card">
<button type="button" @click="count++">count is {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test HMR
</p>
</div>
<p>
Check out
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
>create-vue</a
>, the official Vue + Vite starter
</p>
<p>
Learn more about IDE Support for Vue in the
<a
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
target="_blank"
>Vue Docs Scaling up Guide</a
>.
</p>
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>
<style scoped>
.read-the-docs {
color: #888;
}
</style>

View File

@ -0,0 +1,165 @@
<template>
<el-container class="layout-container">
<el-aside width="200px" class="sidebar">
<div class="logo">
<h3>资金服务平台</h3>
</div>
<el-menu
:default-active="activeMenu"
class="el-menu-vertical"
background-color="#304156"
text-color="#bfcbd9"
active-text-color="#409EFF"
router
>
<el-menu-item index="/dashboard">
<el-icon><HomeFilled /></el-icon>
<span>首页</span>
</el-menu-item>
<el-sub-menu index="/system">
<template #title>
<el-icon><Setting /></el-icon>
<span>系统管理</span>
</template>
<el-menu-item index="/system/user">用户管理</el-menu-item>
<el-menu-item index="/system/role">角色管理</el-menu-item>
<el-menu-item index="/system/menu">菜单管理</el-menu-item>
</el-sub-menu>
<el-sub-menu index="/customer">
<template #title>
<el-icon><UserFilled /></el-icon>
<span>客户中心</span>
</template>
<el-menu-item index="/customer/list">客户管理</el-menu-item>
<el-menu-item index="/customer/contact">联系人管理</el-menu-item>
</el-sub-menu>
<el-sub-menu index="/project">
<template #title>
<el-icon><FolderOpened /></el-icon>
<span>项目管理</span>
</template>
<el-menu-item index="/project/list">项目管理</el-menu-item>
<el-menu-item index="/project/contract">合同管理</el-menu-item>
</el-sub-menu>
</el-menu>
</el-aside>
<el-container>
<el-header class="header">
<div class="header-right">
<el-dropdown @command="handleCommand">
<span class="user-info">
{{ userStore.realName || userStore.username }}
<el-icon class="el-icon--right"><arrow-down /></el-icon>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="profile">个人中心</el-dropdown-item>
<el-dropdown-item command="settings">系统设置</el-dropdown-item>
<el-dropdown-item divided command="logout">退出登录</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</el-header>
<el-main class="main-content">
<router-view />
</el-main>
</el-container>
</el-container>
</template>
<script setup>
import { computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
import { HomeFilled, Setting, UserFilled, FolderOpened, ArrowDown } from '@element-plus/icons-vue'
import { useUserStore } from '../stores/user'
const route = useRoute()
const router = useRouter()
const userStore = useUserStore()
const activeMenu = computed(() => route.path)
const handleCommand = (command) => {
switch (command) {
case 'profile':
router.push('/profile')
break
case 'settings':
router.push('/settings')
break
case 'logout':
handleLogout()
break
}
}
const handleLogout = () => {
ElMessageBox.confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
userStore.logout()
ElMessage.success('退出成功')
router.push('/login')
})
}
</script>
<style scoped>
.layout-container {
height: 100vh;
}
.sidebar {
background-color: #304156;
}
.logo {
height: 60px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
border-bottom: 1px solid #1f2d3d;
}
.logo h3 {
margin: 0;
font-size: 18px;
}
.el-menu-vertical {
border-right: none;
}
.header {
background-color: #fff;
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
display: flex;
align-items: center;
justify-content: flex-end;
}
.header-right {
display: flex;
align-items: center;
}
.user-info {
cursor: pointer;
color: #606266;
}
.main-content {
background-color: #f0f2f5;
padding: 20px;
}
</style>

20
fund-admin/src/main.js Normal file
View File

@ -0,0 +1,20 @@
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
const app = createApp(App)
// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}
app.use(createPinia())
app.use(router)
app.use(ElementPlus)
app.mount('#app')

View File

@ -0,0 +1,112 @@
import { createRouter, createWebHistory } from 'vue-router'
import { useUserStore } from '../stores/user'
const routes = [
{
path: '/login',
name: 'Login',
component: () => import('../views/login/index.vue'),
meta: { public: true }
},
{
path: '/',
name: 'Layout',
component: () => import('../components/Layout.vue'),
redirect: '/dashboard',
children: [
{
path: 'dashboard',
name: 'Dashboard',
component: () => import('../views/dashboard/index.vue'),
meta: { title: '首页', icon: 'HomeFilled' }
},
{
path: 'system',
name: 'System',
meta: { title: '系统管理', icon: 'Setting' },
children: [
{
path: 'user',
name: 'User',
component: () => import('../views/system/user.vue'),
meta: { title: '用户管理' }
},
{
path: 'role',
name: 'Role',
component: () => import('../views/system/role.vue'),
meta: { title: '角色管理' }
},
{
path: 'menu',
name: 'Menu',
component: () => import('../views/system/menu.vue'),
meta: { title: '菜单管理' }
}
]
},
{
path: 'customer',
name: 'Customer',
meta: { title: '客户中心', icon: 'UserFilled' },
children: [
{
path: 'list',
name: 'CustomerList',
component: () => import('../views/customer/list.vue'),
meta: { title: '客户管理' }
},
{
path: 'contact',
name: 'CustomerContact',
component: () => import('../views/customer/contact.vue'),
meta: { title: '联系人管理' }
}
]
},
{
path: 'project',
name: 'Project',
meta: { title: '项目管理', icon: 'FolderOpened' },
children: [
{
path: 'list',
name: 'ProjectList',
component: () => import('../views/project/list.vue'),
meta: { title: '项目管理' }
},
{
path: 'contract',
name: 'Contract',
component: () => import('../views/project/contract.vue'),
meta: { title: '合同管理' }
}
]
}
]
}
]
const router = createRouter({
history: createWebHistory(),
routes
})
// 路由守卫
router.beforeEach((to, from, next) => {
const userStore = useUserStore()
if (to.meta.public) {
next()
return
}
if (!userStore.token) {
next('/login')
return
}
next()
})
export default router

View File

@ -0,0 +1,72 @@
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
export const useUserStore = defineStore('user', () => {
// State
const token = ref(localStorage.getItem('token') || '')
const userInfo = ref(JSON.parse(localStorage.getItem('userInfo') || '{}'))
const permissions = ref(JSON.parse(localStorage.getItem('permissions') || '[]'))
const roles = ref(JSON.parse(localStorage.getItem('roles') || '[]'))
// Getters
const isLoggedIn = computed(() => !!token.value)
const username = computed(() => userInfo.value?.username || '')
const realName = computed(() => userInfo.value?.realName || '')
// Actions
const setToken = (newToken) => {
token.value = newToken
localStorage.setItem('token', newToken)
}
const setUserInfo = (info) => {
userInfo.value = info
localStorage.setItem('userInfo', JSON.stringify(info))
}
const setPermissions = (perms) => {
permissions.value = perms
localStorage.setItem('permissions', JSON.stringify(perms))
}
const setRoles = (roleList) => {
roles.value = roleList
localStorage.setItem('roles', JSON.stringify(roleList))
}
const hasPermission = (perm) => {
return permissions.value.includes(perm)
}
const hasRole = (role) => {
return roles.value.includes(role)
}
const logout = () => {
token.value = ''
userInfo.value = {}
permissions.value = []
roles.value = []
localStorage.removeItem('token')
localStorage.removeItem('userInfo')
localStorage.removeItem('permissions')
localStorage.removeItem('roles')
}
return {
token,
userInfo,
permissions,
roles,
isLoggedIn,
username,
realName,
setToken,
setUserInfo,
setPermissions,
setRoles,
hasPermission,
hasRole,
logout
}
})

79
fund-admin/src/style.css Normal file
View File

@ -0,0 +1,79 @@
:root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
.card {
padding: 2em;
}
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}

View File

@ -0,0 +1,73 @@
import axios from 'axios'
import { ElMessage } from 'element-plus'
import { useUserStore } from '../stores/user'
// 创建axios实例
const request = axios.create({
baseURL: '/api',
timeout: 10000,
headers: {
'Content-Type': 'application/json'
}
})
// 请求拦截器
request.interceptors.request.use(
(config) => {
const userStore = useUserStore()
if (userStore.token) {
config.headers.Authorization = `Bearer ${userStore.token}`
}
return config
},
(error) => {
return Promise.reject(error)
}
)
// 响应拦截器
request.interceptors.response.use(
(response) => {
const res = response.data
// 业务成功
if (res.code === 200) {
return res.data
}
// 业务失败
ElMessage.error(res.message || '请求失败')
return Promise.reject(new Error(res.message || '请求失败'))
},
(error) => {
const { response } = error
if (response) {
switch (response.status) {
case 401:
ElMessage.error('登录已过期,请重新登录')
const userStore = useUserStore()
userStore.logout()
window.location.href = '/login'
break
case 403:
ElMessage.error('没有权限访问')
break
case 404:
ElMessage.error('请求的资源不存在')
break
case 500:
ElMessage.error('服务器内部错误')
break
default:
ElMessage.error(response.data?.message || '请求失败')
}
} else {
ElMessage.error('网络错误,请检查网络连接')
}
return Promise.reject(error)
}
)
export default request

View File

@ -0,0 +1,25 @@
<template>
<div class="page-container">
<el-card>
<template #header>
<div class="card-header">
<span>联系人管理</span>
<el-button type="primary">新增联系人</el-button>
</div>
</template>
<p>联系人管理页面 - 开发中</p>
</el-card>
</div>
</template>
<style scoped>
.page-container {
padding: 20px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>

View File

@ -0,0 +1,172 @@
<template>
<div class="page-container">
<el-card>
<template #header>
<div class="card-header">
<span>客户管理</span>
<el-button type="primary" @click="handleAdd">新增客户</el-button>
</div>
</template>
<el-form :inline="true" class="search-form">
<el-form-item label="客户名称">
<el-input v-model="searchForm.customerName" placeholder="请输入客户名称" />
</el-form-item>
<el-form-item label="客户类型">
<el-select v-model="searchForm.customerType" placeholder="请选择">
<el-option label="企业客户" value="ENTERPRISE" />
<el-option label="个人客户" value="PERSONAL" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<el-table :data="tableData" border v-loading="loading">
<el-table-column prop="customerCode" label="客户编码" width="120" />
<el-table-column prop="customerName" label="客户名称" />
<el-table-column prop="customerType" label="客户类型" width="100">
<template #default="scope">
<el-tag>{{ scope.row.customerType === 'ENTERPRISE' ? '企业' : '个人' }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="industry" label="所属行业" />
<el-table-column prop="legalPerson" label="联系人" />
<el-table-column prop="phone" label="联系电话" />
<el-table-column prop="status" label="状态" width="80">
<template #default="scope">
<el-tag :type="scope.row.status === '1' ? 'success' : 'danger'">
{{ scope.row.status === '1' ? '正常' : '停用' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template #default="scope">
<el-button type="primary" link @click="handleEdit(scope.row)">编辑</el-button>
<el-button type="danger" link @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
class="pagination"
v-model:current-page="page.current"
v-model:page-size="page.size"
:total="page.total"
layout="total, sizes, prev, pager, next"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
</div>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getCustomerList, deleteCustomer } from '../../api/customer'
const loading = ref(false)
const tableData = ref([])
const searchForm = reactive({
customerName: '',
customerType: ''
})
const page = reactive({
current: 1,
size: 10,
total: 0
})
const fetchData = async () => {
loading.value = true
try {
const res = await getCustomerList({
current: page.current,
size: page.size,
customerName: searchForm.customerName,
customerType: searchForm.customerType
})
tableData.value = res.records
page.total = res.total
} catch (error) {
console.error('获取客户列表失败:', error)
} finally {
loading.value = false
}
}
const handleSearch = () => {
page.current = 1
fetchData()
}
const handleReset = () => {
searchForm.customerName = ''
searchForm.customerType = ''
handleSearch()
}
const handleAdd = () => {
console.log('新增客户')
}
const handleEdit = (row) => {
console.log('编辑客户:', row)
}
const handleDelete = (row) => {
ElMessageBox.confirm('确定要删除该客户吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
try {
await deleteCustomer(row.customerId)
ElMessage.success('删除成功')
fetchData()
} catch (error) {
console.error('删除失败:', error)
}
})
}
const handleSizeChange = (val) => {
page.size = val
fetchData()
}
const handleCurrentChange = (val) => {
page.current = val
fetchData()
}
onMounted(() => {
fetchData()
})
</script>
<style scoped>
.page-container {
padding: 20px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.search-form {
margin-bottom: 20px;
}
.pagination {
margin-top: 20px;
justify-content: flex-end;
}
</style>

View File

@ -0,0 +1,143 @@
<template>
<div class="dashboard">
<el-row :gutter="20">
<el-col :span="6">
<el-card class="stat-card">
<div class="stat-icon" style="background: #409EFF;">
<el-icon><User /></el-icon>
</div>
<div class="stat-info">
<div class="stat-value">1,234</div>
<div class="stat-label">客户总数</div>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card class="stat-card">
<div class="stat-icon" style="background: #67C23A;">
<el-icon><FolderOpened /></el-icon>
</div>
<div class="stat-info">
<div class="stat-value">56</div>
<div class="stat-label">项目总数</div>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card class="stat-card">
<div class="stat-icon" style="background: #E6A23C;">
<el-icon><Document /></el-icon>
</div>
<div class="stat-info">
<div class="stat-value">89</div>
<div class="stat-label">合同总数</div>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card class="stat-card">
<div class="stat-icon" style="background: #F56C6C;">
<el-icon><Money /></el-icon>
</div>
<div class="stat-info">
<div class="stat-value">¥2.5M</div>
<div class="stat-label">合同总金额</div>
</div>
</el-card>
</el-col>
</el-row>
<el-row :gutter="20" class="mt-20">
<el-col :span="12">
<el-card>
<template #header>
<span>项目状态分布</span>
</template>
<div class="chart-placeholder">
[图表区域]
</div>
</el-card>
</el-col>
<el-col :span="12">
<el-card>
<template #header>
<span>最近活动</span>
</template>
<el-timeline>
<el-timeline-item
v-for="(activity, index) in activities"
:key="index"
:timestamp="activity.time"
>
{{ activity.content }}
</el-timeline-item>
</el-timeline>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script setup>
import { User, FolderOpened, Document, Money } from '@element-plus/icons-vue'
const activities = [
{ content: '创建了新项目 "XX企业资金管理系统"', time: '2026-02-15 10:30' },
{ content: '客户 "ABC科技" 信息更新', time: '2026-02-15 09:15' },
{ content: '合同 "HT2024001" 签署完成', time: '2026-02-14 16:45' },
{ content: '新增用户 "张三"', time: '2026-02-14 14:20' }
]
</script>
<style scoped>
.dashboard {
padding: 20px;
}
.stat-card {
display: flex;
align-items: center;
padding: 10px;
}
.stat-icon {
width: 60px;
height: 60px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 28px;
}
.stat-info {
margin-left: 15px;
flex: 1;
}
.stat-value {
font-size: 24px;
font-weight: bold;
color: #303133;
}
.stat-label {
font-size: 14px;
color: #909399;
margin-top: 5px;
}
.mt-20 {
margin-top: 20px;
}
.chart-placeholder {
height: 300px;
display: flex;
align-items: center;
justify-content: center;
background: #f5f7fa;
color: #909399;
}
</style>

View File

@ -0,0 +1,139 @@
<template>
<div class="login-container">
<el-card class="login-box">
<template #header>
<div class="login-header">
<h2>资金服务平台</h2>
<p>Fund Service Platform</p>
</div>
</template>
<el-form
ref="loginFormRef"
:model="loginForm"
:rules="loginRules"
class="login-form"
>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
placeholder="用户名"
:prefix-icon="User"
size="large"
/>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
type="password"
placeholder="密码"
:prefix-icon="Lock"
size="large"
show-password
@keyup.enter="handleLogin"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
size="large"
class="login-btn"
:loading="loading"
@click="handleLogin"
>
登录
</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { User, Lock } from '@element-plus/icons-vue'
import { useUserStore } from '../../stores/user'
import { login } from '../../api/auth'
const router = useRouter()
const userStore = useUserStore()
const loginFormRef = ref(null)
const loading = ref(false)
const loginForm = reactive({
username: '',
password: '',
tenantCode: 'default'
})
const loginRules = {
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }]
}
const handleLogin = async () => {
if (!loginFormRef.value) return
await loginFormRef.value.validate(async (valid) => {
if (valid) {
loading.value = true
try {
const res = await login(loginForm)
userStore.setToken(res.accessToken)
userStore.setUserInfo(res.userInfo)
ElMessage.success('登录成功')
router.push('/')
} catch (error) {
console.error('登录失败:', error)
} finally {
loading.value = false
}
}
})
}
</script>
<style scoped>
.login-container {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
width: 400px;
border-radius: 8px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.login-header {
text-align: center;
}
.login-header h2 {
margin: 0;
font-size: 24px;
color: #303133;
}
.login-header p {
margin: 8px 0 0;
font-size: 14px;
color: #909399;
}
.login-form {
margin-top: 20px;
}
.login-btn {
width: 100%;
}
</style>

View File

@ -0,0 +1,25 @@
<template>
<div class="page-container">
<el-card>
<template #header>
<div class="card-header">
<span>合同管理</span>
<el-button type="primary">新增合同</el-button>
</div>
</template>
<p>合同管理页面 - 开发中</p>
</el-card>
</div>
</template>
<style scoped>
.page-container {
padding: 20px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>

View File

@ -0,0 +1,25 @@
<template>
<div class="page-container">
<el-card>
<template #header>
<div class="card-header">
<span>项目管理</span>
<el-button type="primary">新增项目</el-button>
</div>
</template>
<p>项目管理页面 - 开发中</p>
</el-card>
</div>
</template>
<style scoped>
.page-container {
padding: 20px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>

View File

@ -0,0 +1,25 @@
<template>
<div class="page-container">
<el-card>
<template #header>
<div class="card-header">
<span>菜单管理</span>
<el-button type="primary">新增菜单</el-button>
</div>
</template>
<p>菜单管理页面 - 开发中</p>
</el-card>
</div>
</template>
<style scoped>
.page-container {
padding: 20px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>

View File

@ -0,0 +1,25 @@
<template>
<div class="page-container">
<el-card>
<template #header>
<div class="card-header">
<span>角色管理</span>
<el-button type="primary">新增角色</el-button>
</div>
</template>
<p>角色管理页面 - 开发中</p>
</el-card>
</div>
</template>
<style scoped>
.page-container {
padding: 20px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>

View File

@ -0,0 +1,57 @@
<template>
<div class="page-container">
<el-card>
<template #header>
<div class="card-header">
<span>用户管理</span>
<el-button type="primary" @click="handleAdd">新增用户</el-button>
</div>
</template>
<el-table :data="tableData" border>
<el-table-column prop="username" label="用户名" />
<el-table-column prop="realName" label="姓名" />
<el-table-column prop="phone" label="手机号" />
<el-table-column prop="email" label="邮箱" />
<el-table-column prop="status" label="状态">
<template #default="scope">
<el-tag :type="scope.row.status === 1 ? 'success' : 'danger'">
{{ scope.row.status === 1 ? '启用' : '禁用' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template #default>
<el-button type="primary" link>编辑</el-button>
<el-button type="danger" link>删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script setup>
import { ref } from 'vue'
const tableData = ref([
{ username: 'admin', realName: '管理员', phone: '13800138000', email: 'admin@example.com', status: 1 },
{ username: 'zhangsan', realName: '张三', phone: '13800138001', email: 'zhangsan@example.com', status: 1 }
])
const handleAdd = () => {
console.log('新增用户')
}
</script>
<style scoped>
.page-container {
padding: 20px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>

23
fund-admin/vite.config.js Normal file
View File

@ -0,0 +1,23 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
// https://vite.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
},
server: {
port: 5173,
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
}
})