# xcy-pc **Repository Path**: xince-cloud/xcy-pc ## Basic Information - **Project Name**: xcy-pc - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-09 - **Last Updated**: 2026-07-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # xcy-pc XCY 机构管理后台前端。技术栈:Vue 3 + Vite + Vue Router 4 + Pinia + Element Plus + axios。 ## 启动 ```bash npm i npm run dev ``` - 开发服务器:http://localhost:5173 - 后端代理:`/api` → `http://localhost:8080`(需后端在 8080 端口先启动) - 构建:`npm run build`,预览:`npm run preview` ## 目录结构 ``` src/ api/http.js axios 实例(baseURL /api,自动带 token,统一 envelope 解包) router/ index.js 路由入口 + 自动加载约定 + 全局守卫(勿改) modules/*.js 各 feature 的路由片段(page agent 在此加文件) layout/index.vue 主框架(侧边菜单 + 顶部 + router-view) views/ login/index.vue 机构登录页 /... 各业务页面(page agent 在此加文件) store/user.js 用户态(token / userInfo / login / logout) main.js 应用入口 App.vue ``` ## 路由自动加载约定(page agent 必读) `src/router/index.js` 使用 `import.meta.glob('./modules/*.js', { eager: true })` 自动汇总 `src/router/modules/` 下所有路由片段,合并进 Layout 的 children。 page agent 新增页面时: 1. 在 `src/views//` 下放页面组件。 2. 在 `src/router/modules/.js` 新建路由片段,`export default` 一个 route 数组: ```js // src/router/modules/entrust.js export default [ { path: '/entrust', name: 'Entrust', component: () => import('../../views/entrust/index.vue'), meta: { title: '委托单' } } ] ``` 3. 不要修改 `src/router/index.js`,多个 page agent 可互斥并行加文件。 ## API 约定 - 业务响应封装:`{ code, msg, data }`,`code === 0` 成功,`http.js` 直接返回 `data`。 - 非 0 的 code 会 `ElMessage.error(msg)` 并 reject;`401 / 1003` 自动清 token 跳 `/login`。 - 请求自动带 `Authorization: Bearer `。 - 登录接口:`POST /api/v1/auth/org/login`,body `{ orgId, username, password }`。