Commit 1fdd32e2 by 前端

Merge branch 'release/venus-usedcar-h5/1.0.0' into 'master'

上线合并

See merge request !17
2 parents 03e34fd8 627cb7b3
Pipeline #189 for 1fdd32e2 failed in 0 seconds
Showing 114 changed files with 4874 additions and 22 deletions
export default {
"*.{js,jsx,ts,tsx,vue,uvue,uts,md}": "pnpm eslint --cache --fix",
"package.json": "pnpm eslint --cache --fix",
......
......@@ -13,6 +13,6 @@ auto-install-peers=true
dedupe-peer-dependents=true
# Windows 符号链接支持配置
# 使用 isolated 模式,确保 workspace 包正确链接
node-linker=isolated
# hoisted 模式避免 EPERM 符号链接错误(可改为 isolated 并开启开发者模式以恢复)
node-linker=hoisted
enable-pre-post-scripts=true
{
"tailwindCSS.experimental.configFile": "internal/tailwind-config/src/index.ts",
"eslint.nodePath": "./node_modules",
// 告诉 ESLint:这是一个 monorepo
"eslint.workingDirectories": [{ "mode": "auto" }],
// 单份 flat config 在仓库根目录;若用 mode:auto,子包目录下没有 eslint.config.* 会报 Could not find config file
"eslint.workingDirectories": [{ "directory": ".", "changeProcessCWD": true }],
// 使用 flat config(ESLint v9+ 必需)
"eslint.useFlatConfig": true,
"eslint.useESLintClass": true,
......
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
FOUNDATION_EXPORT double permission_handler_iosVersionNumber;
FOUNDATION_EXPORT const unsigned char permission_handler_iosVersionString[];
......@@ -6,7 +6,7 @@
"type": "module",
"scripts": {
"dev": "vite --port 8081 --host",
"build": "vue-tsc && vite build",
"build": "vite build",
"postbuild": "node ../../../../scripts/copy-dist-to-root.mjs",
"preview": "vite preview --port 8081",
"type-check": "vue-tsc --noEmit"
......
......@@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite --host",
"build": "vue-tsc && vite build",
"build": "vite build",
"postbuild": "node ../../../../scripts/copy-dist-to-root.mjs",
"preview": "vite preview",
"type-check": "vue-tsc --noEmit"
......
VITE_APP_TITLE=
VITE_APP_ENV=development
VITE_API_BASE_URL=http://localhost:3000
VITE_APP_TITLE=
VITE_APP_ENV=development
VITE_API_BASE_URL=http://dev-api.example.com
###
# @Author: cen
# @Date: 2026-03-16 15:09:35
# @Description:
# @FilePath: /venus-usedcar-h5/apps/web/venus-usedcar-quality/.env.production
# @LastEditTime: 2026-04-03 14:17:08
# @LastEditors: cenchengwei@foreverht.com
# 可以输入预定的版权声明、个性签名、空行等
###
VITE_APP_TITLE=
VITE_APP_ENV=production
VITE_API_BASE_URL=https://api.example.com
# 二手车 H5
二手车移动端 H5 应用,基于 Vue 3 + Vite + TypeScript。
## 技术栈
- **框架**: Vue 3、Vue Router、Pinia
- **UI**: Vant 4(按需引入)
- **工具**: VueUse、dayjs、glsk-toolkit
- **构建**: Vite、TypeScript、SCSS、Tailwind CSS
- **适配**: `lib-flexible` + `postcss-pxtorem`(设计稿以 375 宽为基准,`rootValue` 与 `flexible` 中基准字号一致)
## 已完成的配置
- **环境变量**: `.env` / `.env.development` / `.env.production`,支持 `VITE_APP_TITLE`、`VITE_API_BASE_URL`、`VITE_APP_ENV`
- **路径别名**: `@`、`@assets`、`@views`、`@components`、`@stores`、`@utils`、`@api`、`@composables`
- **自动导入**: vue / vue-router / pinia / @vueuse/core;Vant 组件与 `src/components`、`src/layouts` 自动注册
- **配置中心**: 远程拉取配置(`venus-usedcar-config`),本地缓存,动态设置 API baseURL;集成 glsk-toolkit Request 实例(与业务请求层并行时可统一收敛)
- **请求封装**: `src/utils/request.ts` 基于 axios,提供 `get`/`post`,统一解析业务 `code === 200` 的 `data`,类型 `ApiResponse<T>`、`PageData<T>`
- **开发代理**: `/api` 代理到 `VITE_API_BASE_URL`,端口 8082
## 已完成的功能
- **路由**: 首页、找车、我的、车辆详情、404;底部 TabBar 布局;首页/找车支持 keepAlive
- **用户**: 登录(手机号+验证码)、登出、用户信息、更新昵称/头像、收藏车辆列表(API 已对接)
- **车辆**: 列表(分页、筛选、排序)、详情、筛选条件、推荐列表、收藏/取消收藏(API 已对接)
- **状态**: Pinia + pinia-plugin-persistedstate 持久化,`useAppStore`、`useUserStore`
## 脚本
```bash
pnpm dev # 开发,http://localhost:8082
pnpm build # 构建
pnpm preview # 预览构建产物(端口 8082)
pnpm type-check # 类型检查
```
/// <reference types="vite/client" />
/// <reference types="vite/client" />
declare module "glsk-toolkit" {
export class Defaults {
constructor(config: Record<string, unknown>);
}
export class Request {
constructor(config: Defaults);
get(url: string, config?: Record<string, unknown>): Promise<unknown>;
post(url: string, data?: unknown, config?: Record<string, unknown>): Promise<unknown>;
put(url: string, data?: unknown, config?: Record<string, unknown>): Promise<unknown>;
delete(url: string, config?: Record<string, unknown>): Promise<unknown>;
interceptors: {
request: {
use(
onFulfilled: (config: Record<string, unknown>) => Record<string, unknown> | Promise<Record<string, unknown>>,
onRejected?: (error: unknown) => unknown
): void;
};
};
}
}
interface ImportMetaEnv {
readonly VITE_APP_TITLE: string;
readonly VITE_API_BASE_URL: string;
readonly VITE_APP_ENV: "development" | "staging" | "production";
/** 静态资源与路由公共路径,如 /venus-usedcar-h5/;不设时非 development 构建默认为该子路径 */
readonly VITE_PUBLIC_BASE?: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}
// @ts-check
import { defineConfig } from "@venus/eslint-config";
export default defineConfig([
{
files: ["src/**/*.ts", "src/**/*.vue"],
languageOptions: {
parserOptions: {
project: ["./tsconfig.json"],
tsconfigRootDir: import.meta.dirname,
},
},
},
]);
<!--
* @Author: cen
* @Date: 2026-03-23 19:52:07
* @Description:
* @FilePath: /venus-usedcar-h5/apps/web/venus-usedcar-quality/index.html
* @LastEditTime: 2026-04-03 14:16:09
* @LastEditors: cenchengwei@foreverht.com
* 可以输入预定的版权声明、个性签名、空行等
-->
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
/>
<meta name="theme-color" content="#ee0a24" />
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<!-- 微信 JSSDK:小程序 webview 通信必需 -->
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<!-- UniApp WebView Bridge:uniapp 容器通信必需 -->
<script src="https://gitcode.com/dcloud/uni-app/raw/dev/dist/uni.webview.1.5.6.js"></script>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
export default {
// 必填:填你自己的真实值(本文件建议不要提交到仓库)
ACCESS_KEY_ID: "LTAI5tCRcCUgd7bt1J7JY596",
ACCESS_KEY_SECRET: "kJos9mgylkR5ztosnDt8Asrc3ulgqy",
STS_ROLE_ARN: "OPTIONAL",
BUCKET: "glsk-oss",
REGION: "oss-cn-shenzhen",
DIR: "usedCarH5/",
PORT: 3000,
};
{
"name": "venus-usedcar-quality",
"version": "1.0.0",
"description": "二手车H5移动端应用",
"private": true,
"type": "module",
"scripts": {
"dev": "vite --host --port 8082",
"build": "vite build",
"preview": "vite preview --port 8082",
"type-check": "vue-tsc --noEmit",
"lint": "eslint \"src/**/*.{ts,vue}\" --fix --no-error-on-unmatched-pattern"
},
"dependencies": {
"@vueuse/core": "catalog:",
"axios": "^1.12.2",
"dayjs": "catalog:",
"glsk-oss-jssdk": "catalog:",
"glsk-toolkit": "catalog:",
"pinia": "catalog:",
"pinia-plugin-persistedstate": "catalog:",
"tailwindcss": "catalog:",
"vant": "^4.9.0",
"vue": "catalog:",
"vue-router": "catalog:"
},
"devDependencies": {
"@types/node": "catalog:",
"@vitejs/plugin-vue": "catalog:",
"autoprefixer": "catalog:",
"postcss": "catalog:",
"postcss-pxtorem": "^6.1.0",
"sass": "catalog:",
"typescript": "catalog:",
"unplugin-auto-import": "catalog:",
"unplugin-vue-components": "catalog:",
"vite": "catalog:",
"vue-tsc": "catalog:"
}
}
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";
import pxtorem from "postcss-pxtorem";
export default {
plugins: [
tailwindcss,
autoprefixer,
pxtorem({
// 与 flexible 中的 BASE_FONT_SIZE 保持一致:
// 设计稿 375 宽时,html 字体为 14px,则 1rem = 14px
rootValue: 14,
propList: ["*"],
unitPrecision: 5,
minPixelValue: 1,
selectorBlackList: [".ignore", "html", "#app"],
}),
],
};
<script setup lang="ts">
import { RouterView } from "vue-router";
</script>
<template>
<div id="vant-portal-host" />
<RouterView />
</template>
<style lang="scss">
#app {
width: 100%;
min-height: 100vh;
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica,
"Segoe UI", Arial, Roboto, "PingFang SC", miui, "Hiragino Sans GB",
"Microsoft Yahei", sans-serif;
background-color: var(--color-bg-page);
}
</style>
export * from "./modules/car";
export * from "./modules/inspect-report";
export * from "./modules/user";
export * from "./modules/work-order";
import type { PageData } from "@utils/request.ts";
import { get, post } from "@utils/request.ts";
export interface CarItem {
brand: string;
city: string;
color: string;
coverImage: string;
createdAt: string;
displacement: string;
id: number;
images: string[];
mileage: number;
model: string;
price: number;
tags: string[];
title: string;
transmission: string;
year: number;
}
export interface CarListParams {
brand?: string;
city?: string;
keyword?: string;
maxPrice?: number;
minPrice?: number;
page?: number;
pageSize?: number;
sortBy?: "mileage_asc" | "newest" | "price_asc" | "price_desc";
}
export interface CarFilter {
brands: Array<{ label: string; value: string }>;
cities: Array<{ label: string; value: string }>;
priceRanges: Array<{ label: string; max: number; min: number; }>;
}
export function getCarList(params?: CarListParams) {
return get<PageData<CarItem>>("/api/cars", params as Record<string, unknown>);
}
export function getCarDetail(id: number | string) {
return get<CarItem>(`/api/cars/${id}`);
}
export function getCarFilters() {
return get<CarFilter>("/api/cars/filters");
}
export function getRecommendedCars(limit = 10) {
return get<CarItem[]>("/api/cars/recommended", { limit });
}
export function collectCar(carId: number) {
return post(`/api/cars/${carId}/collect`);
}
export function uncollectCar(carId: number) {
return post(`/api/cars/${carId}/uncollect`);
}
export * from "./inspect-report";
export * from "./page";
export * from "./record";
export * from "./template";
/** 检测记录详情里的单项值(与详情接口结构对齐;与模板侧的 `InspectionValueItem` 区分) */
import { get } from "@utils/request";
export interface FileInfo {
filePath?: string;
lastModified?: string;
lastModifiedDate?: string;
linkProps?: Record<string, unknown>;
name?: string;
percent?: number;
response?: string;
size?: number;
status?: string;
thumbPath?: string;
thumbUrl?: string;
uid?: string;
url?: string;
}
/** 检测记录详情中单条值(与详情接口字段对齐) */
export interface InspectionDetailValueItem {
id: number;
/** 交互类型,与叶子节点 interactionType 一致 */
interactionType: string;
nodeId: number;
remark: null | string;
resultId: number;
valueKey: null | string;
valueSeq: number;
/** 值内容:图片时为 URL,文字时为文本,按钮选择时为选项 key */
valueText: null | string;
}
export interface InspectionDetailResultVO {
/** 完成标志:"0"-未完成,"1"-已完成 */
completedFlag: string;
id: number;
inspectionValueList: InspectionDetailValueItem[];
nodeId: number;
nodeName: string;
recordId: number;
remark: null | string;
/** 结果状态:1-正常,2-故障,3-无此结构 */
resultStatus: 1 | 2 | 3;
}
export interface InspectionNodeDetail {
/** 是否支持"无此结构":0-否,1-是 */
allowNoStructure: number;
captureRequirement: string;
/** 嵌套子节点(nodeType=1→2→3 层级) */
childrenNodes: InspectionNodeDetail[];
createTime: string;
dataFormat: string;
datePattern: string;
defaultConfig: string;
defaultExpr: string;
defaultField: string;
/** 默认值类型:1-固定值,2-接口获取,3-表达式 */
defaultType: number;
defaultValue: string;
/** 展现模式:1-列表表单,2-网格检测,3-区域分组,4-图片上传,5-基础信息,6-视频录制 */
displayMode: number;
/** 编辑权限,0 不可编辑,1 可编辑 */
editPermission: string;
/** 是否存在默认值:1-存在 0-不存在 */
existsDefaultValue: string;
/** 失败数(异常) */
failNum: number;
id: number;
/** 叶子节点(nodeType=3)的检测结果,其他层级为 null */
inspectionResultVO: InspectionDetailResultVO | null;
interactionType: string;
/** 检测项类型:1-基础字段,2-故障检测 */
itemType: number;
maxCount: number;
maxKb: number;
/** 节点层级,根节点为 0 */
nodeLevel: number;
nodeName: string;
nodePath: string;
/** 节点类型:1-模块,2-分组,3-叶子节点 */
nodeType: 1 | 2 | 3;
/** 无此结构数 */
noStructureNum: number;
options: string;
optionsJson: string;
optionsSourceType: number;
/** 父节点 ID,0 表示根节点 */
parentId: number;
placeholder: string;
remark: string;
/** 是否必填:0-选填,1-必填 */
required: number;
reserved: string;
/** 展示节点名称:1-展示 0-不展示 */
showNodeName: string;
sortOrder: number;
/** 状态:0-禁用,1-启用 */
status: number;
/** 成功数(正常) */
successNum: number;
suffix: string;
templateId: number;
updateTime: string;
validationRules: string;
}
/** 详情接口中的评分结构(与模板侧 `InspectionScoreVO` 区分,避免 barrel 重导出同名冲突) */
export interface InspectionDetailScoreVO {
/** 外观评分依据 */
exteriorComment?: string;
/** 外观评分 */
exteriorScore?: number;
/** 内饰评级依据 */
interiorComment?: string;
/** 内饰评级(A/B/C/D) */
interiorLevel?: string;
/** 综合评价 */
overallComment?: string;
/** 综合评分 */
overallScore?: number;
/** 骨架评级依据 */
skeletonComment?: string;
/** 骨架评级(A/B/C/D) */
skeletonLevel?: string;
}
export interface FileInfo {
filePath?: string;
lastModified?: string;
lastModifiedDate?: string;
linkProps?: Record<string, unknown>;
name?: string;
percent?: number;
response?: string;
size?: number;
status?: string;
thumbPath?: string;
thumbUrl?: string;
uid?: string;
url?: string;
}
export interface DetailRes {
albums?: FileInfo[];
carSeriesId?: number;
carSeriesName?: string;
carTypeId?: number;
carTypeName?: string;
cover?: FileInfo;
displacement?: string;
emissionStandard?: string;
/** 发动机工况视频 */
engineConditionVideo?: string;
id?: number;
/** 检测完成时间 */
inspectionCompletedTime?: string;
/** 是否有事故 0 否 1 是 */
accident?: string;
/** 是否有火烧 0 否 1 是 */
burn?: string;
/** 是否有涉水 0 否 1 是 */
wade?: string;
inspectionNodeList: InspectionNodeDetail[];
inspectionScoreVO?: InspectionDetailScoreVO;
licensePlate?: string;
/** 表显里程,单位万公里 */
mileage?: string;
registrationDate?: string;
/** 尾气工况视频 */
tailGasConditionVideo?: string;
taskId?: number;
/** 整车外观视频 */
wholeCarAppearanceVideo?: string;
}
/**
* 详情
* @param recordId 检测记录 id
*/
export function detail(recordId: number) {
return get<DetailRes>(`/rest/inspectionRecord/${recordId}/detail`);
}
export function getCarTypeList(csId: number) {
return get<DetailRes>(`/rest/ropApi/getCarTypeList?csId=${csId}`);
}
import { post } from "@utils/request";
export interface InspectReportPageParams {
keyword?: string;
page: number;
size: number;
}
export interface PageSort {
empty: boolean;
sorted: boolean;
unsorted: boolean;
}
export interface InspectReportPageData<T> {
content: T[];
first: boolean;
last: boolean;
number: number;
numberOfElements: number;
size: number;
sort: PageSort;
totalElements: number;
totalPages: number;
}
export interface InspectReportVehicleCover {
[key: string]: unknown;
filePath?: string;
lastModified?: number;
lastModifiedDate?: string;
name?: string;
size?: number;
status?: string;
thumbPath?: null | string;
thumbUrl?: null | string;
uid?: number | string;
url?: string;
}
export interface InspectReportVehicleBaseInfo {
[key: string]: unknown;
carBrand?: string;
carBrandId?: number;
carChildsBrandId?: number;
carChildsBrandName?: string;
carSeriesId?: number;
carSeriesName?: string;
carTypeId?: number;
carTypeName?: string;
engineNumber?: string;
guidePrice?: number;
licensePlate?: string;
mileage?: number;
sourceNo?: string;
tags?: string[];
vin?: string;
}
export interface InspectReportVehicle {
[key: string]: unknown;
albums?: InspectReportVehicleCover[];
area?: Record<string, unknown>;
baseInfo?: InspectReportVehicleBaseInfo;
coreSpecs?: Record<string, unknown>;
cover?: InspectReportVehicleCover;
createBy?: string;
createTime?: string;
custodianInfo?: Record<string, unknown>;
evaluationTransaction?: Record<string, unknown>;
historyCondition?: Record<string, unknown>;
licenseInfo?: Record<string, unknown>;
ownerInfo?: Record<string, unknown>;
ownership?: Record<string, unknown>;
parkingSpace?: string;
updateBy?: string;
updateTime?: string;
vehicleId?: number;
venue?: Record<string, unknown>;
}
export interface InspectReportItem {
[key: string]: unknown;
bindStatus?: number;
createTime?: string;
h5Url?: string;
id: number;
reportNo: string;
score?: number;
scoreLevel?: string;
updateTime?: string;
vehicle?: InspectReportVehicle;
woId: string;
}
export type InspectReportPageResult = InspectReportPageData<InspectReportItem>;
export function getInspectReportPage(params: InspectReportPageParams) {
return post<InspectReportPageResult>("/rest/inspect/report/page", params);
}
import { post } from "@utils/request";
export interface LeafNodeValue {
/** 新建保存时多数实现可省略,由后端生成 */
id?: number;
interactionType: string;
remark: string;
valueKey: string;
valueSeq: number;
valueText: string;
}
export interface LeafNodeRecord {
data: LeafNodeValue[];
nodeId: number;
nodeName: string;
remark: string;
resultStatus: number;
}
export interface InspectionRecordSaveParams {
leafNodes: LeafNodeRecord[];
/** 大项 nodeId */
locationModule: number | string;
/** 二级项 nodeId;无二级分组时为 null */
locationSubModule: null | number | string;
/** true = 保存并跳下一步,false = 仅保存 */
nextFlag: boolean;
taskId: number | string;
}
/**
* 保存/下一步
*/
export function saveInspectionRecord(params: InspectionRecordSaveParams) {
return post("/rest/inspectionRecord/save", params);
}
/**
* POST `/rest/inspectionRecord/completeInspection` 请求体
*/
export interface CompleteInspectionParams {
exteriorComment: string;
exteriorScore: number;
interiorComment: string;
interiorLevel: string;
overallComment: string;
overallScore: number;
skeletonComment: string;
skeletonLevel: string;
taskId: number | string;
}
/** `completeInspection` 成功时 `data`:有未完成项时带首项节点信息(多为大项 rootNodeId) */
export interface CompleteInspectionResultData {
firstUncompletedNodeId?: null | number | string;
firstUncompletedNodeName?: null | string;
}
/**
* 完成检测(提交检测评分)
*/
export function completeInspection(params: CompleteInspectionParams) {
return post<CompleteInspectionResultData>("/rest/inspectionRecord/completeInspection", params);
}
import { get, post } from "@utils/request";
/** 检测结果单项值(与落库结构对齐) */
export interface InspectionValueItem {
id?: number;
interactionType?: string;
remark?: string;
resultId?: number;
valueKey?: string;
valueSeq?: number;
valueText?: string;
}
export interface InspectionResultVO {
[key: string]: unknown;
/** 完成标志:0 未完成,1 已完成(接口也可能给空字符串) */
completedFlag?: 0 | 1 | string;
id?: number;
inspectionValueList?: InspectionValueItem[];
nodeId?: number;
nodeName?: string;
recordId?: number;
remark?: string;
resultStatus?: number;
}
export interface InspectionNode {
[key: string]: unknown;
allowNoStructure?: number;
/** 子节点列表(nodeType=2 的节点下挂 nodeType=3 的叶子节点) */
childrenNodes?: InspectionNode[];
createTime?: string;
dataFormat?: string;
defaultType?: number;
defaultValue?: string;
displayMode?: number;
editPermission?: string;
existsDefaultValue?: number | string;
id: number;
/** 检测结果(含完成标志) */
inspectionResultVO?: InspectionResultVO;
interactionType?: string;
itemType: number;
nodeCode?: string;
nodeLevel: number;
nodeName: string;
nodeType: number;
options?: string;
optionsSourceType?: number;
parentId: number;
placeholder?: string;
remark?: string;
required?: number;
/**
* 前端根据 existsDefaultValue / defaultType 解析后的初始值
* (defaultType=2 时从 getInspectionTemplateDefault 的 data[nodeCode] 映射)
*/
resolvedInitialValue?: string;
showNodeName: string;
sortOrder: number;
status: number;
templateId: number;
validationRules?: string;
}
/**
* 获取检测模板根节点(大项)
* @param taskId 检测工单ID
*/
export function getInspectionRootNodes(taskId: number | string) {
return get<InspectionNode[]>(`/rest/inspectionTemplate/${taskId}/rootNodes`);
}
/**
* 检测评分回显(与 `completeInspection` 字段对应,接口可能省略部分字段)
*/
export interface InspectionScoreVO {
[key: string]: unknown;
exteriorComment?: null | string;
exteriorScore?: null | number | string;
interiorComment?: null | string;
interiorLevel?: null | string;
overallComment?: null | string;
overallScore?: null | number | string;
skeletonComment?: null | string;
skeletonLevel?: null | string;
}
/**
* `getInspectionChildren` 响应:
* - 普通节点:节点数组;
* - `rootNodeId === -1`(评分回显):多为 **单元素数组**,元素上挂 `inspectionScoreVO`;少数实现也可能返回顶层带 `inspectionScoreVO` 的对象
*/
export type InspectionChildrenData =
| InspectionNode[]
| {
[key: string]: unknown;
inspectionScoreVO?: InspectionScoreVO | null;
};
/**
* 获取检测模板子节点(二级项)
* @param rootNodeId 根节点ID;传 `-1` 时可拉取检测评分回显(`inspectionScoreVO`)
* @param taskId 检测工单ID
*/
export function getInspectionChildren(rootNodeId: number | string, taskId: number | string) {
return get<InspectionChildrenData>(`/rest/inspectionNode/${rootNodeId}/children`, {
taskId,
});
}
/** getInspectionTemplateDefault 返回的 data 结构(字段与 nodeCode 对应,可扩展) */
export interface InspectionTemplateDefaultData {
[key: string]: unknown;
annualInspectionExpiry?: string;
carBrand?: string;
carSeriesId?: string;
carSeriesName?: string;
compulsoryInsuranceExpiry?: string;
displacement?: string;
emissionStandard?: string;
engineNumber?: string;
exteriorColor?: string;
handoverAddress?: string;
keyCount?: string;
licensePlate?: string;
mileage?: string;
productionDate?: string;
registrationDate?: string;
seat?: string;
sourceNo?: string;
usageType?: string;
vin?: string;
}
/**
* 获取检测模板默认值(业务层已解包为 data 对象)
* @param taskId 检测工单ID
*/
export function getInspectionTemplateDefault(taskId: number | string) {
return post<InspectionTemplateDefaultData>(`/rest/inspectionTemplate/default`, {
taskId,
});
}
/** 是否存在默认值:1-存在 0-不存在 */
function hasDefaultValueFlag(node: InspectionNode): boolean {
return String(node.existsDefaultValue ?? "") === "1";
}
const KEYED_SELECT_INTERACTION_TYPES = new Set([
"button_select",
"dropdown",
"radio_button_select",
]);
function isKeyedSelectInteractionType(interactionType: string | undefined): boolean {
if (!interactionType) return false;
return KEYED_SELECT_INTERACTION_TYPES.has(interactionType);
}
/** 将模板默认值如 `2-私户` 按首个 `-` 拆成 key / 展示文案 */
function parseKeyedSelectDefault(raw: string): { valueKey: string; valueText: string } {
const i = raw.indexOf("-");
if (i === -1) {
return { valueKey: "", valueText: raw };
}
return {
valueKey: raw.slice(0, i),
valueText: raw.slice(i + 1),
};
}
/**
* 解析叶子节点默认值对应的文案列表(可多值,与 inspectionValueList 一一对应)
* - defaultType 1:固定值,取 defaultValue
* - defaultType 2:接口值;若字段为数组则每项一条,否则单条
* - defaultType 3:表达式(暂未约定,返回空)
*/
export function resolveInspectionNodeInitialValueTexts(
node: InspectionNode,
templateDefaultData: InspectionTemplateDefaultData | null | undefined
): string[] {
if (!hasDefaultValueFlag(node)) return [];
const type = node.defaultType;
if (type === 1) {
return [node.defaultValue ?? ""];
}
if (type === 2) {
const code = node.nodeCode;
if (!code || !templateDefaultData) return [];
const raw = (templateDefaultData as Record<string, unknown>)[code];
if (raw === undefined || raw === null) return [];
if (Array.isArray(raw)) {
return raw.map((item) => (item === undefined || item === null ? "" : String(item)));
}
return [String(raw)];
}
if (type === 3) {
return [];
}
if (node.defaultValue !== undefined && node.defaultValue !== null) {
return [String(node.defaultValue)];
}
return [];
}
function buildInspectionResultVOFromDefaults(node: InspectionNode, valueTexts: string[]): InspectionResultVO {
const keyed = isKeyedSelectInteractionType(node.interactionType);
const inspectionValueList: InspectionValueItem[] = valueTexts.map((raw, index) => {
const { valueKey, valueText } = keyed
? parseKeyedSelectDefault(raw)
: { valueKey: "", valueText: raw };
return {
id: 0,
resultId: 0,
valueKey,
valueText,
interactionType: node.interactionType ?? "",
valueSeq: index,
remark: "",
};
});
return {
id: 0,
recordId: 0,
nodeId: node.id,
nodeName: node.nodeName,
resultStatus: 0,
completedFlag: 0,
remark: "",
inspectionValueList,
};
}
/**
* 解析单个叶子节点的初始值(展示用;多值时以 ", " 拼接)
*/
export function resolveInspectionNodeInitialValue(
node: InspectionNode,
templateDefaultData: InspectionTemplateDefaultData | null | undefined
): string | undefined {
const texts = resolveInspectionNodeInitialValueTexts(node, templateDefaultData);
if (texts.length === 0) return undefined;
return texts.length === 1 ? texts[0] : texts.join(", ");
}
/**
* 为二级项下的叶子节点写入解析默认值:
* - 已有 inspectionResultVO 的叶子不覆盖
* - 否则将默认值写入新建的 inspectionResultVO.inspectionValueList[].valueText(多值多条)
*/
export function applyResolvedInitialValuesToLeafNodes(
leafNodes: InspectionNode[] | undefined,
templateDefaultData: InspectionTemplateDefaultData | null | undefined
): InspectionNode[] {
if (!leafNodes?.length) return [];
return leafNodes.map((node) => {
if (node.inspectionResultVO !== null && node.inspectionResultVO !== undefined) {
return { ...node };
}
const valueTexts = resolveInspectionNodeInitialValueTexts(node, templateDefaultData);
if (valueTexts.length === 0) {
return { ...node };
}
const resolvedInitialValue = valueTexts.length === 1 ? valueTexts[0] : valueTexts.join(", ");
const inspectionResultVO = buildInspectionResultVOFromDefaults(node, valueTexts);
const list = inspectionResultVO.inspectionValueList ?? [];
const merged: InspectionNode = {
...node,
resolvedInitialValue,
inspectionResultVO,
};
if (!isKeyedSelectInteractionType(node.interactionType) || list.length === 0) {
return merged;
}
const first = list[0];
if (first === undefined) {
return merged;
}
const it = node.interactionType ?? "";
const valueKey = first.valueKey ?? "";
const valueText = first.valueText ?? "";
if (it === "dropdown" || it === "radio_button_select") {
return {
...merged,
valueKey,
valueText,
value: valueKey,
};
}
if (it === "button_select") {
return {
...merged,
valueKey,
valueText,
value: JSON.stringify(
list.map((row) => ({
valueKey: row.valueKey ?? "",
valueText: row.valueText ?? "",
}))
),
};
}
return merged;
});
}
/*
* @Author: cen
* @Date: 2026-03-16 15:09:35
* @Description:
* @FilePath: /venus-usedcar-h5/apps/web/venus-usedcar-quality/src/api/modules/user.ts
* @LastEditTime: 2026-03-24 17:21:07
* @LastEditors: cenchengwei@foreverht.com
* 可以输入预定的版权声明、个性签名、空行等
*/
import type { UserInfo } from "@stores/modules/user.ts";
import { get, post } from "@utils/request";
export interface LoginParams {
phone: string;
verifyCode: string;
}
export interface LoginResult {
expireTime: number;
phone: string;
token: string;
}
export interface InspectDetailAccount {
[key: string]: unknown;
avatar?: string;
createTime?: string;
id: number;
name: string;
phone: string;
region?: string;
regionName?: string;
status: number;
}
export interface InspectDetailOpLog {
[key: string]: unknown;
createBy?: string;
createTime?: string;
description: string;
id: number;
}
export interface InspectorSimpleSummary {
[key: string]: unknown;
avgInspectCost: number;
inspectCount: number;
recent7AvgInspectCost: number;
recent7InspectCount: number;
recent30AvgInspectCost: number;
recent30InspectCount: number;
}
export interface InspectDetailResult {
[key: string]: unknown;
account: InspectDetailAccount;
inspectorSimpleSummary: InspectorSimpleSummary;
opLogs: InspectDetailOpLog[];
}
export function sendSmsCode(phone: string) {
return post<boolean>("/rest/auth/send-code", { phone });
}
export function login(params: LoginParams) {
return post<LoginResult>("/rest/auth/login", params);
}
export function logout() {
return post("/rest/auth/logout", {});
}
export function getUserInfo() {
return get<UserInfo>("/api/user/info");
}
export function updateUserInfo(data: Partial<Pick<UserInfo, "avatar" | "nickname">>) {
return post<UserInfo>("/api/user/update", data);
}
export function getCollectedCars() {
return get<number[]>("/api/user/collected-cars");
}
export function getInspectDetail() {
return get<InspectDetailResult>("/rest/inspect/detail");
}
import { get, post } from "@utils/request";
export interface WorkOrderListParams {
keyword?: string;
page: number;
size: number;
status: 1 | 2 | 3 | 4;
}
export interface WorkOrderCountData {
canceledCount: number;
completedCount: number;
dispatchedCount: number;
inProgressCount: number;
}
export interface WorkOrderPageData<T> {
content: T[];
last: boolean;
number: number;
numberOfElements: number;
size: number;
totalElements: number;
totalPages: number;
}
export interface WorkOrderVehicle {
baseInfo?: {
carBrand?: string;
carSeriesName?: string;
carTypeName?: string;
licensePlate?: string;
vin?: string;
};
cover?: {
thumbUrl?: string;
url?: string;
};
ownership?: {
carCityName?: string;
carProvinceName?: string;
};
venue?: {
address?: string;
};
}
export interface WorkOrderRemoteItem {
auditStatus?: 1 | 2 | 3 | 4;
createTime?: string;
id: number;
inspectionAddress?: string;
status: 1 | 2 | 3 | 4;
vehicle?: WorkOrderVehicle;
woId: string;
woTime?: string;
}
export function getWorkOrderPage(params: WorkOrderListParams) {
return post<WorkOrderPageData<WorkOrderRemoteItem>>("/rest/inspect/wo/page", params);
}
export function getWorkOrderCountByStatus() {
return get<WorkOrderCountData>("/rest/inspect/wo/countByStatus");
}
export type WorkOrderDetailResult<T = unknown> = T;
export function getWorkOrderDetail<T = unknown>(id: number | string) {
return get<WorkOrderDetailResult<T>>(`/rest/inspect/wo/detail/${id}`);
}
/** 成功时业务 `data` 为报告 H5 完整链接(字符串) */
export function getWorkOrderH5Url(id: number | string) {
return get<string>(`/rest/inspect/wo/getH5Url/${id}`);
}
@use "variables" as *;
// ===== Vant 主题定制(通过 CSS 变量覆盖)=====
:root {
// 主色
--van-primary-color: #{$color-primary};
--van-success-color: #{$color-success};
--van-warning-color: #{$color-warning};
--van-danger-color: #{$color-danger};
// 文字
--van-text-color: #{$color-text-primary};
--van-text-color-2: #{$color-text-secondary};
--van-text-color-3: #{$color-text-disabled};
// 背景
--van-background: #{$color-bg-page};
--van-background-2: #{$color-bg-card};
// 边框
--van-border-color: #{$color-border};
// 业务 CSS 变量
--color-primary: #{$color-primary};
--color-primary-light: #{$color-primary-light};
--color-bg-page: #{$color-bg-page};
--color-bg-card: #{$color-bg-card};
--color-text-primary: #{$color-text-primary};
--color-text-secondary: #{$color-text-secondary};
--color-border: #{$color-border};
--tabbar-height: #{$tabbar-height};
--navbar-height: #{$navbar-height};
--safe-area-bottom: #{$safe-area-bottom};
}
// ===== 滚动条隐藏(移动端) =====
* {
scrollbar-width: none;
-ms-overflow-style: none;
&::-webkit-scrollbar {
display: none;
}
}
// ===== 页面容器 =====
.page-container {
width: 100%;
min-height: 100vh;
background-color: var(--color-bg-page);
}
.page-content {
padding: 12px;
}
// ===== 卡片 =====
.card {
overflow: hidden;
background-color: var(--color-bg-card);
border-radius: 8px;
box-shadow: 0 1px 4px rgb(0 0 0 / 6%);
}
// ===== 分割线 =====
.divider {
height: 1px;
margin: 0;
background-color: var(--color-border);
&--vertical {
width: 1px;
height: 100%;
margin: 0;
}
}
// ===== 空状态 =====
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 48px 16px;
font-size: $font-size-sm;
color: $color-text-disabled;
.empty-icon {
margin-bottom: 12px;
font-size: 48px;
}
}
// ===== 带底部安全区的内容 =====
.safe-bottom {
padding-bottom: calc(#{$tabbar-height} + env(safe-area-inset-bottom));
}
// ===== 价格标签 =====
.price-tag {
font-weight: 700;
color: $color-primary;
.unit {
font-size: $font-size-sm;
font-weight: 400;
}
.amount {
font-size: $font-size-xl;
}
}
*,
*::before,
*::after {
box-sizing: border-box;
padding: 0;
margin: 0;
-webkit-tap-highlight-color: transparent;
}
html {
overflow-x: hidden;
font-size: 16px;
text-size-adjust: 100%;
scroll-behavior: smooth;
}
body {
padding: 0;
margin: 0;
overflow-x: hidden;
overscroll-behavior: none;
line-height: 1.5;
color: #323233;
background-color: #f7f8fa;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
// ===== 最大宽度限制(超过 430px 居中显示,手机端正常自适应)=====
// rem 根字号上限与 utils/flexible.ts 中 LAYOUT_MAX_WIDTH 保持一致
// #app 已加入 postcss-pxtorem selectorBlackList,px 不会被转 rem
#app {
position: relative;
max-width: 430px;
min-height: 100vh;
margin: 0 auto;
overflow-x: hidden;
background-color: #f7f8fa;
}
// Vant 弹层 teleport 挂载点:父级带 transform 后内部 position:fixed 相对该层计算,宽度与 #app 一致,避免 Pad 上遮罩/面板撑满视口
// 宽度需与上方 max-width、utils/flexible.ts 中 LAYOUT_MAX_WIDTH 保持一致
#vant-portal-host {
position: fixed;
top: 0;
left: 50%;
z-index: 3000;
width: 100%;
max-width: 430px;
height: 100%;
pointer-events: none;
transform: translateX(-50%);
}
#vant-portal-host .van-overlay,
#vant-portal-host .van-popup {
pointer-events: auto;
}
// Vant ImagePreview 桌面端:预览项只监听 touch,全屏 popup 又叠在 overlay 之上,导致鼠标点「遮罩」关不掉;
// 关闭按钮 z-index 偏低时还会被 swipe 层盖住。允许点击穿透 popup,仅图片/关闭/页码接收事件,让底层 overlay 处理关闭。
@media (hover: hover) and (pointer: fine) {
#vant-portal-host .van-popup.van-image-preview {
pointer-events: none;
}
#vant-portal-host .van-popup.van-image-preview .van-image-preview__close-icon,
#vant-portal-host .van-popup.van-image-preview .van-image-preview__image,
#vant-portal-host .van-popup.van-image-preview .van-image-preview__image-wrap,
#vant-portal-host .van-popup.van-image-preview .van-image-preview__index,
#vant-portal-host .van-popup.van-image-preview .van-image-preview__cover {
pointer-events: auto;
}
#vant-portal-host .van-popup.van-image-preview .van-image-preview__close-icon {
z-index: 10;
}
}
a {
color: inherit;
text-decoration: none;
-webkit-tap-highlight-color: transparent;
}
img {
display: block;
max-width: 100%;
border: none;
}
input,
textarea,
button,
select {
font-family: inherit;
font-size: inherit;
outline: none;
background: none;
border: none;
}
ul,
ol {
list-style: none;
}
// 禁用用户选择(移动端常用)
.no-select {
user-select: none;
}
// 单行省略
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
// 多行省略
.ellipsis-2 {
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.ellipsis-3 {
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
// 全屏容器
.full-screen {
width: 100%;
min-height: 100vh;
}
// flex 常用工具
.flex {
display: flex;
}
.flex-center {
display: flex;
align-items: center;
justify-content: center;
}
.flex-between {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex-col {
display: flex;
flex-direction: column;
}
// ===== 品牌色 =====
$color-primary: #1989fa;
$color-primary-light: #1989fa;
$color-primary-dark: #1989fa;
// ===== 功能色 =====
$color-success: #07c160;
$color-warning: #ff976a;
$color-danger: #1989fa;
$color-info: #1989fa;
// ===== 文字色 =====
$color-text-primary: #323233;
$color-text-secondary: #646566;
$color-text-disabled: #c8c9cc;
$color-text-placeholder: #969799;
$color-text-inverse: #fff;
// ===== 背景色 =====
$color-bg-page: #f7f8fa;
$color-bg-card: #fff;
$color-bg-overlay: rgb(0 0 0 / 50%);
// ===== 边框色 =====
$color-border: #ebedf0;
$color-border-light: #f2f3f5;
// ===== 间距 =====
$spacing-xs: 4px;
$spacing-sm: 8px;
$spacing-md: 12px;
$spacing-base: 16px;
$spacing-lg: 20px;
$spacing-xl: 24px;
$spacing-xxl: 32px;
// ===== 字体大小 =====
$font-size-xs: 10px;
$font-size-sm: 12px;
$font-size-base: 14px;
$font-size-md: 16px;
$font-size-lg: 18px;
$font-size-xl: 20px;
$font-size-xxl: 24px;
// ===== 圆角 =====
$radius-sm: 4px;
$radius-base: 8px;
$radius-md: 12px;
$radius-lg: 16px;
$radius-full: 9999px;
// ===== 阴影 =====
$shadow-sm: 0 1px 4px rgb(0 0 0 / 8%);
$shadow-base: 0 2px 12px rgb(0 0 0 / 10%);
$shadow-lg: 0 4px 20px rgb(0 0 0 / 15%);
// ===== 过渡 =====
$transition-base: all 0.3s ease;
$transition-fast: all 0.15s ease;
// ===== 底部安全区 =====
$safe-area-bottom: env(safe-area-inset-bottom);
// ===== TabBar 高度 =====
$tabbar-height: 50px;
$navbar-height: 46px;
@tailwind base;
@tailwind components;
@tailwind utilities;
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
declare module 'vue' {
export interface GlobalComponents {
ButtonSelect: typeof import('./components/CustomizeForm/buttonSelect.vue')['default']
ButtonSelectAndImageUpload: typeof import('./components/CustomizeForm/buttonSelectAndImageUpload.vue')['default']
CustomizeUploadFile: typeof import('./components/CustomizeForm/customizeUploadFile.vue')['default']
Index: typeof import('./components/CustomizeForm/Index.vue')['default']
Layouts: typeof import('./layouts/index.vue')['default']
LogoutConfirmModal: typeof import('./components/LogoutConfirmModal.vue')['default']
PageTitle: typeof import('./components/PageTitle.vue')['default']
PageTop: typeof import('./components/PageTop.vue')['default']
RadioSelect: typeof import('./components/CustomizeForm/radioSelect.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
SelectDatePicker: typeof import('./components/CustomizeForm/selectDatePicker.vue')['default']
SelectDropdown: typeof import('./components/CustomizeForm/selectDropdown.vue')['default']
VanActionSheet: typeof import('vant/es')['ActionSheet']
VanButton: typeof import('vant/es')['Button']
VanDatePicker: typeof import('vant/es')['DatePicker']
VanDialog: typeof import('vant/es')['Dialog']
VanEmpty: typeof import('vant/es')['Empty']
VanField: typeof import('vant/es')['Field']
VanForm: typeof import('vant/es')['Form']
VanIcon: typeof import('vant/es')['Icon']
VanImage: typeof import('vant/es')['Image']
VanImagePreview: typeof import('vant/es')['ImagePreview']
VanList: typeof import('vant/es')['List']
VanLoading: typeof import('vant/es')['Loading']
VanOverlay: typeof import('vant/es')['Overlay']
VanPicker: typeof import('vant/es')['Picker']
VanPopup: typeof import('vant/es')['Popup']
VanProgress: typeof import('vant/es')['Progress']
VanPullRefresh: typeof import('vant/es')['PullRefresh']
VanRadio: typeof import('vant/es')['Radio']
VanRadioGroup: typeof import('vant/es')['RadioGroup']
VanSearch: typeof import('vant/es')['Search']
VanSkeleton: typeof import('vant/es')['Skeleton']
VanSlider: typeof import('vant/es')['Slider']
VanSwipe: typeof import('vant/es')['Swipe']
VanSwipeItem: typeof import('vant/es')['SwipeItem']
VanTab: typeof import('vant/es')['Tab']
VanTabbar: typeof import('vant/es')['Tabbar']
VanTabbarItem: typeof import('vant/es')['TabbarItem']
VanTabs: typeof import('vant/es')['Tabs']
VanTag: typeof import('vant/es')['Tag']
WorkOrderStatusTags: typeof import('./components/WorkOrderStatusTags.vue')['default']
}
}
<script setup lang="ts">
import { computed, onMounted, ref, watch } from "vue";
const props = defineProps({
item: {
type: Object,
default: () => { },
}
});
const emit = defineEmits(["update"]);
const pickerValue = ref([]);
// 页面加载时初始化数据
onMounted(() => {
initData();
});
// 初始化数据
function initData() {
pickerValue.value = [];
if (props?.item?.inspectionResultVO) {
const inspectionValueList = props?.item?.inspectionResultVO?.inspectionValueList || [];
for (const i of inspectionValueList) {
if (i.valueText && i.interactionType == "button_select") { pickerValue.value.push(i.valueKey); }
}
}
setupdate();
}
// 计算属性
const columnsList = computed(() => {
const optionsList = JSON.parse(props.item.options || "[]").map(item => {
const valueList = (item || "").split("-");
return {
text: valueList[1] || "",
value: valueList[0] || "",
};
});
return optionsList;
});
// 监听item.resultStatus变化
watch(() => props.item.resultStatus, (newVal) => {
if (newVal) {
pickerValue.value = [];
setupdate();
}
});
function handleBut(item: { value: string }) {
if (item.value) {
props.item.resultStatus = false;
}
if (pickerValue.value.includes(item.value)) {
pickerValue.value = pickerValue.value.filter((i) => i !== item.value);
} else {
pickerValue.value.push(item.value);
}
setupdate();
}
function setupdate() {
const valueList = (pickerValue.value || []).map(item => {
const object = (columnsList.value || []).find(finditem => finditem.value == item) || {};
return {
valueText: object.text || "",
valueKey: item || "",
};
});
if (valueList.length > 0) {
emit("update", JSON.stringify(valueList || []));
} else {
emit("update", "");
}
}
</script>
<template>
<div class="buttonSelect">
<div class="title">
<span v-if="item.required === 1" class="isRequired">*</span>
<span>{{ item.nodeName }}</span>
</div>
<div class="selectList">
<div v-for="(col, index) in columnsList" :key="index" class="selectBut"
:class="{ 'pitchOn': pickerValue.includes(col.value) }" @click="handleBut(col)">
{{ col.text }}
<div v-if="pickerValue.includes(col.value)" class="pitchImg"></div>
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.buttonSelect {
float: left;
width: 100%;
background: #fff;
}
.title {
float: left;
width: 100%;
height: 24px;
padding-left: 16px;
margin-top: 16px;
margin-bottom: 10px;
font-size: 14px;
line-height: 24px;
color: #141e34;
}
.isRequired {
padding-right: 2px;
font-size: 14px;
color: #ee3040;
}
.selectList {
width: 100%;
}
.selectBut {
position: relative;
float: left;
height: 36px;
margin-right: 6px;
margin-bottom: 12px;
margin-left: 6px;
font-size: 14px;
font-weight: 400;
line-height: 36px;
color: #333;
text-align: center;
cursor: pointer;
background: #f9f9f9;
border: 1px solid #f9f9f9;
border-radius: 6px;
padding: 0 16px;
min-width: 30%;
}
.pitchOn {
color: #185EFE !important;
background: #ecf1ff !important;
border: 1px solid #185efe !important;
}
.pitchImg {
position: absolute;
top: 0;
right: 0;
z-index: 99;
width: 16px;
height: 16px;
background-image: url("https://img02.glsx.com.cn/aus/images/preference/pitchOn.png");
background-repeat: no-repeat;
background-size: 100%;
}
</style>
<script setup lang="ts">
import { onMounted, computed, ref } from "vue";
import { uploadFile } from "@/utils/upload.js";
import { showToast } from "vant";
const props = defineProps({
item: {
type: Object,
default: () => { },
},
});
const emit = defineEmits(["update"]);
const uploading = ref(false);
const pickerValue = ref([]);
const fileInputRef = ref<HTMLInputElement | null>(null);
function pickFile() {
if (props.item.resultStatus) {
showToast("无此结构无需上传图片");
return;
}
fileInputRef.value?.click();
}
// 页面加载时初始化数据
onMounted(() => {
initData();
});
// 初始化数据
function initData() {
pickerValue.value = [];
if (props?.item?.inspectionResultVO) {
const inspectionValueList = props?.item?.inspectionResultVO?.inspectionValueList || [];
for (const i of inspectionValueList) {
if (i.valueText && i.interactionType == "image_upload") { pickerValue.value.push(i.valueText) }
}
}
updateData();
}
// 监听item.resultStatus变化
watch(() => props.item.resultStatus, (newVal) => {
if (newVal) {
pickerValue.value = [];
updateData();
}
});
// 计算属性
const validationRules = computed(() => {
return JSON.parse(props.item.validationRules || "{}");
});
async function onFileChange(ev: Event) {
const input = ev.target as HTMLInputElement;
const file = input.files?.[0];
input.value = "";
if (!file) return;
const maxSize10MB = 10 * 1024 * 1024;
if (file.size > maxSize10MB) {
showToast("文件大小不能超过10MB");
return;
}
uploading.value = true;
try {
const res = await uploadFile(file);
const url = (typeof res.aliyunAddress === "string" && res.aliyunAddress) || (typeof res.url === "string" && res.url) || "";
showToast("上传成功");
pickerValue.value.push(url);
updateData();
} catch (error: unknown) {
const msg = error instanceof Error ? error.message : String(error);
showToast(`上传失败:${msg}`);
} finally {
uploading.value = false;
}
}
function handleDelete(item: string) {
pickerValue.value = pickerValue.value.filter((i) => i !== item);
updateData();
}
function updateData() {
if (pickerValue.value.length > 0) {
emit("update", JSON.stringify(pickerValue.value));
} else {
emit("update", "");
}
}
// 图片预览
const imagePreview = ref(false);
const previewImagesList = ref([]);
function previewImage(url: string) {
previewImagesList.value = [url];
imagePreview.value = true;
}
</script>
<template>
<div>
<van-overlay :show="uploading" teleport="#vant-portal-host" z-index="2000">
<div class="loadingBox">
<van-loading color="#1989fa" size="24px" vertical>上传中...</van-loading>
</div>
</van-overlay>
<van-image-preview v-model:show="imagePreview" :closeable="true" :close-on-click-image="false" :images="previewImagesList"></van-image-preview>
<div class="buttonSelect">
<div class="title">
<div class="titleContent">
<span v-if="item.value" class="isRequired">*</span>
<span>异常图片</span>
</div>
<div class="titleTip">
有损伤请拍摄图片,无损伤请忽略
</div>
</div>
<input ref="fileInputRef" accept="image/*" class="hidden-input" type="file" @change="onFileChange">
<div class="uploadPage">
<div v-if="(validationRules.maxCount || 3) > pickerValue.length" class="uploadBox" @click="pickFile">
<van-icon class="plusBox" color="#999999" name="plus" size="24" />
<div class="uploadTxt">
添加照片
</div>
</div>
<div v-for="(url, index) in pickerValue" :key="index" class="uploadBox">
<div class="deleteBox" @click="handleDelete(url)">
<van-icon color="#999999" name="clear" size="20" />
</div>
<van-image :src="url" @click="previewImage(url)" class="uploadBoxImg" width="96" height="96"
radius="8px" />
</div>
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.buttonSelect {
float: left;
width: 100%;
background: #fff;
}
.title {
float: left;
width: 100%;
padding-left: 16px;
margin-top: 16px;
margin-bottom: 10px;
}
.titleContent {
float: left;
width: 100%;
height: 24px;
font-size: 14px;
line-height: 24px;
color: #141e34;
}
.titleTip {
float: left;
width: 100%;
height: 16px;
font-size: 12px;
font-weight: 400;
line-height: 16px;
color: #999;
}
.isRequired {
padding-right: 2px;
font-size: 14px;
color: #ee3040;
}
.hidden-input {
position: absolute;
width: 0;
height: 0;
pointer-events: none;
opacity: 0;
}
.uploadPage {
float: left;
width: calc(100% - 24px);
margin-left: 12px;
}
.uploadBox {
position: relative;
float: left;
width: 96px;
height: 96px;
margin-right: 12px;
margin-bottom: 16px;
background: #f9f9f9;
border-radius: 8px;
}
.uploadBoxImg {
width: 96px;
height: 96px;
border-radius: 8px;
}
.plusBox {
float: left;
margin-top: 22px;
margin-right: 36px;
margin-left: 36px;
}
.uploadTxt {
float: left;
width: 100%;
height: 20px;
margin-top: 8px;
font-size: 12px;
font-weight: 400;
line-height: 20px;
color: #999;
text-align: center;
}
.deleteBox {
position: absolute;
top: 2px;
right: 2px;
z-index: 99;
width: 20px;
height: 20px;
cursor: pointer;
}
.loadingBox {
position: absolute;
top: 50%;
left: 50%;
width: 80px;
height: 80px;
transform: translate(-50%, -50%);
}
</style>
<script setup lang="ts">
import { computed, onMounted, ref } from "vue";
import { uploadFile } from "@/utils/upload.js";
import { showToast } from "vant";
const props = defineProps({
item: {
type: Object,
default: () => {},
},
});
const emit = defineEmits(["update"]);
const uploading = ref(false);
const pickerValue = ref([]);
const fileInputRef = ref<HTMLInputElement | null>(null);
function pickFile() {
fileInputRef.value?.click();
}
// 页面加载时初始化数据
onMounted(() => {
initData();
});
// 初始化数据
function initData() {
pickerValue.value = [];
if (props?.item?.inspectionResultVO) {
const inspectionValueList = props?.item?.inspectionResultVO?.inspectionValueList || [];
for (const i of inspectionValueList) {
if (i.valueText) { pickerValue.value.push(i.valueText); }
}
}
updateData();
}
// 计算属性
const validationRules = computed(() => {
return JSON.parse(props.item.validationRules || "{}");
});
async function onFileChange(ev: Event) {
const input = ev.target as HTMLInputElement;
const file = input.files?.[0];
input.value = "";
if (!file) return;
const maxSize10MB = 10 * 1024 * 1024;
const maxSize100MB = 100 * 1024 * 1024;
if (props.item.interactionType == "image_upload" && file.size > maxSize10MB) {
showToast("文件大小不能超过10MB");
return;
}
if (props.item.interactionType == "video_upload" && file.size > maxSize100MB) {
showToast("文件大小不能超过100MB");
return;
}
uploading.value = true;
try {
const res = await uploadFile(file);
const url = (typeof res.aliyunAddress === "string" && res.aliyunAddress) || (typeof res.url === "string" && res.url) || "";
showToast("上传成功");
pickerValue.value.push(url);
console.log("pickerValue.value", pickerValue.value);
sourceSrcUrl.value = "";
sourceUrl.value = [];
videoShow.value = false;
updateData();
} catch (error: unknown) {
const msg = error instanceof Error ? error.message : String(error);
showToast(`上传失败:${msg}`);
} finally {
uploading.value = false;
}
}
function handleDelete(item: string) {
pickerValue.value = pickerValue.value.filter((i) => i !== item);
console.log("pickerValue.value111111111111111", pickerValue.value);
// 清除视频预览状态,防止缓存
sourceSrcUrl.value = "";
sourceUrl.value = [];
videoShow.value = false;
updateData();
}
function updateData() {
if (pickerValue.value.length > 0) {
emit("update", JSON.stringify(pickerValue.value));
} else {
emit("update", "");
}
}
// 图片预览
const imagePreview = ref(false);
const previewImagesList = ref([]);
function previewImage(url: string) {
previewImagesList.value = [url];
imagePreview.value = true;
}
// 视频预览
const videoShow = ref(false);
const sourceUrl = ref([]);
const sourceSrcUrl = ref("");
function previewVideo(url: string) {
// 添加时间戳参数,防止浏览器缓存
const timestamp = new Date().getTime();
const urlWithTimestamp = url.includes('?') ? `${url}&t=${timestamp}` : `${url}?t=${timestamp}`;
sourceSrcUrl.value = urlWithTimestamp;
sourceUrl.value = [urlWithTimestamp];
console.log("sourceUrl.value", sourceUrl.value);
videoShow.value = true;
}
</script>
<template>
<div>
<van-overlay :show="uploading"
teleport="#vant-portal-host"
z-index="2000">
<div class="loadingBox">
<van-loading color="#1989fa"
size="24px"
vertical>
上传中...
</van-loading>
</div>
</van-overlay>
<!-- 图片预览 -->
<van-image-preview v-model:show="imagePreview" :closeable="true" :close-on-click-image="false" :images="previewImagesList"></van-image-preview>
<!-- 视频预览 -->
<van-image-preview v-model:show="videoShow"
:close-on-click-image="false"
:closeable="true"
:images="sourceUrl">
<template #image="{ src }">
<video controls style="width: 100%;">
<source :src="sourceSrcUrl" />
</video>
</template>
</van-image-preview>
<div class="buttonSelect">
<div class="title">
<div class="titleContent">
<span v-if="item.required === 1" class="isRequired">*</span>
<span>{{ item.nodeName }}</span>
</div>
<div v-if="validationRules.maxCount && validationRules.maxCount.length > 1 && item.interactionType == 'image_upload'"
class="titleTip">
有损伤请拍摄图片,无损伤请忽略
</div>
</div>
<input ref="fileInputRef"
:accept="item.interactionType == 'image_upload' ? 'image/*' : 'video/*'"
class="hidden-input"
type="file"
@change="onFileChange">
<div class="uploadPage">
<div v-if="(validationRules.maxCount || 3) > pickerValue.length"
class="uploadBox"
@click="pickFile">
<van-icon class="plusBox"
color="#999999"
name="plus"
size="24" />
<div class="uploadTxt">
{{ item.interactionType == 'image_upload' ? '添加照片' : '添加视频' }}
</div>
</div>
<div v-for="(url, index) in pickerValue"
:key="index"
class="uploadBox">
<!-- 删除按钮 -->
<div class="deleteBox" @click="handleDelete(url)">
<van-icon color="#999999"
name="clear"
size="20" />
</div>
<!-- 图片 -->
<van-image v-if="item.interactionType == 'image_upload'"
class="uploadBoxImg"
radius="8px"
:src="url"
@click="previewImage(url)" />
<!-- 视频 -->
<video v-if="item.interactionType == 'video_upload'"
class="uploadBoxImg"
controls
:src="url">
您的浏览器不支持 video 标签。
</video>
<!-- 点击视频预览 -->
<div v-if="item.interactionType == 'video_upload'"
class="videoPreviewBox"
@click="previewVideo(url)">
</div>
</div>
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.buttonSelect {
float: left;
width: 100%;
background: #fff;
}
.title {
float: left;
width: 100%;
padding-left: 16px;
margin-top: 16px;
margin-bottom: 10px;
}
.titleContent {
float: left;
width: 100%;
height: 24px;
font-size: 14px;
line-height: 24px;
color: #141e34;
}
.titleTip {
float: left;
width: 100%;
height: 16px;
font-size: 12px;
font-weight: 400;
line-height: 16px;
color: #999;
}
.isRequired {
padding-right: 2px;
font-size: 14px;
color: #ee3040;
}
.hidden-input {
position: absolute;
width: 0;
height: 0;
pointer-events: none;
opacity: 0;
}
.uploadPage {
float: left;
width: calc(100% - 24px);
margin-left: 12px;
}
.uploadBox {
position: relative;
float: left;
width: 96px;
height: 96px;
margin-right: 12px;
margin-bottom: 16px;
background: #f9f9f9;
border: 1px solid #f9f9f9;
border-radius: 8px;
}
.uploadBoxImg {
width: 100%;
height: 100%;
z-index: 9;
border-radius: 8px;
}
.plusBox {
float: left;
margin-top: 22px;
margin-right: 36px;
margin-left: 36px;
}
.uploadTxt {
float: left;
width: 100%;
height: 20px;
margin-top: 8px;
font-size: 12px;
font-weight: 400;
line-height: 20px;
color: #999;
text-align: center;
}
.deleteBox {
position: absolute;
top: 2px;
right: 2px;
z-index: 999;
width: 20px;
height: 20px;
cursor: pointer;
}
.loadingBox {
position: absolute;
top: 50%;
left: 50%;
width: 80px;
height: 80px;
transform: translate(-50%, -50%);
}
.videoPreviewBox {
position: absolute;
top: 0px;
left: 0;
width: 96px;
height: 96px;
background: rgba(0, 0, 0, 0.5);
opacity: 0.1;
z-index: 9;
}
</style>
<script setup lang="ts">
import { computed, onMounted, ref } from "vue";
const props = defineProps({
item: {
type: Object,
default: () => {},
},
});
const emit = defineEmits(["update"]);
const pickerValue = ref("");
// 页面加载时初始化数据
onMounted(() => {
initData();
});
// 初始化数据
function initData() {
pickerValue.value = "";
if (props?.item?.inspectionResultVO) {
const inspectionValueList = props?.item?.inspectionResultVO?.inspectionValueList || [];
if (inspectionValueList && inspectionValueList.length > 0) {
pickerValue.value = inspectionValueList[0].valueKey || "";
}
}
}
// 计算属性
const columnsList = computed(() => {
const optionsList = JSON.parse(props.item.options || "[]").map(item => {
const valueList = (item || "").split("-");
return {
text: valueList[1] || "",
value: valueList[0] || "",
};
});
return optionsList;
});
function handleBut() {
const selected = columnsList.value.find((col) => col.value === pickerValue.value);
emit("update", {
value: selected?.value || "",
valueText: selected?.text || "",
valueKey: selected?.value || "",
});
}
function getLabelWidth(nodeName: string) {
let widtPx = 76;
if (nodeName.length > 4) {
widtPx = widtPx + ((nodeName.length - 4) * 12);
}
return widtPx;
}
</script>
<template>
<van-field v-model="pickerValue"
:label="item.nodeName"
name="radio"
:required="item.required === 1" :label-width="getLabelWidth(item.nodeName) + 'px'">
<template #input>
<div class="templateBox">
<van-radio-group v-model="pickerValue"
direction="horizontal"
style="float: right;"
@change="handleBut">
<van-radio v-for="col in columnsList"
:key="col.value"
icon-size="14px"
:name="col.value">
{{ col.text }}
</van-radio>
</van-radio-group>
</div>
</template>
</van-field>
</template>
<style lang="scss" scoped>
.templateBox {
width: 100%;
}
</style>
<script setup lang="ts">
import { computed, onMounted, ref } from "vue";
const props = defineProps({
item: {
type: Object,
default: () => { },
},
});
const emit = defineEmits(["update"]);
const displayValue = computed({
get: () => String(props.item.value ?? ""),
set: (v: string) => emit("update", v),
});
const columnsType = ref(["year", "month", "day"]);
const showPicker = ref(false);
const pickerValue = ref([]);
// 页面加载时初始化数据
onMounted(() => {
initData();
});
// 初始化数据
function initData() {
const validationRules = JSON.parse(props.item.validationRules || "{}");
if (validationRules.datePattern && validationRules.datePattern.length > 8) {
columnsType.value = ["year", "month", "day"];
} else {
columnsType.value = ["year", "month"];
}
}
function handleShowPicker() {
showPicker.value = true;
if (!props.item.value) {
const date = new Date();
if (columnsType.value.length === 2) {
pickerValue.value = [date.getFullYear(), date.getMonth() + 1];
} else {
pickerValue.value = [date.getFullYear(), date.getMonth() + 1, date.getDate()];
}
} else {
const dateArr = props.item.value.split("-");
if (columnsType.value.length === 2) {
pickerValue.value = [dateArr[0], dateArr[1]];
} else {
pickerValue.value = dateArr;
}
}
}
function onConfirm() {
let picker = "";
if (pickerValue.value.length > 0) {
picker = pickerValue.value.join("-");
}
showPicker.value = false;
emit("update", picker);
}
function getLabelWidth(nodeName: string) {
let widtPx = 76;
if (nodeName.length > 4) {
widtPx = widtPx + ((nodeName.length - 4) * 12);
}
return widtPx;
}
</script>
<template>
<div>
<van-field v-model="displayValue" clearable is-link :label="item.nodeName" name="datePicker"
:placeholder="item.placeholder" readonly :required="item.required === 1" @click="handleShowPicker"
input-align="right" :label-width="getLabelWidth(item.nodeName) + 'px'" />
<van-popup v-model:show="showPicker" destroy-on-close position="bottom" teleport="#vant-portal-host">
<van-date-picker v-model="pickerValue" :columns-type="columnsType" :title="item.nodeName"
@cancel="showPicker = false" @confirm="onConfirm" />
</van-popup>
</div>
</template>
<style lang="scss" scoped></style>
<script setup lang="ts">
import { computed, onMounted, ref } from "vue";
const props = defineProps({
item: {
type: Object,
default: () => {},
},
carTypeList: {
type: Array,
default: () => {},
},
});
const emit = defineEmits(["update"]);
const showPicker = ref(false);
const pickerValue = ref([]);
const displayValueText = computed({
get: () => String(props.item.valueText ?? ""),
set: (v: string) => {
if (!v) {
emit("update", { value: "", valueText: "", valueKey: "" });
return;
}
emit("update", {
value: String(props.item.value ?? ""),
valueText: v,
valueKey: String(props.item.valueKey ?? ""),
});
},
});
// 页面加载时初始化数据
onMounted(() => {
initData();
});
// 初始化数据
function initData() {
pickerValue.value = [];
if (props?.item?.inspectionResultVO) {
const inspectionValueList = props?.item?.inspectionResultVO?.inspectionValueList || [];
if (inspectionValueList && inspectionValueList.length > 0 && inspectionValueList[0].valueKey) {
pickerValue.value = [inspectionValueList[0].valueKey];
}
}
onConfirm();
}
// 计算属性
const columnsList = computed(() => {
const optionsList = JSON.parse(props.item.options || "[]").map(item => {
const valueList = (item || "").split("-");
return {
text: valueList[1] || "",
value: valueList[0] || "",
};
});
return props.item.nodeName === "车型" ? props.carTypeList : optionsList;
});
function onConfirm() {
const picker = pickerValue.value && pickerValue.value.length > 0 ? pickerValue.value[0] : "";
showPicker.value = false;
const selected = columnsList.value.find((col) => col.value === picker) || {};
emit("update", {
value: selected.value || "",
valueText: selected.text || "",
valueKey: selected.value || "",
});
}
function getLabelWidth(nodeName: string) {
let widtPx = 76;
if (nodeName.length > 4) {
widtPx = widtPx + ((nodeName.length - 4) * 12);
}
return widtPx;
}
</script>
<template>
<div>
<van-field v-model="displayValueText"
clearable
is-link
:label="item.nodeName"
name="datePicker"
:placeholder="item.placeholder"
readonly
:required="item.required === 1"
@click="showPicker = true" input-align="right" :label-width="getLabelWidth(item.nodeName) + 'px'" />
<van-popup v-model:show="showPicker"
destroy-on-close
position="bottom"
teleport="#vant-portal-host">
<van-picker v-model="pickerValue"
:columns="columnsList"
:title="item.nodeName"
@cancel="showPicker = false"
@confirm="onConfirm" />
</van-popup>
</div>
</template>
<style lang="scss" scoped></style>
<template>
<van-popup class="logout-confirm-popup"
:close-on-click-overlay="true"
position="center"
round
:show="show"
teleport="#vant-portal-host"
@update:show="emit('update:show', $event)">
<div class="logout-confirm">
<van-icon class="logout-confirm__close"
name="cross"
@click="close" />
<div class="logout-confirm__top">
<img alt=""
class="logout-confirm__bg"
:src="popupBg" />
<div class="logout-confirm__hero">
<img alt=""
class="logout-confirm__icon"
:src="logoutWarningIcon" />
</div>
<h2 class="logout-confirm__title">
退出登录
</h2>
<p class="logout-confirm__desc">
是否确认退出登录?
</p>
</div>
<div class="logout-confirm__actions">
<button class="logout-confirm__btn logout-confirm__btn--cancel"
type="button"
@click="close">
取消
</button>
<button class="logout-confirm__btn logout-confirm__btn--confirm"
type="button"
@click="onConfirm">
确认
</button>
</div>
</div>
</van-popup>
</template>
<script setup lang="ts">
import logoutWarningIcon from "@/assets/image/logout-warning-icon.png";
import popupBg from "@/assets/image/popup-bg.png";
defineProps<{
show: boolean;
}>();
const emit = defineEmits<{
confirm: [];
"update:show": [value: boolean];
}>();
function close() {
emit("update:show", false);
}
function onConfirm() {
emit("confirm");
}
</script>
<style lang="scss" scoped>
@use "@assets/styles/variables" as *;
.logout-confirm-popup {
box-sizing: border-box;
width: calc(100vw - 48px);
max-width: 320px;
padding: 0;
overflow: visible;
background: transparent;
}
.logout-confirm {
position: relative;
padding: 0 0 20px;
overflow: hidden;
background: #fff;
border-radius: 18px;
box-shadow: $shadow-lg;
}
.logout-confirm__close {
position: absolute;
top: 12px;
right: 12px;
z-index: 3;
padding: 4px;
font-size: 20px;
color: #969799;
}
.logout-confirm__top {
position: relative;
z-index: 0;
padding-bottom: 4px;
overflow: hidden;
border-radius: 18px 18px 0 0;
}
.logout-confirm__bg {
position: absolute;
inset: 0;
z-index: 0;
display: block;
width: 100%;
height: 100%;
pointer-events: none;
object-fit: cover;
object-position: top center;
}
.logout-confirm__hero {
position: relative;
z-index: 1;
display: flex;
align-items: flex-end;
justify-content: center;
min-height: 132px;
padding: 28px 24px 0;
}
.logout-confirm__icon {
width: 88px;
height: auto;
margin-bottom: 4px;
}
.logout-confirm__title {
position: relative;
z-index: 1;
margin: 8px 20px 0;
font-size: 18px;
font-weight: 700;
line-height: 1.3;
color: #1a2744;
text-align: center;
}
.logout-confirm__desc {
position: relative;
z-index: 1;
margin: 10px 24px 0;
font-size: 14px;
line-height: 1.45;
color: $color-text-secondary;
text-align: center;
}
.logout-confirm__actions {
position: relative;
z-index: 1;
display: flex;
gap: 12px;
padding: 24px 20px 4px;
background: #fff;
border-radius: 0 0 18px 18px;
}
.logout-confirm__btn {
flex: 1;
height: 44px;
padding: 0 16px;
font-size: 16px;
line-height: 44px;
text-align: center;
cursor: pointer;
border: none;
border-radius: $radius-full;
transition: $transition-fast;
&:active {
opacity: 0.88;
}
}
.logout-confirm__btn--cancel {
font-weight: 400;
color: $color-text-secondary;
background: #f2f3f5;
}
.logout-confirm__btn--confirm {
font-weight: 500;
color: #fff;
background: $color-primary;
}
</style>
<script setup lang="ts">
defineProps<{
title: string;
}>();
</script>
<template>
<div class="page-title">
{{ title }}
</div>
</template>
<style lang="scss" scoped>
.page-title {
padding: 10px 0;
font-size: 17px;
line-height: 1.2;
color: #222;
text-align: center;
}
</style>
<!--
* @Author: cen
* @Date: 2026-03-18 18:09:39
* @Description:
* @FilePath: /venus-usedcar-h5/apps/web/venus-usedcar-quality/src/components/PageTop.vue
* @LastEditTime: 2026-04-03 14:13:59
* @LastEditors: cenchengwei@foreverht.com
* 可以输入预定的版权声明、个性签名、空行等
-->
<template>
<div class="page-top">
<slot />
</div>
</template>
<style lang="scss" scoped>
.page-top {
width: 100%;
// background: url("@assets/image/top_bg.png") no-repeat top center;
// background-size: 100% auto;
}
</style>
<!--
* @Author: cen
* @Date: 2026-03-26 10:52:58
* @Description:
* @FilePath: /venus-usedcar-h5/apps/web/venus-usedcar-quality/src/components/WorkOrderStatusTags.vue
* @LastEditTime: 2026-04-02 16:20:57
* @LastEditors: cenchengwei@foreverht.com
* 可以输入预定的版权声明、个性签名、空行等
-->
<script setup lang="ts">
import { computed } from "vue";
type WorkOrderStatus = 1 | 2 | 3 | 4;
type AuditStatus = 1 | 2 | 3 | 4;
const props = defineProps<{
auditStatus?: AuditStatus;
onlyAudit?: boolean;
status: WorkOrderStatus;
}>();
const checkTag = computed(() => {
switch (props.status) {
case 1: {
return { text: "待检测", bg: "#fef4e8", color: "#f59619" };
}
case 2: {
return { text: "检测中", bg: "#f0eefd", color: "#6a56f0" };
}
case 3: {
return { text: "检测完成", bg: "#e9f9f1", color: "#2cca74" };
}
default: {
return { text: "已取消", bg: "#f2f3f5", color: "#969799" };
}
}
});
const auditTag = computed(() => {
if (props.auditStatus === undefined) return null;
if (props.status !== 2 && props.status !== 3) return null;
// auditStatus: 1待审批;2审批中;3审批通过;4审批驳回
// 待审核(待审批/审批中)仅在「检测完成」Tab 展示,检测中不显示
if (props.auditStatus === 1 || props.auditStatus === 2) {
if (props.status !== 3) return null;
return { text: "待审核", bg: "#f0eefd", color: "#6A56F0", icon: "clock" as const };
}
if (props.auditStatus === 3) {
return { text: "已通过", bg: "#e9f9f1", color: "#27CD5A", icon: "checked" as const };
}
if (props.auditStatus === 4) {
return { text: "已驳回", bg: "#fdeded", color: "#EE3140", icon: "warning" as const };
}
return null;
});
</script>
<template>
<div class="wo-tags">
<van-tag v-if="!props.onlyAudit"
class="wo-tag"
:style="{ background: checkTag.bg, color: checkTag.color }">
{{ checkTag.text }}
</van-tag>
<van-tag v-if="auditTag"
class="wo-tag"
:style="{ background: auditTag.bg, color: auditTag.color }">
<van-icon class="wo-tag__icon"
:color="auditTag.color"
:name="auditTag.icon" />
{{ auditTag.text }}
</van-tag>
</div>
</template>
<style lang="scss" scoped>
.wo-tags {
display: flex;
gap: 6px;
align-items: center;
}
.wo-tag {
padding: 4px 6px;
font-size: 11px;
line-height: 1;
border: 0;
border-radius: 2px;
}
.wo-tag__icon {
font-size: 12px;
vertical-align: -1px;
}
</style>
import { onMounted, ref } from "vue";
const isPad = ref(false);
let inited = false;
const updateDevice = () => {
const width = window.innerWidth;
const height = window.innerHeight;
isPad.value = width >= 768 && width > height;
};
export function useDeviceLayout() {
if (typeof window !== "undefined" && !inited) {
updateDevice();
window.addEventListener("resize", updateDevice);
inited = true;
}
onMounted(() => {
if (typeof window !== "undefined" && !inited) {
updateDevice();
window.addEventListener("resize", updateDevice);
inited = true;
}
});
return {
isPad,
};
}
import { ref } from "vue";
import { showToast } from "vant";
interface UseRequestOptions<T> {
immediate?: boolean;
initialData?: T;
onError?: (error: unknown) => void;
onSuccess?: (data: T) => void;
}
export function useRequest<T>(
requestFn: () => Promise<T>,
options: UseRequestOptions<T> = {},
) {
const { immediate = false, initialData, onSuccess, onError } = options;
const data = ref<T | undefined>(initialData as T);
const loading = ref(false);
const error = ref<unknown>(null);
async function execute() {
loading.value = true;
error.value = null;
try {
const result = await requestFn();
data.value = result;
onSuccess?.(result);
return result;
} catch (error_) {
error.value = error_;
onError?.(error_);
throw error_;
} finally {
loading.value = false;
}
}
if (immediate) {
execute();
}
return { data, loading, error, execute };
}
interface UsePaginationOptions<T> {
onSuccess?: (list: T[], total: number) => void;
pageSize?: number;
}
export function usePagination<T>(
requestFn: (page: number, pageSize: number) => Promise<{ list: T[]; total: number }>,
options: UsePaginationOptions<T> = {},
) {
const { pageSize = 10, onSuccess } = options;
const list = ref<T[]>([]) as import("vue").Ref<T[]>;
const total = ref(0);
const page = ref(1);
const loading = ref(false);
const finished = ref(false);
const refreshing = ref(false);
async function loadMore() {
if (loading.value || finished.value) return;
loading.value = true;
try {
const res = await requestFn(page.value, pageSize);
list.value.push(...res.list);
total.value = res.total;
if (list.value.length >= res.total || res.list.length < pageSize) {
finished.value = true;
} else {
page.value += 1;
}
onSuccess?.(res.list, res.total);
} catch (error) {
showToast("加载失败,请重试");
throw error;
} finally {
loading.value = false;
refreshing.value = false;
}
}
async function refresh() {
page.value = 1;
list.value = [];
finished.value = false;
refreshing.value = true;
await loadMore();
}
return {
list,
total,
page,
loading,
finished,
refreshing,
loadMore,
refresh,
};
}
/**
* 配置中心 - 远程获取配置,使用 fetch 避免提前实例化导致 baseURL 无法动态获取
* 集成 glsk-toolkit Request 实例,统一请求能力
*/
import { Defaults, Request } from "glsk-toolkit";
import { showToast } from "vant";
import { CONFIG_CACHE_KEY, CONFIG_CENTER_URL, TOKEN_KEY } from "./constants";
const defaultBaseURL = import.meta.env.VITE_API_BASE_URL ?? "";
const APP_BASE_PATH = (() => {
const base = import.meta.env.BASE_URL ?? "/";
if (!base || base === "/") {
return "";
}
return base.endsWith("/") ? base.slice(0, -1) : base;
})();
let config: Record<string, unknown> = {};
let requestInstance: null | Request = null;
function getToken(): string {
const token = localStorage.getItem(TOKEN_KEY);
return token ? `Bearer ${token}` : "";
}
/**
* 获取 Request 实例
*/
export function getRequestApi(): null | Request {
return requestInstance;
}
/**
* 初始化 Request 实例(在 fetchConfig 中调用)
*/
function initRequestInstance(cfg: Record<string, unknown>): void {
const apiBaseUrl = ((
(cfg.apiEnv as undefined | { baseURL?: string; baseUrl?: string })?.baseURL ??
(cfg.apiEnv as undefined | { baseURL?: string; baseUrl?: string })?.baseUrl ??
cfg.apiBaseUrl ??
(cfg.gsc as undefined | { baseUrl?: string; baseURL?: string })?.baseUrl ??
(cfg.gsc as undefined | { baseUrl?: string; baseURL?: string })?.baseURL
) as string | undefined);
const baseUrl = apiBaseUrl || defaultBaseURL;
const requestConfig = {
baseUrl: baseUrl || "/",
baseURL: baseUrl || "/",
timeout: 15_000,
headers: {
"Content-Type": "application/json",
},
events: {
error: (error: unknown) => {
const err = error as { message?: string; msg?: string; response?: { status?: number } };
const msg = err?.msg ?? err?.message ?? String(error);
const status = err?.response?.status;
switch (status) {
case 401: {
showToast("登录已过期,请重新登录");
localStorage.removeItem(TOKEN_KEY);
window.location.href = `${APP_BASE_PATH}/login`;
break;
}
case 403: {
showToast("暂无权限");
break;
}
case 500: {
showToast("服务器异常,请稍后重试");
break;
}
default: {
showToast(msg || "网络错误,请检查网络连接");
}
}
},
},
};
const globalDefaults = new Defaults(requestConfig);
requestInstance = new Request(globalDefaults);
requestInstance.interceptors.request.use(
(reqConfig: Record<string, unknown>) => {
const token = getToken();
if (token) {
const headers = (reqConfig.headers as Record<string, string>) ?? {};
reqConfig.headers = { ...headers, Authorization: token };
}
return reqConfig;
},
(err: unknown) => Promise.reject(err)
);
}
/**
* 获取远程配置(不落 localStorage,每次调用都请求配置中心;登录页进入时由路由再次拉取)
*/
export async function fetchConfig(): Promise<Record<string, unknown>> {
try {
const res = await fetch(CONFIG_CENTER_URL, { cache: "no-store" });
const data = (await res.json()) as Record<string, unknown>;
if (data) {
config = (data?.data ?? data) as Record<string, unknown>;
initRequestInstance(config);
} else {
initRequestInstance({ apiBaseUrl: defaultBaseURL });
}
} catch (error) {
console.warn("[配置中心] 获取失败,使用默认配置:", error);
initRequestInstance({ apiBaseUrl: defaultBaseURL });
}
return config;
}
/** 获取当前配置 */
export function getConfig(): Record<string, unknown> {
return config;
}
/** 清空配置缓存 */
export function clearConfigCache(): void {
localStorage.removeItem(CONFIG_CACHE_KEY);
config = {};
requestInstance = null;
}
/*
* @Author: cen
* @Date: 2026-03-25 20:49:38
* @Description:
* @FilePath: /venus-usedcar-h5/apps/web/venus-usedcar-quality/src/config/constants.ts
* @LastEditTime: 2026-03-26 19:53:34
* @LastEditors: cenchengwei@foreverht.com
* 可以输入预定的版权声明、个性签名、空行等
*/
/**
* 应用级常量(配置中心、鉴权存储 key 等)
*/
/** 二手车 H5 配置请求 URL */
export const CONFIG_CENTER_URL =
"https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=venus-usedcar-config";
/** 配置缓存 key */
export const CONFIG_CACHE_KEY = "venus_usedcar_config";
/** localStorage:登录 token(存裸 token,请求头由封装层加 Bearer) */
export const TOKEN_KEY = "venus_usedcar_token";
/** sessionStorage:未登录时记录目标路径,登录成功后回跳 */
export const LOGIN_REDIRECT_KEY = "venus_usedcar_login_redirect";
export {
clearConfigCache,
fetchConfig,
getConfig,
getRequestApi,
} from "./center.ts";
export {
CONFIG_CACHE_KEY,
CONFIG_CENTER_URL,
LOGIN_REDIRECT_KEY,
TOKEN_KEY,
} from "./constants.ts";
export const OSS_CONFIG = {
BUCKET_NAME: "glsk-oss",
OSS_DOMAIN: "https://glsk-oss.oss-cn-shenzhen.aliyuncs.com",
FOLDER: "usedCarH5/",
/**
* glsk-oss-jssdk 需要的 systemSource(会传给 STS 凭证接口)
* H5 默认用 h5,按你们接口约定调整
*/
SYSTEM_SOURCE: "h5",
} as const;
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { RouterView, useRoute, useRouter } from "vue-router";
import tabMineOff from "@/assets/image/tab-mine-off.png";
import tabMineOn from "@/assets/image/tab-mine-on.png";
import tabReportOff from "@/assets/image/tab-report-off.png";
import tabReportOn from "@/assets/image/tab-report-on.png";
import tabWorkOrderOff from "@/assets/image/tab-work-order-off.png";
import tabWorkOrderOn from "@/assets/image/tab-work-order-on.png";
const route = useRoute();
const router = useRouter();
const showTabBar = computed(() => route.meta.showTabBar !== false);
const tabList = [
{ routeName: "Home", title: "检测工单", icon: tabWorkOrderOff, activeIcon: tabWorkOrderOn },
{ routeName: "CarList", title: "检测报告", icon: tabReportOff, activeIcon: tabReportOn },
{ routeName: "Mine", title: "我的", icon: tabMineOff, activeIcon: tabMineOn },
];
/**
* 数字下标 + v-model;勿给 TabbarItem 绑字符串 name。
* 变量勿命名 `active`:`#icon` 插槽会传入同名 prop,会遮蔽 setup 里的 ref,导致 tabbarIndex(false)→0、第一项误判为选中。
*/
const tabbarActive = ref(0);
/** 供模板(含 `#icon` 插槽)使用:在插槽内直接读 ref 可能解析失败→undefined→tabbarIndex 恒为 0,第一项图标永远「选中」 */
const currentTabbarIndex = computed(() => tabbarIndex(tabbarActive.value));
function tabbarIndex(val: unknown): number {
const n = typeof val === "number" ? val : Number(val);
return Number.isFinite(n) ? n : 0;
}
function routeToActiveIndex(): number {
const n = route.name;
if (typeof n === "string") {
const i = tabList.findIndex((t) => t.routeName === n);
if (i !== -1) return i;
}
const p = route.path;
if (p.includes("/home")) return 0;
if (p.includes("car-list")) return 1;
if (p.includes("/mine")) return 2;
return 0;
}
watch(
() => route.fullPath,
() => {
tabbarActive.value = routeToActiveIndex();
},
{ immediate: true },
);
/** 防止 v-model 偶发成字符串导致与 TabbarItem 内部 index 比较失败 */
watch(tabbarActive, (v: unknown) => {
const n = tabbarIndex(v);
if (n !== v) tabbarActive.value = n;
});
function onTabChange(index: number | string) {
const i = tabbarIndex(index);
const tab = tabList[i];
if (tab) {
// 保留 query(如 openType=miniApp),避免 Tab 切换后依赖 query 的状态丢失
router.push({ name: tab.routeName, query: { ...route.query } });
}
}
</script>
<template>
<div class="layout-default">
<RouterView v-slot="{ Component, route: currentRoute }">
<!-- 单 flex 子项,避免双 Transition 根节点参与 flex 时首帧把页头挤到底部 -->
<div class="layout-main">
<Transition mode="out-in" name="fade">
<KeepAlive>
<component :is="Component"
v-if="currentRoute.meta.keepAlive"
:key="currentRoute.fullPath" />
</KeepAlive>
</Transition>
<Transition mode="out-in" name="fade">
<component :is="Component"
v-if="!currentRoute.meta.keepAlive"
:key="currentRoute.fullPath" />
</Transition>
</div>
</RouterView>
<van-tabbar v-if="showTabBar"
v-model="tabbarActive"
active-color="#185efe"
inactive-color="#999999"
safe-area-inset-bottom
@change="onTabChange">
<van-tabbar-item v-for="(tab, idx) in tabList"
:key="tab.routeName">
{{ tab.title }}
<template #icon>
<img alt=""
class="tabbar-item-icon"
:src="currentTabbarIndex === idx ? tab.activeIcon : tab.icon" />
</template>
</van-tabbar-item>
</van-tabbar>
</div>
</template>
<style lang="scss" scoped>
.layout-default {
display: flex;
flex-direction: column;
width: 100%;
min-width: 0;
min-height: 100vh;
overflow-x: hidden;
background-color: var(--color-bg-page);
.layout-main {
display: flex;
flex: 1;
flex-direction: column;
min-width: 0;
min-height: 0;
}
// 让 RouterView 内容区占满剩余空间,tabbar 自然沉底
:deep(.van-tabbar) {
position: sticky;
bottom: 0;
width: 100%;
}
:deep(.van-tabbar-item__text) {
font-size: 10px;
font-weight: 400;
}
}
.tabbar-item-icon {
display: block;
width: 22px;
height: 22px;
object-fit: contain;
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.2s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
</style>
import { createApp } from "vue";
import { createPinia } from "pinia";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import App from "./App.vue";
import { fetchConfig } from "./config/center";
import router from "./router";
import { initFlexible } from "./utils/flexible";
import { initTokenBridge } from "./utils/webviewBridge";
import "vant/es/toast/style";
import "@assets/styles/reset.scss";
import "@assets/styles/index.scss";
import "@assets/tailwind.css";
async function bootstrap() {
initFlexible();
await fetchConfig();
const app = createApp(App);
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
app.use(pinia);
// 在路由守卫运行前,先把宿主注入的 token 初始化进 store
initTokenBridge();
app.use(router);
app.mount("#app");
}
bootstrap();
/*
* @Author: cen
* @Date: 2026-04-02 15:37:28
* @Description:
* @FilePath: /venus-usedcar-h5/apps/web/venus-usedcar-quality/src/router/index.ts
* @LastEditTime: 2026-04-03 14:18:49
* @LastEditors: cenchengwei@foreverht.com
* 可以输入预定的版权声明、个性签名、空行等
*/
import { createRouter, createWebHistory } from "vue-router";
import { fetchConfig } from "@/config/center";
import { LOGIN_REDIRECT_KEY } from "@/config/constants";
import { useUserStore } from "@stores/modules/user.ts";
import { closeToast, showLoadingToast } from "vant";
import routes from "./routes.ts";
const ROUTE_LOADING_DELAY_MS = 200;
let routeLoadingTimer: ReturnType<typeof setTimeout> | undefined;
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes,
scrollBehavior(_, _from, savedPosition) {
if (savedPosition) {
return savedPosition;
}
return { top: 0 };
},
});
// 不需要登录的白名单路由
const WHITE_LIST = new Set(["/inspect-detail", "/inspect-report", "/login"]);
router.beforeEach(async (to, from, next) => {
const userStore = useUserStore();
const hasToken = !!userStore.token;
// SPA 内进入登录页时再拉配置(首屏由 main 拉过;已登录去登录页会重定向,不必请求)
if (to.path === "/login" && from.matched.length > 0 && !hasToken) {
try {
await fetchConfig();
} catch {
/* 失败时沿用内存/默认配置 */
}
}
if (routeLoadingTimer !== undefined) {
clearTimeout(routeLoadingTimer);
routeLoadingTimer = undefined;
}
if (!to.meta.hideRouteLoading) {
routeLoadingTimer = window.setTimeout(() => {
routeLoadingTimer = undefined;
showLoadingToast({
message: "加载中...",
forbidClick: true,
duration: 0,
loadingType: "spinner",
});
}, ROUTE_LOADING_DELAY_MS);
}
if (to.meta.title) {
document.title = `${to.meta.title}`;
}
// 1. 有 token 的情况
if (hasToken) {
// 已经登录还去登录页,直接跳到首页或来源页
if (to.path === "/login") {
next(from.path && from.path !== "/login" ? from.fullPath : "/home");
return;
}
next();
return;
}
// 2. 没有 token 的情况
if (WHITE_LIST.has(to.path)) {
next();
return;
}
// 记录想去的地址,占个位:登录后再跳回来
sessionStorage.setItem(LOGIN_REDIRECT_KEY, to.fullPath);
next("/login");
});
router.afterEach(() => {
if (routeLoadingTimer !== undefined) {
clearTimeout(routeLoadingTimer);
routeLoadingTimer = undefined;
}
closeToast();
});
export default router;
/*
* @Author: cen
* @Date: 2026-03-24 17:37:44
* @Description:
* @FilePath: /venus-usedcar-h5/apps/web/venus-usedcar-quality/src/router/routes.ts
* @LastEditTime: 2026-03-25 19:41:22
* @LastEditors: cenchengwei@foreverht.com
* 可以输入预定的版权声明、个性签名、空行等
*/
import type { RouteRecordRaw } from "vue-router";
const routes: RouteRecordRaw[] = [
{
path: "/login",
name: "Login",
component: () => import("@views/login/index.vue"),
meta: {
title: "登录",
showTabBar: false,
hideRouteLoading: true,
},
},
{
path: "/",
component: () => import("@/layouts/index.vue"),
children: [
{
path: "",
redirect: "/home",
},
{
path: "home",
name: "Home",
component: () => import("@views/home/index.vue"),
meta: {
title: "检测工单",
keepAlive: true,
showTabBar: true,
},
},
{
path: "car-list",
name: "CarList",
component: () => import("@views/car-list/index.vue"),
meta: {
title: "检测报告",
keepAlive: true,
showTabBar: true,
},
},
{
path: "mine",
name: "Mine",
component: () => import("@views/mine/index.vue"),
meta: {
title: "我的",
keepAlive: true,
showTabBar: true,
},
},
{
path: "car-detail/:id",
name: "CarDetail",
component: () => import("@views/car-detail/index.vue"),
meta: {
title: "车辆详情",
keepAlive: false,
showTabBar: false,
},
},
{
path: "work-order-detail/:id",
name: "WorkOrderDetail",
component: () => import("@views/work-order-detail/index.vue"),
meta: {
title: "工单详情",
keepAlive: false,
showTabBar: false,
},
},
{
path: "word-order-detail/:id",
redirect: (to) => ({
name: "WorkOrderDetail",
params: { id: to.params.id },
}),
},
],
},
{
path: "/car-detail/:id",
name: "CarDetail",
component: () => import("@views/car-detail/index.vue"),
meta: {
title: "车辆详情",
showTabBar: false,
},
},
{
path: "/inspect-report",
name: "InspectReport",
component: () => import("@views/inspect-report/index.vue"),
meta: {
title: "检测报告",
showTabBar: false,
},
},
{
path: "/inspect-detail",
name: "InspectDetail",
component: () => import("@views/inspect-detail/index.vue"),
meta: {
title: "检测详情",
showTabBar: false,
},
},
{
path: "/:pathMatch(.*)*",
name: "NotFound",
component: () => import("@views/404/index.vue"),
meta: {
title: "页面不存在",
hideRouteLoading: true,
},
},
];
export default routes;
export { useAppStore } from "./modules/app.ts";
export { useUserStore } from "./modules/user.ts";
export type { UserInfo } from "./modules/user.ts";
import { ref } from "vue";
import { defineStore } from "pinia";
export const useAppStore = defineStore(
"app",
() => {
const loading = ref(false);
const theme = ref<"dark" | "light">("light");
function setLoading(val: boolean) {
loading.value = val;
}
function toggleTheme() {
theme.value = theme.value === "light" ? "dark" : "light";
}
return {
loading,
theme,
setLoading,
toggleTheme,
};
},
{
persist: {
pick: ["theme"],
},
},
);
import { computed, ref } from "vue";
import { logout as requestAuthLogout } from "@/api/modules/user";
import { LOGIN_REDIRECT_KEY, TOKEN_KEY } from "@/config/constants";
import { notifyHostLogout } from "@/utils/webviewBridge";
import { defineStore } from "pinia";
export interface UserInfo {
avatar: string;
id: number;
nickname: string;
phone: string;
}
export const useUserStore = defineStore(
"user",
() => {
const token = ref<string>("");
const userInfo = ref<null | UserInfo>(null);
const isLoggedIn = computed(() => !!token.value);
const username = computed(() => userInfo.value?.nickname ?? "");
function setToken(val: string) {
token.value = val;
if (val) {
localStorage.setItem(TOKEN_KEY, val);
} else {
localStorage.removeItem(TOKEN_KEY);
}
}
function setUserInfo(info: UserInfo) {
userInfo.value = info;
}
/** 调服务端登出后清空 token、用户信息、本地缓存,并通知宿主 WebView */
async function logout() {
try {
if (token.value) {
await requestAuthLogout();
}
} catch {
// 接口失败仍执行本地登出
} finally {
token.value = "";
userInfo.value = null;
localStorage.removeItem(TOKEN_KEY);
notifyHostLogout();
}
sessionStorage.removeItem(LOGIN_REDIRECT_KEY);
const { default: router } = await import("@/router");
await router.replace({ path: "/login" });
}
return {
token,
userInfo,
isLoggedIn,
username,
setToken,
setUserInfo,
logout,
};
},
{
persist: {
pick: ["token", "userInfo"],
},
},
);
export interface ApiResponse<T = unknown> {
code: number;
data: T;
message: string;
}
export interface PageParams {
page: number;
pageSize: number;
}
export interface PageData<T = unknown> {
hasMore: boolean;
list: T[];
page: number;
pageSize: number;
total: number;
}
export interface SelectOption {
disabled?: boolean;
label: string;
value: number | string;
}
declare module "vue-router" {
interface RouteMeta {
/** 为 true 时不展示全局路由 Loading、不参与延迟 Toast */
hideRouteLoading?: boolean;
keepAlive?: boolean;
requiresAuth?: boolean;
showTabBar?: boolean;
title?: string;
}
}
declare global {
interface Window {
__APP_INFO__: {
buildTime: string;
version: string;
};
}
}
export {};
/**
* glsk-oss-jssdk 类型声明
*/
declare module "glsk-oss-jssdk" {
export interface MultipartUploadResult {
[key: string]: any;
aliyunAddress: string;
attachment: string;
size?: string;
}
class GlOssApi {
multipartUpload(
file: File,
successCallback: (result: MultipartUploadResult) => void,
errCallBack: (error: Error) => void,
bucketName?: string,
dir?: string,
custAttrObj?: Record<string, any>,
compressObj?: Record<string, any>,
partSize?: number,
maxRetries?: number
): Promise<void> | void;
}
export default GlOssApi;
}
import type { InspectionNode, InspectionResultVO, LeafNodeRecord } from "@/api";
/** 检测评分:骨架/内饰等级选项(与 ScoreForm 共用) */
export const SCORE_RATING_OPTIONS = ["A", "B", "C", "D"] as const;
export type ScoreRatingOption = (typeof SCORE_RATING_OPTIONS)[number];
export interface SubTab {
/** 二级项自身的完成标志:0 未完成,1 已完成 */
completedFlag?: 0 | 1;
/** 二级项节点上的检测结果(与接口一致,进度/勾选优先据此判断) */
inspectionResultVO?: InspectionResultVO;
key: number | string;
label: string;
/** 该二级项下的叶子节点列表(nodeType=3) */
leafNodes?: InspectionNode[];
nodeId?: number;
}
export interface BigModule {
/** 大项完成标志:0 未完成,1 已完成(接口可能返回字符串) */
completedFlag?: 0 | 1 | string;
/** 是否存在二级分组 Tab;false 表示子节点直接为叶子(nodeType=3),不展示二级 Tab */
hasSecondaryTabs?: boolean;
key: number | string;
label: string;
nodeId?: number;
/**
* 当前大项下二级接口列表维度:total = 列表长度,done = 各节点 inspectionResultVO.completedFlag 统计
* (无二级 Tab、叶子直挂大项时按同一接口返回的叶子条数统计)
*/
secondaryProgress?: { done: number; total: number; };
subTabs: SubTab[];
}
/**
* 内容组件需要通过 defineExpose 暴露此接口。
* validate=false 时不校验直接收集数据;
* validate=true 时校验,未填完返回 null。
*/
export interface InspectSubContentExpose {
collectData(validate: boolean): Promise<LeafNodeRecord[] | null>;
}
/** 中间表单 validate / saveData 单列;`id` 为模板字段,仅作前端对齐,提交 saveInspectionRecord 时在 car-detail 映射中省略 */
export interface CustomizeFormValidateFieldItem {
id?: number;
interactionType?: string;
remark?: string;
valueKey?: string;
valueSeq?: number;
valueText?: string;
}
/** 中间表单 validate / saveData 下单个叶子节点(与 `setSubmitData` 一项一致) */
export interface CustomizeFormValidateNode {
data: CustomizeFormValidateFieldItem[];
nodeId: number | string;
nodeName: string;
remark: string;
resultStatus: number;
}
/** 中间表单 validate / saveData 返回体;`data` 为当前二级下多列叶子节点数组 */
export interface CustomizeFormValidateResult {
data?: CustomizeFormValidateNode[];
message?: string;
success: boolean;
}
/*
* @Author: cen
* @Date: 2026-03-27 17:17:10
* @Description:
* @FilePath: /venus-usedcar-h5/apps/web/venus-usedcar-quality/src/types/views/car-list.ts
* @LastEditTime: 2026-04-02 16:25:09
* @LastEditors: cenchengwei@foreverht.com
* 可以输入预定的版权声明、个性签名、空行等
*/
export interface ReportItem {
inspectionAddress: string;
carTitle: string;
coverImage: string;
/** 列表接口返回的报告 H5 链接 */
h5Url?: string;
id: number;
plateNo: string;
/** 检测记录 id,无 h5Url 时用于站内 InspectReport */
recordId?: number;
reportNo: string;
updateTime: string;
vin: string;
}
import type { AuditStatus, WorkOrderStatus } from "./work-order-common";
export type ActionVariant = "primary" | "secondary";
export interface CardAction {
key:
| "continueCheck"
| "editCheck"
| "rejectReason"
| "startCheck"
| "viewReport"
| "viewWorkOrder";
label: string;
onClick: () => void;
variant: ActionVariant;
}
export interface WorkOrderItem {
address: string;
auditContent?: string;
auditStatus?: AuditStatus;
carTitle: string;
coverImage: string;
dispatchTime: string;
id: string;
orderNo: string;
plateNo: string;
status: WorkOrderStatus;
vin: string;
}
/** 工单列表、详情等页面共用的状态字面量 */
export type WorkOrderStatus = 1 | 2 | 3 | 4;
export type AuditStatus = 1 | 2 | 3 | 4;
import type { WorkOrderStatus } from "./work-order-common";
export interface VehicleCover {
filePath?: null | string;
thumbPath?: null | string;
thumbUrl?: null | string;
url?: null | string;
}
export interface WorkOrderBaseInfo {
carBrand?: string;
carSeriesName?: string;
carTypeName?: string;
licensePlate?: string;
vin?: string;
}
export interface WorkOrderVehicle {
baseInfo?: WorkOrderBaseInfo;
cover?: VehicleCover;
custodianInfo?: { custodianName?: string; custodianPhone?: string };
ownership?: { carCityName?: string; carProvinceName?: string };
venue?: { address?: string };
}
export interface NodeVO {
count: number;
nodeId: number;
nodeName: string;
nodeStatus?: number;
status?: number;
}
export interface InspectionWORespVO {
inspectionAddress?: string;
inspectionCompletedTime?: string;
status?: WorkOrderStatus;
updateTime?: string;
vehicle?: WorkOrderVehicle;
woId?: string;
woTime?: string;
}
export interface WorkOrderDetailRemote {
inspectionWORespVO?: InspectionWORespVO;
nodeVOList?: NodeVO[];
}
// 简易版 rem 适配:
// 以设计稿 375 宽为基准,希望设计稿下 html 字体为 14px。
// 不同屏幕下:html.fontSize = (有效宽度 / 375) * 14px。
// 有效宽度不超过 LAYOUT_MAX_WIDTH,与 reset.scss 中 #app 的 max-width 一致,避免 Pad 等大屏整屏算 rem 导致字体偏大。
const DESIGN_WIDTH = 375;
const BASE_FONT_SIZE = 14; // 设计稿宽度下的根字体大小
/** 与 #app max-width 保持一致,大屏 rem 按此宽度折算 */
const LAYOUT_MAX_WIDTH = 430;
function setRootFontSize() {
const docEl = document.documentElement;
const width = docEl.clientWidth || window.innerWidth;
const minWidth = 320;
const effectiveWidth = Math.min(width, LAYOUT_MAX_WIDTH);
const clampedWidth = Math.max(effectiveWidth, minWidth);
const fontSize = (clampedWidth / DESIGN_WIDTH) * BASE_FONT_SIZE;
docEl.style.fontSize = `${fontSize}px`;
}
export function initFlexible() {
if (typeof window === "undefined") return;
setRootFontSize();
window.addEventListener("resize", () => {
setRootFontSize();
});
window.addEventListener("pageshow", (event) => {
if (event.persisted) {
setRootFontSize();
}
});
}
import dayjs from "dayjs";
/**
* 格式化价格,单位:万元
*/
export function formatPrice(price: number): string {
if (price >= 10_000) {
return `${(price / 10_000).toFixed(1)}万`;
}
return `${price}`;
}
/**
* 格式化里程,单位:公里
*/
export function formatMileage(mileage: number): string {
if (mileage >= 10_000) {
return `${(mileage / 10_000).toFixed(1)}万公里`;
}
return `${mileage}公里`;
}
/**
* 格式化时间
*/
export function formatDate(date: Date | number | string, format = "YYYY-MM-DD"): string {
return dayjs(date).format(format);
}
/**
* 格式化相对时间
*/
export function formatRelativeTime(date: Date | number | string): string {
const now = dayjs();
const target = dayjs(date);
const diffMinutes = now.diff(target, "minute");
if (diffMinutes < 1) return "刚刚";
if (diffMinutes < 60) return `${diffMinutes}分钟前`;
const diffHours = now.diff(target, "hour");
if (diffHours < 24) return `${diffHours}小时前`;
const diffDays = now.diff(target, "day");
if (diffDays < 30) return `${diffDays}天前`;
return target.format("YYYY-MM-DD");
}
/**
* 防抖
*/
export function debounce<T extends (...args: unknown[]) => unknown>(
fn: T,
delay = 300,
): (...args: Parameters<T>) => void {
let timer: null | ReturnType<typeof setTimeout> = null;
return function (...args: Parameters<T>) {
if (timer) clearTimeout(timer);
timer = setTimeout(() => fn(...args), delay);
};
}
/**
* 节流
*/
export function throttle<T extends (...args: unknown[]) => unknown>(
fn: T,
limit = 300,
): (...args: Parameters<T>) => void {
let lastTime = 0;
return function (...args: Parameters<T>) {
const now = Date.now();
if (now - lastTime >= limit) {
lastTime = now;
fn(...args);
}
};
}
import { TOKEN_KEY } from "@/config/constants";
import axios, { AxiosInstance, AxiosResponse } from "axios";
import { showToast } from "vant";
import { getConfig } from "../config/center";
export interface ApiResponse<T = unknown> {
code?: number | string;
data: T;
message?: string;
msg?: string;
success?: boolean;
}
export interface PageData<T = unknown> {
list: T[];
page: number;
pageSize: number;
total: number;
}
/** 请求配置 */
export interface RequestConfig {
[key: string]: unknown;
headers?: Record<string, string>;
params?: Record<string, unknown>;
}
const defaultBaseURL = import.meta.env.VITE_API_BASE_URL ?? "";
const REQUEST_TIMEOUT = 15_000;
const HTTP_CODE_UNAUTHORIZED = 401;
const HTTP_CODE_FORBIDDEN = 403;
const HTTP_CODE_SERVER_ERROR = 500;
const BIZ_CODE_OK = 200;
const BIZ_CODE_UNAUTHORIZED = 1006;
const DEFAULT_EXPIRED_MESSAGE = "登录已过期,请重新登录";
const BIZ_CODES_NO_GLOBAL_TOAST = new Set([1000, 1002, 1003, 1010]);
const APP_BASE_PATH = (() => {
const base = import.meta.env.BASE_URL ?? "/";
if (!base || base === "/") {
return "";
}
return base.endsWith("/") ? base.slice(0, -1) : base;
})();
let axiosInstance: AxiosInstance | null = null;
let isRedirectingToLogin = false;
let loginNavigationInFlight: null | Promise<void> = null;
/**
* 已在请求层提示过用户(或 1006 已跳登录),业务页 catch 不要再追加通用失败文案。
*/
export class ApiHandledError extends Error {
constructor(message: string) {
super(message);
this.name = "ApiHandledError";
Object.setPrototypeOf(this, ApiHandledError.prototype);
}
}
/** 请求层已 toast / 已处理:避免业务页 catch 再 showToast 盖住接口 message */
export function isRequestFailureAlreadyHandled(error: unknown): boolean {
if (error instanceof ApiHandledError) return true;
// 走 axios 错误拦截器时均已 showToast(含无 response 的 default 分支)
return axios.isAxiosError(error);
}
function getToken(): string {
const token = localStorage.getItem(TOKEN_KEY);
return token ? `Bearer ${token}` : "";
}
function resolveBaseUrl(): string {
const cfg = getConfig() as Record<string, unknown>;
const apiBaseUrl =
((cfg.apiEnv as undefined | { baseURL?: string; baseUrl?: string })?.baseURL ??
(cfg.apiEnv as undefined | { baseURL?: string; baseUrl?: string })?.baseUrl ??
(cfg.apiBaseUrl as string | undefined) ??
(cfg.gsc as undefined | { baseUrl?: string; baseURL?: string })?.baseUrl ??
(cfg.gsc as undefined | { baseUrl?: string; baseURL?: string })?.baseURL) as
| string
| undefined;
return apiBaseUrl || defaultBaseURL || "/";
}
function normalizeBizCode(code: unknown): null | number {
if (code === null || code === undefined || code === "") return null;
const normalized = Number(code);
return Number.isNaN(normalized) ? null : normalized;
}
function normalizePathname(pathname: string): string {
if (!pathname) return "/";
if (pathname.length > 1 && pathname.endsWith("/")) {
return pathname.slice(0, -1);
}
return pathname;
}
function isAtLoginPath(): boolean {
return /\/login$/.test(normalizePathname(window.location.pathname));
}
function buildLoginUrlWithHostContext(): string {
const currentUrl = new URL(window.location.href);
const loginUrl = new URL(`${APP_BASE_PATH}/login`, window.location.origin);
const openType = currentUrl.searchParams.get("openType");
if (openType) {
loginUrl.searchParams.set("openType", openType);
}
return `${loginUrl.pathname}${loginUrl.search}`;
}
function getLoginRouteQueryFromCurrentUrl(): { openType?: string } {
const currentUrl = new URL(window.location.href);
const openType = currentUrl.searchParams.get("openType");
return openType ? { openType } : {};
}
function clearAuthState() {
localStorage.removeItem(TOKEN_KEY);
// 同步清理 Pinia,避免路由守卫继续判定为已登录。
void import("@/stores/modules/user")
.then(({ useUserStore }) => {
useUserStore().setToken("");
})
.catch(() => {
// Store 清理失败不阻塞登录跳转。
});
}
async function navigateToLogin() {
if (isAtLoginPath()) return;
try {
const { default: router } = await import("@/router");
await router.replace({
path: "/login",
query: getLoginRouteQueryFromCurrentUrl(),
});
} catch {
// 无法获取 router 时兜底硬跳,避免停留在非法态页面。
if (!isAtLoginPath()) {
window.location.replace(buildLoginUrlWithHostContext());
}
}
}
function ensureLoginRedirect(message: string) {
clearAuthState();
if (isAtLoginPath()) return;
if (!isRedirectingToLogin) {
isRedirectingToLogin = true;
showToast(message);
}
if (!loginNavigationInFlight) {
loginNavigationInFlight = navigateToLogin().finally(() => {
loginNavigationInFlight = null;
isRedirectingToLogin = false;
});
}
}
/** HTTP 层鉴权失败(401) */
function handleHttpUnauthorized() {
ensureLoginRedirect(DEFAULT_EXPIRED_MESSAGE);
}
/** 业务层鉴权失败(code=1006) */
function handleBizUnauthorized(message: string) {
ensureLoginRedirect(message);
}
function getHttpErrorMessage(error: unknown): string {
const err = error as {
message?: string;
response?: { data?: { message?: string } };
};
return err?.response?.data?.message || err?.message || "网络错误,请检查网络连接";
}
function handleHttpError(error: unknown) {
const err = error as { response?: { status?: number } };
const status = err?.response?.status;
const message = getHttpErrorMessage(error);
switch (status) {
case HTTP_CODE_FORBIDDEN: {
showToast("暂无权限");
break;
}
case HTTP_CODE_SERVER_ERROR: {
showToast(message || "服务器异常,请稍后重试");
break;
}
case HTTP_CODE_UNAUTHORIZED: {
handleHttpUnauthorized();
break;
}
default: {
showToast(message);
}
}
}
function isBizResponse<T>(data: ApiResponse<T> | T): data is ApiResponse<T> {
return typeof data === "object" && data !== null && ("code" in data || "success" in data);
}
function createAxiosInstance(): AxiosInstance {
const instance = axios.create({
baseURL: resolveBaseUrl(),
timeout: REQUEST_TIMEOUT,
headers: { "Content-Type": "application/json" },
});
instance.interceptors.request.use(
(config) => {
const token = getToken();
if (token) {
config.headers = {
...config.headers,
Authorization: token,
} as typeof config.headers;
}
return config;
},
(error) => Promise.reject(error)
);
instance.interceptors.response.use(
(response) => response,
(error) => {
handleHttpError(error);
return Promise.reject(error);
}
);
return instance;
}
function getInstance(): AxiosInstance {
if (!axiosInstance) {
axiosInstance = createAxiosInstance();
}
return axiosInstance;
}
/** 统一处理响应,提取 data 或按业务码处理 */
async function handleResponse<T>(
promise: Promise<AxiosResponse<ApiResponse<T> | T>>
): Promise<T> {
const res = await promise;
const data = res.data as ApiResponse<T> | T;
if (!isBizResponse(data)) {
// 非标准结构,直接返回 data
return data as T;
}
const codeNum = normalizeBizCode(data.code);
const isSuccess = codeNum === BIZ_CODE_OK || (codeNum === null && data.success === true);
if (isSuccess) {
return (data.data ?? (data as unknown)) as T;
}
const errMsg = data.message || data.msg || "请求失败";
if (codeNum === BIZ_CODE_UNAUTHORIZED) {
handleBizUnauthorized(errMsg);
throw new ApiHandledError(errMsg);
}
if (codeNum !== null && BIZ_CODES_NO_GLOBAL_TOAST.has(codeNum)) {
throw new Error(errMsg);
}
showToast(errMsg);
throw new ApiHandledError(errMsg);
}
function get<T = unknown>(
url: string,
params?: Record<string, unknown>,
config?: RequestConfig
) {
const instance = getInstance();
const mergedConfig = { ...config, params };
return handleResponse<T>(instance.get(url, mergedConfig));
}
function post<T = unknown>(
url: string,
data?: unknown,
config?: RequestConfig
) {
const instance = getInstance();
return handleResponse<T>(instance.post(url, data, config));
}
export { get, post };
import { OSS_CONFIG } from "@/config/oss.ts";
import GlOssApi from "glsk-oss-jssdk";
let ossApi = null;
function getOssApi() {
if (!ossApi) ossApi = new GlOssApi();
return ossApi;
}
/**
* 使用 glsk-oss-jssdk 分片上传到 OSS。
*
* @param {File} file
* @param {{
* bucketName?: string,
* dir?: string,
* custAttrObj?: Record<string, any>,
* partSizeKB?: number,
* maxRetries?: number
* }} [options]
* @returns {Promise<any>} SDK 返回结果(含 aliyunAddress/attachment 等字段)
*/
export function uploadFile(file, options = {}) {
if (!file) return Promise.reject(new Error("file 不能为空"));
const api = getOssApi();
const bucketName = options.bucketName ?? OSS_CONFIG.BUCKET_NAME;
const dir = options.dir ?? OSS_CONFIG.FOLDER;
const custAttrObj =
options.custAttrObj ?? { systemSource: OSS_CONFIG.SYSTEM_SOURCE };
const partSizeKB = options.partSizeKB ?? 500;
const maxRetries = options.maxRetries ?? 3;
return new Promise((resolve, reject) => {
api.multipartUpload(
file,
(res) => resolve(res),
(err) => reject(err),
bucketName,
dir,
custAttrObj,
{},
partSizeKB,
maxRetries
);
});
}
/**
* 批量上传
* @param {File[]} files
* @param {Parameters<typeof uploadFile>[1]} [options]
*/
export function uploadFiles(files, options = {}) {
if (!Array.isArray(files) || files.length === 0) {
return Promise.reject(new Error("files 不能为空"));
}
return Promise.all(files.map((f) => uploadFile(f, options)));
}
import { useUserStore } from "@stores/modules/user";
type HostMessage =
| Record<string, unknown>
| { token?: string; type: "AUTH_TOKEN"; }
| { token?: string; type: "INIT_TOKEN"; }
| { type: "LOGOUT" };
function safeJsonParse(input: unknown): unknown {
if (typeof input !== "string") return input;
try {
return JSON.parse(input);
} catch {
return input;
}
}
function getUrlToken(): string {
const url = new URL(window.location.href);
const token = url.searchParams.get("token") || url.searchParams.get("authToken") || "";
return token;
}
function stripTokenFromUrl() {
const url = new URL(window.location.href);
const had =
url.searchParams.has("token") ||
url.searchParams.has("authToken") ||
url.searchParams.has("access_token");
if (!had) return;
url.searchParams.delete("token");
url.searchParams.delete("authToken");
url.searchParams.delete("access_token");
window.history.replaceState({}, document.title, url.toString());
}
function postToUniApp(payload: Record<string, unknown>) {
console.log("pad端postToUniApp", payload);
const w = window as unknown as {
parent?: Window;
uni?: { postMessage?: (args: { data: unknown }) => void };
};
const doPost = () => {
try {
w.uni?.postMessage?.({ data: payload });
} catch {
// ignore
}
// 兜底:部分容器没有注入 uni 对象时尝试 parent.postMessage
try {
w.parent?.postMessage?.(payload, "*");
} catch {
// ignore
}
};
if (w.uni) {
// uni 对象已就绪,直接发送
doPost();
} else {
// 等待 UniAppJSBridgeReady 事件后再发送
document.addEventListener("UniAppJSBridgeReady", doPost, { once: true });
}
}
function postToWeChatMiniProgram(payload: Record<string, unknown>) {
const w = window as unknown as {
wx?: { miniProgram?: { postMessage?: (args: { data: unknown }) => void } };
};
try {
w.wx?.miniProgram?.postMessage?.({ data: payload });
} catch {
// ignore
}
}
export function notifyHostToken(token: string) {
const payload = { type: "AUTH_TOKEN", token };
postToUniApp(payload);
postToWeChatMiniProgram(payload);
}
export function notifyHostLogout() {
const payload = { type: "LOGOUT" };
postToUniApp(payload);
postToWeChatMiniProgram(payload);
}
export function initTokenBridge() {
const userStore = useUserStore();
// 1) URL 注入 token(宿主再次进入时推荐用这种方式传入)
const urlToken = getUrlToken();
if (urlToken) {
userStore.setToken(urlToken);
stripTokenFromUrl();
}
// 2) 监听宿主消息(若宿主支持再补一条通道)
window.addEventListener("message", (evt: MessageEvent) => {
const raw = safeJsonParse(evt.data) as HostMessage;
const type = (raw as { type?: unknown })?.type;
if (type === "INIT_TOKEN" || type === "AUTH_TOKEN") {
const token = (raw as { token?: unknown }).token;
if (typeof token === "string" && token) {
userStore.setToken(token);
}
}
if (type === "LOGOUT") {
void userStore.logout();
}
});
}
<script setup lang="ts">
import { useRouter } from "vue-router";
const router = useRouter();
function goHome() {
router.replace({ name: "Home" });
}
</script>
<template>
<div class="not-found-page">
<van-empty description="页面不存在" image="error">
<template #description>
<p class="empty-title">
页面不存在
</p>
<p class="empty-desc">
您访问的页面已移动或不存在
</p>
</template>
<van-button class="back-btn"
color="#ee0a24"
round
type="primary"
@click="goHome">
返回首页
</van-button>
</van-empty>
</div>
</template>
<style lang="scss" scoped>
@use "@assets/styles/variables" as *;
.not-found-page {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
background-color: var(--color-bg-page);
}
.empty-title {
font-size: $font-size-lg;
font-weight: 700;
color: $color-text-primary;
margin-bottom: 6px;
}
.empty-desc {
font-size: $font-size-sm;
color: $color-text-secondary;
}
.back-btn {
margin-top: 24px;
width: 160px;
}
</style>
<template>
<van-popup class="rating-guide-popup"
:close-on-click-overlay="true"
position="center"
round
:show="show"
teleport="#vant-portal-host"
@opened="resetScroll"
@update:show="emit('update:show', $event)">
<div class="rating-guide">
<div class="rating-guide__header">
<span class="rating-guide__title">{{ config.title }}</span>
<van-icon class="rating-guide__close"
name="cross"
@click="emit('update:show', false)" />
</div>
<div ref="scrollRef"
class="rating-guide__scroll">
<div v-for="level in config.levels"
:key="level.grade"
class="rating-card">
<div class="rating-card__top">
<div class="rating-card__badge"
:style="{ background: gradeColor(level.grade) }">
{{ level.grade }}
</div>
<div class="rating-card__headline">
{{ level.grade }}级:{{ level.subtitle }}
</div>
</div>
<p class="rating-card__desc">
{{ level.description }}
</p>
<div class="rating-card__examples-label">
示例:
</div>
<ul class="rating-card__list">
<li v-for="(line, i) in level.examples"
:key="i"
class="rating-card__item">
{{ line }}
</li>
</ul>
</div>
</div>
</div>
</van-popup>
</template>
<script setup lang="ts">
import type { RatingGuideConfig, RatingGuideGrade } from "./rating-guide-content";
import { nextTick, ref, watch } from "vue";
import { RATING_GUIDE_GRADE_COLORS } from "./rating-guide-content";
const props = defineProps<{
config: RatingGuideConfig;
show: boolean;
}>();
const emit = defineEmits<{
"update:show": [value: boolean];
}>();
const scrollRef = ref<HTMLElement | null>(null);
function resetScroll() {
nextTick(() => {
const el = scrollRef.value;
if (el) el.scrollTop = 0;
});
}
/** 同一弹窗切换骨架 / 内饰指引时,避免沿用上一份内容的滚动位置 */
watch(
() => ({ open: props.show, title: props.config.title }),
({ open }) => {
if (open) resetScroll();
},
);
function gradeColor(grade: RatingGuideGrade): string {
return RATING_GUIDE_GRADE_COLORS[grade];
}
</script>
<style lang="scss" scoped>
.rating-guide-popup {
box-sizing: border-box;
width: calc(100vw - 48px);
max-width: 360px;
padding: 0;
overflow: hidden;
background: transparent;
}
.rating-guide {
display: flex;
flex-direction: column;
max-height: min(72vh, 560px);
padding: 20px 16px 16px;
background: #fff;
border-radius: 20px;
}
.rating-guide__header {
position: relative;
flex-shrink: 0;
padding: 0 28px 14px;
text-align: center;
}
.rating-guide__title {
font-size: 17px;
font-weight: 700;
color: #1a1a1a;
}
.rating-guide__close {
position: absolute;
top: 0;
right: 0;
padding: 4px;
font-size: 20px;
color: #969799;
cursor: pointer;
}
.rating-guide__scroll {
flex: 1;
min-height: 0;
padding-right: 4px;
margin-right: -4px;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-thumb {
background: rgb(0 0 0 / 15%);
border-radius: 4px;
}
}
.rating-card {
padding: 14px 12px;
margin-bottom: 12px;
background: #f2f2f7;
border-radius: 12px;
&:last-child {
margin-bottom: 0;
}
}
.rating-card__top {
display: flex;
gap: 10px;
align-items: flex-start;
margin-bottom: 8px;
}
.rating-card__badge {
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
font-size: 15px;
font-weight: 700;
color: #fff;
border-radius: 6px;
}
.rating-card__headline {
flex: 1;
padding-top: 2px;
font-size: 16px;
font-weight: 700;
line-height: 1.35;
color: #1a1a1a;
}
.rating-card__desc {
margin: 0 0 10px;
font-size: 13px;
line-height: 1.5;
color: #333;
}
.rating-card__examples-label {
margin-bottom: 6px;
font-size: 12px;
font-weight: 500;
color: #666;
}
.rating-card__list {
padding: 0;
margin: 0;
list-style: none;
}
.rating-card__item {
position: relative;
padding-left: 12px;
margin-bottom: 6px;
font-size: 12px;
line-height: 1.45;
color: #666;
&:last-child {
margin-bottom: 0;
}
&::before {
position: absolute;
top: 6px;
left: 0;
width: 4px;
height: 4px;
content: "";
background: #c8c9cc;
border-radius: 50%;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!