DEV_DSW 4ef1113c2c feat(login): implement mobile SMS login flow
Add utility function for form URL encoded data serialization, update the oauthToken API to use proper form data and basic authentication, add sendCode API for sending mobile verification codes, and rewrite the phone login flow with input validation and correct OAuth parameters.
2026-06-02 16:55:53 +08:00
2026-05-25 23:40:50 +08:00
2026-05-26 12:14:31 +08:00

nianxx-h5

基于 Vite 的 H5 Web 项目Vue 3 + TypeScript

技术栈

  • Vitepackage.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 typecheckvue-tsc --noEmit
  • yarn build:类型检查 + 构建
  • yarn preview:预览构建产物
  • yarn test:运行 src/**/*.test.tsNode 原生 test runner

需要编译/测试时请手动确认执行。

环境变量

本项目使用 Vite 环境变量(import.meta.env.*)。

必须配置:

  • VITE_API_BASE_URL:接口基础地址(请求库会校验,缺失会直接抛错)

常用配置:

  • VITE_CLIENT_ID:请求 header 注入的 clientId
  • VITE_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
C端H5项目
Readme 7.4 MiB
Languages
Vue 59.3%
TypeScript 22.2%
JavaScript 8.4%
HTML 7.2%
SCSS 2.1%
Other 0.8%