Compare commits
177 Commits
03fff90091
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 66adf7f545 | |||
| f87b977c87 | |||
| 601c4abe53 | |||
| b71ee98129 | |||
| 7611d4f079 | |||
| 76fb3ddcb7 | |||
| aa26731731 | |||
| f2533767d2 | |||
| f1116491b6 | |||
| 537a6b0bd6 | |||
| bcc08a53ea | |||
| fa1a22b286 | |||
| 8c720b7ac3 | |||
| 33c0b9cc43 | |||
| fcaf595b73 | |||
| ef20832761 | |||
| 03a692afb5 | |||
| 7b21def74f | |||
| 783d482e0a | |||
| 62ec215340 | |||
| e02f975217 | |||
| 5530776035 | |||
| 63cdff9c41 | |||
| f1398a5545 | |||
| 36d24a4740 | |||
| c9b5b1fad9 | |||
| 246a0b9d4f | |||
| c3ac7c0985 | |||
| 63c3e2e364 | |||
| 1245df497b | |||
| f081a3b33a | |||
| 3c6bff4d31 | |||
| 5011448902 | |||
| 53f3e99d90 | |||
| 815df40745 | |||
| c27337a145 | |||
| 3fb721f278 | |||
| a4dc28fc97 | |||
| 55a35b5498 | |||
| f4ec82a150 | |||
| c82fea48b8 | |||
| 39a23fb382 | |||
| 871b203a5e | |||
| b746247ccc | |||
| 97069815dc | |||
| 5194c72695 | |||
| dbe75ee080 | |||
| 4471851c62 | |||
| 15a75f965b | |||
| 5a4cef52be | |||
| 30ffc7e557 | |||
| c4b9ed7bae | |||
| fc6c922ac3 | |||
| 54389b32ac | |||
| d8002a8265 | |||
| 51042c395a | |||
| 6cf964e8f7 | |||
| 456f2c69f2 | |||
| 6f005c1404 | |||
| 1ab6d92226 | |||
| 67629ed518 | |||
| fe8a0e7656 | |||
| a82872c1c1 | |||
| 02ecb18147 | |||
| 05c970d1e7 | |||
| 496548afa4 | |||
| 6f08701847 | |||
| 17bb8adee3 | |||
| b2b631ed46 | |||
| ec9a097ef5 | |||
| 3fb28c3f00 | |||
| d7bd034d7d | |||
| 341a9c4066 | |||
| ee1597d2c3 | |||
| 17d10a7d80 | |||
| 54d0e297ea | |||
| 644dfa329c | |||
| 100b79f99b | |||
| f4f7e490b4 | |||
| 6418587738 | |||
| 6983f6568d | |||
| c860621e7a | |||
| 154943815d | |||
| 23f2700c0f | |||
| e215a4d498 | |||
| 50f0779a8e | |||
| 5ee6005ad1 | |||
| a520775a8d | |||
| a5f3895794 | |||
| 58223734a2 | |||
| 9163c7fe9a | |||
| 726c38a75d | |||
| 81caa02d11 | |||
| 8213eec217 | |||
| ac9e7b4436 | |||
| 5ad6133252 | |||
| a07d77dde7 | |||
| 3e7b195002 | |||
| 706b754905 | |||
| 0d77e97ad5 | |||
| ac658e01ae | |||
| a93f508e85 | |||
| 1290189d84 | |||
| 691dd34127 | |||
| 7e7775ccc6 | |||
| b234018f72 | |||
| 7b19f59409 | |||
| 9de6ab8799 | |||
| 86b0c29dcf | |||
| 352be1686a | |||
| 710a0cdc5b | |||
| 4c8dfb5b56 | |||
| 007c8f9ce9 | |||
| 0363a88785 | |||
| 308a080ea4 | |||
| a34cfaff6f | |||
| bd894d6f2e | |||
| b4da838cae | |||
| 660892f9e7 | |||
| 2a021cbaea | |||
| d55fe5cce2 | |||
| 9313700660 | |||
| 9d3276a56a | |||
| 37e89c3eda | |||
| b386d4e60d | |||
| bfdae60910 | |||
| e04b9d57da | |||
| 0265ea4978 | |||
| 1cdc29b1ce | |||
| 58e91ed67c | |||
| 191459ec5c | |||
| 881c0ab61e | |||
| f8c95207c2 | |||
| aba3729335 | |||
| 516ad9fa1c | |||
| 6a3493c7e1 | |||
| a328414b4e | |||
| e81532f920 | |||
| 082fe9fea8 | |||
| 7ba7f4a15a | |||
| 083a2695f3 | |||
| 06ab63b8e5 | |||
| 0950e32fe4 | |||
| 04be130b6d | |||
| 7aee68593c | |||
| 7dbe85bdc7 | |||
| 2b3bf0f4a9 | |||
| daa22f8ff9 | |||
| 2d5c231e81 | |||
| 67a2b24e0b | |||
| edcf0ec99e | |||
| e7450005ab | |||
| 128bdf5a16 | |||
| 9460ad5249 | |||
| b7bb0cfff8 | |||
| 085fd8bad3 | |||
| 5990e000bc | |||
| 0403a83751 | |||
| 531f316026 | |||
| 7a15166281 | |||
| 853046d633 | |||
| 0996e910d9 | |||
| 52048fc2a6 | |||
| fc164beaf3 | |||
| 3b6857637b | |||
| d076088747 | |||
| 06c30a7ea3 | |||
| 37da48c07e | |||
| 51080849eb | |||
| 2b53d47c34 | |||
| 959bcaee7c | |||
| 149d05848e | |||
| e0df7ef063 | |||
| dd7ac909fb | |||
| dbc84d5a21 | |||
| cea67404ed | |||
| 63491fd5f9 |
58
.dockerignore
Normal file
58
.dockerignore
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# ------------------------
|
||||||
|
# Node / Package Manager
|
||||||
|
# ------------------------
|
||||||
|
node_modules
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
.pnpm-store
|
||||||
|
|
||||||
|
# Nuxt build outputs
|
||||||
|
.output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
.cache
|
||||||
|
.unimport
|
||||||
|
.h3
|
||||||
|
.nitro
|
||||||
|
**/.nitro
|
||||||
|
|
||||||
|
# Dev tools / OS files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
*.log
|
||||||
|
logs
|
||||||
|
!.gitkeep
|
||||||
|
|
||||||
|
# Local env files (runtime env should be provided by Docker/K8s)
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
|
||||||
|
# Git
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.gitattributes
|
||||||
|
|
||||||
|
# Editor / IDE
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# Tests
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
Dockerfile*
|
||||||
|
docker-compose.yml
|
||||||
|
|
||||||
|
# CI / Local build artifacts
|
||||||
|
*.tgz
|
||||||
|
*.zip
|
||||||
|
*.tar
|
||||||
|
*.mdx
|
||||||
5
.graphqlrc.yaml
Normal file
5
.graphqlrc.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
schema:
|
||||||
|
- 'http://192.168.86.5:8055/graphql':
|
||||||
|
headers:
|
||||||
|
Authorization: 'Bearer ixSWeViHIqwj6_r7NM-uZVR3NNOyBa_W'
|
||||||
|
documents: 'app/graphql/**/*.{graphql,js,ts,jsx,tsx}'
|
||||||
51
Dockerfile
Normal file
51
Dockerfile
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# -------- Base image --------
|
||||||
|
FROM node:22-alpine AS base
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# -------- Dependencies layer -------
|
||||||
|
FROM base AS deps
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN corepack enable
|
||||||
|
|
||||||
|
# Copy package.json and lockfile
|
||||||
|
COPY package.json pnpm-lock.yaml .npmrc ./
|
||||||
|
|
||||||
|
# Install dependencies with cache
|
||||||
|
RUN --mount=type=cache,target=/root/.local/share/pnpm/store pnpm install
|
||||||
|
|
||||||
|
# -------- Build layer -------
|
||||||
|
FROM deps AS build
|
||||||
|
# Copy entire project
|
||||||
|
COPY . ./
|
||||||
|
|
||||||
|
ENV NITRO_PRESET=node-server
|
||||||
|
|
||||||
|
# Build the project
|
||||||
|
RUN pnpm run build
|
||||||
|
|
||||||
|
# ------- Runtime layer -------
|
||||||
|
FROM base AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# COPY .output folder
|
||||||
|
COPY --from=build /app/.output ./
|
||||||
|
|
||||||
|
|
||||||
|
ARG BUILD_TIME
|
||||||
|
ARG GIT_COMMIT
|
||||||
|
|
||||||
|
RUN echo "{\"buildTime\":\"$BUILD_TIME\",\"gitCommit\":\"$GIT_COMMIT\"}" > /app/version.json
|
||||||
|
|
||||||
|
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
ENV PORT=3000
|
||||||
|
ENV NITRO_PRESET=node-server
|
||||||
|
ENV HOST=0.0.0.0
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
CMD ["node", "/app/server/index.mjs"]
|
||||||
27
README.md
27
README.md
@ -58,9 +58,12 @@ pnpm run dev
|
|||||||
|
|
||||||
项目用到以下环境变量,请自行在项目中配置
|
项目用到以下环境变量,请自行在项目中配置
|
||||||
|
|
||||||
- 'DIRECTUS_URL': 后端Directus服务URL
|
> [!NOTE]
|
||||||
- 'DIRECTUS_TOKEN': Directus服务的API Token
|
>
|
||||||
- 'MEILI_HOST': Meilsearch服务地址
|
> - NUXT_PUBLIC_DIRECTUS_URL: 后端Directus服务URL
|
||||||
|
> - NUXT_PUBLIC_DIRECTUS_TOKEN: 后端Directus服务的API Token
|
||||||
|
> - MEILI_HOST: Meilisearch服务地址
|
||||||
|
> - MEILI_SEARCH_KEY: MeilisearchKey
|
||||||
|
|
||||||
## 构建与部署
|
## 构建与部署
|
||||||
|
|
||||||
@ -81,3 +84,21 @@ pnpm run preview
|
|||||||
2. 部署
|
2. 部署
|
||||||
|
|
||||||
部署构建后的项目并推送到文件服务器中,具体步骤视服务器配置而定
|
部署构建后的项目并推送到文件服务器中,具体步骤视服务器配置而定
|
||||||
|
|
||||||
|
## Dockerfile部署
|
||||||
|
|
||||||
|
1. 构建Docker镜像
|
||||||
|
|
||||||
|
在项目根目录执行docker build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t jinshen-website .
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 运行docker容器
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --name <container-name> jinshen-website
|
||||||
|
```
|
||||||
|
|
||||||
|
网站默认在3000端口开放
|
||||||
|
|||||||
95
app/assets/css/typography.css
Normal file
95
app/assets/css/typography.css
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
.html-typography {
|
||||||
|
padding: 10px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.html-typography h1 {
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
font-size: 1.5em;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.html-typography h2 {
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
font-size: 1.5em;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.html-typography h3 {
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
font-size: 1.2em;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.html-typography p {
|
||||||
|
text-indent: 2em;
|
||||||
|
text-align: justify;
|
||||||
|
margin: 0.5em 0;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.html-typography ol {
|
||||||
|
list-style-type: decimal;
|
||||||
|
padding-left: 2em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.html-typography ul {
|
||||||
|
list-style-type: disc;
|
||||||
|
padding-left: 2em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.html-typography hr {
|
||||||
|
border: none;
|
||||||
|
border-top: 1px solid var(--el-border-color);
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表格基础样式 */
|
||||||
|
.html-typography table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
border: 1px solid var(--el-border-color);
|
||||||
|
margin: 1em 0;
|
||||||
|
table-layout: auto;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 单元格通用样式 */
|
||||||
|
.html-typography th,
|
||||||
|
.html-typography td {
|
||||||
|
border: 1px solid var(--el-border-color);
|
||||||
|
padding: 8px 12px;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: middle;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表头样式 */
|
||||||
|
.html-typography th {
|
||||||
|
background-color: var(--el-fill-color-light);
|
||||||
|
color: var(--el-text-color-primary);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 行 hover 效果 */
|
||||||
|
.html-typography tbody tr:hover {
|
||||||
|
background-color: var(--el-fill-color-light-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 交替行背景 */
|
||||||
|
.html-typography tbody tr:nth-child(odd) {
|
||||||
|
background-color: var(--el-fill-color-lighter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表格标题(如有 caption) */
|
||||||
|
.html-typography table caption {
|
||||||
|
caption-side: top;
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--el-text-color-primary);
|
||||||
|
}
|
||||||
107
app/components/pages/about/LearnMoreCard.vue
Normal file
107
app/components/pages/about/LearnMoreCard.vue
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<template>
|
||||||
|
<component
|
||||||
|
:is="wrapperTag"
|
||||||
|
v-bind="wrapperProps"
|
||||||
|
class="learn-more-wrapper"
|
||||||
|
@click="handleAsyncClick"
|
||||||
|
>
|
||||||
|
<el-card class="learn-more-card">
|
||||||
|
<el-icon class="icon" size="80">
|
||||||
|
<component :is="icon" />
|
||||||
|
</el-icon>
|
||||||
|
<br />
|
||||||
|
{{ title }}
|
||||||
|
</el-card>
|
||||||
|
</component>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
const props = defineProps({
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
to: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
href: {
|
||||||
|
type: [String, Function],
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 包裹器标签
|
||||||
|
const wrapperTag = computed(() => {
|
||||||
|
if (props.to) return resolveComponent('NuxtLink');
|
||||||
|
if (props.href) return 'a';
|
||||||
|
return 'div';
|
||||||
|
});
|
||||||
|
|
||||||
|
// 包裹器属性
|
||||||
|
const wrapperProps = computed(() => {
|
||||||
|
// Nuxt 内部跳转
|
||||||
|
if (props.to) {
|
||||||
|
return { to: props.to };
|
||||||
|
}
|
||||||
|
|
||||||
|
// 外部跳转(字符串)
|
||||||
|
if (typeof props.href === 'string') {
|
||||||
|
return {
|
||||||
|
href: props.href,
|
||||||
|
target: '_blank',
|
||||||
|
rel: 'noopener noreferrer',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 其他情况:href 是异步函数 → 不在这里处理
|
||||||
|
return { href: '#' };
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleAsyncClick(event: Event) {
|
||||||
|
if (typeof props.href === 'function') {
|
||||||
|
event.preventDefault();
|
||||||
|
const url = await props.href();
|
||||||
|
window.open(url, '_blank', 'noopener,noreferrer');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.learn-more-card {
|
||||||
|
width: 20%;
|
||||||
|
min-width: 200px;
|
||||||
|
padding: 20px;
|
||||||
|
margin: 0 auto;
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.learn-more-card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.learn-more-wrapper {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.learn-more-card {
|
||||||
|
width: 80%;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -8,15 +8,17 @@
|
|||||||
</template>
|
</template>
|
||||||
<dl class="text-gray-600 space-y-1 mb-6">
|
<dl class="text-gray-600 space-y-1 mb-6">
|
||||||
<div>
|
<div>
|
||||||
<dt class="font-semibold inline">类型:</dt>
|
<dt class="font-semibold inline">{{ $t('document-meta.type') }}:</dt>
|
||||||
<dd class="inline">{{ file.type }}</dd>
|
<dd class="inline">{{ file.type }}</dd>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<dt class="font-semibold inline">大小:</dt>
|
<dt class="font-semibold inline">{{ $t('document-meta.size') }}:</dt>
|
||||||
<dd class="inline">{{ formatFileSize(file.filesize) }}</dd>
|
<dd class="inline">{{ formatFileSize(file.filesize) }}</dd>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<dt class="font-semibold inline">上传时间:</dt>
|
<dt class="font-semibold inline">
|
||||||
|
{{ $t('document-meta.upload-at') }}:
|
||||||
|
</dt>
|
||||||
<dd class="inline">
|
<dd class="inline">
|
||||||
{{ new Date(file.uploaded_on).toLocaleDateString() }}
|
{{ new Date(file.uploaded_on).toLocaleDateString() }}
|
||||||
</dd>
|
</dd>
|
||||||
@ -24,10 +26,12 @@
|
|||||||
</dl>
|
</dl>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="button-group">
|
<div class="button-group">
|
||||||
<el-button type="primary" @click="handleDownload">下载</el-button>
|
<el-button type="primary" @click="handleDownload">{{
|
||||||
<el-button v-if="file.previewable" @click="handlePreview"
|
$t('document-action.download')
|
||||||
>预览</el-button
|
}}</el-button>
|
||||||
>
|
<el-button v-if="file.previewable" @click="handlePreview">{{
|
||||||
|
$t('document-action.preview')
|
||||||
|
}}</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|||||||
@ -83,4 +83,10 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.homepage-carousel .el-carousel__item {
|
||||||
|
height: 50vw;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,25 +1,26 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="homepage-section">
|
<section class="homepage-section">
|
||||||
<h2>推荐产品</h2>
|
<h2>{{ $t('homepage.recommended-products') }}</h2>
|
||||||
<p>
|
<p>
|
||||||
探索我们的精选产品,满足您的各种需求。无论是创新技术还是经典设计,我们都为您提供优质选择。
|
{{ $t('homepage.recommended-products-desc') }}
|
||||||
</p>
|
</p>
|
||||||
<div v-if="!pending">
|
<div v-if="!pending">
|
||||||
<el-carousel
|
<el-carousel
|
||||||
class="recommend-carousel"
|
class="recommend-carousel"
|
||||||
height="auto"
|
:height="carouselHeight"
|
||||||
arrow="never"
|
arrow="never"
|
||||||
indicator-position="outside"
|
indicator-position="outside"
|
||||||
:autoplay="false"
|
:autoplay="false"
|
||||||
>
|
>
|
||||||
<el-carousel-item
|
<el-carousel-item
|
||||||
v-for="n in Math.floor(products.length / 3) + 1"
|
v-for="n in pages"
|
||||||
|
ref="carouselItem"
|
||||||
: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 products.slice((n - 1) * 3, n * 3)"
|
v-for="(item, index) in pageProducts(n)"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="recommend-card"
|
class="recommend-card"
|
||||||
@click="handleProductCardClick(item.id.toString() || '')"
|
@click="handleProductCardClick(item.id.toString() || '')"
|
||||||
@ -64,9 +65,32 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const carouselHeight = ref<string>('auto');
|
||||||
|
const perPage = ref(3);
|
||||||
|
const carouselItem = ref<HTMLElement | null>(null);
|
||||||
|
|
||||||
const { getImageUrl } = useDirectusImage();
|
const { getImageUrl } = useDirectusImage();
|
||||||
|
const { height } = useElementSize(carouselItem);
|
||||||
|
|
||||||
const products = computed(() => props.homepageData?.recommendProducts || []);
|
const products = computed(() => props.homepageData?.recommendProducts || []);
|
||||||
|
const pages = computed(() =>
|
||||||
|
Math.ceil(products.value.length / perPage.value)
|
||||||
|
);
|
||||||
|
|
||||||
|
const updatePerPage = () => {
|
||||||
|
const width = window.innerWidth;
|
||||||
|
if (width < 768) {
|
||||||
|
perPage.value = 1;
|
||||||
|
} else if (width < 1024) {
|
||||||
|
perPage.value = 2;
|
||||||
|
} else {
|
||||||
|
perPage.value = 3;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const pageProducts = (n: number) => {
|
||||||
|
return products.value.slice((n - 1) * perPage.value, n * perPage.value);
|
||||||
|
};
|
||||||
|
|
||||||
const handleProductCardClick = (documentId: string) => {
|
const handleProductCardClick = (documentId: string) => {
|
||||||
// 使用路由导航到产品详情页
|
// 使用路由导航到产品详情页
|
||||||
@ -76,6 +100,21 @@
|
|||||||
router.push(localePath(`/products/${documentId}`));
|
router.push(localePath(`/products/${documentId}`));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch(height, (h) => {
|
||||||
|
if (h > 0) {
|
||||||
|
carouselHeight.value = h + 40 + 'px';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
updatePerPage();
|
||||||
|
window.addEventListener('resize', updatePerPage);
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
window.removeEventListener('resize', updatePerPage);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -126,7 +165,7 @@
|
|||||||
.recommend-list {
|
.recommend-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
height: 400px;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recommend-card-group {
|
.recommend-card-group {
|
||||||
@ -134,7 +173,7 @@
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
height: 100%;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recommend-card {
|
.recommend-card {
|
||||||
@ -171,6 +210,19 @@
|
|||||||
|
|
||||||
.recommend-card .el-image {
|
.recommend-card .el-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
aspect-ratio: 16 / 10;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
.recommend-card {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.recommend-card {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,23 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="homepage-section">
|
<section class="homepage-section">
|
||||||
<h2>推荐解决方案</h2>
|
<h2>{{ $t('homepage.recommended-solutions') }}</h2>
|
||||||
<p>了解我们的定制解决方案,帮助您优化业务流程,提高效率。</p>
|
<p>{{ $t('homepage.recommended-solutions-desc') }}</p>
|
||||||
<div v-if="!pending">
|
<div v-if="!pending">
|
||||||
<el-carousel
|
<el-carousel
|
||||||
class="recommend-carousel"
|
class="recommend-carousel"
|
||||||
height="auto"
|
:height="carouselHeight"
|
||||||
arrow="never"
|
arrow="never"
|
||||||
indicator-position="outside"
|
indicator-position="outside"
|
||||||
:autoplay="false"
|
:autoplay="false"
|
||||||
>
|
>
|
||||||
<el-carousel-item
|
<el-carousel-item
|
||||||
v-for="n in Math.floor(solutions.length / 3) + 1"
|
v-for="n in pages"
|
||||||
|
ref="carouselItem"
|
||||||
: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 solutions.slice((n - 1) * 3, n * 3)"
|
v-for="(item, index) in pageSolutions(n)"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="recommend-card"
|
class="recommend-card"
|
||||||
@click="handleSolutionCardClick(item.id.toString() || '')"
|
@click="handleSolutionCardClick(item.id.toString() || '')"
|
||||||
@ -62,11 +63,34 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const carouselHeight = ref<string>('auto');
|
||||||
|
const perPage = ref(3);
|
||||||
|
const carouselItem = ref<HTMLElement | null>(null);
|
||||||
|
|
||||||
const { getImageUrl } = useDirectusImage();
|
const { getImageUrl } = useDirectusImage();
|
||||||
|
const { height } = useElementSize(carouselItem);
|
||||||
|
|
||||||
const solutions = computed(
|
const solutions = computed(
|
||||||
() => props.homepageData?.recommendSolutions || []
|
() => props.homepageData?.recommendSolutions || []
|
||||||
);
|
);
|
||||||
|
const pages = computed(() =>
|
||||||
|
Math.ceil(solutions.value.length / perPage.value)
|
||||||
|
);
|
||||||
|
|
||||||
|
const updatePerPage = () => {
|
||||||
|
const width = window.innerWidth;
|
||||||
|
if (width < 768) {
|
||||||
|
perPage.value = 1;
|
||||||
|
} else if (width < 1024) {
|
||||||
|
perPage.value = 2;
|
||||||
|
} else {
|
||||||
|
perPage.value = 3;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const pageSolutions = (n: number) => {
|
||||||
|
return solutions.value.slice((n - 1) * perPage.value, n * perPage.value);
|
||||||
|
};
|
||||||
|
|
||||||
const handleSolutionCardClick = (documentId: string) => {
|
const handleSolutionCardClick = (documentId: string) => {
|
||||||
// 使用路由导航到产品详情页
|
// 使用路由导航到产品详情页
|
||||||
@ -76,6 +100,21 @@
|
|||||||
router.push(localePath(`/solutions/${documentId}`));
|
router.push(localePath(`/solutions/${documentId}`));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch(height, (h) => {
|
||||||
|
if (h > 0) {
|
||||||
|
carouselHeight.value = h + 40 + 'px';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
updatePerPage();
|
||||||
|
window.addEventListener('resize', updatePerPage);
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
window.removeEventListener('resize', updatePerPage);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -126,7 +165,7 @@
|
|||||||
.recommend-list {
|
.recommend-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
height: 400px;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recommend-card-group {
|
.recommend-card-group {
|
||||||
@ -134,7 +173,7 @@
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
height: 100%;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recommend-card {
|
.recommend-card {
|
||||||
@ -171,6 +210,19 @@
|
|||||||
|
|
||||||
.recommend-card .el-image {
|
.recommend-card .el-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
aspect-ratio: 16 / 10;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
.recommend-card {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.recommend-card {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,16 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="product-detail">
|
<div class="product-detail">
|
||||||
<el-tabs v-model="activeName" class="product-tabs" stretch>
|
<el-tabs v-model="activeName" class="product-tabs" stretch>
|
||||||
<el-tab-pane label="产品详情" name="details">
|
<el-tab-pane :label="$t('product-tab.details')" name="details">
|
||||||
<markdown-renderer :content="product.description || ''" />
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||||
|
<div class="html-typography" v-html="product?.description || ''" />
|
||||||
|
<!-- <div v-if="!hydrated" v-html="product.description || ''" /> -->
|
||||||
|
<!-- <div v-else> -->
|
||||||
|
<!-- <html-renderer -->
|
||||||
|
<!-- class="html-typography" -->
|
||||||
|
<!-- :html="product.description || ''" -->
|
||||||
|
<!-- /> -->
|
||||||
|
<!-- </div> -->
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="技术规格" name="specs">
|
<el-tab-pane :label="$t('product-tab.specs')" name="specs">
|
||||||
<spec-table :data="product.specs" />
|
<spec-table :data="product.specs" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="常见问题" name="faq">
|
<el-tab-pane :label="$t('product-tab.faq')" name="faq">
|
||||||
<question-list :questions="product.faqs" />
|
<question-list :questions="product.faqs" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="相关文档" name="documents">
|
<el-tab-pane :label="$t('product-tab.documents')" name="documents">
|
||||||
<document-list :documents="product.documents" />
|
<document-list :documents="product.documents" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
@ -25,7 +33,13 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const hydrated = ref(false);
|
||||||
|
|
||||||
const activeName = ref('details'); // 默认选中概览标签
|
const activeName = ref('details'); // 默认选中概览标签
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
hydrated.value = true;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -42,4 +56,11 @@
|
|||||||
color: var(--el-text-color-primary);
|
color: var(--el-text-color-primary);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.product-tabs ::v-deep(.el-tabs__nav) {
|
||||||
|
float: none;
|
||||||
|
min-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
<el-carousel
|
<el-carousel
|
||||||
v-else
|
v-else
|
||||||
class="product-carousel"
|
class="product-carousel"
|
||||||
height="500px"
|
height="auto"
|
||||||
:autoplay="false"
|
:autoplay="false"
|
||||||
:loop="false"
|
:loop="false"
|
||||||
arrow="always"
|
arrow="always"
|
||||||
@ -18,8 +18,9 @@
|
|||||||
<el-carousel-item
|
<el-carousel-item
|
||||||
v-for="(item, index) in product.images || []"
|
v-for="(item, index) in product.images || []"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
class="product-carousel-item"
|
||||||
>
|
>
|
||||||
<div class="product-carousel-item">
|
<div>
|
||||||
<el-image
|
<el-image
|
||||||
:src="getImageUrl(item.image || '')"
|
:src="getImageUrl(item.image || '')"
|
||||||
:alt="product.name"
|
:alt="product.name"
|
||||||
@ -37,6 +38,10 @@
|
|||||||
<div class="product-info">
|
<div class="product-info">
|
||||||
<h1>{{ product.name }}</h1>
|
<h1>{{ product.name }}</h1>
|
||||||
<p class="summary">{{ product.summary }}</p>
|
<p class="summary">{{ product.summary }}</p>
|
||||||
|
<p v-if="product.status === 'discontinued'" class="discontinued-warning">
|
||||||
|
<el-icon><ElIconWarning /></el-icon>
|
||||||
|
{{ $t('product-discontinued-warning') }}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -59,6 +64,10 @@
|
|||||||
gap: 3rem;
|
gap: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.product-carousel-item {
|
||||||
|
height: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
.product-image .el-image {
|
.product-image .el-image {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -99,4 +108,30 @@
|
|||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.discontinued-warning {
|
||||||
|
color: var(--el-color-error);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.product-header {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-carousel-item {
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-image .el-image {
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
.product-info {
|
||||||
|
padding: 0 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-info h1 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -7,11 +7,11 @@
|
|||||||
:title="item.name"
|
:title="item.name"
|
||||||
:name="item.name"
|
:name="item.name"
|
||||||
>
|
>
|
||||||
<el-descriptions :column="1" border>
|
<el-descriptions :column="1" label-width="30%" border>
|
||||||
<el-descriptions-item
|
<el-descriptions-item
|
||||||
v-for="subItem in item.specs"
|
v-for="subItem in item.specs"
|
||||||
:key="subItem.key"
|
:key="subItem.key"
|
||||||
:label="subItem.value"
|
:label="subItem.key"
|
||||||
>
|
>
|
||||||
{{ subItem.value }}
|
{{ subItem.value }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
@ -40,6 +40,7 @@
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.spec-collapse ::v-deep(.el-collapse-item__header) {
|
.spec-collapse ::v-deep(.el-collapse-item__header) {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
75
app/components/pages/search/SearchResultCard.vue
Normal file
75
app/components/pages/search/SearchResultCard.vue
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<template>
|
||||||
|
<el-card class="result-card">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<h3 class="result-title">{{ item.title }}</h3>
|
||||||
|
<p v-if="item.summary" class="result-summary">
|
||||||
|
{{ item.summary }}
|
||||||
|
</p>
|
||||||
|
<p v-if="item.sectionType" class="result-type">
|
||||||
|
<span>{{ $t('search.section') }}: </span>
|
||||||
|
<span class="result-type-name">{{ typeLabel }}</span>
|
||||||
|
<span v-if="item.type" class="result-type-name"
|
||||||
|
>({{ item.type }})</span
|
||||||
|
>
|
||||||
|
</p>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="image-col">
|
||||||
|
<el-image
|
||||||
|
v-if="item.thumbnail"
|
||||||
|
:src="item.thumbnail"
|
||||||
|
:alt="item.title"
|
||||||
|
style="width: 150px"
|
||||||
|
/>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{
|
||||||
|
item: SearchItemView;
|
||||||
|
typeLabel: string;
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.result-card {
|
||||||
|
border-radius: 12px;
|
||||||
|
transition: box-shadow 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-card:hover {
|
||||||
|
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-title {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-summary {
|
||||||
|
font-size: 0.95rem;
|
||||||
|
color: var(--el-text-color-regular);
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-type {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-type-name {
|
||||||
|
margin-left: 4px;
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-col {
|
||||||
|
display: flex;
|
||||||
|
justify-content: end;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -3,19 +3,13 @@
|
|||||||
<div class="search-results">
|
<div class="search-results">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
v-for="hit in paginatedHits"
|
v-for="hit in paginatedHits"
|
||||||
:key="`${hit.type}-${hit.id}`"
|
:key="`${hit.sectionType}-${hit.id}`"
|
||||||
:to="localePath(resolveHitLink(hit))"
|
:to="localePath(resolveHitLink(hit))"
|
||||||
>
|
>
|
||||||
<el-card class="result-card">
|
<search-result-card
|
||||||
<h3 class="result-title">{{ hit.title }}</h3>
|
:item="hit"
|
||||||
<p v-if="hit.summary" class="result-summary">
|
:type-label="getIndexLabel(hit.sectionType)"
|
||||||
{{ hit.summary }}
|
/>
|
||||||
</p>
|
|
||||||
<p v-if="hit.type" class="result-type">
|
|
||||||
<span>内容类型: </span>
|
|
||||||
<span class="result-type-name">{{ getIndexLabel(hit.type) }}</span>
|
|
||||||
</p>
|
|
||||||
</el-card>
|
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -72,7 +66,7 @@
|
|||||||
const items = props.searchItems;
|
const items = props.searchItems;
|
||||||
const filteredHits = computed(() => {
|
const filteredHits = computed(() => {
|
||||||
if (props.category) {
|
if (props.category) {
|
||||||
return items.filter((item) => item.type === props.category);
|
return items.filter((item) => item.sectionType === props.category);
|
||||||
} else {
|
} else {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
@ -116,14 +110,22 @@
|
|||||||
|
|
||||||
const slug = String(slugCandidate);
|
const slug = String(slugCandidate);
|
||||||
|
|
||||||
if (item.type === 'product') {
|
if (item.sectionType === 'product') {
|
||||||
return localePath({ path: `/products/${slug}` });
|
return localePath({ path: `/products/${slug}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.type === 'solution') {
|
if (item.sectionType === 'solution') {
|
||||||
return localePath({ path: `/solutions/${slug}` });
|
return localePath({ path: `/solutions/${slug}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.sectionType === 'document') {
|
||||||
|
return localePath({ path: `/download/${slug}` });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.sectionType === 'question') {
|
||||||
|
return localePath({ path: `/support/faq`, query: { focus: slug } });
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -22,17 +22,17 @@
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{ name: 'all', label: '全部' },
|
{ name: 'all', label: $t('all') },
|
||||||
{ name: 'product', label: '产品' },
|
{ name: 'product', label: $t('search.sections.product') },
|
||||||
{ name: 'solution', label: '解决方案' },
|
{ name: 'solution', label: $t('search.sections.solution') },
|
||||||
{ name: 'question', label: '相关问题' },
|
{ name: 'question', label: $t('search.sections.faq') },
|
||||||
{ name: 'document', label: '文档资料' },
|
{ name: 'document', label: $t('search.sections.document') },
|
||||||
];
|
];
|
||||||
|
|
||||||
const resultCount = computed(() => {
|
const resultCount = computed(() => {
|
||||||
const map: Record<string, number> = { all: props.searchItems.length };
|
const map: Record<string, number> = { all: props.searchItems.length };
|
||||||
for (const item of props.searchItems) {
|
for (const item of props.searchItems) {
|
||||||
map[item.type] = (map[item.type] ?? 0) + 1;
|
map[item.sectionType] = (map[item.sectionType] ?? 0) + 1;
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
});
|
});
|
||||||
@ -47,3 +47,9 @@
|
|||||||
currentPage.value = 1; // 重置页码
|
currentPage.value = 1; // 重置页码
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.el-tabs {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -2,16 +2,15 @@
|
|||||||
<article class="solution-defail">
|
<article class="solution-defail">
|
||||||
<header class="solution-header">
|
<header class="solution-header">
|
||||||
<h1 class="solution-title">{{ solution.title }}</h1>
|
<h1 class="solution-title">{{ solution.title }}</h1>
|
||||||
<dl class="solution-meta">
|
|
||||||
<dt class="visually-hidden">CreatedAt:</dt>
|
|
||||||
<dd class="solution-date">
|
|
||||||
{{ new Date(solution.createAt).toLocaleDateString() }}
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<p class="solution-summary">{{ solution.summary }}</p>
|
<p class="solution-summary">{{ solution.summary }}</p>
|
||||||
</header>
|
</header>
|
||||||
<section class="solution-content">
|
<section class="solution-content">
|
||||||
<markdown-renderer :content="solution?.content || ''" />
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||||
|
<div class="html-typography" v-html="solution?.content || ''" />
|
||||||
|
<!-- <div v-if="!hydrated" v-html="solution?.content || ''" /> -->
|
||||||
|
<!-- <div v-else> -->
|
||||||
|
<!-- <html-renderer class="html-typography" :html="solution.content || ''" /> -->
|
||||||
|
<!-- </div> -->
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
</template>
|
</template>
|
||||||
@ -23,6 +22,12 @@
|
|||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const hydrated = ref(false);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
hydrated.value = true;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
113
app/components/pages/support/DocumentFilter.vue
Normal file
113
app/components/pages/support/DocumentFilter.vue
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
<template>
|
||||||
|
<div class="document-category">
|
||||||
|
<el-row :gutter="12">
|
||||||
|
<el-col :span="12" :xs="12">
|
||||||
|
<span class="select-label">{{
|
||||||
|
$t('product-filter.product-type')
|
||||||
|
}}</span>
|
||||||
|
<el-select
|
||||||
|
v-model="model.selectedProductType"
|
||||||
|
:placeholder="$t('product-filter.select-product-type')"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="type in productTypeOptions"
|
||||||
|
:key="type.id"
|
||||||
|
:label="type.name"
|
||||||
|
:value="type.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12" :xs="12">
|
||||||
|
<span class="select-label">{{
|
||||||
|
$t('product-filter.product-model')
|
||||||
|
}}</span>
|
||||||
|
<el-select
|
||||||
|
v-model="model.selectedProduct"
|
||||||
|
:placeholder="$t('product-filter.select-product-model')"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="product in productOptions"
|
||||||
|
:key="product.id"
|
||||||
|
:label="product.name"
|
||||||
|
:value="product.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12" :xs="24">
|
||||||
|
<span class="select-label">
|
||||||
|
{{ $t('product-filter.document-type') }}
|
||||||
|
</span>
|
||||||
|
<el-select
|
||||||
|
v-model="model.selectedDocumentType"
|
||||||
|
:placeholder="$t('product-filter.select-document-type')"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="questionType in documentTypeOptions"
|
||||||
|
:key="questionType.id"
|
||||||
|
:label="questionType.name"
|
||||||
|
:value="questionType.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12" :xs="24">
|
||||||
|
<span class="select-label">{{ $t('product-filter.keyword') }}</span>
|
||||||
|
<el-input
|
||||||
|
v-model="model.keyword"
|
||||||
|
:placeholder="$t('product-filter.enter-keyword')"
|
||||||
|
clearable
|
||||||
|
:prefix-icon="Search"
|
||||||
|
/>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Search } from '@element-plus/icons-vue';
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
productTypeOptions: {
|
||||||
|
type: Array as () => Array<DocumentListProductType>,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
productOptions: {
|
||||||
|
type: Array as () => Array<DocumentListProduct>,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
documentTypeOptions: {
|
||||||
|
type: Array as () => Array<DocumentTypeView>,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const model = defineModel<{
|
||||||
|
selectedProduct: string | null;
|
||||||
|
selectedProductType: string | null;
|
||||||
|
selectedDocumentType: string | null;
|
||||||
|
keyword: string;
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.document-category {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
padding: 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-label {
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-select__wrapper),
|
||||||
|
:deep(.el-input__wrapper) {
|
||||||
|
height: 40px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
112
app/components/pages/support/QuestionFilter.vue
Normal file
112
app/components/pages/support/QuestionFilter.vue
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<template>
|
||||||
|
<div class="question-category">
|
||||||
|
<el-row :gutter="12">
|
||||||
|
<el-col :span="12" :xs="12">
|
||||||
|
<span class="select-label">{{
|
||||||
|
$t('product-filter.product-type')
|
||||||
|
}}</span>
|
||||||
|
<el-select
|
||||||
|
v-model="model.selectedProductType"
|
||||||
|
:placeholder="$t('product-filter.select-product-type')"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="type in productTypeOptions"
|
||||||
|
:key="type.id"
|
||||||
|
:label="type.name"
|
||||||
|
:value="type.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12" :xs="12">
|
||||||
|
<span class="select-label">{{
|
||||||
|
$t('product-filter.product-model')
|
||||||
|
}}</span>
|
||||||
|
<el-select
|
||||||
|
v-model="model.selectedProduct"
|
||||||
|
:placeholder="$t('product-filter.select-product-model')"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="product in productOptions"
|
||||||
|
:key="product.id"
|
||||||
|
:label="product.name"
|
||||||
|
:value="product.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12" :xs="24">
|
||||||
|
<span class="select-label">
|
||||||
|
{{ $t('product-filter.question-type') }}
|
||||||
|
</span>
|
||||||
|
<el-select
|
||||||
|
v-model="model.selectedQuestionType"
|
||||||
|
:placeholder="$t('product-filter.select-question-type')"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="questionType in questionTypeOptions"
|
||||||
|
:key="questionType.id"
|
||||||
|
:label="questionType.name"
|
||||||
|
:value="questionType.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12" :xs="24">
|
||||||
|
<span class="select-label">{{ $t('product-filter.keyword') }}</span>
|
||||||
|
<el-input
|
||||||
|
v-model="model.keyword"
|
||||||
|
:placeholder="$t('product-filter.enter-keyword')"
|
||||||
|
clearable
|
||||||
|
:prefix-icon="Search"
|
||||||
|
/>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Search } from '@element-plus/icons-vue';
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
productTypeOptions: {
|
||||||
|
type: Array as () => Array<QuestionListProductType>,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
productOptions: {
|
||||||
|
type: Array as () => Array<QuestionListProduct>,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
questionTypeOptions: {
|
||||||
|
type: Array as () => Array<QuestionTypeView>,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const model = defineModel<{
|
||||||
|
selectedProduct: string | null;
|
||||||
|
selectedProductType: string | null;
|
||||||
|
selectedQuestionType: string | null;
|
||||||
|
keyword: string;
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.question-category {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-label {
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-select__wrapper),
|
||||||
|
:deep(.el-input__wrapper) {
|
||||||
|
height: 40px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -20,7 +20,7 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<NuxtLink class="card-link" :to="to">
|
<NuxtLink class="card-link" :to="to">
|
||||||
<el-button class="card-button" round>
|
<el-button class="card-button" round>
|
||||||
<span>了解更多 > </span>
|
<span>{{ $t('learn-more') }} > </span>
|
||||||
</el-button>
|
</el-button>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|||||||
@ -21,10 +21,10 @@
|
|||||||
|
|
||||||
const activeTab = ref(props.modelValue || '');
|
const activeTab = ref(props.modelValue || '');
|
||||||
const options = [
|
const options = [
|
||||||
{ label: '服务支持', value: '' },
|
{ label: $t('navigation.support'), value: '' },
|
||||||
{ label: '常见问题', value: 'faq' },
|
{ label: $t('navigation.faq'), value: 'faq' },
|
||||||
{ label: '文档资料', value: 'documents' },
|
{ label: $t('navigation.documents'), value: 'documents' },
|
||||||
{ label: '联系售后', value: 'contact-us' },
|
{ label: $t('navigation.contact-info'), value: 'contact-us' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const handleSegmentedChange = (value: string) => {
|
const handleSegmentedChange = (value: string) => {
|
||||||
|
|||||||
@ -7,13 +7,23 @@
|
|||||||
@click="handleClick(doc.fileId)"
|
@click="handleClick(doc.fileId)"
|
||||||
>
|
>
|
||||||
<div class="document-info">
|
<div class="document-info">
|
||||||
<h3>{{ doc.title }}</h3>
|
<div class="document-title">
|
||||||
|
<h3>
|
||||||
|
{{ doc.title }}
|
||||||
|
<span v-if="showCategory && doc.type" class="document-category">
|
||||||
|
|
|
||||||
|
</span>
|
||||||
|
<span v-if="showCategory && doc.type" class="document-category">
|
||||||
|
{{ doc.type.name }}
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
<div class="document-content">
|
<div class="document-content">
|
||||||
<span v-if="doc.size" class="document-meta"
|
<span v-if="doc.size" class="document-meta"
|
||||||
>大小: {{ formatFileSize(doc.size) }}
|
>{{ $t('document-meta.size') }}: {{ formatFileSize(doc.size) }}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="doc.filename" class="document-meta"
|
<span v-if="doc.filename" class="document-meta"
|
||||||
>格式:
|
>{{ $t('document-meta.format') }}:
|
||||||
{{ formatFileExtension(getFileExtension(doc.filename)) }}</span
|
{{ formatFileExtension(getFileExtension(doc.filename)) }}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@ -28,6 +38,10 @@
|
|||||||
type: Array as () => Array<ProductDocumentView>,
|
type: Array as () => Array<ProductDocumentView>,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
showCategory: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const localePath = useLocalePath();
|
const localePath = useLocalePath();
|
||||||
@ -63,6 +77,15 @@
|
|||||||
color: var(--el-text-color-secondary);
|
color: var(--el-text-color-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.document-title {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.document-category {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
.download-button {
|
.download-button {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
:disabled="!fileMeta"
|
:disabled="!fileMeta"
|
||||||
@click="openInNewTab"
|
@click="openInNewTab"
|
||||||
>
|
>
|
||||||
在新标签打开
|
{{ $t('document-action.open-in-new-tab') }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="px-3 py-1.5 rounded bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50"
|
class="px-3 py-1.5 rounded bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50"
|
||||||
@ -29,7 +29,7 @@
|
|||||||
:disabled="!fileMeta"
|
:disabled="!fileMeta"
|
||||||
@click="download"
|
@click="download"
|
||||||
>
|
>
|
||||||
下载
|
{{ $t('document-action.download') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
@ -37,7 +37,7 @@
|
|||||||
<div class="flex-1 overflow-hidden">
|
<div class="flex-1 overflow-hidden">
|
||||||
<!-- 加载状态 -->
|
<!-- 加载状态 -->
|
||||||
<div v-if="pending" class="h-48 grid place-items-center border rounded">
|
<div v-if="pending" class="h-48 grid place-items-center border rounded">
|
||||||
正在加载...
|
{{ $t('loading') }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else-if="errorText"
|
v-else-if="errorText"
|
||||||
@ -122,6 +122,8 @@
|
|||||||
const errorText = computed(() => error.value?.message ?? null);
|
const errorText = computed(() => error.value?.message ?? null);
|
||||||
const fileMeta = computed(() => props.file ?? data.value ?? null);
|
const fileMeta = computed(() => props.file ?? data.value ?? null);
|
||||||
|
|
||||||
|
logger.debug('FilePreviewer - fileMeta:', fileMeta.value);
|
||||||
|
|
||||||
/** 预览源地址:支持在 file.url 上追加额外 query(如临时 token、inline) */
|
/** 预览源地址:支持在 file.url 上追加额外 query(如临时 token、inline) */
|
||||||
const src = computed<string>(() => {
|
const src = computed<string>(() => {
|
||||||
if (!fileMeta.value) return '';
|
if (!fileMeta.value) return '';
|
||||||
|
|||||||
30
app/components/shared/HtmlRenderer.ts
Normal file
30
app/components/shared/HtmlRenderer.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
export default defineComponent({
|
||||||
|
name: 'HtmlRenderer',
|
||||||
|
|
||||||
|
props: {
|
||||||
|
html: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
map: {
|
||||||
|
type: Object as () => HtmlRenderMap,
|
||||||
|
default: () => defaultHtmlRenderMap,
|
||||||
|
},
|
||||||
|
allowUnknown: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
setup(props, { attrs }) {
|
||||||
|
const nodes: VNode[] = useHtmlRenderer(props.html, {
|
||||||
|
map: props.map,
|
||||||
|
allowUnknownTags: props.allowUnknown,
|
||||||
|
});
|
||||||
|
|
||||||
|
logger.debug('nodes: ', nodes);
|
||||||
|
|
||||||
|
// 渲染函数:直接返回 VNode 数组
|
||||||
|
return () => h('div', { ...attrs }, nodes);
|
||||||
|
},
|
||||||
|
});
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<footer class="jinshen-footer">
|
<footer class="jinshen-footer">
|
||||||
<div class="footer-container">
|
<div class="footer-container hide-on-mobile">
|
||||||
<!-- Logo 和公司信息 -->
|
<!-- Logo 和公司信息 -->
|
||||||
<div class="footer-section">
|
<div class="footer-section">
|
||||||
<div class="footer-logo">
|
<div class="footer-logo">
|
||||||
@ -84,19 +84,24 @@
|
|||||||
© {{ currentYear }} {{ $t('company-name') }}.
|
© {{ currentYear }} {{ $t('company-name') }}.
|
||||||
{{ $t('all-rights-reserved') }}
|
{{ $t('all-rights-reserved') }}
|
||||||
</p>
|
</p>
|
||||||
<p>备案号: 浙ICP备12003709号-5</p>
|
<p>
|
||||||
</div>
|
备案号:
|
||||||
<div class="footer-links-bottom">
|
<a href="https://beian.miit.gov.cn/" target="_blank"
|
||||||
<NuxtLink :to="$localePath('/privacy')">{{
|
>浙ICP备12003709号-5</a
|
||||||
$t('privacy-policy')
|
>
|
||||||
}}</NuxtLink>
|
</p>
|
||||||
<span class="separator">|</span>
|
|
||||||
<NuxtLink :to="$localePath('/terms')">{{
|
|
||||||
$t('terms-of-service')
|
|
||||||
}}</NuxtLink>
|
|
||||||
<span class="separator">|</span>
|
|
||||||
<NuxtLink :to="$localePath('/sitemap')">{{ $t('sitemap') }}</NuxtLink>
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- <div class="footer-links-bottom"> -->
|
||||||
|
<!-- <NuxtLink :to="$localePath('/privacy')">{{ -->
|
||||||
|
<!-- $t('privacy-policy') -->
|
||||||
|
<!-- }}</NuxtLink> -->
|
||||||
|
<!-- <span class="separator">|</span> -->
|
||||||
|
<!-- <NuxtLink :to="$localePath('/terms')">{{ -->
|
||||||
|
<!-- $t('terms-of-service') -->
|
||||||
|
<!-- }}</NuxtLink> -->
|
||||||
|
<!-- <span class="separator">|</span> -->
|
||||||
|
<!-- <NuxtLink :to="$localePath('/sitemap')">{{ $t('sitemap') }}</NuxtLink> -->
|
||||||
|
<!-- </div> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
@ -250,6 +255,10 @@
|
|||||||
|
|
||||||
/* 响应式设计 */
|
/* 响应式设计 */
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
|
.hide-on-mobile {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.footer-container {
|
.footer-container {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
padding: 1.5rem 1rem;
|
padding: 1.5rem 1rem;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<header class="header-container">
|
<header class="header-container">
|
||||||
|
<!-- Logo -->
|
||||||
<div class="logo-section">
|
<div class="logo-section">
|
||||||
<NuxtLink :to="$localePath('/')" class="logo-link">
|
<NuxtLink :to="$localePath('/')" class="logo-link">
|
||||||
<el-image
|
<el-image
|
||||||
@ -11,6 +12,7 @@
|
|||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 桌面菜单 -->
|
||||||
<div class="header-menu-section">
|
<div class="header-menu-section">
|
||||||
<!-- 导航菜单 -->
|
<!-- 导航菜单 -->
|
||||||
<el-menu
|
<el-menu
|
||||||
@ -48,6 +50,7 @@
|
|||||||
</el-link>
|
</el-link>
|
||||||
|
|
||||||
<el-link
|
<el-link
|
||||||
|
class="hide-on-mobile"
|
||||||
type="info"
|
type="info"
|
||||||
:underline="false"
|
:underline="false"
|
||||||
href="http://cal.jinshen.cn"
|
href="http://cal.jinshen.cn"
|
||||||
@ -56,7 +59,7 @@
|
|||||||
<el-icon class="mdi mdi-calculator action-icon" />
|
<el-icon class="mdi mdi-calculator action-icon" />
|
||||||
</el-link>
|
</el-link>
|
||||||
|
|
||||||
<el-dropdown @command="setLocale">
|
<el-dropdown class="hide-on-mobile" @command="setLocale">
|
||||||
<el-link type="info" :underline="false">
|
<el-link type="info" :underline="false">
|
||||||
<el-icon class="mdi mdi-translate action-icon" />
|
<el-icon class="mdi mdi-translate action-icon" />
|
||||||
</el-link>
|
</el-link>
|
||||||
@ -64,9 +67,97 @@
|
|||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item command="zh">简体中文</el-dropdown-item>
|
<el-dropdown-item command="zh">简体中文</el-dropdown-item>
|
||||||
<el-dropdown-item command="en">English</el-dropdown-item>
|
<el-dropdown-item command="en">English</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="es"
|
||||||
|
>Español(Machine Translate)</el-dropdown-item
|
||||||
|
>
|
||||||
|
<el-dropdown-item command="ru"
|
||||||
|
>Русский(Machine Translate)</el-dropdown-item
|
||||||
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
|
||||||
|
<!-- 汉堡按钮(仅移动端显示) -->
|
||||||
|
<el-link type="info" :underline="false">
|
||||||
|
<el-icon
|
||||||
|
class="mdi mdi-menu mobile-menu-button"
|
||||||
|
@click="mobileMenuVisible = true"
|
||||||
|
/>
|
||||||
|
</el-link>
|
||||||
|
|
||||||
|
<!-- Drawer 抽屉菜单 -->
|
||||||
|
<client-only>
|
||||||
|
<el-drawer
|
||||||
|
v-model="mobileMenuVisible"
|
||||||
|
class="mobile-drawer"
|
||||||
|
direction="rtl"
|
||||||
|
size="70%"
|
||||||
|
>
|
||||||
|
<template #header>
|
||||||
|
<div class="drawer-header">
|
||||||
|
<h1>{{ $t('mobile-menu.title') }}</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div>
|
||||||
|
<h2>{{ $t('mobile-menu.navigation') }}</h2>
|
||||||
|
<el-menu
|
||||||
|
:default-active="activeName"
|
||||||
|
class="mobile-menu"
|
||||||
|
mode="vertical"
|
||||||
|
router
|
||||||
|
@select="mobileMenuVisible = false"
|
||||||
|
>
|
||||||
|
<el-menu-item index="products" :route="$localePath('/products')">
|
||||||
|
{{ $t('navigation.products') }}
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item
|
||||||
|
index="solutions"
|
||||||
|
:route="$localePath('/solutions')"
|
||||||
|
>
|
||||||
|
{{ $t('navigation.solutions') }}
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item index="support" :route="$localePath('/support')">
|
||||||
|
{{ $t('navigation.support') }}
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item index="about" :route="$localePath('/about')">
|
||||||
|
{{ $t('navigation.about-us') }}
|
||||||
|
</el-menu-item>
|
||||||
|
</el-menu>
|
||||||
|
|
||||||
|
<h2>{{ $t('mobile-menu.utilities') }}</h2>
|
||||||
|
<el-menu
|
||||||
|
:default-active="activeName"
|
||||||
|
class="mobile-menu"
|
||||||
|
mode="vertical"
|
||||||
|
@select="mobileMenuVisible = false"
|
||||||
|
>
|
||||||
|
<el-menu-item @click="openExternalLink('http://cal.jinshen.cn')">
|
||||||
|
{{ $t('navigation.calculator') }}
|
||||||
|
</el-menu-item>
|
||||||
|
</el-menu>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-dropdown @command="setLocale">
|
||||||
|
<el-link type="info" :underline="false">
|
||||||
|
<el-icon class="mdi mdi-translate mobile-menu-button" />
|
||||||
|
</el-link>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu>
|
||||||
|
<el-dropdown-item command="zh">简体中文</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="en">English</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="es"
|
||||||
|
>Español(Machine Translate)</el-dropdown-item
|
||||||
|
>
|
||||||
|
<el-dropdown-item command="ru"
|
||||||
|
>Русский(Machine Translate)</el-dropdown-item
|
||||||
|
>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
</template>
|
||||||
|
</el-drawer>
|
||||||
|
</client-only>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
</template>
|
</template>
|
||||||
@ -78,6 +169,7 @@
|
|||||||
const { setLocale } = useI18n();
|
const { setLocale } = useI18n();
|
||||||
|
|
||||||
const activeName = ref<string | undefined>(undefined);
|
const activeName = ref<string | undefined>(undefined);
|
||||||
|
const mobileMenuVisible = ref(false);
|
||||||
|
|
||||||
const refreshMenu = () => {
|
const refreshMenu = () => {
|
||||||
const path = router.currentRoute.value.path;
|
const path = router.currentRoute.value.path;
|
||||||
@ -94,6 +186,10 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const openExternalLink = (url: string) => {
|
||||||
|
window.open(url, '_blank');
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
refreshMenu();
|
refreshMenu();
|
||||||
// 监听路由变化以更新激活状态
|
// 监听路由变化以更新激活状态
|
||||||
@ -105,10 +201,10 @@
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.header-container {
|
.header-container {
|
||||||
padding: 0 10px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 80px;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
height: 80px;
|
||||||
|
padding: 0 20px;
|
||||||
border-bottom: 1px solid #e0e0e0;
|
border-bottom: 1px solid #e0e0e0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,4 +263,88 @@
|
|||||||
.action-icon {
|
.action-icon {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mobile-menu-button {
|
||||||
|
display: none; /* 默认隐藏汉堡按钮 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-drawer__header) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-drawer__body) {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-drawer h1 {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-drawer h2 {
|
||||||
|
font-size: 20px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-menu {
|
||||||
|
border: none;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-menu .el-menu-item {
|
||||||
|
font-size: 16px;
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-menu .el-menu-item.is-active {
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-menu .el-menu-item:hover {
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
.header-container {
|
||||||
|
height: 70px;
|
||||||
|
padding: 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.website-logo {
|
||||||
|
height: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-menu-section .header-menu .el-menu-item {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.header-menu-section {
|
||||||
|
display: none; /* 隐藏横向菜单 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide-on-mobile {
|
||||||
|
display: none; /* 隐藏部分图标 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-actions {
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-menu-button {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 24px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -13,22 +13,17 @@
|
|||||||
|
|
||||||
const props = defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
const contentWithAbsoluteUrls = convertMedia(props.content);
|
|
||||||
|
|
||||||
// 将 Markdown 转换成 HTML
|
// 将 Markdown 转换成 HTML
|
||||||
const safeHtml = computed(() => renderMarkdown(contentWithAbsoluteUrls));
|
const safeHtml = computed(() => renderMarkdown(props.content));
|
||||||
// const safeHtml = computed(() => renderMarkdown(props.content))
|
|
||||||
|
|
||||||
const container = ref<HTMLElement | null>(null);
|
const container = ref<HTMLElement | null>(null);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
if (!safeHtml.value) return;
|
if (!safeHtml.value) return;
|
||||||
console.log(safeHtml.value);
|
|
||||||
|
|
||||||
// 查找所有 table
|
// 查找所有 table
|
||||||
const tables = container.value.querySelectorAll('table');
|
const tables = container.value.querySelectorAll('table');
|
||||||
console.log(tables);
|
|
||||||
tables.forEach((table) => {
|
tables.forEach((table) => {
|
||||||
// 1. 提取表头
|
// 1. 提取表头
|
||||||
const headers = Array.from(table.querySelectorAll('thead th')).map(
|
const headers = Array.from(table.querySelectorAll('thead th')).map(
|
||||||
@ -55,8 +50,6 @@
|
|||||||
app.mount(mountPoint);
|
app.mount(mountPoint);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log('Rendered HTML:', safeHtml.value);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@ -61,7 +61,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.product-card .el-image {
|
.product-card .el-image {
|
||||||
height: 150px;
|
width: 100%;
|
||||||
|
aspect-ratio: 16 / 10;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,85 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="question-category">
|
|
||||||
<el-row :gutter="12">
|
|
||||||
<el-col :span="8">
|
|
||||||
<span class="select-label">产品分类</span>
|
|
||||||
<el-select
|
|
||||||
v-model="model.selectedType"
|
|
||||||
placeholder="选择产品类型"
|
|
||||||
clearable
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="type in productTypeOptions"
|
|
||||||
:key="type.id"
|
|
||||||
:label="type.name"
|
|
||||||
:value="type.id"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-col>
|
|
||||||
|
|
||||||
<el-col :span="8">
|
|
||||||
<span class="select-label">产品系列</span>
|
|
||||||
<el-select
|
|
||||||
v-model="model.selectedProduct"
|
|
||||||
placeholder="选择系列产品"
|
|
||||||
clearable
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="product in productOptions"
|
|
||||||
:key="product.id"
|
|
||||||
:label="product.name"
|
|
||||||
:value="product.id"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-col>
|
|
||||||
|
|
||||||
<el-col :span="8">
|
|
||||||
<span class="select-label">关键词</span>
|
|
||||||
<el-input
|
|
||||||
v-model="model.keyword"
|
|
||||||
placeholder="输入关键词..."
|
|
||||||
clearable
|
|
||||||
:prefix-icon="Search"
|
|
||||||
/>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { Search } from '@element-plus/icons-vue';
|
|
||||||
|
|
||||||
defineProps({
|
|
||||||
productTypeOptions: {
|
|
||||||
type: Array as () => Array<{ id: number; name: string }>,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
productOptions: {
|
|
||||||
type: Array as () => Array<{ id: number; name: string }>,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const model = defineModel<{
|
|
||||||
keyword: string;
|
|
||||||
selectedType: number | null;
|
|
||||||
selectedProduct: number | null;
|
|
||||||
}>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.question-category {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.select-label {
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-select__wrapper),
|
|
||||||
:deep(.el-input__wrapper) {
|
|
||||||
height: 40px;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,25 +1,76 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="question-list">
|
<div class="question-list">
|
||||||
<el-collapse class="question-collapse" accordion>
|
<el-collapse v-model="activeNames" class="question-collapse">
|
||||||
<el-collapse-item
|
<el-collapse-item
|
||||||
v-for="question in questions"
|
v-for="question in questions"
|
||||||
|
:id="`q-${question.id}`"
|
||||||
:key="question.id"
|
:key="question.id"
|
||||||
:title="question.title"
|
:title="question.title"
|
||||||
:name="question.id"
|
:name="question.id"
|
||||||
>
|
>
|
||||||
<markdown-renderer :content="question.content || ''" />
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||||
|
<div class="html-typography" v-html="question.content || ''" />
|
||||||
|
<!-- <div v-if="!hydrated" v-html="question.content" /> -->
|
||||||
|
<!-- <div v-else> -->
|
||||||
|
<!-- <html-renderer -->
|
||||||
|
<!-- class="html-typography" -->
|
||||||
|
<!-- :html="question.content || ''" -->
|
||||||
|
<!-- /> -->
|
||||||
|
<!-- </div> -->
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineProps({
|
const props = defineProps({
|
||||||
questions: {
|
questions: {
|
||||||
type: Array as PropType<ProductQuestionView[]>,
|
type: Array as PropType<ProductQuestionView[]>,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
const activeNames = ref<(string | number)[]>([]);
|
||||||
|
|
||||||
|
const hydrated = ref(false);
|
||||||
|
|
||||||
|
// 当路由变化(包括初次挂载)时,检查是否需要聚焦
|
||||||
|
watch(
|
||||||
|
() => route.query.focus,
|
||||||
|
async (focusId) => {
|
||||||
|
if (!focusId) return;
|
||||||
|
if (!import.meta.client) return;
|
||||||
|
|
||||||
|
// 确保渲染完成后再操作 DOM
|
||||||
|
await nextTick();
|
||||||
|
|
||||||
|
const target = props.questions.find((q) => q.id === focusId);
|
||||||
|
if (!target) return;
|
||||||
|
|
||||||
|
// 展开目标项
|
||||||
|
activeNames.value = [target.id];
|
||||||
|
|
||||||
|
await nextTick();
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 100)); // 等待动画完成
|
||||||
|
|
||||||
|
// 平滑滚动到对应位置
|
||||||
|
// const el = document.querySelector(`#q-${target.id}`);
|
||||||
|
// el?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||||
|
setTimeout(() => {
|
||||||
|
const el = document.querySelector(`#q-${target.id}`);
|
||||||
|
el?.scrollIntoView({
|
||||||
|
behavior: 'smooth',
|
||||||
|
block: 'start',
|
||||||
|
});
|
||||||
|
}, 200); // 与 el-collapse 的 transition 时间匹配
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
hydrated.value = true;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -67,7 +67,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.solution-card .el-image {
|
.solution-card .el-image {
|
||||||
height: 250px;
|
width: 100%;
|
||||||
|
aspect-ratio: 16 / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1200px) {
|
@media (max-width: 1200px) {
|
||||||
|
|||||||
@ -1,29 +1,17 @@
|
|||||||
import { readSingleton } from '@directus/sdk';
|
|
||||||
|
|
||||||
export const useCompanyProfile = () => {
|
export const useCompanyProfile = () => {
|
||||||
const { $directus } = useNuxtApp();
|
|
||||||
const { getDirectusLocale } = useLocalizations();
|
const { getDirectusLocale } = useLocalizations();
|
||||||
const locale = getDirectusLocale();
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
return useAsyncData(`company-profile-${locale}`, async () => {
|
return useAsyncData(`company-profile-${locale}`, async () => {
|
||||||
return await $directus.request(
|
try {
|
||||||
readSingleton('company_profile', {
|
const data = await $fetch(`/api/cms/companyProfile`, {
|
||||||
fields: [
|
headers: { 'x-locale': locale },
|
||||||
'id',
|
});
|
||||||
{
|
|
||||||
translations: ['id', 'content'],
|
return data;
|
||||||
},
|
} catch (error) {
|
||||||
],
|
logger.error('Error fetching company profile: ', error);
|
||||||
deep: {
|
throw error;
|
||||||
translations: {
|
}
|
||||||
_filter: {
|
|
||||||
languages_code: {
|
|
||||||
_eq: locale,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,29 +1,17 @@
|
|||||||
import { readSingleton } from '@directus/sdk';
|
|
||||||
|
|
||||||
export const useContactInfo = () => {
|
export const useContactInfo = () => {
|
||||||
const { $directus } = useNuxtApp();
|
|
||||||
const { getDirectusLocale } = useLocalizations();
|
const { getDirectusLocale } = useLocalizations();
|
||||||
const locale = getDirectusLocale();
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
return useAsyncData(`contact-info-${locale}`, async () => {
|
return useAsyncData(`contact-info-${locale}`, async () => {
|
||||||
return await $directus.request(
|
try {
|
||||||
readSingleton('contact_info', {
|
const data = await $fetch('/api/cms/contactInfo', {
|
||||||
fields: [
|
headers: { 'x-locale': locale },
|
||||||
'id',
|
});
|
||||||
{
|
|
||||||
translations: ['id', 'content'],
|
return data;
|
||||||
},
|
} catch (error) {
|
||||||
],
|
logger.error('Error fetching contact info: ', error);
|
||||||
deep: {
|
throw error;
|
||||||
translations: {
|
}
|
||||||
_filter: {
|
|
||||||
languages_code: {
|
|
||||||
_eq: locale,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,19 +1,14 @@
|
|||||||
export const useDirectusFiles = () => {
|
export const useDirectusFiles = () => {
|
||||||
const config = useRuntimeConfig();
|
|
||||||
const baseUrl = config.public.directus.url;
|
|
||||||
|
|
||||||
const getFileUrl = (
|
const getFileUrl = (
|
||||||
id?: string | null,
|
id?: string | null,
|
||||||
options?: Record<string, string | number | boolean>
|
options?: Record<string, string | number | boolean>
|
||||||
): string => {
|
): string => {
|
||||||
if (!id) return '';
|
if (!id) return '';
|
||||||
const query = options
|
|
||||||
? '?' +
|
const params = new URLSearchParams(
|
||||||
new URLSearchParams(
|
options as Record<string, string>
|
||||||
Object.entries(options).map(([key, value]) => [key, String(value)])
|
).toString();
|
||||||
).toString()
|
return `/api/assets/${id}${params ? `?${params}` : ''}`;
|
||||||
: '';
|
|
||||||
return `${baseUrl}/assets/${id}${query}`;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
export const useDirectusImage = () => {
|
export const useDirectusImage = () => {
|
||||||
const config = useRuntimeConfig();
|
|
||||||
const baseUrl = config.public.directus.url;
|
|
||||||
const token = config.public.directus.token;
|
|
||||||
|
|
||||||
type DirectusAssetParams = {
|
type DirectusAssetParams = {
|
||||||
width?: number;
|
width?: number;
|
||||||
height?: number;
|
height?: number;
|
||||||
@ -13,19 +9,11 @@ export const useDirectusImage = () => {
|
|||||||
|
|
||||||
const getImageUrl = (id?: string | null, options?: DirectusAssetParams) => {
|
const getImageUrl = (id?: string | null, options?: DirectusAssetParams) => {
|
||||||
if (!id) return '';
|
if (!id) return '';
|
||||||
const queryToken = token ? 'access_token=' + token : '';
|
|
||||||
const queryOptions = options
|
const params = new URLSearchParams(
|
||||||
? new URLSearchParams(
|
options as Record<string, string>
|
||||||
Object.fromEntries(
|
).toString();
|
||||||
Object.entries(options).map(([key, value]) => [key, String(value)])
|
return `/api/assets/${id}${params ? `?${params}` : ''}`;
|
||||||
)
|
|
||||||
).toString
|
|
||||||
: '';
|
|
||||||
const query =
|
|
||||||
queryToken || queryOptions
|
|
||||||
? `?${[queryToken, queryOptions].filter(Boolean).join('&')}`
|
|
||||||
: '';
|
|
||||||
return `${baseUrl}/assets/${id}${query}`;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return { getImageUrl };
|
return { getImageUrl };
|
||||||
|
|||||||
@ -1,67 +1,17 @@
|
|||||||
import { readItems } from '@directus/sdk';
|
|
||||||
|
|
||||||
export const useDocumentList = () => {
|
export const useDocumentList = () => {
|
||||||
const { $directus } = useNuxtApp();
|
|
||||||
const { getDirectusLocale } = useLocalizations();
|
const { getDirectusLocale } = useLocalizations();
|
||||||
const locale = getDirectusLocale();
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
return useAsyncData(`document-list-${locale}`, async () => {
|
return useAsyncData(`document-list-${locale}`, async () => {
|
||||||
return await $directus.request(
|
try {
|
||||||
readItems('product_documents', {
|
const data = $fetch(`/api/cms/documentList`, {
|
||||||
fields: [
|
headers: { 'x-locale': locale },
|
||||||
'id',
|
});
|
||||||
{
|
|
||||||
file: ['id', 'filesize', 'filename_download'],
|
return data;
|
||||||
},
|
} catch (error) {
|
||||||
{
|
logger.error('Error fetching document list:', error);
|
||||||
translations: ['id', 'title'],
|
throw error;
|
||||||
},
|
}
|
||||||
{
|
|
||||||
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 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,54 +1,17 @@
|
|||||||
import { readSingleton } from '@directus/sdk';
|
|
||||||
|
|
||||||
export const useHomepage = () => {
|
export const useHomepage = () => {
|
||||||
const { $directus } = useNuxtApp();
|
|
||||||
const { getDirectusLocale } = useLocalizations();
|
const { getDirectusLocale } = useLocalizations();
|
||||||
const locale = getDirectusLocale();
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
return useAsyncData(`homepage-${locale}`, async () => {
|
return useAsyncData(`homepage-${locale}`, async () => {
|
||||||
return await $directus.request(
|
try {
|
||||||
readSingleton('homepage', {
|
const data = $fetch(`/api/cms/homepage`, {
|
||||||
fields: [
|
headers: { 'x-locale': locale },
|
||||||
'id',
|
});
|
||||||
{
|
|
||||||
carousel: ['id', 'directus_files_id'],
|
return data;
|
||||||
},
|
} catch (error) {
|
||||||
{
|
logger.error('Error fetching homepage:', error);
|
||||||
recommend_products: [
|
throw error;
|
||||||
'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 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,111 +1,17 @@
|
|||||||
import { readItem } from '@directus/sdk';
|
|
||||||
|
|
||||||
export const useProduct = (id: string) => {
|
export const useProduct = (id: string) => {
|
||||||
const { $directus } = useNuxtApp();
|
|
||||||
|
|
||||||
const { getDirectusLocale } = useLocalizations();
|
const { getDirectusLocale } = useLocalizations();
|
||||||
const locale = getDirectusLocale();
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
return useAsyncData(`product-${id}-${locale}`, async () => {
|
return useAsyncData(`product-${id}-${locale}`, async () => {
|
||||||
return await $directus.request(
|
try {
|
||||||
readItem('products', id, {
|
const data = await $fetch(`/api/cms/product/${id}`, {
|
||||||
fields: [
|
headers: { 'x-locale': locale },
|
||||||
'id',
|
});
|
||||||
{ translations: ['id', 'name', 'summary', 'description'] },
|
|
||||||
{
|
return data;
|
||||||
images: [
|
} catch (error) {
|
||||||
'id',
|
logger.error('Error fetching product: ', error);
|
||||||
{
|
throw error;
|
||||||
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 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,42 +1,17 @@
|
|||||||
import { readItems } from '@directus/sdk';
|
|
||||||
|
|
||||||
export const useProductList = () => {
|
export const useProductList = () => {
|
||||||
const { $directus } = useNuxtApp();
|
|
||||||
|
|
||||||
const { getDirectusLocale } = useLocalizations();
|
const { getDirectusLocale } = useLocalizations();
|
||||||
const locale = getDirectusLocale();
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
return useAsyncData(`product-list-${locale}`, async () => {
|
return useAsyncData(`product-list-${locale}`, async () => {
|
||||||
return await $directus.request(
|
try {
|
||||||
readItems('products', {
|
const data = await $fetch(`/api/cms/productList`, {
|
||||||
fields: [
|
headers: { 'x-locale': locale },
|
||||||
'id',
|
});
|
||||||
{ translations: ['id', 'name', 'summary'] },
|
|
||||||
'cover',
|
return data;
|
||||||
{
|
} catch (error) {
|
||||||
product_type: [
|
logger.error('Error fetching product list: ', error);
|
||||||
'id',
|
throw error;
|
||||||
{
|
}
|
||||||
translations: ['id', 'name'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
deep: {
|
|
||||||
translations: {
|
|
||||||
_filter: {
|
|
||||||
languages_code: { _eq: locale },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
product_type: {
|
|
||||||
translations: {
|
|
||||||
_filter: {
|
|
||||||
languages_code: { _eq: locale },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,63 +1,17 @@
|
|||||||
import { readItems } from '@directus/sdk';
|
|
||||||
|
|
||||||
export const useQuestionList = () => {
|
export const useQuestionList = () => {
|
||||||
const { $directus } = useNuxtApp();
|
|
||||||
|
|
||||||
const { getDirectusLocale } = useLocalizations();
|
const { getDirectusLocale } = useLocalizations();
|
||||||
const locale = getDirectusLocale();
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
return useAsyncData(`question-list-${locale}`, async () => {
|
return useAsyncData(`question-list-${locale}`, async () => {
|
||||||
return await $directus.request(
|
try {
|
||||||
readItems('questions', {
|
const data = $fetch(`/api/cms/questionList`, {
|
||||||
fields: [
|
headers: { 'x-locale': locale },
|
||||||
'id',
|
});
|
||||||
{
|
|
||||||
translations: ['*'],
|
return data;
|
||||||
},
|
} catch (error) {
|
||||||
{
|
logger.error('Error fetching question list:', error);
|
||||||
products: [
|
throw error;
|
||||||
'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 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,28 +1,17 @@
|
|||||||
import { readItem } from '@directus/sdk';
|
|
||||||
|
|
||||||
export const useSolution = (id: string) => {
|
export const useSolution = (id: string) => {
|
||||||
const { $directus } = useNuxtApp();
|
|
||||||
const { getDirectusLocale } = useLocalizations();
|
const { getDirectusLocale } = useLocalizations();
|
||||||
const locale = getDirectusLocale();
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
return useAsyncData(`solution-${id}-${locale}`, async () => {
|
return useAsyncData(`solution-${id}-${locale}`, async () => {
|
||||||
return await $directus.request(
|
try {
|
||||||
readItem('solutions', id, {
|
const data = await $fetch(`/api/cms/solution/${id}`, {
|
||||||
fields: [
|
headers: { 'x-locale': locale },
|
||||||
'id',
|
});
|
||||||
{
|
|
||||||
translations: ['*'],
|
return data;
|
||||||
},
|
} catch (error) {
|
||||||
'create_at',
|
logger.error('Error fetching solution: ', error);
|
||||||
],
|
throw error;
|
||||||
deep: {
|
}
|
||||||
translations: {
|
|
||||||
_filter: {
|
|
||||||
languages_code: { _eq: locale },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,38 +1,17 @@
|
|||||||
import { readItems } from '@directus/sdk';
|
|
||||||
|
|
||||||
export const useSolutionList = () => {
|
export const useSolutionList = () => {
|
||||||
const { $directus } = useNuxtApp();
|
|
||||||
const { getDirectusLocale } = useLocalizations();
|
const { getDirectusLocale } = useLocalizations();
|
||||||
const locale = getDirectusLocale();
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
return useAsyncData(`solution-list-${locale}`, async () => {
|
return useAsyncData(`solution-list-${locale}`, async () => {
|
||||||
return await $directus.request(
|
try {
|
||||||
readItems('solutions', {
|
const data = $fetch(`/api/cms/solutionList`, {
|
||||||
fields: [
|
headers: { 'x-locale': locale },
|
||||||
'id',
|
});
|
||||||
'cover',
|
|
||||||
{
|
return data;
|
||||||
type: ['id', { translations: ['id', 'name'] }],
|
} catch (error) {
|
||||||
},
|
logger.error('Error fetching solution list:', error);
|
||||||
{
|
throw error;
|
||||||
translations: ['id', 'title', 'summary'],
|
}
|
||||||
},
|
|
||||||
],
|
|
||||||
deep: {
|
|
||||||
type: {
|
|
||||||
translations: {
|
|
||||||
_filter: {
|
|
||||||
languages_code: { _eq: locale },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
translations: {
|
|
||||||
_filter: {
|
|
||||||
languages_code: { _eq: locale },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,3 +1,2 @@
|
|||||||
export * from './directus';
|
export * from './directus';
|
||||||
export * from './useLocalizations';
|
export * from './useLocalizations';
|
||||||
export * from './useMeilisearch';
|
|
||||||
|
|||||||
80
app/composables/useHtmlRenderer.ts
Normal file
80
app/composables/useHtmlRenderer.ts
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
import { h, type VNode } from 'vue';
|
||||||
|
import { parseDocument } from 'htmlparser2';
|
||||||
|
import type { Element, Text, Node } from 'domhandler';
|
||||||
|
|
||||||
|
/** 标签映射的类型:key=标签名,value=渲染函数 */
|
||||||
|
export type HtmlRenderMap = Record<
|
||||||
|
string,
|
||||||
|
(node: Element, children: VNode[]) => VNode
|
||||||
|
>;
|
||||||
|
|
||||||
|
export interface HtmlRenderOptions {
|
||||||
|
/** 自定义标签渲染映射 */
|
||||||
|
map?: HtmlRenderMap;
|
||||||
|
|
||||||
|
/** 默认是否将未知标签渲染为原生标签(默认 true) */
|
||||||
|
allowUnknownTags?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useHtmlRenderer = (
|
||||||
|
html: string,
|
||||||
|
options: HtmlRenderOptions = {}
|
||||||
|
) => {
|
||||||
|
const { map = {}, allowUnknownTags = true } = options;
|
||||||
|
|
||||||
|
const doc = parseDocument(html);
|
||||||
|
|
||||||
|
function render(node: Node): VNode | string | null {
|
||||||
|
// 文本节点
|
||||||
|
if (node.type === 'text') {
|
||||||
|
const textNode = node as Text;
|
||||||
|
const content = textNode.data;
|
||||||
|
|
||||||
|
// ❗忽略"纯空白" 文本(换行、空格)
|
||||||
|
if (!content || /^\s+$/.test(content)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标签节点
|
||||||
|
if (node.type === 'tag') {
|
||||||
|
const elem = node as Element;
|
||||||
|
const rawName = elem.name ?? '';
|
||||||
|
const name = rawName.trim().toLowerCase();
|
||||||
|
|
||||||
|
// 标签名有效性校验
|
||||||
|
const isValidTag = /^[a-zA-Z][a-zA-Z0-9-]*$/.test(name);
|
||||||
|
if (!isValidTag) {
|
||||||
|
logger.warn(`Invalid tag name ignored: "${rawName}"`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const children: VNode[] = (elem.children || [])
|
||||||
|
.map((child) => render(child))
|
||||||
|
.filter(Boolean) as VNode[];
|
||||||
|
|
||||||
|
// 自定义映射
|
||||||
|
if (map[name]) {
|
||||||
|
return map[name](elem, children);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 默认将未知标签渲染为原生标签
|
||||||
|
if (allowUnknownTags) {
|
||||||
|
return h(name, elem.attribs || {}, children);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 忽略无法渲染节点
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nodes = doc.children
|
||||||
|
.map((child) => render(child))
|
||||||
|
.filter(Boolean) as VNode[];
|
||||||
|
|
||||||
|
return nodes;
|
||||||
|
};
|
||||||
@ -1,15 +1,14 @@
|
|||||||
import type { StrapiLocale } from '@nuxtjs/strapi';
|
|
||||||
import type { Language as ElementLanguage } from 'element-plus/es/locale';
|
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';
|
||||||
|
import es from 'element-plus/es/locale/lang/es';
|
||||||
|
import ru from 'element-plus/es/locale/lang/ru';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用语言映射结构
|
* 应用语言映射结构
|
||||||
* 用于统一 Strapi / Directus / Element Plus 的多语言配置
|
* 用于统一 Strapi / Directus / Element Plus 的多语言配置
|
||||||
*/
|
*/
|
||||||
export interface LocaleMapping {
|
export interface LocaleMapping {
|
||||||
/** 用于StrapiLocale **/
|
|
||||||
strapi: StrapiLocale;
|
|
||||||
/** 用于Directus translations.languages_code **/
|
/** 用于Directus translations.languages_code **/
|
||||||
directus: string;
|
directus: string;
|
||||||
/** Element Plus语言对象 **/
|
/** Element Plus语言对象 **/
|
||||||
@ -24,15 +23,21 @@ export interface LocaleMapping {
|
|||||||
*/
|
*/
|
||||||
export const localeMap = {
|
export const localeMap = {
|
||||||
zh: {
|
zh: {
|
||||||
strapi: 'zh-CN',
|
|
||||||
directus: 'zh-CN',
|
directus: 'zh-CN',
|
||||||
element: zhCn,
|
element: zhCn,
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
strapi: 'en',
|
|
||||||
directus: 'en-US',
|
directus: 'en-US',
|
||||||
element: en,
|
element: en,
|
||||||
},
|
},
|
||||||
|
es: {
|
||||||
|
directus: 'es-ES',
|
||||||
|
element: es,
|
||||||
|
},
|
||||||
|
ru: {
|
||||||
|
directus: 'ru-RU',
|
||||||
|
element: ru,
|
||||||
|
},
|
||||||
} satisfies Record<string, LocaleMapping>;
|
} satisfies Record<string, LocaleMapping>;
|
||||||
|
|
||||||
/** 应用支持的语言键类型 **/
|
/** 应用支持的语言键类型 **/
|
||||||
@ -74,8 +79,6 @@ export const useLocalizations = () => {
|
|||||||
return {
|
return {
|
||||||
/** 当前Nuxt I18n语言(只读) **/
|
/** 当前Nuxt I18n语言(只读) **/
|
||||||
locale: readonly(locale),
|
locale: readonly(locale),
|
||||||
/** 获取Strapi的本地化代码 **/
|
|
||||||
getStrapiLocale: (l?: AppLocale) => getMapping(l).strapi,
|
|
||||||
/** 获取Directus的本地化代码 **/
|
/** 获取Directus的本地化代码 **/
|
||||||
getDirectusLocale: (l?: AppLocale) => getMapping(l).directus,
|
getDirectusLocale: (l?: AppLocale) => getMapping(l).directus,
|
||||||
/** 获取Element Plus语言对象 **/
|
/** 获取Element Plus语言对象 **/
|
||||||
|
|||||||
@ -1,137 +0,0 @@
|
|||||||
import { MeiliSearch } from 'meilisearch';
|
|
||||||
import type { SearchParams } from 'meilisearch';
|
|
||||||
|
|
||||||
const parseIndexes = (
|
|
||||||
indexes: string | string[] | undefined,
|
|
||||||
locale?: string
|
|
||||||
): string[] => {
|
|
||||||
if (!indexes) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
let suffix = '';
|
|
||||||
if (locale) {
|
|
||||||
suffix = `_${locale}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Array.isArray(indexes)) {
|
|
||||||
return indexes.map((item) => `${item.trim()}${suffix}`).filter(Boolean);
|
|
||||||
}
|
|
||||||
return indexes
|
|
||||||
.split(',')
|
|
||||||
.map((item) => `${item.trim()}${suffix}`)
|
|
||||||
.filter(Boolean);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const useMeilisearch = () => {
|
|
||||||
const runtimeConfig = useRuntimeConfig();
|
|
||||||
|
|
||||||
const indexes = computed(() =>
|
|
||||||
parseIndexes(runtimeConfig.public?.meili?.indexes)
|
|
||||||
);
|
|
||||||
|
|
||||||
let meiliClient: MeiliSearch | null = null;
|
|
||||||
|
|
||||||
const ensureClient = () => {
|
|
||||||
if (meiliClient) return meiliClient;
|
|
||||||
|
|
||||||
const host = runtimeConfig.public?.meili?.host;
|
|
||||||
if (!host) {
|
|
||||||
console.warn('Meilisearch host is not configured.');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const apiKey = runtimeConfig.public?.meili?.searchKey;
|
|
||||||
meiliClient = new MeiliSearch({
|
|
||||||
host,
|
|
||||||
apiKey: apiKey || undefined,
|
|
||||||
});
|
|
||||||
return meiliClient;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 泛型搜索函数
|
|
||||||
* @template T 文档类型, 如 MeiliProductIndex
|
|
||||||
* ---
|
|
||||||
* @param query 搜索关键词
|
|
||||||
* @param params 其他搜索参数
|
|
||||||
* @returns 搜索结果数组
|
|
||||||
*/
|
|
||||||
async function search<
|
|
||||||
K extends MeiliSearchItemType = MeiliSearchItemType,
|
|
||||||
T extends MeiliIndexMap[K] = MeiliIndexMap[K],
|
|
||||||
>(
|
|
||||||
query: string,
|
|
||||||
params: SearchParams = {},
|
|
||||||
searchLocale?: string
|
|
||||||
): Promise<SearchSection<T>[]> {
|
|
||||||
const trimmedQuery = query.trim();
|
|
||||||
if (!trimmedQuery) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const client = ensureClient();
|
|
||||||
if (!client) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const activeIndexes = indexes.value as K[];
|
|
||||||
if (!activeIndexes.length) {
|
|
||||||
console.warn('No Meilisearch indexes configured.');
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const rawIndexMap = Object.fromEntries(
|
|
||||||
activeIndexes.map((index) => [`${index}_${searchLocale}`, index])
|
|
||||||
);
|
|
||||||
const indexesWithLocale = activeIndexes.map(
|
|
||||||
(index) => index + (searchLocale ? `_${searchLocale}` : '')
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(indexesWithLocale);
|
|
||||||
|
|
||||||
const requests = indexesWithLocale.map(async (indexUid) => {
|
|
||||||
const response = await client.index(indexUid).search<T>(trimmedQuery, {
|
|
||||||
limit: params.limit ?? 10,
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
indexUid,
|
|
||||||
response,
|
|
||||||
} satisfies RawSearchSection<T>;
|
|
||||||
});
|
|
||||||
|
|
||||||
const settled = await Promise.allSettled(requests);
|
|
||||||
|
|
||||||
console.log('Meilisearch settled results:', settled);
|
|
||||||
|
|
||||||
settled
|
|
||||||
.filter(
|
|
||||||
(result): result is PromiseRejectedResult =>
|
|
||||||
result.status === 'rejected'
|
|
||||||
)
|
|
||||||
.forEach((result) => {
|
|
||||||
console.error('Meilisearch query failed', result.reason);
|
|
||||||
});
|
|
||||||
|
|
||||||
return settled
|
|
||||||
.filter(
|
|
||||||
(result): result is PromiseFulfilledResult<RawSearchSection<T>> =>
|
|
||||||
result.status === 'fulfilled'
|
|
||||||
)
|
|
||||||
.map((result) => {
|
|
||||||
const { indexUid, response } = result.value;
|
|
||||||
return {
|
|
||||||
indexUid: indexUid,
|
|
||||||
rawIndex: rawIndexMap[indexUid],
|
|
||||||
hits: response.hits,
|
|
||||||
estimatedTotalHits:
|
|
||||||
response.estimatedTotalHits ?? response.hits.length,
|
|
||||||
processingTimeMs: response.processingTimeMs ?? 0,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
search,
|
|
||||||
indexes,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
47
app/composables/usePageSeo.ts
Normal file
47
app/composables/usePageSeo.ts
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
* 设置页面级 SEO 元数据(包含 title、description、OG/Twitter 等常用字段)。
|
||||||
|
*
|
||||||
|
* 该函数基于 `useSeoMeta` 封装,可用于 Nuxt 3 / Nuxt 4
|
||||||
|
* 配合 SSR/CSR 动态更新,可安全用于异步数据场景(如 CMS 内容页)。
|
||||||
|
*
|
||||||
|
* @param {Object} meta - 页面 SEO 配置对象
|
||||||
|
* @param {string} meta.title - 页面标题(会同时应用到 title / og:title)
|
||||||
|
* @param {string} [meta.description] - 页面描述(会应用到 description / og:description)
|
||||||
|
* @param {string} [meta.image] - 用于分享卡片的预览图(og:image / twitter:image)
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // 用于普通页面
|
||||||
|
* usePageSeo({
|
||||||
|
* title: '产品中心 - 金申机械',
|
||||||
|
* description: '查看全系列纸管机械产品',
|
||||||
|
* image: '/images/og/products.png'
|
||||||
|
* })
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // 用于动态内容(如产品详情页)
|
||||||
|
* const product = await fetchProduct()
|
||||||
|
* usePageSeo({
|
||||||
|
* title: product.name,
|
||||||
|
* description: product.summary,
|
||||||
|
* image: product.coverImage
|
||||||
|
* })
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* - 自动生成以下 meta:`title`, `description`, `og:title`, `og:description`, `og:image`, `twitter:card`
|
||||||
|
* - 默认使用 `summary_large_image` 作为 Twitter 卡片类型
|
||||||
|
* - 推荐与 `useHead()` 配合增加 canonical / alternate hreflang 等额外 SEO 标签
|
||||||
|
*/
|
||||||
|
export function usePageSeo(meta: {
|
||||||
|
title: string;
|
||||||
|
description?: string;
|
||||||
|
image?: string;
|
||||||
|
}) {
|
||||||
|
useSeoMeta({
|
||||||
|
title: meta.title,
|
||||||
|
ogTitle: meta.title,
|
||||||
|
description: meta.description,
|
||||||
|
ogDescription: meta.description,
|
||||||
|
ogImage: meta.image,
|
||||||
|
twitterCard: 'summary_large_image',
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -12,6 +12,17 @@
|
|||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
useHead(() => {
|
||||||
|
const siteTitle = t('company-name');
|
||||||
|
return {
|
||||||
|
titleTemplate: (title) => (title ? `${title} - ${siteTitle}` : siteTitle),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.app-container {
|
.app-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -3,3 +3,14 @@
|
|||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
useHead(() => {
|
||||||
|
const siteTitle = `${$t('page-title.preview')} - ${t('company-name')}`;
|
||||||
|
return {
|
||||||
|
title: siteTitle,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,79 +0,0 @@
|
|||||||
/**
|
|
||||||
* 将 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,
|
|
||||||
fileId: fileId,
|
|
||||||
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,
|
|
||||||
fileId: fileId,
|
|
||||||
filename: file.filename_download,
|
|
||||||
title: trans.title,
|
|
||||||
url: url,
|
|
||||||
size: file.filesize,
|
|
||||||
products: related_products,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,134 +0,0 @@
|
|||||||
/**
|
|
||||||
* 将 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,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
/**
|
|
||||||
* 将 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,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
/**
|
|
||||||
* 将 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,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
/**
|
|
||||||
* 文档视图模型
|
|
||||||
* 用于文档列表渲染的数据结构
|
|
||||||
*/
|
|
||||||
export interface ProductDocumentView {
|
|
||||||
/** 唯一标识符 **/
|
|
||||||
id: number;
|
|
||||||
|
|
||||||
/** 文件UUID **/
|
|
||||||
fileId: string;
|
|
||||||
|
|
||||||
/** 文件名 **/
|
|
||||||
filename: string;
|
|
||||||
|
|
||||||
/** 文档标题 **/
|
|
||||||
title: string;
|
|
||||||
|
|
||||||
/** 文档大小 **/
|
|
||||||
size: number;
|
|
||||||
|
|
||||||
/** 文档链接 **/
|
|
||||||
url: string;
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
/**
|
|
||||||
* 常见问题视图模型
|
|
||||||
* 用于产品页常见问题渲染的数据结构
|
|
||||||
*/
|
|
||||||
export interface ProductQuestionView {
|
|
||||||
/** 唯一标识符 **/
|
|
||||||
id: number;
|
|
||||||
|
|
||||||
/** 问题标题 **/
|
|
||||||
title: string;
|
|
||||||
|
|
||||||
/** 问题内容 **/
|
|
||||||
content: string;
|
|
||||||
}
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
/**
|
|
||||||
* 产品规格模型
|
|
||||||
* 用于产品规格渲染的数据结构
|
|
||||||
*/
|
|
||||||
export interface ProductSpecView {
|
|
||||||
/** 唯一标识符 **/
|
|
||||||
id: number;
|
|
||||||
|
|
||||||
/** 规格名称 **/
|
|
||||||
key: string;
|
|
||||||
|
|
||||||
/** 规格值 **/
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 产品规格表模型
|
|
||||||
* 用于产品规格表渲染的数据结构
|
|
||||||
*/
|
|
||||||
export interface ProductSpecGroupView {
|
|
||||||
/** 唯一标识符 **/
|
|
||||||
id: number;
|
|
||||||
|
|
||||||
/** 规格组名称 **/
|
|
||||||
name: string;
|
|
||||||
|
|
||||||
/** 规格组 **/
|
|
||||||
specs: ProductSpecView[];
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
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[];
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
export interface SearchItemView {
|
|
||||||
/** 唯一标识符 **/
|
|
||||||
id: number;
|
|
||||||
|
|
||||||
/** 条目类型 **/
|
|
||||||
type: 'product' | 'solution' | 'question' | 'document';
|
|
||||||
|
|
||||||
/** 条目标题 **/
|
|
||||||
title: string;
|
|
||||||
|
|
||||||
/** 条目摘要 **/
|
|
||||||
summary?: string;
|
|
||||||
}
|
|
||||||
@ -1,46 +1,70 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<div v-if="!pending">
|
|
||||||
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<markdown-renderer :content="content.content || ''" />
|
<el-skeleton :loading="pending" :rows="10" animated>
|
||||||
</div>
|
<template #default>
|
||||||
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||||
|
<div class="html-typography" v-html="companyProfile?.content || ''" />
|
||||||
|
<!-- <div v-if="!hydrated" v-html="companyProfile.content || ''" /> -->
|
||||||
|
<!-- <div v-else> -->
|
||||||
|
<!-- <html-renderer -->
|
||||||
|
<!-- class="html-typography" -->
|
||||||
|
<!-- :html="companyProfile.content || ''" -->
|
||||||
|
<!-- /> -->
|
||||||
|
<!-- </div> -->
|
||||||
|
|
||||||
<el-divider content-position="left">更多信息</el-divider>
|
<el-divider content-position="left">{{
|
||||||
|
$t('learn-more')
|
||||||
|
}}</el-divider>
|
||||||
<div class="button-group">
|
<div class="button-group">
|
||||||
<NuxtLink :to="$localePath('/support/contact-us')">
|
<learn-more-card
|
||||||
<el-card class="card-button">
|
:title="$t('navigation.contact-info')"
|
||||||
<el-icon class="icon" size="80">
|
:icon="ElIconService"
|
||||||
<ElIconService />
|
:to="$localePath('/support/contact-us')"
|
||||||
</el-icon>
|
/>
|
||||||
<br />
|
<learn-more-card
|
||||||
联系信息
|
:title="$t('navigation.address')"
|
||||||
</el-card>
|
:icon="ElIconMapLocation"
|
||||||
</NuxtLink>
|
@click="openMap"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
<div v-else class="loading">
|
</el-skeleton>
|
||||||
<el-skeleton :rows="5" animated />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const localePath = useLocalePath();
|
const localePath = useLocalePath();
|
||||||
|
const hydrated = ref(false);
|
||||||
const breadcrumbItems = [
|
const breadcrumbItems = [
|
||||||
{ label: $t('navigation.home'), to: localePath('/') },
|
{ label: $t('navigation.home'), to: localePath('/') },
|
||||||
{ label: $t('navigation.about-us') },
|
{ label: $t('navigation.about-us') },
|
||||||
];
|
];
|
||||||
const { data, pending, error } = await useCompanyProfile();
|
const { data, pending, error } = useCompanyProfile();
|
||||||
|
|
||||||
const content = computed(() => toCompanyProfileView(data.value));
|
const companyProfile = computed(() => data.value ?? null);
|
||||||
|
|
||||||
|
const openMap = () => {
|
||||||
|
window.open(localePath('/locate'));
|
||||||
|
};
|
||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
console.error('数据获取失败: ', value);
|
logger.error('数据获取失败: ', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pageTitle = computed(() => $t('page-title.about-us'));
|
||||||
|
useHead({
|
||||||
|
title: pageTitle,
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
hydrated.value = true;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -59,14 +83,6 @@
|
|||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.markdown-body p) {
|
|
||||||
text-indent: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.markdown-body h2) {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-divider__text) {
|
:deep(.el-divider__text) {
|
||||||
color: var(--el-color-info);
|
color: var(--el-color-info);
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
@ -77,25 +93,7 @@
|
|||||||
justify-content: left;
|
justify-content: left;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-left: 2rem;
|
margin-left: 2rem;
|
||||||
}
|
gap: 2rem;
|
||||||
|
|
||||||
.card-button {
|
|
||||||
width: 20%;
|
|
||||||
min-width: 200px;
|
|
||||||
padding: 20px;
|
|
||||||
margin: 0 auto;
|
|
||||||
cursor: pointer;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-button:hover {
|
|
||||||
transform: translateY(-4px);
|
|
||||||
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
padding: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading {
|
.loading {
|
||||||
@ -104,4 +102,16 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.button-group {
|
||||||
|
align-items: center;
|
||||||
|
margin-left: 0;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,14 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1 class="page-title">文件下载</h1>
|
<h1 class="page-title">{{ $t('navigation.downloads') }}</h1>
|
||||||
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!pending" class="page-content">
|
<div class="page-content">
|
||||||
|
<el-skeleton
|
||||||
|
:loading="pending"
|
||||||
|
:rows="6"
|
||||||
|
animated
|
||||||
|
:throttle="{ leading: 500, trailing: 500 }"
|
||||||
|
>
|
||||||
|
<template #default>
|
||||||
<file-card :file-id="id" :file="file" />
|
<file-card :file-id="id" :file="file" />
|
||||||
</div>
|
</template>
|
||||||
<div v-else>
|
</el-skeleton>
|
||||||
<el-skeleton :rows="6" animated />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -19,7 +25,9 @@
|
|||||||
|
|
||||||
const breadcrumbItems = [
|
const breadcrumbItems = [
|
||||||
{ label: $t('navigation.home'), to: localePath('/') },
|
{ label: $t('navigation.home'), to: localePath('/') },
|
||||||
{ label: $t('navigation.downloads'), to: localePath('/downloads') },
|
{ label: $t('navigation.support'), to: localePath('/support') },
|
||||||
|
{ label: $t('navigation.documents'), to: localePath('/support/documents') },
|
||||||
|
{ label: $t('navigation.downloads') },
|
||||||
];
|
];
|
||||||
|
|
||||||
const id = route.params.id as string;
|
const id = route.params.id as string;
|
||||||
@ -36,6 +44,11 @@
|
|||||||
statusMessage: '文件未找到',
|
statusMessage: '文件未找到',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pageTitle = $t('page-title.download');
|
||||||
|
usePageSeo({
|
||||||
|
title: file.value.filename_download || pageTitle,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -59,4 +72,10 @@
|
|||||||
.breadcrumb {
|
.breadcrumb {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.breadcrumb {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,27 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="homepage">
|
<div class="homepage">
|
||||||
<homepage-carousel :homepage-data="homepageData" :pending="pending" />
|
<homepage-carousel :homepage-data="data" :pending="pending" />
|
||||||
<homepage-product-section
|
<homepage-product-section :homepage-data="data" :pending="pending" />
|
||||||
:homepage-data="homepageData"
|
<homepage-solution-section :homepage-data="data" :pending="pending" />
|
||||||
:pending="pending"
|
|
||||||
/>
|
|
||||||
<homepage-solution-section
|
|
||||||
:homepage-data="homepageData"
|
|
||||||
:pending="pending"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { data, pending, error } = await useHomepage();
|
const { data, pending, error } = await useHomepage();
|
||||||
|
|
||||||
const homepageData = computed(() => {
|
const pageTilte = $t('page-title.homepage');
|
||||||
return toHomepageView(data.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
console.error('数据获取失败: ', value);
|
logger.error('数据获取失败: ', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useSeoMeta({
|
||||||
|
title: pageTilte,
|
||||||
|
description: $t('company-description'),
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
28
app/pages/locate.vue
Normal file
28
app/pages/locate.vue
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page-container">
|
||||||
|
<h1>{{ $t('redirecting') }}</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
onMounted(async () => {
|
||||||
|
const platform = await getAutoMappedService();
|
||||||
|
|
||||||
|
// // ✔ 移动端能正常跳转
|
||||||
|
window.location.href = platform;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.page-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 80vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,98 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="page-container">
|
|
||||||
<div v-if="!pending">
|
|
||||||
<div v-if="product">
|
|
||||||
<!-- 面包屑导航 -->
|
|
||||||
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
|
||||||
<!-- 产品详情内容 -->
|
|
||||||
<product-header :product="product" />
|
|
||||||
<!-- 产品详细描述 -->
|
|
||||||
<product-detail :product="product" />
|
|
||||||
</div>
|
|
||||||
<!-- 未找到产品 -->
|
|
||||||
<div v-else class="not-found">
|
|
||||||
<not-found-result
|
|
||||||
:title="$t('product-not-found')"
|
|
||||||
:sub-title="$t('product-not-found-desc')"
|
|
||||||
:back-text="$t('back-to-products')"
|
|
||||||
:on-back="() => $router.push($localePath('/products'))"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="loading">
|
|
||||||
<el-skeleton style="--el-skeleton-circle-size: 400px">
|
|
||||||
<template #template>
|
|
||||||
<el-skeleton-item variant="circle" />
|
|
||||||
</template>
|
|
||||||
</el-skeleton>
|
|
||||||
<el-skeleton :rows="5" animated />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
const route = useRoute();
|
|
||||||
const localePath = useLocalePath();
|
|
||||||
|
|
||||||
// 获取路由参数
|
|
||||||
const id = computed(() => route.params.slug as string);
|
|
||||||
|
|
||||||
const { data, pending, error } = await useProduct(id.value);
|
|
||||||
|
|
||||||
const rawProduct = computed(() => data.value ?? null);
|
|
||||||
const product = computed(() => {
|
|
||||||
if (rawProduct.value === null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return toProductView(rawProduct.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
const breadcrumbItems = computed(() => [
|
|
||||||
{ label: $t('navigation.home'), to: localePath('/') },
|
|
||||||
{ label: $t('navigation.products'), to: localePath('/products') },
|
|
||||||
{ label: product.value?.name || '' },
|
|
||||||
]);
|
|
||||||
|
|
||||||
watch(error, (value) => {
|
|
||||||
if (value) {
|
|
||||||
console.error('数据获取失败: ', value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// SEO
|
|
||||||
useHead({
|
|
||||||
title: computed(() => product.value?.name || 'Product Detail'),
|
|
||||||
meta: [
|
|
||||||
{
|
|
||||||
name: 'description',
|
|
||||||
content: computed(() => product.value?.summary || ''),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.page-container {
|
|
||||||
min-height: 80vh;
|
|
||||||
max-width: 1200px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.breadcrumb {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.not-found {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 400px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
75
app/pages/products/[slug].vue
Normal file
75
app/pages/products/[slug].vue
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page-container">
|
||||||
|
<div v-if="product">
|
||||||
|
<!-- 面包屑导航 -->
|
||||||
|
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
||||||
|
<!-- 产品详情内容 -->
|
||||||
|
<product-header :product="product" />
|
||||||
|
<!-- 产品详细描述 -->
|
||||||
|
<product-detail :product="product" />
|
||||||
|
</div>
|
||||||
|
<!-- 未找到产品 -->
|
||||||
|
<div v-else class="not-found">
|
||||||
|
<not-found-result
|
||||||
|
:title="$t('product-not-found')"
|
||||||
|
:sub-title="$t('product-not-found-desc')"
|
||||||
|
:back-text="$t('back-to-products')"
|
||||||
|
:on-back="() => $router.push($localePath('/products'))"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
const route = useRoute();
|
||||||
|
const localePath = useLocalePath();
|
||||||
|
|
||||||
|
// 获取路由参数
|
||||||
|
const id = route.params.slug as string;
|
||||||
|
|
||||||
|
const { data: product, error } = await useProduct(id);
|
||||||
|
|
||||||
|
const breadcrumbItems = computed(() => [
|
||||||
|
{ label: $t('navigation.home'), to: localePath('/') },
|
||||||
|
{ label: $t('navigation.products'), to: localePath('/products') },
|
||||||
|
{ label: product.value?.name || '' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
watch(error, (value) => {
|
||||||
|
if (value) {
|
||||||
|
logger.error('数据获取失败: ', value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// SEO
|
||||||
|
usePageSeo({
|
||||||
|
title: product.value?.name || $t('page-title.products'),
|
||||||
|
description: product.value?.summary || '',
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.page-container {
|
||||||
|
min-height: 80vh;
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb {
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.not-found {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 400px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,21 +1,46 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
|
<div>
|
||||||
<h1 class="page-title">{{ $t('our-products') }}</h1>
|
<h1 class="page-title">{{ $t('our-products') }}</h1>
|
||||||
|
<p class="page-subtitle">
|
||||||
|
{{ $t('products-desc') }}{{ $t('find-discontinued-products') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!pending" class="page-content">
|
<div>
|
||||||
|
<el-skeleton
|
||||||
|
animated
|
||||||
|
:loading="pending"
|
||||||
|
:throttle="{ leading: 500, trailing: 500 }"
|
||||||
|
>
|
||||||
|
<template #template>
|
||||||
|
<div v-for="i in 3" :key="i" class="products-container">
|
||||||
|
<el-skeleton-item variant="h1" class="skeleton-collapse" />
|
||||||
|
<div class="skeleton-group-list">
|
||||||
|
<el-skeleton-item
|
||||||
|
v-for="j in 3"
|
||||||
|
:key="j"
|
||||||
|
variant="rect"
|
||||||
|
class="skeleton-card"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
<div class="products-container">
|
<div class="products-container">
|
||||||
<el-collapse v-model="activeNames" class="product-collapse">
|
<el-collapse v-model="activeNames" class="product-collapse">
|
||||||
<el-collapse-item
|
<el-collapse-item
|
||||||
v-for="(group, type) in groupedProducts"
|
v-for="[key, value] in Object.entries(groupedProducts)"
|
||||||
:key="type"
|
:key="key"
|
||||||
:title="type || '未分类'"
|
:title="key || '未分类'"
|
||||||
:name="type || 'no-category'"
|
:name="key || 'no-category'"
|
||||||
>
|
>
|
||||||
<div class="group-list">
|
<div class="group-list">
|
||||||
<product-card
|
<product-card
|
||||||
v-for="product in group"
|
v-for="product in value.data"
|
||||||
:key="product.id"
|
:key="product.id"
|
||||||
:slug="product.id.toString()"
|
:slug="product.id.toString()"
|
||||||
:image-url="getImageUrl(product.cover.toString())"
|
:image-url="getImageUrl(product.cover.toString())"
|
||||||
@ -26,9 +51,8 @@
|
|||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
<div v-else>
|
</el-skeleton>
|
||||||
<el-skeleton :rows="6" animated />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -37,7 +61,7 @@
|
|||||||
const localePath = useLocalePath();
|
const localePath = useLocalePath();
|
||||||
const { getImageUrl } = useDirectusImage();
|
const { getImageUrl } = useDirectusImage();
|
||||||
|
|
||||||
const { data, pending, error } = useProductList();
|
const { data: products, pending, error } = await useProductList();
|
||||||
|
|
||||||
const activeNames = ref<string[]>([]);
|
const activeNames = ref<string[]>([]);
|
||||||
|
|
||||||
@ -46,31 +70,21 @@
|
|||||||
{ label: $t('navigation.products') },
|
{ label: $t('navigation.products') },
|
||||||
];
|
];
|
||||||
|
|
||||||
const productsRaw = computed(() => data.value ?? []);
|
|
||||||
const products = computed(() =>
|
|
||||||
productsRaw.value.map((item) => toProductListView(item))
|
|
||||||
);
|
|
||||||
|
|
||||||
// 按类型分组
|
// 按类型分组
|
||||||
// 兼容 product_type 既可能为对象也可能为字符串
|
|
||||||
const groupedProducts = computed(() => {
|
const groupedProducts = computed(() => {
|
||||||
const groups: Record<string, ProductListView[]> = {};
|
const groups: Record<string, { data: ProductListView[]; sort: number }> =
|
||||||
|
{};
|
||||||
for (const prod of products.value) {
|
for (const prod of products.value) {
|
||||||
let typeKey = '';
|
const typeKey = prod.product_type?.name ?? '';
|
||||||
if (typeof prod.product_type === 'string') {
|
if (!groups[typeKey]) {
|
||||||
typeKey = prod.product_type;
|
groups[typeKey] = { data: [], sort: prod.product_type?.sort ?? 999 };
|
||||||
} else if (
|
|
||||||
prod.product_type &&
|
|
||||||
typeof prod.product_type === 'object' &&
|
|
||||||
'name' in prod.product_type
|
|
||||||
) {
|
|
||||||
typeKey = prod.product_type || '';
|
|
||||||
}
|
}
|
||||||
if (!groups[typeKey]) groups[typeKey] = [];
|
groups[typeKey]?.data.push(prod);
|
||||||
groups[typeKey]?.push(prod);
|
|
||||||
}
|
}
|
||||||
console.log(groups);
|
const sortedGroups = Object.fromEntries(
|
||||||
return groups;
|
Object.entries(groups).sort(([, a], [, b]) => a.sort - b.sort)
|
||||||
|
);
|
||||||
|
return sortedGroups;
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(groupedProducts, () => {
|
watch(groupedProducts, () => {
|
||||||
@ -84,13 +98,7 @@
|
|||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
console.error('数据获取失败: ', value);
|
logger.error('数据获取失败: ', value);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(pending, (value) => {
|
|
||||||
if (!value) {
|
|
||||||
console.log('AsyncData: ', data.value);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -102,6 +110,11 @@
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pageTitle = $t('page-title.products');
|
||||||
|
usePageSeo({
|
||||||
|
title: pageTitle,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -113,13 +126,18 @@
|
|||||||
|
|
||||||
.page-header {
|
.page-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-title {
|
.page-title {
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: var(--el-color-primary);
|
color: var(--el-color-primary);
|
||||||
margin-bottom: 1rem;
|
}
|
||||||
|
|
||||||
|
.page-subtitle {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.breadcrumb {
|
.breadcrumb {
|
||||||
@ -151,6 +169,50 @@
|
|||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.skeleton-collapse {
|
||||||
|
height: 50px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.skeleton-group-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 40px;
|
||||||
|
justify-content: flex-start;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.skeleton-card {
|
||||||
|
width: 30%;
|
||||||
|
height: 250px;
|
||||||
|
margin-right: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1200px) {
|
||||||
|
.skeleton-card {
|
||||||
|
width: 45%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.group-list {
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.skeleton-group-list {
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.skeleton-card {
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
:deep(.el-collapse-item__header) {
|
:deep(.el-collapse-item__header) {
|
||||||
padding: 30px auto;
|
padding: 30px auto;
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
|
|||||||
@ -1,11 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="search-page">
|
<div class="search-page">
|
||||||
<search-header v-model="keyword" />
|
<search-header v-model="keyword" />
|
||||||
<div v-if="loading" class="search-state">
|
<div class="search-state">
|
||||||
<el-skeleton :rows="4" animated />
|
<el-skeleton
|
||||||
</div>
|
:loading="loading"
|
||||||
<search-tabs v-else-if="hasResults" :search-items="searchItems" />
|
animated
|
||||||
<div v-else class="search-state">
|
:throttle="{ leading: 500, trailing: 500 }"
|
||||||
|
>
|
||||||
|
<template #template>
|
||||||
|
<el-skeleton-item
|
||||||
|
v-for="i in 10"
|
||||||
|
:key="i"
|
||||||
|
variant="rect"
|
||||||
|
class="skeleton-item"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
|
<search-tabs v-if="hasResults" :search-items="searchItems" />
|
||||||
|
<div v-else>
|
||||||
<el-empty
|
<el-empty
|
||||||
:description="
|
:description="
|
||||||
route.query.query
|
route.query.query
|
||||||
@ -14,6 +26,9 @@
|
|||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-skeleton>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -21,58 +36,36 @@
|
|||||||
// i18n相关
|
// i18n相关
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { getDirectusLocale } = useLocalizations();
|
const { getDirectusLocale } = useLocalizations();
|
||||||
const directusLocale = getDirectusLocale();
|
const locale = getDirectusLocale();
|
||||||
|
|
||||||
// 路由相关
|
// 路由相关
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
// 搜索相关
|
// 搜索相关
|
||||||
const { search } = useMeilisearch();
|
|
||||||
const keyword = ref('');
|
const keyword = ref('');
|
||||||
|
|
||||||
|
if (typeof route.query.query === 'string' && route.query.query.trim()) {
|
||||||
|
keyword.value = route.query.query;
|
||||||
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: sections,
|
data: searchItems,
|
||||||
pending: loading,
|
pending: loading,
|
||||||
error,
|
error,
|
||||||
refresh,
|
refresh,
|
||||||
} = await useAsyncData(
|
} = useAsyncData(`meilisearch-${keyword.value}-${locale}`, async () => {
|
||||||
() => `search-${directusLocale}-${route.query.query ?? ''}`,
|
try {
|
||||||
async () => {
|
const data = await $fetch(`/api/search?query=${keyword.value}`, {
|
||||||
const q = String(route.query.query ?? '').trim();
|
headers: { 'x-locale': locale },
|
||||||
if (!q) return [];
|
});
|
||||||
return await search(q, { limit: 12 }, directusLocale);
|
return data;
|
||||||
|
} catch (error) {
|
||||||
|
logger.error('Error fetching search results: ', error);
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
// 空Section过滤
|
const hasResults = computed(() => searchItems.value.length > 0);
|
||||||
const filteredSections = computed(() =>
|
|
||||||
sections.value.filter((section) => section.hits.length > 0)
|
|
||||||
);
|
|
||||||
|
|
||||||
const typeMap = {
|
|
||||||
products: 'products',
|
|
||||||
solutions: 'solutions',
|
|
||||||
questions: 'questions',
|
|
||||||
product_documents: 'product_documents',
|
|
||||||
} as const;
|
|
||||||
// 展平hits
|
|
||||||
const hits = computed(() =>
|
|
||||||
filteredSections.value.flatMap((section) => {
|
|
||||||
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);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
const hasResults = computed(() =>
|
|
||||||
filteredSections.value.some((section) => section.hits.length > 0)
|
|
||||||
);
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.query.query,
|
() => route.query.query,
|
||||||
@ -84,9 +77,16 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => locale,
|
||||||
|
async () => {
|
||||||
|
await refresh();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
console.error('数据获取失败: ', value);
|
logger.error('数据获取失败: ', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -111,7 +111,11 @@
|
|||||||
.search-state {
|
.search-state {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 3rem 0;
|
}
|
||||||
|
|
||||||
|
.skeleton-item {
|
||||||
|
height: 80px;
|
||||||
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<div v-if="!pending">
|
|
||||||
<div v-if="solution">
|
<div v-if="solution">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
||||||
@ -16,27 +15,16 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="loading">
|
|
||||||
<el-skeleton :rows="5" animated />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const localePath = useLocalePath();
|
const localePath = useLocalePath();
|
||||||
|
|
||||||
// 获取路由参数(documentId)
|
// 获取路由参数
|
||||||
const id = computed(() => route.params.slug as string);
|
const id = route.params.slug as string;
|
||||||
|
|
||||||
const { data, pending, error } = await useSolution(id.value);
|
const { data: solution, error } = await useSolution(id);
|
||||||
|
|
||||||
const solution = computed(() => {
|
|
||||||
if (!data.value) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return toSolutionView(data.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
const breadcrumbItems = computed(() => [
|
const breadcrumbItems = computed(() => [
|
||||||
{ label: $t('navigation.home'), to: localePath('/') },
|
{ label: $t('navigation.home'), to: localePath('/') },
|
||||||
@ -46,9 +34,14 @@
|
|||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
console.error('数据获取失败: ', value);
|
logger.error('数据获取失败: ', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
usePageSeo({
|
||||||
|
title: solution.value?.title || $t('page-title.solutions'),
|
||||||
|
description: solution.value?.summary || '',
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -1,10 +1,33 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
|
<div>
|
||||||
<h1 class="page-title">{{ $t('learn-our-solutions') }}</h1>
|
<h1 class="page-title">{{ $t('learn-our-solutions') }}</h1>
|
||||||
|
<p class="page-subtitle">{{ $t('solutions-desc') }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!pending" class="solutions-container">
|
<div class="solutions-container">
|
||||||
|
<el-skeleton
|
||||||
|
:loading="pending"
|
||||||
|
animated
|
||||||
|
:throttle="{
|
||||||
|
leading: 500,
|
||||||
|
trailing: 500,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #template>
|
||||||
|
<div class="skeleton-group-list">
|
||||||
|
<el-skeleton-item
|
||||||
|
v-for="i in 12"
|
||||||
|
:key="i"
|
||||||
|
variant="rect"
|
||||||
|
class="skeleton-card"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
<el-tabs v-model="activeName" class="solutions-tabs">
|
<el-tabs v-model="activeName" class="solutions-tabs">
|
||||||
<el-tab-pane :label="$t('all')" name="all">
|
<el-tab-pane :label="$t('all')" name="all">
|
||||||
<div class="solution-list">
|
<div class="solution-list">
|
||||||
@ -19,14 +42,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
v-for="(group, type) in groupedSolutions"
|
v-for="[key, value] in Object.entries(groupedSolutions)"
|
||||||
:key="type"
|
:key="key"
|
||||||
:label="type || '未分类'"
|
:label="key || '未分类'"
|
||||||
:name="type || 'no-category'"
|
:name="key || 'no-category'"
|
||||||
>
|
>
|
||||||
<div class="solution-list">
|
<div class="solution-list">
|
||||||
<solution-card
|
<solution-card
|
||||||
v-for="solution in group"
|
v-for="solution in value.data"
|
||||||
:key="solution.id"
|
:key="solution.id"
|
||||||
:document-id="solution.id.toString()"
|
:document-id="solution.id.toString()"
|
||||||
:cover-url="getImageUrl(solution.cover || '')"
|
:cover-url="getImageUrl(solution.cover || '')"
|
||||||
@ -36,9 +59,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</template>
|
||||||
<div v-else>
|
</el-skeleton>
|
||||||
<el-skeleton :rows="6" animated />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -52,40 +74,39 @@
|
|||||||
{ label: $t('navigation.solutions') },
|
{ label: $t('navigation.solutions') },
|
||||||
];
|
];
|
||||||
|
|
||||||
const { data, pending, error } = await useSolutionList();
|
const { data, pending, error } = useSolutionList();
|
||||||
|
|
||||||
const solutionsRaw = computed(() => data.value ?? []);
|
const solutions = computed(() => data.value ?? []);
|
||||||
const solutions = computed(() =>
|
|
||||||
solutionsRaw.value.map((item) => toSolutionListView(item))
|
|
||||||
);
|
|
||||||
|
|
||||||
const activeName = ref<string>('all');
|
const activeName = ref<string>('all');
|
||||||
|
|
||||||
// 按类型分组
|
// 按类型分组
|
||||||
const groupedSolutions = computed(() => {
|
const groupedSolutions = computed(() => {
|
||||||
const gourps: Record<string, SolutionListView[]> = {};
|
const groups: Record<string, { data: SolutionListView[]; sort: number }> =
|
||||||
|
{};
|
||||||
for (const sol of solutions.value) {
|
for (const sol of solutions.value) {
|
||||||
let typeKey = '';
|
const typeKey = sol.solution_type?.name ?? '';
|
||||||
if (typeof sol.solution_type === 'string') {
|
if (!groups[typeKey]) {
|
||||||
typeKey = sol.solution_type;
|
groups[typeKey] = { data: [], sort: sol.solution_type?.sort ?? 999 };
|
||||||
} else if (
|
|
||||||
sol.solution_type &&
|
|
||||||
typeof sol.solution_type === 'object' &&
|
|
||||||
'type' in sol.solution_type
|
|
||||||
) {
|
|
||||||
typeKey = sol.solution_type || '';
|
|
||||||
}
|
}
|
||||||
if (!gourps[typeKey]) gourps[typeKey] = [];
|
groups[typeKey]?.data.push(sol);
|
||||||
gourps[typeKey]?.push(sol);
|
|
||||||
}
|
}
|
||||||
return gourps;
|
const sortedGroups = Object.fromEntries(
|
||||||
|
Object.entries(groups).sort(([, a], [, b]) => a.sort - b.sort)
|
||||||
|
);
|
||||||
|
return sortedGroups;
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
console.error('数据获取失败: ', value);
|
logger.error('数据获取失败: ', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pageTitle = $t('page-title.solutions');
|
||||||
|
usePageSeo({
|
||||||
|
title: pageTitle,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -97,15 +118,20 @@
|
|||||||
|
|
||||||
.page-header {
|
.page-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-title {
|
.page-title {
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-bottom: 1rem;
|
|
||||||
color: var(--el-color-primary);
|
color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.page-subtitle {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
.breadcrumb {
|
.breadcrumb {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
@ -117,4 +143,38 @@
|
|||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
gap: 40px;
|
gap: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.skeleton-group-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 20px;
|
||||||
|
justify-content: flex-start;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.skeleton-card {
|
||||||
|
width: 30%;
|
||||||
|
height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1200px) {
|
||||||
|
.skeleton-card {
|
||||||
|
width: 45%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.skeleton-group-list {
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.skeleton-card {
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -6,31 +6,55 @@
|
|||||||
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="!pending" class="page-content">
|
<div class="page-content">
|
||||||
<markdown-renderer :content="content.content || ''" />
|
<el-skeleton
|
||||||
</div>
|
:rows="10"
|
||||||
<div v-else class="loading">
|
:loading="pending"
|
||||||
<el-skeleton :rows="5" animated />
|
animated
|
||||||
|
:throttle="{ leading: 500, trailing: 500 }"
|
||||||
|
>
|
||||||
|
<template #default>
|
||||||
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||||
|
<div class="html-typography" v-html="contactInfo?.content || ''" />
|
||||||
|
<!-- <div v-if="!hydrated" v-html="contactInfo?.content || ''" /> -->
|
||||||
|
<!-- <div v-else> -->
|
||||||
|
<!-- <html-renderer -->
|
||||||
|
<!-- class="html-typography" -->
|
||||||
|
<!-- :html="contactInfo?.content || ''" -->
|
||||||
|
<!-- /> -->
|
||||||
|
<!-- </div> -->
|
||||||
|
</template>
|
||||||
|
</el-skeleton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const localePath = useLocalePath();
|
const localePath = useLocalePath();
|
||||||
|
const hydrated = ref(false);
|
||||||
const breadcrumbItems = [
|
const breadcrumbItems = [
|
||||||
{ label: $t('navigation.home'), to: localePath('/') },
|
{ label: $t('navigation.home'), to: localePath('/') },
|
||||||
{ label: $t('navigation.support'), to: localePath('/support') },
|
{ label: $t('navigation.support'), to: localePath('/support') },
|
||||||
{ label: $t('navigation.contact-info') },
|
{ label: $t('navigation.contact-info') },
|
||||||
];
|
];
|
||||||
const { data, pending, error } = await useContactInfo();
|
const { data, pending, error } = useContactInfo();
|
||||||
|
|
||||||
const content = computed(() => toContactInfoView(data.value));
|
const contactInfo = computed(() => data.value ?? null);
|
||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
console.error('数据获取失败: ', value);
|
logger.error('数据获取失败: ', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pageTitle = $t('page-title.contact-us');
|
||||||
|
usePageSeo({
|
||||||
|
title: pageTitle,
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
hydrated.value = true;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -63,4 +87,10 @@
|
|||||||
:deep(.markdown-body ul) {
|
:deep(.markdown-body ul) {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.breadcrumb {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,21 +1,60 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<div v-if="pending">
|
<div>
|
||||||
<el-skeleton :rows="5" animated />
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<support-tabs model-value="documents" />
|
<support-tabs model-value="documents" />
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1 class="page-title">{{ $t('navigation.documents') }}</h1>
|
<h1 class="page-title">{{ $t('navigation.documents') }}</h1>
|
||||||
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
||||||
</div>
|
</div>
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<product-filter
|
<document-filter
|
||||||
v-model="filters"
|
v-model="filters"
|
||||||
:product-type-options="productTypeOptions"
|
:product-type-options="productTypeOptions"
|
||||||
:product-options="productOptions"
|
:product-options="productOptions"
|
||||||
|
:document-type-options="documentTypeOptions"
|
||||||
/>
|
/>
|
||||||
<document-list :documents="filteredDocuments" />
|
|
||||||
|
<el-skeleton
|
||||||
|
:loading="pending"
|
||||||
|
animated
|
||||||
|
:throttle="{
|
||||||
|
leading: 500,
|
||||||
|
trailing: 500,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #template>
|
||||||
|
<div class="flex flex-col gap-xl">
|
||||||
|
<el-skeleton-item
|
||||||
|
variant="rect"
|
||||||
|
style="width: 100%; height: 100px"
|
||||||
|
/>
|
||||||
|
<el-skeleton-item
|
||||||
|
v-for="i in 10"
|
||||||
|
:key="i"
|
||||||
|
variant="h1"
|
||||||
|
style="height: 60px"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
|
<document-list
|
||||||
|
:documents="paginatedDocuments"
|
||||||
|
:show-category="
|
||||||
|
filters.selectedDocumentType === null ||
|
||||||
|
filters.selectedDocumentType === undefined
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="page"
|
||||||
|
class="justify-center pagination-container"
|
||||||
|
layout="prev, pager, next"
|
||||||
|
hide-on-single-page
|
||||||
|
:page-size="documentsPerPage"
|
||||||
|
:total="filteredDocuments.length"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-skeleton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -30,16 +69,36 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
const filters = reactive({
|
const filters = reactive({
|
||||||
selectedType: null as number | null,
|
selectedDocumentType: null as string | null,
|
||||||
selectedProduct: null as number | null,
|
selectedProductType: null as string | null,
|
||||||
|
selectedProduct: null as string | null,
|
||||||
keyword: '',
|
keyword: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data, pending, error } = await useDocumentList();
|
const page = ref(1);
|
||||||
|
const documentsPerPage = 10;
|
||||||
|
|
||||||
const documents = computed(
|
const { data, pending, error } = useDocumentList();
|
||||||
() => data?.value.map((item) => toDocumentListView(item)) ?? []
|
|
||||||
);
|
const documents = computed(() => data.value ?? []);
|
||||||
|
|
||||||
|
const documentTypeOptions = computed(() => {
|
||||||
|
const types: DocumentTypeView[] = [];
|
||||||
|
documents.value.forEach((doc: DocumentListView) => {
|
||||||
|
if (!types.some((item) => item.id === doc.type.id)) {
|
||||||
|
if (doc.type.id === '-1') {
|
||||||
|
types.push({
|
||||||
|
id: '-1',
|
||||||
|
name: $t('product-filter.misc'),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
types.push(doc.type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return types;
|
||||||
|
});
|
||||||
|
|
||||||
const productTypeOptions = computed(() => {
|
const productTypeOptions = computed(() => {
|
||||||
const types: DocumentListProductType[] = [];
|
const types: DocumentListProductType[] = [];
|
||||||
@ -56,13 +115,13 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const productOptions = computed(() => {
|
const productOptions = computed(() => {
|
||||||
if (!filters.selectedType) return [];
|
if (!filters.selectedProductType) return [];
|
||||||
const products: DocumentListProduct[] = [];
|
const products: DocumentListProduct[] = [];
|
||||||
|
|
||||||
documents.value.forEach((doc: DocumentListView) => {
|
documents.value.forEach((doc: DocumentListView) => {
|
||||||
doc.products?.forEach((product: DocumentListProduct) => {
|
doc.products?.forEach((product: DocumentListProduct) => {
|
||||||
if (
|
if (
|
||||||
product.type.id === filters.selectedType &&
|
product.type.id === filters.selectedProductType &&
|
||||||
!products.some((item) => item.id === product.id)
|
!products.some((item) => item.id === product.id)
|
||||||
) {
|
) {
|
||||||
products.push(product);
|
products.push(product);
|
||||||
@ -73,44 +132,57 @@
|
|||||||
return products;
|
return products;
|
||||||
});
|
});
|
||||||
|
|
||||||
const filteredDocuments = computed(() =>
|
const filteredDocuments = computed(() => {
|
||||||
documents.value.filter((doc: DocumentListView) => {
|
const fuzzyMatchedDocuments = fuzzyMatch(documents.value, {
|
||||||
|
keyword: filters.keyword,
|
||||||
|
keys: ['title'],
|
||||||
|
threshold: 0.6,
|
||||||
|
});
|
||||||
|
return fuzzyMatchedDocuments.filter((doc: DocumentListView) => {
|
||||||
const matchProduct = filters.selectedProduct
|
const matchProduct = filters.selectedProduct
|
||||||
? doc.products?.some(
|
? doc.products?.some(
|
||||||
(product: DocumentListProduct) =>
|
(product: DocumentListProduct) =>
|
||||||
product.id === filters.selectedProduct
|
product.id === filters.selectedProduct
|
||||||
)
|
)
|
||||||
: filters.selectedType
|
: filters.selectedProductType
|
||||||
? doc.products?.some(
|
? doc.products?.some(
|
||||||
(product: DocumentListProduct) =>
|
(product: DocumentListProduct) =>
|
||||||
product.type?.id === filters.selectedType
|
product.type?.id === filters.selectedProductType
|
||||||
)
|
)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const matchKeyword = filters.keyword
|
const matchDocumentType = filters.selectedDocumentType
|
||||||
? doc.title && doc.title.includes(filters.keyword)
|
? doc.type.id === filters.selectedDocumentType
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
return matchProduct && matchKeyword;
|
return matchProduct && matchDocumentType;
|
||||||
})
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const paginatedDocuments = computed(() => {
|
||||||
|
return filteredDocuments.value.slice(
|
||||||
|
(page.value - 1) * documentsPerPage,
|
||||||
|
page.value * documentsPerPage
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => filters.selectedType,
|
() => filters.selectedProductType,
|
||||||
() => {
|
() => {
|
||||||
filters.selectedProduct = null;
|
filters.selectedProduct = null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(documents, (value) => {
|
|
||||||
console.log(value);
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
console.error('数据获取失败: ', value);
|
logger.error('数据获取失败: ', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pageTitle = $t('page-title.documents');
|
||||||
|
usePageSeo({
|
||||||
|
title: pageTitle,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -135,12 +207,6 @@
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.document-category {
|
|
||||||
padding: 0rem 2rem;
|
|
||||||
gap: 4px;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-content {
|
.page-content {
|
||||||
padding: 1rem 2rem 2rem;
|
padding: 1rem 2rem 2rem;
|
||||||
}
|
}
|
||||||
@ -155,4 +221,41 @@
|
|||||||
height: 40px;
|
height: 40px;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pagination-container {
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.breadcrumb {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-pagination) {
|
||||||
|
.btn-prev,
|
||||||
|
.btn-next {
|
||||||
|
.el-icon {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-pager {
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
.el-pager li {
|
||||||
|
font-size: 1rem;
|
||||||
|
/* border: 1px solid #409eff; */
|
||||||
|
border-radius: 50%;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #ecf5ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.is-active {
|
||||||
|
background-color: var(--el-color-primary);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<div v-if="pending" class="flex justify-center items-center h-64">
|
|
||||||
<el-skeleton :rows="6" animated />
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<support-tabs model-value="faq" />
|
<support-tabs model-value="faq" />
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1 class="page-title">{{ $t('navigation.faq') }}</h1>
|
<h1 class="page-title">{{ $t('navigation.faq') }}</h1>
|
||||||
@ -11,38 +7,89 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<product-filter
|
<question-filter
|
||||||
v-model="filters"
|
v-model="filters"
|
||||||
:product-type-options="productTypeOptions"
|
:product-type-options="productTypeOptions"
|
||||||
:product-options="productOptions"
|
:product-options="productOptions"
|
||||||
|
:question-type-options="questionTypeOptions"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<question-list :questions="filteredQuestions" />
|
<el-skeleton
|
||||||
|
:loading="pending"
|
||||||
|
animated
|
||||||
|
:throttle="{ leading: 500, trailing: 500 }"
|
||||||
|
>
|
||||||
|
<template #template>
|
||||||
|
<div class="flex flex-col gap-xl">
|
||||||
|
<el-skeleton-item
|
||||||
|
v-for="i in 10"
|
||||||
|
:key="i"
|
||||||
|
variant="h1"
|
||||||
|
style="height: 80px"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
|
<question-list :questions="paginatedQuestions" />
|
||||||
|
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="page"
|
||||||
|
class="justify-center pagination-container"
|
||||||
|
layout="prev, pager, next"
|
||||||
|
hide-on-single-page
|
||||||
|
:page-size="questionsPerPage"
|
||||||
|
:total="filteredQuestions.length"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-skeleton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const localePath = useLocalePath();
|
const localePath = useLocalePath();
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
const filters = reactive({
|
const filters = reactive({
|
||||||
selectedType: null as number | null,
|
selectedQuestionType: null as string | null,
|
||||||
selectedProduct: null as number | null,
|
selectedProduct: null as string | null,
|
||||||
|
selectedProductType: null as string | null,
|
||||||
keyword: '',
|
keyword: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const page = ref(1);
|
||||||
|
const questionsPerPage = 10;
|
||||||
|
|
||||||
|
const focusQuestionId = ref<string | null>(
|
||||||
|
route.query.focus as string | null
|
||||||
|
);
|
||||||
|
|
||||||
const breadcrumbItems = [
|
const breadcrumbItems = [
|
||||||
{ label: $t('navigation.home'), to: localePath('/') },
|
{ label: $t('navigation.home'), to: localePath('/') },
|
||||||
{ label: $t('navigation.support'), to: localePath('/support') },
|
{ label: $t('navigation.support'), to: localePath('/support') },
|
||||||
{ label: $t('navigation.faq') },
|
{ label: $t('navigation.faq') },
|
||||||
];
|
];
|
||||||
|
|
||||||
const { data, pending, error } = await useQuestionList();
|
const { data, pending, error } = useQuestionList();
|
||||||
|
|
||||||
const questions = computed(
|
const questions = computed(() => data.value ?? []);
|
||||||
() => data.value.map((item) => toQuestionListView(item)) ?? null
|
|
||||||
);
|
const questionTypeOptions = computed(() => {
|
||||||
|
const types: QuestionTypeView[] = [];
|
||||||
|
questions.value.forEach((q: QuestionListView) => {
|
||||||
|
if (!types.some((t) => t.id === q.type.id)) {
|
||||||
|
if (q.type.id === '-1') {
|
||||||
|
types.push({
|
||||||
|
id: '-1',
|
||||||
|
name: $t('product-filter.misc'),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
types.push(q.type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return types;
|
||||||
|
});
|
||||||
|
|
||||||
const productTypeOptions = computed(() => {
|
const productTypeOptions = computed(() => {
|
||||||
const types: QuestionListProductType[] = [];
|
const types: QuestionListProductType[] = [];
|
||||||
@ -58,12 +105,12 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const productOptions = computed(() => {
|
const productOptions = computed(() => {
|
||||||
if (!filters.selectedType) return [];
|
if (!filters.selectedProductType) return [];
|
||||||
const products: QuestionListProduct[] = [];
|
const products: QuestionListProduct[] = [];
|
||||||
questions.value.forEach((q: QuestionListView) => {
|
questions.value.forEach((q: QuestionListView) => {
|
||||||
q.products.forEach((product: QuestionListProduct) => {
|
q.products.forEach((product: QuestionListProduct) => {
|
||||||
if (
|
if (
|
||||||
product.type.id === filters.selectedType &&
|
product.type.id === filters.selectedProductType &&
|
||||||
!products.some((p) => p.id === product.id)
|
!products.some((p) => p.id === product.id)
|
||||||
) {
|
) {
|
||||||
products.push(product);
|
products.push(product);
|
||||||
@ -74,44 +121,77 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const filteredQuestions = computed(() => {
|
const filteredQuestions = computed(() => {
|
||||||
return questions.value.filter((question: QuestionListView) => {
|
const fuzzyMatchedQuestions = fuzzyMatch(questions.value, {
|
||||||
|
keyword: filters.keyword,
|
||||||
|
keys: ['title'],
|
||||||
|
threshold: 0.6,
|
||||||
|
});
|
||||||
|
return fuzzyMatchedQuestions.filter((question: QuestionListView) => {
|
||||||
const matchProduct = filters.selectedProduct
|
const matchProduct = filters.selectedProduct
|
||||||
? question.products?.some(
|
? question.products?.some(
|
||||||
(product: QuestionListProduct) =>
|
(product: QuestionListProduct) =>
|
||||||
product.id === filters.selectedProduct
|
product.id === filters.selectedProduct
|
||||||
)
|
)
|
||||||
: filters.selectedType
|
: filters.selectedProductType
|
||||||
? question.products?.some(
|
? question.products?.some(
|
||||||
(product: QuestionListProduct) =>
|
(product: QuestionListProduct) =>
|
||||||
product.type.id === filters.selectedType
|
product.type.id === filters.selectedProductType
|
||||||
)
|
)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const matchKeyword = filters.keyword
|
const matchQuestionType = filters.selectedQuestionType
|
||||||
? (question.title && question.title.includes(filters.keyword)) ||
|
? question.type.id === filters.selectedQuestionType
|
||||||
(question.content && question.content.includes(filters.keyword))
|
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
return matchProduct && matchKeyword;
|
return matchProduct && matchQuestionType;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const paginatedQuestions = computed(() => {
|
||||||
|
const start = (page.value - 1) * questionsPerPage;
|
||||||
|
const end = page.value * questionsPerPage;
|
||||||
|
return filteredQuestions.value.slice(start, end);
|
||||||
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => filters.selectedType,
|
focusQuestionId,
|
||||||
|
async (focusId) => {
|
||||||
|
if (!focusId) return;
|
||||||
|
if (!import.meta.client) return;
|
||||||
|
|
||||||
|
await nextTick();
|
||||||
|
|
||||||
|
const question = filteredQuestions.value.find((q) => q.id === focusId);
|
||||||
|
if (!question) return;
|
||||||
|
|
||||||
|
const targetIndex = filteredQuestions.value.indexOf(question);
|
||||||
|
const targetPage = Math.floor(targetIndex / questionsPerPage) + 1;
|
||||||
|
onMounted(() => {
|
||||||
|
if (page.value !== targetPage) {
|
||||||
|
page.value = targetPage;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => filters.selectedProductType,
|
||||||
() => {
|
() => {
|
||||||
filters.selectedProduct = null;
|
filters.selectedProduct = null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(data, (newVal) => {
|
|
||||||
console.log('useAsyncData updated:', newVal);
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(error, (value) => {
|
watch(error, (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
console.error('数据获取失败: ', value);
|
logger.error('数据获取失败: ', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pageTitle = $t('page-title.faq');
|
||||||
|
usePageSeo({
|
||||||
|
title: pageTitle,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -139,4 +219,40 @@
|
|||||||
.page-content {
|
.page-content {
|
||||||
padding: 1rem 2rem 2rem;
|
padding: 1rem 2rem 2rem;
|
||||||
}
|
}
|
||||||
|
.pagination-container {
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.breadcrumb {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-pagination) {
|
||||||
|
.btn-prev,
|
||||||
|
.btn-next {
|
||||||
|
.el-icon {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-pager {
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
.el-pager li {
|
||||||
|
font-size: 1rem;
|
||||||
|
/* border: 1px solid #409eff; */
|
||||||
|
border-radius: 50%;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #ecf5ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.is-active {
|
||||||
|
background-color: var(--el-color-primary);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<section style="margin-bottom: 2rem">
|
<section style="margin-bottom: 2rem">
|
||||||
<p>
|
<p>
|
||||||
金申机械制造有限公司致力于为客户提供优质的产品与服务。针对纸管机、分纸机、纸吸管等产品,我们提供全方位的售后服务,确保客户能够安心地使用我们的产品。
|
{{ $t('support-page-desc') }}
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
<div class="card-group">
|
<div class="card-group">
|
||||||
@ -35,23 +35,28 @@
|
|||||||
const supportItems = [
|
const supportItems = [
|
||||||
{
|
{
|
||||||
title: $t('navigation.faq'),
|
title: $t('navigation.faq'),
|
||||||
description: '我们为用户整理了常见问题的答案,帮助您快速解决疑惑。',
|
description: $t('support-card-desc.faq'),
|
||||||
to: localePath('/support/faq'),
|
to: localePath('/support/faq'),
|
||||||
iconComponent: ElIconQuestionFilled,
|
iconComponent: ElIconQuestionFilled,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: $t('navigation.documents'),
|
title: $t('navigation.documents'),
|
||||||
description: '我们为用户整理了常见问题的答案,帮助您快速解决疑惑。',
|
description: $t('support-card-desc.documents'),
|
||||||
to: localePath('/support/documents'),
|
to: localePath('/support/documents'),
|
||||||
iconComponent: ElIconDocumentChecked,
|
iconComponent: ElIconDocumentChecked,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: $t('navigation.contact-info'),
|
title: $t('navigation.contact-info'),
|
||||||
description: '通过电话、邮箱联系我们,我们将现场为您服务。',
|
description: $t('support-card-desc.contact-info'),
|
||||||
to: localePath('/support/contact-us'),
|
to: localePath('/support/contact-us'),
|
||||||
iconComponent: ElIconService,
|
iconComponent: ElIconService,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const pageTitle = $t('page-title.support');
|
||||||
|
usePageSeo({
|
||||||
|
title: pageTitle,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -86,7 +91,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.card-group {
|
.card-group {
|
||||||
display: flex;
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
gap: 50px;
|
gap: 50px;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
@ -121,4 +127,19 @@
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
min-height: 36px;
|
min-height: 36px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
section {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-group {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import { createDirectus, rest, staticToken } from '@directus/sdk';
|
import { createDirectus, rest, staticToken, graphql } from '@directus/sdk';
|
||||||
|
|
||||||
export default defineNuxtPlugin(() => {
|
export default defineNuxtPlugin(() => {
|
||||||
const config = useRuntimeConfig();
|
const config = useRuntimeConfig();
|
||||||
|
|
||||||
const directus = createDirectus<Schema>(config.public.directus.url)
|
const directus = createDirectus<Schema>(config.public.directus.url)
|
||||||
.with(rest())
|
.with(rest())
|
||||||
|
.with(graphql())
|
||||||
.with(staticToken(config.public.directus.token || ''));
|
.with(staticToken(config.public.directus.token || ''));
|
||||||
return {
|
return {
|
||||||
provide: { directus },
|
provide: { directus },
|
||||||
|
|||||||
45
app/utils/autoMap.ts
Normal file
45
app/utils/autoMap.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
async function testSpeed(url: string, timeout = 1500) {
|
||||||
|
const start = performance.now();
|
||||||
|
|
||||||
|
try {
|
||||||
|
await Promise.race([
|
||||||
|
fetch(url, { method: 'HEAD', mode: 'no-cors' }),
|
||||||
|
new Promise((_, reject) => setTimeout(() => reject('timeout'), timeout)),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return performance.now() - start;
|
||||||
|
} catch {
|
||||||
|
return Infinity; // unreachable or timed out
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function selectBestMap() {
|
||||||
|
const testTargets = {
|
||||||
|
// amap: 'https://www.amap.com/favicon.ico',
|
||||||
|
baidu: 'https://map.baidu.com/favicon.ico',
|
||||||
|
google: 'https://maps.google.com/favicon.ico',
|
||||||
|
};
|
||||||
|
|
||||||
|
const results: Record<string, number> = {};
|
||||||
|
|
||||||
|
for (const key in testTargets) {
|
||||||
|
results[key] = await testSpeed(testTargets[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug(results);
|
||||||
|
|
||||||
|
// 根据延迟排序,选择最稳最快的平台
|
||||||
|
return Object.entries(results).sort((a, b) => a[1] - b[1])[0][0];
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getAutoMappedService(): Promise<string> {
|
||||||
|
const target = {
|
||||||
|
// amap: 'https://surl.amap.com/2dYNorIJ1dgoN',
|
||||||
|
baidu: 'https://j.map.baidu.com/f9/c3x',
|
||||||
|
google: 'https://maps.app.goo.gl/9LqvMwEq7VaRkqnM6',
|
||||||
|
};
|
||||||
|
|
||||||
|
const fastestMap = await selectBestMap();
|
||||||
|
|
||||||
|
return target[fastestMap];
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import { expect, test, describe } from 'vitest';
|
import { expect, test, describe } from 'vitest';
|
||||||
|
import { formatFileSize, getFileExtension, formatFileExtension } from './file';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单元测试: formatFileSize
|
* 单元测试: formatFileSize
|
||||||
|
|||||||
108
app/utils/fuzzyFilter.ts
Normal file
108
app/utils/fuzzyFilter.ts
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
import Fuse from 'fuse.js';
|
||||||
|
|
||||||
|
interface FuzzyFilterOptions<T> {
|
||||||
|
/** 匹配关键字 */
|
||||||
|
keyword: string;
|
||||||
|
|
||||||
|
/** 搜索字段 */
|
||||||
|
keys: Array<FuzzyKeyOf<T>>;
|
||||||
|
|
||||||
|
/** 模糊程度 (0~1,越低越严格) */
|
||||||
|
threshold?: number;
|
||||||
|
|
||||||
|
/** 最小匹配字符数 */
|
||||||
|
minMatchCharLength?: number;
|
||||||
|
|
||||||
|
/** 当前语言 */
|
||||||
|
locale?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 限定 keys 只能选择字符串字段 */
|
||||||
|
type FuzzyKeyOf<T> = {
|
||||||
|
[K in keyof T]: T[K] extends string ? K : never;
|
||||||
|
}[keyof T];
|
||||||
|
|
||||||
|
export function fuzzyMatch<T extends object>(
|
||||||
|
source: T[],
|
||||||
|
options: FuzzyFilterOptions<T>
|
||||||
|
): T[] {
|
||||||
|
const { keyword, keys, threshold = 0.35, minMatchCharLength = 1 } = options;
|
||||||
|
|
||||||
|
// --- 文本标准化函数 ---
|
||||||
|
const normalizeText = (text: string): string => {
|
||||||
|
const normalizedText = text.normalize('NFKC').toLowerCase().trim();
|
||||||
|
return normalizedText;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型安全的对象取值函数
|
||||||
|
*/
|
||||||
|
function getPropertyByPath<T>(
|
||||||
|
obj: T,
|
||||||
|
path: string | string[]
|
||||||
|
): string | undefined {
|
||||||
|
const keys = Array.isArray(path) ? path : path.split('.');
|
||||||
|
let value: unknown = obj;
|
||||||
|
for (const key of keys) {
|
||||||
|
if (value && typeof value === 'object' && key in value) {
|
||||||
|
value = (value as Record<string, unknown>)[key];
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return typeof value === 'string' ? value : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- fallback 模糊匹配算法 ---
|
||||||
|
const fallbackFuzzyMatch = (text: string, pattern: string): boolean => {
|
||||||
|
const normalizedText = normalizeText(text);
|
||||||
|
const normalizedPattern = normalizeText(pattern);
|
||||||
|
let i = 0;
|
||||||
|
for (const char of normalizedPattern) {
|
||||||
|
i = normalizedText.indexOf(char, i);
|
||||||
|
if (i === -1) return false;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const k = keyword.trim();
|
||||||
|
|
||||||
|
if (!k) {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (import.meta.client) {
|
||||||
|
// 客户端使用Fuze.js进行模糊匹配
|
||||||
|
const fuse = new Fuse<T>(source, {
|
||||||
|
keys: keys as string[],
|
||||||
|
threshold,
|
||||||
|
minMatchCharLength,
|
||||||
|
ignoreLocation: true,
|
||||||
|
findAllMatches: true,
|
||||||
|
isCaseSensitive: false,
|
||||||
|
getFn: (obj, path) => {
|
||||||
|
const value = getPropertyByPath(obj, path);
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
const normalized = value
|
||||||
|
.normalize('NFKC')
|
||||||
|
.replace(/\s+/g, '')
|
||||||
|
.toLowerCase()
|
||||||
|
.trim();
|
||||||
|
return normalized;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = fuse.search(k);
|
||||||
|
return result.map((result) => result.item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return source.filter((item) =>
|
||||||
|
keys.some((key) => {
|
||||||
|
const value = item[key];
|
||||||
|
return typeof value === 'string' ? fallbackFuzzyMatch(value, k) : false;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
30
app/utils/htmlDefaultMap.ts
Normal file
30
app/utils/htmlDefaultMap.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import type { HtmlRenderMap } from '@/composables/useHtmlRenderer';
|
||||||
|
import { h } from 'vue';
|
||||||
|
import MarkdownTable from '@/components/shared/MarkdownTable.vue';
|
||||||
|
|
||||||
|
export const defaultHtmlRenderMap: HtmlRenderMap = {
|
||||||
|
h1: (_, children) => h('h1', {}, children),
|
||||||
|
|
||||||
|
h2: (_, children) => h('h2', {}, children),
|
||||||
|
|
||||||
|
p: (_, children) => h('p', {}, children),
|
||||||
|
|
||||||
|
// table: (_, children) => h('div', {}, [h('table', {}, children)]),
|
||||||
|
table: (node) => {
|
||||||
|
const { headers, rows } = parseHtmlTable(node);
|
||||||
|
|
||||||
|
return h(
|
||||||
|
'div',
|
||||||
|
{},
|
||||||
|
h(MarkdownTable, {
|
||||||
|
headers,
|
||||||
|
rows,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
img: (node) =>
|
||||||
|
h('img', {
|
||||||
|
src: node.attribs?.src,
|
||||||
|
}),
|
||||||
|
};
|
||||||
@ -18,17 +18,3 @@ export function renderMarkdown(content: string): string {
|
|||||||
|
|
||||||
return dirtyHtml;
|
return dirtyHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function convertMedia(content: string): string {
|
|
||||||
// 通过正则表达式替换Markdown中的图片链接
|
|
||||||
//  -> )
|
|
||||||
|
|
||||||
if (!content) return '';
|
|
||||||
|
|
||||||
const contentWithAbsoluteUrls = content.replace(
|
|
||||||
/!\[([^\]]*)\]\((\/uploads\/[^)]+)\)/g,
|
|
||||||
(_, alt, url) => `})`
|
|
||||||
);
|
|
||||||
|
|
||||||
return contentWithAbsoluteUrls;
|
|
||||||
}
|
|
||||||
|
|||||||
90
app/utils/parseTable.ts
Normal file
90
app/utils/parseTable.ts
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import type { Element, Node } from 'domhandler';
|
||||||
|
|
||||||
|
export interface ParsedTable {
|
||||||
|
headers: string[];
|
||||||
|
rows: Record<string, string>[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const isElement = (n: Node): n is Element => n.type === 'tag';
|
||||||
|
|
||||||
|
export function parseHtmlTable(table: Element): ParsedTable {
|
||||||
|
if (table.name !== 'table') {
|
||||||
|
throw new Error('parseHtmlTable: node is not <table>');
|
||||||
|
}
|
||||||
|
// 获取 table 下的所有 tag 子节点
|
||||||
|
const getChildren = (node: Node): Element[] =>
|
||||||
|
isElement(node) ? node.children.filter(isElement) : [];
|
||||||
|
|
||||||
|
// ---- 找 thead / tbody ----
|
||||||
|
const children = getChildren(table);
|
||||||
|
const thead = children.find((n) => n.name === 'thead');
|
||||||
|
const tbody = children.find((n) => n.name === 'tbody');
|
||||||
|
|
||||||
|
if (!tbody) {
|
||||||
|
return { headers: [], rows: [] };
|
||||||
|
}
|
||||||
|
|
||||||
|
const bodyRows = getChildren(tbody).filter((n) => n.name === 'tr');
|
||||||
|
|
||||||
|
if (bodyRows.length === 0) {
|
||||||
|
return { headers: [], rows: [] };
|
||||||
|
}
|
||||||
|
// ---- 1. 表头 ----
|
||||||
|
let headerCells: Element[] = [];
|
||||||
|
|
||||||
|
if (thead) {
|
||||||
|
// 如果 Directus 有 thead(一般不会)
|
||||||
|
const headerRow = getChildren(thead).find((n) => n.name === 'tr');
|
||||||
|
headerCells = headerRow
|
||||||
|
? getChildren(headerRow).filter((n) => n.name === 'th' || n.name === 'td')
|
||||||
|
: [];
|
||||||
|
} else {
|
||||||
|
// Directus 情况:没有 thead → 用 tbody 第一行作为 header
|
||||||
|
headerCells = getChildren(bodyRows[0]).filter(
|
||||||
|
(n) => n.name === 'th' || n.name === 'td'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info(headerCells);
|
||||||
|
|
||||||
|
const headers = headerCells.map((cell, i) => {
|
||||||
|
const text = cell.children
|
||||||
|
.filter((c) => c.type === 'text')
|
||||||
|
.map((t) => t.data.trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
.join('');
|
||||||
|
return text || `列${i + 1}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
// ---- 2. 数据行 ----
|
||||||
|
// 如果没有 thead,则跳过第一行(它是 header)
|
||||||
|
const dataRows = thead ? bodyRows : bodyRows.slice(1);
|
||||||
|
|
||||||
|
const rows = dataRows.map((row) => {
|
||||||
|
const cells = getChildren(row).filter(
|
||||||
|
(n) => n.name === 'td' || n.name === 'th'
|
||||||
|
);
|
||||||
|
|
||||||
|
const record: Record<string, string> = {};
|
||||||
|
|
||||||
|
headers.forEach((header, i) => {
|
||||||
|
const cell = cells[i];
|
||||||
|
if (!cell) {
|
||||||
|
record[header] = '';
|
||||||
|
} else {
|
||||||
|
const text = cell.children
|
||||||
|
.filter((c) => c.type === 'text')
|
||||||
|
.map((t) => t.data.trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
.join('');
|
||||||
|
record[header] = text;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return record;
|
||||||
|
});
|
||||||
|
|
||||||
|
logger.info(headers, rows);
|
||||||
|
|
||||||
|
return { headers, rows };
|
||||||
|
}
|
||||||
63
docker-build.sh
Executable file
63
docker-build.sh
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# ========== 脚本配置 ==========
|
||||||
|
#
|
||||||
|
IMAGE_NAME="git.jinshen.cn/remilia/jinshen-website" # 含仓库前缀的镜像名称
|
||||||
|
DOCKERFILE="Dockerfile" # Dockerfile 文件路径
|
||||||
|
BUILD_CONTEXT="." # 构建上下文路径
|
||||||
|
PUSH_IMAGE=true # 是否推送镜像到远程仓库
|
||||||
|
DOCKER_LOGIN=false # 是否需要登录 Docker 仓库
|
||||||
|
REGISTRY_USER="" #Docker 仓库用户名
|
||||||
|
REGISTRY_PASSWORD="" #Docker 仓库密码
|
||||||
|
|
||||||
|
# ==============================
|
||||||
|
|
||||||
|
# 生成时间戳TAG
|
||||||
|
TIMESTAMP_TAG=$(date +'%Y%m%d%H%M%S')
|
||||||
|
BUILD_TIME=$(date +"%Y-%m-%d %H:%M:%S")
|
||||||
|
GIT_COMMIT=$(git rev-parse --short HEAD || echo "unknown")
|
||||||
|
|
||||||
|
echo "📦 构建镜像: ${IMAGE_NAME}"
|
||||||
|
echo "⏱️ 时间戳标签: ${TIMESTAMP_TAG}"
|
||||||
|
echo "🔖 Git 提交: ${GIT_COMMIT}"
|
||||||
|
echo "⭐ 同时构建 latest 标签"
|
||||||
|
|
||||||
|
# docker login(如果启用)
|
||||||
|
if [ "$DOCKER_LOGIN" = true ]; then
|
||||||
|
if [ -z "$REGISTRY_PASSWORD" ]; then
|
||||||
|
echo "❌ 登录失败:启用了 DOCKER_LOGIN,但 REGISTRY_PASSWORD 为空"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "🔐 正在登录 Docker Registry..."
|
||||||
|
echo "$REGISTRY_PASSWORD" | docker login "$(echo "$IMAGE_NAME" | cut -d'/' -f1)" \
|
||||||
|
--username "$REGISTRY_USER" --password-stdin
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 根据是否推送决定 buildx 参数
|
||||||
|
if [ "$PUSH_IMAGE" = true ]; then
|
||||||
|
BUILDX_MODE="--push"
|
||||||
|
echo "🚀 将构建并推送镜像到仓库"
|
||||||
|
else
|
||||||
|
BUILDX_MODE="--load"
|
||||||
|
echo "🛠️ 仅本地构建镜像(不推送)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 构建镜像(带 version metadata)
|
||||||
|
docker buildx build \
|
||||||
|
-t "${IMAGE_NAME}:${TIMESTAMP_TAG}" \
|
||||||
|
-t "${IMAGE_NAME}:latest" \
|
||||||
|
--build-arg BUILD_TIME="$BUILD_TIME" \
|
||||||
|
--build-arg GIT_COMMIT="$GIT_COMMIT" \
|
||||||
|
-f "$DOCKERFILE" "$BUILD_CONTEXT" \
|
||||||
|
$BUILDX_MODE
|
||||||
|
|
||||||
|
|
||||||
|
echo "🎉 镜像构建完成!"
|
||||||
|
echo "📌 可用镜像:"
|
||||||
|
echo " - ${IMAGE_NAME}:${TIMESTAMP_TAG}"
|
||||||
|
echo " - ${IMAGE_NAME}:latest"
|
||||||
|
|
||||||
|
if [ "$PUSH_IMAGE" = false ]; then
|
||||||
|
echo "⚠️ 镜像未推送(PUSH_IMAGE=false)"
|
||||||
|
fi
|
||||||
13
docker-compose.test.yml
Normal file
13
docker-compose.test.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
website:
|
||||||
|
image: git.jinshen.cn/remilia/jinshen-website
|
||||||
|
container_name: webService
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file: .env
|
||||||
|
environment:
|
||||||
|
NUXT_PUBLIC_DIRECTUS_URL: ${DIRECTUS_URL}
|
||||||
|
NUXT_PUBLIC_DIRECTUS_TOKEN: ${DIRECTUS_TOKEN}
|
||||||
|
NUXT_PUBLIC_MEILI_HOST: ${MEILI_HOST}
|
||||||
|
NUXT_PUBLIC_MEILI_SEARCH_KEY: ${MEILI_MASTER_KEY}
|
||||||
|
ports:
|
||||||
|
- 3200:3000
|
||||||
9
entrypoint.sh
Normal file
9
entrypoint.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
echo "Starting Nuxt App..."
|
||||||
|
if [ -f "/app/version.json" ]; then
|
||||||
|
echo "Version info:"
|
||||||
|
cat /app/version.json
|
||||||
|
else
|
||||||
|
echo "⚠️ version.json not found!"
|
||||||
|
fi
|
||||||
|
exec "$@"
|
||||||
@ -13,6 +13,7 @@ export default withNuxt(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
'no-console': 'warn',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
"result-count": "{count} results",
|
"result-count": "{count} results",
|
||||||
"no-results": "No results found for \"{query}\".",
|
"no-results": "No results found for \"{query}\".",
|
||||||
"no-query": "Enter a keyword to start searching.",
|
"no-query": "Enter a keyword to start searching.",
|
||||||
|
"section": "Section",
|
||||||
"untitled": "Untitled",
|
"untitled": "Untitled",
|
||||||
"sections": {
|
"sections": {
|
||||||
"product": "Products",
|
"product": "Products",
|
||||||
@ -22,8 +23,8 @@
|
|||||||
"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",
|
||||||
"products-desc": "We provide high-quality product solutions to meet various business needs.",
|
"products-desc": "We provide the latest products an instant service support to meet various business needs of our customers.",
|
||||||
"solutions-desc": "Providing customized technology solutions for enterprises to accelerate digital transformation.",
|
"solutions-desc": "We offer diversified technical solutions for enterprises, supporting various fields such as industry and packaging.",
|
||||||
"support-desc": "24/7 professional technical support to ensure stable operation of your business.",
|
"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",
|
||||||
@ -37,7 +38,8 @@
|
|||||||
"downloads": "Downloads",
|
"downloads": "Downloads",
|
||||||
"faq": "FAQ",
|
"faq": "FAQ",
|
||||||
"documents": "Documents",
|
"documents": "Documents",
|
||||||
"calculator": "Calculator"
|
"calculator": "Calculator",
|
||||||
|
"address": "Company Address"
|
||||||
},
|
},
|
||||||
"contact-info": "Contact Us",
|
"contact-info": "Contact Us",
|
||||||
"telephone": "Telephone",
|
"telephone": "Telephone",
|
||||||
@ -61,7 +63,70 @@
|
|||||||
"back-to-home": "Back to Home",
|
"back-to-home": "Back to Home",
|
||||||
"no-content-available": "No detailed information available",
|
"no-content-available": "No detailed information available",
|
||||||
"loading": "Loading...",
|
"loading": "Loading...",
|
||||||
"our-products": "Our Products",
|
"our-products": "Our Latest Products",
|
||||||
|
"find-discontinued-products": "To find discontinued products, please use the search function.",
|
||||||
|
"product-discontinued-warning": "Product is discontinued and may no longer receive immediate support or updates",
|
||||||
"learn-our-solutions": "Learn Our Solutions",
|
"learn-our-solutions": "Learn Our Solutions",
|
||||||
"all": "All"
|
"all": "All",
|
||||||
|
"support-page-desc": "Zhejiang Jinshen Machinery Manufacturing Co., Ltd is committed to providing high-quality products and services to our customers. For products such as paper tube machines, slitting machines, and paper straw equipment, we offer comprehensive after-sales support to ensure our customers can use our products with confidence.",
|
||||||
|
"support-card-desc": {
|
||||||
|
"faq": "We have compiled answers to frequently asked questions to help you quickly resolve any concerns.",
|
||||||
|
"documents": "We provide product manuals, technical specifications, and other documentation for easy reference.",
|
||||||
|
"contact-info": "Contact us by phone or email, and we will provide on-site support for you."
|
||||||
|
},
|
||||||
|
|
||||||
|
"product-filter": {
|
||||||
|
"product-type": "Product type",
|
||||||
|
"product-model": "Product model",
|
||||||
|
"keyword": "Keyword",
|
||||||
|
"select-product-type": "Select product type",
|
||||||
|
"select-product-model": "Select product model",
|
||||||
|
"enter-keyword": "Enter keyword",
|
||||||
|
"question-type": "Question Type",
|
||||||
|
"select-question-type": "Select question type",
|
||||||
|
"document-type": "Document Type",
|
||||||
|
"select-document-type": "Select document type",
|
||||||
|
"misc": "Misc"
|
||||||
|
},
|
||||||
|
"document-meta": {
|
||||||
|
"size": "Size",
|
||||||
|
"format": "Format",
|
||||||
|
"type": "Type",
|
||||||
|
"upload-at": "Upload at"
|
||||||
|
},
|
||||||
|
"document-action": {
|
||||||
|
"download": "Download",
|
||||||
|
"open-in-new-tab": "Open in New Tab",
|
||||||
|
"preview": "Preview"
|
||||||
|
},
|
||||||
|
"mobile-menu": {
|
||||||
|
"title": "Menu",
|
||||||
|
"navigation": "Navigation",
|
||||||
|
"utilities": "Utilities"
|
||||||
|
},
|
||||||
|
"homepage": {
|
||||||
|
"recommended-products": "Recommended Products",
|
||||||
|
"recommended-products-desc": "Explore our curated selection of products to meet your diverse needs. Whether it's innovative technology or classic designs, we offer quality choices for you.",
|
||||||
|
"recommended-solutions": "Recommended Solutions",
|
||||||
|
"recommended-solutions-desc": "Learn about our tailored solutions designed to help your business thrive in a competitive market."
|
||||||
|
},
|
||||||
|
"page-title": {
|
||||||
|
"homepage": "Homepage",
|
||||||
|
"products": "Products",
|
||||||
|
"solutions": "Solutions",
|
||||||
|
"support": "Support",
|
||||||
|
"faq": "FAQ",
|
||||||
|
"documents": "Documents",
|
||||||
|
"contact-us": "Contact Us",
|
||||||
|
"download": "Downloads",
|
||||||
|
"preview": "Preview",
|
||||||
|
"about-us": "About Us"
|
||||||
|
},
|
||||||
|
"product-tab": {
|
||||||
|
"details": "Details",
|
||||||
|
"specs": "Specifications",
|
||||||
|
"faq": "FAQ",
|
||||||
|
"documents": "Documents"
|
||||||
|
},
|
||||||
|
"redirecting": "Redirecting..."
|
||||||
}
|
}
|
||||||
|
|||||||
131
i18n/locales/es.json
Normal file
131
i18n/locales/es.json
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
{
|
||||||
|
"back": "Volver",
|
||||||
|
"not-found": "Página no encontrada",
|
||||||
|
"search-placeholder": "Buscar...",
|
||||||
|
"search": {
|
||||||
|
"title": "Búsqueda en el sitio",
|
||||||
|
"head-title": "Búsqueda",
|
||||||
|
"search-button": "Buscar",
|
||||||
|
"results-for": "Resultados de la búsqueda para \"{query}\"",
|
||||||
|
"result-count": "{count} resultados",
|
||||||
|
"no-results": "No se encontraron coincidencias para \"{query}\".",
|
||||||
|
"no-query": "Ingrese una palabra clave para comenzar a buscar.",
|
||||||
|
"section": "sección",
|
||||||
|
"untitled": "sin título",
|
||||||
|
"sections": {
|
||||||
|
"product": "Productos",
|
||||||
|
"solution": "Soluciones",
|
||||||
|
"faq": "FAQ",
|
||||||
|
"document": "Documentaciones",
|
||||||
|
"default": "Otros contenidos"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"company-name": "Jinshen Machinary Manufacturing Co., Ltd.",
|
||||||
|
"company-description": "Especializado en la producción de una serie de equipos de tubos y latas de papel, integrando diseño, fabricación, ventas y servicio.",
|
||||||
|
"learn-more": "Saber más",
|
||||||
|
"products-desc": "Ofrecemos los últimos productos y un servicio de asistencia instantáneo para satisfacer las diversas necesidades comerciales de nuestros clientes.",
|
||||||
|
"solutions-desc": "Ofrecemos soluciones técnicas diversificadas para empresas, prestando apoyo en diversos campos, como la industria y el embalaje.",
|
||||||
|
"support-desc": "Soporte técnico profesional 24/7, asegurando la estabilidad de su negocio.",
|
||||||
|
"quick-links": "Enlaces rápidos",
|
||||||
|
"utilities": "Herramientas útiles",
|
||||||
|
"navigation": {
|
||||||
|
"home": "Inicio",
|
||||||
|
"products": "Productos",
|
||||||
|
"solutions": "Soluciones",
|
||||||
|
"support": "Soporte",
|
||||||
|
"about-us": "Sobre nosotros",
|
||||||
|
"contact-info": "Información de contacto",
|
||||||
|
"downloads": "Descargas",
|
||||||
|
"faq": "FAQ",
|
||||||
|
"documents": "Documentaciones",
|
||||||
|
"calculator": "Herramienta de cálculo de tubos de papel",
|
||||||
|
"address": "Dirección de la empresa"
|
||||||
|
},
|
||||||
|
"contact-info": "Contáctenos",
|
||||||
|
"telephone": "Teléfono",
|
||||||
|
"email": "Correo electrónico",
|
||||||
|
"address": "Dirección",
|
||||||
|
"company-address": "No. 689 Qiushi Road, Wutong Industrial Zone, Tongxiang City, Zhejiang Province, China",
|
||||||
|
"follow-us": "Síguenos",
|
||||||
|
"all-rights-reserved": "All rights reserved",
|
||||||
|
"privacy-policy": "Política de privacidad",
|
||||||
|
"terms-of-service": "Términos del servicio",
|
||||||
|
"sitemap": "Mapa del sitio",
|
||||||
|
"product-details": "Detalles del producto",
|
||||||
|
"product-not-found": "Producto no encontrado",
|
||||||
|
"product-not-found-desc": "Lo sentimos, el producto que busca no existe o ha sido eliminado.",
|
||||||
|
"back-to-products": "Volver a la lista de productos",
|
||||||
|
"solution-not-found": "Solución no encontrada",
|
||||||
|
"solution-not-found-desc": "Lo sentimos, la solución que busca no existe o ha sido eliminada.",
|
||||||
|
"back-to-solutions": "Volver a la lista de soluciones",
|
||||||
|
"page-not-found": "Página no encontrada",
|
||||||
|
"page-not-found-desc": "Lo sentimos, la página que busca no existe o ha sido eliminada.",
|
||||||
|
"back-to-home": "Volver al inicio",
|
||||||
|
"no-content-available": "No hay información disponible",
|
||||||
|
"loading": "Cargando...",
|
||||||
|
"our-products": "Nuestros últimos productos",
|
||||||
|
"find-discontinued-products": "Para encontrar productos descatalogados, utilice la función de búsqueda.",
|
||||||
|
"product-discontinued-warning": "Este producto ha sido descontinuado y puede que ya no reciba soporte o actualizaciones inmediatas.",
|
||||||
|
"learn-our-solutions": "Aprenda sobre nuestras soluciones",
|
||||||
|
"all": "Todo",
|
||||||
|
"support-page-desc": "Zhejiang Jinshen Machinery Manufacturing Co., Ltd se dedica a proporcionar productos y servicios de alta calidad a los clientes. Para máquinas de tubos de papel, máquinas de corte y pajitas de papel, ofrecemos un servicio postventa integral para garantizar que los clientes puedan usar nuestros productos con confianza.",
|
||||||
|
"support-card-desc": {
|
||||||
|
"faq": "Hemos compilado respuestas a preguntas frecuentes para ayudarle a resolver dudas rápidamente.",
|
||||||
|
"documents": "Proporcionamos manuales de productos, especificaciones técnicas y otros documentos para la comodidad del usuario.",
|
||||||
|
"contact-info": "Contáctenos por teléfono o correo electrónico, y le brindaremos servicio presencial."
|
||||||
|
},
|
||||||
|
"product-filter": {
|
||||||
|
"product-type": "Tipo de producto",
|
||||||
|
"product-model": "Modelo del producto",
|
||||||
|
"keyword": "Palabra clave",
|
||||||
|
"select-product-type": "Seleccione el tipo de producto",
|
||||||
|
"select-product-model": "Seleccione modelo de producto",
|
||||||
|
"enter-keyword": "Ingrese palabra clave",
|
||||||
|
"misc": "Varios",
|
||||||
|
"document-type": "Tipo de documento",
|
||||||
|
"select-document-type": "Seleccionar tipo de documento",
|
||||||
|
"question-type": "Tipo de pregunta",
|
||||||
|
"select-question-type": "Seleccionar tipo de pregunta"
|
||||||
|
},
|
||||||
|
"document-meta": {
|
||||||
|
"size": "Tamaño",
|
||||||
|
"format": "Formato",
|
||||||
|
"type": "Tipo",
|
||||||
|
"upload-at": "Fecha de carga"
|
||||||
|
},
|
||||||
|
"document-action": {
|
||||||
|
"download": "Descargar",
|
||||||
|
"open-in-new-tab": "Abrir en una nueva pestaña",
|
||||||
|
"preview": "Vista previa"
|
||||||
|
},
|
||||||
|
"mobile-menu": {
|
||||||
|
"title": "Menú",
|
||||||
|
"navigation": "Navegación del sitio",
|
||||||
|
"utilities": "Herramientas útiles"
|
||||||
|
},
|
||||||
|
"homepage": {
|
||||||
|
"recommended-products": "Productos recomendados",
|
||||||
|
"recommended-products-desc": "Explore nuestros productos seleccionados para satisfacer sus diversas necesidades. Ya sea tecnología innovadora o diseño clásico, ofrecemos opciones de calidad para usted.",
|
||||||
|
"recommended-solutions": "Soluciones recomendadas",
|
||||||
|
"recommended-solutions-desc": "Aprenda sobre nuestras soluciones personalizadas, que le ayudarán a optimizar sus procesos de negocio y mejorar la eficiencia."
|
||||||
|
},
|
||||||
|
"page-title": {
|
||||||
|
"homepage": "Página principal",
|
||||||
|
"products": "Productos",
|
||||||
|
"solutions": "Soluciones",
|
||||||
|
"support": "Soporte",
|
||||||
|
"faq": "FAQ",
|
||||||
|
"documents": "Documentos",
|
||||||
|
"contact-us": "Contáctenos",
|
||||||
|
"download": "Descarga de documentos",
|
||||||
|
"preview": "Vista previa de documentos",
|
||||||
|
"about-us": "Sobre nosotros"
|
||||||
|
},
|
||||||
|
"product-tab": {
|
||||||
|
"details": "Detalles",
|
||||||
|
"specs": "Especificaciones",
|
||||||
|
"faq": "FAQ",
|
||||||
|
"documents": "Documentos"
|
||||||
|
},
|
||||||
|
"redirecting": "Redirigiendo..."
|
||||||
|
}
|
||||||
131
i18n/locales/ru.json
Normal file
131
i18n/locales/ru.json
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
{
|
||||||
|
"back": "Назад",
|
||||||
|
"not-found": "Страница не найдена",
|
||||||
|
"search-placeholder": "Поиск...",
|
||||||
|
"search": {
|
||||||
|
"title": "Поиск на сайте",
|
||||||
|
"head-title": "Поиск",
|
||||||
|
"search-button": "Поиск",
|
||||||
|
"results-for": "Результаты поиска для \"{query}\"",
|
||||||
|
"result-count": "Всего {count} результатов",
|
||||||
|
"no-results": "Ничего не найдено по запросу \"{query}\".",
|
||||||
|
"no-query": "Введите ключевые слова для начала поиска.",
|
||||||
|
"section": "раздел",
|
||||||
|
"untitled": "Без названия",
|
||||||
|
"sections": {
|
||||||
|
"product": "Продукты",
|
||||||
|
"solution": "Решения",
|
||||||
|
"faq": "Часто задаваемые вопросы",
|
||||||
|
"document": "Документация",
|
||||||
|
"default": "Другие материалы"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"company-name": "Jinshen Machinary Manufacturing Co., Ltd.",
|
||||||
|
"company-description": "Профессионально производим оборудование для бумажных трубок и канистр, услуги по проектированию, производству, продаже и сервисному обслуживанию.",
|
||||||
|
"learn-more": "Узнать больше",
|
||||||
|
"products-desc": "Мы предоставляем новейшие продукты и мгновенную сервисную поддержку для удовлетворения различных бизнес-потребностей наших клиентов.",
|
||||||
|
"solutions-desc": "Мы предлагаем разнообразные технические решения для предприятий, поддерживая различные области, такие как промышленность и упаковка.",
|
||||||
|
"support-desc": "Профессиональная техническая поддержка 24/7, обеспечивающая стабильную работу вашего бизнеса.",
|
||||||
|
"quick-links": "Быстрые ссылки",
|
||||||
|
"utilities": "Полезные инструменты",
|
||||||
|
"navigation": {
|
||||||
|
"home": "Главная",
|
||||||
|
"products": "Центр продуктов",
|
||||||
|
"solutions": "Решения",
|
||||||
|
"support": "Поддержка",
|
||||||
|
"about-us": "О нас",
|
||||||
|
"contact-info": "Контактная информация",
|
||||||
|
"downloads": "Файлы для скачивания",
|
||||||
|
"faq": "Часто задаваемые вопросы",
|
||||||
|
"documents": "Документация",
|
||||||
|
"calculator": "Калькулятор бумажных трубок",
|
||||||
|
"address": "Адрес компании"
|
||||||
|
},
|
||||||
|
"contact-info": "Свяжитесь с нами",
|
||||||
|
"telephone": "Телефон",
|
||||||
|
"email": "Электронная почта",
|
||||||
|
"address": "Адрес",
|
||||||
|
"company-address": "No. 689 Qiushi Road, Wutong Industrial Zone, Tongxiang City, Zhejiang Province, China",
|
||||||
|
"follow-us": "Следуйте за нами",
|
||||||
|
"all-rights-reserved": "All rights reserved",
|
||||||
|
"privacy-policy": "Политика конфиденциальности",
|
||||||
|
"terms-of-service": "Условия обслуживания",
|
||||||
|
"sitemap": "Карта сайта",
|
||||||
|
"product-details": "Детали продукта",
|
||||||
|
"product-not-found": "Продукт не найден",
|
||||||
|
"product-not-found-desc": "Извините, продукт, который вы ищете, не существует или был удален.",
|
||||||
|
"back-to-products": "Вернуться к списку продуктов",
|
||||||
|
"solution-not-found": "Решение не найдено",
|
||||||
|
"solution-not-found-desc": "Извините, решение, которое вы ищете, не существует или было удалено.",
|
||||||
|
"back-to-solutions": "Вернуться к списку решений",
|
||||||
|
"page-not-found": "Страница не найдена",
|
||||||
|
"page-not-found-desc": "Извините, страница, которую вы ищете, не существует или была удалена.",
|
||||||
|
"back-to-home": "Вернуться на главную",
|
||||||
|
"no-content-available": "Нет доступной информации",
|
||||||
|
"loading": "Загрузка...",
|
||||||
|
"our-products": "Наши последние продукты",
|
||||||
|
"find-discontinued-products": "Чтобы найти другие продукты, используйте функцию поиска.",
|
||||||
|
"product-discontinued-warning": "Этот продукт снят с производства и может больше не получать мгновенную поддержку или обновления",
|
||||||
|
"learn-our-solutions": "Узнайте о наших решениях",
|
||||||
|
"all": "Все",
|
||||||
|
"support-page-desc": "Zhejiang Jinshen Machinery Manufacturing Co., Ltd Стремится предоставлять клиентам высококачественные продукты и услуги. Мы предлагаем послепродажное обслуживание для таких продуктов, как машины для бумажных трубок и соломинок, обеспечивая уверенность клиентов в использовании нашей продукции.",
|
||||||
|
"support-card-desc": {
|
||||||
|
"faq": "Мы собрали ответы на часто задаваемые вопросы, чтобы помочь вам быстро решить свои проблемы.",
|
||||||
|
"documents": "Предоставляем документацию, такую как руководства по продуктам, технические спецификации, для удобства пользователей.",
|
||||||
|
"contact-info": "Свяжитесь с нами по телефону или электронной почте, и мы оперативно вам поможем."
|
||||||
|
},
|
||||||
|
"product-filter": {
|
||||||
|
"product-type": "Тип продукта",
|
||||||
|
"product-model": "Модель продукта",
|
||||||
|
"keyword": "Ключевое слово",
|
||||||
|
"select-product-type": "Выберите тип продукта",
|
||||||
|
"select-product-model": "Выберите модель продукта",
|
||||||
|
"enter-keyword": "Введите ключевое слово",
|
||||||
|
"misc": "разное",
|
||||||
|
"document-type": "Тип документа",
|
||||||
|
"question-type": "Тип вопроса",
|
||||||
|
"select-document-type": "Выберите тип документа",
|
||||||
|
"select-question-type": "Выберите тип вопроса"
|
||||||
|
},
|
||||||
|
"document-meta": {
|
||||||
|
"size": "Размер",
|
||||||
|
"format": "Формат",
|
||||||
|
"type": "Тип",
|
||||||
|
"upload-at": "Дата загрузки"
|
||||||
|
},
|
||||||
|
"document-action": {
|
||||||
|
"download": "Скачать",
|
||||||
|
"open-in-new-tab": "Открыть в новой вкладке",
|
||||||
|
"preview": "Предварительный просмотр"
|
||||||
|
},
|
||||||
|
"mobile-menu": {
|
||||||
|
"title": "Меню",
|
||||||
|
"navigation": "Навигация по сайту",
|
||||||
|
"utilities": "Полезные инструменты"
|
||||||
|
},
|
||||||
|
"homepage": {
|
||||||
|
"recommended-products": "Рекомендуемые продукты",
|
||||||
|
"recommended-products-desc": "Исследуйте наши тщательно отобранные продукты, которые удовлетворят все ваши потребности. Мы предлагаем как инновационные технологии, так и классические решения.",
|
||||||
|
"recommended-solutions": "Рекомендуемые решения",
|
||||||
|
"recommended-solutions-desc": "Узнайте о наших индивидуальных решениях, чтобы оптимизировать бизнес-процессы и повысить эффективность."
|
||||||
|
},
|
||||||
|
"page-title": {
|
||||||
|
"homepage": "Главная",
|
||||||
|
"products": "Центр продуктов",
|
||||||
|
"solutions": "Решения",
|
||||||
|
"support": "Поддержка",
|
||||||
|
"faq": "Часто задаваемые вопросы",
|
||||||
|
"documents": "Документация",
|
||||||
|
"contact-us": "Свяжитесь с нами",
|
||||||
|
"download": "Скачать докумен",
|
||||||
|
"preview": "Просмотр документа",
|
||||||
|
"about-us": "О нас"
|
||||||
|
},
|
||||||
|
"product-tab": {
|
||||||
|
"details": "Детали продукта",
|
||||||
|
"specs": "Технические спецификации",
|
||||||
|
"faq": "Часто задаваемые вопросы",
|
||||||
|
"documents": "Связанные документы"
|
||||||
|
},
|
||||||
|
"redirecting": "Перенаправление..."
|
||||||
|
}
|
||||||
@ -10,6 +10,7 @@
|
|||||||
"result-count": "共 {count} 条结果",
|
"result-count": "共 {count} 条结果",
|
||||||
"no-results": "没有找到与 “{query}” 匹配的内容。",
|
"no-results": "没有找到与 “{query}” 匹配的内容。",
|
||||||
"no-query": "请输入关键字开始搜索。",
|
"no-query": "请输入关键字开始搜索。",
|
||||||
|
"section": "内容类型",
|
||||||
"untitled": "未命名条目",
|
"untitled": "未命名条目",
|
||||||
"sections": {
|
"sections": {
|
||||||
"product": "产品",
|
"product": "产品",
|
||||||
@ -22,8 +23,8 @@
|
|||||||
"company-name": "金申机械制造有限公司",
|
"company-name": "金申机械制造有限公司",
|
||||||
"company-description": "专业生产一系列纸管、纸罐设备,集设计、制造、销售、服务于一体。",
|
"company-description": "专业生产一系列纸管、纸罐设备,集设计、制造、销售、服务于一体。",
|
||||||
"learn-more": "了解更多",
|
"learn-more": "了解更多",
|
||||||
"products-desc": "我们提供高质量的产品解决方案,满足各种业务需求。",
|
"products-desc": "我们提供最新的产品与即时的服务支持,满足客户的各类业务需求。",
|
||||||
"solutions-desc": "为企业提供定制化的技术解决方案,助力数字化转型。",
|
"solutions-desc": "我们为企业提供多样化的技术解决方案,在工业、包装等多种领域提供支持。",
|
||||||
"support-desc": "7x24小时专业技术支持,确保您的业务稳定运行。",
|
"support-desc": "7x24小时专业技术支持,确保您的业务稳定运行。",
|
||||||
"quick-links": "快速链接",
|
"quick-links": "快速链接",
|
||||||
"utilities": "实用工具",
|
"utilities": "实用工具",
|
||||||
@ -37,7 +38,8 @@
|
|||||||
"downloads": "文件下载",
|
"downloads": "文件下载",
|
||||||
"faq": "常见问题",
|
"faq": "常见问题",
|
||||||
"documents": "文档资料",
|
"documents": "文档资料",
|
||||||
"calculator": "纸管计算工具"
|
"calculator": "纸管计算工具",
|
||||||
|
"address": "公司地址"
|
||||||
},
|
},
|
||||||
"contact-info": "联系我们",
|
"contact-info": "联系我们",
|
||||||
"telephone": "电话",
|
"telephone": "电话",
|
||||||
@ -61,7 +63,69 @@
|
|||||||
"back-to-home": "返回首页",
|
"back-to-home": "返回首页",
|
||||||
"no-content-available": "暂无详细信息",
|
"no-content-available": "暂无详细信息",
|
||||||
"loading": "加载中...",
|
"loading": "加载中...",
|
||||||
"our-products": "我们的产品",
|
"our-products": "我们的最新产品",
|
||||||
|
"find-discontinued-products": "如需查找其他产品,请使用搜索功能",
|
||||||
|
"product-discontinued-warning": "本产品已停产,可能不再提供即时的支持或更新",
|
||||||
"learn-our-solutions": "了解我们的解决方案",
|
"learn-our-solutions": "了解我们的解决方案",
|
||||||
"all": "全部"
|
"all": "全部",
|
||||||
|
"support-page-desc": "金申机械制造有限公司致力于为客户提供优质的产品与服务。针对纸管机、分纸机、纸吸管等产品,我们提供全方位的售后服务,确保客户能够安心地使用我们的产品。",
|
||||||
|
"support-card-desc": {
|
||||||
|
"faq": "我们为用户整理了常见问题的答案,帮助您快速解决疑惑。",
|
||||||
|
"documents": "提供产品手册、技术规格等文档资料,方便用户查阅。",
|
||||||
|
"contact-info": "通过电话、邮箱联系我们,我们将现场为您服务。"
|
||||||
|
},
|
||||||
|
"product-filter": {
|
||||||
|
"product-type": "产品类型",
|
||||||
|
"product-model": "产品系列",
|
||||||
|
"keyword": "关键词",
|
||||||
|
"select-product-type": "选择产品类型",
|
||||||
|
"select-product-model": "选择产品系列",
|
||||||
|
"enter-keyword": "输入关键词",
|
||||||
|
"question-type": "问题类型",
|
||||||
|
"select-question-type": "选择问题类型",
|
||||||
|
"document-type": "文档类型",
|
||||||
|
"select-document-type": "选择文档类型",
|
||||||
|
"misc": "其他"
|
||||||
|
},
|
||||||
|
"document-meta": {
|
||||||
|
"size": "大小",
|
||||||
|
"format": "格式",
|
||||||
|
"type": "类型",
|
||||||
|
"upload-at": "上传时间"
|
||||||
|
},
|
||||||
|
"document-action": {
|
||||||
|
"download": "下载",
|
||||||
|
"open-in-new-tab": "在新标签页打开",
|
||||||
|
"preview": "预览"
|
||||||
|
},
|
||||||
|
"mobile-menu": {
|
||||||
|
"title": "菜单",
|
||||||
|
"navigation": "站内导航",
|
||||||
|
"utilities": "实用工具"
|
||||||
|
},
|
||||||
|
"homepage": {
|
||||||
|
"recommended-products": "推荐产品",
|
||||||
|
"recommended-products-desc": "探索我们的精选产品,满足您的各种需求。无论是创新技术还是经典设计,我们都为您提供优质选择。",
|
||||||
|
"recommended-solutions": "推荐解决方案",
|
||||||
|
"recommended-solutions-desc": "了解我们的定制解决方案,帮助您优化业务流程,提高效率。"
|
||||||
|
},
|
||||||
|
"page-title": {
|
||||||
|
"homepage": "首页",
|
||||||
|
"products": "产品中心",
|
||||||
|
"solutions": "解决方案",
|
||||||
|
"support": "服务支持",
|
||||||
|
"faq": "常见问题",
|
||||||
|
"documents": "文档资料",
|
||||||
|
"contact-us": "联系我们",
|
||||||
|
"download": "文档下载",
|
||||||
|
"preview": "文档预览",
|
||||||
|
"about-us": "关于我们"
|
||||||
|
},
|
||||||
|
"product-tab": {
|
||||||
|
"details": "产品详情",
|
||||||
|
"specs": "技术规格",
|
||||||
|
"faq": "常见问题",
|
||||||
|
"documents": "相关文档"
|
||||||
|
},
|
||||||
|
"redirecting": "正在跳转..."
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||||
|
import GraphQLLoader from 'vite-plugin-graphql-loader';
|
||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
compatibilityDate: '2025-07-15',
|
compatibilityDate: '2025-07-15',
|
||||||
devtools: { enabled: true },
|
devtools: { enabled: true },
|
||||||
@ -6,15 +8,29 @@ export default defineNuxtConfig({
|
|||||||
app: {
|
app: {
|
||||||
// head
|
// head
|
||||||
head: {
|
head: {
|
||||||
title: '金申机械制造有限公司',
|
titleTemplate: '金申机械制造有限公司',
|
||||||
meta: [
|
meta: [
|
||||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||||
{
|
{
|
||||||
name: 'description',
|
name: 'description',
|
||||||
content: 'Jinshen Website',
|
content:
|
||||||
|
'浙江金申机械制造有限公司,专业生产一系列纸管、纸罐设备,是一家集设计、制造、销售、服务于一体的企业。公司主要 产品有原纸分切机、数控纸管机、纸管精切机及纸管后加工设备等 三十多个品种,产品在造纸、印刷、包装、纺织及文具等行业得到 广泛应用。公司依靠科技进步,引进高新技术,致力于新产品开发及技术改造,并配备完善的销售网络和售后服务体系,产品销往全国各地及全球上百个国家和地区,真正做到让客户买的放心,用的安心。',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
htmlAttrs: {
|
||||||
|
lang: 'zh',
|
||||||
|
},
|
||||||
|
link: [
|
||||||
|
{ rel: 'icon', type: 'image/x-icon', href: '/jinshen-logo.ico' },
|
||||||
|
{
|
||||||
|
rel: 'apple-touch-icon',
|
||||||
|
href: '/jinshen-logo.png',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
rel: 'manifest',
|
||||||
|
href: '/manifest.json',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -38,6 +54,10 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
directus: {
|
directus: {
|
||||||
url: process.env.DIRECTUS_URL || 'http://localhost:8055',
|
url: process.env.DIRECTUS_URL || 'http://localhost:8055',
|
||||||
|
publicUrl:
|
||||||
|
process.env.DIRECTUS_PUBLIC_URL ||
|
||||||
|
process.env.DIRECTUS_URL ||
|
||||||
|
'http://localhost:8055',
|
||||||
token: process.env.DIRECTUS_TOKEN || undefined,
|
token: process.env.DIRECTUS_TOKEN || undefined,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -62,6 +82,7 @@ export default defineNuxtConfig({
|
|||||||
'@unocss/reset/tailwind.css',
|
'@unocss/reset/tailwind.css',
|
||||||
'~/assets/scss/index.scss',
|
'~/assets/scss/index.scss',
|
||||||
'~/assets/css/fonts.css',
|
'~/assets/css/fonts.css',
|
||||||
|
'~/assets/css/typography.css',
|
||||||
'@mdi/font/css/materialdesignicons.min.css',
|
'@mdi/font/css/materialdesignicons.min.css',
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -86,6 +107,7 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
plugins: [GraphQLLoader()],
|
||||||
},
|
},
|
||||||
|
|
||||||
devServer: {
|
devServer: {
|
||||||
@ -100,6 +122,7 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
|
|
||||||
i18n: {
|
i18n: {
|
||||||
|
baseUrl: process.env.BASE_URL || 'http://localhost:3000',
|
||||||
detectBrowserLanguage: {
|
detectBrowserLanguage: {
|
||||||
useCookie: true,
|
useCookie: true,
|
||||||
cookieKey: 'i18n_redirected',
|
cookieKey: 'i18n_redirected',
|
||||||
@ -109,6 +132,8 @@ export default defineNuxtConfig({
|
|||||||
locales: [
|
locales: [
|
||||||
{ code: 'en', language: 'en-US', name: 'English', file: 'en.json' },
|
{ code: 'en', language: 'en-US', name: 'English', file: 'en.json' },
|
||||||
{ code: 'zh', language: 'zh-CN', name: '简体中文', file: 'zh.json' },
|
{ code: 'zh', language: 'zh-CN', name: '简体中文', file: 'zh.json' },
|
||||||
|
{ code: 'es', language: 'es-ES', name: 'Español', file: 'es.json' },
|
||||||
|
{ code: 'ru', language: 'ru-RU', name: 'Русский', file: 'ru.json' },
|
||||||
],
|
],
|
||||||
defaultLocale: 'zh',
|
defaultLocale: 'zh',
|
||||||
strategy: 'prefix_except_default',
|
strategy: 'prefix_except_default',
|
||||||
|
|||||||
@ -22,14 +22,20 @@
|
|||||||
"@types/markdown-it": "^14.1.2",
|
"@types/markdown-it": "^14.1.2",
|
||||||
"@unocss/nuxt": "^66.4.2",
|
"@unocss/nuxt": "^66.4.2",
|
||||||
"@vueuse/nuxt": "^13.6.0",
|
"@vueuse/nuxt": "^13.6.0",
|
||||||
|
"dom-serializer": "^2.0.0",
|
||||||
|
"domhandler": "^5.0.3",
|
||||||
"dompurify": "^3.2.6",
|
"dompurify": "^3.2.6",
|
||||||
"element-plus": "^2.10.7",
|
"element-plus": "^2.10.7",
|
||||||
|
"fuse.js": "^7.1.0",
|
||||||
|
"graphql": "^16.12.0",
|
||||||
|
"htmlparser2": "^10.0.0",
|
||||||
"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",
|
"nuxt-directus": "5.7.0",
|
||||||
"sass": "^1.90.0",
|
"sass": "^1.90.0",
|
||||||
"sharp": "^0.34.3",
|
"sharp": "^0.34.3",
|
||||||
|
"vite-plugin-graphql-loader": "^4.0.4",
|
||||||
"vue": "^3.5.18",
|
"vue": "^3.5.18",
|
||||||
"vue-router": "^4.5.1"
|
"vue-router": "^4.5.1"
|
||||||
},
|
},
|
||||||
|
|||||||
60
pnpm-lock.yaml
generated
60
pnpm-lock.yaml
generated
@ -41,12 +41,27 @@ importers:
|
|||||||
'@vueuse/nuxt':
|
'@vueuse/nuxt':
|
||||||
specifier: ^13.6.0
|
specifier: ^13.6.0
|
||||||
version: 13.9.0(magicast@0.3.5)(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))(vue@3.5.21(typescript@5.9.2))
|
version: 13.9.0(magicast@0.3.5)(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))(vue@3.5.21(typescript@5.9.2))
|
||||||
|
dom-serializer:
|
||||||
|
specifier: ^2.0.0
|
||||||
|
version: 2.0.0
|
||||||
|
domhandler:
|
||||||
|
specifier: ^5.0.3
|
||||||
|
version: 5.0.3
|
||||||
dompurify:
|
dompurify:
|
||||||
specifier: ^3.2.6
|
specifier: ^3.2.6
|
||||||
version: 3.2.6
|
version: 3.2.6
|
||||||
element-plus:
|
element-plus:
|
||||||
specifier: ^2.10.7
|
specifier: ^2.10.7
|
||||||
version: 2.11.2(vue@3.5.21(typescript@5.9.2))
|
version: 2.11.2(vue@3.5.21(typescript@5.9.2))
|
||||||
|
fuse.js:
|
||||||
|
specifier: ^7.1.0
|
||||||
|
version: 7.1.0
|
||||||
|
graphql:
|
||||||
|
specifier: ^16.12.0
|
||||||
|
version: 16.12.0
|
||||||
|
htmlparser2:
|
||||||
|
specifier: ^10.0.0
|
||||||
|
version: 10.0.0
|
||||||
markdown-it:
|
markdown-it:
|
||||||
specifier: ^14.1.0
|
specifier: ^14.1.0
|
||||||
version: 14.1.0
|
version: 14.1.0
|
||||||
@ -65,6 +80,9 @@ importers:
|
|||||||
sharp:
|
sharp:
|
||||||
specifier: ^0.34.3
|
specifier: ^0.34.3
|
||||||
version: 0.34.3
|
version: 0.34.3
|
||||||
|
vite-plugin-graphql-loader:
|
||||||
|
specifier: ^4.0.4
|
||||||
|
version: 4.0.4
|
||||||
vue:
|
vue:
|
||||||
specifier: ^3.5.18
|
specifier: ^3.5.18
|
||||||
version: 3.5.21(typescript@5.9.2)
|
version: 3.5.21(typescript@5.9.2)
|
||||||
@ -3081,6 +3099,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
|
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
|
||||||
engines: {node: '>=0.12'}
|
engines: {node: '>=0.12'}
|
||||||
|
|
||||||
|
entities@6.0.1:
|
||||||
|
resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==}
|
||||||
|
engines: {node: '>=0.12'}
|
||||||
|
|
||||||
env-paths@2.2.1:
|
env-paths@2.2.1:
|
||||||
resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==}
|
resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
@ -3495,6 +3517,16 @@ packages:
|
|||||||
graphemer@1.4.0:
|
graphemer@1.4.0:
|
||||||
resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==}
|
resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==}
|
||||||
|
|
||||||
|
graphql-tag@2.12.6:
|
||||||
|
resolution: {integrity: sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==}
|
||||||
|
engines: {node: '>=10'}
|
||||||
|
peerDependencies:
|
||||||
|
graphql: ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0
|
||||||
|
|
||||||
|
graphql@16.12.0:
|
||||||
|
resolution: {integrity: sha512-DKKrynuQRne0PNpEbzuEdHlYOMksHSUI8Zc9Unei5gTsMNA2/vMpoMz/yKba50pejK56qj98qM0SjYxAKi13gQ==}
|
||||||
|
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'}
|
||||||
@ -3525,6 +3557,9 @@ packages:
|
|||||||
hookable@5.5.3:
|
hookable@5.5.3:
|
||||||
resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==}
|
resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==}
|
||||||
|
|
||||||
|
htmlparser2@10.0.0:
|
||||||
|
resolution: {integrity: sha512-TwAZM+zE5Tq3lrEHvOlvwgj1XLWQCtaaibSN11Q+gGBAS7Y1uZSWwXXRe4iF6OXnaq1riyQAPFOBtYc77Mxq0g==}
|
||||||
|
|
||||||
http-errors@2.0.0:
|
http-errors@2.0.0:
|
||||||
resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==}
|
resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==}
|
||||||
engines: {node: '>= 0.8'}
|
engines: {node: '>= 0.8'}
|
||||||
@ -5385,6 +5420,9 @@ packages:
|
|||||||
vue-tsc:
|
vue-tsc:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
vite-plugin-graphql-loader@4.0.4:
|
||||||
|
resolution: {integrity: sha512-lYnpQ2luV2fcuXmOJADljuktfMbDW00Y+6QS+Ek8Jz1Vdzlj/51LSGJwZqyjJ24a5YQ+o29Hr6el/5+nlZetvg==}
|
||||||
|
|
||||||
vite-plugin-inspect@11.3.3:
|
vite-plugin-inspect@11.3.3:
|
||||||
resolution: {integrity: sha512-u2eV5La99oHoYPHE6UvbwgEqKKOQGz86wMg40CCosP6q8BkB6e5xPneZfYagK4ojPJSj5anHCrnvC20DpwVdRA==}
|
resolution: {integrity: sha512-u2eV5La99oHoYPHE6UvbwgEqKKOQGz86wMg40CCosP6q8BkB6e5xPneZfYagK4ojPJSj5anHCrnvC20DpwVdRA==}
|
||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
@ -8991,6 +9029,8 @@ snapshots:
|
|||||||
|
|
||||||
entities@4.5.0: {}
|
entities@4.5.0: {}
|
||||||
|
|
||||||
|
entities@6.0.1: {}
|
||||||
|
|
||||||
env-paths@2.2.1: {}
|
env-paths@2.2.1: {}
|
||||||
|
|
||||||
environment@1.1.0: {}
|
environment@1.1.0: {}
|
||||||
@ -9476,6 +9516,13 @@ snapshots:
|
|||||||
|
|
||||||
graphemer@1.4.0: {}
|
graphemer@1.4.0: {}
|
||||||
|
|
||||||
|
graphql-tag@2.12.6(graphql@16.12.0):
|
||||||
|
dependencies:
|
||||||
|
graphql: 16.12.0
|
||||||
|
tslib: 2.8.1
|
||||||
|
|
||||||
|
graphql@16.12.0: {}
|
||||||
|
|
||||||
gzip-size@6.0.0:
|
gzip-size@6.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
duplexer: 0.1.2
|
duplexer: 0.1.2
|
||||||
@ -9512,6 +9559,13 @@ snapshots:
|
|||||||
|
|
||||||
hookable@5.5.3: {}
|
hookable@5.5.3: {}
|
||||||
|
|
||||||
|
htmlparser2@10.0.0:
|
||||||
|
dependencies:
|
||||||
|
domelementtype: 2.3.0
|
||||||
|
domhandler: 5.0.3
|
||||||
|
domutils: 3.2.2
|
||||||
|
entities: 6.0.1
|
||||||
|
|
||||||
http-errors@2.0.0:
|
http-errors@2.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
depd: 2.0.0
|
depd: 2.0.0
|
||||||
@ -11722,6 +11776,12 @@ snapshots:
|
|||||||
optionator: 0.9.4
|
optionator: 0.9.4
|
||||||
typescript: 5.9.2
|
typescript: 5.9.2
|
||||||
|
|
||||||
|
vite-plugin-graphql-loader@4.0.4:
|
||||||
|
dependencies:
|
||||||
|
graphql: 16.12.0
|
||||||
|
graphql-tag: 2.12.6(graphql@16.12.0)
|
||||||
|
magic-string: 0.30.19
|
||||||
|
|
||||||
vite-plugin-inspect@11.3.3(@nuxt/kit@3.19.2(magicast@0.3.5))(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)):
|
vite-plugin-inspect@11.3.3(@nuxt/kit@3.19.2(magicast@0.3.5))(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)):
|
||||||
dependencies:
|
dependencies:
|
||||||
ansis: 4.1.0
|
ansis: 4.1.0
|
||||||
|
|||||||
BIN
public/jinshen-logo.ico
Normal file
BIN
public/jinshen-logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
BIN
public/logo196x196.png
Normal file
BIN
public/logo196x196.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
public/logo512x512.png
Normal file
BIN
public/logo512x512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 60 KiB |
20
public/manifest.json
Normal file
20
public/manifest.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "金申机械制造有限公司",
|
||||||
|
"short_name": "金申机械",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "/logo196x196.png",
|
||||||
|
"sizes": "196x196",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/logo512x512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"background_color": "#ffffff",
|
||||||
|
"theme_color": "#0f172a"
|
||||||
|
}
|
||||||
36
server/api/assets/[id].ts
Normal file
36
server/api/assets/[id].ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
export default defineEventHandler(async (event) => {
|
||||||
|
const id = getRouterParam(event, 'id');
|
||||||
|
if (!id)
|
||||||
|
throw createError({
|
||||||
|
statusCode: 400,
|
||||||
|
statusMessage: 'ID parameter is required',
|
||||||
|
});
|
||||||
|
|
||||||
|
const url = new URL(`${useRuntimeConfig().public.directus.url}/assets/${id}`);
|
||||||
|
|
||||||
|
const query = getQuery(event);
|
||||||
|
Object.entries(query).forEach(([key, value]) => {
|
||||||
|
url.searchParams.set(key, String(value));
|
||||||
|
});
|
||||||
|
|
||||||
|
const token = useRuntimeConfig().public.directus.token || '';
|
||||||
|
const res = await fetch(url.toString(), {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
throw createError({
|
||||||
|
statusCode: res.status,
|
||||||
|
statusMessage: `Failed to fetch asset: ${res.statusText}`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const contentType =
|
||||||
|
res.headers.get('Content-Type') || 'application/octet-stream';
|
||||||
|
setHeader(event, 'Content-Type', contentType);
|
||||||
|
setHeader(event, 'Cache-Control', 'public, max-age=86400, immutable');
|
||||||
|
|
||||||
|
return res.body;
|
||||||
|
});
|
||||||
15
server/api/cms/companyProfile.get.ts
Normal file
15
server/api/cms/companyProfile.get.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { companyProfileService } from '~~/server/services/cms/companyProfileService';
|
||||||
|
|
||||||
|
export default defineEventHandler(async (event) => {
|
||||||
|
const locale = getHeader(event, 'x-locale') || 'zh-CN';
|
||||||
|
|
||||||
|
const companyProfile = await companyProfileService.getCompanyProfile(locale);
|
||||||
|
|
||||||
|
companyProfile.content = rewriteAssetUrls(
|
||||||
|
companyProfile.content,
|
||||||
|
useRuntimeConfig().public.directus.publicUrl,
|
||||||
|
'/api/assets'
|
||||||
|
);
|
||||||
|
|
||||||
|
return companyProfile;
|
||||||
|
});
|
||||||
15
server/api/cms/contactInfo.get.ts
Normal file
15
server/api/cms/contactInfo.get.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { contactInfoService } from '~~/server/services/cms/contactInfoService';
|
||||||
|
|
||||||
|
export default defineEventHandler(async (event) => {
|
||||||
|
const locale = getHeader(event, 'x-locale') || 'zh-CN';
|
||||||
|
|
||||||
|
const contactInfo = await contactInfoService.getContactInfo(locale);
|
||||||
|
|
||||||
|
contactInfo.content = rewriteAssetUrls(
|
||||||
|
contactInfo.content,
|
||||||
|
useRuntimeConfig().public.directus.publicUrl,
|
||||||
|
'/api/assets'
|
||||||
|
);
|
||||||
|
|
||||||
|
return contactInfo;
|
||||||
|
});
|
||||||
7
server/api/cms/documentList.get.ts
Normal file
7
server/api/cms/documentList.get.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { documentService } from '~~/server/services/cms/documentService';
|
||||||
|
|
||||||
|
export default defineEventHandler(async (event) => {
|
||||||
|
const locale = getHeader(event, 'x-locale') || 'zh-CN';
|
||||||
|
|
||||||
|
return documentService.getDocumentList(locale);
|
||||||
|
});
|
||||||
7
server/api/cms/homepage.get.ts
Normal file
7
server/api/cms/homepage.get.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { homepageService } from '~~/server/services/cms/homepageService';
|
||||||
|
|
||||||
|
export default defineEventHandler(async (event) => {
|
||||||
|
const locale = getHeader(event, 'x-locale') || 'zh-CN';
|
||||||
|
|
||||||
|
return homepageService.getHomepage(locale);
|
||||||
|
});
|
||||||
21
server/api/cms/product/[id].get.ts
Normal file
21
server/api/cms/product/[id].get.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { productService } from '~~/server/services/cms/productService';
|
||||||
|
|
||||||
|
export default defineEventHandler(async (event) => {
|
||||||
|
const id = getRouterParam(event, 'id');
|
||||||
|
if (!id)
|
||||||
|
throw createError({
|
||||||
|
statusCode: 400,
|
||||||
|
statusMessage: 'Product ID is required',
|
||||||
|
});
|
||||||
|
const locale = getHeader(event, 'x-locale') || 'zh-CN';
|
||||||
|
|
||||||
|
const product = await productService.getProductById(id, locale);
|
||||||
|
|
||||||
|
product.description = rewriteAssetUrls(
|
||||||
|
product.description,
|
||||||
|
useRuntimeConfig().public.directus.publicUrl,
|
||||||
|
'/api/assets'
|
||||||
|
);
|
||||||
|
|
||||||
|
return product;
|
||||||
|
});
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user