refactor: migrate backend to TypeScript

This commit is contained in:
gin
2026-06-17 17:40:12 +08:00
parent 98eae63435
commit 74acfd664f
457 changed files with 7397 additions and 25009 deletions
-21
View File
@@ -1,21 +0,0 @@
node_modules
.DS_Store
dist
dist-ssr
*.local
.eslintcache
report.html
yarn.lock
npm-debug.log*
.pnpm-error.log*
.pnpm-debug.log
tests/**/coverage/
# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
tsconfig.tsbuildinfo
+1 -2
View File
@@ -3,5 +3,4 @@ VITE_PUBLIC_PATH = ./
VITE_ROUTER_HISTORY = "hash"
VITE_CDN = false
VITE_COMPRESSION = "none"
VITE_APP_BASE_API = '/prod-api'
VITE_APP_BASE_API =
+1 -2
View File
@@ -3,5 +3,4 @@ VITE_PUBLIC_PATH = ./
VITE_ROUTER_HISTORY = "hash"
VITE_CDN = true
VITE_COMPRESSION = "none"
VITE_APP_BASE_API = '/stage-api'
VITE_APP_BASE_API =
+1 -1
View File
@@ -33,7 +33,7 @@ module.exports = {
withDefaults: "readonly"
},
extends: [
"../eslint.base.cjs",
"../../eslint.base.cjs",
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/typescript/recommended",
-23
View File
@@ -1,23 +0,0 @@
FROM node:22-alpine AS build-stage
WORKDIR /app
RUN corepack enable
RUN corepack prepare pnpm@11.1.3 --activate
RUN npm config set registry https://registry.npmmirror.com
COPY .npmrc package.json pnpm-lock.yaml pnpm-workspace.yaml tsconfig.base.json ./
COPY web/package.json web/package.json
RUN pnpm install --frozen-lockfile --filter @simple-template/web...
COPY web web
WORKDIR /app/web
RUN pnpm build
FROM nginx:stable-alpine AS production-stage
COPY --from=build-stage /app/web/dist /usr/share/nginx/html
COPY web/nginx/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
+44 -123
View File
@@ -1,145 +1,66 @@
<p align="center">
<img src="https://img.shields.io/badge/Release-V1.8.0-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status">
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Boot-2.7.1-blue.svg" alt="Downloads">
<a target="_blank" href="https://bladex.vip">
<img src="https://img.shields.io/badge/Author-valarchie-ff69b4.svg" alt="Downloads">
</a>
<a target="_blank" href="https://bladex.vip">
<img src="https://img.shields.io/badge/Copyright%20-@Agileboot-%23ff3f59.svg" alt="Downloads">
</a>
</p>
<p align="center">
# CollabLedger Web
<img alt="logo" height="200" src="https://oscimg.oschina.net/oscnet/up-eda2a402cc061f1f5f40d9ac4c084f4c98c.png">
</p>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">AgileBoot v2.0.0</h1>
Vite + Vue 3 Web 管理端,作为根目录 pnpm workspace 的子包维护。
<h4 align="center">基于SpringBoot+Vue3前后端分离的Java快速开发框架</h4>
<p align="center">
</p>
## 本地开发
## ⚡ 平台简介 ⚡
从仓库根目录执行:
- 本仓库是 Agilboot 快速开发脚手架的配套前端项目。前端是基于优秀的开源项目[Pure-Admin](https://github.com/pure-admin/vue-pure-admin)开发而成。在此感谢 Pure-Admin 作者。
- 本仓库前端技术栈 [Vue3](https://v3.cn.vuejs.org) + [Element Plus](https://element-plus.org/zh-CN) + [Vite](https://cn.vitejs.dev) 版本。
- 配套后端代码仓库地址[AgileBoot-Back-End](https://github.com/valarchie/AgileBoot-Back-End) 版本。
- 规范请参照该文档 [前端规范](https://gitee.com/MinJieLiu/web-standard#/MinJieLiu/web-standard)
### 前端配套资料
#### 配套视频
- [点我查看教程](https://www.bilibili.com/video/BV1kg411v7QT)
- [点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq)
#### 配套保姆级文档
- [查看文档](https://yiming_chang.gitee.io/pure-admin-doc)
#### Pure-Admin 框架预览
- [查看预览](https://pure-admin-thin.netlify.app/#/login)
#### Pure-Admin 维护者
- [xiaoxian521](https://github.com/xiaoxian521)
## ✨ 使用 ✨
### 开发环境
Node.js 版本要求:16.0+
pnpm 版本要求:6.0+
优先选择 node=16, pnpm=7.30.5的环境.
如果您还没安装 pnpm,请执行下面命令进行安装(mac 用户遇到安装报错请在命令前加上 sudo) 如果是 windows 用户,使用 power shell 管理员权限执行
```
npm install -g pnpm
```
安装依赖
```
```bash
pnpm install
pnpm dev:web
```
启动平台
`frontend/web/.env.development` 默认使用:
```
pnpm run dev
```env
VITE_PORT=80
VITE_APP_BASE_API=/dev-api
```
不管是什么源,我们都可以不用管,直接执行下面命令即可
开发环境下,`vite.config.ts` 会把 `/dev-api` 代理到本地后端 `http://localhost:3000`
npm config set registry https://registry.npmmirror.com
## Vercel 部署
上面的命令是将本地的源换成国内源 npmmirror
(opens new window),经过几轮测试,发现它的下载速度快且同步率高,同步频率 10 分钟一次,如果您之前的源是这个 http://registry.npm.taobao.org ,那您必须换成 npmmirror 啦,因为原淘宝 npm 域名即将停止解析
Web 管理端作为独立的 Vercel Project 部署。先全局安装并登录 Vercel CLI:
## 🙊 系统内置功能 🙊
🙂 大部分功能,均有通过 **单元测试** **集成测试** 保证质量。
| | 功能 | 描述 |
| --- | ---------- | ------------------------------------------------------------- |
| | 用户管理 | 用户是系统操作者,该功能主要完成系统用户配置 |
| ⭐ | 部门管理 | 配置系统组织机构(公司、部门、小组),树结构展现支持数据权限 |
| ⭐ | 岗位管理 | 配置系统用户所属担任职务 |
| | 菜单管理 | 配置系统菜单、操作权限、按钮权限标识等,本地缓存提供性能 |
| ⭐ | 角色管理 | 角色菜单权限分配、设置角色按机构进行数据范围权限划分 |
| | 参数管理 | 对系统动态配置常用参数 |
| | 通知公告 | 系统通知公告信息发布维护 |
| 🚀 | 操作日志 | 系统正常操作日志记录和查询;系统异常信息日志记录和查询 |
| | 登录日志 | 系统登录日志记录查询包含登录异常 |
| | 在线用户 | 当前系统中活跃用户状态监控 |
| | 系统接口 | 根据业务代码自动生成相关的 api 接口文档 |
| | 服务监控 | 监视当前系统 CPU、内存、磁盘、堆栈等相关信息 |
| | 缓存监控 | 对系统的缓存信息查询,命令统计等 |
| | 连接池监视 | 监视当前系统数据库连接池状态,可进行分析 SQL 找出系统性能瓶颈 |
## 💥 在线体验 💥
演示地址:
- <www.agileboot.vip>
- <www.agileboot.cc>
> 账号密码:admin/admin123
[项目文档](https://juejin.cn/column/7159946528827080734)
## 🎬 AgileBoot 全栈交流群 🎬
QQ 群: [![加入QQ群](https://img.shields.io/badge/1398880-blue.svg)](https://qm.qq.com/cgi-bin/qm/qr?k=TR5guoXS0HssErVWefmdFRirJvfpEvp1&jump_from=webapi&authKey=VkWMmVhp/pNdWuRD8sqgM+Sv2+Vy2qCJQSeLmeXlLtfER2RJBi6zL56PdcRlCmTs) 点击按钮入群。
如果觉得该项目对您有帮助,可以小额捐赠支持本项目演示网站服务器等费用~
<img alt="logo" height="200" src="https://oscimg.oschina.net/oscnet/up-28b63fdd7b3ce003bd30c25883f2276212b.png">
### 用法
#### 安装依赖
```
pnpm install
```bash
pnpm add -g vercel
vercel login
```
#### 安装一个包
进入 Web 目录并关联项目:
```
pnpm add 包名
```bash
cd frontend/web
vercel link
```
#### 卸载一个包
推荐配置:
```
pnpm remove 包名
```text
Framework Preset: Vite
Install Command: pnpm install
Build Command: pnpm build
Output Directory: dist
```
### 许可证
在 Vercel 项目环境变量中配置后端地址:
原则上不收取任何费用及版权,可商用,不过如需二次开源(比如用此平台二次开发并开源,要求前端代码必须开源免费)请联系作者获取许可!(免费,走个记录而已)
```bash
vercel env add VITE_APP_BASE_API production
```
变量值示例:
```env
VITE_APP_BASE_API=https://your-backend.example.com
```
部署:
```bash
vercel deploy --prod
```
`vercel.json` 已配置 SPA 路由回退,刷新管理端子路由时会返回 `index.html`
+2 -2
View File
@@ -21,8 +21,8 @@ export function viteBuildInfo(): Plugin {
bold(
green(
`👏欢迎使用${blue(
"[Agileboot全栈项目]"
)},如果您感觉不错,记得点击后面链接给个star哦💖 https://github.com/valarchie/agileboot-back-end`
"[CollabLedger全栈项目]"
)},如果您感觉不错,记得点击后面链接给个star哦💖 https://github.com/valarchie/collab_ledger-back-end`
)
)
);
+1 -1
View File
@@ -8,7 +8,7 @@
name="viewport"
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
/>
<title>Agileboot管理系统</title>
<title>CollabLedger管理系统</title>
<link rel="icon" href="/favicon.ico" />
<script>
window.process = {};
-20
View File
@@ -1,20 +0,0 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
location /prod-api/ {
proxy_pass http://app:8080/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
try_files $uri $uri/ /index.html;
}
}
+5 -5
View File
@@ -1,5 +1,5 @@
{
"name": "@simple-template/web",
"name": "@collab_ledger/web",
"version": "1.0.0",
"private": true,
"scripts": {
@@ -13,9 +13,9 @@
"typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck",
"svgo": "svgo -f src/assets/svg -o src/assets/svg",
"clean:cache": "rimraf node_modules && pnpm install",
"lint:eslint": "eslint --ignore-path ../.eslintignore --cache --cache-location node_modules/.cache/eslint/.eslintcache --max-warnings 0 \"{src,build}/**/*.{vue,js,ts,tsx}\"",
"lint:prettier": "prettier --check \"src/**/*.{js,ts,json,tsx,css,scss,vue,html,md}\"",
"lint:stylelint": "pnpm --dir .. exec stylelint \"web/**/*.{html,vue,css,scss}\" --config ./stylelint.config.cjs --ignore-path ./.stylelintignore --cache --cache-location web/node_modules/.cache/stylelint/",
"lint:eslint": "eslint --ignore-path ../../.eslintignore --cache --cache-location node_modules/.cache/eslint/.eslintcache --max-warnings 0 \"{src,build}/**/*.{vue,js,ts,tsx}\"",
"lint:prettier": "prettier --check --ignore-path ../../.prettierignore \"src/**/*.{js,ts,json,tsx,css,scss,vue,html,md}\"",
"lint:stylelint": "pnpm --dir ../.. exec stylelint \"frontend/web/**/*.{html,vue,css,scss}\" --config stylelint.config.cjs --ignore-path .stylelintignore --cache --cache-location node_modules/.cache/stylelint/",
"lint": "pnpm lint:eslint && pnpm lint:prettier && pnpm lint:stylelint",
"prepare": "echo \"Git hooks are managed by ../../.githooks\"",
"preinstall": "npx only-allow pnpm"
@@ -96,7 +96,7 @@
"vue-eslint-parser": "^9.3.1",
"vue-tsc": "^1.8.1"
},
"repository": "git@github.com:valarchie/agileboot-front-end-pure.git",
"repository": "git@github.com:valarchie/collab_ledger-front-end-pure.git",
"author": "valarchie",
"license": "MIT"
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"Version": "4.4.0",
"Title": "Agileboot",
"Title": "CollabLedger",
"FixedHeader": true,
"HiddenSideBar": false,
"MultiTagsCache": false,
+1 -1
View File
@@ -23,7 +23,7 @@ export function rsaEncrypt(txt): string {
return encryptedValue;
}
const aesKey = "agileboot1234567";
const aesKey = "collab_ledger123";
export function aesEncrypt(txt): string {
if (isEmpty(txt)) {
+1 -1
View File
@@ -529,7 +529,7 @@ onBeforeUnmount(() => {
<!-- 底部 -->
<div class="flex items-center justify-center h-full">
<div class="flex flex-col items-center justify-center mb-3">
<span>Copyright © 2018-2023 Agileboot All Rights Reserved. </span>
<span>Copyright © 2018-2023 CollabLedger All Rights Reserved. </span>
<el-link
href="https://beian.miit.gov.cn"
rel="external nofollow"
@@ -162,7 +162,7 @@ export function useLoginLogHook() {
CommonUtils.fillPaginationParams(searchFormParams, pagination);
CommonUtils.fillTimeRangeParams(searchFormParams, timeRange.value);
exportLoginLogExcelApi(toRaw(searchFormParams), "登录日志.xls");
exportLoginLogExcelApi(toRaw(searchFormParams), "登录日志.xlsx");
}
async function handleDelete(row) {
@@ -175,7 +175,7 @@ export function useOperationLogHook() {
CommonUtils.fillPaginationParams(searchFormParams, pagination);
CommonUtils.fillTimeRangeParams(searchFormParams, timeRange.value);
exportOperationLogExcelApi(toRaw(searchFormParams), "操作日志.xls");
exportOperationLogExcelApi(toRaw(searchFormParams), "操作日志.xlsx");
}
async function handleDelete(row) {
+1 -1
View File
@@ -176,7 +176,7 @@ export function useHook() {
async function exportAllExcel() {
CommonUtils.fillPaginationParams(searchFormParams, pagination);
exportUserExcelApi(toRaw(searchFormParams), "用户列表.xls");
exportUserExcelApi(toRaw(searchFormParams), "用户列表.xlsx");
}
async function handleAdd(row, done) {
@@ -25,7 +25,7 @@ const upload = reactive({
function downloadTemplate() {
http.download(
"system/users/excelTemplate",
`user_template_${new Date().getTime()}.xls`
`user_template_${new Date().getTime()}.xlsx`
);
}
+1 -1
View File
@@ -1,5 +1,5 @@
{
"extends": "../tsconfig.base.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "esnext",
"module": "esnext",
+2 -2
View File
@@ -30,8 +30,8 @@ declare global {
/** 内嵌的`iframe`链接 `可选` */
frameSrc?: string;
/** 是否是内部页面 使用frameSrc来嵌入页面时,当isFrameSrcInternal=true的时候, 前端需要做特殊处理 */
/** 比如链接是 /druid/login.html */
/** 前端需要处理成 http://localhost:8080/druid/login.html */
/** 比如链接是 /internal/page.html */
/** 前端需要处理成当前后端服务可访问的完整地址 */
isFrameSrcInternal?: boolean;
/** `iframe`页是否开启首次加载动画(默认`true`)`可选` */
frameLoading?: boolean;
+8
View File
@@ -0,0 +1,8 @@
{
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.html"
}
]
}
+1 -1
View File
@@ -45,7 +45,7 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
// 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy
proxy: {
"/dev-api": {
target: "http://localhost:8080",
target: "http://localhost:3000",
changeOrigin: true,
rewrite: path => path.replace(/^\/dev-api/, "")
}