131cf599ad6f4b862f05c792d2f72e0bf8b46322
add new `/notice` application route and standalone notice detail page format vue-router import to follow project code style guidelines hide myOrder entries from ChatQuickAccess and MoreService component lists comment out unused book now button in goods page and location navigation card refactor home page drawer event listeners with proper types and optional chaining fix NoticeMessage component: remove redundant swiper indicators, adjust container padding, update navigation to use the new notice route comment out weather fetching logic in Welcome component to disable weather display
nianxx-h5
基于 Vite 的 H5 Web 项目(Vue 3 + TypeScript)。
技术栈
- Vite(见
package.json,本仓库使用 ESM:"type": "module") - Vue 3 + TypeScript
- vue-router 4
- Pinia
- Vant 4(配合
unplugin-auto-import/unplugin-vue-components自动导入) - Tailwind CSS v4(通过
@tailwindcss/vite) - vue-i18n(支持:
zh-CN/en-US/th-TH) - axios(统一请求库:
src/utils/request.ts) - mitt(事件总线)
目录约定
- 入口:
src/main.ts - 根组件:
src/App.vue - 路由:
src/router/index.ts - 页面:
src/pages/ - 公共组件:
src/components/ - 首页模块组件:
src/pages/home/components/ - 国际化:
src/i18n/ - 状态管理:
src/store/ - 全局样式:
src/styles/main.css - 工具:
src/utils/ - 共享类型:
src/shared/
本地开发
使用 Yarn。
yarn
yarn dev
常用命令:
yarn dev:启动开发服务器(端口 5174,配置见vite.config.ts)yarn typecheck:vue-tsc --noEmityarn build:类型检查 + 构建yarn preview:预览构建产物yarn test:运行src/**/*.test.ts(Node 原生 test runner)
需要编译/测试时请手动确认执行。
环境变量
本项目使用 Vite 环境变量(import.meta.env.*)。
必须配置:
VITE_API_BASE_URL:接口基础地址(请求库会校验,缺失会直接抛错)
常用配置:
VITE_CLIENT_ID:请求 header 注入的clientIdVITE_API_TIMEOUT_MS:请求超时毫秒数(默认 15000)VITE_TOKEN:临时 token(当前请求库会在请求前写入上下文,属于临时逻辑)
路由
当前路由配置见 src/router/index.ts(按 src/pages/ 目录落地):
/、/home:首页/login:登录/booking:预定/goods:商品详情/album:相册/quick:快速预定/order、/order/detail:订单列表 / 订单详情/service:工单列表
国际化(i18n)
- i18n 实例:
src/i18n/index.ts - 语言包:
src/i18n/modules/**/{zh-CN,en-US,th-TH}.ts - 切换语言:
setLocale(locale)(同时会同步 Vant 语言与document.lang)
统一请求库
统一请求库实现:
src/utils/request.ts- 类型定义:
src/shared/request-types.ts - 使用文档:
docs/request.md
特殊说明(uni-* 痕迹)
代码中仍存在部分 uni.* API(例如 uni.navigateTo / uni.requestSubscribeMessage)。如果最终运行环境为纯 H5 Web,需要确认这些能力的提供方式(注入 / 替换 / 降级)。
协作规范
仓库协作约定见 AGENTS.md。
Description
Languages
Vue
59.3%
TypeScript
22.2%
JavaScript
8.4%
HTML
7.2%
SCSS
2.1%
Other
0.8%