3c177d208748b8ece36153c5ae9a49b5f76ed55f
Replace verbose uni.showToast object syntax with shorter direct calls, remove unnecessary setTimeout wrappers around error toast calls, clean up redundant loading state handling, and remove unused WeChat pay and app payment placeholder code.
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。
yarn
yarn dev
常用命令:
yarn dev:启动开发服务器(端口 5174)yarn typecheck:vue-tsc --noEmityarn build:类型检查 + 构建yarn preview:预览构建产物yarn test:运行src/**/*.test.ts(Node 原生 test runner)
需要编译/测试时请手动确认执行。
路由
当前已在 router/index.ts 配置页面路由(按 src/pages/ 目录落地):
/、/home:首页/login:登录/booking:预定/goods、/goods/album:商品详情/相册/quick、/quick/list:快速预定/order、/order/detail:订单列表/详情/service/order:工单列表
统一请求库
统一请求库实现:
- request.ts
- 类型定义:request-types.ts
- 使用文档: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。
Description
Languages
Vue
59.3%
TypeScript
22.2%
JavaScript
8.4%
HTML
7.2%
SCSS
2.1%
Other
0.8%