feat(CMS)!: 将项目后端由Strapi迁移至Directus
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m49s
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m49s
- 将项目后端由Strapi迁移至Directus - 加强类型标注 - 调整部分路由名称 - 分离原始后端数据与视图对象数据 Issue: resolve #42
This commit is contained in:
19
app/app.vue
19
app/app.vue
@ -11,26 +11,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ElConfigProvider } from 'element-plus';
|
import { ElConfigProvider } from 'element-plus';
|
||||||
|
|
||||||
const { login } = useStrapiAuth();
|
|
||||||
|
|
||||||
const { getElementPlusLocale } = useLocalizations();
|
const { getElementPlusLocale } = useLocalizations();
|
||||||
|
|
||||||
const elementPlusLocale = getElementPlusLocale();
|
const elementPlusLocale = getElementPlusLocale();
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
// 检查用户是否已登录
|
|
||||||
const user = useStrapiUser();
|
|
||||||
if (!user.value) {
|
|
||||||
// 如果未登录,重定向到登录页面
|
|
||||||
login({ identifier: 'remilia', password: 'huanshuo51' })
|
|
||||||
.then(() => {
|
|
||||||
console.log('Login successful');
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Login failed:', error);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log('User is already logged in:', user.value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -6,18 +6,19 @@
|
|||||||
class="document-card"
|
class="document-card"
|
||||||
>
|
>
|
||||||
<div class="document-info">
|
<div class="document-info">
|
||||||
<h3>{{ doc.caption || doc.name }}</h3>
|
<h3>{{ doc.title }}</h3>
|
||||||
<div class="document-content">
|
<div class="document-content">
|
||||||
<span v-if="doc.size" class="document-meta"
|
<span v-if="doc.size" class="document-meta"
|
||||||
>大小: {{ formatFileSize(doc.size) }}
|
>大小: {{ formatFileSize(doc.size) }}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="doc.ext" class="document-meta"
|
<span v-if="doc.filename" class="document-meta"
|
||||||
>格式: {{ formatFileExtension(doc.ext) }}</span
|
>格式:
|
||||||
|
{{ formatFileExtension(getFileExtension(doc.filename)) }}</span
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
class="download-button"
|
class="download-button"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleDownload(doc.name, doc.url)"
|
@click="handleDownload(doc.title, doc.url)"
|
||||||
>
|
>
|
||||||
下载
|
下载
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -30,7 +31,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineProps({
|
defineProps({
|
||||||
documents: {
|
documents: {
|
||||||
type: Array as () => Array<StrapiMedia>,
|
type: Array as () => Array<ProductDocumentView>,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -20,8 +20,8 @@
|
|||||||
<NuxtLinkLocale to="/">{{ $t('navigation.home') }}</NuxtLinkLocale>
|
<NuxtLinkLocale to="/">{{ $t('navigation.home') }}</NuxtLinkLocale>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<NuxtLink :to="$localePath('/productions')">{{
|
<NuxtLink :to="$localePath('/products')">{{
|
||||||
$t('navigation.productions')
|
$t('navigation.products')
|
||||||
}}</NuxtLink>
|
}}</NuxtLink>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@ -21,8 +21,8 @@
|
|||||||
:persistent="false"
|
:persistent="false"
|
||||||
router
|
router
|
||||||
>
|
>
|
||||||
<el-menu-item index="productions" :route="$localePath('/productions')">
|
<el-menu-item index="products" :route="$localePath('/products')">
|
||||||
<span class="title">{{ $t('navigation.productions') }}</span>
|
<span class="title">{{ $t('navigation.products') }}</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="solutions" :route="$localePath('/solutions')">
|
<el-menu-item index="solutions" :route="$localePath('/solutions')">
|
||||||
<span class="title">{{ $t('navigation.solutions') }}</span>
|
<span class="title">{{ $t('navigation.solutions') }}</span>
|
||||||
@ -81,8 +81,8 @@
|
|||||||
|
|
||||||
const refreshMenu = () => {
|
const refreshMenu = () => {
|
||||||
const path = router.currentRoute.value.path;
|
const path = router.currentRoute.value.path;
|
||||||
if (path.startsWith('/productions')) {
|
if (path.startsWith('/products')) {
|
||||||
activeName.value = 'productions';
|
activeName.value = 'products';
|
||||||
} else if (path.startsWith('/solutions')) {
|
} else if (path.startsWith('/solutions')) {
|
||||||
activeName.value = 'solutions';
|
activeName.value = 'solutions';
|
||||||
} else if (path.startsWith('/support')) {
|
} else if (path.startsWith('/support')) {
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card class="production-card" @click="handleClick">
|
<el-card class="product-card" @click="handleClick">
|
||||||
<template #header>
|
<template #header>
|
||||||
<!-- Image -->
|
<!-- Image -->
|
||||||
<el-image class="production-image" :src="imageUrl" fit="contain" />
|
<el-image class="product-image" :src="imageUrl" fit="contain" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<!-- Name -->
|
<!-- Name -->
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<span class="production-name">{{ name }}</span>
|
<span class="product-name">{{ name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- Description -->
|
<!-- Description -->
|
||||||
<div class="card-description text-left opacity-25">{{ description }}</div>
|
<div class="card-description text-left opacity-25">{{ description }}</div>
|
||||||
@ -32,25 +32,25 @@
|
|||||||
// 优先使用 slug,如果没有则使用 id
|
// 优先使用 slug,如果没有则使用 id
|
||||||
const routeParam = props.slug || props.id;
|
const routeParam = props.slug || props.id;
|
||||||
if (routeParam) {
|
if (routeParam) {
|
||||||
navigateTo(localePath(`/productions/${routeParam}`));
|
navigateTo(localePath(`/products/${routeParam}`));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.production-card {
|
.product-card {
|
||||||
width: 30%;
|
width: 30%;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-card:hover {
|
.product-card:hover {
|
||||||
transform: translateY(-4px);
|
transform: translateY(-4px);
|
||||||
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-name {
|
.product-name {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@
|
|||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-card .el-image {
|
.product-card .el-image {
|
||||||
height: 150px;
|
height: 150px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
@ -73,13 +73,13 @@
|
|||||||
|
|
||||||
/* 响应式设计 */
|
/* 响应式设计 */
|
||||||
@media (max-width: 1200px) {
|
@media (max-width: 1200px) {
|
||||||
.production-card {
|
.product-card {
|
||||||
width: 45%;
|
width: 45%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.production-card {
|
.product-card {
|
||||||
width: 90%;
|
width: 90%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,9 +3,9 @@
|
|||||||
<el-collapse class="question-collapse" accordion>
|
<el-collapse class="question-collapse" accordion>
|
||||||
<el-collapse-item
|
<el-collapse-item
|
||||||
v-for="question in questions"
|
v-for="question in questions"
|
||||||
:key="question.documentId"
|
:key="question.id"
|
||||||
:title="question.title"
|
:title="question.title"
|
||||||
:name="question.documentId"
|
:name="question.id"
|
||||||
>
|
>
|
||||||
<markdown-renderer :content="question.content || ''" />
|
<markdown-renderer :content="question.content || ''" />
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
@ -16,11 +16,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineProps({
|
defineProps({
|
||||||
questions: {
|
questions: {
|
||||||
type: Array as () => Array<{
|
type: Array as PropType<ProductQuestionView[]>,
|
||||||
title: string;
|
|
||||||
content: string;
|
|
||||||
documentId: string;
|
|
||||||
}>,
|
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,14 +2,14 @@
|
|||||||
<div v-if="hasResults">
|
<div v-if="hasResults">
|
||||||
<div class="search-results">
|
<div class="search-results">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
v-for="(hit, hitIndex) in paginatedHits"
|
v-for="hit in paginatedHits"
|
||||||
:key="`${getHitIdentifier(hit.content, hitIndex)}`"
|
:key="`${hit.type}-${hit.id}`"
|
||||||
:to="localePath(resolveHitLink(hit.content))"
|
:to="localePath(resolveHitLink(hit))"
|
||||||
>
|
>
|
||||||
<el-card class="result-card">
|
<el-card class="result-card">
|
||||||
<h3 class="result-title">{{ getHitTitle(hit.content) }}</h3>
|
<h3 class="result-title">{{ hit.title }}</h3>
|
||||||
<p v-if="getHitSummary(hit.content)" class="result-summary">
|
<p v-if="hit.summary" class="result-summary">
|
||||||
{{ getHitSummary(hit.content) }}
|
{{ hit.summary }}
|
||||||
</p>
|
</p>
|
||||||
<p v-if="hit.type" class="result-type">
|
<p v-if="hit.type" class="result-type">
|
||||||
<span>内容类型: </span>
|
<span>内容类型: </span>
|
||||||
@ -44,13 +44,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
interface HitItem {
|
|
||||||
content: SearchHit;
|
|
||||||
type: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
hitItems: HitItem[];
|
searchItems: SearchItemView[];
|
||||||
currentPage: number;
|
currentPage: number;
|
||||||
category?: string;
|
category?: string;
|
||||||
}>();
|
}>();
|
||||||
@ -74,12 +69,12 @@
|
|||||||
const pageSize = ref(5);
|
const pageSize = ref(5);
|
||||||
|
|
||||||
// 搜索相关
|
// 搜索相关
|
||||||
const hits = props.hitItems;
|
const items = props.searchItems;
|
||||||
const filteredHits = computed(() => {
|
const filteredHits = computed(() => {
|
||||||
if (props.category) {
|
if (props.category) {
|
||||||
return hits.filter((hit) => hit.type === props.category);
|
return items.filter((item) => item.type === props.category);
|
||||||
} else {
|
} else {
|
||||||
return hits;
|
return items;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const paginatedHits = computed(() => {
|
const paginatedHits = computed(() => {
|
||||||
@ -89,7 +84,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const indexLabels = computed<Record<string, string>>(() => ({
|
const indexLabels = computed<Record<string, string>>(() => ({
|
||||||
production: t('search.sections.production'),
|
product: t('search.sections.product'),
|
||||||
solution: t('search.sections.solution'),
|
solution: t('search.sections.solution'),
|
||||||
support: t('search.sections.support'),
|
support: t('search.sections.support'),
|
||||||
default: t('search.sections.default'),
|
default: t('search.sections.default'),
|
||||||
@ -106,64 +101,13 @@
|
|||||||
return filteredHits.value.length > 0;
|
return filteredHits.value.length > 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取搜索条目的唯一标识符
|
|
||||||
* 尝试根据搜索条目的相关词条获取唯一标识符
|
|
||||||
* 若未找到,则fallback至给定的index
|
|
||||||
* @param hit 搜索条目
|
|
||||||
* @param index 条目索引
|
|
||||||
*/
|
|
||||||
const getHitIdentifier = (hit: SearchHit, index: number) => {
|
|
||||||
const candidate = [hit.objectID, hit.documentId, hit.id, hit.slug].find(
|
|
||||||
(value) =>
|
|
||||||
['string', 'number'].includes(typeof value) && String(value).length > 0
|
|
||||||
);
|
|
||||||
return candidate != null ? String(candidate) : String(index);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取搜索条目的标题
|
|
||||||
* @param hit 搜索条目
|
|
||||||
*/
|
|
||||||
const getHitTitle = (hit: SearchHit) => {
|
|
||||||
const candidate = [
|
|
||||||
hit.title,
|
|
||||||
hit.name,
|
|
||||||
hit.heading,
|
|
||||||
hit.documentTitle,
|
|
||||||
].find((value) => typeof value === 'string' && value.trim().length > 0);
|
|
||||||
return candidate ? String(candidate) : t('search.untitled');
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取搜索条目的摘要
|
|
||||||
* @param hit 搜索条目
|
|
||||||
*/
|
|
||||||
const getHitSummary = (hit: SearchHit) => {
|
|
||||||
const candidate = [
|
|
||||||
hit.summary,
|
|
||||||
hit.description,
|
|
||||||
hit.snippet,
|
|
||||||
hit.content,
|
|
||||||
hit.text,
|
|
||||||
].find((value) => typeof value === 'string' && value.trim().length > 0);
|
|
||||||
return candidate ? String(candidate) : '';
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析条目链接
|
* 解析条目链接
|
||||||
* 根据条目类型返回正确的跳转链接
|
* 根据条目类型返回正确的跳转链接
|
||||||
* @param hit 搜索条目
|
* @param item 搜索条目
|
||||||
*/
|
*/
|
||||||
const resolveHitLink = (hit: SearchHit) => {
|
const resolveHitLink = (item: SearchItemView) => {
|
||||||
if (typeof hit.route === 'string' && hit.route.trim().length > 0) {
|
const slugCandidate = item.id;
|
||||||
return localePath(hit.route);
|
|
||||||
}
|
|
||||||
|
|
||||||
const slugCandidate = [hit.slug, hit.documentId, hit.id, hit.objectID].find(
|
|
||||||
(value) =>
|
|
||||||
['string', 'number'].includes(typeof value) && String(value).length > 0
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!slugCandidate) {
|
if (!slugCandidate) {
|
||||||
return null;
|
return null;
|
||||||
@ -171,11 +115,11 @@
|
|||||||
|
|
||||||
const slug = String(slugCandidate);
|
const slug = String(slugCandidate);
|
||||||
|
|
||||||
if (hit.indexUid === 'production') {
|
if (item.type === 'product') {
|
||||||
return localePath({ path: `/productions/${slug}` });
|
return localePath({ path: `/products/${slug}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hit.indexUid === 'solution') {
|
if (item.type === 'solution') {
|
||||||
return localePath({ path: `/solutions/${slug}` });
|
return localePath({ path: `/solutions/${slug}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,15 +3,15 @@
|
|||||||
<el-collapse v-model="activeName">
|
<el-collapse v-model="activeName">
|
||||||
<el-collapse-item
|
<el-collapse-item
|
||||||
v-for="item in data"
|
v-for="item in data"
|
||||||
:key="item.title"
|
:key="item.name"
|
||||||
:title="item.title"
|
:title="item.name"
|
||||||
:name="item.title"
|
:name="item.name"
|
||||||
>
|
>
|
||||||
<el-descriptions :column="1" border>
|
<el-descriptions :column="1" border>
|
||||||
<el-descriptions-item
|
<el-descriptions-item
|
||||||
v-for="subItem in item.items"
|
v-for="subItem in item.specs"
|
||||||
:key="subItem.label"
|
:key="subItem.key"
|
||||||
:label="subItem.label"
|
:label="subItem.value"
|
||||||
>
|
>
|
||||||
{{ subItem.value }}
|
{{ subItem.value }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
@ -24,15 +24,15 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object as () => ProductionSpecGroup[],
|
type: Object as () => ProductSpecGroupView[],
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 默认全部展开
|
// 默认全部展开
|
||||||
const activeName = ref<string[]>(
|
const activeName = ref<string[]>(
|
||||||
props.data.map((item: ProductionSpecGroup) => {
|
props.data.map((item: ProductSpecGroupView) => {
|
||||||
return item.title;
|
return item.name;
|
||||||
}) || []
|
}) || []
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
11
app/composables/directus/index.ts
Normal file
11
app/composables/directus/index.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export * from './useDirectusImage';
|
||||||
|
export * from './useDirectusFiles';
|
||||||
|
export * from './useProductList';
|
||||||
|
export * from './useProduct';
|
||||||
|
export * from './useSolutionList';
|
||||||
|
export * from './useSolution';
|
||||||
|
export * from './useQuestionList';
|
||||||
|
export * from './useDocumentList';
|
||||||
|
export * from './useContactInfo';
|
||||||
|
export * from './useCompanyProfile';
|
||||||
|
export * from './useHomepage';
|
||||||
29
app/composables/directus/useCompanyProfile.ts
Normal file
29
app/composables/directus/useCompanyProfile.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import { readSingleton } from '@directus/sdk';
|
||||||
|
|
||||||
|
export const useCompanyProfile = () => {
|
||||||
|
const { $directus } = useNuxtApp();
|
||||||
|
const { getDirectusLocale } = useLocalizations();
|
||||||
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
|
return useAsyncData(`company-profile-${locale}`, async () => {
|
||||||
|
return await $directus.request(
|
||||||
|
readSingleton('company_profile', {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['id', 'content'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
deep: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: {
|
||||||
|
_eq: locale,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
29
app/composables/directus/useContactInfo.ts
Normal file
29
app/composables/directus/useContactInfo.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import { readSingleton } from '@directus/sdk';
|
||||||
|
|
||||||
|
export const useContactInfo = () => {
|
||||||
|
const { $directus } = useNuxtApp();
|
||||||
|
const { getDirectusLocale } = useLocalizations();
|
||||||
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
|
return useAsyncData(`contact-info-${locale}`, async () => {
|
||||||
|
return await $directus.request(
|
||||||
|
readSingleton('contact_info', {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['id', 'content'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
deep: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: {
|
||||||
|
_eq: locale,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
22
app/composables/directus/useDirectusFiles.ts
Normal file
22
app/composables/directus/useDirectusFiles.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
export const useDirectusFiles = () => {
|
||||||
|
const config = useRuntimeConfig();
|
||||||
|
const baseUrl = config.public.directus.url;
|
||||||
|
|
||||||
|
const getFileUrl = (
|
||||||
|
id?: string | null,
|
||||||
|
options?: Record<string, string | number | boolean>
|
||||||
|
): string => {
|
||||||
|
if (!id) return '';
|
||||||
|
const query = options
|
||||||
|
? '?' +
|
||||||
|
new URLSearchParams(
|
||||||
|
Object.entries(options).map(([key, value]) => [key, String(value)])
|
||||||
|
).toString()
|
||||||
|
: '';
|
||||||
|
return `${baseUrl}/assets/${id}${query}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
getFileUrl,
|
||||||
|
};
|
||||||
|
};
|
||||||
32
app/composables/directus/useDirectusImage.ts
Normal file
32
app/composables/directus/useDirectusImage.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
export const useDirectusImage = () => {
|
||||||
|
const config = useRuntimeConfig();
|
||||||
|
const baseUrl = config.public.directus.url;
|
||||||
|
const token = config.public.directus.token;
|
||||||
|
|
||||||
|
type DirectusAssetParams = {
|
||||||
|
width?: number;
|
||||||
|
height?: number;
|
||||||
|
fit?: 'cover' | 'contain' | 'inside' | 'outside';
|
||||||
|
quality?: number;
|
||||||
|
format?: 'webp' | 'jpg' | 'png' | 'auto';
|
||||||
|
} & Record<string, string | number | boolean>;
|
||||||
|
|
||||||
|
const getImageUrl = (id?: string | null, options?: DirectusAssetParams) => {
|
||||||
|
if (!id) return '';
|
||||||
|
const queryToken = token ? 'access_token=' + token : '';
|
||||||
|
const queryOptions = options
|
||||||
|
? new URLSearchParams(
|
||||||
|
Object.fromEntries(
|
||||||
|
Object.entries(options).map(([key, value]) => [key, String(value)])
|
||||||
|
)
|
||||||
|
).toString
|
||||||
|
: '';
|
||||||
|
const query =
|
||||||
|
queryToken || queryOptions
|
||||||
|
? `?${[queryToken, queryOptions].filter(Boolean).join('&')}`
|
||||||
|
: '';
|
||||||
|
return `${baseUrl}/assets/${id}${query}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
return { getImageUrl };
|
||||||
|
};
|
||||||
67
app/composables/directus/useDocumentList.ts
Normal file
67
app/composables/directus/useDocumentList.ts
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
import { readItems } from '@directus/sdk';
|
||||||
|
|
||||||
|
export const useDocumentList = () => {
|
||||||
|
const { $directus } = useNuxtApp();
|
||||||
|
const { getDirectusLocale } = useLocalizations();
|
||||||
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
|
return useAsyncData(`document-list-${locale}`, async () => {
|
||||||
|
return await $directus.request(
|
||||||
|
readItems('product_documents', {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
file: ['id', 'filesize', 'filename_download'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
translations: ['id', 'title'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
products: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
products_id: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['id', 'name'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
product_type: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['id', 'name'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
deep: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
products: {
|
||||||
|
products_id: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
product_type: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
54
app/composables/directus/useHomepage.ts
Normal file
54
app/composables/directus/useHomepage.ts
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import { readSingleton } from '@directus/sdk';
|
||||||
|
|
||||||
|
export const useHomepage = () => {
|
||||||
|
const { $directus } = useNuxtApp();
|
||||||
|
const { getDirectusLocale } = useLocalizations();
|
||||||
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
|
return useAsyncData(`homepage-${locale}`, async () => {
|
||||||
|
return await $directus.request(
|
||||||
|
readSingleton('homepage', {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
carousel: ['id', 'directus_files_id'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
recommend_products: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['id', 'name', 'summary'],
|
||||||
|
},
|
||||||
|
'cover',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
recommend_solutions: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['id', 'title', 'summary'],
|
||||||
|
},
|
||||||
|
'cover',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
deep: {
|
||||||
|
recommend_products: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
recommend_solutions: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
111
app/composables/directus/useProduct.ts
Normal file
111
app/composables/directus/useProduct.ts
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
import { readItem } from '@directus/sdk';
|
||||||
|
|
||||||
|
export const useProduct = (id: string) => {
|
||||||
|
const { $directus } = useNuxtApp();
|
||||||
|
|
||||||
|
const { getDirectusLocale } = useLocalizations();
|
||||||
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
|
return useAsyncData(`product-${id}-${locale}`, async () => {
|
||||||
|
return await $directus.request(
|
||||||
|
readItem('products', id, {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
{ translations: ['id', 'name', 'summary', 'description'] },
|
||||||
|
{
|
||||||
|
images: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
product_images_id: [
|
||||||
|
'id',
|
||||||
|
'image',
|
||||||
|
{ translations: ['id', 'caption'] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
specs: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['*'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
specs: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['id', 'key'],
|
||||||
|
},
|
||||||
|
'value',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
faqs: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
questions_id: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['id', 'title', 'content'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
documents: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
product_documents_id: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
file: ['id', 'filesize', 'filename_download'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
translations: ['id', 'title'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
deep: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
images: {
|
||||||
|
product_images_id: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
faqs: {
|
||||||
|
questions_id: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
documents: {
|
||||||
|
documents_id: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
42
app/composables/directus/useProductList.ts
Normal file
42
app/composables/directus/useProductList.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import { readItems } from '@directus/sdk';
|
||||||
|
|
||||||
|
export const useProductList = () => {
|
||||||
|
const { $directus } = useNuxtApp();
|
||||||
|
|
||||||
|
const { getDirectusLocale } = useLocalizations();
|
||||||
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
|
return useAsyncData(`product-list-${locale}`, async () => {
|
||||||
|
return await $directus.request(
|
||||||
|
readItems('products', {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
{ translations: ['id', 'name', 'summary'] },
|
||||||
|
'cover',
|
||||||
|
{
|
||||||
|
product_type: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['id', 'name'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
deep: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
product_type: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
63
app/composables/directus/useQuestionList.ts
Normal file
63
app/composables/directus/useQuestionList.ts
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import { readItems } from '@directus/sdk';
|
||||||
|
|
||||||
|
export const useQuestionList = () => {
|
||||||
|
const { $directus } = useNuxtApp();
|
||||||
|
|
||||||
|
const { getDirectusLocale } = useLocalizations();
|
||||||
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
|
return useAsyncData(`question-list-${locale}`, async () => {
|
||||||
|
return await $directus.request(
|
||||||
|
readItems('questions', {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['*'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
products: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
products_id: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
product_type: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['id', 'name'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ translations: ['id', 'name'] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
deep: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
products: {
|
||||||
|
products_id: {
|
||||||
|
product_type: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
28
app/composables/directus/useSolution.ts
Normal file
28
app/composables/directus/useSolution.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { readItem } from '@directus/sdk';
|
||||||
|
|
||||||
|
export const useSolution = (id: string) => {
|
||||||
|
const { $directus } = useNuxtApp();
|
||||||
|
const { getDirectusLocale } = useLocalizations();
|
||||||
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
|
return useAsyncData(`solution-${id}-${locale}`, async () => {
|
||||||
|
return await $directus.request(
|
||||||
|
readItem('solutions', id, {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
{
|
||||||
|
translations: ['*'],
|
||||||
|
},
|
||||||
|
'create_at',
|
||||||
|
],
|
||||||
|
deep: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
38
app/composables/directus/useSolutionList.ts
Normal file
38
app/composables/directus/useSolutionList.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import { readItems } from '@directus/sdk';
|
||||||
|
|
||||||
|
export const useSolutionList = () => {
|
||||||
|
const { $directus } = useNuxtApp();
|
||||||
|
const { getDirectusLocale } = useLocalizations();
|
||||||
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
|
return useAsyncData(`solution-list-${locale}`, async () => {
|
||||||
|
return await $directus.request(
|
||||||
|
readItems('solutions', {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
'cover',
|
||||||
|
{
|
||||||
|
type: ['id', { translations: ['id', 'name'] }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
translations: ['id', 'title', 'summary'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
deep: {
|
||||||
|
type: {
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
translations: {
|
||||||
|
_filter: {
|
||||||
|
languages_code: { _eq: locale },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
3
app/composables/index.ts
Normal file
3
app/composables/index.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export * from './directus';
|
||||||
|
export * from './useLocalizations';
|
||||||
|
export * from './useMeilisearch';
|
||||||
@ -3,38 +3,94 @@ import type { Language as ElementLanguage } from 'element-plus/es/locale';
|
|||||||
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
||||||
import en from 'element-plus/es/locale/lang/en';
|
import en from 'element-plus/es/locale/lang/en';
|
||||||
|
|
||||||
// Strapi本地化映射
|
/**
|
||||||
export const strapiLocales: Record<string, StrapiLocale> = {
|
* 应用语言映射结构
|
||||||
zh: 'zh-CN',
|
* 用于统一 Strapi / Directus / Element Plus 的多语言配置
|
||||||
en: 'en',
|
*/
|
||||||
};
|
export interface LocaleMapping {
|
||||||
|
/** 用于StrapiLocale **/
|
||||||
|
strapi: StrapiLocale;
|
||||||
|
/** 用于Directus translations.languages_code **/
|
||||||
|
directus: string;
|
||||||
|
/** Element Plus语言对象 **/
|
||||||
|
element: ElementLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
// Element Plus本地化映射
|
/**
|
||||||
export const elementPlusLocales: Record<string, ElementLanguage> = {
|
* 应用支持的语言映射表。
|
||||||
zh: zhCn,
|
*
|
||||||
en: en,
|
* 每个键(如 "zh"、"en")对应一套统一的本地化配置,
|
||||||
};
|
* 方便在 Strapi / Directus / Element Plus 三方系统间保持一致。
|
||||||
|
*/
|
||||||
|
export const localeMap = {
|
||||||
|
zh: {
|
||||||
|
strapi: 'zh-CN',
|
||||||
|
directus: 'zh-CN',
|
||||||
|
element: zhCn,
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
strapi: 'en',
|
||||||
|
directus: 'en-US',
|
||||||
|
element: en,
|
||||||
|
},
|
||||||
|
} satisfies Record<string, LocaleMapping>;
|
||||||
|
|
||||||
|
/** 应用支持的语言键类型 **/
|
||||||
|
export type AppLocale = keyof typeof localeMap;
|
||||||
|
|
||||||
|
/** 默认语言, 当找不到匹配语言时回退到默认语言 **/
|
||||||
|
const defaultLocale: AppLocale = 'zh';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提供 Strapi、 Directus 与 Element Plus的国际化映射工具
|
||||||
|
*
|
||||||
|
* ---
|
||||||
|
* @example
|
||||||
|
* ``` ts
|
||||||
|
* const { locale, getStrapiLocale, getElementPlusLocale } = useLocalizations()
|
||||||
|
*
|
||||||
|
* const strapiLang = getStrapiLocale() // 当前 Strapi 语言码
|
||||||
|
* const elLocale = getElementPlusLocale('en') // 获取 Element Plus 英文对象
|
||||||
|
* const all = getLocaleMapping('zh') // 获取完整映射结构
|
||||||
|
* ```
|
||||||
|
* ---
|
||||||
|
*
|
||||||
|
* @returns 返回当前语言及各系统的本地化获取方法
|
||||||
|
*/
|
||||||
export const useLocalizations = () => {
|
export const useLocalizations = () => {
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n<{ locale: Ref<AppLocale> }>();
|
||||||
|
|
||||||
// 获取Strapi本地化代码
|
/**
|
||||||
const getStrapiLocale = (nuxtLocale?: string): StrapiLocale => {
|
* 获取对应语言的完整映射结构
|
||||||
const currentLocale = nuxtLocale || locale.value;
|
*
|
||||||
return strapiLocales[currentLocale] || 'zh-Hans';
|
* @param nuxtLocale - 可选的语言码参数,若提供则使用该语言码,否则使用当前应用语言
|
||||||
};
|
* @returns 返回当前语言的完整映射对象
|
||||||
|
*/
|
||||||
// 获取Element Plus本地化
|
const getMapping = (nuxtLocale?: AppLocale): LocaleMapping => {
|
||||||
const getElementPlusLocale = (nuxtLocale?: string) => {
|
const current = nuxtLocale || locale.value;
|
||||||
const currentLocale = nuxtLocale || locale.value;
|
return localeMap[current] || localeMap[defaultLocale];
|
||||||
const elementPlusLocale =
|
|
||||||
elementPlusLocales[currentLocale] || elementPlusLocales['zh'];
|
|
||||||
return elementPlusLocale;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
/** 当前Nuxt I18n语言(只读) **/
|
||||||
locale: readonly(locale),
|
locale: readonly(locale),
|
||||||
getStrapiLocale,
|
/** 获取Strapi的本地化代码 **/
|
||||||
getElementPlusLocale,
|
getStrapiLocale: (l?: AppLocale) => getMapping(l).strapi,
|
||||||
|
/** 获取Directus的本地化代码 **/
|
||||||
|
getDirectusLocale: (l?: AppLocale) => getMapping(l).directus,
|
||||||
|
/** 获取Element Plus语言对象 **/
|
||||||
|
getElementPlusLocale: (l?: AppLocale) => getMapping(l).element,
|
||||||
|
/**
|
||||||
|
* 获取完整的语言映射结构(Strapi / Directus / Element Plus)
|
||||||
|
*
|
||||||
|
* @param l: 指定语言,默认为当前locale
|
||||||
|
* @returns 语言映射对象
|
||||||
|
*/
|
||||||
|
getLocaleMapping: getMapping,
|
||||||
|
|
||||||
|
/** 所有可用的Directus语言代码列表(只读) **/
|
||||||
|
availableDirectusLocales: readonly(
|
||||||
|
Object.values(localeMap).map((item) => item.directus)
|
||||||
|
),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,33 +1,25 @@
|
|||||||
import { MeiliSearch } from 'meilisearch';
|
import { MeiliSearch } from 'meilisearch';
|
||||||
import type { SearchParams, SearchResponse } from 'meilisearch';
|
import type { SearchParams } from 'meilisearch';
|
||||||
|
|
||||||
interface RawSearchSection {
|
const parseIndexes = (
|
||||||
indexUid: string;
|
indexes: string | string[] | undefined,
|
||||||
response: SearchResponse<Record<string, unknown>>;
|
locale?: string
|
||||||
}
|
): string[] => {
|
||||||
|
|
||||||
export interface SearchHit extends Record<string, unknown> {
|
|
||||||
indexUid: string;
|
|
||||||
objectID?: string | number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SearchSection {
|
|
||||||
indexUid: string;
|
|
||||||
hits: SearchHit[];
|
|
||||||
estimatedTotalHits: number;
|
|
||||||
processingTimeMs: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const parseIndexes = (indexes: string | string[] | undefined): string[] => {
|
|
||||||
if (!indexes) {
|
if (!indexes) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let suffix = '';
|
||||||
|
if (locale) {
|
||||||
|
suffix = `_${locale}`;
|
||||||
|
}
|
||||||
|
|
||||||
if (Array.isArray(indexes)) {
|
if (Array.isArray(indexes)) {
|
||||||
return indexes.map((item) => item.trim()).filter(Boolean);
|
return indexes.map((item) => `${item.trim()}${suffix}`).filter(Boolean);
|
||||||
}
|
}
|
||||||
return indexes
|
return indexes
|
||||||
.split(',')
|
.split(',')
|
||||||
.map((item) => item.trim())
|
.map((item) => `${item.trim()}${suffix}`)
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -56,10 +48,22 @@ export const useMeilisearch = () => {
|
|||||||
return meiliClient;
|
return meiliClient;
|
||||||
};
|
};
|
||||||
|
|
||||||
const search = async (
|
/**
|
||||||
|
* 泛型搜索函数
|
||||||
|
* @template T 文档类型, 如 MeiliProductIndex
|
||||||
|
* ---
|
||||||
|
* @param query 搜索关键词
|
||||||
|
* @param params 其他搜索参数
|
||||||
|
* @returns 搜索结果数组
|
||||||
|
*/
|
||||||
|
async function search<
|
||||||
|
K extends MeiliSearchItemType = MeiliSearchItemType,
|
||||||
|
T extends MeiliIndexMap[K] = MeiliIndexMap[K],
|
||||||
|
>(
|
||||||
query: string,
|
query: string,
|
||||||
params: SearchParams = {}
|
params: SearchParams = {},
|
||||||
): Promise<SearchSection[]> => {
|
searchLocale?: string
|
||||||
|
): Promise<SearchSection<T>[]> {
|
||||||
const trimmedQuery = query.trim();
|
const trimmedQuery = query.trim();
|
||||||
if (!trimmedQuery) {
|
if (!trimmedQuery) {
|
||||||
return [];
|
return [];
|
||||||
@ -70,34 +74,35 @@ export const useMeilisearch = () => {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const activeIndexes = indexes.value;
|
const activeIndexes = indexes.value as K[];
|
||||||
if (!activeIndexes.length) {
|
if (!activeIndexes.length) {
|
||||||
console.warn('No Meilisearch indexes configured.');
|
console.warn('No Meilisearch indexes configured.');
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
const rawIndexMap = Object.fromEntries(
|
||||||
|
activeIndexes.map((index) => [`${index}_${searchLocale}`, index])
|
||||||
|
);
|
||||||
|
const indexesWithLocale = activeIndexes.map(
|
||||||
|
(index) => index + (searchLocale ? `_${searchLocale}` : '')
|
||||||
|
);
|
||||||
|
|
||||||
const requests = activeIndexes.map(async (indexUid) => {
|
console.log(indexesWithLocale);
|
||||||
const response = await client.index(indexUid).search(trimmedQuery, {
|
|
||||||
|
const requests = indexesWithLocale.map(async (indexUid) => {
|
||||||
|
const response = await client.index(indexUid).search<T>(trimmedQuery, {
|
||||||
limit: params.limit ?? 10,
|
limit: params.limit ?? 10,
|
||||||
...params,
|
...params,
|
||||||
});
|
});
|
||||||
const safeResponse = JSON.parse(JSON.stringify(response));
|
|
||||||
return {
|
return {
|
||||||
indexUid,
|
indexUid,
|
||||||
response: {
|
response,
|
||||||
hits: safeResponse.hits,
|
} satisfies RawSearchSection<T>;
|
||||||
estimatedTotalHits:
|
|
||||||
safeResponse.estimatedTotalHits ?? safeResponse.hits.length,
|
|
||||||
processingTimeMs: safeResponse.processingTimeMs ?? 0,
|
|
||||||
query: safeResponse.query,
|
|
||||||
},
|
|
||||||
} satisfies RawSearchSection;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log((await requests[0])?.response.hits[0]?.locale);
|
|
||||||
|
|
||||||
const settled = await Promise.allSettled(requests);
|
const settled = await Promise.allSettled(requests);
|
||||||
|
|
||||||
|
console.log('Meilisearch settled results:', settled);
|
||||||
|
|
||||||
settled
|
settled
|
||||||
.filter(
|
.filter(
|
||||||
(result): result is PromiseRejectedResult =>
|
(result): result is PromiseRejectedResult =>
|
||||||
@ -108,22 +113,22 @@ export const useMeilisearch = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return settled
|
return settled
|
||||||
.filter((result) => result.status === 'fulfilled')
|
.filter(
|
||||||
|
(result): result is PromiseFulfilledResult<RawSearchSection<T>> =>
|
||||||
|
result.status === 'fulfilled'
|
||||||
|
)
|
||||||
.map((result) => {
|
.map((result) => {
|
||||||
const fulfilled = result as PromiseFulfilledResult<RawSearchSection>;
|
const { indexUid, response } = result.value;
|
||||||
return {
|
return {
|
||||||
indexUid: fulfilled.value.indexUid,
|
indexUid: indexUid,
|
||||||
hits: fulfilled.value.response.hits.map((hit) => ({
|
rawIndex: rawIndexMap[indexUid],
|
||||||
...hit,
|
hits: response.hits,
|
||||||
indexUid: fulfilled.value.indexUid,
|
|
||||||
})),
|
|
||||||
estimatedTotalHits:
|
estimatedTotalHits:
|
||||||
fulfilled.value.response.estimatedTotalHits ??
|
response.estimatedTotalHits ?? response.hits.length,
|
||||||
fulfilled.value.response.hits.length,
|
processingTimeMs: response.processingTimeMs ?? 0,
|
||||||
processingTimeMs: fulfilled.value.response.processingTimeMs ?? 0,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
search,
|
search,
|
||||||
|
|||||||
17
app/models/mappers/companyProfileMapper.ts
Normal file
17
app/models/mappers/companyProfileMapper.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* 将 Directus 返回的 CompanyProfile 数据转换为 CompanyProfileView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 CompanyProfile 数据
|
||||||
|
* @returns 转换后的 CompanyProfileView 对象
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const view = toCompanyProfileView(rawCompanyProfile);
|
||||||
|
*/
|
||||||
|
export function toCompanyProfileView(raw: CompanyProfile): CompanyProfileView {
|
||||||
|
const trans = raw.translations?.[0] ?? { content: '' };
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
content: trans.content,
|
||||||
|
};
|
||||||
|
}
|
||||||
17
app/models/mappers/contactInfoMapper.ts
Normal file
17
app/models/mappers/contactInfoMapper.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* 将 Directus 返回的 ContactInfo 数据转换为 ContactInfoView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 ContactInfo 数据
|
||||||
|
* @returns 转换后的 ContactInfoView 对象
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const view = toContactInfoView(rawContactInfo);
|
||||||
|
*/
|
||||||
|
export function toContactInfoView(raw: ContactInfo): ContactInfoView {
|
||||||
|
const trans = raw.translations?.[0] ?? { content: '' };
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
content: trans.content,
|
||||||
|
};
|
||||||
|
}
|
||||||
77
app/models/mappers/documentMapper.ts
Normal file
77
app/models/mappers/documentMapper.ts
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* 将 Directus 返回的 Document 数据转换为 ProductDocumentView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 Document 数据
|
||||||
|
* @returns 转换后的 ProductDocumentView 对象
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const view = toProductDocumentView(rawDocument);
|
||||||
|
*/
|
||||||
|
export function toProductDocumentView(
|
||||||
|
raw: ProductDocument
|
||||||
|
): ProductDocumentView {
|
||||||
|
const trans = raw.translations?.[0] ?? {
|
||||||
|
title: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
const fileId = typeof raw.file === 'string' ? raw.file : raw.file?.id;
|
||||||
|
const file = raw.file as DirectusFile;
|
||||||
|
|
||||||
|
const { getFileUrl } = useDirectusFiles();
|
||||||
|
|
||||||
|
const url = getFileUrl(fileId);
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
filename: file.filename_download,
|
||||||
|
title: trans.title,
|
||||||
|
url: url,
|
||||||
|
size: file.filesize,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将 Directus 返回的 Document 数据转换为 DocumentListView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 Document 数据
|
||||||
|
* @returns 转换后的 DocumentListView 对象
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const view = toDocumentListView(rawDocument);
|
||||||
|
*/
|
||||||
|
export function toDocumentListView(raw: ProductDocument): DocumentListView {
|
||||||
|
const trans = raw.translations?.[0] ?? { title: '' };
|
||||||
|
|
||||||
|
const fileId = typeof raw.file === 'string' ? raw.file : raw.file?.id;
|
||||||
|
const file = raw.file as DirectusFile;
|
||||||
|
|
||||||
|
const { getFileUrl } = useDirectusFiles();
|
||||||
|
const url = getFileUrl(fileId);
|
||||||
|
|
||||||
|
const related_products: DocumentListProduct[] = raw.products
|
||||||
|
?.filter(isObject<ProductsProductDocument>)
|
||||||
|
.map((item) => item.products_id)
|
||||||
|
.filter(isObject<Product>)
|
||||||
|
.map((item) => {
|
||||||
|
const productType =
|
||||||
|
isObject<ProductType>(item.product_type) &&
|
||||||
|
({
|
||||||
|
id: item.product_type.id,
|
||||||
|
name: item.product_type.translations?.[0]?.name,
|
||||||
|
} satisfies DocumentListProductType);
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
name: item.translations?.[0]?.name,
|
||||||
|
type: productType,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
filename: file.filename_download,
|
||||||
|
title: trans.title,
|
||||||
|
url: url,
|
||||||
|
size: file.filesize,
|
||||||
|
products: related_products,
|
||||||
|
};
|
||||||
|
}
|
||||||
51
app/models/mappers/homepageMapper.ts
Normal file
51
app/models/mappers/homepageMapper.ts
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* 将 Directus 返回的 Homepage 数据转换为 HomepageView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 Homepage 数据
|
||||||
|
* @returns 转换后的 HomepageView 对象
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const view = toHomepageView(rawHomepage);
|
||||||
|
*/
|
||||||
|
export function toHomepageView(raw: Homepage): HomepageView {
|
||||||
|
const carousel = (raw.carousel ?? [])
|
||||||
|
.filter(isObject<HomepageFile>)
|
||||||
|
.map((item) => item.directus_files_id)
|
||||||
|
.filter((item) => typeof item === 'string');
|
||||||
|
|
||||||
|
const products = (raw.recommend_products ?? [])
|
||||||
|
.filter(isObject<Product>)
|
||||||
|
.map((item) => {
|
||||||
|
const cover = isObject<DirectusFile>(item.cover)
|
||||||
|
? item.cover.id
|
||||||
|
: item.cover;
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
name: item.translations?.[0].name,
|
||||||
|
summary: item.translations?.[0].summary,
|
||||||
|
cover: cover,
|
||||||
|
} satisfies HomepageProductView;
|
||||||
|
});
|
||||||
|
|
||||||
|
const solutions = (raw.recommend_solutions ?? [])
|
||||||
|
.filter(isObject<Solution>)
|
||||||
|
.map((item) => {
|
||||||
|
const cover = isObject<DirectusFile>(item.cover)
|
||||||
|
? item.cover.id
|
||||||
|
: item.cover;
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
title: item.translations?.[0].title,
|
||||||
|
summary: item.translations?.[0].summary,
|
||||||
|
cover: cover,
|
||||||
|
} satisfies HomepageSolutionView;
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
carousel: carousel ?? [],
|
||||||
|
recommendProducts: products ?? [],
|
||||||
|
recommendSolutions: solutions ?? [],
|
||||||
|
};
|
||||||
|
}
|
||||||
134
app/models/mappers/productMapper.ts
Normal file
134
app/models/mappers/productMapper.ts
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
/**
|
||||||
|
* 将 Directus返回的 Product 数据转换为 ProductListView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 Product 数据
|
||||||
|
* @returns 转换后的 ProductListView 对象
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const view = toProductListView(rawProduct);
|
||||||
|
*/
|
||||||
|
export function toProductListView(raw: Product): ProductListView {
|
||||||
|
const trans = raw.translations?.[0] ?? { name: '', summary: '' };
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
product_type:
|
||||||
|
typeof raw.product_type === 'string'
|
||||||
|
? raw.product_type
|
||||||
|
: typeof raw.product_type === 'object' && raw.product_type
|
||||||
|
? raw.product_type.translations[0].name || ''
|
||||||
|
: '',
|
||||||
|
name: trans.name,
|
||||||
|
summary: trans.summary,
|
||||||
|
cover: raw.cover.toString(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将 Directus 返回的 ProductSpecGroup 数据转换为 ProductSpecGroupView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 ProductSpecGroup 数据
|
||||||
|
* @returns 转换后的 ProductSpecGroupView 对象
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const view = toProductSpecGroupView(rawSpecGroup);
|
||||||
|
*/
|
||||||
|
export function toProductSpecGroupView(
|
||||||
|
raw: ProductSpecGroup
|
||||||
|
): ProductSpecGroupView {
|
||||||
|
const trans = raw.translations?.[0] ?? {
|
||||||
|
name: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
name: trans.name,
|
||||||
|
specs: raw.specs
|
||||||
|
.filter(isObject<ProductSpec>)
|
||||||
|
.map((item) => toProductSpecView(item)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将 Directus 返回的 ProductSpec 数据转换为 ProductSpecView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 ProductSpec 数据
|
||||||
|
* @returns 转换后的 ProductSpecView 对象
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const view = toProductSpecView(rawSpecGroup);
|
||||||
|
*/
|
||||||
|
export function toProductSpecView(raw: ProductSpec): ProductSpecView {
|
||||||
|
const trans = raw.translations?.[0] ?? {
|
||||||
|
key: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
key: trans.key,
|
||||||
|
value: raw.value,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将 Directus 返回的 Product 数据转换为 ProductView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 Product 数据
|
||||||
|
* @returns 转换后的 ProductView 对象
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const view = toProductView(rawProduct);
|
||||||
|
*/
|
||||||
|
export function toProductView(raw: Product): ProductView {
|
||||||
|
const trans = raw.translations?.[0] ?? {
|
||||||
|
name: '',
|
||||||
|
summary: '',
|
||||||
|
description: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
const images = (raw.images ?? [])
|
||||||
|
.filter(isObject<ProductsProductImage>)
|
||||||
|
.map((item) => item.product_images_id)
|
||||||
|
.filter(isObject<ProductImage>)
|
||||||
|
.map((item) => {
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
image: item.image.toString(),
|
||||||
|
caption: item.translations?.[0]?.caption || '',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const specs = (raw.specs ?? [])
|
||||||
|
.filter(isObject<ProductSpecGroup>)
|
||||||
|
.map((item) => toProductSpecGroupView(item));
|
||||||
|
|
||||||
|
const faqs = (raw.faqs ?? [])
|
||||||
|
.filter(isObject<ProductsQuestion>)
|
||||||
|
.map((item) => item.questions_id)
|
||||||
|
.filter(isObject<Question>)
|
||||||
|
.map((item) => toProductQuestionView(item));
|
||||||
|
|
||||||
|
const documents = (raw.documents ?? [])
|
||||||
|
.filter(isObject<ProductsProductDocument>)
|
||||||
|
.map((item) => item.product_documents_id)
|
||||||
|
.filter(isObject<ProductDocument>)
|
||||||
|
.map((item) => toProductDocumentView(item));
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
|
||||||
|
product_type:
|
||||||
|
typeof raw.product_type === 'string'
|
||||||
|
? raw.product_type
|
||||||
|
: typeof raw.product_type === 'object' && raw.product_type
|
||||||
|
? raw.product_type.translations[0].name || ''
|
||||||
|
: '',
|
||||||
|
name: trans.name,
|
||||||
|
summary: trans.summary,
|
||||||
|
images: images,
|
||||||
|
description: trans.description,
|
||||||
|
specs: specs,
|
||||||
|
faqs: faqs,
|
||||||
|
documents: documents,
|
||||||
|
};
|
||||||
|
}
|
||||||
59
app/models/mappers/questionMapper.ts
Normal file
59
app/models/mappers/questionMapper.ts
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* 将 Directus 返回的 Question 数据转换为 ProductQuestionView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 Question 数据
|
||||||
|
* @returns 转换后的 ProductQuestionView 对象
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const view = toProductQuestionView(rawQuestion);
|
||||||
|
*/
|
||||||
|
export function toProductQuestionView(raw: Question): ProductQuestionView {
|
||||||
|
const trans = raw.translations?.[0] ?? { title: '', content: '' };
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
title: trans.title,
|
||||||
|
content: trans.content,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将 Directus 返回的 Question 数据转换为 QuestionListView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 Question 数据
|
||||||
|
* @returns 转换后的 QuestionListView 对象
|
||||||
|
* ---
|
||||||
|
* @example
|
||||||
|
* const view = toQuestionListView(rawQuestion);
|
||||||
|
*/
|
||||||
|
export function toQuestionListView(raw: Question): QuestionListView {
|
||||||
|
const trans = raw.translations?.[0] ?? { title: '', content: '' };
|
||||||
|
|
||||||
|
const related_products: QuestionListProduct[] = (raw.products ?? [])
|
||||||
|
.filter(isObject<ProductsQuestion>)
|
||||||
|
.map((item) => item.products_id)
|
||||||
|
.filter(isObject<Product>)
|
||||||
|
.map((item) => {
|
||||||
|
const translations = item.translations[0] ?? { name: '' };
|
||||||
|
|
||||||
|
const product_type =
|
||||||
|
isObject<ProductType>(item.product_type) &&
|
||||||
|
({
|
||||||
|
id: item.product_type.id,
|
||||||
|
name: item.product_type.translations[0]?.name,
|
||||||
|
} satisfies QuestionListProductType);
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
name: translations.name,
|
||||||
|
type: product_type,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
title: trans.title,
|
||||||
|
content: trans.content,
|
||||||
|
products: related_products,
|
||||||
|
};
|
||||||
|
}
|
||||||
16
app/models/mappers/searchItemMapper.ts
Normal file
16
app/models/mappers/searchItemMapper.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* 搜索索引转换器
|
||||||
|
* @param hit 搜索条目
|
||||||
|
* @returns 转换后的搜索条目视图模型
|
||||||
|
*
|
||||||
|
* ---
|
||||||
|
* @example
|
||||||
|
* const view = toSearchItemView(item, 'products');
|
||||||
|
*/
|
||||||
|
export function toSearchItemView<T extends MeiliSearchItemType>(
|
||||||
|
item: MeiliIndexMap[T],
|
||||||
|
type: T
|
||||||
|
): SearchItemView {
|
||||||
|
const converter = converters[type];
|
||||||
|
return converter ? converter(item) : null;
|
||||||
|
}
|
||||||
54
app/models/mappers/solutionMapper.ts
Normal file
54
app/models/mappers/solutionMapper.ts
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
* 将 Directus 返回的 Solution 数据转换为 SolutionListView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 Solution 数据
|
||||||
|
* @returns 转换后的 SolutionListView 对象
|
||||||
|
*
|
||||||
|
* ---
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const view = toSolutionListView(rawSolution);
|
||||||
|
*/
|
||||||
|
export function toSolutionListView(raw: Solution): SolutionListView {
|
||||||
|
const trans = raw.translations?.[0] ?? {
|
||||||
|
title: '',
|
||||||
|
summary: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
title: trans.title,
|
||||||
|
summary: trans.summary,
|
||||||
|
solution_type: isObject<SolutionType>(raw.type)
|
||||||
|
? raw.type.translations[0].name
|
||||||
|
: '',
|
||||||
|
cover: isObject<DirectusFile>(raw.cover) ? raw.cover.id : raw.cover,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将 Directus 返回的 Solution 数据转换为 SolutionView 视图模型
|
||||||
|
*
|
||||||
|
* @param raw: 原始的 Solution 数据
|
||||||
|
* @returns 转换后的 SolutionView 对象
|
||||||
|
*
|
||||||
|
* ---
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const view = toSolutionView(rawSolution);
|
||||||
|
*/
|
||||||
|
export function toSolutionView(raw: Solution): SolutionView {
|
||||||
|
const trans = raw.translations?.[0] ?? {
|
||||||
|
title: '',
|
||||||
|
summary: '',
|
||||||
|
content: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
title: trans.title,
|
||||||
|
summary: trans.summary,
|
||||||
|
content: trans.content,
|
||||||
|
createAt: raw.create_at,
|
||||||
|
};
|
||||||
|
}
|
||||||
30
app/models/utils/object.ts
Normal file
30
app/models/utils/object.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* 判断某一值是否为非null对象
|
||||||
|
*
|
||||||
|
* @template T 泛型类型,用于推断目标对象的类型
|
||||||
|
* @param value: 需要判断的值
|
||||||
|
* @returns 如果值是非null对象则返回true,否则返回false
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* if (isObject<Product>(value)) value.id
|
||||||
|
*/
|
||||||
|
export const isObject = <T extends object>(value: unknown): value is T =>
|
||||||
|
typeof value === 'object' && value !== null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断某一值是否为非null对象组成的数组
|
||||||
|
*
|
||||||
|
* @template T 泛型类型,用于推断目标对象的类型
|
||||||
|
* @param value: 需要判断的值
|
||||||
|
* @returns 如果值是非null对象组成的数组则返回true,否则返回false
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const data: unknown = [{ id: 1 }, { id: 2 }];
|
||||||
|
* if (isArrayOfObject)<{ id: number }>(data) {
|
||||||
|
* // TypeScript 知道 data 是 { id: number }[] 类型
|
||||||
|
* console.log(data[0].id);
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
export const isArrayOfObject = <T extends object>(arr: unknown): arr is T[] => {
|
||||||
|
return Array.isArray(arr) && arr.every(isObject<T>);
|
||||||
|
};
|
||||||
35
app/models/utils/search-converters.ts
Normal file
35
app/models/utils/search-converters.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* 各索引对应的转换函数表
|
||||||
|
*/
|
||||||
|
export const converters: {
|
||||||
|
[K in keyof MeiliIndexMap]: (item: MeiliIndexMap[K]) => SearchItemView;
|
||||||
|
} = {
|
||||||
|
products: (item: MeiliIndexMap['products']): SearchItemView => ({
|
||||||
|
id: item.id,
|
||||||
|
type: 'product',
|
||||||
|
title: item.name,
|
||||||
|
summary: item.summary,
|
||||||
|
}),
|
||||||
|
|
||||||
|
solutions: (item: MeiliIndexMap['solutions']): SearchItemView => ({
|
||||||
|
id: item.id,
|
||||||
|
type: 'solution',
|
||||||
|
title: item.title,
|
||||||
|
summary: item.summary,
|
||||||
|
}),
|
||||||
|
|
||||||
|
questions: (item: MeiliIndexMap['questions']): SearchItemView => ({
|
||||||
|
id: item.id,
|
||||||
|
type: 'question',
|
||||||
|
title: item.title,
|
||||||
|
summary: item.content.slice(0, 100) + '...',
|
||||||
|
}),
|
||||||
|
|
||||||
|
product_documents: (
|
||||||
|
item: MeiliIndexMap['product_documents']
|
||||||
|
): SearchItemView => ({
|
||||||
|
id: item.id,
|
||||||
|
type: 'document',
|
||||||
|
title: item.title,
|
||||||
|
}),
|
||||||
|
};
|
||||||
10
app/models/views/CompanyProfileView.ts
Normal file
10
app/models/views/CompanyProfileView.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* 公司简介视图模型
|
||||||
|
*/
|
||||||
|
export interface CompanyProfileView {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 内容 **/
|
||||||
|
content: string;
|
||||||
|
}
|
||||||
10
app/models/views/ContactInfoView.ts
Normal file
10
app/models/views/ContactInfoView.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* 联系信息视图模型
|
||||||
|
*/
|
||||||
|
export interface ContactInfoView {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 内容 **/
|
||||||
|
content: string;
|
||||||
|
}
|
||||||
42
app/models/views/DocumentListView.ts
Normal file
42
app/models/views/DocumentListView.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* 文档关联产品类型模型
|
||||||
|
* 用于在文档库中提供产品筛选功能
|
||||||
|
*/
|
||||||
|
export interface DocumentListProductType {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文档关联产品模型
|
||||||
|
* 用于在文档库中提供产品筛选功能
|
||||||
|
*/
|
||||||
|
export interface DocumentListProduct {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
type: DocumentListProductType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文档列表模型
|
||||||
|
* 用于文档库(/support/documents)页面渲染的数据结构
|
||||||
|
*/
|
||||||
|
export interface DocumentListView {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 文件名 **/
|
||||||
|
filename: string;
|
||||||
|
|
||||||
|
/** 文档标题 **/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/** 文档大小 **/
|
||||||
|
size: number;
|
||||||
|
|
||||||
|
/** 文档链接 **/
|
||||||
|
url: string;
|
||||||
|
|
||||||
|
/** 相关产品 **/
|
||||||
|
products: DocumentListProduct[];
|
||||||
|
}
|
||||||
50
app/models/views/HomepageView.ts
Normal file
50
app/models/views/HomepageView.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[];
|
||||||
|
}
|
||||||
20
app/models/views/ProductDocumentView.ts
Normal file
20
app/models/views/ProductDocumentView.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* 文档视图模型
|
||||||
|
* 用于文档列表渲染的数据结构
|
||||||
|
*/
|
||||||
|
export interface ProductDocumentView {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 文件名 **/
|
||||||
|
filename: string;
|
||||||
|
|
||||||
|
/** 文档标题 **/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/** 文档大小 **/
|
||||||
|
size: number;
|
||||||
|
|
||||||
|
/** 文档链接 **/
|
||||||
|
url: string;
|
||||||
|
}
|
||||||
20
app/models/views/ProductListView.ts
Normal file
20
app/models/views/ProductListView.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* 产品列表视图模型
|
||||||
|
* 用于产品列表(/products)渲染的数据结构
|
||||||
|
*/
|
||||||
|
export interface ProductListView {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 产品名称 **/
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
/** 产品简介 **/
|
||||||
|
summary: string;
|
||||||
|
|
||||||
|
/** 产品类型 **/
|
||||||
|
product_type: string;
|
||||||
|
|
||||||
|
/** 产品封面(图片的id) **/
|
||||||
|
cover: string;
|
||||||
|
}
|
||||||
14
app/models/views/ProductQuestionView.ts
Normal file
14
app/models/views/ProductQuestionView.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 常见问题视图模型
|
||||||
|
* 用于产品页常见问题渲染的数据结构
|
||||||
|
*/
|
||||||
|
export interface ProductQuestionView {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 问题标题 **/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/** 问题内容 **/
|
||||||
|
content: string;
|
||||||
|
}
|
||||||
29
app/models/views/ProductSpecGroupView.ts
Normal file
29
app/models/views/ProductSpecGroupView.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[];
|
||||||
|
}
|
||||||
38
app/models/views/ProductView.ts
Normal file
38
app/models/views/ProductView.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
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: QuestionView[];
|
||||||
|
|
||||||
|
/** 产品文档 **/
|
||||||
|
documents: ProductDocumentView[];
|
||||||
|
}
|
||||||
36
app/models/views/QuestionListVuew.ts
Normal file
36
app/models/views/QuestionListVuew.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
app/models/views/SearchItemView.ts
Normal file
13
app/models/views/SearchItemView.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
export interface SearchItemView {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 条目类型 **/
|
||||||
|
type: 'product' | 'solution' | 'question' | 'document';
|
||||||
|
|
||||||
|
/** 条目标题 **/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/** 条目摘要 **/
|
||||||
|
summary?: string;
|
||||||
|
}
|
||||||
20
app/models/views/SolutionListView.ts
Normal file
20
app/models/views/SolutionListView.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* 解决方案列表模型
|
||||||
|
* 用于解决方案列表(/solutions)渲染的数据结构
|
||||||
|
*/
|
||||||
|
export interface SolutionListView {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 标题 **/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/** 摘要 **/
|
||||||
|
summary: string;
|
||||||
|
|
||||||
|
/** 解决方案类型 **/
|
||||||
|
solution_type: string;
|
||||||
|
|
||||||
|
/** 解决方案封面(图片id) **/
|
||||||
|
cover: string;
|
||||||
|
}
|
||||||
20
app/models/views/SolutionView.ts
Normal file
20
app/models/views/SolutionView.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* 解决方案模型
|
||||||
|
* 用于解决方案页(/solutions/[slug])渲染的数据结构
|
||||||
|
*/
|
||||||
|
export interface SolutionView {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 标题 **/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/** 摘要 **/
|
||||||
|
summary: string;
|
||||||
|
|
||||||
|
/** 内容 **/
|
||||||
|
content: string;
|
||||||
|
|
||||||
|
/** 创建时间 **/
|
||||||
|
createAt: string;
|
||||||
|
}
|
||||||
@ -15,7 +15,7 @@
|
|||||||
</el-breadcrumb>
|
</el-breadcrumb>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<markdown-renderer :content="content || ''" />
|
<markdown-renderer :content="content.content || ''" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-divider content-position="left">更多信息</el-divider>
|
<el-divider content-position="left">更多信息</el-divider>
|
||||||
@ -38,17 +38,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { findOne } = useStrapi();
|
const { data, pending, error } = await useCompanyProfile();
|
||||||
const { getStrapiLocale } = useLocalizations();
|
|
||||||
const strapiLocale = getStrapiLocale();
|
|
||||||
|
|
||||||
const { data, pending, error } = useAsyncData('company-profile', () =>
|
const content = computed(() => toCompanyProfileView(data.value));
|
||||||
findOne<StrapiCompanyProfile>('company-profile', undefined, {
|
|
||||||
locale: strapiLocale,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
const content = computed(() => data.value?.data.content);
|
|
||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
|
|||||||
@ -12,14 +12,11 @@
|
|||||||
<div class="carousel-item">
|
<div class="carousel-item">
|
||||||
<el-image
|
<el-image
|
||||||
class="carousel-image"
|
class="carousel-image"
|
||||||
:src="useStrapiMedia(item.url || '')"
|
:src="getImageUrl(item)"
|
||||||
:alt="item.alternativeText || `Carousel Image ${index + 1}`"
|
:alt="`Carousel Image ${index + 1}`"
|
||||||
fit="contain"
|
fit="contain"
|
||||||
lazy
|
lazy
|
||||||
/>
|
/>
|
||||||
<p v-if="item.caption" class="carousel-image-caption">
|
|
||||||
{{ item.caption }}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</el-carousel-item>
|
</el-carousel-item>
|
||||||
</el-carousel>
|
</el-carousel>
|
||||||
@ -42,24 +39,24 @@
|
|||||||
:autoplay="false"
|
:autoplay="false"
|
||||||
>
|
>
|
||||||
<el-carousel-item
|
<el-carousel-item
|
||||||
v-for="n in Math.floor(recommend_productions.length / 3) + 1"
|
v-for="n in Math.floor(recommend_products.length / 3) + 1"
|
||||||
:key="n"
|
:key="n"
|
||||||
class="recommend-list"
|
class="recommend-list"
|
||||||
>
|
>
|
||||||
<div class="recommend-card-group">
|
<div class="recommend-card-group">
|
||||||
<el-card
|
<el-card
|
||||||
v-for="(item, index) in recommend_productions.slice(
|
v-for="(item, index) in recommend_products.slice(
|
||||||
(n - 1) * 3,
|
(n - 1) * 3,
|
||||||
n * 3
|
n * 3
|
||||||
)"
|
)"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="recommend-card"
|
class="recommend-card"
|
||||||
@click="handleProductionCardClick(item.documentId || '')"
|
@click="handleProductCardClick(item.id.toString() || '')"
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<el-image
|
<el-image
|
||||||
:src="useStrapiMedia(item.cover?.url || '')"
|
:src="getImageUrl(item.cover)"
|
||||||
:alt="item.cover?.alternativeText || item.title"
|
:alt="item.name"
|
||||||
fit="cover"
|
fit="cover"
|
||||||
lazy
|
lazy
|
||||||
/>
|
/>
|
||||||
@ -67,7 +64,7 @@
|
|||||||
<div class="recommend-card-body">
|
<div class="recommend-card-body">
|
||||||
<!-- Title -->
|
<!-- Title -->
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<span class="recommend-card-title">{{ item.title }}</span>
|
<span class="recommend-card-title">{{ item.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- Description -->
|
<!-- Description -->
|
||||||
<div class="recommend-card-description text-left opacity-25">
|
<div class="recommend-card-description text-left opacity-25">
|
||||||
@ -107,12 +104,12 @@
|
|||||||
)"
|
)"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="recommend-card"
|
class="recommend-card"
|
||||||
@click="handleSolutionCardClick(item.documentId || '')"
|
@click="handleSolutionCardClick(item.id.toString() || '')"
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<el-image
|
<el-image
|
||||||
:src="useStrapiMedia(item.cover?.url || '')"
|
:src="getImageUrl(item.cover)"
|
||||||
:alt="item.cover?.alternativeText || item.title"
|
:alt="item.title"
|
||||||
fit="cover"
|
fit="cover"
|
||||||
lazy
|
lazy
|
||||||
/>
|
/>
|
||||||
@ -140,55 +137,39 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { findOne } = useStrapi();
|
const { getImageUrl } = useDirectusImage();
|
||||||
const { getStrapiLocale } = useLocalizations();
|
|
||||||
const strapiLocale = getStrapiLocale();
|
|
||||||
|
|
||||||
const { data, pending, error } = useAsyncData('homepage', () =>
|
const { data, pending, error } = await useHomepage();
|
||||||
findOne<StrapiHomepage>('homepage', undefined, {
|
|
||||||
populate: {
|
|
||||||
carousel: {
|
|
||||||
populate: '*',
|
|
||||||
},
|
|
||||||
recommend_productions: {
|
|
||||||
populate: {
|
|
||||||
cover: {
|
|
||||||
populate: '*',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
recommend_solutions: {
|
|
||||||
populate: {
|
|
||||||
cover: {
|
|
||||||
populate: '*',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
locale: strapiLocale,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
const carousel = computed(() => data.value?.data.carousel || []);
|
const homepageData = computed(() => {
|
||||||
const recommend_productions = computed(
|
return toHomepageView(data.value);
|
||||||
() => data.value?.data.recommend_productions || []
|
});
|
||||||
|
|
||||||
|
const carousel = computed(() => homepageData.value?.carousel);
|
||||||
|
|
||||||
|
const recommend_products = computed(
|
||||||
|
() => homepageData.value?.recommendProducts
|
||||||
);
|
);
|
||||||
const recommend_solutions = computed(
|
const recommend_solutions = computed(
|
||||||
() => data.value?.data.recommend_solutions || []
|
() => homepageData.value?.recommendSolutions
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(pending, () => {
|
||||||
|
console.log(data.value);
|
||||||
|
});
|
||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
console.error('数据获取失败: ', value);
|
console.error('数据获取失败: ', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleProductionCardClick = (documentId: string) => {
|
const handleProductCardClick = (documentId: string) => {
|
||||||
// 使用路由导航到产品详情页
|
// 使用路由导航到产品详情页
|
||||||
if (documentId) {
|
if (documentId) {
|
||||||
const localePath = useLocalePath();
|
const localePath = useLocalePath();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
router.push(localePath(`/productions/${documentId}`));
|
router.push(localePath(`/products/${documentId}`));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<div v-if="!pending">
|
<div v-if="!pending">
|
||||||
<div v-if="production">
|
<div v-if="product">
|
||||||
<!-- 面包屑导航 -->
|
<!-- 面包屑导航 -->
|
||||||
<el-breadcrumb class="breadcrumb" separator="/">
|
<el-breadcrumb class="breadcrumb" separator="/">
|
||||||
<el-breadcrumb-item class="text-md opacity-50">
|
<el-breadcrumb-item class="text-md opacity-50">
|
||||||
@ -10,44 +10,44 @@
|
|||||||
}}</NuxtLink>
|
}}</NuxtLink>
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
<el-breadcrumb-item class="text-md opacity-50">
|
<el-breadcrumb-item class="text-md opacity-50">
|
||||||
<NuxtLink :to="$localePath('/productions')">{{
|
<NuxtLink :to="$localePath('/products')">{{
|
||||||
$t('navigation.productions')
|
$t('navigation.products')
|
||||||
}}</NuxtLink>
|
}}</NuxtLink>
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
<el-breadcrumb-item class="text-md opactiy-50">{{
|
<el-breadcrumb-item class="text-md opactiy-50">{{
|
||||||
production.title
|
product.name
|
||||||
}}</el-breadcrumb-item>
|
}}</el-breadcrumb-item>
|
||||||
</el-breadcrumb>
|
</el-breadcrumb>
|
||||||
|
|
||||||
<!-- 产品详情内容 -->
|
<!-- 产品详情内容 -->
|
||||||
<div class="production-header">
|
<div class="product-header">
|
||||||
<div class="production-image">
|
<div class="product-image">
|
||||||
<el-image
|
<el-image
|
||||||
v-if="production.production_images.length <= 1"
|
v-if="product.images.length <= 1"
|
||||||
:src="useStrapiMedia(production?.cover?.url || '')"
|
:src="getImageUrl(product.images[0].image)"
|
||||||
:alt="production.title"
|
:alt="product.name"
|
||||||
fit="contain"
|
fit="contain"
|
||||||
/>
|
/>
|
||||||
<el-carousel
|
<el-carousel
|
||||||
v-else
|
v-else
|
||||||
class="production-carousel"
|
class="product-carousel"
|
||||||
height="500px"
|
height="500px"
|
||||||
:autoplay="false"
|
:autoplay="false"
|
||||||
:loop="false"
|
:loop="false"
|
||||||
arrow="always"
|
arrow="always"
|
||||||
>
|
>
|
||||||
<el-carousel-item
|
<el-carousel-item
|
||||||
v-for="(item, index) in production.production_images || []"
|
v-for="(item, index) in product.images || []"
|
||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
<div class="production-carousel-item">
|
<div class="product-carousel-item">
|
||||||
<el-image
|
<el-image
|
||||||
:src="useStrapiMedia(item.url || '')"
|
:src="getImageUrl(item.image || '')"
|
||||||
:alt="item.alternativeText || production.title"
|
:alt="product.name"
|
||||||
fit="contain"
|
fit="contain"
|
||||||
lazy
|
lazy
|
||||||
/>
|
/>
|
||||||
<p v-if="item.caption" class="production-image-caption">
|
<p v-if="item.caption" class="product-image-caption">
|
||||||
{{ item.caption }}
|
{{ item.caption }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -55,34 +55,26 @@
|
|||||||
</el-carousel>
|
</el-carousel>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="production-info">
|
<div class="product-info">
|
||||||
<h1>{{ production.title }}</h1>
|
<h1>{{ product.name }}</h1>
|
||||||
<p class="summary">{{ production.summary }}</p>
|
<p class="summary">{{ product.summary }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 产品详细描述 -->
|
<!-- 产品详细描述 -->
|
||||||
<div class="production-content">
|
<div class="product-content">
|
||||||
<el-tabs v-model="activeName" class="production-tabs" stretch>
|
<el-tabs v-model="activeName" class="product-tabs" stretch>
|
||||||
<el-tab-pane label="产品详情" name="details">
|
<el-tab-pane label="产品详情" name="details">
|
||||||
<markdown-renderer
|
<markdown-renderer :content="product.description || ''" />
|
||||||
:content="production.production_details || ''"
|
|
||||||
/>
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="技术规格" name="specs">
|
<el-tab-pane label="技术规格" name="specs">
|
||||||
<spec-table :data="production.production_specs" />
|
<spec-table :data="product.specs" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="常见问题" name="faq">
|
<el-tab-pane label="常见问题" name="faq">
|
||||||
<question-list :questions="production.questions" />
|
<question-list :questions="product.faqs" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="相关文档" name="documents">
|
<el-tab-pane label="相关文档" name="documents">
|
||||||
<document-list
|
<document-list :documents="product.documents" />
|
||||||
:documents="
|
|
||||||
production.production_documents.map(
|
|
||||||
(item) => item.document
|
|
||||||
) || []
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
@ -95,8 +87,8 @@
|
|||||||
:sub-title="$t('product-not-found-desc')"
|
:sub-title="$t('product-not-found-desc')"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<el-button type="primary" @click="$router.push('/productions')">
|
<el-button type="primary" @click="$router.push('/products')">
|
||||||
{{ $t('back-to-productions') }}
|
{{ $t('back-to-products') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-result>
|
</el-result>
|
||||||
@ -115,39 +107,22 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { findOne } = useStrapi();
|
|
||||||
const { getStrapiLocale } = useLocalizations();
|
|
||||||
const strapiLocale = getStrapiLocale();
|
|
||||||
|
|
||||||
// 获取路由参数(slug 或 id)
|
const { getImageUrl } = useDirectusImage();
|
||||||
const documentId = computed(() => route.params.slug as string);
|
|
||||||
|
|
||||||
const { data, pending, error } = useAsyncData(
|
// 获取路由参数
|
||||||
() => `production-${documentId.value}`,
|
const id = computed(() => route.params.slug as string);
|
||||||
() =>
|
|
||||||
findOne<Production>('productions', documentId.value, {
|
|
||||||
populate: {
|
|
||||||
production_specs: {
|
|
||||||
populate: '*',
|
|
||||||
},
|
|
||||||
production_images: {
|
|
||||||
populate: '*',
|
|
||||||
},
|
|
||||||
cover: {
|
|
||||||
populate: '*',
|
|
||||||
},
|
|
||||||
questions: {
|
|
||||||
populate: '*',
|
|
||||||
},
|
|
||||||
production_documents: {
|
|
||||||
populate: 'document',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
locale: strapiLocale,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
const production = computed(() => data.value?.data ?? null);
|
const { data, pending, error } = await useProduct(id.value);
|
||||||
|
|
||||||
|
console.log('Raw Data: ', data.value);
|
||||||
|
|
||||||
|
const rawProduct = computed(() => data.value ?? null);
|
||||||
|
const product = computed(() => {
|
||||||
|
return toProductView(rawProduct.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('View Data: ', product.value);
|
||||||
|
|
||||||
const activeName = ref('details'); // 默认选中概览标签
|
const activeName = ref('details'); // 默认选中概览标签
|
||||||
|
|
||||||
@ -159,11 +134,11 @@
|
|||||||
|
|
||||||
// SEO
|
// SEO
|
||||||
useHead({
|
useHead({
|
||||||
title: computed(() => production.value?.title || 'Product Detail'),
|
title: computed(() => product.value?.name || 'Product Detail'),
|
||||||
meta: [
|
meta: [
|
||||||
{
|
{
|
||||||
name: 'description',
|
name: 'description',
|
||||||
content: computed(() => production.value?.summary || ''),
|
content: computed(() => product.value?.summary || ''),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
@ -180,20 +155,20 @@
|
|||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-header {
|
.product-header {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 2fr 1fr;
|
grid-template-columns: 2fr 1fr;
|
||||||
gap: 3rem;
|
gap: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-image .el-image {
|
.product-image .el-image {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 500px;
|
height: 500px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-image-caption {
|
.product-image-caption {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
/* left: 10%; */
|
/* left: 10%; */
|
||||||
@ -205,7 +180,7 @@
|
|||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-carousel :deep(.el-carousel__button) {
|
.product-carousel :deep(.el-carousel__button) {
|
||||||
/* 指示器按钮样式 */
|
/* 指示器按钮样式 */
|
||||||
width: 8px;
|
width: 8px;
|
||||||
height: 8px;
|
height: 8px;
|
||||||
@ -214,7 +189,7 @@
|
|||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-info h1 {
|
.product-info h1 {
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
@ -227,16 +202,16 @@
|
|||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-tabs ::v-deep(.el-tabs__nav) {
|
.product-tabs ::v-deep(.el-tabs__nav) {
|
||||||
min-width: 30%;
|
min-width: 30%;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-tabs ::v-deep(.el-tabs__content) {
|
.product-tabs ::v-deep(.el-tabs__content) {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-content h2 {
|
.product-content h2 {
|
||||||
color: var(--el-text-color-primary);
|
color: var(--el-text-color-primary);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
@ -257,12 +232,12 @@
|
|||||||
|
|
||||||
/* 响应式设计 */
|
/* 响应式设计 */
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.production-header {
|
.product-header {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
gap: 2rem;
|
gap: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-info h1 {
|
.product-info h1 {
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1 class="page-title">{{ $t('our-productions') }}</h1>
|
<h1 class="page-title">{{ $t('our-products') }}</h1>
|
||||||
<el-breadcrumb class="breadcrumb">
|
<el-breadcrumb class="breadcrumb">
|
||||||
<el-breadcrumb-item class="text-md opacity-50">
|
<el-breadcrumb-item class="text-md opacity-50">
|
||||||
<NuxtLink :to="$localePath('/')">{{
|
<NuxtLink :to="$localePath('/')">{{
|
||||||
@ -9,29 +9,29 @@
|
|||||||
}}</NuxtLink>
|
}}</NuxtLink>
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
<el-breadcrumb-item class="text-md opacity-50">
|
<el-breadcrumb-item class="text-md opacity-50">
|
||||||
<NuxtLink :to="$localePath('/productions')">{{
|
<NuxtLink :to="$localePath('/products')">{{
|
||||||
$t('navigation.productions')
|
$t('navigation.products')
|
||||||
}}</NuxtLink>
|
}}</NuxtLink>
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
</el-breadcrumb>
|
</el-breadcrumb>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!pending" class="page-content">
|
<div v-if="!pending" class="page-content">
|
||||||
<div class="productions-container">
|
<div class="products-container">
|
||||||
<el-collapse v-model="activeNames" class="production-collapse">
|
<el-collapse v-model="activeNames" class="product-collapse">
|
||||||
<el-collapse-item
|
<el-collapse-item
|
||||||
v-for="(group, type) in groupedProductions"
|
v-for="(group, type) in groupedProducts"
|
||||||
:key="type"
|
:key="type"
|
||||||
:title="type || '未分类'"
|
:title="type || '未分类'"
|
||||||
:name="type || 'no-category'"
|
:name="type || 'no-category'"
|
||||||
>
|
>
|
||||||
<div class="group-list">
|
<div class="group-list">
|
||||||
<production-card
|
<product-card
|
||||||
v-for="production in group"
|
v-for="product in group"
|
||||||
:key="production.documentId || production.id"
|
:key="product.id"
|
||||||
:slug="production.documentId"
|
:slug="product.id.toString()"
|
||||||
:image-url="useStrapiMedia(production?.cover?.url || '')"
|
:image-url="getImageUrl(product.cover.toString())"
|
||||||
:name="production.title"
|
:name="product.name"
|
||||||
:description="production.summary || ''"
|
:description="product.summary || ''"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
@ -45,63 +45,43 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { find } = useStrapi();
|
const { getImageUrl } = useDirectusImage();
|
||||||
const { getStrapiLocale } = useLocalizations();
|
|
||||||
const strapiLocale = getStrapiLocale();
|
|
||||||
|
|
||||||
const { data, pending, error } = useAsyncData(
|
const { data, pending, error } = useProductList();
|
||||||
'productions',
|
|
||||||
() =>
|
|
||||||
find<Production>('productions', {
|
|
||||||
populate: {
|
|
||||||
cover: {
|
|
||||||
populate: '*',
|
|
||||||
},
|
|
||||||
production_type: {
|
|
||||||
populate: '*',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
filters: {
|
|
||||||
show_in_production_list: {
|
|
||||||
$eq: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
locale: strapiLocale,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
lazy: true,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const activeNames = ref<string[]>([]);
|
const activeNames = ref<string[]>([]);
|
||||||
|
|
||||||
const productions = computed(() => data.value?.data ?? []);
|
const productsRaw = computed(() => data.value ?? []);
|
||||||
|
const products = computed(() =>
|
||||||
|
productsRaw.value.map((item) => toProductListView(item))
|
||||||
|
);
|
||||||
|
|
||||||
// 按类型分组
|
// 按类型分组
|
||||||
// 兼容 production_type 既可能为对象也可能为字符串
|
// 兼容 product_type 既可能为对象也可能为字符串
|
||||||
const groupedProductions = computed(() => {
|
const groupedProducts = computed(() => {
|
||||||
const groups: Record<string, Production[]> = {};
|
const groups: Record<string, ProductListView[]> = {};
|
||||||
for (const prod of productions.value) {
|
for (const prod of products.value) {
|
||||||
let typeKey = '';
|
let typeKey = '';
|
||||||
if (typeof prod.production_type === 'string') {
|
if (typeof prod.product_type === 'string') {
|
||||||
typeKey = prod.production_type;
|
typeKey = prod.product_type;
|
||||||
} else if (
|
} else if (
|
||||||
prod.production_type &&
|
prod.product_type &&
|
||||||
typeof prod.production_type === 'object' &&
|
typeof prod.product_type === 'object' &&
|
||||||
'type' in prod.production_type
|
'name' in prod.product_type
|
||||||
) {
|
) {
|
||||||
typeKey = prod.production_type.type || '';
|
typeKey = prod.product_type || '';
|
||||||
}
|
}
|
||||||
if (!groups[typeKey]) groups[typeKey] = [];
|
if (!groups[typeKey]) groups[typeKey] = [];
|
||||||
groups[typeKey]?.push(prod);
|
groups[typeKey]?.push(prod);
|
||||||
}
|
}
|
||||||
|
console.log(groups);
|
||||||
return groups;
|
return groups;
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(groupedProductions, () => {
|
watch(groupedProducts, () => {
|
||||||
if (groupedProductions.value) {
|
if (groupedProducts.value) {
|
||||||
activeNames.value = [
|
activeNames.value = [
|
||||||
...Object.keys(groupedProductions.value),
|
...Object.keys(groupedProducts.value),
|
||||||
'no-category',
|
'no-category',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -113,10 +93,16 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
watch(pending, (value) => {
|
||||||
if (groupedProductions.value) {
|
if (!value) {
|
||||||
|
console.log('AsyncData: ', data.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
if (groupedProducts.value) {
|
||||||
activeNames.value = [
|
activeNames.value = [
|
||||||
...Object.keys(groupedProductions.value),
|
...Object.keys(groupedProducts.value),
|
||||||
'no-category',
|
'no-category',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -145,13 +131,13 @@
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.productions-container {
|
.products-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 40px;
|
gap: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.production-group {
|
.product-group {
|
||||||
margin-bottom: 32px;
|
margin-bottom: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,17 +30,17 @@
|
|||||||
<el-tab-pane :label="`全部(${resultCount['all']})`" name="all">
|
<el-tab-pane :label="`全部(${resultCount['all']})`" name="all">
|
||||||
<search-results
|
<search-results
|
||||||
v-model:current-page="currentPage"
|
v-model:current-page="currentPage"
|
||||||
:hit-items="hits"
|
:search-items="searchItems"
|
||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
:label="`产品(${resultCount['production'] || 0})`"
|
:label="`产品(${resultCount['product'] || 0})`"
|
||||||
name="production"
|
name="product"
|
||||||
>
|
>
|
||||||
<search-results
|
<search-results
|
||||||
v-model:current-page="currentPage"
|
v-model:current-page="currentPage"
|
||||||
:hit-items="hits"
|
:search-items="searchItems"
|
||||||
category="production"
|
category="product"
|
||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
@ -49,7 +49,7 @@
|
|||||||
>
|
>
|
||||||
<search-results
|
<search-results
|
||||||
v-model:current-page="currentPage"
|
v-model:current-page="currentPage"
|
||||||
:hit-items="hits"
|
:search-items="searchItems"
|
||||||
category="solution"
|
category="solution"
|
||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@ -59,7 +59,7 @@
|
|||||||
>
|
>
|
||||||
<search-results
|
<search-results
|
||||||
v-model:current-page="currentPage"
|
v-model:current-page="currentPage"
|
||||||
:hit-items="hits"
|
:search-items="searchItems"
|
||||||
category="question"
|
category="question"
|
||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@ -69,7 +69,7 @@
|
|||||||
>
|
>
|
||||||
<search-results
|
<search-results
|
||||||
v-model:current-page="currentPage"
|
v-model:current-page="currentPage"
|
||||||
:hit-items="hits"
|
:search-items="searchItems"
|
||||||
category="document"
|
category="document"
|
||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@ -92,8 +92,8 @@
|
|||||||
|
|
||||||
// i18n相关
|
// i18n相关
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { getStrapiLocale } = useLocalizations();
|
const { getDirectusLocale } = useLocalizations();
|
||||||
const strapiLocale = getStrapiLocale();
|
const directusLocale = getDirectusLocale();
|
||||||
|
|
||||||
// 路由相关
|
// 路由相关
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@ -110,40 +110,48 @@
|
|||||||
pending: loading,
|
pending: loading,
|
||||||
error,
|
error,
|
||||||
} = await useAsyncData(
|
} = await useAsyncData(
|
||||||
() => `search-${route.query.query ?? ''}`,
|
() => `search-${directusLocale}-${route.query.query ?? ''}`,
|
||||||
async () => {
|
async () => {
|
||||||
const q = String(route.query.query ?? '').trim();
|
const q = String(route.query.query ?? '').trim();
|
||||||
if (!q) return [];
|
if (!q) return [];
|
||||||
return await search(q, { limit: 12 });
|
return await search(q, { limit: 12 }, directusLocale);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// 本地化+空Section过滤
|
// 空Section过滤
|
||||||
const filteredSections = computed(() =>
|
const filteredSections = computed(() =>
|
||||||
sections.value
|
sections.value.filter((section) => section.hits.length > 0)
|
||||||
.map((section) => ({
|
|
||||||
...section,
|
|
||||||
hits: section.hits.filter(
|
|
||||||
(hit) =>
|
|
||||||
!hit.locale ||
|
|
||||||
String(hit.locale).toLowerCase() === strapiLocale.toLowerCase()
|
|
||||||
),
|
|
||||||
}))
|
|
||||||
.filter((section) => section.hits.length > 0)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const typeMap = {
|
||||||
|
products: 'products',
|
||||||
|
solutions: 'solutions',
|
||||||
|
questions: 'questions',
|
||||||
|
product_documents: 'product_documents',
|
||||||
|
} as const;
|
||||||
// 展平hits
|
// 展平hits
|
||||||
const hits = computed(() =>
|
const hits = computed(() =>
|
||||||
filteredSections.value.flatMap((item) =>
|
filteredSections.value.flatMap((section) => {
|
||||||
item.hits.map((content) => ({ content, type: item.indexUid }))
|
const type = typeMap[section.rawIndex as keyof typeof typeMap];
|
||||||
)
|
if (!type) return [];
|
||||||
|
return section.hits.map((hit) => ({ type, content: hit }));
|
||||||
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const searchItems = computed(() =>
|
||||||
|
hits.value.map((hit) => {
|
||||||
|
return toSearchItemView(hit.content, hit.type);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(searchItems.value);
|
||||||
|
|
||||||
// 分类控制
|
// 分类控制
|
||||||
const activeTab = ref('all');
|
const activeTab = ref('all');
|
||||||
const resultCount = computed(() => {
|
const resultCount = computed(() => {
|
||||||
const map: Record<string, number> = { all: hits.value.length };
|
const map: Record<string, number> = { all: searchItems.value.length };
|
||||||
for (const hit of hits.value) {
|
for (const item of searchItems.value) {
|
||||||
map[hit.type] = (map[hit.type] ?? 0) + 1;
|
map[item.type] = (map[item.type] ?? 0) + 1;
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
});
|
});
|
||||||
@ -177,7 +185,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const results = await search(trimmed, { limit: 12 });
|
const results = await search(trimmed, { limit: 12 }, directusLocale);
|
||||||
if (requestId === activeRequestId.value) {
|
if (requestId === activeRequestId.value) {
|
||||||
sections.value = results;
|
sections.value = results;
|
||||||
}
|
}
|
||||||
@ -197,12 +205,16 @@
|
|||||||
router.replace(localePath({ path: '/search' }));
|
router.replace(localePath({ path: '/search' }));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch(activeTab, () => {
|
||||||
|
currentPage.value = 1; // 重置页码
|
||||||
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.query.query,
|
() => route.query.query,
|
||||||
(newQuery) => {
|
async (newQuery) => {
|
||||||
if (typeof newQuery === 'string' && newQuery.trim()) {
|
if (typeof newQuery === 'string' && newQuery.trim()) {
|
||||||
keyword.value = newQuery;
|
keyword.value = newQuery;
|
||||||
performSearch(newQuery);
|
await performSearch(newQuery);
|
||||||
} else {
|
} else {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
<div class="solution-meta">
|
<div class="solution-meta">
|
||||||
<span class="solution-date">
|
<span class="solution-date">
|
||||||
CreatedAt:
|
CreatedAt:
|
||||||
{{ new Date(solution.createdAt).toLocaleDateString() }}
|
{{ new Date(solution.createAt).toLocaleDateString() }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -42,7 +42,7 @@
|
|||||||
:sub-title="$t('solution-not-found-desc')"
|
:sub-title="$t('solution-not-found-desc')"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<el-button type="primary" @click="$router.push('/productions')">
|
<el-button type="primary" @click="$router.push('/solutions')">
|
||||||
{{ $t('back-to-solutions') }}
|
{{ $t('back-to-solutions') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -57,23 +57,17 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { findOne } = useStrapi();
|
|
||||||
const { getStrapiLocale } = useLocalizations();
|
|
||||||
const strapiLocale = getStrapiLocale();
|
|
||||||
|
|
||||||
// 获取路由参数(documentId)
|
// 获取路由参数(documentId)
|
||||||
const documentId = computed(() => route.params.slug as string);
|
const id = computed(() => route.params.slug as string);
|
||||||
|
|
||||||
const { data, pending, error } = useAsyncData(
|
const { data, pending, error } = await useSolution(id.value);
|
||||||
() => `solution-${documentId.value}`,
|
|
||||||
() =>
|
|
||||||
findOne<Solution>('solutions', documentId.value, {
|
|
||||||
populate: '*',
|
|
||||||
locale: strapiLocale,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
const solution = computed(() => data.value?.data ?? null);
|
console.log('RawData: ', data.value);
|
||||||
|
const process = toSolutionView(data.value);
|
||||||
|
console.log('Processed Solution: ', process);
|
||||||
|
|
||||||
|
const solution = computed(() => toSolutionView(data.value));
|
||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
|
|||||||
@ -21,11 +21,11 @@
|
|||||||
<div class="solution-list">
|
<div class="solution-list">
|
||||||
<solution-card
|
<solution-card
|
||||||
v-for="solution in solutions"
|
v-for="solution in solutions"
|
||||||
:key="solution.documentId"
|
:key="solution.id"
|
||||||
:title="solution.title"
|
:title="solution.title"
|
||||||
:summary="solution.summary || ''"
|
:summary="solution.summary || ''"
|
||||||
:cover-url="useStrapiMedia(solution?.cover?.url || '')"
|
:cover-url="getImageUrl(solution.cover || '')"
|
||||||
:document-id="solution.documentId"
|
:document-id="solution.id.toString()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@ -38,9 +38,9 @@
|
|||||||
<div class="solution-list">
|
<div class="solution-list">
|
||||||
<solution-card
|
<solution-card
|
||||||
v-for="solution in group"
|
v-for="solution in group"
|
||||||
:key="solution.documentId"
|
:key="solution.id"
|
||||||
:document-id="solution.documentId"
|
:document-id="solution.id.toString()"
|
||||||
:cover-url="useStrapiMedia(solution?.cover?.url || '')"
|
:cover-url="getImageUrl(solution.cover || '')"
|
||||||
:title="solution.title"
|
:title="solution.title"
|
||||||
:summary="solution.summary || ''"
|
:summary="solution.summary || ''"
|
||||||
/>
|
/>
|
||||||
@ -55,31 +55,22 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { find } = useStrapi();
|
const { getImageUrl } = useDirectusImage();
|
||||||
const { getStrapiLocale } = useLocalizations();
|
|
||||||
const strapiLocale = getStrapiLocale();
|
|
||||||
|
|
||||||
const { data, pending, error } = useAsyncData('solutions', () =>
|
const { data, pending, error } = await useSolutionList();
|
||||||
find<Solution>('solutions', {
|
|
||||||
populate: {
|
const solutionsRaw = computed(() => data.value ?? []);
|
||||||
cover: {
|
const solutions = computed(() =>
|
||||||
populate: '*',
|
solutionsRaw.value.map((item) => toSolutionListView(item))
|
||||||
},
|
|
||||||
solution_type: {
|
|
||||||
populate: '*',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
locale: strapiLocale,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const activeName = ref<string>('all');
|
const activeName = ref<string>('all');
|
||||||
|
|
||||||
const solutions = computed(() => data.value?.data ?? []);
|
console.log('Processed Data', solutions.value);
|
||||||
|
|
||||||
// 按类型分组
|
// 按类型分组
|
||||||
const groupedSolutions = computed(() => {
|
const groupedSolutions = computed(() => {
|
||||||
const gourps: Record<string, Solution[]> = {};
|
const gourps: Record<string, SolutionListView[]> = {};
|
||||||
for (const sol of solutions.value) {
|
for (const sol of solutions.value) {
|
||||||
let typeKey = '';
|
let typeKey = '';
|
||||||
if (typeof sol.solution_type === 'string') {
|
if (typeof sol.solution_type === 'string') {
|
||||||
@ -89,7 +80,7 @@
|
|||||||
typeof sol.solution_type === 'object' &&
|
typeof sol.solution_type === 'object' &&
|
||||||
'type' in sol.solution_type
|
'type' in sol.solution_type
|
||||||
) {
|
) {
|
||||||
typeKey = sol.solution_type.type || '';
|
typeKey = sol.solution_type || '';
|
||||||
}
|
}
|
||||||
if (!gourps[typeKey]) gourps[typeKey] = [];
|
if (!gourps[typeKey]) gourps[typeKey] = [];
|
||||||
gourps[typeKey]?.push(sol);
|
gourps[typeKey]?.push(sol);
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="!pending" class="page-content">
|
<div v-if="!pending" class="page-content">
|
||||||
<markdown-renderer :content="content || ''" />
|
<markdown-renderer :content="content.content || ''" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="loading">
|
<div v-else class="loading">
|
||||||
<el-skeleton :rows="5" animated />
|
<el-skeleton :rows="5" animated />
|
||||||
@ -32,18 +32,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { findOne } = useStrapi();
|
const { data, pending, error } = await useContactInfo();
|
||||||
const { getStrapiLocale } = useLocalizations();
|
|
||||||
const strapiLocale = getStrapiLocale();
|
|
||||||
|
|
||||||
const { data, pending, error } = useAsyncData('contact-info', () =>
|
const content = computed(() => toContactInfoView(data.value));
|
||||||
findOne<StrapiContactInfo>('contact-info', undefined, {
|
|
||||||
populate: '*',
|
|
||||||
locale: strapiLocale,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
const content = computed(() => data.value?.data.content ?? '');
|
|
||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
|
|||||||
@ -35,25 +35,25 @@
|
|||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="type in productionTypeOptions"
|
v-for="type in productTypeOptions"
|
||||||
:key="type.documentId"
|
:key="type.id"
|
||||||
:label="type.type"
|
:label="type.name"
|
||||||
:value="type.documentId"
|
:value="type.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<span class="select-label">产品系列</span>
|
<span class="select-label">产品系列</span>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="selectedProduction"
|
v-model="selectedProduct"
|
||||||
placeholder="选择系列产品"
|
placeholder="选择系列产品"
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="production in productionOptions"
|
v-for="product in productOptions"
|
||||||
:key="production.documentId"
|
:key="product.id"
|
||||||
:label="production.title"
|
:label="product.name"
|
||||||
:value="production.documentId"
|
:value="product.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -78,37 +78,24 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Search } from '@element-plus/icons-vue';
|
import { Search } from '@element-plus/icons-vue';
|
||||||
|
|
||||||
const { find } = useStrapi();
|
const { data, pending, error } = await useDocumentList();
|
||||||
const { getStrapiLocale } = useLocalizations();
|
|
||||||
const strapiLocale = getStrapiLocale();
|
|
||||||
|
|
||||||
const { data, pending, error } = useAsyncData('documents', () =>
|
const documents = computed(
|
||||||
find<ProductionDocument>('production-documents', {
|
() => data?.value.map((item) => toDocumentListView(item)) ?? []
|
||||||
populate: ['document', 'related_productions.production_type'],
|
|
||||||
locale: strapiLocale,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// const documents = computed(
|
|
||||||
// () =>
|
|
||||||
// data.value?.data.map((item) => ({
|
|
||||||
// ...item.document,
|
|
||||||
// })) || []
|
|
||||||
// );
|
|
||||||
const documents = computed(() => data.value?.data ?? []);
|
|
||||||
|
|
||||||
const keyword = ref('');
|
const keyword = ref('');
|
||||||
|
|
||||||
const selectedType = ref<string | null>(null);
|
const selectedType = ref<number | null>(null);
|
||||||
const selectedProduction = ref<string | null>(null);
|
const selectedProduct = ref<number | null>(null);
|
||||||
|
|
||||||
const productionTypeOptions = computed(() => {
|
const productTypeOptions = computed(() => {
|
||||||
const types: ProductionType[] = [];
|
const types: DocumentListProductType[] = [];
|
||||||
documents.value.forEach((document: ProductionDocument) => {
|
documents.value.forEach((doc: DocumentListView) => {
|
||||||
document.related_productions?.forEach((production: Production) => {
|
doc.products?.forEach((product: DocumentListProduct) => {
|
||||||
const productionType = production?.production_type;
|
const productType = product.type;
|
||||||
if (!types.some((p) => p.documentId === productionType.documentId)) {
|
if (!types.some((item) => item.id === productType.id)) {
|
||||||
types.push(productionType);
|
types.push(productType);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -116,51 +103,48 @@
|
|||||||
return types;
|
return types;
|
||||||
});
|
});
|
||||||
|
|
||||||
const productionOptions = computed(() => {
|
const productOptions = computed(() => {
|
||||||
if (!selectedType.value) return [];
|
if (!selectedType.value) return [];
|
||||||
const productions: Production[] = [];
|
const products: DocumentListProduct[] = [];
|
||||||
documents.value.forEach((document: ProductionDocument) => {
|
|
||||||
document.related_productions.forEach((production: Production) => {
|
documents.value.forEach((doc: DocumentListView) => {
|
||||||
|
doc.products?.forEach((product: DocumentListProduct) => {
|
||||||
if (
|
if (
|
||||||
production.production_type?.documentId === selectedType.value &&
|
product.type.id === selectedType.value &&
|
||||||
!productions.some((p) => p.documentId === production.documentId)
|
!products.some((item) => item.id === product.id)
|
||||||
) {
|
) {
|
||||||
productions.push(production);
|
products.push(product);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return productions;
|
|
||||||
|
return products;
|
||||||
});
|
});
|
||||||
|
|
||||||
const filteredDocuments = computed(() =>
|
const filteredDocuments = computed(() =>
|
||||||
documents.value
|
documents.value.filter((doc: DocumentListView) => {
|
||||||
.filter((document: ProductionDocument) => {
|
const matchProduct = selectedProduct.value
|
||||||
const matchProduction = selectedProduction.value
|
? doc.products?.some(
|
||||||
? document.related_productions?.some(
|
(product: DocumentListProduct) =>
|
||||||
(production: Production) =>
|
product.id === selectedProduct.value
|
||||||
production.documentId === selectedProduction.value
|
)
|
||||||
|
: selectedType.value
|
||||||
|
? doc.products?.some(
|
||||||
|
(product: DocumentListProduct) =>
|
||||||
|
product.type?.id === selectedType.value
|
||||||
)
|
)
|
||||||
: selectedType.value
|
|
||||||
? document.related_productions?.some(
|
|
||||||
(production: Production) =>
|
|
||||||
production.production_type?.documentId === selectedType.value
|
|
||||||
)
|
|
||||||
: true;
|
|
||||||
|
|
||||||
const matchKeyword = keyword.value
|
|
||||||
? document.document.caption &&
|
|
||||||
document.document.caption.includes(keyword.value)
|
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
return matchProduction && matchKeyword;
|
const matchKeyword = keyword.value
|
||||||
})
|
? doc.title && doc.title.includes(keyword.value)
|
||||||
.map((item) => ({
|
: true;
|
||||||
...item.document,
|
|
||||||
}))
|
return matchProduct && matchKeyword;
|
||||||
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(selectedType, () => {
|
watch(selectedType, () => {
|
||||||
selectedProduction.value = null;
|
selectedProduct.value = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(documents, (value) => {
|
watch(documents, (value) => {
|
||||||
|
|||||||
@ -36,25 +36,25 @@
|
|||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="type in productionTypeOptions"
|
v-for="type in productTypeOptions"
|
||||||
:key="type.documentId"
|
:key="type.id"
|
||||||
:label="type.type"
|
:label="type.name"
|
||||||
:value="type.documentId"
|
:value="type.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<span class="select-label">产品系列</span>
|
<span class="select-label">产品系列</span>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="selectedProduction"
|
v-model="selectedProduct"
|
||||||
placeholder="选择系列产品"
|
placeholder="选择系列产品"
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="production in productionOptions"
|
v-for="product in productOptions"
|
||||||
:key="production.documentId"
|
:key="product.id"
|
||||||
:label="production.title"
|
:label="product.name"
|
||||||
:value="production.documentId"
|
:value="product.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -78,68 +78,58 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Search } from '@element-plus/icons-vue';
|
import { Search } from '@element-plus/icons-vue';
|
||||||
const { find } = useStrapi();
|
|
||||||
const { getStrapiLocale } = useLocalizations();
|
|
||||||
const strapiLocale = getStrapiLocale();
|
|
||||||
|
|
||||||
const { data, pending, error } = useAsyncData('questions', () =>
|
const { data, pending, error } = await useQuestionList();
|
||||||
find<Question>('questions', {
|
|
||||||
populate: {
|
const questions = computed(
|
||||||
related_productions: {
|
() => data.value.map((item) => toQuestionListView(item)) ?? null
|
||||||
populate: ['production_type'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
locale: strapiLocale,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const questions = computed(() => data.value?.data ?? null);
|
|
||||||
|
|
||||||
const keyword = ref('');
|
const keyword = ref('');
|
||||||
|
|
||||||
const selectedType = ref<string | null>(null);
|
const selectedType = ref<number | null>(null);
|
||||||
const selectedProduction = ref<string | null>(null);
|
const selectedProduct = ref<number | null>(null);
|
||||||
|
|
||||||
const productionTypeOptions = computed(() => {
|
const productTypeOptions = computed(() => {
|
||||||
const types: ProductionType[] = [];
|
const types: QuestionListProductType[] = [];
|
||||||
questions.value.forEach((q: Question) => {
|
questions.value.forEach((q: QuestionListView) => {
|
||||||
q.related_productions?.forEach((production: Production) => {
|
q.products.forEach((product: QuestionListProduct) => {
|
||||||
const productionType = production?.production_type;
|
const productType = product.type;
|
||||||
if (!types.some((p) => p.documentId === productionType.documentId)) {
|
if (!types.some((p) => p.id === productType.id)) {
|
||||||
types.push(productionType);
|
types.push(productType);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return types;
|
return types;
|
||||||
});
|
});
|
||||||
|
|
||||||
const productionOptions = computed(() => {
|
const productOptions = computed(() => {
|
||||||
if (!selectedType.value) return [];
|
if (!selectedType.value) return [];
|
||||||
const productions: Production[] = [];
|
const products: QuestionListProduct[] = [];
|
||||||
questions.value.forEach((question: Question) => {
|
questions.value.forEach((q: QuestionListView) => {
|
||||||
question.related_productions.forEach((production: Production) => {
|
q.products.forEach((product: QuestionListProduct) => {
|
||||||
if (
|
if (
|
||||||
production.production_type?.documentId === selectedType.value &&
|
product.type.id === selectedType.value &&
|
||||||
!productions.some((p) => p.documentId === production.documentId)
|
!products.some((p) => p.id === product.id)
|
||||||
) {
|
) {
|
||||||
productions.push(production);
|
products.push(product);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return productions;
|
return products;
|
||||||
});
|
});
|
||||||
|
|
||||||
const filteredQuestions = computed(() => {
|
const filteredQuestions = computed(() => {
|
||||||
return questions.value.filter((question: Question) => {
|
return questions.value.filter((question: QuestionListView) => {
|
||||||
const matchProduction = selectedProduction.value
|
const matchProduct = selectedProduct.value
|
||||||
? question.related_productions?.some(
|
? question.products?.some(
|
||||||
(production: Production) =>
|
(product: QuestionListProduct) =>
|
||||||
production.documentId === selectedProduction.value
|
product.id === selectedProduct.value
|
||||||
)
|
)
|
||||||
: selectedType.value
|
: selectedType.value
|
||||||
? question.related_productions?.some(
|
? question.products?.some(
|
||||||
(production: Production) =>
|
(product: QuestionListProduct) =>
|
||||||
production.production_type?.documentId === selectedType.value
|
product.type.id === selectedType.value
|
||||||
)
|
)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
@ -148,12 +138,12 @@
|
|||||||
(question.content && question.content.includes(keyword.value))
|
(question.content && question.content.includes(keyword.value))
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
return matchProduction && matchKeyword;
|
return matchProduct && matchKeyword;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(selectedType, () => {
|
watch(selectedType, () => {
|
||||||
selectedProduction.value = null;
|
selectedProduct.value = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(data, (newVal) => {
|
watch(data, (newVal) => {
|
||||||
|
|||||||
12
app/plugins/directus.ts
Normal file
12
app/plugins/directus.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { createDirectus, rest, staticToken } from '@directus/sdk';
|
||||||
|
|
||||||
|
export default defineNuxtPlugin(() => {
|
||||||
|
const config = useRuntimeConfig();
|
||||||
|
|
||||||
|
const directus = createDirectus<Schema>(config.public.directus.url)
|
||||||
|
.with(rest())
|
||||||
|
.with(staticToken(config.public.directus.token || ''));
|
||||||
|
return {
|
||||||
|
provide: { directus },
|
||||||
|
};
|
||||||
|
});
|
||||||
7
app/types/common.ts
Normal file
7
app/types/common.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export type JsonPrimitive = string | number | boolean | null;
|
||||||
|
|
||||||
|
export type JsonArray = JsonValue[];
|
||||||
|
|
||||||
|
export type JsonObject = { [key: string]: JsonValue };
|
||||||
|
|
||||||
|
export type JsonValue = JsonPrimitive | JsonArray | JsonObject;
|
||||||
1
app/types/directus/index.ts
Normal file
1
app/types/directus/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './my-schema';
|
||||||
842
app/types/directus/my-schema.ts
Normal file
842
app/types/directus/my-schema.ts
Normal file
@ -0,0 +1,842 @@
|
|||||||
|
export interface CompanyProfile {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
translations?: CompanyProfileTranslation[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CompanyProfileTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
company_profile_id?: CompanyProfile | string | null;
|
||||||
|
languages_code?: Language | string | null;
|
||||||
|
content?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ContactInfo {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
translations?: ContactInfoTranslation[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ContactInfoTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
contact_info_id?: ContactInfo | string | null;
|
||||||
|
languages_code?: Language | string | null;
|
||||||
|
content?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DocumentsTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
languages_code?: Language | string | null;
|
||||||
|
title?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Homepage {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
carousel?: HomepageFile[] | string[];
|
||||||
|
recommend_products?: Product[] | string[];
|
||||||
|
recommend_solutions?: Solution[] | string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface HomepageFile {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
homepage_id?: Homepage | string | null;
|
||||||
|
directus_files_id?: DirectusFile | string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Language {
|
||||||
|
/** @primaryKey */
|
||||||
|
code: string;
|
||||||
|
name?: string | null;
|
||||||
|
direction?: 'ltr' | 'rtl' | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductDocument {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
status?: 'published' | 'draft' | 'archived';
|
||||||
|
file?: DirectusFile | string | null;
|
||||||
|
products?: ProductsProductDocument[] | string[];
|
||||||
|
translations?: ProductDocumentsTranslation[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductDocumentsTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
product_documents_id?: ProductDocument | string | null;
|
||||||
|
languages_code?: Language | string | null;
|
||||||
|
title?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductImage {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
image?: DirectusFile | string | null;
|
||||||
|
translations?: ProductImagesTranslation[] | null;
|
||||||
|
products?: ProductsProductImage[] | string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductImagesTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
product_images_id?: ProductImage | string | null;
|
||||||
|
languages_code?: Language | string | null;
|
||||||
|
caption?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductSpecGroup {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
product?: Product | string | null;
|
||||||
|
sort?: number | null;
|
||||||
|
translations?: ProductSpecGroupsTranslation[] | null;
|
||||||
|
specs?: ProductSpec[] | string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductSpecGroupsTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
product_spec_groups_id?: ProductSpecGroup | string | null;
|
||||||
|
languages_code?: Language | string | null;
|
||||||
|
name?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductSpec {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
group?: ProductSpecGroup | string | null;
|
||||||
|
sort?: number | null;
|
||||||
|
value?: string | null;
|
||||||
|
translations?: ProductSpecsTranslation[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductSpecsTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
product_specs_id?: ProductSpec | string | null;
|
||||||
|
languages_code?: Language | string | null;
|
||||||
|
key?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductType {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
/** @description 当前产品条目的状态 */
|
||||||
|
status?: 'published' | 'draft' | 'archived';
|
||||||
|
/** @description i18n文本 */
|
||||||
|
translations?: ProductTypesTranslation[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductTypesTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
product_types_id?: ProductType | string | null;
|
||||||
|
languages_code?: Language | string | null;
|
||||||
|
/** @required */
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Product {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
/** @description 当前产品条目的状态 */
|
||||||
|
status?: 'published' | 'draft' | 'archived';
|
||||||
|
product_type?: ProductType | string | null;
|
||||||
|
/** @description 在产品列表中显示 */
|
||||||
|
cover?: DirectusFile | string | null;
|
||||||
|
homepage_recommend?: Homepage | string | null;
|
||||||
|
recommend_sort?: number | null;
|
||||||
|
/** @description i18n字段 */
|
||||||
|
translations?: ProductsTranslation[] | null;
|
||||||
|
faqs?: ProductsQuestion[] | string[];
|
||||||
|
documents?: ProductsProductDocument[] | string[];
|
||||||
|
/** @description 在产品详情页中展示 */
|
||||||
|
images?: ProductsProductImage[] | string[];
|
||||||
|
specs?: ProductSpecGroup[] | string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductsProductDocument {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
products_id?: Product | string | null;
|
||||||
|
product_documents_id?: ProductDocument | string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductsProductImage {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
products_id?: Product | string | null;
|
||||||
|
product_images_id?: ProductImage | string | null;
|
||||||
|
sort?: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductsQuestion {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
products_id?: Product | string | null;
|
||||||
|
questions_id?: Question | string | null;
|
||||||
|
sort?: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductsTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
products_id?: Product | string | null;
|
||||||
|
languages_code?: Language | string | null;
|
||||||
|
/** @required */
|
||||||
|
name: string;
|
||||||
|
summary?: string | null;
|
||||||
|
description?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Question {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
status?: 'published' | 'draft' | 'archived';
|
||||||
|
/** @description i18n字段 */
|
||||||
|
translations?: QuestionsTranslation[] | null;
|
||||||
|
products?: ProductsQuestion[] | string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QuestionsTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
questions_id?: Question | string | null;
|
||||||
|
languages_code?: Language | string | null;
|
||||||
|
/** @required */
|
||||||
|
title: string;
|
||||||
|
content?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SolutionType {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
status?: 'published' | 'draft' | 'archived';
|
||||||
|
/** @description i18n字段 */
|
||||||
|
translations?: SolutionTypesTranslation[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SolutionTypesTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
solution_types_id?: SolutionType | string | null;
|
||||||
|
languages_code?: Language | string | null;
|
||||||
|
name?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Solution {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
status?: 'published' | 'draft' | 'archived';
|
||||||
|
type?: SolutionType | string | null;
|
||||||
|
cover?: DirectusFile | string | null;
|
||||||
|
homepage_recommend?: Homepage | string | null;
|
||||||
|
recommend_sort?: number | null;
|
||||||
|
/** @description 条目创建时自动生成 */
|
||||||
|
create_at?: string | null;
|
||||||
|
translations?: SolutionsTranslation[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SolutionsTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
solutions_id?: Solution | string | null;
|
||||||
|
languages_code?: Language | string | null;
|
||||||
|
title?: string | null;
|
||||||
|
summary?: string | null;
|
||||||
|
content?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusAccess {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
role?: DirectusRole | string | null;
|
||||||
|
user?: DirectusUser | string | null;
|
||||||
|
policy?: DirectusPolicy | string;
|
||||||
|
sort?: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusActivity {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
action?: string;
|
||||||
|
user?: DirectusUser | string | null;
|
||||||
|
timestamp?: string;
|
||||||
|
ip?: string | null;
|
||||||
|
user_agent?: string | null;
|
||||||
|
collection?: string;
|
||||||
|
item?: string;
|
||||||
|
origin?: string | null;
|
||||||
|
revisions?: DirectusRevision[] | string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusCollection {
|
||||||
|
/** @primaryKey */
|
||||||
|
collection: string;
|
||||||
|
icon?: string | null;
|
||||||
|
note?: string | null;
|
||||||
|
display_template?: string | null;
|
||||||
|
hidden?: boolean;
|
||||||
|
singleton?: boolean;
|
||||||
|
translations?: Array<{
|
||||||
|
language: string;
|
||||||
|
translation: string;
|
||||||
|
singular: string;
|
||||||
|
plural: string;
|
||||||
|
}> | null;
|
||||||
|
archive_field?: string | null;
|
||||||
|
archive_app_filter?: boolean;
|
||||||
|
archive_value?: string | null;
|
||||||
|
unarchive_value?: string | null;
|
||||||
|
sort_field?: string | null;
|
||||||
|
accountability?: 'all' | 'activity' | null | null;
|
||||||
|
color?: string | null;
|
||||||
|
item_duplication_fields?: 'json' | null;
|
||||||
|
sort?: number | null;
|
||||||
|
group?: DirectusCollection | string | null;
|
||||||
|
collapse?: string;
|
||||||
|
preview_url?: string | null;
|
||||||
|
versioning?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusComment {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
collection?: DirectusCollection | string;
|
||||||
|
item?: string;
|
||||||
|
comment?: string;
|
||||||
|
date_created?: string | null;
|
||||||
|
date_updated?: string | null;
|
||||||
|
user_created?: DirectusUser | string | null;
|
||||||
|
user_updated?: DirectusUser | string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusField {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
collection?: DirectusCollection | string;
|
||||||
|
field?: string;
|
||||||
|
special?: string[] | null;
|
||||||
|
interface?: string | null;
|
||||||
|
options?: 'json' | null;
|
||||||
|
display?: string | null;
|
||||||
|
display_options?: 'json' | null;
|
||||||
|
readonly?: boolean;
|
||||||
|
hidden?: boolean;
|
||||||
|
sort?: number | null;
|
||||||
|
width?: string | null;
|
||||||
|
translations?: 'json' | null;
|
||||||
|
note?: string | null;
|
||||||
|
conditions?: 'json' | null;
|
||||||
|
required?: boolean | null;
|
||||||
|
group?: DirectusField | string | null;
|
||||||
|
validation?: 'json' | null;
|
||||||
|
validation_message?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusFile {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
storage?: string;
|
||||||
|
filename_disk?: string | null;
|
||||||
|
filename_download?: string;
|
||||||
|
title?: string | null;
|
||||||
|
type?: string | null;
|
||||||
|
folder?: DirectusFolder | string | null;
|
||||||
|
uploaded_by?: DirectusUser | string | null;
|
||||||
|
created_on?: string;
|
||||||
|
modified_by?: DirectusUser | string | null;
|
||||||
|
modified_on?: string;
|
||||||
|
charset?: string | null;
|
||||||
|
filesize?: number | null;
|
||||||
|
width?: number | null;
|
||||||
|
height?: number | null;
|
||||||
|
duration?: number | null;
|
||||||
|
embed?: string | null;
|
||||||
|
description?: string | null;
|
||||||
|
location?: string | null;
|
||||||
|
tags?: string[] | null;
|
||||||
|
metadata?: 'json' | null;
|
||||||
|
focal_point_x?: number | null;
|
||||||
|
focal_point_y?: number | null;
|
||||||
|
tus_id?: string | null;
|
||||||
|
tus_data?: 'json' | null;
|
||||||
|
uploaded_on?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusFolder {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
name?: string;
|
||||||
|
parent?: DirectusFolder | string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusMigration {
|
||||||
|
/** @primaryKey */
|
||||||
|
version: string;
|
||||||
|
name?: string;
|
||||||
|
timestamp?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusPermission {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
collection?: string;
|
||||||
|
action?: string;
|
||||||
|
permissions?: 'json' | null;
|
||||||
|
validation?: 'json' | null;
|
||||||
|
presets?: 'json' | null;
|
||||||
|
fields?: string[] | null;
|
||||||
|
policy?: DirectusPolicy | string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusPolicy {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
/** @required */
|
||||||
|
name: string;
|
||||||
|
icon?: string;
|
||||||
|
description?: string | null;
|
||||||
|
ip_access?: string[] | null;
|
||||||
|
enforce_tfa?: boolean;
|
||||||
|
admin_access?: boolean;
|
||||||
|
app_access?: boolean;
|
||||||
|
permissions?: DirectusPermission[] | string[];
|
||||||
|
users?: DirectusAccess[] | string[];
|
||||||
|
roles?: DirectusAccess[] | string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusPreset {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
bookmark?: string | null;
|
||||||
|
user?: DirectusUser | string | null;
|
||||||
|
role?: DirectusRole | string | null;
|
||||||
|
collection?: string | null;
|
||||||
|
search?: string | null;
|
||||||
|
layout?: string | null;
|
||||||
|
layout_query?: 'json' | null;
|
||||||
|
layout_options?: 'json' | null;
|
||||||
|
refresh_interval?: number | null;
|
||||||
|
filter?: 'json' | null;
|
||||||
|
icon?: string | null;
|
||||||
|
color?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusRelation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
many_collection?: string;
|
||||||
|
many_field?: string;
|
||||||
|
one_collection?: string | null;
|
||||||
|
one_field?: string | null;
|
||||||
|
one_collection_field?: string | null;
|
||||||
|
one_allowed_collections?: string[] | null;
|
||||||
|
junction_field?: string | null;
|
||||||
|
sort_field?: string | null;
|
||||||
|
one_deselect_action?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusRevision {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
activity?: DirectusActivity | string;
|
||||||
|
collection?: string;
|
||||||
|
item?: string;
|
||||||
|
data?: 'json' | null;
|
||||||
|
delta?: 'json' | null;
|
||||||
|
parent?: DirectusRevision | string | null;
|
||||||
|
version?: DirectusVersion | string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusRole {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
/** @required */
|
||||||
|
name: string;
|
||||||
|
icon?: string;
|
||||||
|
description?: string | null;
|
||||||
|
parent?: DirectusRole | string | null;
|
||||||
|
children?: DirectusRole[] | string[];
|
||||||
|
policies?: DirectusAccess[] | string[];
|
||||||
|
users?: DirectusUser[] | string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusSession {
|
||||||
|
/** @primaryKey */
|
||||||
|
token: string;
|
||||||
|
user?: DirectusUser | string | null;
|
||||||
|
expires?: string;
|
||||||
|
ip?: string | null;
|
||||||
|
user_agent?: string | null;
|
||||||
|
share?: DirectusShare | string | null;
|
||||||
|
origin?: string | null;
|
||||||
|
next_token?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusSettings {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
project_name?: string;
|
||||||
|
project_url?: string | null;
|
||||||
|
project_color?: string;
|
||||||
|
project_logo?: DirectusFile | string | null;
|
||||||
|
public_foreground?: DirectusFile | string | null;
|
||||||
|
public_background?: DirectusFile | string | null;
|
||||||
|
public_note?: string | null;
|
||||||
|
auth_login_attempts?: number | null;
|
||||||
|
auth_password_policy?:
|
||||||
|
| null
|
||||||
|
| `/^.{8,}$/`
|
||||||
|
| `/(?=^.{8,}$)(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{';'?>.<,])(?!.*\\s).*$/`
|
||||||
|
| null;
|
||||||
|
storage_asset_transform?: 'all' | 'none' | 'presets' | null;
|
||||||
|
storage_asset_presets?: Array<{
|
||||||
|
key: string;
|
||||||
|
fit: 'contain' | 'cover' | 'inside' | 'outside';
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
quality: number;
|
||||||
|
withoutEnlargement: boolean;
|
||||||
|
format: 'auto' | 'jpeg' | 'png' | 'webp' | 'tiff' | 'avif';
|
||||||
|
transforms: 'json';
|
||||||
|
}> | null;
|
||||||
|
custom_css?: string | null;
|
||||||
|
storage_default_folder?: DirectusFolder | string | null;
|
||||||
|
basemaps?: Array<{
|
||||||
|
name: string;
|
||||||
|
type: 'raster' | 'tile' | 'style';
|
||||||
|
url: string;
|
||||||
|
tileSize: number;
|
||||||
|
attribution: string;
|
||||||
|
}> | null;
|
||||||
|
mapbox_key?: string | null;
|
||||||
|
module_bar?: 'json' | null;
|
||||||
|
project_descriptor?: string | null;
|
||||||
|
default_language?: string;
|
||||||
|
custom_aspect_ratios?: Array<{ text: string; value: number }> | null;
|
||||||
|
public_favicon?: DirectusFile | string | null;
|
||||||
|
default_appearance?: 'auto' | 'light' | 'dark';
|
||||||
|
default_theme_light?: string | null;
|
||||||
|
theme_light_overrides?: 'json' | null;
|
||||||
|
default_theme_dark?: string | null;
|
||||||
|
theme_dark_overrides?: 'json' | null;
|
||||||
|
report_error_url?: string | null;
|
||||||
|
report_bug_url?: string | null;
|
||||||
|
report_feature_url?: string | null;
|
||||||
|
public_registration?: boolean;
|
||||||
|
public_registration_verify_email?: boolean;
|
||||||
|
public_registration_role?: DirectusRole | string | null;
|
||||||
|
public_registration_email_filter?: 'json' | null;
|
||||||
|
visual_editor_urls?: Array<{ url: string }> | null;
|
||||||
|
accepted_terms?: boolean | null;
|
||||||
|
project_id?: string | null;
|
||||||
|
mcp_enabled?: boolean;
|
||||||
|
mcp_allow_deletes?: boolean;
|
||||||
|
mcp_prompts_collection?: string | null;
|
||||||
|
mcp_system_prompt_enabled?: boolean;
|
||||||
|
mcp_system_prompt?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusUser {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
first_name?: string | null;
|
||||||
|
last_name?: string | null;
|
||||||
|
email?: string | null;
|
||||||
|
password?: string | null;
|
||||||
|
location?: string | null;
|
||||||
|
title?: string | null;
|
||||||
|
description?: string | null;
|
||||||
|
tags?: string[] | null;
|
||||||
|
avatar?: DirectusFile | string | null;
|
||||||
|
language?: string | null;
|
||||||
|
tfa_secret?: string | null;
|
||||||
|
status?:
|
||||||
|
| 'draft'
|
||||||
|
| 'invited'
|
||||||
|
| 'unverified'
|
||||||
|
| 'active'
|
||||||
|
| 'suspended'
|
||||||
|
| 'archived';
|
||||||
|
role?: DirectusRole | string | null;
|
||||||
|
token?: string | null;
|
||||||
|
last_access?: string | null;
|
||||||
|
last_page?: string | null;
|
||||||
|
provider?: string;
|
||||||
|
external_identifier?: string | null;
|
||||||
|
auth_data?: 'json' | null;
|
||||||
|
email_notifications?: boolean | null;
|
||||||
|
appearance?: null | 'auto' | 'light' | 'dark' | null;
|
||||||
|
theme_dark?: string | null;
|
||||||
|
theme_light?: string | null;
|
||||||
|
theme_light_overrides?: 'json' | null;
|
||||||
|
theme_dark_overrides?: 'json' | null;
|
||||||
|
text_direction?: 'auto' | 'ltr' | 'rtl';
|
||||||
|
policies?: DirectusAccess[] | string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusWebhook {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
name?: string;
|
||||||
|
method?: null;
|
||||||
|
url?: string;
|
||||||
|
status?: 'active' | 'inactive';
|
||||||
|
data?: boolean;
|
||||||
|
actions?: 'create' | 'update' | 'delete';
|
||||||
|
collections?: string[];
|
||||||
|
headers?: Array<{ header: string; value: string }> | null;
|
||||||
|
was_active_before_deprecation?: boolean;
|
||||||
|
migrated_flow?: DirectusFlow | string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusDashboard {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
name?: string;
|
||||||
|
icon?: string;
|
||||||
|
note?: string | null;
|
||||||
|
date_created?: string | null;
|
||||||
|
user_created?: DirectusUser | string | null;
|
||||||
|
color?: string | null;
|
||||||
|
panels?: DirectusPanel[] | string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusPanel {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
dashboard?: DirectusDashboard | string;
|
||||||
|
name?: string | null;
|
||||||
|
icon?: string | null;
|
||||||
|
color?: string | null;
|
||||||
|
show_header?: boolean;
|
||||||
|
note?: string | null;
|
||||||
|
type?: string;
|
||||||
|
position_x?: number;
|
||||||
|
position_y?: number;
|
||||||
|
width?: number;
|
||||||
|
height?: number;
|
||||||
|
options?: 'json' | null;
|
||||||
|
date_created?: string | null;
|
||||||
|
user_created?: DirectusUser | string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusNotification {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: number;
|
||||||
|
timestamp?: string | null;
|
||||||
|
status?: string | null;
|
||||||
|
recipient?: DirectusUser | string;
|
||||||
|
sender?: DirectusUser | string | null;
|
||||||
|
subject?: string;
|
||||||
|
message?: string | null;
|
||||||
|
collection?: string | null;
|
||||||
|
item?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusShare {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
name?: string | null;
|
||||||
|
collection?: DirectusCollection | string;
|
||||||
|
item?: string;
|
||||||
|
role?: DirectusRole | string | null;
|
||||||
|
password?: string | null;
|
||||||
|
user_created?: DirectusUser | string | null;
|
||||||
|
date_created?: string | null;
|
||||||
|
date_start?: string | null;
|
||||||
|
date_end?: string | null;
|
||||||
|
times_used?: number | null;
|
||||||
|
max_uses?: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusFlow {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
name?: string;
|
||||||
|
icon?: string | null;
|
||||||
|
color?: string | null;
|
||||||
|
description?: string | null;
|
||||||
|
status?: string;
|
||||||
|
trigger?: string | null;
|
||||||
|
accountability?: string | null;
|
||||||
|
options?: 'json' | null;
|
||||||
|
operation?: DirectusOperation | string | null;
|
||||||
|
date_created?: string | null;
|
||||||
|
user_created?: DirectusUser | string | null;
|
||||||
|
operations?: DirectusOperation[] | string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusOperation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
name?: string | null;
|
||||||
|
key?: string;
|
||||||
|
type?: string;
|
||||||
|
position_x?: number;
|
||||||
|
position_y?: number;
|
||||||
|
options?: 'json' | null;
|
||||||
|
resolve?: DirectusOperation | string | null;
|
||||||
|
reject?: DirectusOperation | string | null;
|
||||||
|
flow?: DirectusFlow | string;
|
||||||
|
date_created?: string | null;
|
||||||
|
user_created?: DirectusUser | string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusTranslation {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
/** @required */
|
||||||
|
language: string;
|
||||||
|
/** @required */
|
||||||
|
key: string;
|
||||||
|
/** @required */
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusVersion {
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
key?: string;
|
||||||
|
name?: string | null;
|
||||||
|
collection?: DirectusCollection | string;
|
||||||
|
item?: string;
|
||||||
|
hash?: string | null;
|
||||||
|
date_created?: string | null;
|
||||||
|
date_updated?: string | null;
|
||||||
|
user_created?: DirectusUser | string | null;
|
||||||
|
user_updated?: DirectusUser | string | null;
|
||||||
|
delta?: 'json' | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DirectusExtension {
|
||||||
|
enabled?: boolean;
|
||||||
|
/** @primaryKey */
|
||||||
|
id: string;
|
||||||
|
folder?: string;
|
||||||
|
source?: string;
|
||||||
|
bundle?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Schema {
|
||||||
|
company_profile: CompanyProfile;
|
||||||
|
company_profile_translations: CompanyProfileTranslation[];
|
||||||
|
contact_info: ContactInfo;
|
||||||
|
contact_info_translations: ContactInfoTranslation[];
|
||||||
|
documents_translations: DocumentsTranslation[];
|
||||||
|
homepage: Homepage;
|
||||||
|
homepage_files: HomepageFile[];
|
||||||
|
languages: Language[];
|
||||||
|
product_documents: ProductDocument[];
|
||||||
|
product_documents_translations: ProductDocumentsTranslation[];
|
||||||
|
product_images: ProductImage[];
|
||||||
|
product_images_translations: ProductImagesTranslation[];
|
||||||
|
product_spec_groups: ProductSpecGroup[];
|
||||||
|
product_spec_groups_translations: ProductSpecGroupsTranslation[];
|
||||||
|
product_specs: ProductSpec[];
|
||||||
|
product_specs_translations: ProductSpecsTranslation[];
|
||||||
|
product_types: ProductType[];
|
||||||
|
product_types_translations: ProductTypesTranslation[];
|
||||||
|
products: Product[];
|
||||||
|
products_product_documents: ProductsProductDocument[];
|
||||||
|
products_product_images: ProductsProductImage[];
|
||||||
|
products_questions: ProductsQuestion[];
|
||||||
|
products_translations: ProductsTranslation[];
|
||||||
|
questions: Question[];
|
||||||
|
questions_translations: QuestionsTranslation[];
|
||||||
|
solution_types: SolutionType[];
|
||||||
|
solution_types_translations: SolutionTypesTranslation[];
|
||||||
|
solutions: Solution[];
|
||||||
|
solutions_translations: SolutionsTranslation[];
|
||||||
|
directus_access: DirectusAccess[];
|
||||||
|
directus_activity: DirectusActivity[];
|
||||||
|
directus_collections: DirectusCollection[];
|
||||||
|
directus_comments: DirectusComment[];
|
||||||
|
directus_fields: DirectusField[];
|
||||||
|
directus_files: DirectusFile[];
|
||||||
|
directus_folders: DirectusFolder[];
|
||||||
|
directus_migrations: DirectusMigration[];
|
||||||
|
directus_permissions: DirectusPermission[];
|
||||||
|
directus_policies: DirectusPolicy[];
|
||||||
|
directus_presets: DirectusPreset[];
|
||||||
|
directus_relations: DirectusRelation[];
|
||||||
|
directus_revisions: DirectusRevision[];
|
||||||
|
directus_roles: DirectusRole[];
|
||||||
|
directus_sessions: DirectusSession[];
|
||||||
|
directus_settings: DirectusSettings;
|
||||||
|
directus_users: DirectusUser[];
|
||||||
|
directus_webhooks: DirectusWebhook[];
|
||||||
|
directus_dashboards: DirectusDashboard[];
|
||||||
|
directus_panels: DirectusPanel[];
|
||||||
|
directus_notifications: DirectusNotification[];
|
||||||
|
directus_shares: DirectusShare[];
|
||||||
|
directus_flows: DirectusFlow[];
|
||||||
|
directus_operations: DirectusOperation[];
|
||||||
|
directus_translations: DirectusTranslation[];
|
||||||
|
directus_versions: DirectusVersion[];
|
||||||
|
directus_extensions: DirectusExtension[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum CollectionNames {
|
||||||
|
company_profile = 'company_profile',
|
||||||
|
company_profile_translations = 'company_profile_translations',
|
||||||
|
contact_info = 'contact_info',
|
||||||
|
contact_info_translations = 'contact_info_translations',
|
||||||
|
documents_translations = 'documents_translations',
|
||||||
|
homepage = 'homepage',
|
||||||
|
homepage_files = 'homepage_files',
|
||||||
|
languages = 'languages',
|
||||||
|
product_documents = 'product_documents',
|
||||||
|
product_documents_translations = 'product_documents_translations',
|
||||||
|
product_images = 'product_images',
|
||||||
|
product_images_translations = 'product_images_translations',
|
||||||
|
product_spec_groups = 'product_spec_groups',
|
||||||
|
product_spec_groups_translations = 'product_spec_groups_translations',
|
||||||
|
product_specs = 'product_specs',
|
||||||
|
product_specs_translations = 'product_specs_translations',
|
||||||
|
product_types = 'product_types',
|
||||||
|
product_types_translations = 'product_types_translations',
|
||||||
|
products = 'products',
|
||||||
|
products_product_documents = 'products_product_documents',
|
||||||
|
products_product_images = 'products_product_images',
|
||||||
|
products_questions = 'products_questions',
|
||||||
|
products_translations = 'products_translations',
|
||||||
|
questions = 'questions',
|
||||||
|
questions_translations = 'questions_translations',
|
||||||
|
solution_types = 'solution_types',
|
||||||
|
solution_types_translations = 'solution_types_translations',
|
||||||
|
solutions = 'solutions',
|
||||||
|
solutions_translations = 'solutions_translations',
|
||||||
|
directus_access = 'directus_access',
|
||||||
|
directus_activity = 'directus_activity',
|
||||||
|
directus_collections = 'directus_collections',
|
||||||
|
directus_comments = 'directus_comments',
|
||||||
|
directus_fields = 'directus_fields',
|
||||||
|
directus_files = 'directus_files',
|
||||||
|
directus_folders = 'directus_folders',
|
||||||
|
directus_migrations = 'directus_migrations',
|
||||||
|
directus_permissions = 'directus_permissions',
|
||||||
|
directus_policies = 'directus_policies',
|
||||||
|
directus_presets = 'directus_presets',
|
||||||
|
directus_relations = 'directus_relations',
|
||||||
|
directus_revisions = 'directus_revisions',
|
||||||
|
directus_roles = 'directus_roles',
|
||||||
|
directus_sessions = 'directus_sessions',
|
||||||
|
directus_settings = 'directus_settings',
|
||||||
|
directus_users = 'directus_users',
|
||||||
|
directus_webhooks = 'directus_webhooks',
|
||||||
|
directus_dashboards = 'directus_dashboards',
|
||||||
|
directus_panels = 'directus_panels',
|
||||||
|
directus_notifications = 'directus_notifications',
|
||||||
|
directus_shares = 'directus_shares',
|
||||||
|
directus_flows = 'directus_flows',
|
||||||
|
directus_operations = 'directus_operations',
|
||||||
|
directus_translations = 'directus_translations',
|
||||||
|
directus_versions = 'directus_versions',
|
||||||
|
directus_extensions = 'directus_extensions',
|
||||||
|
}
|
||||||
2
app/types/meilisearch/index.ts
Normal file
2
app/types/meilisearch/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './meili-index';
|
||||||
|
export * from './search-result';
|
||||||
88
app/types/meilisearch/meili-index.ts
Normal file
88
app/types/meilisearch/meili-index.ts
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
/**
|
||||||
|
* 产品索引文档结构
|
||||||
|
*/
|
||||||
|
export interface MeiliProductIndex {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 产品名称 **/
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
/** 产品简介 **/
|
||||||
|
summary: string;
|
||||||
|
|
||||||
|
/** 产品详情 **/
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
/** 产品类型 **/
|
||||||
|
type: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解决方案索引文档结构
|
||||||
|
*/
|
||||||
|
export interface MeiliSolutionIndex {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 解决方案标题 **/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/** 解决方案摘要 **/
|
||||||
|
summary: string;
|
||||||
|
|
||||||
|
/** 解决方案内容 **/
|
||||||
|
content: string;
|
||||||
|
|
||||||
|
/** 解决方案类型 **/
|
||||||
|
type: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相关问题索引文档结构
|
||||||
|
*/
|
||||||
|
export interface MeiliQuestionIndex {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 问题标题 **/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/** 问题内容 **/
|
||||||
|
content: string;
|
||||||
|
|
||||||
|
/** 相关产品 **/
|
||||||
|
products: string[];
|
||||||
|
|
||||||
|
/** 相关产品类型 **/
|
||||||
|
product_types: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相关文档索引文档结构
|
||||||
|
*/
|
||||||
|
export interface MeiliProductDocumentIndex {
|
||||||
|
/** 唯一标识符 **/
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/** 文档标题 **/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/** 相关产品 **/
|
||||||
|
products: string[];
|
||||||
|
|
||||||
|
/** 相关产品类型 **/
|
||||||
|
product_types: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 索引名与类型映射
|
||||||
|
*/
|
||||||
|
export interface MeiliIndexMap {
|
||||||
|
products: MeiliProductIndex;
|
||||||
|
solutions: MeiliSolutionIndex;
|
||||||
|
questions: MeiliQuestionIndex;
|
||||||
|
product_documents: MeiliProductDocumentIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type MeiliSearchItemType = keyof MeiliIndexMap;
|
||||||
42
app/types/meilisearch/search-result.ts
Normal file
42
app/types/meilisearch/search-result.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import type { SearchResponse } from 'meilisearch';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原始搜索分段结果
|
||||||
|
* @template T 索引类型
|
||||||
|
*/
|
||||||
|
export interface RawSearchSection<T> {
|
||||||
|
/** 索引名 **/
|
||||||
|
indexUid: string;
|
||||||
|
|
||||||
|
/** 响应数据 **/
|
||||||
|
response: SearchResponse<T>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索结果
|
||||||
|
*/
|
||||||
|
export interface SearchHit extends Record<string, unknown> {
|
||||||
|
objectID?: string | number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索分段结果
|
||||||
|
* @template T 索引类型
|
||||||
|
*/
|
||||||
|
export interface SearchSection<T> {
|
||||||
|
/** 索引名 **/
|
||||||
|
indexUid: string;
|
||||||
|
|
||||||
|
/** 原始索引名 **/
|
||||||
|
rawIndex: MeiliSearchItemType;
|
||||||
|
|
||||||
|
/** 命中条目 **/
|
||||||
|
hits: T[];
|
||||||
|
// hits: SearchHit[];
|
||||||
|
|
||||||
|
/** 条目总数 **/
|
||||||
|
estimatedTotalHits: number;
|
||||||
|
|
||||||
|
/** 处理时间 **/
|
||||||
|
processingTimeMs: number;
|
||||||
|
}
|
||||||
@ -1,53 +0,0 @@
|
|||||||
export interface StrapiEntity {
|
|
||||||
id: number;
|
|
||||||
documentId: string;
|
|
||||||
createdAt: string;
|
|
||||||
updatedAt: string;
|
|
||||||
publishedAt: string;
|
|
||||||
locale: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface StrapiMedia {
|
|
||||||
id: number;
|
|
||||||
url: string;
|
|
||||||
ext: string;
|
|
||||||
name: string;
|
|
||||||
size: number;
|
|
||||||
alternativeText: string;
|
|
||||||
caption: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface StrapiImageFormat {
|
|
||||||
url: string;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
size: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface StrapiImage extends StrapiMedia {
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
formats: {
|
|
||||||
small: StrapiImageFormat;
|
|
||||||
medium: StrapiImageFormat;
|
|
||||||
thumbnail: StrapiImageFormat;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface StrapiResponse<T> {
|
|
||||||
data: T;
|
|
||||||
meta: {
|
|
||||||
pagination: {
|
|
||||||
page: number;
|
|
||||||
pageSize: number;
|
|
||||||
pageCount: number;
|
|
||||||
total: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export type StrapiRelation<T, K extends keyof T = never> = Omit<
|
|
||||||
T,
|
|
||||||
K | keyof StrapiEntity
|
|
||||||
> &
|
|
||||||
StrapiEntity;
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
export * from './common';
|
|
||||||
export * from './production';
|
|
||||||
export * from './singleTypes';
|
|
||||||
export * from './solution';
|
|
||||||
export * from './question';
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
import type {
|
|
||||||
StrapiEntity,
|
|
||||||
StrapiImage,
|
|
||||||
StrapiMedia,
|
|
||||||
StrapiRelation,
|
|
||||||
} from './common';
|
|
||||||
|
|
||||||
export interface ProductionType extends StrapiEntity {
|
|
||||||
type: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProductionSpecItem {
|
|
||||||
label: string;
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProductionSpecGroup {
|
|
||||||
title: string;
|
|
||||||
items: ProductionSpecItem[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Production extends StrapiEntity {
|
|
||||||
title: string;
|
|
||||||
summary: string;
|
|
||||||
production_type: ProductionType;
|
|
||||||
cover: StrapiImage;
|
|
||||||
production_images: StrapiImage[];
|
|
||||||
production_details: string;
|
|
||||||
production_specs: ProductionSpecGroup[];
|
|
||||||
production_documents: StrapiRelation<
|
|
||||||
ProductionDocument,
|
|
||||||
'related_productions'
|
|
||||||
>[];
|
|
||||||
questions: StrapiRelation<Question, 'related_productions'>[];
|
|
||||||
show_in_production_list: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProductionDocument extends StrapiEntity {
|
|
||||||
document: StrapiMedia;
|
|
||||||
related_productions: StrapiRelation<Production, 'production_documents'>[];
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
export interface Question extends StrapiEntity {
|
|
||||||
title: string;
|
|
||||||
content: string;
|
|
||||||
related_productions: StrapiRelation<Production, 'questions'>[];
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
export interface StrapiCompanyProfile extends StrapiEntity {
|
|
||||||
content: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface StrapiContactInfo extends StrapiEntity {
|
|
||||||
content: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface StrapiHomepage extends StrapiEntity {
|
|
||||||
carousel: StrapiImage[];
|
|
||||||
recommend_productions: StrapiRelation<Production>[];
|
|
||||||
recommend_solutions: StrapiRelation<Solution>[];
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
import type { StrapiEntity, StrapiImage } from './common';
|
|
||||||
|
|
||||||
export interface SolutionType extends StrapiEntity {
|
|
||||||
type: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Solution extends StrapiEntity {
|
|
||||||
title: string;
|
|
||||||
summary: string;
|
|
||||||
cover: StrapiImage;
|
|
||||||
solution_type: SolutionType;
|
|
||||||
content: string;
|
|
||||||
}
|
|
||||||
@ -1,12 +1,19 @@
|
|||||||
export function formatFileSize(sizeInKB: number): string {
|
export function formatFileSize(sizeInBytes: number): string {
|
||||||
if (sizeInKB < 1024) {
|
if (sizeInBytes < 1024) {
|
||||||
|
return `${sizeInBytes.toFixed(2)} B`;
|
||||||
|
} else if (sizeInBytes < 1024 * 1024) {
|
||||||
|
const sizeInKB = sizeInBytes / 1024;
|
||||||
return `${sizeInKB.toFixed(2)} KB`;
|
return `${sizeInKB.toFixed(2)} KB`;
|
||||||
} else {
|
} else {
|
||||||
const sizeInMB = sizeInKB / 1024;
|
const sizeInMB = sizeInBytes / 1024 / 1024;
|
||||||
return `${sizeInMB.toFixed(2)} MB`;
|
return `${sizeInMB.toFixed(2)} MB`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getFileExtension(filename: string): string {
|
||||||
|
return filename.split('.').pop() || '';
|
||||||
|
}
|
||||||
|
|
||||||
export function formatFileExtension(ext: string): string {
|
export function formatFileExtension(ext: string): string {
|
||||||
return ext.startsWith('.') ? ext.slice(1).toUpperCase() : ext.toUpperCase();
|
return ext.startsWith('.') ? ext.slice(1).toUpperCase() : ext.toUpperCase();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
"no-query": "Enter a keyword to start searching.",
|
"no-query": "Enter a keyword to start searching.",
|
||||||
"untitled": "Untitled",
|
"untitled": "Untitled",
|
||||||
"sections": {
|
"sections": {
|
||||||
"production": "Products",
|
"product": "Products",
|
||||||
"solution": "Solutions",
|
"solution": "Solutions",
|
||||||
"support": "Support",
|
"support": "Support",
|
||||||
"default": "Other"
|
"default": "Other"
|
||||||
@ -21,14 +21,14 @@
|
|||||||
"company-name": "Jinshen Machinary Manufacturing Co., Ltd.",
|
"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.",
|
"company-description": "We specialize in manufacturing a range of paper tube and can equipment, integrating design, manufacturing, sales, and service.",
|
||||||
"learn-more": "Learn More",
|
"learn-more": "Learn More",
|
||||||
"productions-desc": "We provide high-quality product solutions to meet various business needs.",
|
"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.",
|
"solutions-desc": "Providing customized technology solutions for enterprises to accelerate digital transformation.",
|
||||||
"support-desc": "24/7 professional technical support to ensure stable operation of your business.",
|
"support-desc": "24/7 professional technical support to ensure stable operation of your business.",
|
||||||
"quick-links": "Quick Links",
|
"quick-links": "Quick Links",
|
||||||
"utilities": "Utilities",
|
"utilities": "Utilities",
|
||||||
"navigation": {
|
"navigation": {
|
||||||
"home": "Home",
|
"home": "Home",
|
||||||
"productions": "Productions",
|
"products": "Products",
|
||||||
"solutions": "Solutions",
|
"solutions": "Solutions",
|
||||||
"support": "Support",
|
"support": "Support",
|
||||||
"about-us": "About Us",
|
"about-us": "About Us",
|
||||||
@ -50,13 +50,13 @@
|
|||||||
"product-details": "Product Details",
|
"product-details": "Product Details",
|
||||||
"product-not-found": "Product Not Found",
|
"product-not-found": "Product Not Found",
|
||||||
"product-not-found-desc": "Sorry, the product you are looking for does not exist or has been removed.",
|
"product-not-found-desc": "Sorry, the product you are looking for does not exist or has been removed.",
|
||||||
"back-to-productions": "Back to Products",
|
"back-to-products": "Back to Products",
|
||||||
"solution-not-found": "Solution Not Found",
|
"solution-not-found": "Solution Not Found",
|
||||||
"solution-not-found-desc": "Sorry, the solution you are lokking for does not exist or has been removed.",
|
"solution-not-found-desc": "Sorry, the solution you are lokking for does not exist or has been removed.",
|
||||||
"back-to-solutions": "Back to Solutions",
|
"back-to-solutions": "Back to Solutions",
|
||||||
"no-content-available": "No detailed information available",
|
"no-content-available": "No detailed information available",
|
||||||
"loading": "Loading...",
|
"loading": "Loading...",
|
||||||
"our-productions": "Our Productions",
|
"our-products": "Our Products",
|
||||||
"learn-our-solutions": "Learn Our Solutions",
|
"learn-our-solutions": "Learn Our Solutions",
|
||||||
"all": "All"
|
"all": "All"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
"no-query": "请输入关键字开始搜索。",
|
"no-query": "请输入关键字开始搜索。",
|
||||||
"untitled": "未命名条目",
|
"untitled": "未命名条目",
|
||||||
"sections": {
|
"sections": {
|
||||||
"production": "产品",
|
"product": "产品",
|
||||||
"solution": "解决方案",
|
"solution": "解决方案",
|
||||||
"support": "服务支持",
|
"support": "服务支持",
|
||||||
"default": "其他内容"
|
"default": "其他内容"
|
||||||
@ -21,14 +21,14 @@
|
|||||||
"company-name": "金申机械制造有限公司",
|
"company-name": "金申机械制造有限公司",
|
||||||
"company-description": "专业生产一系列纸管、纸罐设备,集设计、制造、销售、服务于一体。",
|
"company-description": "专业生产一系列纸管、纸罐设备,集设计、制造、销售、服务于一体。",
|
||||||
"learn-more": "了解更多",
|
"learn-more": "了解更多",
|
||||||
"productions-desc": "我们提供高质量的产品解决方案,满足各种业务需求。",
|
"products-desc": "我们提供高质量的产品解决方案,满足各种业务需求。",
|
||||||
"solutions-desc": "为企业提供定制化的技术解决方案,助力数字化转型。",
|
"solutions-desc": "为企业提供定制化的技术解决方案,助力数字化转型。",
|
||||||
"support-desc": "7x24小时专业技术支持,确保您的业务稳定运行。",
|
"support-desc": "7x24小时专业技术支持,确保您的业务稳定运行。",
|
||||||
"quick-links": "快速链接",
|
"quick-links": "快速链接",
|
||||||
"utilities": "实用工具",
|
"utilities": "实用工具",
|
||||||
"navigation": {
|
"navigation": {
|
||||||
"home": "主页",
|
"home": "主页",
|
||||||
"productions": "产品中心",
|
"products": "产品中心",
|
||||||
"solutions": "解决方案",
|
"solutions": "解决方案",
|
||||||
"support": "服务支持",
|
"support": "服务支持",
|
||||||
"about-us": "关于我们",
|
"about-us": "关于我们",
|
||||||
@ -50,13 +50,13 @@
|
|||||||
"product-details": "产品详情",
|
"product-details": "产品详情",
|
||||||
"product-not-found": "产品未找到",
|
"product-not-found": "产品未找到",
|
||||||
"product-not-found-desc": "抱歉,您访问的产品不存在或已被删除。",
|
"product-not-found-desc": "抱歉,您访问的产品不存在或已被删除。",
|
||||||
"back-to-productions": "返回产品列表",
|
"back-to-products": "返回产品列表",
|
||||||
"solution-not-found": "解决方案未找到",
|
"solution-not-found": "解决方案未找到",
|
||||||
"solution-not-found-desc": "抱歉,您访问的解决方案不存在或已被删除",
|
"solution-not-found-desc": "抱歉,您访问的解决方案不存在或已被删除",
|
||||||
"back-to-solutions": "返回解决方案列表",
|
"back-to-solutions": "返回解决方案列表",
|
||||||
"no-content-available": "暂无详细信息",
|
"no-content-available": "暂无详细信息",
|
||||||
"loading": "加载中...",
|
"loading": "加载中...",
|
||||||
"our-productions": "我们的产品",
|
"our-products": "我们的产品",
|
||||||
"learn-our-solutions": "了解我们的解决方案",
|
"learn-our-solutions": "了解我们的解决方案",
|
||||||
"all": "全部"
|
"all": "全部"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,16 +27,11 @@ export default defineNuxtConfig({
|
|||||||
? typeof process.env.MEILI_SEARCH_INDEXES === 'string'
|
? typeof process.env.MEILI_SEARCH_INDEXES === 'string'
|
||||||
? process.env.MEILI_SEARCH_INDEXES.split(',').map((i) => i.trim())
|
? process.env.MEILI_SEARCH_INDEXES.split(',').map((i) => i.trim())
|
||||||
: process.env.MEILI_SEARCH_INDEXES
|
: process.env.MEILI_SEARCH_INDEXES
|
||||||
: ['production', 'solution'],
|
: ['products', 'solutions', 'questions', 'product_documents'],
|
||||||
},
|
},
|
||||||
strapi: {
|
directus: {
|
||||||
url: process.env.STRAPI_URL || 'http://localhost:1337',
|
url: process.env.DIRECTUS_URL || 'http://localhost:8055',
|
||||||
token: process.env.STRAPI_TOKEN || undefined,
|
token: process.env.DIRECTUS_TOKEN || undefined,
|
||||||
prefix: '/api',
|
|
||||||
admin: '/admin',
|
|
||||||
version: 'v5',
|
|
||||||
cookie: {},
|
|
||||||
cookieName: 'strapi_jwt',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -48,8 +43,8 @@ export default defineNuxtConfig({
|
|||||||
typescript: {
|
typescript: {
|
||||||
tsConfig: {
|
tsConfig: {
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
noUnUsedLocals: false,
|
noUnusedLocals: false,
|
||||||
noUnUsedParameters: false,
|
noUnusedParameters: false,
|
||||||
strict: false,
|
strict: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -114,7 +109,7 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
|
|
||||||
imports: {
|
imports: {
|
||||||
dirs: ['types/**'],
|
dirs: ['types/**', 'models/**'],
|
||||||
},
|
},
|
||||||
|
|
||||||
modules: [
|
modules: [
|
||||||
@ -128,6 +123,5 @@ export default defineNuxtConfig({
|
|||||||
'@unocss/nuxt',
|
'@unocss/nuxt',
|
||||||
'@element-plus/nuxt',
|
'@element-plus/nuxt',
|
||||||
'@nuxtjs/i18n',
|
'@nuxtjs/i18n',
|
||||||
'@nuxtjs/strapi',
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
"prepare": "husky"
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@directus/sdk": "^20.1.0",
|
||||||
"@mdi/font": "^7.4.47",
|
"@mdi/font": "^7.4.47",
|
||||||
"@nuxt/eslint": "1.8.0",
|
"@nuxt/eslint": "1.8.0",
|
||||||
"@nuxt/fonts": "0.11.4",
|
"@nuxt/fonts": "0.11.4",
|
||||||
@ -18,7 +19,6 @@
|
|||||||
"@nuxt/image": "1.11.0",
|
"@nuxt/image": "1.11.0",
|
||||||
"@nuxt/test-utils": "3.19.2",
|
"@nuxt/test-utils": "3.19.2",
|
||||||
"@nuxtjs/i18n": "10.0.5",
|
"@nuxtjs/i18n": "10.0.5",
|
||||||
"@nuxtjs/strapi": "2.1.1",
|
|
||||||
"@pinia/nuxt": "^0.11.2",
|
"@pinia/nuxt": "^0.11.2",
|
||||||
"@types/markdown-it": "^14.1.2",
|
"@types/markdown-it": "^14.1.2",
|
||||||
"@unocss/nuxt": "^66.4.2",
|
"@unocss/nuxt": "^66.4.2",
|
||||||
@ -28,6 +28,7 @@
|
|||||||
"markdown-it": "^14.1.0",
|
"markdown-it": "^14.1.0",
|
||||||
"meilisearch": "^0.53.0",
|
"meilisearch": "^0.53.0",
|
||||||
"nuxt": "^4.0.3",
|
"nuxt": "^4.0.3",
|
||||||
|
"nuxt-directus": "5.7.0",
|
||||||
"sass": "^1.90.0",
|
"sass": "^1.90.0",
|
||||||
"sharp": "^0.34.3",
|
"sharp": "^0.34.3",
|
||||||
"vue": "^3.5.18",
|
"vue": "^3.5.18",
|
||||||
|
|||||||
193
pnpm-lock.yaml
generated
193
pnpm-lock.yaml
generated
@ -8,6 +8,9 @@ importers:
|
|||||||
|
|
||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@directus/sdk':
|
||||||
|
specifier: ^20.1.0
|
||||||
|
version: 20.1.0
|
||||||
'@mdi/font':
|
'@mdi/font':
|
||||||
specifier: ^7.4.47
|
specifier: ^7.4.47
|
||||||
version: 7.4.47
|
version: 7.4.47
|
||||||
@ -29,9 +32,6 @@ importers:
|
|||||||
'@nuxtjs/i18n':
|
'@nuxtjs/i18n':
|
||||||
specifier: 10.0.5
|
specifier: 10.0.5
|
||||||
version: 10.0.5(@vue/compiler-dom@3.5.21)(db0@0.3.2)(eslint@9.35.0(jiti@2.5.1))(ioredis@5.7.0)(magicast@0.3.5)(rollup@4.50.2)(vue@3.5.21(typescript@5.9.2))
|
version: 10.0.5(@vue/compiler-dom@3.5.21)(db0@0.3.2)(eslint@9.35.0(jiti@2.5.1))(ioredis@5.7.0)(magicast@0.3.5)(rollup@4.50.2)(vue@3.5.21(typescript@5.9.2))
|
||||||
'@nuxtjs/strapi':
|
|
||||||
specifier: 2.1.1
|
|
||||||
version: 2.1.1(magicast@0.3.5)
|
|
||||||
'@pinia/nuxt':
|
'@pinia/nuxt':
|
||||||
specifier: ^0.11.2
|
specifier: ^0.11.2
|
||||||
version: 0.11.2(magicast@0.3.5)(pinia@3.0.3(typescript@5.9.2)(vue@3.5.21(typescript@5.9.2)))
|
version: 0.11.2(magicast@0.3.5)(pinia@3.0.3(typescript@5.9.2)(vue@3.5.21(typescript@5.9.2)))
|
||||||
@ -59,6 +59,9 @@ importers:
|
|||||||
nuxt:
|
nuxt:
|
||||||
specifier: ^4.0.3
|
specifier: ^4.0.3
|
||||||
version: 4.1.2(@parcel/watcher@2.5.1)(@types/node@24.4.0)(@vue/compiler-sfc@3.5.21)(db0@0.3.2)(eslint@9.35.0(jiti@2.5.1))(ioredis@5.7.0)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.2)(sass@1.92.1)(terser@5.44.0)(typescript@5.9.2)(vite@7.1.5(@types/node@24.4.0)(jiti@2.5.1)(sass@1.92.1)(terser@5.44.0)(yaml@2.8.1))(yaml@2.8.1)
|
version: 4.1.2(@parcel/watcher@2.5.1)(@types/node@24.4.0)(@vue/compiler-sfc@3.5.21)(db0@0.3.2)(eslint@9.35.0(jiti@2.5.1))(ioredis@5.7.0)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.2)(sass@1.92.1)(terser@5.44.0)(typescript@5.9.2)(vite@7.1.5(@types/node@24.4.0)(jiti@2.5.1)(sass@1.92.1)(terser@5.44.0)(yaml@2.8.1))(yaml@2.8.1)
|
||||||
|
nuxt-directus:
|
||||||
|
specifier: 5.7.0
|
||||||
|
version: 5.7.0(magicast@0.3.5)
|
||||||
sass:
|
sass:
|
||||||
specifier: ^1.90.0
|
specifier: ^1.90.0
|
||||||
version: 1.92.1
|
version: 1.92.1
|
||||||
@ -323,6 +326,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA==}
|
resolution: {integrity: sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
|
'@directus/sdk@20.1.0':
|
||||||
|
resolution: {integrity: sha512-EV2bwfiOXc1QFYAIqfGgyZ7JcKgHF43UVEYivUpMjOLiihI9tpmNfcz/qmOXju7LCZrBmSwTOHMRtOXPdZWiLQ==}
|
||||||
|
engines: {node: '>=22'}
|
||||||
|
|
||||||
'@element-plus/icons-vue@2.3.2':
|
'@element-plus/icons-vue@2.3.2':
|
||||||
resolution: {integrity: sha512-OzIuTaIfC8QXEPmJvB4Y4kw34rSXdCJzxcD1kFStBvr8bK6X1zQAYDo0CNMjojnfTqRQCJ0I7prlErcoRiET2A==}
|
resolution: {integrity: sha512-OzIuTaIfC8QXEPmJvB4Y4kw34rSXdCJzxcD1kFStBvr8bK6X1zQAYDo0CNMjojnfTqRQCJ0I7prlErcoRiET2A==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@ -997,9 +1004,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-rLQc/nEVWL0xMJf1a6+ndUpdQtxPBFzm4jeqG4o7HuXtDLn4HOe1dPdu7AsaIqq7EcsEjZ5T4mX4X8XnB8cT0Q==}
|
resolution: {integrity: sha512-rLQc/nEVWL0xMJf1a6+ndUpdQtxPBFzm4jeqG4o7HuXtDLn4HOe1dPdu7AsaIqq7EcsEjZ5T4mX4X8XnB8cT0Q==}
|
||||||
engines: {node: '>=20.11.1'}
|
engines: {node: '>=20.11.1'}
|
||||||
|
|
||||||
'@nuxtjs/strapi@2.1.1':
|
|
||||||
resolution: {integrity: sha512-CNcsEqkhto4P5SEA4ZuRrGdfOT7swsZp/hvR7SNG3OW3J8eHJythE68P1LaszCq5uvYlg7j90Iue534sEdedtQ==}
|
|
||||||
|
|
||||||
'@oxc-minify/binding-android-arm64@0.87.0':
|
'@oxc-minify/binding-android-arm64@0.87.0':
|
||||||
resolution: {integrity: sha512-ZbJmAfXvNAamOSnXId3BiM3DiuzlD1isqKjtmRFb/hpvChHHA23FSPrFcO16w+ugZKg33sZ93FinFkKtlC4hww==}
|
resolution: {integrity: sha512-ZbJmAfXvNAamOSnXId3BiM3DiuzlD1isqKjtmRFb/hpvChHHA23FSPrFcO16w+ugZKg33sZ93FinFkKtlC4hww==}
|
||||||
engines: {node: '>=14.0.0'}
|
engines: {node: '>=14.0.0'}
|
||||||
@ -2538,14 +2542,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==}
|
resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
call-bind-apply-helpers@1.0.2:
|
|
||||||
resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
call-bound@1.0.4:
|
|
||||||
resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
callsites@3.1.0:
|
callsites@3.1.0:
|
||||||
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
|
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
@ -2958,10 +2954,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-Sf2LSQP+bOlhKWWyhFsn0UsfdK/kCWRv1iuA2gXAwt3dyNabr6QSj00I2V10pidqz69soatm9ZwZvpQMTIOd5Q==}
|
resolution: {integrity: sha512-Sf2LSQP+bOlhKWWyhFsn0UsfdK/kCWRv1iuA2gXAwt3dyNabr6QSj00I2V10pidqz69soatm9ZwZvpQMTIOd5Q==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
|
||||||
dunder-proto@1.0.1:
|
|
||||||
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
duplexer@0.1.2:
|
duplexer@0.1.2:
|
||||||
resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==}
|
resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==}
|
||||||
|
|
||||||
@ -3020,21 +3012,9 @@ packages:
|
|||||||
errx@0.1.0:
|
errx@0.1.0:
|
||||||
resolution: {integrity: sha512-fZmsRiDNv07K6s2KkKFTiD2aIvECa7++PKyD5NC32tpRw46qZA3sOz+aM+/V9V0GDHxVTKLziveV4JhzBHDp9Q==}
|
resolution: {integrity: sha512-fZmsRiDNv07K6s2KkKFTiD2aIvECa7++PKyD5NC32tpRw46qZA3sOz+aM+/V9V0GDHxVTKLziveV4JhzBHDp9Q==}
|
||||||
|
|
||||||
es-define-property@1.0.1:
|
|
||||||
resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
es-errors@1.3.0:
|
|
||||||
resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
es-module-lexer@1.7.0:
|
es-module-lexer@1.7.0:
|
||||||
resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==}
|
resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==}
|
||||||
|
|
||||||
es-object-atoms@1.1.1:
|
|
||||||
resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
esbuild@0.25.9:
|
esbuild@0.25.9:
|
||||||
resolution: {integrity: sha512-CRbODhYyQx3qp7ZEwzxOk4JBqmD/seJrzPa/cGjY1VtIn5E09Oi9/dB4JwctnfZ8Q8iT7rioVv5k/FNT/uf54g==}
|
resolution: {integrity: sha512-CRbODhYyQx3qp7ZEwzxOk4JBqmD/seJrzPa/cGjY1VtIn5E09Oi9/dB4JwctnfZ8Q8iT7rioVv5k/FNT/uf54g==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
@ -3352,17 +3332,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==}
|
resolution: {integrity: sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
get-intrinsic@1.3.0:
|
|
||||||
resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
get-port-please@3.2.0:
|
get-port-please@3.2.0:
|
||||||
resolution: {integrity: sha512-I9QVvBw5U/hw3RmWpYKRumUeaDgxTPd401x364rLmWBJcOQ753eov1eTgzDqRG9bqFIfDc7gfzcQEWrUri3o1A==}
|
resolution: {integrity: sha512-I9QVvBw5U/hw3RmWpYKRumUeaDgxTPd401x364rLmWBJcOQ753eov1eTgzDqRG9bqFIfDc7gfzcQEWrUri3o1A==}
|
||||||
|
|
||||||
get-proto@1.0.1:
|
|
||||||
resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
get-stream@8.0.1:
|
get-stream@8.0.1:
|
||||||
resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==}
|
resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==}
|
||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
@ -3427,20 +3399,12 @@ packages:
|
|||||||
resolution: {integrity: sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==}
|
resolution: {integrity: sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
gopd@1.2.0:
|
|
||||||
resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
graceful-fs@4.2.11:
|
graceful-fs@4.2.11:
|
||||||
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
|
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
|
||||||
|
|
||||||
graphemer@1.4.0:
|
graphemer@1.4.0:
|
||||||
resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==}
|
resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==}
|
||||||
|
|
||||||
graphql@16.11.0:
|
|
||||||
resolution: {integrity: sha512-mS1lbMsxgQj6hge1XZ6p7GPhbrtFwUFYi3wRzXAC/FmYnyXMTvvI3td3rjmQ2u8ewXueaSvRPWaEcgVVOT9Jnw==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0}
|
|
||||||
|
|
||||||
gzip-size@6.0.0:
|
gzip-size@6.0.0:
|
||||||
resolution: {integrity: sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==}
|
resolution: {integrity: sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
@ -3456,10 +3420,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
has-symbols@1.1.0:
|
|
||||||
resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
hasown@2.0.2:
|
hasown@2.0.2:
|
||||||
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
|
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
@ -3888,10 +3848,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==}
|
resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
math-intrinsics@1.1.0:
|
|
||||||
resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
mdn-data@2.0.28:
|
mdn-data@2.0.28:
|
||||||
resolution: {integrity: sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==}
|
resolution: {integrity: sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==}
|
||||||
|
|
||||||
@ -4123,6 +4079,9 @@ packages:
|
|||||||
nuxt-define@1.0.0:
|
nuxt-define@1.0.0:
|
||||||
resolution: {integrity: sha512-CYZ2WjU+KCyCDVzjYUM4eEpMF0rkPmkpiFrybTqqQCRpUbPt2h3snswWIpFPXTi+osRCY6Og0W/XLAQgDL4FfQ==}
|
resolution: {integrity: sha512-CYZ2WjU+KCyCDVzjYUM4eEpMF0rkPmkpiFrybTqqQCRpUbPt2h3snswWIpFPXTi+osRCY6Og0W/XLAQgDL4FfQ==}
|
||||||
|
|
||||||
|
nuxt-directus@5.7.0:
|
||||||
|
resolution: {integrity: sha512-hoNXbhQ8UgDrCXqzqxC0wngi64AVqYYGGU/bwylgZWbKyU0m6kyNQVLGuQuXmFbogr2WMaw+FtXSgLz+DS32hA==}
|
||||||
|
|
||||||
nuxt@4.1.2:
|
nuxt@4.1.2:
|
||||||
resolution: {integrity: sha512-g5mwszCZT4ZeGJm83nxoZvtvZoAEaY65VDdn7p7UgznePbRaEJJ1KS1OIld4FPVkoDZ8TEVuDNqI9gUn12Exvg==}
|
resolution: {integrity: sha512-g5mwszCZT4ZeGJm83nxoZvtvZoAEaY65VDdn7p7UgznePbRaEJJ1KS1OIld4FPVkoDZ8TEVuDNqI9gUn12Exvg==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
@ -4141,10 +4100,6 @@ packages:
|
|||||||
engines: {node: ^14.16.0 || >=16.10.0}
|
engines: {node: ^14.16.0 || >=16.10.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
object-inspect@1.13.4:
|
|
||||||
resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
ofetch@1.4.1:
|
ofetch@1.4.1:
|
||||||
resolution: {integrity: sha512-QZj2DfGplQAr2oj9KzceK9Hwz6Whxazmn85yYeVuS3u9XTMOGMRx0kO95MQ+vLsj/S/NwBDMMLU5hpxvI6Tklw==}
|
resolution: {integrity: sha512-QZj2DfGplQAr2oj9KzceK9Hwz6Whxazmn85yYeVuS3u9XTMOGMRx0kO95MQ+vLsj/S/NwBDMMLU5hpxvI6Tklw==}
|
||||||
|
|
||||||
@ -4559,10 +4514,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
|
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
|
|
||||||
qs@6.14.0:
|
|
||||||
resolution: {integrity: sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==}
|
|
||||||
engines: {node: '>=0.6'}
|
|
||||||
|
|
||||||
quansync@0.2.11:
|
quansync@0.2.11:
|
||||||
resolution: {integrity: sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA==}
|
resolution: {integrity: sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA==}
|
||||||
|
|
||||||
@ -4766,22 +4717,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==}
|
resolution: {integrity: sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
|
|
||||||
side-channel-list@1.0.0:
|
|
||||||
resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
side-channel-map@1.0.1:
|
|
||||||
resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
side-channel-weakmap@1.0.2:
|
|
||||||
resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
side-channel@1.1.0:
|
|
||||||
resolution: {integrity: sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
signal-exit@4.1.0:
|
signal-exit@4.1.0:
|
||||||
resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
|
resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
|
||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
@ -5879,6 +5814,8 @@ snapshots:
|
|||||||
|
|
||||||
'@ctrl/tinycolor@3.6.1': {}
|
'@ctrl/tinycolor@3.6.1': {}
|
||||||
|
|
||||||
|
'@directus/sdk@20.1.0': {}
|
||||||
|
|
||||||
'@element-plus/icons-vue@2.3.2(vue@3.5.21(typescript@5.9.2))':
|
'@element-plus/icons-vue@2.3.2(vue@3.5.21(typescript@5.9.2))':
|
||||||
dependencies:
|
dependencies:
|
||||||
vue: 3.5.21(typescript@5.9.2)
|
vue: 3.5.21(typescript@5.9.2)
|
||||||
@ -6881,16 +6818,6 @@ snapshots:
|
|||||||
- uploadthing
|
- uploadthing
|
||||||
- vue
|
- vue
|
||||||
|
|
||||||
'@nuxtjs/strapi@2.1.1(magicast@0.3.5)':
|
|
||||||
dependencies:
|
|
||||||
'@nuxt/kit': 3.19.2(magicast@0.3.5)
|
|
||||||
defu: 6.1.4
|
|
||||||
graphql: 16.11.0
|
|
||||||
qs: 6.14.0
|
|
||||||
ufo: 1.6.1
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- magicast
|
|
||||||
|
|
||||||
'@oxc-minify/binding-android-arm64@0.87.0':
|
'@oxc-minify/binding-android-arm64@0.87.0':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
@ -8364,16 +8291,6 @@ snapshots:
|
|||||||
|
|
||||||
cac@6.7.14: {}
|
cac@6.7.14: {}
|
||||||
|
|
||||||
call-bind-apply-helpers@1.0.2:
|
|
||||||
dependencies:
|
|
||||||
es-errors: 1.3.0
|
|
||||||
function-bind: 1.1.2
|
|
||||||
|
|
||||||
call-bound@1.0.4:
|
|
||||||
dependencies:
|
|
||||||
call-bind-apply-helpers: 1.0.2
|
|
||||||
get-intrinsic: 1.3.0
|
|
||||||
|
|
||||||
callsites@3.1.0: {}
|
callsites@3.1.0: {}
|
||||||
|
|
||||||
caniuse-api@3.0.0:
|
caniuse-api@3.0.0:
|
||||||
@ -8754,12 +8671,6 @@ snapshots:
|
|||||||
|
|
||||||
dotenv@17.2.2: {}
|
dotenv@17.2.2: {}
|
||||||
|
|
||||||
dunder-proto@1.0.1:
|
|
||||||
dependencies:
|
|
||||||
call-bind-apply-helpers: 1.0.2
|
|
||||||
es-errors: 1.3.0
|
|
||||||
gopd: 1.2.0
|
|
||||||
|
|
||||||
duplexer@0.1.2: {}
|
duplexer@0.1.2: {}
|
||||||
|
|
||||||
eastasianwidth@0.2.0: {}
|
eastasianwidth@0.2.0: {}
|
||||||
@ -8821,16 +8732,8 @@ snapshots:
|
|||||||
|
|
||||||
errx@0.1.0: {}
|
errx@0.1.0: {}
|
||||||
|
|
||||||
es-define-property@1.0.1: {}
|
|
||||||
|
|
||||||
es-errors@1.3.0: {}
|
|
||||||
|
|
||||||
es-module-lexer@1.7.0: {}
|
es-module-lexer@1.7.0: {}
|
||||||
|
|
||||||
es-object-atoms@1.1.1:
|
|
||||||
dependencies:
|
|
||||||
es-errors: 1.3.0
|
|
||||||
|
|
||||||
esbuild@0.25.9:
|
esbuild@0.25.9:
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@esbuild/aix-ppc64': 0.25.9
|
'@esbuild/aix-ppc64': 0.25.9
|
||||||
@ -9221,26 +9124,8 @@ snapshots:
|
|||||||
|
|
||||||
get-east-asian-width@1.4.0: {}
|
get-east-asian-width@1.4.0: {}
|
||||||
|
|
||||||
get-intrinsic@1.3.0:
|
|
||||||
dependencies:
|
|
||||||
call-bind-apply-helpers: 1.0.2
|
|
||||||
es-define-property: 1.0.1
|
|
||||||
es-errors: 1.3.0
|
|
||||||
es-object-atoms: 1.1.1
|
|
||||||
function-bind: 1.1.2
|
|
||||||
get-proto: 1.0.1
|
|
||||||
gopd: 1.2.0
|
|
||||||
has-symbols: 1.1.0
|
|
||||||
hasown: 2.0.2
|
|
||||||
math-intrinsics: 1.1.0
|
|
||||||
|
|
||||||
get-port-please@3.2.0: {}
|
get-port-please@3.2.0: {}
|
||||||
|
|
||||||
get-proto@1.0.1:
|
|
||||||
dependencies:
|
|
||||||
dunder-proto: 1.0.1
|
|
||||||
es-object-atoms: 1.1.1
|
|
||||||
|
|
||||||
get-stream@8.0.1: {}
|
get-stream@8.0.1: {}
|
||||||
|
|
||||||
get-tsconfig@4.10.1:
|
get-tsconfig@4.10.1:
|
||||||
@ -9314,14 +9199,10 @@ snapshots:
|
|||||||
slash: 5.1.0
|
slash: 5.1.0
|
||||||
unicorn-magic: 0.3.0
|
unicorn-magic: 0.3.0
|
||||||
|
|
||||||
gopd@1.2.0: {}
|
|
||||||
|
|
||||||
graceful-fs@4.2.11: {}
|
graceful-fs@4.2.11: {}
|
||||||
|
|
||||||
graphemer@1.4.0: {}
|
graphemer@1.4.0: {}
|
||||||
|
|
||||||
graphql@16.11.0: {}
|
|
||||||
|
|
||||||
gzip-size@6.0.0:
|
gzip-size@6.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
duplexer: 0.1.2
|
duplexer: 0.1.2
|
||||||
@ -9344,8 +9225,6 @@ snapshots:
|
|||||||
|
|
||||||
has-flag@4.0.0: {}
|
has-flag@4.0.0: {}
|
||||||
|
|
||||||
has-symbols@1.1.0: {}
|
|
||||||
|
|
||||||
hasown@2.0.2:
|
hasown@2.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
function-bind: 1.1.2
|
function-bind: 1.1.2
|
||||||
@ -9796,8 +9675,6 @@ snapshots:
|
|||||||
punycode.js: 2.3.1
|
punycode.js: 2.3.1
|
||||||
uc.micro: 2.1.0
|
uc.micro: 2.1.0
|
||||||
|
|
||||||
math-intrinsics@1.1.0: {}
|
|
||||||
|
|
||||||
mdn-data@2.0.28: {}
|
mdn-data@2.0.28: {}
|
||||||
|
|
||||||
mdn-data@2.0.30:
|
mdn-data@2.0.30:
|
||||||
@ -10058,6 +9935,12 @@ snapshots:
|
|||||||
|
|
||||||
nuxt-define@1.0.0: {}
|
nuxt-define@1.0.0: {}
|
||||||
|
|
||||||
|
nuxt-directus@5.7.0(magicast@0.3.5):
|
||||||
|
dependencies:
|
||||||
|
'@nuxt/kit': 3.19.2(magicast@0.3.5)
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- magicast
|
||||||
|
|
||||||
nuxt@4.1.2(@parcel/watcher@2.5.1)(@types/node@24.4.0)(@vue/compiler-sfc@3.5.21)(db0@0.3.2)(eslint@9.35.0(jiti@2.5.1))(ioredis@5.7.0)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.2)(sass@1.92.1)(terser@5.44.0)(typescript@5.9.2)(vite@7.1.5(@types/node@24.4.0)(jiti@2.5.1)(sass@1.92.1)(terser@5.44.0)(yaml@2.8.1))(yaml@2.8.1):
|
nuxt@4.1.2(@parcel/watcher@2.5.1)(@types/node@24.4.0)(@vue/compiler-sfc@3.5.21)(db0@0.3.2)(eslint@9.35.0(jiti@2.5.1))(ioredis@5.7.0)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.2)(sass@1.92.1)(terser@5.44.0)(typescript@5.9.2)(vite@7.1.5(@types/node@24.4.0)(jiti@2.5.1)(sass@1.92.1)(terser@5.44.0)(yaml@2.8.1))(yaml@2.8.1):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@nuxt/cli': 3.28.0(magicast@0.3.5)
|
'@nuxt/cli': 3.28.0(magicast@0.3.5)
|
||||||
@ -10190,8 +10073,6 @@ snapshots:
|
|||||||
pkg-types: 2.3.0
|
pkg-types: 2.3.0
|
||||||
tinyexec: 1.0.1
|
tinyexec: 1.0.1
|
||||||
|
|
||||||
object-inspect@1.13.4: {}
|
|
||||||
|
|
||||||
ofetch@1.4.1:
|
ofetch@1.4.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
destr: 2.0.5
|
destr: 2.0.5
|
||||||
@ -10662,10 +10543,6 @@ snapshots:
|
|||||||
|
|
||||||
punycode@2.3.1: {}
|
punycode@2.3.1: {}
|
||||||
|
|
||||||
qs@6.14.0:
|
|
||||||
dependencies:
|
|
||||||
side-channel: 1.1.0
|
|
||||||
|
|
||||||
quansync@0.2.11: {}
|
quansync@0.2.11: {}
|
||||||
|
|
||||||
queue-microtask@1.2.3: {}
|
queue-microtask@1.2.3: {}
|
||||||
@ -10936,34 +10813,6 @@ snapshots:
|
|||||||
|
|
||||||
shell-quote@1.8.3: {}
|
shell-quote@1.8.3: {}
|
||||||
|
|
||||||
side-channel-list@1.0.0:
|
|
||||||
dependencies:
|
|
||||||
es-errors: 1.3.0
|
|
||||||
object-inspect: 1.13.4
|
|
||||||
|
|
||||||
side-channel-map@1.0.1:
|
|
||||||
dependencies:
|
|
||||||
call-bound: 1.0.4
|
|
||||||
es-errors: 1.3.0
|
|
||||||
get-intrinsic: 1.3.0
|
|
||||||
object-inspect: 1.13.4
|
|
||||||
|
|
||||||
side-channel-weakmap@1.0.2:
|
|
||||||
dependencies:
|
|
||||||
call-bound: 1.0.4
|
|
||||||
es-errors: 1.3.0
|
|
||||||
get-intrinsic: 1.3.0
|
|
||||||
object-inspect: 1.13.4
|
|
||||||
side-channel-map: 1.0.1
|
|
||||||
|
|
||||||
side-channel@1.1.0:
|
|
||||||
dependencies:
|
|
||||||
es-errors: 1.3.0
|
|
||||||
object-inspect: 1.13.4
|
|
||||||
side-channel-list: 1.0.0
|
|
||||||
side-channel-map: 1.0.1
|
|
||||||
side-channel-weakmap: 1.0.2
|
|
||||||
|
|
||||||
signal-exit@4.1.0: {}
|
signal-exit@4.1.0: {}
|
||||||
|
|
||||||
simple-concat@1.0.1:
|
simple-concat@1.0.1:
|
||||||
|
|||||||
Reference in New Issue
Block a user