build / build (push) Successful in 2m1s
后端新增「通知公告」模块(key=notice,对应 D:\项目管理\NoticeFront,线上前缀 /notice)。
★ 它与既有「校园公告」(campusnotice)是**两个应用**,别混:
campusnotice 按班级下发 + 审批流/草稿箱;notice 按用户下发,无审批/草稿/推送范围。
- vite.config.ts:加 /notice 代理 → 8093(本地联调;缺了则代取字典/提交都会 404)
- assets/config/modules.ts:补 MODULE_CONTEXT/LABEL/LANDING/META/ORDER 五行。
★ MODULE_CONTEXT 缺一行,moduleUrl() 就返回 null —— 「去系统里查看」会变成点不动的空按钮,
这正是新模块最容易漏的一处。
- components/QuickActions.vue:补首屏快捷卡文案(图标「通」、色调 cyan)
- views/Chat.vue:补两条例句(发布通知公告 / 我有哪些未读的通知?),
并把「公告|通知」的边打边提示改成提醒两个模块说全称最稳(光说「发通知」是跨模块歧义)
142 lines
6.0 KiB
TypeScript
142 lines
6.0 KiB
TypeScript
import { UserConfig, defineConfig } from "vite";
|
||
import { createHtmlPlugin } from "vite-plugin-html";
|
||
import vue from "@vitejs/plugin-vue";
|
||
import path, { resolve } from "path";
|
||
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
|
||
import ViteAutoImport from "unplugin-auto-import/vite";
|
||
|
||
import UnoCSS from "@unocss/vite";
|
||
import presetUno from "@unocss/preset-uno";
|
||
|
||
import presetRemToPx from "@unocss/preset-rem-to-px";
|
||
|
||
export default defineConfig((): UserConfig => {
|
||
// 构建产物直出 dist/ 根(CI 打 zip 取 dist 根,projman 校验要求 zip 根直接是 index.html)
|
||
const outDir = "dist";
|
||
|
||
return {
|
||
plugins: [
|
||
vue(),
|
||
createSvgIconsPlugin({
|
||
iconDirs: [resolve(process.cwd(), "src/assets/icons")],
|
||
symbolId: "icon-[dir]-[name]",
|
||
inject: "body-last",
|
||
customDomId: "__svg__icons__dom__",
|
||
}),
|
||
ViteAutoImport({
|
||
imports: [
|
||
"vue",
|
||
"vue-router",
|
||
{
|
||
"view-ui-plus": ["Button", "Input", "Message", "Avatar", "Tag", "Tooltip"],
|
||
},
|
||
{
|
||
from: "alova/client",
|
||
imports: ["useRequest", "useWatcher", "useForm"],
|
||
},
|
||
],
|
||
dts: "./src/auto-imports.d.ts",
|
||
dirs: ["src/api/module"],
|
||
}),
|
||
createHtmlPlugin({
|
||
minify: true,
|
||
pages: [
|
||
{
|
||
entry: "src/main.ts",
|
||
template: "index.html",
|
||
filename: "index.html",
|
||
injectOptions: {
|
||
data: {
|
||
title: "智能助手",
|
||
injectScript: ``,
|
||
},
|
||
},
|
||
},
|
||
],
|
||
}),
|
||
UnoCSS({
|
||
presets: [
|
||
presetUno(),
|
||
presetRemToPx({ baseFontSize: 4 }),
|
||
],
|
||
shortcuts: {
|
||
"flex-center": "flex items-center justify-center",
|
||
card: "bg-white rounded-8px shadow-md p-16px",
|
||
"text-ellipsis": "truncate",
|
||
},
|
||
theme: {
|
||
fontSize: {
|
||
xs: "12px",
|
||
sm: "14px",
|
||
base: "16px",
|
||
lg: "18px",
|
||
xl: "20px",
|
||
"2xl": "24px",
|
||
},
|
||
},
|
||
}),
|
||
],
|
||
resolve: {
|
||
alias: {
|
||
"@": path.resolve(__dirname, "./src"),
|
||
},
|
||
},
|
||
server: {
|
||
host: "localhost",
|
||
port: 8080,
|
||
proxy: {
|
||
// 同源代理:serviceHost 留空时前端走 /api/...,由这里转发到本地 AgentService(8093),
|
||
// 规避后端 CAS 过滤器对 /api/* 不回 CORS 头导致的浏览器直连跨域拦截。
|
||
// 如需连测试环境:target 换成 http://base.yunhaixingtong.com/agent
|
||
"/api": {
|
||
target: "http://localhost:8093",
|
||
changeOrigin: true,
|
||
},
|
||
// 业务模块前缀:模块的**路由前缀与模块 key 不一定同名** —— 请假的 key 是
|
||
// `homeleave` 而真实前缀是 `/home-leave`。后端下发的 optionCall / 附件 uploadPath
|
||
// 都会带上真实前缀,本地一并代理到 mock,好让「路径拼错」这类问题在本地就暴露
|
||
// (请假的佐证材料就曾因为拼成 /homeleave/api/base/FileUpload 而 404,直到上线才发现)。
|
||
"/home-leave": { target: "http://localhost:8093", changeOrigin: true },
|
||
"/campusnotice": { target: "http://localhost:8093", changeOrigin: true },
|
||
// 通知公告:与「校园公告」是两个应用 —— 它是 notice(前缀 /notice),
|
||
// 而校园公告是 campusnotice(前缀 /campusnotice)。key 与前缀同名,仍显式列出。
|
||
"/notice": { target: "http://localhost:8093", changeOrigin: true },
|
||
"/dormnotice": { target: "http://localhost:8093", changeOrigin: true },
|
||
"/familyactivity": { target: "http://localhost:8093", changeOrigin: true },
|
||
"/coursehomework": { target: "http://localhost:8093", changeOrigin: true },
|
||
// 教师专业发展:前缀与模块 key 同名(profession),但按同一条铁律显式列出,
|
||
// 免得以后改了 key 又出现「本地测不出、上线 404」。
|
||
"/profession": { target: "http://localhost:8093", changeOrigin: true },
|
||
},
|
||
},
|
||
base: "./",
|
||
build: {
|
||
target: "modules",
|
||
outDir,
|
||
assetsDir: "assets",
|
||
sourcemap: false,
|
||
minify: "esbuild",
|
||
chunkSizeWarningLimit: 1000,
|
||
cssTarget: "chrome61",
|
||
rollupOptions: {
|
||
input: {
|
||
main: resolve("index.html"),
|
||
},
|
||
output: {
|
||
chunkFileNames: "static/js/[name]-[hash].js",
|
||
entryFileNames: "static/js/[name]-[hash].js",
|
||
assetFileNames: (assetInfo: any) => {
|
||
if (assetInfo.type === "asset" && /\.(jpe?g|png|gif|svg)$/i.test(assetInfo.name)) {
|
||
return "static/img/[name].[hash][ext]";
|
||
}
|
||
if (assetInfo.type === "asset" && /\.(ttf|woff|woff2|eot)$/i.test(assetInfo.name)) {
|
||
return "static/fonts/[name].[hash][ext]";
|
||
}
|
||
return "static/[ext]/[name]-[hash].[ext]";
|
||
},
|
||
},
|
||
},
|
||
},
|
||
};
|
||
});
|