refactor: 将Data到ViewModel的转换由App转移至Server端
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m15s
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m15s
- 将逻辑转移到Server端后,简化前端逻辑
This commit is contained in:
@ -1,2 +1,3 @@
|
||||
export * from './directus';
|
||||
export * from './meilisearch';
|
||||
export * from './views';
|
||||
|
||||
10
shared/types/views/company-profile-view.ts
Normal file
10
shared/types/views/company-profile-view.ts
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 公司简介视图模型
|
||||
*/
|
||||
export interface CompanyProfileView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 内容 **/
|
||||
content: string;
|
||||
}
|
||||
10
shared/types/views/contact-info-view.ts
Normal file
10
shared/types/views/contact-info-view.ts
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 联系信息视图模型
|
||||
*/
|
||||
export interface ContactInfoView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 内容 **/
|
||||
content: string;
|
||||
}
|
||||
45
shared/types/views/document-list-view.ts
Normal file
45
shared/types/views/document-list-view.ts
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 文档关联产品类型模型
|
||||
* 用于在文档库中提供产品筛选功能
|
||||
*/
|
||||
export interface DocumentListProductType {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档关联产品模型
|
||||
* 用于在文档库中提供产品筛选功能
|
||||
*/
|
||||
export interface DocumentListProduct {
|
||||
id: number;
|
||||
name: string;
|
||||
type: DocumentListProductType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档列表模型
|
||||
* 用于文档库(/support/documents)页面渲染的数据结构
|
||||
*/
|
||||
export interface DocumentListView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 文件UUID **/
|
||||
fileId: string;
|
||||
|
||||
/** 文件名 **/
|
||||
filename: string;
|
||||
|
||||
/** 文档标题 **/
|
||||
title: string;
|
||||
|
||||
/** 文档大小 **/
|
||||
size: number;
|
||||
|
||||
/** 文档链接 **/
|
||||
url: string;
|
||||
|
||||
/** 相关产品 **/
|
||||
products: DocumentListProduct[];
|
||||
}
|
||||
50
shared/types/views/homepage-view.ts
Normal file
50
shared/types/views/homepage-view.ts
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* 主页推荐产品视图模型
|
||||
*/
|
||||
export interface HomepageProductView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 产品名称 **/
|
||||
name: string;
|
||||
|
||||
/** 产品简介 **/
|
||||
summary: string;
|
||||
|
||||
/** 产品封面 **/
|
||||
cover: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主页推荐解决方案视图模型
|
||||
*/
|
||||
export interface HomepageSolutionView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 解决方案标题 **/
|
||||
title: string;
|
||||
|
||||
/** 解决方案摘要 **/
|
||||
summary: string;
|
||||
|
||||
/** 解决方案封面 **/
|
||||
cover: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主页视图模型
|
||||
*/
|
||||
export interface HomepageView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 首页图片 **/
|
||||
carousel: string[];
|
||||
|
||||
/** 首页推荐产品 **/
|
||||
recommendProducts: HomepageProductView[];
|
||||
|
||||
/** 首页推荐解决方案 **/
|
||||
recommendSolutions: HomepageSolutionView[];
|
||||
}
|
||||
13
shared/types/views/index.ts
Normal file
13
shared/types/views/index.ts
Normal file
@ -0,0 +1,13 @@
|
||||
export * from './solution-view';
|
||||
export * from './solution-list-view';
|
||||
export * from './product-view';
|
||||
export * from './product-list-view';
|
||||
export * from './product-spec-group-view';
|
||||
export * from './product-document-view';
|
||||
export * from './product-question-view';
|
||||
export * from './document-list-view';
|
||||
export * from './question-list-view';
|
||||
export * from './company-profile-view';
|
||||
export * from './contact-info-view';
|
||||
export * from './homepage-view';
|
||||
export * from './search-item-view';
|
||||
23
shared/types/views/product-document-view.ts
Normal file
23
shared/types/views/product-document-view.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 文档视图模型
|
||||
* 用于文档列表渲染的数据结构
|
||||
*/
|
||||
export interface ProductDocumentView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 文件UUID **/
|
||||
fileId: string;
|
||||
|
||||
/** 文件名 **/
|
||||
filename: string;
|
||||
|
||||
/** 文档标题 **/
|
||||
title: string;
|
||||
|
||||
/** 文档大小 **/
|
||||
size: number;
|
||||
|
||||
/** 文档链接 **/
|
||||
url: string;
|
||||
}
|
||||
35
shared/types/views/product-list-view.ts
Normal file
35
shared/types/views/product-list-view.ts
Normal file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 产品类型视图模型
|
||||
* 用于产品列表页的section渲染与排序
|
||||
*/
|
||||
export interface ProductTypeView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 类型名 **/
|
||||
name: string;
|
||||
|
||||
/** 排序字段 **/
|
||||
sort: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品列表视图模型
|
||||
* 用于产品列表(/products)渲染的数据结构
|
||||
*/
|
||||
export interface ProductListView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 产品名称 **/
|
||||
name: string;
|
||||
|
||||
/** 产品简介 **/
|
||||
summary: string;
|
||||
|
||||
/** 产品类型 **/
|
||||
product_type: ProductTypeView;
|
||||
|
||||
/** 产品封面(图片的id) **/
|
||||
cover: string;
|
||||
}
|
||||
14
shared/types/views/product-question-view.ts
Normal file
14
shared/types/views/product-question-view.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 常见问题视图模型
|
||||
* 用于产品页常见问题渲染的数据结构
|
||||
*/
|
||||
export interface ProductQuestionView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 问题标题 **/
|
||||
title: string;
|
||||
|
||||
/** 问题内容 **/
|
||||
content: string;
|
||||
}
|
||||
29
shared/types/views/product-spec-group-view.ts
Normal file
29
shared/types/views/product-spec-group-view.ts
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 产品规格模型
|
||||
* 用于产品规格渲染的数据结构
|
||||
*/
|
||||
export interface ProductSpecView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 规格名称 **/
|
||||
key: string;
|
||||
|
||||
/** 规格值 **/
|
||||
value: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品规格表模型
|
||||
* 用于产品规格表渲染的数据结构
|
||||
*/
|
||||
export interface ProductSpecGroupView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 规格组名称 **/
|
||||
name: string;
|
||||
|
||||
/** 规格组 **/
|
||||
specs: ProductSpecView[];
|
||||
}
|
||||
42
shared/types/views/product-view.ts
Normal file
42
shared/types/views/product-view.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import type { ProductSpecGroupView } from './product-spec-group-view';
|
||||
import type { ProductQuestionView } from './product-question-view';
|
||||
import type { ProductDocumentView } from './product-document-view';
|
||||
|
||||
interface ImageView {
|
||||
id: number;
|
||||
image: string;
|
||||
caption: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品视图模型
|
||||
* 用于产品详情页(/products/[slug])渲染的数据结构
|
||||
*/
|
||||
export interface ProductView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 产品名称 **/
|
||||
name: string;
|
||||
|
||||
/** 产品简介 **/
|
||||
summary: string;
|
||||
|
||||
/** 产品类型 **/
|
||||
product_type: string;
|
||||
|
||||
/** 产品图片 **/
|
||||
images: ImageView[];
|
||||
|
||||
/** 产品详情 **/
|
||||
description: string;
|
||||
|
||||
/** 产品规格 **/
|
||||
specs: ProductSpecGroupView[];
|
||||
|
||||
/** 产品常见问题 **/
|
||||
faqs: ProductQuestionView[];
|
||||
|
||||
/** 产品文档 **/
|
||||
documents: ProductDocumentView[];
|
||||
}
|
||||
36
shared/types/views/question-list-view.ts
Normal file
36
shared/types/views/question-list-view.ts
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* 问题关联产品类型模型
|
||||
* 用于在常见问题列表中提供产品筛选功能
|
||||
*/
|
||||
export interface QuestionListProductType {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 问题关联产品模型
|
||||
* 用于在常见问题列表中提供产品筛选功能
|
||||
*/
|
||||
export interface QuestionListProduct {
|
||||
id: number;
|
||||
name: string;
|
||||
type: QuestionListProductType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 常见问题列表视图模型
|
||||
* 用于常见问题列表(/support/faq)页面渲染的数据结构
|
||||
*/
|
||||
export interface QuestionListView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 问题标题 **/
|
||||
title: string;
|
||||
|
||||
/** 问题内容 **/
|
||||
content: string;
|
||||
|
||||
/** 关联产品 **/
|
||||
products: QuestionListProduct[];
|
||||
}
|
||||
13
shared/types/views/search-item-view.ts
Normal file
13
shared/types/views/search-item-view.ts
Normal file
@ -0,0 +1,13 @@
|
||||
export interface SearchItemView {
|
||||
/** 唯一标识符 **/
|
||||
id: number | string;
|
||||
|
||||
/** 条目类型 **/
|
||||
type: 'product' | 'solution' | 'question' | 'document';
|
||||
|
||||
/** 条目标题 **/
|
||||
title: string;
|
||||
|
||||
/** 条目摘要 **/
|
||||
summary: string;
|
||||
}
|
||||
35
shared/types/views/solution-list-view.ts
Normal file
35
shared/types/views/solution-list-view.ts
Normal file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 解决方案类型视图模型
|
||||
* 用于解决方案列表页标签栏的渲染与排序
|
||||
*/
|
||||
export interface SolutionTypeView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 类型名 **/
|
||||
name: string;
|
||||
|
||||
/** 排序字段 **/
|
||||
sort: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解决方案列表模型
|
||||
* 用于解决方案列表(/solutions)渲染的数据结构
|
||||
*/
|
||||
export interface SolutionListView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 标题 **/
|
||||
title: string;
|
||||
|
||||
/** 摘要 **/
|
||||
summary: string;
|
||||
|
||||
/** 解决方案类型 **/
|
||||
solution_type: SolutionTypeView;
|
||||
|
||||
/** 解决方案封面(图片id) **/
|
||||
cover: string;
|
||||
}
|
||||
20
shared/types/views/solution-view.ts
Normal file
20
shared/types/views/solution-view.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* 解决方案模型
|
||||
* 用于解决方案页(/solutions/[slug])渲染的数据结构
|
||||
*/
|
||||
export interface SolutionView {
|
||||
/** 唯一标识符 **/
|
||||
id: number;
|
||||
|
||||
/** 标题 **/
|
||||
title: string;
|
||||
|
||||
/** 摘要 **/
|
||||
summary: string;
|
||||
|
||||
/** 内容 **/
|
||||
content: string;
|
||||
|
||||
/** 创建时间 **/
|
||||
createAt: string;
|
||||
}
|
||||
Reference in New Issue
Block a user