Commit 3b224019 by 张立顺

feat: 初始化车生活简化系统 v1.0.0

0 parents
Showing 1000 changed files with 3152 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

File mode changed
File mode changed
# 订单列表横向滚动卡顿 — 原因分析与优化
## 问题页面
- [`src/views/orderManage/order.vue`](../src/views/orderManage/order.vue)(1.1 精品升级)
- [`src/views/orderManage/carDamage.vue`](../src/views/orderManage/carDamage.vue)(2.1 会员权益 / 2.3 延保,共用同一列表组件)
## 根因(按影响排序)
1. **超宽表格(~45–50 列)+ `fixed="right"` 操作列** — Element UI 固定列双份 DOM,横滚时 layout/sync 成本高(主因)
2. **10+ 列对 `subOrderList` 嵌套 `v-for`** — 每行数千 DOM 节点
3. **30+ 列自定义 slot** — 无法走简单文本渲染
4. **`el-tooltip` 行内实例** — 商品名称/类目/套餐别名列
5. **模板内重复调用 `getGoodsTypeName`(4 次/格)**
6. **操作列多个 `auth-button`** + fixed 叠加
## 已实施优化
### 精品(order.vue)
| 阶段 | 改动 | 文件 |
|------|------|------|
| 保留 | **操作列 `fixed="right"`**(产品要求) | order.vue |
| 保留 | 操作按钮全部平铺 `auth-button`,不收进下拉 | order.vue |
| P0 | `getList` 预计算展示字段 | `utils/orderListRowDisplay.js` |
| P0 | 分页上限改为 20 | order.vue |
| P1 | 子商品 10 列收入展开行 | order.vue |
| P1b | 展开区改用**原生 table**(替代嵌套 el-table) | order.vue |
| P1b | 展开区 `overflow-x: auto` 独立横滚 | order.vue |
| P1b | **手风琴单展开**(`expand-row-keys`) | order.vue |
### 权益(carDamage.vue)
| 阶段 | 改动 | 文件 |
|------|------|------|
| 保留 | **操作列 `fixed="right"`** | carDamage.vue |
| 保留 | 操作按钮全部平铺 `auth-button`(9040132–9040135、9040147、9040148) | carDamage.vue |
| P0 | `getList` 预计算展示字段(`mapCarDamageListRow`) | `utils/orderListRowDisplay.js` |
| P0 | 分页上限改为 20 | carDamage.vue |
| P1 | 子商品 **14 列**收入展开行(含套餐、优惠券) | carDamage.vue |
| P1b | 展开区原生 table + 独立横滚 | carDamage.vue |
| P1b | 手风琴单展开 | carDamage.vue |
| 保留 | 权益特有主表列:第三方订单号、展业场景、交易参考号、上传协议 | carDamage.vue |
## 静态指标(优化后)
| 指标 | 精品 order.vue | 权益 carDamage.vue |
|------|----------------|-------------------|
| 主表列数 | ~33 | ~35 |
| 子商品展示 | 展开行原生 table(10 列) | 展开行原生 table(14 列) |
| 展开模式 | 同时仅 1 行展开 | 同时仅 1 行展开 |
| 操作列 fixed | **是(保留)** | **是(保留)** |
| 操作按钮 | 全部平铺,无 dropdown | 全部平铺,无 dropdown |
| pageSize 上限 | 20 | 20 |
## 展开行卡顿说明
展开后若使用嵌套 `el-table`,会与父表 `fixed="right"` 叠加导致横滚再次变卡。已通过原生 table + 展开区独立滚动 + 手风琴模式缓解。
## 后续可选(未实施)
- 列显示配置(用户自选可见列)
- 虚拟滚动 PoC(P2)
> 说明:操作列固定会带来一定横滚成本,通过子商品展开行 + 预计算字段等其他优化抵消大部分 DOM 压力。
## 验收指标
- 横滚 FPS ≥ 50(10 行、默认列)
- scroll 长任务 < 50ms
- 主表 DOM 节点降 40%+(展开行收起时)
# 订单列表筛选/分页状态记忆
## 背景
订单列表(`orderList`)包含多个子 Tab(精品升级、升配、众筹、权益、延保、积分商城)。用户从列表进入详情再返回时,原先会丢失筛选条件、分页位置和表格数据。
## 根因
1. 路由 `orderList` 的 `meta.cache: false`,页面不在 `keep-alive` 中
2. 组件 `name` 与路由 `name` 不一致(`OrderList` vs `orderList`)
3. 详情页返回时 `close({ tagName: "/orderList" })` 主动销毁列表 Tab
4. 壳层 `$route` watcher 在详情返回时重复 `loadScenesForCategory`
## 方案
**keep-alive + 导航修复**(不改 `d2-table`)
- 开启 `orderList` 路由 `cache: true`
- 壳层组件 `name` 改为 `orderList`(与路由一致)
- 详情返回仅关闭详情 Tab,不关闭列表 Tab,不带 `tabPane` params
- `shouldReapplyRouteParams` 守卫:从详情返回时跳过路由参数重放
- **不在 `activated` 中刷新列表**(满足返回不重新请求)
## 涉及文件
| 文件 | 说明 |
|------|------|
| `src/router/modules/904_orderManagement.js` | `cache: true` |
| `src/views/orderManage/orderList.vue` | 壳层 name、routeGuard |
| `src/views/orderManage/order.vue` | 子组件改名 `OrderLightUpgrade` |
| `src/views/orderManage/utils/orderListRouteParams.js` | 路由参数解析 |
| `src/views/orderManage/utils/orderListRouteGuard.js` | 是否重放路由参数 |
| `src/views/orderManage/utils/orderListNavigation.js` | 统一返回导航 |
| 详情页 4 个 | 使用统一导航工具 |
## 流程
```
列表筛选/翻页 → 进详情(列表 deactivated 缓存)
→ 返回(仅关详情 Tab,push orderList)
→ 列表 activated 恢复,不触发 getList/refreshTable
```
## 手工回归清单
对**每个子 Tab**执行:
1. 设置 2+ 筛选条件 → 查询 → 翻到第 2 页
2. 进入详情 → 返回
3. 断言:筛选值、页码、表格行数据与离开前一致;Network 无新列表接口
4. 断言:一级/二级 Tab 与离开前一致
5. 主动切换二级 Tab 再切回 → 子列表应重新加载
6. 客户列表带 `customerName`/`customerPhone` 跳转 → 自动填充并查询
7. `updateRefesh` 全局刷新 → 列表仍触发刷新
8. 右键 Tab「重新加载」→ 恢复初始状态
9. 从 `orderSupplement` 进详情再返回 → 仍回补录页
## 不在范围
- `orderSupplement`、施工单、退款审核等其它页面
- `d2-table` 组件改动
- 浏览器刷新后状态保留(Phase 2 sessionStorage)
## 风险
- 详情页改单后列表可能过期:后续可用 `updateRefesh` 或 `refresh=1` query 处理
- 用户手动关闭列表 Tab 再打开:正常全新加载
# ROP 接口对接指南
本文档沉淀门店工作汇报(dailyReport)联调经验,供后续新接口快速对接复用。
## 1. 工具与模块
| 能力 | 路径 / 命令 |
|------|-------------|
| ROP 客户端(Node/脚本/集成测) | [`src/libs/rop/`](../../src/libs/rop/) |
| apiName 统一解析 | [`src/libs/rop/resolveApiName.js`](../../src/libs/rop/resolveApiName.js) |
| 签名(浏览器与 Node 共用) | [`src/libs/rop/signCore.js`](../../src/libs/rop/signCore.js) |
| Swagger 契约解析 | [`src/libs/rop/swaggerInspect.js`](../../src/libs/rop/swaggerInspect.js) |
| 契约 diff | [`src/libs/rop/contractDiff.js`](../../src/libs/rop/contractDiff.js) |
| Swagger 快照 | [`src/libs/rop/__snapshots__/smartcarlife.swagger.json`](../../src/libs/rop/__snapshots__/smartcarlife.swagger.json) |
| 脚手架 CLI | `npm run rop:swagger -- [--prefix\|--method] --out <dir> [--dry-run] [--force] [--contracts-only]` |
| 一键导入 CLI | `npm run rop:import -- --method <method> [--dry-run] [--force] [--json]` |
| 聊天导入 | [ROP_CHAT_IMPORT.md](./ROP_CHAT_IMPORT.md)(自然语言触发,读 [SKILL.md](../skills/rop-api-import/SKILL.md)) |
| 拉取快照 | `npm run rop:swagger:fetch` |
| 契约校验 | `npm run rop:contract:check` |
| 一键验证 | `npm run rop:verify` |
| 冒烟示例 | `npm run api:smoke:journal` |
| 冒烟模板 | [`scripts/rop-api-smoke.template.js`](../../scripts/rop-api-smoke.template.js) |
| Jest 测试辅助 | [`tests/helpers/ropTestClient.js`](../../tests/helpers/ropTestClient.js) |
浏览器内请求仍使用 [`src/api/request.js`](../../src/api/request.js)(内部已复用 `resolveApiName`),**不要**在 Vue 页面直接引用 `ropClient`。
---
## 2. 拉取 Swagger
**正确地址**(本项目 ROP):
```text
{host}/rop-dj-smartcarlife/swagger-rop/api-docs
```
不要使用 `/v3/api-docs`。
开发环境示例:
```text
http://dj.dev.glsx.com.cn/rop-dj-smartcarlife/swagger-rop/api-docs
```
接口路径约定:
```text
/router/{method}/1.0.0 → POST
```
### 契约更新流程
后端发版或联调前:
```bash
npm run rop:swagger:fetch
git diff src/libs/rop/__snapshots__/smartcarlife.swagger.json
npm run rop:contract:check
```
提交快照 diff,便于团队感知契约变更。
---
## 3. 读契约(ROP 特点)
1. **请求参数多为 query**,不是 JSON body(与常见 OpenAPI 不同)
2. **响应**为 `RopResponse<T>`,浏览器 axios 拦截器已解包 `data`(见 `baseConfig.axios.result`)
3. **列表**常为 `RpcPagination<T>`:`list / total / pageNum / pageSize`
4. `sessionId` 由 [`request.js`](../../src/api/request.js) 自动注入,adapter **不需要**处理
### 脚手架生成契约
省略 `--swagger` 时默认读取本地快照。
**单接口:**
```bash
npm run rop:swagger -- \
--method dj.api.smartcarlife.dailyReport.overview.page \
--feature journalRecord \
--out src/api/adapters/journalRecord \
--dry-run
```
**按前缀批量:**
```bash
npm run rop:swagger -- \
--prefix dj.api.smartcarlife.dailyReport \
--out src/api/adapters/journalRecord \
--contracts-only
```
`--contracts-only` 仅生成 `__contracts__`,不覆盖已有 adapter 实现文件。
生成物:
```text
src/api/adapters/{feature}/
build{Method}Params.js # 含 @typedef JSDoc
map{Method}Response.js
__contracts__/{method}.contract.json
__contracts__/{method}.contract.md
```
去掉 `--dry-run` 后落盘。已存在文件默认 **skip**(加 `--force` 才覆盖)。`--feature` 仅打印 mock 模板提示,不自动改已有 mock 文件;新建 mock 可加 `--mock`。
---
## 3.1 新接口 5 分钟上手
1. `npm run rop:swagger -- --prefix <prefix> --out src/api/adapters/{feature} --contracts-only --dry-run` 核对契约
2. 生成 adapter 模板或手工编写,补业务映射
3. `src/api/{feature}.js` 接入 `request` + adapter + mock
4. 复制 [`rop-api-smoke.template.js`](../../scripts/rop-api-smoke.template.js) 写冒烟脚本
5. `npm run rop:verify`(单测 + 契约校验 + 冒烟)通过后再测页面
---
## 4. Adapter 三层约定
以 [`src/api/adapters/journalRecord/`](../../src/api/adapters/journalRecord/) 为范本:
| 层级 | 命名 | 职责 |
|------|------|------|
| 请求 | `buildXxxParams(uiParams)` | 页面/表格筛选 → ROP 请求字段 |
| 行映射 | `mapXxxRow(dto)` | 单行 DTO → 表格列字段 |
| 分页 | `mapXxxPageResponse(res)` | 分页响应 → d2-table 结构 |
### UI 与 API 字段不一致
在 **adapter** 处理,例如:
- 下拉存 `staffUuid`,接口要 `staffName` → 在 `beforeSearchFn` 解析姓名后传入 `buildOverviewParams`
- `sceneType`(0 权益 / 1 轻改)→ `bizType` / `bizTypeName` → [`mapSceneType.js`](../../src/api/adapters/journalRecord/mapSceneType.js)
---
## 5. API 层(`src/api/*.js`)
```js
// 模式
export function getXxx(data) {
if (USE_MOCK) return loadMock().then(m => m.mockXxx(data));
const payload = { ...buildXxxParams(data), method: `${path}xxx.yyy` };
return request(payload, RequestMethods.POST).then(mapXxxPageResponse);
}
```
Mock 开关:`VUE_APP_{FEATURE}_MOCK=true` 时启用(参考 `VUE_APP_JOURNAL_MOCK` / `VUE_APP_ABNORMAL_FLOW_MOCK`),默认走真实接口。
---
## 6. Mock 规范
[`journalRecord.mock.js`](../../src/api/journalRecord.mock.js):
1. Mock 原始数据使用 **Swagger 字段名**(如 `sceneType`、`onBreak`、`createdDate`)
2. 必须经 **同一套 adapter** 输出,保证 Mock / 真实接口行为一致
3. 不要在 mock 里写 UI 字段名(如 `bizTypeName`),除非 adapter 不再转换
---
## 7. Node 客户端用法
```js
const { createLoggedInClient } = require("../src/libs/rop/ropClient");
async function main() {
const client = await createLoggedInClient({
userName: "glsadmin",
password: "123456",
apiName: "dj", // 可选,默认 dj
});
const data = await client.callSmartcarlife("dailyReport.overview.page", {
currentPage: 1,
pageSize: 10,
templateType: 1,
reportDate: "2026-07-16",
});
console.log(data.total, data.list?.length);
}
```
环境变量:
| 变量 | 说明 |
|------|------|
| `ROP_TEST_USER` / `ROP_TEST_PASSWORD` | 集成测试账号 |
| `ROP_SWAGGER_URL` | 拉取快照 / `--online` 校验时的 Swagger 地址 |
| `VUE_APP_CONFIG_CENTER_URL` | 配置中心;失败回退 `baseConfig.develop.json` |
| `ROP_INTEGRATION=1` | 开启集成测试(默认 skip) |
---
## 8. 联调 Checklist
- [ ] `npm run rop:swagger:fetch` 更新快照(或确认本地快照可用)
- [ ] `npm run rop:swagger -- ... --dry-run` 核对参数/响应
- [ ] 编写/补全 `src/api/adapters/{feature}/` adapters
- [ ] `src/api/*.js` 接入 request + adapter
- [ ] Mock 数据对齐 Swagger 字段
- [ ] `.env.development`:默认不开启 `VUE_APP_USE_DEVELOP_AXIOS`(配置中心成功则用返回配置);确认未设置 feature mock 开关(或 `VUE_APP_*_MOCK` 非 `true`)
- [ ] `npm run rop:contract:check` 契约基线通过
- [ ] `npm run api:smoke:journal`(或对应冒烟脚本)通过
- [ ] 浏览器登录验证页面
---
## 9. 附录:dailyReport 接口索引
| method | adapter 请求 | adapter 响应 |
|--------|-------------|--------------|
| `dailyReport.merchant.list` | (API 层补分页) | `mapMerchantList.js` |
| `dailyReport.overview.page` | `buildOverviewParams.js` | `mapOverviewRow.js` |
| `dailyReport.detail.select` | `buildDetailSelectParams` in `mapDetailResponse.js` | `mapDetailResponse.js` |
| `merchant.staff.list` | `merchantId` | `mapMerchantStaffList.js` |
契约文件见 [`__contracts__/`](../../src/api/adapters/journalRecord/__contracts__/)。
### overview.page 请求参数
`currentPage`, `pageSize`, `merchantId`, `staffName`, `reportDate`, `templateType`
### overview 列表关键响应字段
`sceneType`, `onBreak`, `createdDate`, `reportStatus`, `staffName`, `merchantName`
### detail.select
请求:`id`(必填)
响应:`jsonContent` + 基础元信息
---
## 10. 测试策略
| 类型 | 做法 |
|------|------|
| adapter 单测 | 直接 import 纯函数,传入 fixture DTO |
| API 层单测 | `jest.mock('@/api/request')`(见 [JEST_TESTING.md](../rules/JEST_TESTING.md)) |
| 契约校验 | `npm run rop:contract:check`(对比快照与 `__contracts__`) |
| 集成测 | `tests/helpers/ropTestClient.js` + `ROP_INTEGRATION=1` |
| 冒烟脚本 | `scripts/*-smoke.js` 调用 `createLoggedInClient` |
---
## 11. 复用验收清单
新 feature 接入完成后,逐项确认:
- [ ] `npm run rop:swagger -- ... --contracts-only` 生成并提交 `__contracts__`
- [ ] adapter 单测通过(至少覆盖请求映射 + 行映射)
- [ ] `npm run rop:contract:check` 通过
- [ ] `npm run api:smoke:{feature}` 或 `npm run rop:verify` exit 0
- [ ] `.env.development` 未误开 `VUE_APP_USE_DEVELOP_AXIOS=true`(除非个人本地需强制 dev 网关),未误开 feature mock(`VUE_APP_*_MOCK=true`)
- [ ] 浏览器页面可访问(需账号具备对应菜单权限)
- [ ] 脚手架未误覆盖已有 adapter(默认 skip;必要时才用 `--force`)
**一键验证命令**:
```bash
npm run rop:verify
```
包含 ROP 单测 + 契约校验 + dailyReport 冒烟,用于确认工具链本身可复用。
---
## 12. 聊天导入
在 Cursor 聊天框用自然语言导入单接口,详见 [ROP_CHAT_IMPORT.md](./ROP_CHAT_IMPORT.md)。
Agent 规程:[`/.ai/skills/rop-api-import/SKILL.md`](../skills/rop-api-import/SKILL.md)
```text
导入接口 dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve(总部运营审批流水报备)
```
流程:dry-run 预览 → 用户确认 → `rop:import` 落盘 → `rop:contract:check`。
# ROP 聊天导入
在 Cursor 聊天框用自然语言导入 ROP 接口,基于本地 Swagger 快照自动生成分层 adapter 并迁移已有 API 函数。
Agent 规程见 [/.ai/skills/rop-api-import/SKILL.md](../skills/rop-api-import/SKILL.md)。
---
## 快速开始
在 Cursor 聊天输入:
```text
导入接口 dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve(总部运营审批流水报备)
```
Agent 将:
1. 从本地 Swagger 快照解析契约(`src/libs/rop/__snapshots__/smartcarlife.swagger.json`)
2. 执行 `npm run rop:import -- ... --dry-run --json` 展示预览
3. 等你回复「确认导入」后落盘
4. 运行 `npm run rop:contract:check` 校验
等价终端命令:
```bash
# 预览
npm run rop:import -- "导入接口 dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve" --dry-run
# 落盘
npm run rop:import -- --method dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve
# 校验
npm run rop:contract:check
```
---
## 流程图
```mermaid
sequenceDiagram
participant User as 用户
participant Agent as Cursor_Agent
participant CLI as rop_import
participant Swagger as 本地快照
User->>Agent: 导入接口 dj.api...
Agent->>CLI: --dry-run --json
CLI->>Swagger: buildContract
CLI-->>Agent: 导入报告
Agent->>User: 预览 + 询问确认
User->>Agent: 确认导入
Agent->>CLI: 正式导入 --json
Agent->>CLI: rop:contract:check
Agent->>User: 汇总结果
```
---
## 与 rop:swagger 的区别
| 维度 | `rop:swagger` | `rop:import`(聊天导入) |
|------|---------------|--------------------------|
| 用途 | 批量生成契约/adapter 模板 | 单接口导入 + 迁移已有 API |
| 自然语言 | 不支持 | 支持 |
| API 文件改写 | 不处理 | 自动 migrateApiFile |
| 聊天场景 | 不适合 | **推荐** |
---
## 导入产出
```text
src/api/adapters/{feature}/
build{Method}Params.js
map{Method}Response.js
__contracts__/{method}.contract.json
__contracts__/{method}.contract.md
```
若 `src/api/*.js` 中已有引用该 method 的 `export function`,将自动迁移为 adapter 模式(函数名不变,Vue 通常无需修改)。
---
## 常见问题
### method 在 Swagger 中找不到
本地快照过旧,先更新:
```bash
npm run rop:swagger:fetch
```
### 文件显示 skipped
默认不覆盖已有契约/adapter。需要覆盖时:
```bash
npm run rop:import -- --method <method> --force
```
### 没有已有 API 函数
`rop:import` 不会自动新建 `export function`,需在 `src/api/*.js` 手工补充,模式见 [ROP_API_INTEGRATION.md](./ROP_API_INTEGRATION.md) §5。
### Mock 未自动迁移
目前仅 `abnormalFlow.mock.js` 支持自动迁移,其他 feature 需手工改 mock。
---
## 验收 checklist
- [ ] 聊天输入 method,Agent 先 dry-run 不写文件
- [ ] 确认后落盘,`rop-import.report.json` 生成
- [ ] `npm run rop:contract:check` 通过
- [ ] Swagger 缺失时提示 `rop:swagger:fetch`
File mode changed
File mode changed
##
### 仅给自动化流程时使用
请根据 git diff 为此处改动编写单元测试代码。
## 要求:
1. 严格遵循 /.ai/rules/JEST_TESTING.md 和 /.ai/rules/TESTING_GUIDE.md 中的规范
2. 使用 Jest 测试框架,遵循 AAA 模式(Arrange-Act-Assert)
3. 测试文件命名:*.spec.js,存放在与被测文件同级目录
## Mock 规范(必须遵守):
- 在测试文件顶部按顺序执行:定义 mock 函数 → jest.mock() → require() 导入被测试模块
- 每次测试前使用 jest.clearAllMocks() 重置 mock
- 组件测试在 afterEach 中调用 wrapper.destroy()
## 输出格式:
1. 📂 测试文件路径:[完整路径]
2. 📝 测试代码:[完整的测试代码,可直接运行]
## API规范
调用接口时:
* 优先复用现有 API
* 使用项目已有 axios 封装
* 保持统一错误处理
* 新接口对接流程、Swagger 脚手架、adapter 约定见 [ROP 接口对接指南](../docs/ROP_API_INTEGRATION.md)
不要直接创建新的请求框架。Node/脚本/集成测试使用 `src/libs/rop/`,浏览器仍走 `src/api/request.js`。
## 调试规范
发现问题时:
### 第一步
阅读相关代码:
* 页面
* API
* Vuex
* Router
先理解逻辑再修改。
---
### 第二步
定位问题原因。
不要通过不断试错碰运气修复问题。
---
### 第三步
如果连续两次修改仍未解决:
必须进入系统化分析模式:
1. 分析可能根因
2. 提出验证方案
3. 给出至少3种解决方案
4. 分析优缺点
5. 推荐最终方案
# ESLint 代码格式规范
生成或修改代码时**必须**符合项目 [`eslint.config.js`](../../eslint.config.js)(基于 `@antfu/eslint-config`),不得依赖用户手动 fix。
## 核心规则
| 类别 | 规则 | 要求 |
|------|------|------|
| JS 基础 | `stylistic/quotes` | 双引号 `"` |
| JS 基础 | `stylistic/semi` | 语句末尾分号 |
| JS 基础 | `array-bracket-spacing` | `[ "a", "b" ]` 括号内空格 |
| JS 基础 | `curly` | `if/for` 等必须写 `{}` |
| JS 基础 | `style/brace-style` | 1tbs(`else` 与 `}` 同行) |
| JS 缩进 | `stylistic/indent` | **Tab** 缩进(script / style 段) |
| Vue 结构 | `vue/block-order` | `template` → `script` → `style` |
| Vue 模板 | `vue/html-indent` | 2 空格缩进 |
| Vue 模板 | `vue/max-attributes-per-line` | 多行标签每行 1 个属性;单行最多 2 个 |
| Vue 模板 | `vue/attributes-order` | 指令 / 绑定 / 静态属性 / 事件 固定顺序 |
| Vue 模板 | `vue/first-attribute-linebreak` | 多行标签时,首属性紧跟标签名 |
| Vue 模板 | `vue/html-closing-bracket-newline` | 闭合括号不换行 |
| Vue 模板 | `vue/multiline-html-element-content-newline` | 多行元素内容前后换行 |
## Vue 属性顺序(速记)
```text
v-for / v-if / v-show → ref / key → v-model → v-xxx → id / class / style → :prop → @event
```
同组内按字母序(`vue/attributes-order` 的 `alphabetical: true`)。
## 模板示例
```vue
<!-- 正确:首属性同行,v-if 在 class 前,多行每行一个属性 -->
<div v-if="visible"
class="section-block">
<!-- 错误:v-if 在 class 后、同一行两个属性 -->
<div class="section-block" v-if="visible">
<!-- 正确:多行文本元素内容换行 -->
<div class="section-title">
区域经理审批
</div>
<!-- 正确:与同模块一致,组件非自闭合 -->
<detailComp
:config-data="flowInfoConfig"
:detail-info="detailInfo"
label-width="120px"
></detailComp>
```
## 与同目录文件对齐
- 新增 `.vue` 前先阅读同目录已有文件(如 `index.vue`、`detail.vue`)
- 模板段 2 空格;script / style 段 Tab
- 组件标签写法与同模块保持一致(如 `detailComp` 用 `></detailComp>`)
- import 顺序:上级目录模块先于同级模块(`../constants/...` 先于 `./detailComp.vue`)
## 完成前自检
1. 对照同目录 `.vue` 文件的写法
2. 多行标签不超过 1 属性/行
3. 条件指令(`v-if` / `v-loading`)写在静态 `class` 之前
4. 字符串双引号、数组括号内加空格、语句加分号
5. `if` 单行返回也写 `{}`
6. 不引入未使用的 import
7. 修改完成后对 touched files 执行 linter 检查,消除 ESLint 诊断
## 参考文件
- 配置:[`eslint.config.js`](../../eslint.config.js)
- 抽屉示例:[`src/views/financeManage/components/TmplDrawer.vue`](../../src/views/financeManage/components/TmplDrawer.vue)
- 详情页示例:[`src/views/financeManage/exceptionOrderManage/detail.vue`](../../src/views/financeManage/exceptionOrderManage/detail.vue)
## 表单规范
新增业务表单优先使用:
```text
glsx-combi-form
```
适用场景:
* 新增页面
* 编辑页面
* 弹窗表单
仅在无法满足需求时使用:
```text
el-form
```
并说明原因。
# Git Commit Message 规范
生成 commit message 时必须遵循 **Conventional Commits 规范**。
* 使用中文输出 commit message
# Jest 单元测试实战指南
## 适用场景
本规范适用于 Vue 2 + Jest 项目的单元测试编写,特别是处理复杂依赖链的模块。
---
## 一、核心 Mock 模式(必须遵守)
### 1. 测试文件标准模板
```javascript
/**
* 测试文件头部 - 按顺序执行
*/
// 第 1 步:定义 mock 函数
const mockRequest = jest.fn();
const mockRequestMethods = { POST: 'POST', GET: 'GET' };
// 第 2 步:在导入被测试模块前,用 jest.mock() 提前 mock 所有依赖
jest.mock('@/api/request', () => mockRequest);
jest.mock('@/api/request.methods', () => mockRequestMethods);
// Mock API 模块(如需)
const mockXxxApi = jest.fn();
jest.mock('@/path/to/api', () => ({
xxxApi: mockXxxApi,
}));
// 第 3 步:mock 之后才用 require() 导入被测试模块
const { func1, func2 } = require('./xxx.js');
// 第 4 步:开始编写测试
describe('xxx 测试', () => {
beforeEach(() => {
jest.clearAllMocks(); // 每次测试前重置 mock
});
it('应该...', () => {
// Arrange
mockXxxApi.mockResolvedValue(expectedData);
// Act
const result = await func1();
// Assert
expect(result).toEqual(expectedData);
});
});
```
### 2. 为什么用 require() 而不是 import?
`jest.mock()` 是 hoisted 的,但 ES Module 的 `import` 也是 hoisted 的,这会导致依赖在 mock 之前就被加载。使用 `require()` 可以确保在 mock 之后才加载模块。
---
## 二、Jest 配置清单
### jest.config.js 必要配置
```javascript
module.exports = {
moduleFileExtensions: ['js', 'jsx', 'json', 'vue'],
transform: {
'^.+\\.vue$': '@vue/vue2-jest',
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\\.jsx?$': 'babel-jest',
},
transformIgnorePatterns: [
'node_modules/(?!(lodash-es|nanoid|flex.css|dayjs)/)',
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'\\.css$': 'jest-transform-stub',
'^@/plugin/d2admin/(.*)$': '<rootDir>/jest.mocks/d2admin.js',
'^@/assets/svg-icons/index.js$': '<rootDir>/jest.mocks/svg-icons-index.js',
'^@/assets/svg-icons$': '<rootDir>/jest.mocks/svg-icons-index.js',
'^@/api/request$': '<rootDir>/jest.mocks/request.js',
'^@/main$': '<rootDir>/jest.mocks/main.js',
'^@/main.js$': '<rootDir>/jest.mocks/main.js',
},
testURL: 'http://localhost/',
testEnvironment: 'jsdom',
setupFiles: ['<rootDir>/jest.setup.js'],
};
```
### jest.setup.js 必要配置
```javascript
// 初始化 dayjs(避免 locale 插件加载失败)
const dayjs = require('dayjs');
dayjs.locale('en');
// mock require.context (Webpack 特有,Jest 不支持)
if (!global.require.context) {
global.require.context = (() => {
return { keys: () => [] };
});
}
```
---
## 三、常见依赖链问题
### 问题场景
当被测试模块有以下依赖链时:
```
table.data.js
→ api/index.js
→ @/api/request
→ @/main
→ @/plugin/d2admin
→ @/assets/svg-icons
```
### 解决方案
1. 在 `jest.config.js` 的 `moduleNameMapper` 中映射所有可能缺失的依赖
2. 在测试文件顶部用 `jest.mock()` 提前 mock 关键依赖
3. 使用 `require()` 在 mock 之后导入被测试模块
---
## 四、陷阱与解决方案
| 问题 | 错误信息 | 解决方案 |
|------|----------|----------|
| require.context 未定义 | `require.context is not a function` | 在 `jest.setup.js` 中全局 mock |
| dayjs locale 失败 | `_.locale is not a function` | 在 `jest.setup.js` 中初始化 dayjs |
| CSS 文件无法解析 | `SyntaxError: Unexpected token '{'` | `moduleNameMapper` 映射到 `jest-transform-stub` |
| 测试断言字符不匹配 | `"张三,李四" vs "张三,李四"` | 断言必须与源代码字符**完全一致**(注意中英文标点) |
| 函数参数类型错误 | 返回 `undefined` | 检查函数接收的是对象还是原始值 |
| 依赖链断裂 | `Cannot find module '@/xxx'` | 完整 mock 体系 + `moduleNameMapper` |
### 字符匹配特别注意
源代码使用英文逗号 `,`,测试断言不能用中文逗号 `,`:
```javascript
// 源代码
.join(',') // 英文逗号
// 错误
expect(result).toBe('张三,李四'); // 中文逗号
// 正确
expect(result).toBe('张三,李四'); // 英文逗号
```
---
## 五、Mock 文件模板
### jest.mocks/request.js
```javascript
// Mock @/api/request
module.exports = jest.fn();
```
### jest.mocks/main.js
```javascript
// Mock @/main
module.exports = {
baseConfig: {},
};
```
### jest.mocks/d2admin.js
```javascript
// Mock @/plugin/d2admin
module.exports = {};
```
### jest.mocks/svg-icons-index.js
```javascript
// Mock @/assets/svg-icons/index.js
module.exports = {};
```
---
## 六、测试文件结构
### 单元测试 (`*.spec.js`)
- 存放位置:与被测文件**同一目录**
- 测试原则:只关注单一组件/函数的隔离逻辑
- 使用 `jest.mock()` 隔离外部依赖
### 集成测试 (`*.integration.spec.js`)
- 存放位置:**Feature 根目录**
- 测试原则:测试多个模块之间的联动
- 验证常量、API、数据层之间的数据流一致性
---
## 七、测试命令
```bash
# 运行单个模块的测试
npm run test:unit -- 路径/到/模块
# 运行所有测试
npm run test:unit
# 监听模式(文件改动自动重跑)
npm run test:unit -- --watch
```
---
## 八、AAA 模式示例
```javascript
describe('getTableFormSchema', () => {
it('应该返回一个数组', async () => {
// Arrange - 准备数据
mockGetTaskCenterBizCategoryListApi.mockResolvedValue([]);
// Act - 执行操作
const schema = await getTableFormSchema();
// Assert - 断言结果
expect(Array.isArray(schema)).toBe(true);
});
});
```
---
## 九、内存泄露防护
```javascript
// 组件测试必须在 afterEach 中销毁实例
afterEach(() => {
wrapper.destroy();
jest.clearAllMocks();
});
```
---
## 十、异步处理
```javascript
// 事件触发后影响 DOM 的情况,必须等待 nextTick
await wrapper.vm.$nextTick();
await localVue.nextTick();
```
---
## 快速检查清单
创建新测试文件前检查:
- [ ] 已在测试文件顶部定义 mock 函数
- [ ] 已用 `jest.mock()` 提前 mock 所有依赖
- [ ] 已用 `require()` 导入被测试模块
- [ ] `jest.config.js` 已配置 `moduleNameMapper`
- [ ] `jest.setup.js` 已配置全局 mock
- [ ] 测试断言的字符与源代码完全一致
- [ ] `afterEach` 中调用了 `wrapper.destroy()`(组件测试)
- [ ] 异步操作使用了 `nextTick()`
# Language
默认使用 **简体中文** 输出,包括:
- Git commit message
- Pull Request 描述
- 代码解释
- 技术说明
只有在代码注释或特殊要求时才使用英文。
## AI协作规范
与用户沟通时:
* 使用中文
* 简洁清晰
* 面向业务结果
避免:
* 堆砌术语
* 长篇理论分析
* 无关架构讨论
解释问题时:
向“不懂代码但逻辑清晰的人”解释。
## 本地开发规范
常用命令:
```bash
npm run dev
npm run start
npm run lint
npm run test:unit
```
AI 修改代码后,应对 touched files 消除 ESLint 诊断(IDE linter 或 `npm run lint`),避免提交前才暴露格式问题。格式细则见 [ESLINT.md](./ESLINT.md)。
### 开发性能与主题预研
详见 [`.ai/docs/DEV_PERF_AND_THEME_RESEARCH.md`](../docs/DEV_PERF_AND_THEME_RESEARCH.md)(`npm run serve` 慢/OOM、懒加载开关、Element 主题静态化等方案的预研与后续落地顺序)。
默认不要执行:
```bash
npm run build
```
仅在:
* 用户明确要求
* 排查构建问题
时执行。
## 路由规范
遵循现有:
```text
router/modules
```
结构。
权限控制与动态路由逻辑保持一致。
不要创建第二套路由体系。
## 状态管理
使用:
```text
Vuex Modules
```
保持与现有 store 结构一致。
不要新增 Pinia。
# dj-car-life-system 项目测试指南
## 测试命令
```bash
# 单元测试
npm run test:unit -- tests/unit/xxx.spec.js
# E2E 测试 (需先安装 Playwright)
npm install -D @playwright/test
npx playwright install
npx playwright test tests/e2e/xxx.spec.js
```
---
# 核心规范(必须严格遵守)
## 1. 测试分类与文件存放规范
* 【单元测试 (Unit Test)】
- 命名格式:`*.spec.js`
- 存放位置:必须与被测文件在【同一级目录】(就近原则)。如果是组件,和 `.vue` 放在一起;如果是纯函数或 Vuex 逻辑,和原文件放在一起。
- 测试原则:只关注单一组件/函数的隔离逻辑。使用 `shallowMount` 挂载组件,隔离子组件。
* 【集成测试 (Integration Test)】
- 命名格式:`*.integration.spec.js`
- 存放位置:必须存放在该功能的【Feature 根目录下】(如 `src/features/shopping-cart/ShoppingCart.integration.spec.js`)。
- 测试原则:测试多个组件、子组件与当前 Feature 专属 Vuex Module 的联动。使用 `mount` 进行完整挂载,需要 mock 网络请求(如 msw 或 jest.mock)。
* 【E2E 测试 (End-to-End Test)】
- 命名格式:`*.e2e.js`
- 存放位置:必须独立于 src,统一存放在项目根目录的【`/e2e`】文件夹下。
- 测试原则:站在真实用户视角测试完整业务流,不涉及任何 Vue 内部实现细节。
## 2. 测试编写原则
**重要:如果单元测试暴露出来业务代码的问题,不要修改业务代码,只修复测试代码。**
业务代码的逻辑应该由业务需求驱动,而不是为了通过测试而修改。
## 3. Vue 2 测试代码编写守则
* 【内存泄露防护】:在单测和集成测试的 `afterEach` 钩子中,必须调用 `wrapper.destroy()` 销毁实例。
* 【异步处理】:遇到事件触发、数据改变后影响 DOM 的情况,必须使用 `await localVue.nextTick()` 或 `await wrapper.vm.$nextTick()`。
* 【Vuex 注入】:如果组件依赖 Vuex,必须使用 `createLocalVue()` 并注入对应的局部 store module,禁止直接污染全局 store。
* 【测试用例结构】:遵循 AAA 模式(Arrange 准备数据,Act 执行操作,Assert 断言结果)。描述性文字(`describe`, `it`)要清晰表达业务意图。
## 4. E2E 测试编写指南
### 测试场景设计
- 从真实用户视角出发,测试完整业务流程
- 覆盖主要功能路径和常见边缘情况
- 验证页面导航、数据展示、表单交互等
### 最佳实践
- 使用 `test.beforeEach` 进行登录等前置操作
- 使用 `page.waitForLoadState('networkidle')` 等待异步请求完成
- 使用有意义的测试用例名称,描述业务意图
- 截图和录屏仅在失败时保存(已在配置中设置)
### 文件命名
- 格式:`*.e2e.js`
- 示例:`e2e/taskCenter.e2e.js`
---
# 你的下一步输出
请根据我接下来提供给你的代码,输出以下内容:
1. 💡 这是一个 [单元测试 / 集成测试 / E2E 测试]。
2. 📂 推荐的文件存放路径是:`[具体路径/文件名]`
3. 📝 测试代码:[具体的测试代码]
## 已修改的配置文件
- `jest.config.js` - 添加了 transformIgnorePatterns
- `package.json` - 修复了 test:unit 脚本,添加了 test:unit:legacy
- `playwright.config.js` - 新增 E2E 测试配置
---
## 5. E2E 登录态处理(重要)
### 问题背景
本项目(D2Admin + Vuex)的登录态判断依赖 **Vuex 内存状态**(`store.state.d2admin.user.info`),
而非仅 Cookie/Token。路由守卫逻辑:
```
store.state.d2admin.user.info 存在 → 放行
store.state.d2admin.user.info 为空 → 跳转 /login
```
Playwright 的 `storageState` 只能持久化 **Cookie + localStorage**,无法保存 Vuex 内存,
因此每个新 browser context 都会丢失登录态,无法通过 `storageState` 跨 context 保持登录。
### 解决方案:共享 context
**不动业务代码**,在 `beforeAll` 中创建 context 并登录一次,同一个 describe 内的
所有 test 复用同一个 `sharedPage`,Vuex 内存态自然保持。
```js
let sharedPage;
test.beforeAll(async ({ browser }) => {
const context = await browser.newContext();
sharedPage = await context.newPage();
await sharedPage.goto("/#/login");
await sharedPage.getByPlaceholder("账户").fill("xxx");
await sharedPage.getByPlaceholder("密码").fill("xxx");
await sharedPage.getByRole("button", { name: "登录" }).click();
await sharedPage.waitForURL(/#\/index/);
});
test("用例1", async () => {
await sharedPage.goto("/#/target-page"); // 复用已登录的 page
});
test.afterAll(async () => {
await sharedPage.context().close();
});
```
### 注意事项
1. **不使用 Playwright 默认的 `page` fixture**,改用闭包变量 `sharedPage`
2. **每个 test 开头做 `goto`** 导航到目标页面,用 URL 导航来隔离 test 间状态
3. **afterAll 关闭 context**,避免资源泄漏
4. URL 提取为常量(如 `BASE_URL`),方便切换测试环境
---
## 6. 旧后台项目 E2E 稳定性经验
适用于本项目这类 `Vue2 + Element UI + D2Admin` 的后台页面。
### 页面就绪判断
不要只等待路由切换完成,也不要只依赖固定 `waitForTimeout`。
推荐组合:
1. 等关键接口返回
2. 等页面核心容器可见
3. 等表单控件或表格真实渲染完成
例如新增/编辑页如果依赖元数据接口,必须先等真实接口返回,再继续执行后续步骤。
### 选择器策略
#### 1. 表格操作列
Element UI 表格和 D2Admin 表格可能存在 fixed 列副本、隐藏节点、slot 包装节点。
因此:
- 不要默认认为 `getByRole()` 一定稳定
- 优先在“当前行的操作列作用域”内定位
- 优先点击真实可见的 `button`
- 如果组件渲染结构复杂,可在受控范围内做 DOM fallback
#### 2. 弹窗套弹窗
不要只靠“包含某段文本”来区分外层弹窗和内层弹窗。
推荐组合:
1. 先记录当前可见弹窗数量
2. 点击后等待可见弹窗数量增加
3. 用二级弹窗专属根节点或专属内容区定位
如果详情弹窗有独立根 class,应优先以该 class 作为锚点。
#### 3. 文本定位
在旧项目里,按钮和表格操作列经常是复杂 slot 渲染,文本选择器通常比过度依赖语义角色更稳定。
但前提是:
- 文案必须以真实页面为准
- 不要只照测试用例文档写死文案
- 文案更新后要同步维护测试
### 断言策略
- 优先断言稳定的内容区、根容器、业务字段
- 少依赖容易变化的局部 DOM 结构
- 如果标题节点不稳定,可以断言整个弹窗包含标题文本和专属内容区同时存在
### 调试顺序
推荐顺序:
1. 先定向跑失败用例
2. 再看失败截图和 trace
3. 根据真实 DOM 和真实文案修正选择器
4. 最后全量回归
不要在定位未收敛时反复全量跑整个文件。
### 真实环境约束
- E2E 默认优先走真实接口和真实链路
- 如果页面依赖真实环境数据,测试里要显式写明依赖项
- 对固定数据依赖要用常量集中管理,方便替换和排查
例如:
```js
const RECORD_DETAIL_STRATEGY_NAME = "测试发送策略";
```
### 实操原则
- 先保证流程稳定,再考虑写法优雅
- 先最小改动,再逐步增强健壮性
- 每次修复后先做定向验证,再做整文件回归
## UI规范
### UI框架
统一使用:
* Element UI
* D2Admin
新增页面需要保持:
* 间距一致
* 表单风格一致
* 表格风格一致
* 弹窗风格一致
不要引入新的大型UI框架。
---
name: rop-api-import
description: >-
从 Cursor 聊天导入 ROP 接口。当用户说「导入接口」「对接接口」「ROP 导入」或消息含
dj.api.smartcarlife.* 时使用。基于本地 Swagger 快照执行 npm run rop:import,
先 dry-run 预览,用户确认后再落盘。
---
# ROP 聊天导入
详细说明见 [ROP_CHAT_IMPORT.md](../../docs/ROP_CHAT_IMPORT.md)。
## 触发条件
满足**任一**即执行本 skill:
| 类型 | 模式 |
|------|------|
| 动词 | `导入接口`、`对接接口`、`ROP 导入`、`swagger 导入` |
| method | 文本含 `dj.api.smartcarlife.` |
| 组合 | `导入` + `dj.api.*` |
**不触发:** 仅讨论字段、仅问接口用法、无导入意图。
## 工作流(必须按顺序)
### 1. 解析 method
从用户原文提取 `dj.api.smartcarlife.*`。用户若指定 `--api` / `--feature`,保留给 CLI。
### 2. dry-run 预览(不落盘)
```bash
npm run rop:import -- "<用户原文或 method>" --dry-run --json
```
解析 stdout JSON,按下方模板回复用户。
### 3. 等待确认
仅当用户明确回复「确认导入」「落盘」「继续」后进入步骤 4。
用户回复「取消」则结束,不执行落盘。
用户明确说「跳过预览直接导入」时,可跳过 dry-run,但仍需告知将写入哪些文件。
### 4. 正式落盘
```bash
npm run rop:import -- --method <method> --json
```
若用户要求覆盖已有文件,加 `--force` 并二次确认。
### 5. 契约校验
```bash
npm run rop:contract:check
```
将结果汇总给用户。
## dry-run 回复模板
```markdown
## ROP 接口导入预览
| 项 | 值 |
|----|-----|
| 接口 | `<method>` |
| 说明 | <summary> |
| Feature | <feature> |
| API 文件 | <apiFile> |
| 已有函数 | <existingFunction 或「无,需手工补 export」> |
**请求参数:** <name* 表示必填,逗号分隔>
**响应:** <responseRoot> <pagination 时标注 (pagination)>
**文件计划:**
- <status>: <path>(逐项列出 files 数组)
数据源:本地 Swagger 快照 `src/libs/rop/__snapshots__/smartcarlife.swagger.json`
确认后我将执行落盘并运行 `npm run rop:contract:check`。回复「确认导入」继续,或「取消」放弃。
```
## 落盘完成回复模板
```markdown
## 导入完成
- 文件变更:(按 files 数组列出 status + path)
- 契约校验:<通过 / 失败及原因>
**后续建议:**
1. 检查 adapter 内字段映射是否符合页面需求
2. 关闭 feature mock 后浏览器验证页面
```
## 错误处理
| 错误 | Agent 动作 |
|------|-----------|
| 未找到 method | 请用户提供完整 `dj.api.smartcarlife.*` |
| Swagger 中未找到 method | 建议 `npm run rop:swagger:fetch` 后重试 dry-run |
| 仅支持 dj.api.smartcarlife.* | 检查 method 拼写 |
| files 多为 skipped | 说明默认不覆盖;覆盖需 `--force` |
| rop:contract:check 失败 | 展示失败信息,建议检查契约 diff |
| 无 existingFunction | 提示在 `src/api/*.js` 手工补 export,参考 [ROP_API_INTEGRATION.md](../../docs/ROP_API_INTEGRATION.md) §5 |
## 禁止事项
- 不要手写 adapter 替代 CLI(CLI 失败且用户明确要求手工补除外)
- 不要在 Vue 页面引用 `ropClient`
- 不要未经确认直接落盘(用户明确跳过预览除外)
- 不要误用 `rop:swagger`;聊天导入默认走 `rop:import`
- 不要修改 `src/libs/rop/__snapshots__/` 快照内容
## 能力边界
- Mock 迁移目前仅支持 `abnormalFlow.mock.js`
- 无已有 API 函数时不自动新建 `export function`
- 默认不覆盖已有 adapter/契约文件
> 1%
last 2 versions
not ie <= 8
[mcp_servers.codegraph]
command = "codegraph"
args = [
"serve",
"--mcp",
]
root = true
[*]
charset = utf-8
indent_style = tab
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{yml,yaml}]
indent_style = space
indent_size = 2
# 所有环境默认
VUE_APP_CONFIG_CENTER_URL=https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config
# 页面 title 前缀
VUE_APP_TITLE=D+
# 静态资源基础路径
VUE_APP_PUBLIC_PATH = '/dj-carlife-web/'
# cdn图片加速地址
VUE_APP_PUBLIC_IMGPATH = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/web/'
# 仓库地址
VUE_APP_REPO = 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
# 国际化配置
VUE_APP_I18N_LOCALE=zh-chs
VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_ELEMENT_COLOR=#409EFF
VUE_APP_STORAGE_PREFIX=d+
# 开发环境
# 网络请求开发地址
# VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
VUE_APP_REPO=http://192.168.3.171:7300/mock/5be17454f31545347559d499/config
VUE_APP_SIMPLE_PERMISSION_BYPASS=true
# 配置中心地址继承 .env 中的 VUE_APP_CONFIG_CENTER_URL(config-center-backend)
# 配置中心成功时直接使用返回的环境配置(测试/正式);不可用时回退 baseConfig.develop.json
# 若需强制本地 dev 网关,在 .env.development.local 设 VUE_APP_USE_DEVELOP_AXIOS=true
# 门店工作汇报:默认走真实 dailyReport 接口;本地需 Mock 时设 VUE_APP_JOURNAL_MOCK=true
# No Mock 构建
# 指定构建模式
NODE_ENV=production
# 标记当前是 No Mock 构建
VUE_APP_BUILD_MODE=nomock
.DS_Store
node_modules
/dist
/.history
/cache
/copyDirTarget
/.webpack-cache
.cursorrules
.cursor
.trae
.claude
.github
.vscode/changelists.json
.sentryclirc
# 本地环境文件不上传
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
# AI Local
.ai/settings.local.json
.cursor-swagger-ui.html
.cursor/
.claude/settings.local.json
.roo/
.copilot/
.windsurf/
/.codegraph/
# test
/playwright/
/testCase/
# ROP import runtime report
rop-import.report.json
# 默认所有文件
# CI 配置
.eslint-config.js @shijie @qianduan01 @chenwq @huyue @limin
.editorconfig @shijie @qianduan01 @chenwq @huyue @limin
## Ai Action
- [x] 单元测试
- [ ] E2E2测试
## 变更内容
-
## 测试情况
-
## 风险评估
-
## Checklist
- [ ] 已自测
- [ ] 已更新文档
- [ ] 已通知相关人员
{
"mcpServers": {
"codegraph": {
"type": "stdio",
"command": "codegraph",
"args": [
"serve",
"--mcp"
]
}
}
}
legacy-peer-deps=true
{
"recommendations": [
"dbaeumer.vscode-eslint",
"stylelint.vscode-stylelint",
"dbaeumer.vscode-eslint",
"Vue.volar"
]
}
\ No newline at end of file \ No newline at end of file
{
"eslint.enable": true,
"eslint.format.enable": true,
"prettier.enable": false,
"i18n-ally.localesPaths": [
"src/locales"
],
"cSpell.words": [
"Cascader",
"glsx",
"vuex"
],
"workbench.tree.indent": 24,
"explorer.compactFolders": false,
"scm.compactFolders": false,
"problems.decorations.enabled": false,
// Vue - Official:仅保留高亮/补全/跳转,关闭内置格式化
"vue.format.script.enabled": false,
"vue.format.template.enabled": false,
"vue.format.style.enabled": false,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true,
"search.exclude": {
"**/coverage": true,
"**/dist": true,
"**/.git": true,
"**/node_modules": true
},
"search.useIgnoreFiles": true,
"search.useGlobalIgnoreFiles": true,
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
// JavaScript React
"[javascriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
// TypeScript
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
// TypeScript React
"[typescriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
// Vue:格式化走 ESLint,不走 Vue - Official
"[vue]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true
},
// JSON
"[json]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
// JSONC(带注释的配置文件)
"[jsonc]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
// HTML
"[html]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
// CSS / SCSS
"[css]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[scss]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[less]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
// Markdown
"[markdown]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"editor.autoIndent": "full",
"editor.codeActionsOnSave": {
// "source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit"
},
"editor.pasteAs.preferences": [
"text",
"text.updateImports.jsts"
],
"explorer.decorations.colors": false,
"eslint.validate": [
"astro",
"css",
"gql",
"graphql",
"html",
"javascript",
"javascriptreact",
"json",
"jsonc",
"less",
"markdown",
"mjs",
"pcss",
"postcss",
"scss",
"svelte",
"toml",
"vue",
"xml",
"yaml"
],
// 优先使用 @/ 别名路径
"javascript.preferences.importModuleSpecifier": "non-relative",
// 确保这个是 true
"javascript.suggest.autoImports": true,
"vue.updateImportsOnFileMove.enabled": true,
"i18n-ally.sourceLanguage": "zh-chs",
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"*.js": "$(capture).spec.js, $(capture).test.js",
".env": ".env.*, .env.nomock, .env.local, .env.development, .env.production, .env.test, .env.staging",
"eslint.config.js": ".editorconfig"
}
}
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "dev",
"problemMatcher": [],
"label": "npm: dev",
"detail": "set NODE_OPTIONS=--openssl-legacy-provider && npm run serve"
}
]
}
\ No newline at end of file \ No newline at end of file
{
"Vue 2 Component": {
"prefix": "vue2",
"body": [
"<template>",
" <div class=\"$1\">",
" $0",
" </div>",
"</template>",
"",
"<script>",
"export default {",
" name: '$2',",
" data() {",
" return {",
" $3",
" };",
" },",
" props: {",
" $4",
" },",
" computed: {",
" $5",
" },",
" methods: {",
" $6",
" },",
" mounted() {",
" $7",
" }",
"};",
"</script>",
"",
"<style scoped lang=\"scss\">",
"$8",
"</style>"
],
"description": "Vue 2 单文件组件模板"
},
"Vuex Store Template (Vue2)": {
"prefix": "vuexstore2",
"body": [
"export default {",
" state: {",
" ${1:count}: ${2:0},",
" },",
" getters: {",
" ${3:get${1/(.*)/${1:/capitalize}/}}: state => state.${1},",
" },",
" mutations: {",
" set${1/(.*)/${1:/capitalize}/}(state, payload) {",
" state.${1} = payload;",
" },",
" increment${1/(.*)/${1:/capitalize}/}(state, payload = 1) {",
" state.${1} += payload;",
" }",
" },",
" actions: {",
" ${4:increment${1/(.*)/${1:/capitalize}/}Async}({ commit }, payload) {",
" setTimeout(() => {",
" commit('increment${1/(.*)/${1:/capitalize}/}', payload);",
" }, 1000);",
" }",
" },",
"};"
],
"description": "Vue 2 + Vuex 3 的 store 模板"
}
}
# AGENTS.md
# 项目AI规范
请优先阅读:
- /.ai/rules/ 目录下的文件
- /.ai/rules/ESLINT.md(代码格式,生成代码必遵)
- ROP 聊天导入:/.ai/skills/rop-api-import/SKILL.md、/.ai/docs/ROP_CHAT_IMPORT.md
- 开发性能 / Element 主题预研:/.ai/docs/DEV_PERF_AND_THEME_RESEARCH.md
## 项目概述
### 项目名称
dj-car-life-system(嘀加智享车生活后台管理系统)
### 项目类型
企业级 Web 管理后台 SPA。
注意:
* 不是微信小程序
* 不是 H5 活动页
* 不是 React / Next.js 项目
* 不要按小程序架构设计功能
---
## 技术栈
### 核心框架
* Vue 2.6
* Vue Router 3
* Vuex 3
* Element UI 2
* D2Admin
### 构建工具
* Vue CLI 5
* Webpack 5
### 网络请求
* axios
* 项目已有封装
### 语言
* JavaScript
除非用户明确要求,否则不要:
* 升级 Vue3
* 引入 Pinia
* 使用 Composition API
* 使用 script setup
* 大规模 TypeScript 改造
---
## 项目结构
```text
src/
├── api/
├── views/
├── components/
├── router/modules/
├── store/modules/
├── plugin/d2admin/
├── common/
└── libs/
```
新增功能时优先遵循现有目录结构。
不要创建重复能力的目录和工具。
---
## 编码原则
### 优先遵循现有代码风格
修改代码时:
* 先阅读相关模块
* 保持现有命名风格
* 保持现有文件组织方式
* 保持现有组件拆分方式
不要为了追求“最佳实践”而大规模重构。
---
### 实现原则
优先级:
```text
正确
↓
简单
↓
可维护
↓
性能优化
```
优先选择:
* 最简单方案
* 最小改动方案
* 与现有系统一致方案
---
### 组件开发
默认使用:
```js
export default {};
```
即:
* Vue2 Options API
* 单文件组件(SFC)
不要默认使用:
* Composition API
* script setup
---
## 代码格式(ESLint)
生成或修改代码**必须**符合 [`eslint.config.js`](eslint.config.js),细则见 [`.ai/rules/ESLINT.md`](.ai/rules/ESLINT.md)。
* 不得依赖用户手动 fix;写代码时按 ESLINT.md 执行
* 修改完成后对 touched files 检查 linter,消除 ESLint 诊断
* 若与同目录旧文件缩进不一致,以 ESLint 规则 + 同模块现有文件为准
---
## 错误处理
用户操作失败时:
* 给出明确提示
* 保持与项目现有 Message 风格一致
不要静默失败。
## 测试规范
修改完成后优先:
* 检查代码逻辑
* 检查运行结果
* 检查控制台报错
能够验证的内容先验证。
不要直接宣布完成。
## 输出要求
完成任务后优先说明:
1. 做了什么
2. 为什么这么做
3. 风险点是什么
然后再补充可选优化建议。
不要把优化建议当成必须任务。
# 嘀加智享车生活后台 http://192.168.3.233:8090/saas_plus/dj-car-life-system
## node 版本
14.21.3
## 包管理工具
npm 6.14.8
## AI 相关
* 项目忽略所有AI相关文件. 不要提交如 CLAUDE.md 等文件.
* 项目提供统一目录, 个人使用什么 AI 自己配置读取.ai/下的文件
* 如果有补充,可以在.ai下对应目录补充.
* 如果你的AI工具不支持自定义目录, 请将 .ai 目录下的文件复制到你对应的目录下去, 以节省你的token
# 测试环境
## url
* http://frontend.test.glsx.com.cn/dj-carlife-web/#/login
## account
* glsadmin
## password
* admin123
# 生产环境
## url
* http://dj.glsx.com.cn/dj-carlife-web/#/login
## account
* liushiquan1
## password
* liushiq123
开发环境 glsadmin 123456
预发布账号: yfbyyb a123456
测试环境账号 15816539335 a123456(超管)
aa123456 aa123456 (园区店)
bb123456 bb123456 (服务商)
module.exports = {
plugins: [
'@babel/plugin-proposal-nullish-coalescing-operator', // 双问号
'@babel/plugin-proposal-optional-chaining' // 可选链
// '@babel/plugin-proposal-optional-chaining', // 可选链 ?.
// '@babel/plugin-proposal-nullish-coalescing-operator' // 空值合并 ??
],
presets: ['@vue/cli-plugin-babel/preset'],
// 允许两种编码引入方式共存,也就是 common 规范与 es6 规范的共存处理
sourceType: 'unambiguous'
}
FROM debian:bookworm-slim
ENV DEBIAN_FRONTEND=noninteractive
# 基础工具
RUN apt-get update && apt-get install -y \
curl \
git \
nano \
ca-certificates \
bash \
unzip \
jq \
&& rm -rf /var/lib/apt/lists/*
# 创建用户(uid=1000)
RUN useradd -m -u 1000 -s /bin/bash claude
# 切换到 claude 用户
USER claude
ENV HOME=/home/claude
# Volta
ENV VOLTA_HOME=/home/claude/.volta
ENV PATH=${VOLTA_HOME}/bin:${PATH}
# 安装 Volta
RUN curl https://get.volta.sh | bash
# 安装 Node
RUN volta install node@14
RUN volta install node@22
# 安装 Claude Code
RUN npm install -g @anthropic-ai/claude-code
# 初始化 Claude 配置
RUN mkdir -p /home/claude/.claude && \
echo '{}' > /home/claude/.claude.json && \
jq '. + {"hasCompletedOnboarding": true}' \
/home/claude/.claude.json \
> /home/claude/.claude.json.tmp && \
mv /home/claude/.claude.json.tmp /home/claude/.claude.json
# ==========================
# 最后统一修正权限
# ==========================
USER root
RUN chown -R 1000:1000 /home/claude
# 恢复默认运行用户
USER claude
WORKDIR /workspace
CMD ["/bin/bash"]
services:
ai-worker:
# user: "1000:1000"
build:
context: .
dockerfile: ../build/Dockerfile.unit.test
container_name: ai-worker
working_dir: /workspace
volumes:
- npm-cache:/home/jdkapp/.npm
# npm 缓存
- npm-cache:/home/claude/.npm
# Claude 登录状态
- claude-cache:/home/claude/.claude/projects
# Volta 缓存(node、npm)
- volta-cache:/home/claude/.volta
environment:
- ANTHROPIC_AUTH_TOKEN
- GIT_AUTHOR_NAME=AI-BOT
- GIT_AUTHOR_EMAIL=ai-bot@didihu.com.cn
- GIT_COMMITTER_NAME=AI-BOT
- GIT_COMMITTER_EMAIL=ai-bot@didihu.com.cn
- AI_GITLAB_TOKEN
- ANTHROPIC_BASE_URL=https://dashscope.aliyuncs.com/apps/anthropic
- ANTHROPIC_MODEL=qwen3.5-plus
- ANTHROPIC_SMALL_FAST_MODEL=qwen3.5-flash
- ANTHROPIC_DEFAULT_HAIKU_MODEL=qwen3.5-flash
- ANTHROPIC_DEFAULT_SONNET_MODEL=qwen3.5-plus
- ANTHROPIC_DEFAULT_OPUS_MODEL=qwen3.5-plus
- CLAUDE_CODE_SUBAGENT_MODEL=qwen3.5-plus
command: >
sh -c '
git config --global credential.helper store &&
echo "http://oauth2:$${AI_GITLAB_TOKEN}@gitlab.test.glsx.com.cn" > ~/.git-credentials &&
tail -f /dev/null
'
restart: unless-stopped
volumes:
npm-cache:
claude-cache:
volta-cache:
/**
* E2E 登录辅助(Vuex 内存登录态)
*
* 本项目路由守卫依赖 store 内存,不能用 storageState 跨 context。
* 新用例请在 beforeAll 中调用 createLoggedInPage,整文件复用返回的 page。
*/
export function getBaseUrl() {
return (process.env.BASE_URL || "http://192.168.1.146:8080/dj-carlife-web/").replace(
/\/$/,
"",
);
}
export async function login(page, {
account = "glsadmin",
password = "123456",
} = {}) {
const baseUrl = getBaseUrl();
await page.goto(`${baseUrl}/#/login`);
await page.getByPlaceholder("账户").fill(account);
await page.getByPlaceholder("密码").fill(password);
await page.getByRole("button", { name: "登录" }).click();
await page.waitForURL(/#\/index/);
await page.waitForLoadState("networkidle");
}
/**
* 创建已登录的共享 page(beforeAll 调用一次即可)
* @returns {Promise<import('@playwright/test').Page>}
*/
export async function createLoggedInPage(browser, options = {}) {
const context = await browser.newContext();
const page = await context.newPage();
page.setDefaultTimeout(options.timeout || 10000);
page.setDefaultNavigationTimeout(options.navigationTimeout || 30000);
await login(page, options);
return page;
}
import process from "node:process";
import { expect, test } from "@playwright/test";
const routeIds = [
"903",
"90317",
"903170101",
"903170102",
"904",
"90412",
"904120101",
"904120102",
"90413",
"904130101",
"906",
"90635",
"907",
];
function success(data) {
return { code: "0", message: "success", data };
}
function methodOf(request) {
const params = new URLSearchParams(request.postData() || new URL(request.url()).search);
return params.get("method") || "";
}
async function installRopMock(page, calls) {
await page.route("**/*router**", async (route) => {
const method = methodOf(route.request());
calls.push(method);
let data = {};
if (method === "dj.api.user.login") {
data = { sessionId: "simple-e2e-session", accountList: [{ merchantNo: "10001" }] };
} else if (method === "dj.api.user.info") {
data = {
loginAccount: { isAdmin: 1, accountType: 1, merchantAccountList: [] },
merchant: { merchantNo: "10001", merchantName: "Mock 门店" },
};
} else if (method === "dj.api.userauth.getUserAuth") {
data = routeIds.map(authId => ({ authId, parentId: "1" }));
} else if (method === "scrm.api.equity.service.spu.select.get") {
data = [{ packageCode: "PKG001", packageName: "Mock 权益商品" }];
} else if (method === "scrm.api.equity.service.channel.order.detail") {
data = { id: "E1", customerName: "张三", mobile: "13800138000", packageCode: "PKG001" };
} else if (method === "scrm.api.equity.service.channel.order.insert.or.update") {
data = { id: "E1" };
} else if (method === "scrm.api.equity.service.contract.base.extend.template.list.page") {
data = { list: [{ id: "C1", templateName: "Mock 延保合同" }], total: 1 };
} else if (method === "scrm.api.equity.service.contract.template.detail") {
data = { id: "C1", templateName: "Mock 合同", content: "<p>Mock 合同正文</p>" };
} else if (method.includes(".list") || method.includes(".page") || method.includes(".pages")) {
data = { list: [], rows: [], total: 0 };
}
await route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify(success(data)),
});
});
}
async function login(page, calls) {
await installRopMock(page, calls);
await page.goto("#/login");
await page.getByTestId("username").fill("simple-e2e");
await page.getByTestId("password").fill("mock-password");
await page.locator(".button-login").click();
await expect(page).toHaveURL(/#\/index/);
}
test.describe("simple migrated pages with local ROP mock", () => {
test("lists and account placeholder are readable", async ({ page }) => {
const calls = [];
await login(page, calls);
await page.goto("#/equity-orders");
await expect(page.getByText("新增权益订单")).toBeVisible();
await expect(page.getByText("暂无权益订单")).toBeVisible();
await page.goto("#/servicesManage");
await expect(page.getByRole("tab", { name: "车损权益", exact: true })).toBeVisible();
await expect(page.getByRole("tab", { name: "延保权益", exact: true })).toBeVisible();
await page.goto("#/contract-manager");
await expect(page.getByRole("tab", { name: "产品合同", exact: true })).toBeVisible();
await expect(page.getByRole("tab", { name: "商品合同", exact: true })).toBeVisible();
await expect(page.getByRole("tab", { name: "套餐合同", exact: true })).toBeVisible();
const beforeAccount = calls.filter(method => method.startsWith("scrm.")).length;
await page.goto("#/account-center");
await expect(page.getByText("组织、菜单、角色、员工管理需求文档待补充")).toBeVisible();
expect(calls.filter(method => method.startsWith("scrm.")).length).toBe(beforeAccount);
});
test("equity order form submits once through the mock gateway", async ({ page }) => {
const calls = [];
await login(page, calls);
await page.goto("#/equity-orders/edit");
await page.locator(".el-form-item").filter({ hasText: "客户姓名" }).locator("input").fill("张三");
await page.locator(".el-form-item").filter({ hasText: "手机号" }).locator("input").fill("13800138000");
await page.locator(".el-form-item").filter({ hasText: "权益商品" }).locator("input").click();
await page.getByText("Mock 权益商品", { exact: true }).click();
await page.getByRole("button", { name: "保存" }).click();
await expect.poll(() => calls.filter(method => method === "scrm.api.equity.service.channel.order.insert.or.update").length).toBe(1);
});
test("service project and contract forms submit once through the mock gateway", async ({ page }) => {
const calls = [];
await login(page, calls);
await page.goto("#/service-project/edit?type=extended");
await page.locator(".el-form-item").filter({ hasText: "项目名称" }).locator("input").fill("Mock 延保权益");
await page.locator(".el-form-item").filter({ hasText: "合同模板" }).locator("input").click();
await page.getByText("Mock 延保合同", { exact: true }).click();
await page.getByRole("button", { name: "保存" }).click();
await expect.poll(() => calls.filter(method => method === "scrm.api.equity.service.items.extend.insert.or.update").length).toBe(1);
await page.goto("#/contract-manager/edit");
await page.locator(".el-form-item").filter({ hasText: "模板名称" }).locator("input").fill("Mock 合同模板");
await page.locator(".w-e-text").fill("Mock 合同正文");
await page.getByRole("button", { name: "保存" }).click();
await expect.poll(() => calls.filter(method => method === "scrm.api.equity.service.contract.template.update").length).toBe(1);
});
});
test.describe("shared development read-only smoke", () => {
test.skip(!process.env.E2E_USERNAME || !process.env.E2E_PASSWORD, "E2E_USERNAME/E2E_PASSWORD 未提供,仅跳过共享开发环境只读冒烟");
test("login and open migrated read-only pages", async ({ page }) => {
await page.goto("#/login");
await page.getByTestId("username").fill(process.env.E2E_USERNAME);
await page.getByTestId("password").fill(process.env.E2E_PASSWORD);
await page.locator(".button-login").click();
await expect(page).not.toHaveURL(/#\/login/);
for (const route of ["equity-orders", "servicesManage", "contract-manager", "account-center"]) {
await page.goto(`#/${route}`);
await expect(page.locator("body")).not.toContainText("404");
}
});
});
import antfu from "@antfu/eslint-config";
export default antfu({
markdown: true,
vue: true,
css: true,
jsonc: true,
json: true,
ignores: [
// 忽略uni_modules目录
"**/uni_modules/",
"dist",
// unplugin-auto-import 生成的类型文件,每次提交都改变,所以加入这里吧,与 .gitignore 配合使用
"auto-import.d.ts",
"build/",
"node_modules/",
// # node 覆盖率文件
"coverage/",
"**/*-min.js",
"**/*.min.js",
],
stylistic: {
"indent": "tab", // 4个空格
"quotes": "double", // or 'double'
"semi": true,
"array-bracket-spacing": ["error", "always"],
},
rules: {
"unicorn/prefer-node-protocol": "off",
"curly": ["error", "all"],
"vue/no-deprecated-slot-attribute": "off",
"vue/no-deprecated-v-on-native-modifier": "off",
"vue/no-deprecated-destroyed-lifecycle": "off",
"vue/no-deprecated-model-definition": "off",
"jsdoc/check-types": "off",
"no-useless-catch": "off",
"vue/no-unused-refs": "warn",
"unused-imports/no-unused-imports": "warn",
"no-unused-vars": "warn",
"style/eol-last": "off",
"no-prototype-builtins": "warn",
"prefer-template": "off",
"no-useless-return": "off",
"vue/no-deprecated-delete-set": "off",
"vue/no-deprecated-dollar-listeners-api": "off",
"vue/require-explicit-emits": "off",
"eqeqeq": "warn",
"vue/eqeqeq": "warn",
"vue/v-on-event-hyphenation": "off",
"style/no-tabs": "off",
"vue/no-deprecated-v-bind-sync": "off",
"vue/no-lone-template": "off",
"vue/no-mutating-props": "off",
"vue/no-deprecated-filter": "off",
"vue/no-v-for-template-key-on-child": "off",
// 关闭:强制组件 name 使用 PascalCase(由于 keep-alive 需要组件 name 与路由 name 一致,路由多为小写)
"vue/component-definition-name-casing": "off",
// 强制:Vue 多行 HTML 元素的内容前后必须换行
"vue/multiline-html-element-content-newline": [
"error",
{
ignoreWhenEmpty: false, // 即使元素内容为空,也要求换行(如 <div>\n</div>)
ignores: [], // 无忽略的元素(所有多行元素都生效)
allowEmptyLines: true, // 允许内容前后存在空白行
},
],
// 强制:Vue HTML 标签闭合括号不换行
"vue/html-closing-bracket-newline": [
"error",
{
singleline: "never", // 单行标签:闭合括号不换行(如 <image src="xxx" />)
multiline: "never", // 多行标签:闭合括号不换行(如 <image\n src="xxx"\n/>)
},
],
// 强制:Vue HTML 元素自闭合格式(如 <image /> 而非 <image></image>)
"vue/html-self-closing": [
"error",
{
html: {
void: "any", // 原生空标签(如 <img>)允许任意自闭合格式
normal: "any", // 原生普通标签(如 <div>)允许任意自闭合格式
component: "any", // 自定义组件(如 <MyComponent>)允许任意自闭合格式
},
svg: "any", // SVG 标签允许任意自闭合格式
math: "any", // MathML 标签允许任意自闭合格式
},
],
// 强制:Vue HTML 模板中标签缩进 4 个空格
"vue/html-indent": [
"error",
2,
{
attribute: 1, // 属性相对于标签缩进 1 级(4 个空格)
baseIndent: 1, // 基础缩进 1 级(适配组件嵌套场景)
closeBracket: 0, // 闭合标签与属性对齐(不额外缩进)
alignAttributesVertically: true, // 多行属性时垂直对齐(如所有属性左侧对齐)
ignores: [], // 无忽略的标签
},
],
"vue/attributes-order": ["error", {
order: [
"DEFINITION", // is
"LIST_RENDERING", // v-for
"CONDITIONALS", // v-if v-else-if v-else v-show v-cloak
"RENDER_MODIFIERS", // v-once v-pre
"GLOBAL", // id
"UNIQUE", // ref key
"SLOT", // v-slot slot
"TWO_WAY_BINDING", // v-model
"OTHER_DIRECTIVES", // v-custom-directive
"ATTR_STATIC", // 静态属性排最前
"ATTR_SHORTHAND_BOOL", // 布尔简写排中间
"ATTR_DYNAMIC", // 动态绑定排最后
"EVENTS", // @click @focus
"CONTENT", // v-text v-html
],
alphabetical: true, // 是否在同组内再按字母排序(建议 false,官方默认顺序更好)
}],
// 强制:Vue SFC 中块的顺序(template -> script -> style)
"vue/block-order": [
"error",
{
order: ["template", "script", "style"], // 固定三个核心块的顺序
},
],
// 强制:Vue 元素首属性的换行格式
"vue/first-attribute-linebreak": [
"error",
{
singleline: "beside", // 单行属性:首属性紧跟标签名(不换行)
multiline: "beside", // 多行属性:首属性也紧跟标签名(注:原注释描述与配置冲突,按配置「不换行」,如需换行可改为 "below")
},
],
// 强制:Vue 元素属性每行最多数量限制
"vue/max-attributes-per-line": [
"error",
{
singleline: 2, // 单行元素最多允许 2 个属性(如 <image src="xxx" alt="xxx">)
multiline: 1, // 多行元素每行最多 1 个属性(每个属性单独一行)
},
],
// 关闭:unused-imports 插件的「禁止未使用变量」检测(与 no-unused-vars 功能重叠,同步关闭)
"unused-imports/no-unused-vars": "off",
// 关闭:禁止无限制使用 eslint-disable 注释(允许临时禁用多个规则,按需关闭)
"eslint-comments/no-unlimited-disable": "off",
// 关闭:检查 JSDoc 注释中参数名与实际参数是否一致(无需强制 JSDoc 规范时关闭)
"jsdoc/check-param-names": "off",
// 强制:代码块前必须加空格(如 function fn() { 前加空格,报错级别 error)
"space-before-blocks": "error",
// 关闭:禁止使用 console(开发环境保留 console.log 便于调试,按需关闭)
"no-console": "off",
"style/brace-style": ["error", "1tbs"],
},
formatters: {
/**
* Format CSS, LESS, SCSS files, also the `<style>` blocks in Vue
* By default uses Prettier
*/
css: true,
scss: true,
less: true,
/**
* Format HTML files
* By default uses Prettier
*/
html: true,
},
}, {
files: ["**/*.spec.js", "**/*.integration.spec.js"],
languageOptions: {
globals: {
jest: "readonly",
describe: "readonly",
it: "readonly",
test: "readonly",
expect: "readonly",
beforeEach: "readonly",
afterEach: "readonly",
beforeAll: "readonly",
afterAll: "readonly",
require: "readonly",
module: "readonly",
process: "readonly",
window: "readonly",
document: "readonly",
navigator: "readonly",
location: "readonly",
URL: "readonly",
Blob: "readonly",
File: "readonly",
FormData: "readonly",
MessageEvent: "readonly",
localStorage: "readonly",
sessionStorage: "readonly",
setTimeout: "readonly",
clearTimeout: "readonly",
setInterval: "readonly",
clearInterval: "readonly",
},
},
});
module.exports = {
moduleFileExtensions: [
"js",
"jsx",
"json",
"vue",
],
transform: {
"^.+\\.vue$": "@vue/vue2-jest",
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub",
"^.+\\.jsx?$": "babel-jest",
},
transformIgnorePatterns: [
"node_modules/(?!(lodash-es|nanoid|flex.css|dayjs)/)",
],
moduleNameMapper: {
"^@api/(.*)$": "<rootDir>/src/api/$1",
"\\.css$": "jest-transform-stub",
"^@/plugin/d2admin/(.*)$": "<rootDir>/jest.mocks/d2admin.js",
"^@/assets/svg-icons/index.js$": "<rootDir>/jest.mocks/svg-icons-index.js",
"^@/assets/svg-icons$": "<rootDir>/jest.mocks/svg-icons-index.js",
"^@/assets/svg-icons/(.*)$": "<rootDir>/jest.mocks/svg-icons.js",
"^@/api/request$": "<rootDir>/jest.mocks/request.js",
"^\./request$": "<rootDir>/jest.mocks/request.js",
"^@/main$": "<rootDir>/jest.mocks/main.js",
"^@/main.js$": "<rootDir>/jest.mocks/main.js",
"^@/store(?:/index)?$": "<rootDir>/jest.mocks/store.js",
"^@/common/util/$": "<rootDir>/src/common/util.js",
"^glsk-oss-jssdk$": "<rootDir>/jest.mocks/glsk-oss.js",
"^@/(.*)$": "<rootDir>/src/$1",
},
snapshotSerializers: [
"jest-serializer-vue",
],
testMatch: [
"**/*.spec.js",
"**/*.integration.spec.js",
"tests/**/*.spec.js",
],
testURL: "http://localhost/",
testEnvironment: "jsdom",
setupFiles: ["<rootDir>/jest.setup.js"],
};
// Mock d2admin 模块
module.exports = {
install: () => {},
};
/* global jest */
class GlOssApi {
constructor() {
this.upload = jest.fn(() => Promise.resolve({ url: "" }));
this.put = jest.fn(() => Promise.resolve({ url: "" }));
}
}
module.exports = GlOssApi;
module.exports.default = GlOssApi;
// Mock main.js 模块
module.exports = {
baseConfig: {},
};
// Mock request 模块
module.exports = jest.fn((params, method, options) => {
return Promise.resolve({});
});
/* global jest */
function recursiveProxy() {
const proxy = new Proxy(() => proxy, {
get(target, property) {
if (property === Symbol.toPrimitive) {
return () => "";
}
if (property === "length") {
return 0;
}
return proxy;
},
apply() {
return proxy;
},
});
return proxy;
}
const store = {
state: recursiveProxy(),
getters: recursiveProxy(),
dispatch: jest.fn(() => Promise.resolve()),
commit: jest.fn(),
};
module.exports = store;
module.exports.default = store;
// Mock svg-icons 模块
module.exports = [];
// Mock svg-icons 模块
const requireAll = () => [];
module.exports = [];
// Jest 全局设置文件
// 设置 dayjs 默认语言
const dayjs = require('dayjs');
dayjs.locale('en');
// Mock require.context (webpack 特有,Jest 不支持)
// 需要在 setupFilesAfterEnv 中设置,这样在加载测试文件之前就生效
global.require = global.require || (() => {});
if (!global.require.context) {
global.require.context = (() => {
return {
keys: () => [],
};
});
}
{
"compilerOptions": {
"target": "ES2020",
// "jsx": "react-jsx",
// "lib": ["ES2020", "DOM", "DOM.Iterable"],
"lib": [
"ES2020"
],
"useDefineForClassFields": true,
/* Paths */
"baseUrl": ".",
"module": "ESNext",
/* Bundler mode */
// 按 Node 规则解析模块
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
],
"@api/*": [
"src/api/*"
]
},
"resolveJsonModule": true,
"allowImportingTsExtensions": false,
"allowJs": true,
"checkJs": false,
"noEmit": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"isolatedModules": true,
"skipLibCheck": true
},
"include": [
"src/**/*",
"src/**/*.js",
"src/**/*.vue"
],
"exclude": [
"node_modules",
"dist",
".git"
]
}
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
{
"name": "dj-car-life-system-simple",
"version": "0.1.0",
"private": true,
"scripts": {
"备注": "去掉nomock配置命令",
"serve": "set NODE_OPTIONS=--max-old-space-size=4096&& vue-cli-service serve",
"start": "npm run serve",
"dev": "npm run serve",
"build": "vue-cli-service build --no-module",
"build:nomock": "vue-cli-service build --mode nomock",
"lint": "vue-cli-service lint --fix",
"rop:swagger": "node scripts/rop-swagger-scaffold.js",
"rop:swagger:fetch": "node scripts/rop-swagger-fetch.js",
"rop:contract:check": "node scripts/rop-contract-diff.js",
"rop:import": "node scripts/rop-import.js",
"rop:verify": "npm run test:unit -- tests/unit/libs/rop && npm run rop:contract:check",
"report": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --report",
"test:unit": "vue-cli-service test:unit"
},
"dependencies": {
"@sentry/browser": "^7.12.1",
"@sentry/integrations": "^7.12.1",
"@sentry/tracing": "^7.3.0",
"@sentry/vue": "^7.3.0",
"ali-oss": "^6.22.0",
"axios": "^0.18.0",
"baseline-browser-mapping": "^2.10.42",
"better-scroll": "^1.15.2",
"bignumber.js": "^9.1.1",
"caniuse-lite": "^1.0.30001803",
"core-js": "^3.8.3",
"dayjs": "^1.8.12",
"default-passive-events": "^2.0.0",
"echarts": "^5.3.2",
"element-ui": "2.13.2",
"emoji-regex": "^10.6.0",
"file-saver": "^2.0.5",
"flex.css": "^1.1.7",
"fuse.js": "^3.4.4",
"glsk-oss-jssdk": "^1.0.6",
"glsk-toolkit": "^1.0.5",
"glsx-common-sdk": "^0.3.0",
"hotkeys-js": "^3.6.2",
"html2canvas": "^1.4.1",
"js-cookie": "^2.2.0",
"js-md5": "^0.7.3",
"lodash": "^4.17.23",
"lodash-es": "^4.17.22",
"lowdb": "^1.0.0",
"nanoid": "^5.1.6",
"nprogress": "^0.2.0",
"number-precision": "^1.6.0",
"qrcodejs2": "^0.0.2",
"qs": "^6.8.0",
"rfdc": "^1.3.0",
"screenfull": "^4.2.0",
"sha1": "^1.1.1",
"sortablejs": "^1.15.6",
"svg-sprite-loader": "^6.0.11",
"ua-parser-js": "^0.7.19",
"vue": "2.6.10",
"vue-lazyload": "^1.2.3",
"vue-router": "3.0.5",
"vuedraggable": "^2.24.3",
"vuex": "^3.0.1",
"wangeditor": "4.7.15",
"webpack-theme-color-replacer": "^1.4.2",
"xlsx": "^0.16.9"
},
"devDependencies": {
"@antfu/eslint-config": "^6.7.3",
"@babel/core": "^7.12.16",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.17.12",
"@babel/plugin-proposal-optional-chaining": "7.13.12",
"@kazupon/vue-i18n-loader": "^0.4.1",
"@playwright/test": "^1.39.0",
"@sentry/webpack-plugin": "^1.18.9",
"@vue/babel-helper-vue-jsx-merge-props": "^1.4.0",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-unit-jest": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vue/compiler-sfc": "^3.5.26",
"@vue/test-utils": "1.0.0-beta.29",
"@vue/vue2-jest": "^27.0.0-alpha.3",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^27.5.1",
"eslint": "^9.39.2",
"eslint-plugin-format": "^1.2.0",
"jest": "^27.1.0",
"jest-serializer-vue": "^3.1.0",
"jest-transform-stub": "^2.0.0",
"md5": "^2.3.0",
"playwright": "^1.39.0",
"postcss-preset-env": "^7.7.2",
"postcss-px-to-viewport": "^1.1.1",
"sass": "~1.62.0",
"sass-loader": "^7.3.1",
"script-loader": "^0.7.2",
"speed-measure-webpack-plugin": "^1.5.0",
"vue-template-compiler": "2.6.10",
"webpack": "^5.74.0"
},
"volta": {
"node": "14.21.3"
}
}
/**
* Playwright E2E 测试配置
*
* 使用方法:
* 1. 安装 Playwright: npm install -D @playwright/test
* 2. 安装浏览器:npx playwright install
* 3. 运行测试:npx playwright test
* 4. 带 UI 运行:npx playwright test --ui
* 5. 运行特定测试:npx playwright test e2e/xxx.e2e.js
* 6. 生成报告:npx playwright show-report
*/
import process from "node:process";
import { defineConfig, devices } from "@playwright/test";
import dayjs from "dayjs";
// 生成时间戳,用于报告和结果目录
// Windows 路径不能含冒号;报告/结果目录用安全时间戳
const timestamp = dayjs().format("YYYY-MM-DD_HH-mm-ss");
export default defineConfig({
// 测试文件位置
testDir: "./e2e",
// 测试文件匹配模式
testMatch: "**/*.e2e.js",
// 超时时间
timeout: 30 * 1000,
// 每个测试的期望时间
expect: {
timeout: 5000,
},
// 失败重试次数
retries: 1,
// 并行执行配置
workers: 1,
// 是否失败即停止
failOnFlakyTests: false,
// 报告配置
// 产出到 playwright/report/index.YYYY-MM-DD hh-mm.html
reporter: [
["list"],
[
"html",
{
outputFolder: `playwright/report/${timestamp}`,
open: "never",
},
],
],
// 共享配置
use: {
// 基础 URL - 使用当前 IP 访问
baseURL: process.env.BASE_URL || "http://192.168.1.146:8080/dj-carlife-web/",
// 截图配置
screenshot: "only-on-failure",
// 录屏配置
video: process.env.PLAYWRIGHT_VIDEO === "true" ? "retain-on-failure" : "off",
// 追踪配置
trace: "retain-on-failure",
// 浏览器上下文选项
actionTimeout: 10000,
navigationTimeout: 30000,
},
// 测试结果目录(截图、视频、trace)
// 产出到 playwright/result/YYYY-MM-DD hh-mm/
outputDir: `playwright/result/${timestamp}`,
// 浏览器配置
projects: [
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
viewport: { width: 1920, height: 1080 },
},
},
],
// Web 服务器配置 (用于自动启动开发服务器)
// 如果在远程机器运行,请设置 SKIP_WEBSERVER=true 并手动启动服务
webServer: process.env.SKIP_WEBSERVER
? undefined
: {
command: "npm run serve",
timeout: 120 * 1000,
reuseExistingServer: true,
// 等待 URL,确保服务器准备好
url: process.env.BASE_URL
? process.env.BASE_URL.replace(/\/$/, "") + "/#/"
: "http://192.168.1.146:8080/dj-carlife-web/#/",
},
});
const path = require('path')
class copyDir {
apply(compiler) {
// done是webpack 得编译完成周期
compiler.hooks.afterEmit.tap('DonePlugins', function(stats) {
// console.log('编译完成!!')
// 因为写在文件夹里面 要找外面的文件要加../
// 删除老文件夹 并拷贝
removeDir(`${__dirname}/../dist`)
cpSync(
path.join(__dirname, '../copyDirTarget'),
path.join(__dirname, '../dist')
)
cpSync(
path.join(__dirname, '../copyDirTarget'),
path.join(__dirname, '../dist//dj-carlife-web')
)
// removeDir(`${__dirname}/../copyDirTarget`)
})
}
}
/** 主要版本 */
const major = process.version.match(/v([0-9]*).([0-9]*)/)[1]
/** 特性版本 */
const minor = process.version.match(/v([0-9]*).([0-9]*)/)[2]
/**
* 文件夹复制
* @param {string} source 源文件夹
* @param {string} destination 目标文件夹
*/
function cpSync(source, destination) {
const fs = require('fs')
// console.log('source', source)
// 判断node版本不是16.7.0以上的版本
// 则进入兼容处理
// 这样处理是因为16.7.0的版本支持了直接复制文件夹的操作
if (Number(major) < 16 || (Number(major) == 16 && Number(minor) < 7)) {
// 如果存在文件夹 先递归删除该文件夹
if (fs.existsSync(destination)) fs.rmSync(destination, { recursive: true })
// 新建文件夹 递归新建
fs.mkdirSync(destination, { recursive: true })
// 读取源文件夹
const rd = fs.readdirSync(source)
// console.log('rd', rd)
for (const fd of rd) {
// 循环拼接源文件夹/文件全名称
const sourceFullName = source + '/' + fd
// 循环拼接目标文件夹/文件全名称
const destFullName = destination + '/' + fd
// 读取文件信息
const lstatRes = fs.lstatSync(sourceFullName)
// 是否是文件
if (lstatRes.isFile()) fs.copyFileSync(sourceFullName, destFullName)
// 是否是文件夹
if (lstatRes.isDirectory()) cpSync(sourceFullName, destFullName)
}
} else fs.cpSync(source, destination, { force: true, recursive: true })
}
/**
* @caption 删除本地文件夹/文件
* @param {String} directoryPath 例: d://x/x/x.json 或者 d://x/x/x
*/
function removeDir(directoryPath) {
const fs = require('fs')
// 判断文件是否存在
require('fs').existsSync(directoryPath) && dleteDir()
function dleteDir() {
const files = fs.readdirSync(directoryPath)
for (var i = 0; i < files.length; i++) {
const newPath = path.join(directoryPath, files[i])
const stat = fs.statSync(newPath)
if (stat.isDirectory()) {
// 如果是文件夹就递归下去
removeDir(newPath)
} else {
// 删除文件
fs.unlinkSync(newPath)
}
}
fs.rmdirSync(directoryPath) // 如果文件夹是空的,就将自己删除掉
}
}
module.exports = copyDir
const removeDir = require('./removeFn')
class AsyncRomveDir {
apply(compiler) {
// console.log('自定义异步组件');
compiler.hooks.afterEmit.tapAsync('AsyncPlugin', (compilation, cb) => {
setTimeout(() => {
// console.log()
removeDir(`${__dirname}/../copyDirTarget`)
cb()
}, 5000)
})
}
}
module.exports = AsyncRomveDir
/**
* @caption 删除本地文件夹/文件
* @param {String} directoryPath 例: d://x/x/x.json 或者 d://x/x/x
*/
function removeDir(directoryPath) {
const fs = require('fs')
const path = require('path')
// 判断文件是否存在
require('fs').existsSync(directoryPath) && dleteDir()
function dleteDir() {
const files = fs.readdirSync(directoryPath)
for (var i = 0; i < files.length; i++) {
const newPath = path.join(directoryPath, files[i])
const stat = fs.statSync(newPath)
if (stat.isDirectory()) {
// 如果是文件夹就递归下去
removeDir(newPath)
} else {
// 删除文件
fs.unlinkSync(newPath)
}
}
fs.rmdirSync(directoryPath) // 如果文件夹是空的,就将自己删除掉
}
}
module.exports = removeDir
No preview for this file type
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-08 12:25:27
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-08 14:10:42
* @FilePath: \scrm-micro-drainage\public\hash.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
// hash.js
self.importScripts('spark-md5.min.js')
self.onmessage = e => {
console.log(e)
const { file } = e.data
const spark = new self.SparkMD5.ArrayBuffer()
let count = 0
const loadNext = index => {
const reader = new FileReader()
reader.readAsArrayBuffer(file)
reader.onload = e => {
count++
spark.append(e.target.result)
var hexHash = spark.end()
var oParams = {}
oParams.fileMD5 = hexHash
oParams.file = e.target.result
oParams.size = file.size
self.postMessage(oParams)
}
}
loadNext(0)
}
No preview for this file type
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32" fill="white">
<path opacity=".25" d="M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"/>
<path d="M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z">
<animateTransform attributeName="transform" type="rotate" from="0 16 16" to="360 16 16" dur="0.8s" repeatCount="indefinite" />
</path>
</svg>
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>icon.ico">
<!-- 使用CDN的CSS文件 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
<% } %>
<!-- 使用CDN的JS文件 预加载 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" />
<% } %>
<title>
<%= VUE_APP_TITLE %>
</title>
<style>
html,
body,
#app {
height: 100%;
margin: 0px;
padding: 0px;
width: 100%;
}
.d2-home {
background-color: #2A343D;
height: 100%;
display: flex;
flex-direction: column;
}
.d2-home__main {
user-select: none;
width: 100%;
flex-grow: 1;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.d2-home__footer {
width: 100%;
flex-grow: 0;
text-align: center;
padding: 1em 0;
}
.d2-home__footer>a {
font-size: 12px;
color: #fff;
text-decoration: none;
}
.d2-home__loading {
height: 32px;
width: 32px;
margin-bottom: 20px;
}
.d2-home__title {
color: #FFF;
font-size: 20px;
margin-bottom: 10px;
}
.d2-home__sub-title {
color: #fff;
font-size: 14px;
}
</style>
<!-- <script>
var _hmt = _hmt || [];
var hmid = "1dfa88d0c8571eef2d383070cb3e5ca1";
(function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?" + hmid; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s);})();
</script> -->
</head>
<body>
<noscript>
<strong>
很抱歉,如果没有 JavaScript 支持,系统 将不能正常工作。请启用浏览器的 JavaScript 然后继续。
</strong>
</noscript>
<div id="app">
<div class="d2-home">
<div class="d2-home__main">
<!-- <img class="d2-home__loading" src="`/image/loading/loading-spin.svg`" alt="loading"> -->
<img class="d2-home__loading" src="<%= VUE_APP_PUBLIC_PATH %>/image/loading/loading-spin.svg" alt="loading">
<div class="d2-home__title">
正在加载资源
</div>
<div class="d2-home__sub-title">
初次加载资源可能需要较多时间 请耐心等待
</div>
</div>
<div class="d2-home__footer">
<a href="http://www.glsx.com.cn" target="_blank">
<!-- 版权所有&copy-2019 GLSX粤ICP备12020087号 -->
</a>
</div>
</div>
</div>
<!-- built files will be auto injected -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
</body>
<script type="text/javascript"
src="https://webapi.amap.com/maps?v=1.4.15&key=44cc16e43ad7ed3358df507bd0618181&plugin=AMap.Geocoder&plugin=AMap.PlaceSearch&plugin=AMap.Geolocation">
</script>
</html>
\ No newline at end of file \ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!