feat: 提交校园公告前端工程源码(Vue3 + Vite + view-ui-plus)
build / build (push) Successful in 10m17s

- 同步仓库 CI 配置 .gitea/workflows/build.yml
- 纳入 src/public/config/scripts 等工程文件
- .gitignore 增加 .scratch/.backup/.trash,排除本地临时产物
This commit is contained in:
lijing
2026-09-15 11:15:03 +08:00
parent 36f921450c
commit ec1f94eaa8
344 changed files with 40001 additions and 2 deletions
+11
View File
@@ -0,0 +1,11 @@
# 开发环境 (dev):仅 vite dev --mode dev 加载;build 产物不读任何 .env.*
# (.env.base/.env.ld/.env.prod 已删,线上由 /api/env-config?target=front 运行时下发)。
# ⚠️ VITE_* 仅本地开发生效。
# API 走 /api 同源相对路径(vite proxy 转发到本地后端 8101),
# 规避后端 CAS 过滤器不回 CORS 头导致的跨域拦截;SSO/基础平台用真实环境
VITE_BASE_HOST=http://base.yunhaixingtong.com
VITE_SSO_HOST=http://sso.yunhaixingtong.com
VITE_SERVICE_HOST=http://base.yunhaixingtong.com/campusnotice/
VITE_ZIYUANKU_HOST=https://base.bestsch.com/BschZyk
VITE_ZHUANXIANG_HOST=https://base.bestsch.com/BschZncpd
VITE_IS_MOCK=false
+9
View File
@@ -0,0 +1,9 @@
# 本地纯前端调试模式:仅 vite dev --mode mock 加载(build 产物不读任何 .env.*,
# 线上由 /api/env-config?target=front 运行时下发)。后端 SSO/base 不可达时启用内置 mock
# 启动:npm run dev:mock
VITE_BASE_HOST=
VITE_SSO_HOST=
VITE_SERVICE_HOST=http://localhost:8101
VITE_ZIYUANKU_HOST=
VITE_ZHUANXIANG_HOST=
VITE_IS_MOCK=true
+29
View File
@@ -0,0 +1,29 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
yarn.lock
.npmrc
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# scratch
.temp
+15
View File
@@ -0,0 +1,15 @@
module.exports = {
extends: ["airbnb", "prettier", "prettier/react"],
singleQuote: false, // 是否强制使用单引号
printWidth: 120, // 超过最大值换行
tabWidth: 4,
htmlWhitespaceSensitivity: "ignore",
semi: true, // 结尾是否使用分号
//disableLanguages: ["vue"], // 不格式化vue文件,vue文件的格式化单独设置
endOfLine: "auto",
arrowParens: "avoid", // 箭头函数参数括号 默认avoid 可选 avoid| always
};
//如需显示webpack目录,运行以下命令
// npm run eject
//如需配合使eslint生效,运行以下命令
//npm install --save-dev eslint-plugin-prettier
+82 -2
View File
@@ -1,3 +1,83 @@
# CampusnoticeFront
# 校园公告前端(Vue3 + Vite + view-ui-plus)
managed by projman
## 本地启动
```bash
npm install
```
### 1)纯前端调试(推荐,后端不可用时)
本地连不上 `sso.yunhaixingtong.com` / `base.yunhaixingtong.com` 时,后端 CAS 过滤器会拦截
`/api/*` 请求导致所有接口失败。此时使用内置 mock 调试前端页面:
```bash
npm run dev:mock
```
- 启用 `src/assets/mock/noticeapi.ts` 中的内存 mock(vite-plugin-mock),覆盖全部页面接口:
用户/菜单、发文部门字典、通知增删改查、阅读情况、联系组、选择用户树、附件上传等。
- mock 数据为内存态,刷新页面即还原;修改 mock 文件后需重启 dev server 才生效。
- mock 模式下请求走 vite 同源(`host.config.ts` 中 `serviceHost` 为空串)。
### 2)连接后端调试
```bash
npm run dev
```
- `.env.dev`:`VITE_SERVICE_HOST=http://localhost:8070/notice`(Java 后端,见 `../service`)。
- 后端需要能访问 CAS(`yh.sso.server-url-prefix`)与用户中心(`yh.open.*`),否则接口 302/失败。
## 信息架构(对齐后端测试台 api-test.html 六视图)
| 路由 | 页面 |
| --- | --- |
| `/` | 我的通知(左列表 + 右详情;未读/已读/类型筛选,三 tab 带条数 `notice/ReadTabCount`;详情 `上一篇/下一篇`(`notice/GetNextPrev?type=1`)+ 打印;附件/回执提示) |
| `/list` | 已发管理(状态/类型筛选、审批进度、撤回/置顶/催读/转发、阅读回执、驳回重提) |
| `/list/new` | 写通知(新建/编辑 `?serid=`/草稿续编/转发 `?fid=`;推送范围+预估、回执勾选、直接发布/存草稿/提交审批三态) |
| `/drafts` | 草稿箱(继续编辑/提交审批/删除) |
| `/noticelist` | 全部通知(管理端) |
| `/approval` | 审批中心(待我审批/已通过/已驳回/全部,多步流程进度) |
| `/approval-setting` | 审核设置(审批人池) |
| `/stats` | 通知统计(开发中) |
| `/setting` | 应用设置(发文部门卡片 + 自定义组) |
| `/list/detail` `/noticelist/detail` | 通知详情(`type=0` 管理视角含阅读进度/审批轨迹/编辑/打印,`type=1` 查看) |
> 旧版路径(`/notice/*`、`/accept`、`/manage` 等)已保留重定向兼容。
## 关键组件
- `components/PushScopePanel.vue`:推送范围面板(全校/学段/年级/班级树 + chips +
ScopePreview 接收人数预估,`notice/ScopeTree`)。
- `components/ApprovalFlowEditor.vue`:多步审批流编辑器(或签/会签、步骤排序)。
- `components/UserCheckModal.vue`:选择用户弹窗(组织树勾选 + 已选列表,移植自旧前端
`oldfront/src/components/userCheck.vue`)。
- `components/NoticeUpload.vue`:通知附件上传(选择文件 + 200MB 限制,移植自旧
`uploadFile.vue`)。
- `utils/noticePrint.ts`:公告打印公共工具(v17)。「已收到」与「通知详情」共用,打印件含
标题/来源·发布人·发布时间/接收范围/正文/附件文件名清单/打印时间;`buildPrintHtml` 为纯函数,
可被 `.scratch` 脚本直接断言(弹窗被浏览器拦截时 `printNotice` 返回 false 由页面提示)。
- 发文部门卡片:见 `views/notice/NoticeSetting.vue`,样式与交互对齐 UserBase「应用类型」
(`UserBase/front/src/views/app/AppCategory.vue`),额外支持停用/启用。
## 菜单说明
左侧菜单数据源为平台用户中心 `base/GetUserMod`(库表配置)。**栏目名称直接显示接口返回的
`name`,前端不做改名**(v10 起已移除原 `MENU_NAME_MAP` 展示层映射):在平台管理后台把模块名
改成「我的通知 / 已发管理 / …」,前端刷新即生效;平台仍配旧叫法则显示旧叫法。
应用内保留三层处理(`components/layout.vue` + `utils/menuRoute.ts`):
1. 平台配置的 `page` 格式不可控,统一解析为内部路由(path 精确 → 原始模块名别名 → 外链整页
跳转 → `modId` 契约兜底);解析使用接口原始 `name`,与显示名互不影响,配错时显式提示而非静默跳默认页;
2. 「草稿箱」菜单项注入(平台无对应模块,挂「已发管理」之后),无需改动平台模块表;
3. 栏目顺序按接口 `orderNumber` 升序(`utils/menuRoute.ts` `sortByOrderNumber`,v11):后端
`GetUserMod` 保持用户中心返回行序不重排,排序在前端完成,平台改模块「排序号」即换序;
`orderNumber` 缺失/非数值的项沉底,同值保持接口原序。
`assets/config/menu.ts` 为早期本地菜单兜底数据,现已无引用,仅作历史参考。
## 统计说明
统计相关前端已按需求移除(`Notice_statis` 接口封装、菜单、图标等),后期统计不在本应用内做。
+41
View File
@@ -0,0 +1,41 @@
import type { GeneratorConfig } from "@alova/wormhole";
export default {
generator: [
{
input: "http://base.yunhaixingtong.com/notice/v3/api-docs",
// 文档平台类型
platform: "swagger",
// 生成代码的输出目录
output: "src/api",
// 响应数据的媒体类型
responseMediaType: "application/json",
// 请求体数据的媒体类型
bodyMediaType: "application/json",
// 生成的 API 版本
version: 1,
// 生成代码类型
type: "typescript",
// 全局 API 名称
global: "Apis",
splitImplementation: true,
implementation: "inline",
// API 处理函数
handleApi: apiDescriptor => {
// 过滤掉已废弃的 API
if (apiDescriptor.deprecated) {
return undefined;
}
const newOpId = apiDescriptor.summary?.trim() || apiDescriptor.operationId;
const url = apiDescriptor.url.replace(/^\/{platform}\//, "/api/");
return {
...apiDescriptor,
operationId: newOpId, // 关键:改掉它
url: apiDescriptor.url.replace(/^\/{platform}\//, "/api/"),
};
},
},
],
} as GeneratorConfig;
+6
View File
@@ -0,0 +1,6 @@
//铃铛debug
window.conf = {
baseHost: "http://basedebug.bestsch.com",
ssoHost: "http://ssodebug.bestsch.com",
serviceHost: "http://basedebug.bestsch.com/QualityEvaluate",
};
+45
View File
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="../../favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- 运行时配置引导:在任何应用模块执行前同步拉取 /<contextPath>/api/env-config
(后端免登录端点,projman 配置管理在线维护),替代生产构建环境变量。
必须同步:host.config.ts 在模块求值期就读 window.__APP_CONFIG__;失败/本地开发
(根路径,段数不足 2)则不设置:本地走 .env.dev/.env.mock(VITE_*),线上走同域推导兜底。
target = URL 第 2 段目录名:本应用产物部署于 /{contextPath}/front/,故为 front,
对应后端配置键 yh.env-config.source.front(环境变量 YH_ENV_CONFIG_SOURCE_FRONT)。
注意:同步 XHR 不支持 timeout 属性(赋值会抛 InvalidAccessError),依赖内网快速失败 -->
<script>
(function () {
try {
var seg = location.pathname.split("/").filter(Boolean);
if (seg.length < 2) return; // 本地开发(根路径):走 .env.dev / .env.mock
var xhr = new XMLHttpRequest();
xhr.open("GET", "/" + seg[0] + "/api/env-config?target=" + encodeURIComponent(seg[1]), false);
xhr.send(null);
if (xhr.status === 200) {
var conf = JSON.parse(xhr.responseText);
if (conf && typeof conf === "object") window.__APP_CONFIG__ = conf;
}
} catch (e) {
/* 拉取失败保持未设置,走同域推导兜底 */
}
})();
</script>
<title><%- title %></title>
<link rel="stylesheet" href="./libs/ztree/zTreeStyle.css" />
<script src="./libs/jquery.min.js"></script>
<script src="./libs/lodash.min.js"></script>
<script src="./libs/ztree/jquery.ztree.all.min.js"></script>
<%- injectScript %>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
+14346
View File
File diff suppressed because it is too large Load Diff
+53
View File
@@ -0,0 +1,53 @@
{
"name": "campus-announcement",
"private": true,
"version": "0.0.0",
"nodeversion": "20.19.4",
"type": "module",
"scripts": {
"dev": "vite --mode dev",
"dev:mock": "vite --mode mock",
"build": "vite build --mode base",
"build:base": "vite build --mode base",
"build:ld": "vite build --mode ld",
"build:prod": "vite build --mode prod",
"preview": "vite preview",
"api:gen": "alova gen -f"
},
"dependencies": {
"@open-file-viewer/core": "^0.1.43",
"@open-file-viewer/vue": "^0.1.43",
"@types/lodash": "^4.14.196",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",
"alova": "^3.4.0",
"axios": "^0.24.0",
"lodash": "^4.17.21",
"mitt": "^3.0.1",
"mockjs": "^1.1.0",
"node-sass": "latest",
"pdfjs-dist": "^4.10.38",
"pinia": "^2.1.4",
"sass": "^1.64.1",
"view-ui-plus": "^1.3.16",
"vite-plugin-mock": "2.9.6",
"vue": "^3.4.19",
"vue-router": "4",
"vuedraggable": "^4.1.0"
},
"devDependencies": {
"@alova/wormhole": "^1.5.0",
"@types/node": "^20.4.4",
"@unocss/preset-rem-to-px": "^66.6.0",
"@unocss/preset-uno": "^66.6.0",
"@vitejs/plugin-vue": "^5.0.4",
"fast-glob": "^3.3.2",
"typescript": "^5.2.2",
"unocss": "^66.6.0",
"unplugin-auto-import": "0.18.3",
"vite": "^5.1.4",
"vite-plugin-html": "^3.2.2",
"vite-plugin-svg-icons": "^2.0.1",
"vue-tsc": "^1.8.27"
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEáCNS2-H
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEá ETen-B5-H` ^
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSE!!�º]aX!!]`�21�> �p �z�$]‚�"R‚d�-Uƒ7�*„␍4„%�+ „Z „{�/…%…<�9K…b�1]†.�"‡ ‰`]‡,�"]ˆ
�"]ˆh�"]‰F�"]Š$�"]‹�"]‹`�"]Œ>�"]��"]�z�"]ŽX�"]�6�"]��"]�r�"]‘P�"]’.�"]“ �"]“j�"]”H�"]•&�"]–�"]–b�"]—@�"]˜�"]˜|�"]™Z�"]š8�"]›�"]›t�"]œR�"]�0�"]ž�"]žl�"]ŸJ�"] (�"]¡�"]¡d�"]¢B�"]£ �"X£~�']¤W�"]¥5�"]¦�"]¦q�"]§O�"]¨-�"]© �"]©i�"]ªG�"]«%�"]¬�"]¬a�"]­?�"]®�"]®{�"]¯Y�"]°7�"]±�"]±s�"]²Q�"]³/�"]´␍�"]´k�"]µI�"]¶'�"]·�"]·c�"]¸A�"]¹�"]¹}�"]º[�"]»9
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More