签入版本
This commit is contained in:
@@ -293,7 +293,7 @@ ALTER TABLE laravel_city ADD INDEX idx_parent_code (parent_code);
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=rxthinkcmf.laravel13.elevue
|
||||
DB_DATABASE=rxthinkcmf.laravel13.antdvue
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=root
|
||||
DB_PREFIX=laravel_
|
||||
@@ -303,7 +303,7 @@ DB_PREFIX=laravel_
|
||||
DB_CONNECTION=pgsql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=5432
|
||||
DB_DATABASE=rxthinkcmf.laravel13.elevue
|
||||
DB_DATABASE=rxthinkcmf.laravel13.antdvue
|
||||
DB_USERNAME=postgres
|
||||
DB_PASSWORD=root
|
||||
DB_PREFIX=laravel_
|
||||
@@ -313,7 +313,7 @@ DB_PREFIX=laravel_
|
||||
DB_CONNECTION=sqlsrv
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=1433
|
||||
DB_DATABASE=rxthinkcmf.laravel13.elevue
|
||||
DB_DATABASE=rxthinkcmf.laravel13.antdvue
|
||||
DB_USERNAME=sa
|
||||
DB_PASSWORD=root
|
||||
DB_PREFIX=laravel_
|
||||
@@ -323,7 +323,7 @@ DB_PREFIX=laravel_
|
||||
DB_CONNECTION=oracle
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=1521
|
||||
DB_DATABASE=rxthinkcmf.laravel13.elevue
|
||||
DB_DATABASE=rxthinkcmf.laravel13.antdvue
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=root
|
||||
DB_PREFIX=laravel_
|
||||
@@ -383,15 +383,15 @@ Eloquent 的方言层自动处理大部分 SQL 差异,切换数据库只需修
|
||||
```text
|
||||
document/
|
||||
├── mysql/
|
||||
│ └── rxthinkcmf.laravel13.elevue.sql # MySQL 版本
|
||||
│ └── rxthinkcmf.laravel13.antdvue.sql # MySQL 版本
|
||||
├── postgresql/
|
||||
│ └── rxthinkcmf.laravel13.elevue.sql # PostgreSQL 版本
|
||||
│ └── rxthinkcmf.laravel13.antdvue.sql # PostgreSQL 版本
|
||||
├── sqlserver/
|
||||
│ └── rxthinkcmf.laravel13.elevue.sql # SQL Server 版本
|
||||
│ └── rxthinkcmf.laravel13.antdvue.sql # SQL Server 版本
|
||||
├── oracle/
|
||||
│ └── rxthinkcmf.laravel13.elevue.sql # Oracle 版本
|
||||
│ └── rxthinkcmf.laravel13.antdvue.sql # Oracle 版本
|
||||
└── sqlite/
|
||||
└── rxthinkcmf.laravel13.elevue.sql # SQLite 版本
|
||||
└── rxthinkcmf.laravel13.antdvue.sql # SQLite 版本
|
||||
```
|
||||
|
||||
各数据库脚本包含完整的表结构定义和初始数据(用户、角色、菜单、字典、城市行政区划等),已针对各数据库的 SQL 语法做了适配,可直接导入使用。
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 4.4 前端分层架构
|
||||
|
||||
:::tip 概述
|
||||
前端采用 Vue 3 + TypeScript 组件化架构,分为 View(视图)→ API(接口)→ Store(状态)→ HTTP(请求)四层。辅以 Router(路由)、Directives(指令)、Hooks(组合式函数)、Utils(工具)等支撑模块。前端为本仓库 `ui/` 目录内的 EleVue 管理后台。
|
||||
前端采用 Vue 3 + TypeScript 组件化架构,分为 View(视图)→ API(接口)→ Store(状态)→ HTTP(请求)四层。辅以 Router(路由)、Directives(指令)、Hooks(组合式函数)、Utils(工具)等支撑模块。前端为本仓库 `ui/` 目录内的 AntdVue 管理后台。
|
||||
:::
|
||||
|
||||
## 架构全景
|
||||
@@ -81,33 +81,30 @@ src/views/
|
||||
```vue
|
||||
<template>
|
||||
<!-- 搜索区 -->
|
||||
<el-form :model="searchForm" inline>
|
||||
<el-form-item label="名称">
|
||||
<el-input v-model="searchForm.name" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="fetchData">搜索</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<a-form :model="searchForm" layout="inline">
|
||||
<a-form-item label="名称">
|
||||
<a-input v-model:value="searchForm.name" />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-button type="primary" @click="fetchData">搜索</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<el-button v-perm="'sys:example:add'" type="primary" @click="handleAdd">新增</el-button>
|
||||
<a-button v-perm="'sys:example:add'" type="primary" @click="handleAdd">新增</a-button>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<el-table :data="tableData">
|
||||
<el-table-column prop="id" label="ID" />
|
||||
<el-table-column prop="name" label="名称" />
|
||||
<el-table-column prop="statusText" label="状态" />
|
||||
<el-table-column label="操作">
|
||||
<template #default="{ row }">
|
||||
<el-button v-perm="'sys:example:update'" @click="handleEdit(row)">编辑</el-button>
|
||||
<el-button v-perm="'sys:example:delete'" type="danger" @click="handleDelete(row.id)">删除</el-button>
|
||||
<a-table :data-source="tableData" :columns="columns" :pagination="false" row-key="id">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-button v-perm="'sys:example:update'" @click="handleEdit(record)">编辑</a-button>
|
||||
<a-button v-perm="'sys:example:delete'" danger @click="handleDelete(record.id)">删除</a-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<!-- 分页(后端固定返回 records / total / current / size / pages) -->
|
||||
<el-pagination v-model:current-page="pageNo" v-model:page-size="pageSize"
|
||||
<a-pagination v-model:current="pageNo" v-model:page-size="pageSize"
|
||||
:total="total" @change="fetchData" />
|
||||
</template>
|
||||
|
||||
@@ -231,10 +228,8 @@ src/utils/http/axios/
|
||||
|-------|------|-----------|
|
||||
| userStore | `user.ts` | Token、用户信息、权限列表、登录/登出 |
|
||||
| asyncRouteStore | `asyncRoute.ts` | 动态路由、keep-alive 缓存列表 |
|
||||
| projectSettingStore | `projectSetting.ts` | 项目配置(主题、布局等) |
|
||||
| projectSettingStore | `projectSetting.ts` | 项目配置(导航/顶栏主题、布局等) |
|
||||
| tabsViewStore | `tabsView.ts` | 标签页导航状态 |
|
||||
| designSettingStore | `designSetting.ts` | 主题设计配置 |
|
||||
| ossConfigStore | `ossConfig.ts` | 云存储配置 |
|
||||
| lockscreenStore | `lockscreen.ts` | 锁屏状态 |
|
||||
|
||||
**userStore 核心流程:**
|
||||
@@ -318,10 +313,10 @@ src/utils/http/axios/
|
||||
|
||||
```vue
|
||||
<!-- v-perm:单权限 -->
|
||||
<el-button v-perm="'sys:user:add'" type="primary">新增</el-button>
|
||||
<a-button v-perm="'sys:user:add'" type="primary">新增</a-button>
|
||||
|
||||
<!-- v-perms:多权限(满足任一即可) -->
|
||||
<el-button v-perms="['sys:user:add', 'sys:user:update']">操作</el-button>
|
||||
<a-button v-perms="['sys:user:add', 'sys:user:update']">操作</a-button>
|
||||
```
|
||||
|
||||
无权限时元素直接从 DOM 移除,而非仅隐藏。
|
||||
@@ -419,7 +414,7 @@ v-perm 指令读取 permissions 列表 → 控制元素显隐
|
||||
| `routes/api.php` | `src/api/**/*.ts` | 路由 ↔ API 函数 |
|
||||
| 字典数据(`dict` 表) | `src/enums/` + 字典 Store | 枚举常量 |
|
||||
| `#[Permission]` 注解 | `v-perm` 指令 | 权限码对应 |
|
||||
| 分页 `records/total/current/size/pages` | el-pagination 绑定 | 固定分页结构 |
|
||||
| 分页 `records/total/current/size/pages` | a-pagination 绑定 | 固定分页结构 |
|
||||
|
||||
## 层间通信规范
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
```text
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ 浏览器(Vue3 + ElementPlus) │
|
||||
│ 浏览器(Vue3 + AntDesign) │
|
||||
│ Axios HTTP 请求 / Vite 开发代理 │
|
||||
└──────────────────────────────┬──────────────────────────────────┘
|
||||
│
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
### 1. 前后端分离
|
||||
|
||||
前端 Vue3 应用通过 HTTP API 调用后端 Laravel 服务,两者独立开发、独立部署。前端开发阶段通过 Vite 的 `proxy` 配置将 `/api` 请求代理到后端 `http://localhost:8000`,生产环境由 Nginx 统一反向代理。
|
||||
前端 Vue3 应用通过 HTTP API 调用后端 Laravel 服务,两者独立开发、独立部署。前端开发阶段通过 Vite 的 `proxy` 配置将 `/api` 请求代理到后端 `http://admin.laravel13.antdvue`,生产环境由 Nginx 统一反向代理。
|
||||
|
||||
### 2. 分层架构
|
||||
|
||||
@@ -243,7 +243,7 @@ static::updating(function ($model) {
|
||||
|
||||
```text
|
||||
┌──────────────────────────────────────────────────────────────┐
|
||||
│ 前端(Vue3 + ElementPlus) │
|
||||
│ 前端(Vue3 + AntDesign) │
|
||||
│ Pinia · Vue Router · Axios · TinyMce · ECharts │
|
||||
└──────────────────────────┬───────────────────────────────────┘
|
||||
│ HTTP / JSON
|
||||
|
||||
@@ -43,7 +43,7 @@ location / {
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8000',
|
||||
target: 'http://admin.laravel13.antdvue',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user