Template
Align console UI with school-iot-admin and wire login to serverschool
UI / layout - rebuild left mode: full-width blue header (60px) + white sidebar below + card-style tags view - introduce design tokens in variables.css (brand #347df9, sidebar 240px, menu item 49px) and theme overrides for dark / dark-blue themes - restyle navigation bar (logo + platform name / top nav / tools + user), logo, sidebar (selected state: light blue bg + blue bar + bold), tags view, app main - global styles: .app-container white card, .head-title, .btn-blue/.btn-white, el-table / el-dialog look, brand color injected into --el-color-primary - add favorites store (localStorage) wired to sidebar star and header top nav - disable template watermark / footer / promo notifications by default Login (serverschool) - port school-iot-admin login page (background art, right side card, keep-login) - OAuth2 password mode: GET /oauth/token (raw axios) + GET /uc/account/current - port phone lookup (/wx/getAccoutList) and forget-password flow (/sms/sendCode + /sms/verifyCode) as components/login/Forget.vue - user store exposes accountInfo / accountType / teamId / roleId and strips password Infra - move all devServer proxies and env vars from school-iot-admin/vue.config.js (default targets point to production) - fix empty sidebar: guard short-circuit skipped setRoutes when login page already fetched user info
This commit is contained in:
+124
-4
@@ -13,7 +13,14 @@ import svgLoader from "vite-svg-loader"
|
||||
|
||||
// Configuring Vite: https://cn.vite.dev/config
|
||||
export default defineConfig(({ mode }) => {
|
||||
const { VITE_PUBLIC_PATH } = loadEnv(mode, process.cwd(), "") as ImportMetaEnv
|
||||
const {
|
||||
VITE_PUBLIC_PATH,
|
||||
VITE_SCHOOL_TARGET,
|
||||
VITE_WS_TARGET,
|
||||
VITE_VIDEO_TARGET,
|
||||
VITE_VIDEO_MINIO,
|
||||
VITE_AGENT_DIALOGUE_TARGET
|
||||
} = loadEnv(mode, process.cwd(), "") as ImportMetaEnv
|
||||
return {
|
||||
// 开发或打包构建时用到的公共基础路径
|
||||
base: VITE_PUBLIC_PATH,
|
||||
@@ -35,14 +42,127 @@ export default defineConfig(({ mode }) => {
|
||||
strictPort: false,
|
||||
// 是否自动打开浏览器
|
||||
open: true,
|
||||
// 反向代理
|
||||
// 反向代理(从 school-iot-admin/vue.config.js 的 devServer.proxy 搬运,默认连生产环境)
|
||||
// 目标地址优先读 .env.development 里的 VITE_*_TARGET,未配置时用下面的默认值
|
||||
proxy: {
|
||||
// apifoxmock(demo / FastCrud 演示页)
|
||||
"/api/v1": {
|
||||
target: "https://apifoxmock.com/m1/2930465-2145633-default",
|
||||
// 是否为 WebSocket
|
||||
ws: false,
|
||||
// 是否允许跨域
|
||||
changeOrigin: true
|
||||
},
|
||||
// serverschool 后端(登录 / 业务主接口)
|
||||
"/hxyd-api": {
|
||||
target: VITE_SCHOOL_TARGET || "https://band.hxzhxy.cn",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
// 去掉前缀后转发,例如 /hxyd-api/oauth/token -> /oauth/token
|
||||
rewrite: path => path.replace(/^\/hxyd-api/, "")
|
||||
},
|
||||
// 测试后端(老平台 203 环境)
|
||||
"/hxyd-test": {
|
||||
target: "http://203.25.213.15:8100",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
rewrite: path => path.replace(/^\/hxyd-test/, "")
|
||||
},
|
||||
// 智能体对话(score_agent / LangGraph,本机起服务)
|
||||
"/agent-dialogue-api": {
|
||||
target: VITE_AGENT_DIALOGUE_TARGET || "http://127.0.0.1:3030",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
rewrite: path => path.replace(/^\/agent-dialogue-api/, "")
|
||||
},
|
||||
// LangGraph 智能体服务
|
||||
"/hxyd-langgraph": {
|
||||
target: "http://192.168.0.111:2027",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
rewrite: path => path.replace(/^\/hxyd-langgraph/, "")
|
||||
},
|
||||
// Dify
|
||||
"/hxyd-dify": {
|
||||
target: "https://net2.hxzhxy.cn:5093",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
rewrite: path => path.replace(/^\/hxyd-dify/, "")
|
||||
},
|
||||
// AI 服务(yolo 识别等)
|
||||
"/hxyd-ai": {
|
||||
target: "http://100.64.0.25:8080",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
rewrite: path => path.replace(/^\/hxyd-ai/, "")
|
||||
},
|
||||
// 成绩智能体后端(205)
|
||||
"/school-api": {
|
||||
target: "http://192.168.0.205:8100",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
rewrite: path => path.replace(/^\/school-api/, "")
|
||||
},
|
||||
// yolo 抓拍图片(minio),必须放在 /hxyd-video 前面(更前缀优先匹配)
|
||||
"/hxyd-video/yolo": {
|
||||
target: VITE_VIDEO_MINIO || "http://11.1.20.107:9000",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
// 与老平台一致:只去掉 /hxyd-video,保留 /yolo
|
||||
rewrite: path => path.replace(/^\/hxyd-video/, "")
|
||||
},
|
||||
// 视频流(wvp / jessibuca 拉流)
|
||||
"/hxyd-video": {
|
||||
target: VITE_VIDEO_TARGET || "http://11.1.20.107:8000",
|
||||
ws: true,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
rewrite: path => path.replace(/^\/hxyd-video/, "")
|
||||
},
|
||||
// WebSocket
|
||||
"/ws-api": {
|
||||
target: VITE_WS_TARGET || "ws://139.159.182.121:8100",
|
||||
ws: true,
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/ws-api/, "")
|
||||
},
|
||||
// WebRTC 流媒体
|
||||
"/webrtc": {
|
||||
target: "http://192.168.0.244:8082",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/webrtc/, "")
|
||||
},
|
||||
// 个人测试后端
|
||||
"/xtl": {
|
||||
target: "http://192.168.0.10:8100",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/xtl/, "")
|
||||
},
|
||||
"/tangchao": {
|
||||
target: "http://192.168.0.209:8100",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/tangchao/, "")
|
||||
},
|
||||
"/huanghui": {
|
||||
target: "http://192.168.0.205:8100",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/huanghui/, "")
|
||||
},
|
||||
"/xiatianle": {
|
||||
target: "http://3.3.3.3:8100",
|
||||
ws: false,
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/xiatianle/, "")
|
||||
}
|
||||
},
|
||||
// 是否允许跨域
|
||||
|
||||
Reference in New Issue
Block a user