Compare commits

...

11 Commits

Author SHA1 Message Date
ef20832761 feat: 页脚添加ICP跳转链接
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m11s
- ICP跳转: 点击备案号跳转到工信部网站
2025-12-13 16:07:49 +08:00
03a692afb5 feat: 页面描述 & 停产产品标示
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m59s
- 页面描述:产品列表与解决方案列表添加页面描述
- 停产标示:对于已停产产品,在产品详情页添加已停产标示
- 视图变更:产品视图添加Status字段,用于标示已停产产品
- 文案变更与补全:调整部分页面UI文案,并补全各个语言的新增文案
2025-12-10 14:10:03 +08:00
7b21def74f feat: 补全i18n翻译
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m59s
- 翻译补全: 补全英语、西班牙语、俄语的翻译
2025-12-10 14:06:58 +08:00
783d482e0a feat: 产品/解决方案列表页描述
- 页面描述:为产品列表与解决方案列表添加页面描述
- 停产提示:在产品列表中提示停产产品使用搜索功能
2025-12-10 14:00:05 +08:00
62ec215340 feat: 产品视图模型添加状态
- 产品状态:从Directus Schema获取Product的Status字段
- 视图字段:添加Status字段用于标示产品状态
- 测试方法:为Status字段添加单元测试
2025-12-10 13:35:00 +08:00
e02f975217 fix: 修正计算器跳转链接
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m9s
- 修正页面在竖屏状态下页面无法正确跳转到计算器页面的问题
2025-12-08 13:48:25 +08:00
5530776035 feat: 搜索页图片预览 & 文档列表显示文档类型
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m21s
- 缩略图预览: 搜索页栏目右侧添加缩略图预览功能
- 细分类型: 搜索页栏目添加细分类型展示:如产品(原纸分切机)
- 接口调整:
调整可选字段类型使其符合搜索引擎索引格式;将搜索条目中的type改为sectionType用于大类分类,并将type作为细分类型使用
- 文档类型: 文档页添加文档类型展示功能,当用户未指定文档类型时,在标题右侧显示文档类型
- 查询调整: 产品查询添加文档类型查询

ISSUE: Resolve #94
2025-12-05 17:23:34 +08:00
63cdff9c41 feat: 为文档库添加文档类型显示功能
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m10s
- 功能添加:在文档列表中,当未指定文档类型时,在标题右侧显示文档类型
- 查询更改:产品查询添加文档类型查询方法
- mapper更改:productDocumentView添加文档类型
2025-12-05 17:18:48 +08:00
f1398a5545 feat: 为搜索条目添加细分类型
- 类型细分:有原先的四大分类添加细分类型,例如产品(原纸分切机)
- 接口调整:原先的type分类改为sectionType并将type作为细分类型使用
2025-12-05 16:49:09 +08:00
36d24a4740 fix: 可选字段处理
- 为搜索条目中的可选字段进行判断并处理
2025-12-05 16:25:57 +08:00
c9b5b1fad9 feat: 为搜索页栏目添加图片缩略图功能
- 图片预览:产品与解决方案栏目添加缩略图功能
- 组件提取:在搜索结果页,将单个搜索结果单独提取为组件SearchResultCard
2025-12-05 14:56:24 +08:00
22 changed files with 326 additions and 70 deletions

View File

@ -38,6 +38,10 @@
<div class="product-info">
<h1>{{ product.name }}</h1>
<p class="summary">{{ product.summary }}</p>
<p v-if="product.status === 'discontinued'" class="discontinued-warning">
<el-icon><ElIconWarning /></el-icon>
{{ $t('product-discontinued-warning') }}
</p>
</div>
</div>
</template>
@ -105,6 +109,10 @@
margin-bottom: 2rem;
}
.discontinued-warning {
color: var(--el-color-error);
}
@media (max-width: 768px) {
.product-header {
grid-template-columns: 1fr;

View File

@ -0,0 +1,75 @@
<template>
<el-card class="result-card">
<el-row>
<el-col :span="12">
<h3 class="result-title">{{ item.title }}</h3>
<p v-if="item.summary" class="result-summary">
{{ item.summary }}
</p>
<p v-if="item.sectionType" class="result-type">
<span>{{ $t('search.section') }}: </span>
<span class="result-type-name">{{ typeLabel }}</span>
<span v-if="item.type" class="result-type-name"
>({{ item.type }})</span
>
</p>
</el-col>
<el-col :span="12" class="image-col">
<el-image
v-if="item.thumbnail"
:src="item.thumbnail"
:alt="item.title"
style="width: 150px"
/>
</el-col>
</el-row>
</el-card>
</template>
<script setup lang="ts">
defineProps<{
item: SearchItemView;
typeLabel: string;
}>();
</script>
<style scoped>
.result-card {
border-radius: 12px;
transition: box-shadow 0.2s ease;
}
.result-card:hover {
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
}
.result-title {
font-size: 1.2rem;
font-weight: 600;
color: var(--el-color-primary);
display: inline-block;
}
.result-summary {
font-size: 0.95rem;
color: var(--el-text-color-regular);
margin-bottom: 0.5rem;
line-height: 1.6;
}
.result-type {
font-size: 0.8rem;
color: var(--el-text-color-secondary);
}
.result-type-name {
margin-left: 4px;
color: var(--el-color-primary);
}
.image-col {
display: flex;
justify-content: end;
align-items: center;
}
</style>

View File

@ -3,19 +3,13 @@
<div class="search-results">
<NuxtLink
v-for="hit in paginatedHits"
:key="`${hit.type}-${hit.id}`"
:key="`${hit.sectionType}-${hit.id}`"
:to="localePath(resolveHitLink(hit))"
>
<el-card class="result-card">
<h3 class="result-title">{{ hit.title }}</h3>
<p v-if="hit.summary" class="result-summary">
{{ hit.summary }}
</p>
<p v-if="hit.type" class="result-type">
<span>{{ $t('search.section') }}: </span>
<span class="result-type-name">{{ getIndexLabel(hit.type) }}</span>
</p>
</el-card>
<search-result-card
:item="hit"
:type-label="getIndexLabel(hit.sectionType)"
/>
</NuxtLink>
</div>
@ -72,7 +66,7 @@
const items = props.searchItems;
const filteredHits = computed(() => {
if (props.category) {
return items.filter((item) => item.type === props.category);
return items.filter((item) => item.sectionType === props.category);
} else {
return items;
}
@ -116,19 +110,19 @@
const slug = String(slugCandidate);
if (item.type === 'product') {
if (item.sectionType === 'product') {
return localePath({ path: `/products/${slug}` });
}
if (item.type === 'solution') {
if (item.sectionType === 'solution') {
return localePath({ path: `/solutions/${slug}` });
}
if (item.type === 'document') {
if (item.sectionType === 'document') {
return localePath({ path: `/download/${slug}` });
}
if (item.type === 'question') {
if (item.sectionType === 'question') {
return localePath({ path: `/support/faq`, query: { focus: slug } });
}

View File

@ -32,7 +32,7 @@
const resultCount = computed(() => {
const map: Record<string, number> = { all: props.searchItems.length };
for (const item of props.searchItems) {
map[item.type] = (map[item.type] ?? 0) + 1;
map[item.sectionType] = (map[item.sectionType] ?? 0) + 1;
}
return map;
});

View File

@ -7,7 +7,17 @@
@click="handleClick(doc.fileId)"
>
<div class="document-info">
<h3>{{ doc.title }}</h3>
<div class="document-title">
<h3>
{{ doc.title }}
<span v-if="showCategory && doc.type" class="document-category">
|
</span>
<span v-if="showCategory && doc.type" class="document-category">
{{ doc.type.name }}
</span>
</h3>
</div>
<div class="document-content">
<span v-if="doc.size" class="document-meta"
>{{ $t('document-meta.size') }}: {{ formatFileSize(doc.size) }}
@ -28,6 +38,10 @@
type: Array as () => Array<ProductDocumentView>,
default: () => [],
},
showCategory: {
type: Boolean,
default: true,
},
});
const localePath = useLocalePath();
@ -63,6 +77,15 @@
color: var(--el-text-color-secondary);
}
.document-title {
margin-bottom: 0.5rem;
}
.document-category {
font-size: 0.75rem;
color: var(--el-text-color-secondary);
}
.download-button {
margin-left: auto;
}

View File

@ -84,7 +84,12 @@
&copy; {{ currentYear }} {{ $t('company-name') }}.
{{ $t('all-rights-reserved') }}
</p>
<p>备案号: 浙ICP备12003709号-5</p>
<p>
备案号:
<a href="https://beian.miit.gov.cn/" target="_blank"
>浙ICP备12003709号-5</a
>
</p>
</div>
<!-- <div class="footer-links-bottom"> -->
<!-- <NuxtLink :to="$localePath('/privacy')">{{ -->

View File

@ -131,7 +131,9 @@
mode="vertical"
@select="mobileMenuVisible = false"
>
<el-menu-item @click="openExternalLink('http://cal.jinshen.cn')">
<el-menu-item
@click="openExternalLink('http://cal.3w.jinshen.cn')"
>
{{ $t('navigation.calculator') }}
</el-menu-item>
</el-menu>

View File

@ -1,7 +1,13 @@
<template>
<div class="page-container">
<div class="page-header">
<h1 class="page-title">{{ $t('our-products') }}</h1>
<div>
<h1 class="page-title">{{ $t('our-products') }}</h1>
<p class="page-subtitle">
{{ $t('products-desc') }}{{ $t('find-discontinued-products') }}
</p>
</div>
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
</div>
<div v-if="!pending" class="page-content">
@ -102,13 +108,18 @@
.page-header {
display: flex;
margin-bottom: 1rem;
}
.page-title {
font-size: 2rem;
font-weight: bold;
color: var(--el-color-primary);
margin-bottom: 1rem;
}
.page-subtitle {
font-size: 0.8rem;
color: var(--el-text-color-secondary);
}
.breadcrumb {

View File

@ -1,7 +1,11 @@
<template>
<div class="page-container">
<div class="page-header">
<h1 class="page-title">{{ $t('learn-our-solutions') }}</h1>
<div>
<h1 class="page-title">{{ $t('learn-our-solutions') }}</h1>
<p class="page-subtitle">{{ $t('solutions-desc') }}</p>
</div>
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
</div>
<div v-if="!pending" class="solutions-container">
@ -94,15 +98,20 @@
.page-header {
display: flex;
margin-bottom: 1rem;
}
.page-title {
font-size: 2rem;
font-weight: bold;
margin-bottom: 1rem;
color: var(--el-color-primary);
}
.page-subtitle {
font-size: 0.8rem;
color: var(--el-text-color-secondary);
}
.breadcrumb {
margin-left: auto;
}

View File

@ -17,7 +17,13 @@
:document-type-options="documentTypeOptions"
/>
<document-list :documents="paginatedDocuments" />
<document-list
:documents="paginatedDocuments"
:show-category="
filters.selectedDocumentType === null ||
filters.selectedDocumentType === undefined
"
/>
<el-pagination
v-model:current-page="page"

View File

@ -23,8 +23,8 @@
"company-name": "Jinshen Machinary Manufacturing Co., Ltd.",
"company-description": "We specialize in manufacturing a range of paper tube and can equipment, integrating design, manufacturing, sales, and service.",
"learn-more": "Learn More",
"products-desc": "We provide high-quality product solutions to meet various business needs.",
"solutions-desc": "Providing customized technology solutions for enterprises to accelerate digital transformation.",
"products-desc": "We provide the latest products an instant service support to meet various business needs of our customers.",
"solutions-desc": "We offer diversified technical solutions for enterprises, supporting various fields such as industry and packaging.",
"support-desc": "24/7 professional technical support to ensure stable operation of your business.",
"quick-links": "Quick Links",
"utilities": "Utilities",
@ -63,7 +63,9 @@
"back-to-home": "Back to Home",
"no-content-available": "No detailed information available",
"loading": "Loading...",
"our-products": "Our Products",
"our-products": "Our Latest Products",
"find-discontinued-products": "To find discontinued products, please use the search function.",
"product-discontinued-warning": "Product is discontinued and may no longer receive immediate support or updates",
"learn-our-solutions": "Learn Our Solutions",
"all": "All",
"support-page-desc": "Zhejiang Jinshen Machinery Manufacturing Co., Ltd is committed to providing high-quality products and services to our customers. For products such as paper tube machines, slitting machines, and paper straw equipment, we offer comprehensive after-sales support to ensure our customers can use our products with confidence.",

View File

@ -23,8 +23,8 @@
"company-name": "Jinshen Machinary Manufacturing Co., Ltd.",
"company-description": "Especializado en la producción de una serie de equipos de tubos y latas de papel, integrando diseño, fabricación, ventas y servicio.",
"learn-more": "Saber más",
"products-desc": "Ofrecemos soluciones de productos de alta calidad que satisfacen diversas necesidades empresariales.",
"solutions-desc": "Providing customized technology solutions for enterprises to accelerate digital transformation.",
"products-desc": "Ofrecemos los últimos productos y un servicio de asistencia instantáneo para satisfacer las diversas necesidades comerciales de nuestros clientes.",
"solutions-desc": "Ofrecemos soluciones técnicas diversificadas para empresas, prestando apoyo en diversos campos, como la industria y el embalaje.",
"support-desc": "Soporte técnico profesional 24/7, asegurando la estabilidad de su negocio.",
"quick-links": "Enlaces rápidos",
"utilities": "Herramientas útiles",
@ -63,7 +63,9 @@
"back-to-home": "Volver al inicio",
"no-content-available": "No hay información disponible",
"loading": "Cargando...",
"our-products": "Nuestros productos",
"our-products": "Nuestros últimos productos",
"find-discontinued-products": "Para encontrar productos descatalogados, utilice la función de búsqueda.",
"product-discontinued-warning": "Este producto ha sido descontinuado y puede que ya no reciba soporte o actualizaciones inmediatas.",
"learn-our-solutions": "Aprenda sobre nuestras soluciones",
"all": "Todo",
"support-page-desc": "Zhejiang Jinshen Machinery Manufacturing Co., Ltd se dedica a proporcionar productos y servicios de alta calidad a los clientes. Para máquinas de tubos de papel, máquinas de corte y pajitas de papel, ofrecemos un servicio postventa integral para garantizar que los clientes puedan usar nuestros productos con confianza.",

View File

@ -23,8 +23,8 @@
"company-name": "Jinshen Machinary Manufacturing Co., Ltd.",
"company-description": "Профессионально производим оборудование для бумажных трубок и канистр, услуги по проектированию, производству, продаже и сервисному обслуживанию.",
"learn-more": "Узнать больше",
"products-desc": "Мы предоставляем высококачественные решения для различных бизнес-потребностей.",
"solutions-desc": "Предлагаем индивидуальные технологические решения для содействия цифровой трансформации.",
"products-desc": "Мы предоставляем новейшие продукты и мгновенную сервисную поддержку для удовлетворения различных бизнес-потребностей наших клиентов.",
"solutions-desc": "Мы предлагаем разнообразные технические решения для предприятий, поддерживая различные области, такие как промышленность и упаковка.",
"support-desc": "Профессиональная техническая поддержка 24/7, обеспечивающая стабильную работу вашего бизнеса.",
"quick-links": "Быстрые ссылки",
"utilities": "Полезные инструменты",
@ -63,7 +63,9 @@
"back-to-home": "Вернуться на главную",
"no-content-available": "Нет доступной информации",
"loading": "Загрузка...",
"our-products": "Наши продукты",
"our-products": "Наши последние продукты",
"find-discontinued-products": "Чтобы найти другие продукты, используйте функцию поиска.",
"product-discontinued-warning": "Этот продукт снят с производства и может больше не получать мгновенную поддержку или обновления",
"learn-our-solutions": "Узнайте о наших решениях",
"all": "Все",
"support-page-desc": "Zhejiang Jinshen Machinery Manufacturing Co., Ltd Стремится предоставлять клиентам высококачественные продукты и услуги. Мы предлагаем послепродажное обслуживание для таких продуктов, как машины для бумажных трубок и соломинок, обеспечивая уверенность клиентов в использовании нашей продукции.",

View File

@ -23,8 +23,8 @@
"company-name": "金申机械制造有限公司",
"company-description": "专业生产一系列纸管、纸罐设备,集设计、制造、销售、服务于一体。",
"learn-more": "了解更多",
"products-desc": "我们提供高质量的产品解决方案,满足各种业务需求。",
"solutions-desc": "为企业提供定制化的技术解决方案,助力数字化转型。",
"products-desc": "我们提供最新的产品与即时的服务支持,满足客户的各类业务需求。",
"solutions-desc": "我们为企业提供多样化的技术解决方案,在工业、包装等多种领域提供支持。",
"support-desc": "7x24小时专业技术支持确保您的业务稳定运行。",
"quick-links": "快速链接",
"utilities": "实用工具",
@ -63,7 +63,9 @@
"back-to-home": "返回首页",
"no-content-available": "暂无详细信息",
"loading": "加载中...",
"our-products": "我们的产品",
"our-products": "我们的最新产品",
"find-discontinued-products": "如需查找其他产品,请使用搜索功能",
"product-discontinued-warning": "本产品已停产,可能不再提供即时的支持或更新",
"learn-our-solutions": "了解我们的解决方案",
"all": "全部",
"support-page-desc": "金申机械制造有限公司致力于为客户提供优质的产品与服务。针对纸管机、分纸机、纸吸管等产品,我们提供全方位的售后服务,确保客户能够安心地使用我们的产品。",

View File

@ -51,6 +51,13 @@ query GetProduct($id: ID!, $locale: String!) {
id
product_documents_id(filter: { status: { _eq: "published" } }) {
id
type {
id
translations(filter: { languages_code: { code: { _eq: $locale } } }) {
id
name
}
}
file {
id
filesize

View File

@ -347,6 +347,15 @@ describe('toProductDocumentView', () => {
filesize: 1000,
filename_download: 'doc1.pdf',
},
type: {
id: 1,
translations: [
{
id: 1,
name: 'manual',
},
],
},
translations: [
{
id: 1,
@ -363,6 +372,10 @@ describe('toProductDocumentView', () => {
fileId: 'rand-om__-uuid-1234',
filename: 'doc1.pdf',
title: 'Document Title 1',
type: {
id: '1',
name: 'manual',
},
size: 1000,
url: '/api/assets/rand-om__-uuid-1234',
},
@ -391,6 +404,10 @@ describe('toProductDocumentView', () => {
fileId: 'rand-om__-uuid-1234',
filename: 'doc1.pdf',
title: '',
type: {
id: '-1',
name: '',
},
size: 1000,
url: '/api/assets/rand-om__-uuid-1234',
},
@ -413,6 +430,10 @@ describe('toProductDocumentView', () => {
filename: '',
title: '',
size: 0,
type: {
id: '-1',
name: '',
},
url: '',
},
{
@ -421,6 +442,10 @@ describe('toProductDocumentView', () => {
filename: '',
title: '',
size: 0,
type: {
id: '-1',
name: '',
},
url: '',
},
]);
@ -431,21 +456,26 @@ describe('toProductDocumentView', () => {
* 单元测试: toProductView
*/
describe('toProductView', () => {
const baseData: Product = {
id: 1,
status: 'in-production',
translations: [
{
id: 1,
name: 'Product Name',
summary: 'Product Summary',
description: 'Product Description',
},
],
};
test('convert raw data to ProductView correctly', () => {
const rawData: Product = {
id: 1,
translations: [
{
id: 1,
name: 'Product Name',
summary: 'Product Summary',
description: 'Product Description',
},
],
...baseData,
};
expect(toProductView(rawData)).toEqual({
id: '1',
status: 'in-production',
name: 'Product Name',
summary: 'Product Summary',
description: 'Product Description',
@ -458,12 +488,13 @@ describe('toProductView', () => {
test('convert raw data with missing translations', () => {
const rawData: Product = {
id: 1,
...baseData,
translations: [],
};
expect(toProductView(rawData)).toEqual({
id: '1',
status: 'in-production',
name: '',
summary: '',
description: '',
@ -473,4 +504,23 @@ describe('toProductView', () => {
specs: [],
});
});
test('conert raw data with missing status', () => {
const rawData: Product = {
...baseData,
status: undefined,
};
expect(toProductView(rawData)).toEqual({
id: '1',
status: 'discontinued',
name: 'Product Name',
summary: 'Product Summary',
description: 'Product Description',
images: [],
documents: [],
faqs: [],
specs: [],
});
});
});

View File

@ -1,4 +1,5 @@
import { isObject } from '../../server/utils/object';
import { toDocumentTypeView } from './documentMapper';
/**
* 将 Directus 返回的 ProductImage 数据转换为 ProductImageView 视图模型
@ -161,6 +162,10 @@ export function toProductDocumentView(
size: 0,
title: '',
url: '',
type: {
id: '-1',
name: '',
},
} satisfies ProductDocumentView;
}
@ -173,6 +178,10 @@ export function toProductDocumentView(
size: 0,
title: '',
url: '',
type: {
id: '-1',
name: '',
},
} satisfies ProductDocumentView;
}
@ -184,6 +193,8 @@ export function toProductDocumentView(
const trans = document.translations?.[0];
const typeView = toDocumentTypeView(document.type ?? null);
return {
id: item.id.toString(),
fileId: file?.id ?? '',
@ -191,6 +202,7 @@ export function toProductDocumentView(
size: file?.filesize ?? 0,
title: trans?.title ?? '',
url: url,
type: typeView,
} satisfies ProductDocumentView;
});
}
@ -207,6 +219,8 @@ export function toProductDocumentView(
export function toProductView(raw: Product): ProductView {
const trans = raw.translations?.[0];
const status = raw.status ?? 'discontinued';
const images = toProductImageView(raw.images ?? []);
const specs = toProductSpecGroupView(raw.specs ?? []);
@ -217,6 +231,7 @@ export function toProductView(raw: Product): ProductView {
return {
id: raw.id.toString(),
status: status,
name: trans?.name ?? '',
summary: trans?.summary ?? '',
images: images,

View File

@ -12,13 +12,16 @@ describe('converters', () => {
summary: 'High efficiency',
description: 'Detailed description',
type: 'pump',
cover: 'rand-om__-uuid-1234',
};
const result = converters.products(item);
expect(result).toEqual({
id: 1,
type: 'product',
sectionType: 'product',
title: 'Hydraulic Pump',
summary: 'High efficiency',
type: 'pump',
thumbnail: '/api/assets/rand-om__-uuid-1234',
});
});
@ -29,13 +32,16 @@ describe('converters', () => {
summary: 'Effective solution',
content: 'Detailed content',
type: 'Type A',
cover: 'rand-om__-uuid-5678',
};
const result = converters.solutions(item);
expect(result).toEqual({
id: 1,
type: 'solution',
sectionType: 'solution',
title: 'Solution A',
summary: 'Effective solution',
type: 'Type A',
thumbnail: '/api/assets/rand-om__-uuid-5678',
});
});
@ -47,13 +53,15 @@ describe('converters', () => {
'This is a detailed explanation of how to use the product effectively.',
products: ['Product A'],
product_types: ['Type A'],
type: 'Question Type',
};
const result = converters.questions(item);
expect(result).toEqual({
id: 1,
title: 'How to use product?',
summary: '',
type: 'question',
summary: undefined,
type: 'Question Type',
sectionType: 'question',
});
});
@ -64,13 +72,15 @@ describe('converters', () => {
products: ['Product A'],
product_types: ['Type A'],
fileUUID: 'TEST-UUID',
type: 'manual',
};
const result = converters.product_documents(item);
expect(result).toEqual({
id: 'TEST-UUID',
title: 'User Manual',
summary: '',
type: 'document',
summary: undefined,
sectionType: 'document',
type: 'manual',
});
});
});

View File

@ -6,31 +6,35 @@ export const converters: {
} = {
products: (item: MeiliIndexMap['products']): SearchItemView => ({
id: item.id,
type: 'product',
sectionType: 'product',
title: item.name,
summary: item.summary,
summary: item?.summary,
type: item?.type,
thumbnail: item?.cover ? `/api/assets/${item.cover}` : undefined,
}),
solutions: (item: MeiliIndexMap['solutions']): SearchItemView => ({
id: item.id,
type: 'solution',
sectionType: 'solution',
title: item.title,
summary: item.summary,
summary: item?.summary,
type: item?.type,
thumbnail: item?.cover ? `/api/assets/${item.cover}` : undefined,
}),
questions: (item: MeiliIndexMap['questions']): SearchItemView => ({
id: item.id,
type: 'question',
sectionType: 'question',
title: item.title,
summary: '',
type: item?.type,
}),
product_documents: (
item: MeiliIndexMap['product_documents']
): SearchItemView => ({
id: item.fileUUID || item.id,
type: 'document',
sectionType: 'document',
title: item.title,
summary: '',
type: item?.type,
}),
};

View File

@ -9,13 +9,16 @@ export interface MeiliProductIndex {
name: string;
/** 产品简介 **/
summary: string;
summary?: string;
/** 产品详情 **/
description: string;
description?: string;
/** 产品类型 **/
type: string;
type?: string;
/** 产品缩略图 **/
cover?: string;
}
/**
@ -29,13 +32,16 @@ export interface MeiliSolutionIndex {
title: string;
/** 解决方案摘要 **/
summary: string;
summary?: string;
/** 解决方案内容 **/
content: string;
content?: string;
/** 解决方案类型 **/
type: string;
type?: string;
/** 解决方案缩略图 **/
cover?: string;
}
/**
@ -49,7 +55,10 @@ export interface MeiliQuestionIndex {
title: string;
/** 问题内容 **/
content: string;
content?: string;
/** 问题类型 **/
type?: string;
/** 相关产品 **/
products: string[];
@ -68,6 +77,9 @@ export interface MeiliProductDocumentIndex {
/** 文档标题 **/
title: string;
/** 文档类型 **/
type?: string;
/** 相关产品 **/
products: string[];

View File

@ -1,3 +1,8 @@
import type { DocumentTypeView } from './document-list-view';
import type { Product } from '../directus/my-schema.ts';
type ProductStatus = Product['status'];
/**
* 产品图片视图模型
* 用于产品详情页(/products/[slug])中的产品图片数据结构
@ -73,6 +78,9 @@ export interface ProductDocumentView {
/** 文档大小 **/
size: number;
/** 文档类型 **/
type: DocumentTypeView;
/** 文档链接 **/
url: string;
}
@ -85,6 +93,9 @@ export interface ProductView {
/** 唯一标识符 **/
id: string;
/** 产品状态 **/
status: ProductStatus;
/** 产品名称 **/
name: string;

View File

@ -3,11 +3,17 @@ export interface SearchItemView {
id: number | string;
/** 条目类型 **/
type: 'product' | 'solution' | 'question' | 'document';
sectionType: 'product' | 'solution' | 'question' | 'document';
/** 条目标题 **/
title: string;
/** 条目摘要 **/
summary: string;
summary?: string;
/** 条目分类 **/
type?: string;
/** 条目预览图 **/
thumbnail?: string;
}