Files
nianxx-h5/README.md
duanshuwen 548df7020c feat: initial project setup with core infrastructure and api clients
- Add environment configs for dev/staging/prod environments
- Implement centralized axios request utility with standardized error handling
- Add shared TypeScript types for API responses and requests
- Create comprehensive API client modules for all core endpoints
- Configure vue router with all application page routes
- Add icon fonts, static assets, and loading animations
- Set up project documentation and collaboration guidelines
- Remove deprecated uni-app bridge component files
2026-05-26 21:42:36 +08:00

94 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# nianxx-h5
基于 Vite 的 H5 Web 项目Vue 3 + TypeScript
## 技术栈
- Vite 5
- Vue 3 + TypeScript
- vue-router 4
- Pinia
- Vant 4
- Tailwind CSS v4通过 `@tailwindcss/vite`
- vue-i18n
- axios统一请求库封装见下文
## 目录约定
- 入口:`src/main.ts`
- 路由:`src/router/index.ts`
- 页面:`src/pages/`
- 组件:`src/components/`
- 国际化:`src/i18n/`
- 全局样式:`src/styles/main.css`
- 工具:`src/utils/`
- 共享类型:`src/shared/`
## 本地开发
使用 Yarn。
```bash
yarn
yarn dev
```
常用命令:
- `yarn dev`:启动开发服务器(端口 5174
- `yarn typecheck``vue-tsc --noEmit`
- `yarn build`:类型检查 + 构建
- `yarn preview`:预览构建产物
- `yarn test`:运行 `src/**/*.test.ts`Node 原生 test runner
需要编译/测试时请手动确认执行。
## 路由
当前已在 [router/index.ts](file:///d:/www/znkj/nianxx-h5/src/router/index.ts) 配置页面路由(按 `src/pages/` 目录落地):
- `/``/home`:首页
- `/login`:登录
- `/booking`:预定
- `/goods``/goods/album`:商品详情/相册
- `/quick``/quick/list`:快速预定
- `/order``/order/detail`:订单列表/详情
- `/service/order`:工单列表
## 统一请求库
统一请求库实现:
- [request.ts](file:///d:/www/znkj/nianxx-h5/src/utils/request.ts)
- 类型定义:[request-types.ts](file:///d:/www/znkj/nianxx-h5/src/shared/request-types.ts)
- 使用文档:[docs/request.md](file:///d:/www/znkj/nianxx-h5/docs/request.md)
必须配置环境变量:
- `VITE_API_BASE_URL`
可选配置:
- `VITE_API_TIMEOUT_MS`(默认 15000
## 特殊说明uni-* 痕迹)
代码中存在 `uni.*` API、`<uni-icons>` 等用法。若最终运行环境为纯 H5 Web需要确认这些能力的提供方式注入/替换/降级)。
## 历史遗留问题清单(待逐个替换)
以下为当前仓库可证实的缺失/不一致点,建议按优先级逐步处理:
- `@/request/api/*` 在多个页面/组件被引用,但仓库内暂无对应实现
- `@/utils` 存在目录级导入,但暂无 `src/utils/index.*`
- `@/store` 被引用但实际目录为 `src/stores/`
- `@/hooks/*``@/constant/*` 被引用但当前仓库未找到对应目录
- `src/utils/requets.ts` 为空文件且命名疑似拼写遗留
更详细的引用点列表见:`.trae/documents/统一请求库封装计划.md`
## 协作规范
仓库协作约定见 [AGENTS.md](file:///d:/www/znkj/nianxx-h5/AGENTS.md)。