Compare commits

...

136 Commits

Author SHA1 Message Date
66adf7f545 fix: 修正面包屑导航的显示逻辑
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m7s
- 竖屏下不显示面包屑导航
2025-12-27 17:06:03 +08:00
f87b977c87 fix: 调整面包屑导航的显示逻辑
- 在移动端隐藏面包屑导航
2025-12-27 17:05:41 +08:00
601c4abe53 fix: 修正计算器连接
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m3s
- 域名改为cal.jinshen.cn
2025-12-26 15:01:35 +08:00
b71ee98129 feat: 为Apple/PWA进行图标适配
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m23s
2025-12-24 14:56:28 +08:00
7611d4f079 fix: 调整页面渲染机制
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m9s
- 懒加载:部分页面添加懒加载机制,在用户访问时先加载静态资源在获取动态资源
- 骨架屏机制:各个页面的骨架屏渲染有el-skeleton自身模板控制
- 布局调整:部分页面布局调整
- i18n文本: 新增国际化文本redirecting
2025-12-19 13:28:54 +08:00
76fb3ddcb7 fix: 重定向页布局调整
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m54s
2025-12-19 13:26:48 +08:00
aa26731731 fix: 补全骨架屏渲染机制
- 补全各个页面的骨架屏渲染机制修改
2025-12-19 13:26:26 +08:00
f2533767d2 fix: 调整关于我们页面渲染机制
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m3s
- 骨架屏:骨架屏由el-skeleton模板控制
2025-12-19 12:53:01 +08:00
f1116491b6 fix: 调整解决方案列表渲染机制
- 骨架屏:解决方案列表页骨架屏渲染由el-skeleton模板控制
2025-12-19 12:48:36 +08:00
537a6b0bd6 fix: 调整产品列表页渲染机制
- 渲染机制:产品列表页懒加载采用el-skeleton自身模板机制
- 布局调整:调整产品页/骨架屏在竖屏下的布局
2025-12-19 12:00:42 +08:00
bcc08a53ea fix: 调整服务支持页面渲染模式
- 将条件渲染由div判断改为el-skeleton template
2025-12-19 11:38:33 +08:00
fa1a22b286 feat: 服务支持页懒加载
- 骨架屏调整:服务支持页骨架屏布局调整
- 懒加载:服务支持页添加懒加载机制
2025-12-19 11:17:32 +08:00
8c720b7ac3 fix: 修正查询/搜索无法完全显示的问题
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m7s
- 扩大查询/搜索的最大条目数
2025-12-18 15:05:57 +08:00
33c0b9cc43 fix: 修正搜索条目无法完全显示的问题
- 为查询/搜索添加更大的limit
2025-12-18 15:05:17 +08:00
fcaf595b73 feat: 添加ICP跳转链接
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m13s
2025-12-13 16:08:38 +08:00
ef20832761 feat: 页脚添加ICP跳转链接
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m11s
- ICP跳转: 点击备案号跳转到工信部网站
2025-12-13 16:07:49 +08:00
03a692afb5 feat: 页面描述 & 停产产品标示
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m59s
- 页面描述:产品列表与解决方案列表添加页面描述
- 停产标示:对于已停产产品,在产品详情页添加已停产标示
- 视图变更:产品视图添加Status字段,用于标示已停产产品
- 文案变更与补全:调整部分页面UI文案,并补全各个语言的新增文案
2025-12-10 14:10:03 +08:00
7b21def74f feat: 补全i18n翻译
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m59s
- 翻译补全: 补全英语、西班牙语、俄语的翻译
2025-12-10 14:06:58 +08:00
783d482e0a feat: 产品/解决方案列表页描述
- 页面描述:为产品列表与解决方案列表添加页面描述
- 停产提示:在产品列表中提示停产产品使用搜索功能
2025-12-10 14:00:05 +08:00
62ec215340 feat: 产品视图模型添加状态
- 产品状态:从Directus Schema获取Product的Status字段
- 视图字段:添加Status字段用于标示产品状态
- 测试方法:为Status字段添加单元测试
2025-12-10 13:35:00 +08:00
e02f975217 fix: 修正计算器跳转链接
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m9s
- 修正页面在竖屏状态下页面无法正确跳转到计算器页面的问题
2025-12-08 13:48:25 +08:00
5530776035 feat: 搜索页图片预览 & 文档列表显示文档类型
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m21s
- 缩略图预览: 搜索页栏目右侧添加缩略图预览功能
- 细分类型: 搜索页栏目添加细分类型展示:如产品(原纸分切机)
- 接口调整:
调整可选字段类型使其符合搜索引擎索引格式;将搜索条目中的type改为sectionType用于大类分类,并将type作为细分类型使用
- 文档类型: 文档页添加文档类型展示功能,当用户未指定文档类型时,在标题右侧显示文档类型
- 查询调整: 产品查询添加文档类型查询

ISSUE: Resolve #94
2025-12-05 17:23:34 +08:00
63cdff9c41 feat: 为文档库添加文档类型显示功能
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m10s
- 功能添加:在文档列表中,当未指定文档类型时,在标题右侧显示文档类型
- 查询更改:产品查询添加文档类型查询方法
- mapper更改:productDocumentView添加文档类型
2025-12-05 17:18:48 +08:00
f1398a5545 feat: 为搜索条目添加细分类型
- 类型细分:有原先的四大分类添加细分类型,例如产品(原纸分切机)
- 接口调整:原先的type分类改为sectionType并将type作为细分类型使用
2025-12-05 16:49:09 +08:00
36d24a4740 fix: 可选字段处理
- 为搜索条目中的可选字段进行判断并处理
2025-12-05 16:25:57 +08:00
c9b5b1fad9 feat: 为搜索页栏目添加图片缩略图功能
- 图片预览:产品与解决方案栏目添加缩略图功能
- 组件提取:在搜索结果页,将单个搜索结果单独提取为组件SearchResultCard
2025-12-05 14:56:24 +08:00
246a0b9d4f refactor(mapper): 为Server端的Mapper添加空值处理与类型控制逻辑
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m53s
- 空值处理与类型控制:为相关关系型字段的数据处理添加空值处理与类型控制
- 目录结构调整:分离Product/ProductList与Solution/SolutionList
- 修复bug:修复产品页与解决方案页无法正常触发404逻辑的问题
2025-12-04 17:57:07 +08:00
c3ac7c0985 fix: 修正产品/解决方案在归档后无法正常触发404 UI的问题
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m0s
2025-12-04 17:52:36 +08:00
63c3e2e364 refactor: 重构解决方案相关Mapper
- 空值处理与类型控制:为关系型字段添加空值处理与类型控制逻辑
- 目录结构调整:分离SolutionList与Solution相关的Mapper为不同的文件
2025-12-04 17:40:04 +08:00
1245df497b refactor: 重构产品相关Mapper
- 空值处理与类型控制:为相关关系型字段的数据处理添加空值处理与类型控制
- 调整目录结构:将文件目录按照实际查询划分为Product和ProductList两个文件
2025-12-04 17:38:43 +08:00
f081a3b33a feat(support): 为文档库/相关问题页面添加类型筛选功能
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m1s
- 功能添加:文档库/FAQ页添加类型筛选功能
- 类型同步:前端补全问题类型与文档类型的类型标注,与后端移至
- 查询变更:GraphQL查询增添文档/问题类型查询
- 组件分离:将原先文档库与FAQ页共用的ProductFilter分离为两个不同的组件:DocumentFilter与QuestionFilter
- i18n文本补全:为新增的相关文本补全国际化翻译
2025-12-03 18:00:03 +08:00
3c6bff4d31 chore: 删除无用组件
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m4s
- 文档页与问题页的筛选器分离为两个不同的组件,原先product-filter删除
2025-12-03 17:58:26 +08:00
5011448902 chore: 补全i18n文本
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m55s
- 补全俄语与西班牙语的i18n翻译
2025-12-03 17:53:18 +08:00
53f3e99d90 feat: 文档库页面添加文档类型筛选功能
- 功能添加:添加按照文档类型筛选文档的功能
- 组件更改:将筛选器由product-filter改为document-filter
2025-12-03 17:47:57 +08:00
815df40745 style: 删除无用class 2025-12-03 17:33:28 +08:00
c27337a145 feat: 文档库查询添加文档类型字段
- graphQL查询修改:添加type字段查询
- 视图模型字段更新:添加DocumentTypeView视图模型并为DocumentList类型添加type字段
- mapper更新: 添加DocumentType的转换方法
2025-12-03 17:30:16 +08:00
3fb721f278 test: 修改测试用例 2025-12-03 17:17:34 +08:00
a4dc28fc97 feat: 问题列表添加问题类型筛选功能
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m4s
- 功能添加:添加问题筛选功能
- 组件更改:将product-filter改为question-filter
- 文本添加:i18n文本添加
2025-12-03 16:59:11 +08:00
55a35b5498 chore: 调整字段名
- 将问题类型的类型名字段命名由type改为name
2025-12-03 16:56:57 +08:00
f4ec82a150 feat: 相关问题查询添加问题类型查询
- 查询语句更改:添加type字段
- mapper增添:添加type字段的mapper
- 视图模型更改:QuestionListView添加type字段
2025-12-03 15:53:20 +08:00
c82fea48b8 chore: 类型同步
- 后端CMS为问题/文档添加类型字段,前端同步更改
2025-12-03 14:26:20 +08:00
39a23fb382 feat: 计算器跳转链接修改
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m14s
- 将纸管计算工具跳转链接修改为正式版本版本
2025-12-02 17:03:47 +08:00
871b203a5e feat: 调整计算器URL
- 将计算器链接改为云服务器上的服务
2025-12-02 17:01:25 +08:00
b746247ccc feat(pagination): 问题库/文档库的分页功能实现
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m18s
- 为文档库/问题库实现分页功能,当前按照一页10个栏目分页
- 问题跳转时确保能够正常触发分页逻辑与聚焦逻辑
- 调整部分graphQL改动导致的类型匹配问题
2025-12-02 15:31:25 +08:00
97069815dc feat: 常见问题页面分页逻辑
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m31s
- el-pagination提供分页功能
- 从搜索页跳转到本路由时,自动跳转并聚焦指定问题
2025-12-02 15:29:06 +08:00
5194c72695 feat: 文档库分页功能
- el-pagination提供分页功能
2025-12-02 14:49:26 +08:00
dbe75ee080 fix: 调整变量类型
- 将id相关类型由number修改为string,符合graphQL规范
2025-12-02 14:33:10 +08:00
4471851c62 fix: 补全缺失的i18n文本
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m15s
- 搜索栏目与搜索卡片内部分文本补全
2025-11-24 14:23:13 +08:00
15a75f965b fix: 补全搜索页面缺失的翻译内容
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m13s
- 栏目标题、搜索卡片类型翻译
2025-11-24 14:18:41 +08:00
5a4cef52be feat: 添加西班牙语与俄语适配
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m5s
- 西班牙语与俄语i18n文本
- 对应语言切换选项
2025-11-21 16:53:03 +08:00
30ffc7e557 feat: 添加机器翻译标注
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m1s
2025-11-21 16:51:49 +08:00
c4b9ed7bae feat: 补全i18n文本
Some checks failed
deploy to server / build-and-deploy (push) Has been cancelled
- 补全西班牙语与俄语文本
2025-11-21 16:50:05 +08:00
fc6c922ac3 feat: 站点的语言切换选项添加西班牙语与俄语选项
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m18s
- WIP: i18n文本尚未完善
2025-11-20 15:35:20 +08:00
54389b32ac fix: 修改地图开启逻辑
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m7s
- 当单击公司地址时,先在新标签页开启locate路由,再异步定向到合适的地图服务商页面
2025-11-19 15:04:51 +08:00
d8002a8265 fix: 修改地图开启逻辑
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m4s
- 当单击公司地址时,先在新标签页开启locate路由,再异步定向到合适的地图服务商页面
2025-11-19 15:03:59 +08:00
51042c395a feat: 修改地图服务的跳转链接
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m45s
- 将高德地图改为百度地图
2025-11-19 14:06:47 +08:00
6cf964e8f7 feat: 修改地图服务跳转链接
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m57s
- 将高德地图改为百度地图
2025-11-19 14:05:28 +08:00
456f2c69f2 fix: 调整地图跳转逻辑
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m10s
- 新增locate页,用于地图跳转
- 调整about页卡片布局
2025-11-18 17:04:29 +08:00
6f005c1404 fix: 调整地图跳转逻辑
Some checks failed
deploy to server / build-and-deploy (push) Has been cancelled
- 新增locate页,用于地图跳转
- 调整about页卡片布局
2025-11-18 17:03:40 +08:00
1ab6d92226 feat: about页面添加公司地址跳转功能
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m3s
- 外部链接跳转:点击公司地址时,跳转带外部地图服务商链接
- 智能跳转: 根据用户的连接情况,自动选择google地图或者高德地图
2025-11-18 14:16:39 +08:00
67629ed518 feat: about页面添加公司地址跳转功能
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m21s
- 外部链接跳转:点击公司地址时,跳转带外部地图服务商链接
- 智能跳转: 根据用户的连接情况,自动选择google地图或者高德地图
2025-11-18 14:11:43 +08:00
fe8a0e7656 fix: 修复specs无法正常转换的问题
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m8s
- 修正查询语句: 补全spces的id字段
2025-11-17 14:48:36 +08:00
a82872c1c1 fix: 修复specs无法正常转换的问题
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m12s
- 修正GraphQL查询语句:补全Specs的id字段
2025-11-17 14:46:46 +08:00
02ecb18147 fix: 问题列表无法聚焦问题
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m20s
- 将类型标注中的id字段改为string,与GraphQL返回类型一致
- 问题id比较随之更改为字符串匹配
- 删除无用导出

ISSUE: Resolve #83
2025-11-15 16:39:06 +08:00
05c970d1e7 chore: 删除无用导出
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m19s
- 删除useMeilisearch
2025-11-15 16:33:52 +08:00
496548afa4 fix: 修复前端类型标注与GraphQL访问数据不同的问题
- 将类型标注中的id字段改为string
2025-11-15 16:33:30 +08:00
6f08701847 fix: 修复无法搜索问题
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m51s
- 将搜索服务移至Server端
2025-11-14 14:59:03 +08:00
17bb8adee3 fix: 修复Server搜索问题
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m7s
- 将meilisearch搜索服务移至Server端
2025-11-14 14:57:55 +08:00
b2b631ed46 fix: 暂时将html渲染回滚到v-html
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m59s
- 暂时弃用html-renderer,改为v-html
- html-typography增添表格样式
2025-11-14 13:30:25 +08:00
ec9a097ef5 fix: 暂时弃用html-renderer将html渲染回滚到v-html
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m56s
- 增添table样式
2025-11-14 13:29:00 +08:00
3fb28c3f00 test: 优化测试代码
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m6s
- 显式导入相关依赖以避免Vitest的依赖问题

ISSUE: close: #46
2025-11-14 12:34:59 +08:00
d7bd034d7d test: 优化测试代码
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m5s
- 显式导入相关依赖以避免相关问题
2025-11-14 12:23:49 +08:00
341a9c4066 refactor: 将页面的Markdown渲染改为HTML渲染
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m57s
- 前后端通信:后端相关字段由Markdown改为WYSIWYG,前端做出响应更改
- 页面显示调整: 移除解决方案页创建日期显示
- 工具添加: 添加Asset处理方法,将CMS域名URL重写为Server API URL
- 代码整理:移除部分弃用代码

ISSUES: Close: #40 Resolve: #24
2025-11-14 11:48:17 +08:00
ee1597d2c3 fix: 调整URL转换的baseURL
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m54s
- 将baseURL由directus_url转为directus_public_url
2025-11-14 11:42:29 +08:00
17d10a7d80 chore: 移除部分无用代码
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m37s
2025-11-14 11:06:09 +08:00
54d0e297ea feat: 将Markdown渲染改为HTML渲染
- CMS相关字段由Markdown改为WYSIWYG,前端做出对应更改
- AssetUrl重写:将CMS地址重写为本地API
2025-11-14 11:06:00 +08:00
644dfa329c fix: 删除解决方案页的创建日期显示 2025-11-14 09:55:35 +08:00
100b79f99b feat: 将Solution的内容渲染有Markdown改为Html 2025-11-14 09:54:41 +08:00
f4f7e490b4 fix: 修正服务支持页面文本错误
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m56s
2025-11-14 08:06:00 +08:00
6418587738 fix: 修正服务支持页面描述文本错误
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m0s
2025-11-14 08:04:34 +08:00
6983f6568d feat!: 将QuestionList的内容渲染由Markdown改为HTML
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m10s
- 后端CMS字段由Markdown改为WYSIWYG因此前端做出对应修改
2025-11-14 00:07:31 +08:00
c860621e7a feat!: 将QuestionList的内容渲染由Markdown改为HTML
All checks were successful
deploy to server / build-and-deploy (push) Successful in 6m51s
- 后端CMS字段由Markdown改为WYSIWYG因此前端做出对应修改
2025-11-14 00:00:05 +08:00
154943815d refactor: 将Data到ViewModel的转换由App转移至Server端
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m42s
- 将逻辑转移到Server端后,简化前端逻辑
2025-11-13 20:51:09 +08:00
23f2700c0f refactor: 将Data到ViewModel的转换由App转移至Server端
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m15s
- 将逻辑转移到Server端后,简化前端逻辑
2025-11-13 20:45:43 +08:00
e215a4d498 fix: 修正GraphQL无法正常读取的问题
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m8s
- 将graphql查询文件移至server/assets,他们在构建后会以二进制形式写入server的存储中
- 在server端通过storage读取数据
2025-11-12 19:51:14 +08:00
50f0779a8e fix: 修正无法正常读取GraphQL的问题
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m22s
- 将GraphQL移至server/assets,在构建后会被写入server中
- 在server端通过storage读取数据
2025-11-12 19:49:17 +08:00
5ee6005ad1 refactor: 将前后端通信由app端移至server端
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m9s
- graphql请求的server端实现
- 文件请求的server端实现
2025-11-12 18:25:21 +08:00
a520775a8d refactor: 将文件请求由app端转到server端
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m2s
2025-11-12 18:19:21 +08:00
a5f3895794 refactor: 将数据获取从app端移至server端
- 调整数据获取位置以提升安全性
- 对于后端状态为Archived的数据,通过server控制不进行获取
2025-11-12 17:54:43 +08:00
58223734a2 feat: 前端请求添加Status控制
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m12s
- 产品页/解决方案页仅获取已发布条目
2025-11-12 14:50:55 +08:00
9163c7fe9a feat: 为前端请求添加Status控制
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m6s
- 在产品页/解决方案页等路由仅获取已发布条目
2025-11-12 14:48:51 +08:00
726c38a75d refactor: 重构项目的数据获取方法
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m1s
- 将相关数据获取由REST转为GraphQL
- 声明GraphQL模块
- 修改相关的Mapper与测试方法
2025-11-11 17:05:44 +08:00
81caa02d11 chore: 删除无用代码
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m30s
2025-11-11 17:02:02 +08:00
8213eec217 refactor: 关于我们页的API重构
Some checks failed
deploy to server / build-and-deploy (push) Has been cancelled
2025-11-11 17:01:18 +08:00
ac9e7b4436 refactor: 联系信息页的API重构 2025-11-11 16:58:40 +08:00
5ad6133252 refactor: 文档资料页的API重构 2025-11-11 16:55:41 +08:00
a07d77dde7 refactor: 问题列表的API重构 2025-11-11 16:49:58 +08:00
3e7b195002 refactor: 解决方案页的API重构 2025-11-11 16:43:08 +08:00
706b754905 refactor: 解决方案列表的API重构 2025-11-11 16:35:20 +08:00
0d77e97ad5 test: 完善测试 2025-11-11 16:15:05 +08:00
ac658e01ae refactor: 调整首页数据获取API
- 将首页的数据获取由REST重构为GraphQL
2025-11-11 16:14:58 +08:00
a93f508e85 refactor: 调整GraphQL导入形式
- 以纯文本形式导入
2025-11-11 16:08:24 +08:00
1290189d84 style: 格式化graphql文件 2025-11-11 16:01:20 +08:00
691dd34127 refactor: 产品页与产品列表的API重构
- 将产品页与产品列表的API由REST重构为GraphQL
- 修改Mapper与单元测试
2025-11-11 15:58:15 +08:00
7e7775ccc6 feat: 为Directus插件提供GraphQL支持
- 在Nuxt中引入GraphQL加载模块
- 为Directus引入GraphQl, Query
2025-11-11 15:52:27 +08:00
b234018f72 fix: 调整筛选条目排序权重
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m46s
- 以搜索条目匹配程度为标准排序
- 移除拼音支持
2025-11-10 17:28:24 +08:00
7b19f59409 fix: 调整筛选条目排序权重
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m49s
- 以搜索条目匹配程度为标准排序
- 移除拼音支持
2025-11-10 17:26:23 +08:00
9de6ab8799 fix: 调整模糊匹配阈值
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m6s
- 将阈值由0.3调整为0.6
2025-11-10 16:42:56 +08:00
86b0c29dcf fix: 调整模糊匹配阈值
Some checks failed
deploy to server / build-and-deploy (push) Has been cancelled
- 将阈值有0.3调整至0.6
2025-11-10 16:42:30 +08:00
352be1686a feat: 产品筛选器的模糊搜索
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m7s
- 引入前端依赖Fuse.js, pinyin-pro分别用于模糊匹配与拼音转换
- 新增Utils-fuzzyFilter,封装了Fuse的初始化/模糊匹配与相关工具函数
- 将前端由字符串匹配改为模糊匹配
2025-11-10 16:05:44 +08:00
710a0cdc5b feat: 支持拼音搜索
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m38s
- 使用pinyin-pro进行汉语拼音转换
- 调整搜索权重
2025-11-10 15:39:47 +08:00
4c8dfb5b56 feat: 产品筛选器的模糊搜索功能
- 引入纯前端依赖Fuse.js用于模糊匹配
- 新增Utils-fuzzyFilter封装Fuse的初始化与匹配
- 在前端将字符串匹配改为模糊匹配
2025-11-10 15:08:32 +08:00
007c8f9ce9 feat: 产品列表与解决方案列表的排序
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m4s
- 为产品/解决方案类型添加sort字段用于排序
- 各个栏目的类型按照sort升序排序
- 更新directus类型
2025-11-08 15:51:33 +08:00
0363a88785 feat: 解决方案列表页标签排序
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m1s
- 为SolutionType添加Sort字段用于排序
- 解决方案列表按照sort升序排序
2025-11-08 15:46:37 +08:00
308a080ea4 docs: 为ProductTypeView添加注释 2025-11-08 15:42:40 +08:00
a34cfaff6f fix: 修正product-list的遍历问题 2025-11-08 15:42:03 +08:00
bd894d6f2e feat: 产品列表页排序
- 为ProductType添加sort字段用于排序
- 产品列表页项目按照sort升序排序
2025-11-08 15:34:42 +08:00
b4da838cae feat: 添加自定义logger用于输出日志
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m6s
- 使用自定义logger,自定义输出级别
- 添加eslint规则,禁用console输出
- 将项目的console输出改为logger输出
2025-11-08 14:42:35 +08:00
660892f9e7 fix: 将原项目的console输出改为logger输出
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m11s
- 添加eslint,不允许使用console输出
2025-11-08 14:40:41 +08:00
2a021cbaea feat: 添加自定义日志系统logger
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m15s
2025-11-08 14:22:31 +08:00
d55fe5cce2 fix: 补全i18n文本
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m9s
- 补全产品详情页的tab标签文本翻译
2025-11-08 10:46:12 +08:00
9313700660 fix: 补全i18n文本
Some checks failed
deploy to server / build-and-deploy (push) Has been cancelled
- 补全产品详情页的i18n文本
2025-11-08 10:45:29 +08:00
9d3276a56a fix: 补全SEO&调整列表样式
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m8s
- chore: 去除console.log输出
- fix: 补全SEO
- fix: 调整SpecTable表头样式
2025-11-08 10:15:19 +08:00
37e89c3eda chore: 去除console.log输出
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m4s
2025-11-08 10:10:19 +08:00
b386d4e60d fix: 补全SEO
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m2s
- 关于我们页面的SEO信息补全
2025-11-08 10:05:32 +08:00
bfdae60910 fix: 调整SpecTable表头样式
- 加粗标题
2025-11-08 10:03:15 +08:00
e04b9d57da feat: 为各个页面补全标题与SEO
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m54s
- 添加Composable API: usePageSeo用于为路由页面添加SEO
- 为各个页面补全路由标题与SEO

ISSUE: resolve #52
2025-11-07 15:40:01 +08:00
0265ea4978 feat: 为各个页面补全标题与SEO
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m4s
2025-11-07 15:37:18 +08:00
1cdc29b1ce fix: 调整部分图像显示问题
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m10s
- 产品/解决方案卡片图片宽度、比例调整
- 产品页竖屏是的文字边距调整
2025-11-07 14:38:07 +08:00
58e91ed67c fix: 调整部分图像显示问题
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m59s
- 产品/解决方案卡片图片宽度调整为100%并将比例设定为16/10
- 产品页在竖屏状态下的文字边距
2025-11-07 14:36:21 +08:00
191459ec5c fix: 修复download页面的导航路由
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m57s
- 删除`文件下载`的导航链接
- 添加返回到`服务支持`与`文档资料`的链接
2025-11-07 14:15:32 +08:00
881c0ab61e fix: 修正download页面的breadcrumb导航
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m50s
- 增添返回到服务支持与文档资料的链接
2025-11-07 13:40:17 +08:00
f8c95207c2 build: doker镜像构建时记录构建时间与commit-sha
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m49s
- 镜像构建时会向项目目录内的version.json写入构建时间与commit-sha,并在镜像启动时输出日志
- 添加用于获取版本号的/api/version
2025-11-06 17:47:23 +08:00
aba3729335 build: doker镜像构建时记录构建时间与gitcommit
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m59s
- 镜像构建时会向项目目录内的version.json写入构建时间与commit-sha,并在镜像启动时输出日志
- 添加用于获取版本号的server api
2025-11-06 17:45:09 +08:00
516ad9fa1c chore: 修复部分代码bug
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m0s
- 修正ProductView中的命名错误
- 移除弃置的Strapi方法
2025-11-06 16:58:00 +08:00
6a3493c7e1 chore: 修正部分代码bug
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m56s
- ProductView中faqs命名错误,修正为ProductQuestionView
- 移除useLocalizations中弃置的Strapi语言获取方法
2025-11-06 16:56:42 +08:00
162 changed files with 5486 additions and 2160 deletions

5
.graphqlrc.yaml Normal file
View 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}'

View File

@ -32,10 +32,20 @@ WORKDIR /app
# COPY .output folder # COPY .output folder
COPY --from=build /app/.output ./ 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 PORT=3000
ENV NITRO_PRESET=node-server ENV NITRO_PRESET=node-server
ENV HOST=0.0.0.0 ENV HOST=0.0.0.0
EXPOSE 3000 EXPOSE 3000
ENTRYPOINT ["/entrypoint.sh"]
CMD ["node", "/app/server/index.mjs"] CMD ["node", "/app/server/index.mjs"]

View 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);
}

View 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>

View File

@ -210,6 +210,7 @@
.recommend-card .el-image { .recommend-card .el-image {
width: 100%; width: 100%;
aspect-ratio: 16 / 10;
border-radius: 4px; border-radius: 4px;
} }

View File

@ -210,6 +210,7 @@
.recommend-card .el-image { .recommend-card .el-image {
width: 100%; width: 100%;
aspect-ratio: 16 / 10;
border-radius: 4px; border-radius: 4px;
} }

View File

@ -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>

View File

@ -38,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>
@ -105,6 +109,10 @@
margin-bottom: 2rem; margin-bottom: 2rem;
} }
.discontinued-warning {
color: var(--el-color-error);
}
@media (max-width: 768px) { @media (max-width: 768px) {
.product-header { .product-header {
grid-template-columns: 1fr; grid-template-columns: 1fr;
@ -117,6 +125,9 @@
.product-image .el-image { .product-image .el-image {
height: 300px; height: 300px;
} }
.product-info {
padding: 0 1rem;
}
.product-info h1 { .product-info h1 {
font-size: 1.5rem; font-size: 1.5rem;

View File

@ -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>

View File

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

View File

@ -3,19 +3,13 @@
<div class="search-results"> <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,19 +110,19 @@
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.type === 'document') { if (item.sectionType === 'document') {
return localePath({ path: `/download/${slug}` }); return localePath({ path: `/download/${slug}` });
} }
if (item.type === 'question') { if (item.sectionType === 'question') {
return localePath({ path: `/support/faq`, query: { focus: slug } }); return localePath({ path: `/support/faq`, query: { focus: slug } });
} }

View File

@ -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>

View File

@ -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>

View 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>

View File

@ -1,12 +1,12 @@
<template> <template>
<div class="question-category"> <div class="question-category">
<el-row class="hide-on-mobile" :gutter="12"> <el-row :gutter="12">
<el-col :span="8"> <el-col :span="12" :xs="12">
<span class="select-label">{{ <span class="select-label">{{
$t('product-filter.product-type') $t('product-filter.product-type')
}}</span> }}</span>
<el-select <el-select
v-model="model.selectedType" v-model="model.selectedProductType"
:placeholder="$t('product-filter.select-product-type')" :placeholder="$t('product-filter.select-product-type')"
clearable clearable
> >
@ -19,7 +19,7 @@
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="12" :xs="12">
<span class="select-label">{{ <span class="select-label">{{
$t('product-filter.product-model') $t('product-filter.product-model')
}}</span> }}</span>
@ -37,7 +37,25 @@
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="8"> <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> <span class="select-label">{{ $t('product-filter.keyword') }}</span>
<el-input <el-input
v-model="model.keyword" v-model="model.keyword"
@ -47,52 +65,6 @@
/> />
</el-col> </el-col>
</el-row> </el-row>
<el-row class="display-on-mobile" :gutter="12">
<el-col :span="12">
<span class="select-label">{{
$t('product-filter.product-type')
}}</span>
<el-select
v-model="model.selectedType"
: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">
<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-row>
<el-row class="display-on-mobile">
<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-row>
</div> </div>
</template> </template>
@ -101,19 +73,24 @@
defineProps({ defineProps({
productTypeOptions: { productTypeOptions: {
type: Array as () => Array<{ id: number; name: string }>, type: Array as () => Array<QuestionListProductType>,
default: () => [], default: () => [],
}, },
productOptions: { productOptions: {
type: Array as () => Array<{ id: number; name: string }>, type: Array as () => Array<QuestionListProduct>,
default: () => [],
},
questionTypeOptions: {
type: Array as () => Array<QuestionTypeView>,
default: () => [], default: () => [],
}, },
}); });
const model = defineModel<{ const model = defineModel<{
selectedProduct: string | null;
selectedProductType: string | null;
selectedQuestionType: string | null;
keyword: string; keyword: string;
selectedType: number | null;
selectedProduct: number | null;
}>(); }>();
</script> </script>
@ -132,18 +109,4 @@
height: 40px; height: 40px;
font-size: 0.9rem; font-size: 0.9rem;
} }
.display-on-mobile {
display: none;
}
@media (max-width: 768px) {
.hide-on-mobile {
display: none;
}
.display-on-mobile {
display: flex;
margin-bottom: 1rem;
}
}
</style> </style>

View File

@ -7,7 +7,17 @@
@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"
>{{ $t('document-meta.size') }}: {{ formatFileSize(doc.size) }} >{{ $t('document-meta.size') }}: {{ formatFileSize(doc.size) }}
@ -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;
} }

View File

@ -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 '';

View 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);
},
});

View File

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

View File

@ -67,6 +67,12 @@
<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>
@ -140,6 +146,12 @@
<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>

View File

@ -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>

View File

@ -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;
} }

View File

@ -8,7 +8,15 @@
: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>
@ -25,6 +33,8 @@
const activeNames = ref<(string | number)[]>([]); const activeNames = ref<(string | number)[]>([]);
const hydrated = ref(false);
// 当路由变化(包括初次挂载)时,检查是否需要聚焦 // 当路由变化(包括初次挂载)时,检查是否需要聚焦
watch( watch(
() => route.query.focus, () => route.query.focus,
@ -35,18 +45,32 @@
// 确保渲染完成后再操作 DOM // 确保渲染完成后再操作 DOM
await nextTick(); await nextTick();
const target = props.questions.find((q) => q.id === Number(focusId)); const target = props.questions.find((q) => q.id === focusId);
if (!target) return; if (!target) return;
// 展开目标项 // 展开目标项
activeNames.value = [target.id]; activeNames.value = [target.id];
await nextTick();
await new Promise((resolve) => setTimeout(resolve, 100)); // 等待动画完成
// 平滑滚动到对应位置 // 平滑滚动到对应位置
const el = document.querySelector(`#q-${target.id}`); // const el = document.querySelector(`#q-${target.id}`);
el?.scrollIntoView({ behavior: 'smooth', block: 'start' }); // 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 } { immediate: true }
); );
onMounted(() => {
hydrated.value = true;
});
</script> </script>
<style scoped> <style scoped>

View File

@ -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) {

View File

@ -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,
},
},
},
},
})
);
}); });
}; };

View File

@ -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,
},
},
},
},
})
);
}); });
}; };

View File

@ -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 {

View File

@ -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 };

View File

@ -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 },
},
},
},
},
},
},
})
);
}); });
}; };

View File

@ -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 },
},
},
},
},
})
);
}); });
}; };

View File

@ -1,110 +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 },
},
},
},
},
},
})
);
}); });
}; };

View File

@ -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 },
},
},
},
},
})
);
}); });
}; };

View File

@ -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 },
},
},
},
},
},
})
);
}); });
}; };

View File

@ -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 },
},
},
},
})
);
}); });
}; };

View File

@ -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 },
},
},
},
})
);
}); });
}; };

View File

@ -1,3 +1,2 @@
export * from './directus'; export * from './directus';
export * from './useLocalizations'; export * from './useLocalizations';
export * from './useMeilisearch';

View 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;
};

View File

@ -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语言对象 **/

View File

@ -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,
};
};

View 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',
});
}

View File

@ -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;

View File

@ -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>

View File

@ -1,106 +0,0 @@
import { describe, test, expect } from 'vitest';
/**
* 单元测试: toProductDocumentView
*/
describe('toProductDocumentView', () => {
test('convert raw data with fileId to ProductDocumentView correctly', () => {
const rawData: ProductDocument = {
id: 1,
file: 'rand-om__-uuid-1234',
translations: [{ id: 10, title: 'Document Title' }],
};
expect(toProductDocumentView(rawData)).toEqual({
id: 1,
fileId: 'rand-om__-uuid-1234',
filename: undefined,
title: 'Document Title',
url: 'http://localhost:8055/assets/rand-om__-uuid-1234',
size: undefined,
});
});
test('convert raw data with fileMeta to ProductDocumentView correctly', () => {
const rawData: ProductDocument = {
id: 1,
file: {
id: 'rand-om__-uuid-1234',
filename_download: 'document.pdf',
filesize: 2048,
},
translations: [{ id: 10, title: 'Document Title' }],
};
expect(toProductDocumentView(rawData)).toEqual({
id: 1,
fileId: 'rand-om__-uuid-1234',
filename: 'document.pdf',
title: 'Document Title',
url: 'http://localhost:8055/assets/rand-om__-uuid-1234',
size: 2048,
});
});
test('convert raw data with missing translations', () => {
const rawData: ProductDocument = {
id: 1,
file: 'rand-om__-uuid-1234',
translations: [],
};
expect(toProductDocumentView(rawData)).toEqual({
id: 1,
fileId: 'rand-om__-uuid-1234',
filename: undefined,
title: '',
url: 'http://localhost:8055/assets/rand-om__-uuid-1234',
size: undefined,
});
});
});
/**
* 单元测试: toDocumentListView
*/
describe('toProductDocumentView', () => {
test('convert raw data with fileId to DocumentListView correctly', () => {
const rawData: ProductDocument = {
id: 1,
file: 'rand-om__-uuid-1234',
translations: [{ id: 10, title: 'Document Title' }],
products: [
{
id: 10,
products_id: {
id: 1,
translations: [{ id: 1, name: 'Product A' }],
product_type: {
id: 1,
translations: [{ id: 1, name: 'Type A' }],
},
},
},
],
};
expect(toDocumentListView(rawData)).toEqual({
id: 1,
fileId: 'rand-om__-uuid-1234',
filename: undefined,
title: 'Document Title',
url: 'http://localhost:8055/assets/rand-om__-uuid-1234',
size: undefined,
products: [
{
id: 1,
name: 'Product A',
type: {
id: 1,
name: 'Type A',
},
},
],
});
});
});

View File

@ -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,
};
}

View File

@ -1,168 +0,0 @@
import { describe, test, expect } from 'vitest';
/**
* 单元测试: toProductListView
*/
describe('toProductListView', () => {
test('convert raw data to ProductListView correctly', () => {
const rawData: Product = {
id: 1,
translations: [
{ id: 10, name: 'Product Name', summary: 'Product Summary' },
],
cover: 'cover-file-uuid-1234',
product_type: {
id: 1,
translations: [{ id: 20, name: 'Type Name' }],
},
};
expect(toProductListView(rawData)).toEqual({
id: 1,
name: 'Product Name',
summary: 'Product Summary',
cover: 'cover-file-uuid-1234',
product_type: 'Type Name',
});
});
test('convert raw data with missing translations', () => {
const rawData: Product = {
id: 1,
translations: [],
cover: 'cover-file-uuid-1234',
product_type: {
id: 20,
translations: [],
},
};
expect(toProductListView(rawData)).toEqual({
id: 1,
name: '',
summary: '',
cover: 'cover-file-uuid-1234',
product_type: '',
});
});
});
/**
* 单元测试: toProductSpecView
*/
describe('toProductSpecView', () => {
test('convert raw data to ProductSpecView correctly', () => {
const rawData: ProductSpec = {
id: 1,
translations: [{ id: 1, key: 'Key', value: 'Value' }],
};
expect(toProductSpecView(rawData)).toEqual({
id: 1,
key: 'Key',
value: 'Value',
});
});
test('convert raw data with missing translations', () => {
const rawData: ProductSpec = {
id: 1,
translations: [],
};
expect(toProductSpecView(rawData)).toEqual({
id: 1,
key: '',
value: '',
});
});
});
/**
* 单元测试: toProductSpecGroupView
*/
describe('toProductSpecGroupView', () => {
test('convert raw data to ProductSpecGroupView correctly', () => {
const rawData: ProductSpecGroup = {
id: 1,
translations: [{ id: 1, name: 'Group Name' }],
specs: [
{ id: 1, translations: [{ id: 1, key: 'Key1', value: 'Value1' }] },
{ id: 2, translations: [{ id: 2, key: 'Key2', value: 'Value2' }] },
],
};
expect(toProductSpecGroupView(rawData)).toEqual({
id: 1,
name: 'Group Name',
specs: [
{ id: 1, key: 'Key1', value: 'Value1' },
{ id: 2, key: 'Key2', value: 'Value2' },
],
});
});
test('convert raw data with missing translations', () => {
const rawData: ProductSpecGroup = {
id: 1,
translations: [],
specs: [],
};
expect(toProductSpecGroupView(rawData)).toEqual({
id: 1,
name: '',
specs: [],
});
});
});
/**
* 单元测试: toProductView
*/
describe('toProductView', () => {
test('convert raw data to ProductView correctly', () => {
const rawData: Product = {
id: 1,
translations: [
{
id: 1,
name: 'Product Name',
summary: 'Product Summary',
description: 'Product Description',
},
],
};
expect(toProductView(rawData)).toEqual({
id: 1,
name: 'Product Name',
summary: 'Product Summary',
description: 'Product Description',
product_type: '',
images: [],
documents: [],
faqs: [],
specs: [],
});
});
test('convert raw data with missing translations', () => {
const rawData: Product = {
id: 1,
translations: [],
};
expect(toProductView(rawData)).toEqual({
id: 1,
name: '',
summary: '',
description: '',
product_type: '',
images: [],
documents: [],
faqs: [],
specs: [],
});
});
});

View File

@ -1,136 +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: '' };
const type = isObject<ProductType>(raw.product_type)
? raw.product_type.translations.length === 0
? ''
: raw.product_type.translations[0].name
: '';
return {
id: raw.id,
product_type: type,
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: '',
value: '',
};
return {
id: raw.id,
key: trans.key,
value: trans.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,
};
}

View File

@ -1,113 +0,0 @@
import { describe, expect, test } from 'vitest';
/**
* 单元测试: toProductQuestionView
*/
describe('toProductQuestionView', () => {
test('convert raw data to ProductQuestionView correctly', () => {
const rawData: Question = {
id: 1,
translations: [
{ id: 1, title: 'Question Title', content: 'Question Answer' },
],
};
expect(toProductQuestionView(rawData)).toEqual({
id: 1,
title: 'Question Title',
content: 'Question Answer',
});
});
test('convert raw data with missing translations', () => {
const rawData: Question = {
id: 1,
translations: [],
};
expect(toProductQuestionView(rawData)).toEqual({
id: 1,
title: '',
content: '',
});
});
});
/**
* 单元测试: toQuestionListView
*/
describe('toQuestionListView', () => {
test('convert raw data to QuestionListView correctly', () => {
const rawData: Question = {
id: 1,
translations: [
{ id: 1, title: 'Question Title', content: 'Question Answer' },
],
products: [
{
id: 1,
products_id: {
id: 1,
translations: [{ id: 1, name: 'Product Name' }],
product_type: {
id: 1,
translations: [{ id: 1, name: 'Type Name' }],
},
},
},
],
};
expect(toQuestionListView(rawData)).toEqual({
id: 1,
title: 'Question Title',
content: 'Question Answer',
products: [
{
id: 1,
name: 'Product Name',
type: {
id: 1,
name: 'Type Name',
},
},
],
});
});
test('convert raw data with missing translations', () => {
const rawData: Question = {
id: 1,
translations: [],
products: [
{
id: 1,
products_id: {
id: 1,
translations: [],
product_type: {
id: 1,
translations: [],
},
},
},
],
};
expect(toQuestionListView(rawData)).toEqual({
id: 1,
title: '',
content: '',
products: [
{
id: 1,
name: '',
type: {
id: 1,
name: '',
},
},
],
});
});
});

View File

@ -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,
};
}

View File

@ -1,88 +0,0 @@
import { describe, test, expect } from 'vitest';
/**
* 单元测试: toSolutionListView
*/
describe('toSolutionListView', () => {
test('convert raw data to SolutionListView correctly', () => {
const rawData: Solution = {
id: 1,
translations: [
{ id: 1, title: 'Solution Title', summary: 'Solution Summary' },
],
type: {
id: 1,
translations: [{ id: 1, name: 'Type Name' }],
},
};
expect(toSolutionListView(rawData)).toEqual({
id: 1,
title: 'Solution Title',
summary: 'Solution Summary',
solution_type: 'Type Name',
});
});
test('convert raw data with missing translations', () => {
const rawData: Solution = {
id: 1,
translations: [],
type: {
id: 1,
translations: [],
},
};
expect(toSolutionListView(rawData)).toEqual({
id: 1,
title: '',
summary: '',
solution_type: '',
});
});
});
/**
* 单元测试: toSolutionView
*/
describe('toSolutionView', () => {
test('convert raw data to SolutionView correctly', () => {
const rawData: Solution = {
id: 1,
translations: [
{
id: 1,
title: 'Solution Title',
summary: 'Solution Summary',
content: 'Solution Content',
},
],
create_at: '2023-01-01T00:00:00Z',
};
expect(toSolutionView(rawData)).toEqual({
id: 1,
title: 'Solution Title',
summary: 'Solution Summary',
content: 'Solution Content',
createAt: '2023-01-01T00:00:00Z',
});
});
test('convert raw data with missing translations', () => {
const rawData: Solution = {
id: 1,
translations: [],
create_at: '2023-01-01T00:00:00Z',
};
expect(toSolutionView(rawData)).toEqual({
id: 1,
title: '',
summary: '',
content: '',
createAt: '2023-01-01T00:00:00Z',
});
});
});

View File

@ -1,58 +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: '',
};
const type = isObject<SolutionType>(raw.type)
? raw.type.translations.length === 0
? ''
: raw.type.translations[0].name
: '';
return {
id: raw.id,
title: trans.title,
summary: trans.summary,
solution_type: type,
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,
};
}

View File

@ -1,23 +0,0 @@
/**
* 文档视图模型
* 用于文档列表渲染的数据结构
*/
export interface ProductDocumentView {
/** 唯一标识符 **/
id: number;
/** 文件UUID **/
fileId: string;
/** 文件名 **/
filename: string;
/** 文档标题 **/
title: string;
/** 文档大小 **/
size: number;
/** 文档链接 **/
url: string;
}

View File

@ -1,14 +0,0 @@
/**
* 常见问题视图模型
* 用于产品页常见问题渲染的数据结构
*/
export interface ProductQuestionView {
/** 唯一标识符 **/
id: number;
/** 问题标题 **/
title: string;
/** 问题内容 **/
content: string;
}

View File

@ -1,29 +0,0 @@
/**
* 产品规格模型
* 用于产品规格渲染的数据结构
*/
export interface ProductSpecView {
/** 唯一标识符 **/
id: number;
/** 规格名称 **/
key: string;
/** 规格值 **/
value: string;
}
/**
* 产品规格表模型
* 用于产品规格表渲染的数据结构
*/
export interface ProductSpecGroupView {
/** 唯一标识符 **/
id: number;
/** 规格组名称 **/
name: string;
/** 规格组 **/
specs: ProductSpecView[];
}

View File

@ -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[];
}

View File

@ -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">{{ $t('learn-more') }}</el-divider> <el-divider content-position="left">{{
<div class="button-group"> $t('learn-more')
<NuxtLink :to="$localePath('/support/contact-us')"> }}</el-divider>
<el-card class="card-button"> <div class="button-group">
<el-icon class="icon" size="80"> <learn-more-card
<ElIconService /> :title="$t('navigation.contact-info')"
</el-icon> :icon="ElIconService"
<br /> :to="$localePath('/support/contact-us')"
{{ $t('navigation.contact-info') }} />
</el-card> <learn-more-card
</NuxtLink> :title="$t('navigation.address')"
</div> :icon="ElIconMapLocation"
</div> @click="openMap"
<div v-else class="loading"> />
<el-skeleton :rows="5" animated /> </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.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>

View File

@ -4,11 +4,17 @@
<h1 class="page-title">{{ $t('navigation.downloads') }}</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">
<file-card :file-id="id" :file="file" /> <el-skeleton
</div> :loading="pending"
<div v-else> :rows="6"
<el-skeleton :rows="6" animated /> animated
:throttle="{ leading: 500, trailing: 500 }"
>
<template #default>
<file-card :file-id="id" :file="file" />
</template>
</el-skeleton>
</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>

View File

@ -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
View 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>

View File

@ -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>

View 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>

View File

@ -1,34 +1,58 @@
<template> <template>
<div class="page-container"> <div class="page-container">
<div class="page-header"> <div class="page-header">
<h1 class="page-title">{{ $t('our-products') }}</h1> <div>
<h1 class="page-title">{{ $t('our-products') }}</h1>
<p class="page-subtitle">
{{ $t('products-desc') }}{{ $t('find-discontinued-products') }}
</p>
</div>
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" /> <app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
</div> </div>
<div v-if="!pending" class="page-content"> <div>
<div class="products-container"> <el-skeleton
<el-collapse v-model="activeNames" class="product-collapse"> animated
<el-collapse-item :loading="pending"
v-for="(group, type) in groupedProducts" :throttle="{ leading: 500, trailing: 500 }"
:key="type" >
:title="type || '未分类'" <template #template>
:name="type || 'no-category'" <div v-for="i in 3" :key="i" class="products-container">
> <el-skeleton-item variant="h1" class="skeleton-collapse" />
<div class="group-list"> <div class="skeleton-group-list">
<product-card <el-skeleton-item
v-for="product in group" v-for="j in 3"
:key="product.id" :key="j"
:slug="product.id.toString()" variant="rect"
:image-url="getImageUrl(product.cover.toString())" class="skeleton-card"
:name="product.name"
:description="product.summary || ''"
/> />
</div> </div>
</el-collapse-item> </div>
</el-collapse> </template>
</div> <template #default>
</div> <div class="products-container">
<div v-else> <el-collapse v-model="activeNames" class="product-collapse">
<el-skeleton :rows="6" animated /> <el-collapse-item
v-for="[key, value] in Object.entries(groupedProducts)"
:key="key"
:title="key || '未分类'"
:name="key || 'no-category'"
>
<div class="group-list">
<product-card
v-for="product in value.data"
:key="product.id"
:slug="product.id.toString()"
:image-url="getImageUrl(product.cover.toString())"
:name="product.name"
:description="product.summary || ''"
/>
</div>
</el-collapse-item>
</el-collapse>
</div>
</template>
</el-skeleton>
</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;

View File

@ -1,18 +1,33 @@
<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 }"
<el-empty >
:description=" <template #template>
route.query.query <el-skeleton-item
? $t('search.no-results', { query: route.query?.query }) v-for="i in 10"
: $t('search.no-query') :key="i"
" variant="rect"
/> class="skeleton-item"
/>
</template>
<template #default>
<search-tabs v-if="hasResults" :search-items="searchItems" />
<div v-else>
<el-empty
:description="
route.query.query
? $t('search.no-results', { query: route.query?.query })
: $t('search.no-query')
"
/>
</div>
</template>
</el-skeleton>
</div> </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) {

View File

@ -1,23 +1,18 @@
<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" />
</div>
<solution-detail :solution="solution" />
</div>
<div v-else class="not-found">
<not-found-result
:title="$t('solution-not-found')"
:sub-title="$t('solution-not-found-desc')"
:back-text="$t('back-to-solutions')"
:on-back="() => $router.push($localePath('/solutions'))"
/>
</div> </div>
<solution-detail :solution="solution" />
</div> </div>
<div v-else class="loading"> <div v-else class="not-found">
<el-skeleton :rows="5" animated /> <not-found-result
:title="$t('solution-not-found')"
:sub-title="$t('solution-not-found-desc')"
:back-text="$t('back-to-solutions')"
:on-back="() => $router.push($localePath('/solutions'))"
/>
</div> </div>
</div> </div>
</template> </template>
@ -26,17 +21,10 @@
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>

View File

@ -1,44 +1,66 @@
<template> <template>
<div class="page-container"> <div class="page-container">
<div class="page-header"> <div class="page-header">
<h1 class="page-title">{{ $t('learn-our-solutions') }}</h1> <div>
<h1 class="page-title">{{ $t('learn-our-solutions') }}</h1>
<p class="page-subtitle">{{ $t('solutions-desc') }}</p>
</div>
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" /> <app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
</div> </div>
<div v-if="!pending" class="solutions-container"> <div class="solutions-container">
<el-tabs v-model="activeName" class="solutions-tabs"> <el-skeleton
<el-tab-pane :label="$t('all')" name="all"> :loading="pending"
<div class="solution-list"> animated
<solution-card :throttle="{
v-for="solution in solutions" leading: 500,
:key="solution.id" trailing: 500,
:title="solution.title" }"
:summary="solution.summary || ''" >
:cover-url="getImageUrl(solution.cover || '')" <template #template>
:document-id="solution.id.toString()" <div class="skeleton-group-list">
<el-skeleton-item
v-for="i in 12"
:key="i"
variant="rect"
class="skeleton-card"
/> />
</div> </div>
</el-tab-pane> </template>
<el-tab-pane <template #default>
v-for="(group, type) in groupedSolutions" <el-tabs v-model="activeName" class="solutions-tabs">
:key="type" <el-tab-pane :label="$t('all')" name="all">
:label="type || '未分类'" <div class="solution-list">
:name="type || 'no-category'" <solution-card
> v-for="solution in solutions"
<div class="solution-list"> :key="solution.id"
<solution-card :title="solution.title"
v-for="solution in group" :summary="solution.summary || ''"
:key="solution.id" :cover-url="getImageUrl(solution.cover || '')"
:document-id="solution.id.toString()" :document-id="solution.id.toString()"
:cover-url="getImageUrl(solution.cover || '')" />
:title="solution.title" </div>
:summary="solution.summary || ''" </el-tab-pane>
/> <el-tab-pane
</div> v-for="[key, value] in Object.entries(groupedSolutions)"
</el-tab-pane> :key="key"
</el-tabs> :label="key || '未分类'"
</div> :name="key || 'no-category'"
<div v-else> >
<el-skeleton :rows="6" animated /> <div class="solution-list">
<solution-card
v-for="solution in value.data"
:key="solution.id"
:document-id="solution.id.toString()"
:cover-url="getImageUrl(solution.cover || '')"
:title="solution.title"
:summary="solution.summary || ''"
/>
</div>
</el-tab-pane>
</el-tabs>
</template>
</el-skeleton>
</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>

View File

@ -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>

View File

@ -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>

View File

@ -1,48 +1,95 @@
<template> <template>
<div class="page-container"> <div class="page-container">
<div v-if="pending" class="flex justify-center items-center h-64"> <support-tabs model-value="faq" />
<el-skeleton :rows="6" animated /> <div class="page-header">
<h1 class="page-title">{{ $t('navigation.faq') }}</h1>
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
</div> </div>
<div v-else>
<support-tabs model-value="faq" />
<div class="page-header">
<h1 class="page-title">{{ $t('navigation.faq') }}</h1>
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
</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
</div> :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>
</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>

View File

@ -52,6 +52,11 @@
iconComponent: ElIconService, iconComponent: ElIconService,
}, },
]; ];
const pageTitle = $t('page-title.support');
usePageSeo({
title: pageTitle,
});
</script> </script>
<style scoped> <style scoped>
@ -132,5 +137,9 @@
grid-template-columns: 1fr; grid-template-columns: 1fr;
gap: 20px; gap: 20px;
} }
.breadcrumb {
display: none;
}
} }
</style> </style>

View File

@ -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
View 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];
}

View File

@ -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
View 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;
})
);
}

View 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,
}),
};

View File

@ -18,17 +18,3 @@ export function renderMarkdown(content: string): string {
return dirtyHtml; return dirtyHtml;
} }
export function convertMedia(content: string): string {
// 通过正则表达式替换Markdown中的图片链接
// ![alt text](image-url) -> ![alt text](strapiMedia(image-url))
if (!content) return '';
const contentWithAbsoluteUrls = content.replace(
/!\[([^\]]*)\]\((\/uploads\/[^)]+)\)/g,
(_, alt, url) => `![${alt}](${useStrapiMedia(url)})`
);
return contentWithAbsoluteUrls;
}

90
app/utils/parseTable.ts Normal file
View 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
View 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

9
entrypoint.sh Normal file
View 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 "$@"

View File

@ -13,6 +13,7 @@ export default withNuxt(
}, },
}, },
], ],
'no-console': 'warn',
}, },
} }
); );

View File

@ -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,9 @@
"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-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.",
@ -77,7 +81,12 @@
"keyword": "Keyword", "keyword": "Keyword",
"select-product-type": "Select product type", "select-product-type": "Select product type",
"select-product-model": "Select product model", "select-product-model": "Select product model",
"enter-keyword": "Enter keyword" "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": { "document-meta": {
"size": "Size", "size": "Size",
@ -100,5 +109,24 @@
"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-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": "Recommended Solutions",
"recommended-solutions-desc": "Learn about our tailored solutions designed to help your business thrive in a competitive market." "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
View 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
View 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": "Перенаправление..."
}

View File

@ -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,10 +63,12 @@
"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-page-desc": "金申机械制造有限公司致力于为客户提供优质的产品与服务。针对纸管机、分纸机、纸吸管等产品,我们提供全方位的售后服务,确保客户能够安心地使用我们的产品。",
"support-card-desc": { "support-card-desc": {
"faq": "我们为用户整理了常见问题的答案,帮助您快速解决疑惑。", "faq": "我们为用户整理了常见问题的答案,帮助您快速解决疑惑。",
"documents": "提供产品手册、技术规格等文档资料,方便用户查阅。", "documents": "提供产品手册、技术规格等文档资料,方便用户查阅。",
@ -76,7 +80,12 @@
"keyword": "关键词", "keyword": "关键词",
"select-product-type": "选择产品类型", "select-product-type": "选择产品类型",
"select-product-model": "选择产品系列", "select-product-model": "选择产品系列",
"enter-keyword": "输入关键词" "enter-keyword": "输入关键词",
"question-type": "问题类型",
"select-question-type": "选择问题类型",
"document-type": "文档类型",
"select-document-type": "选择文档类型",
"misc": "其他"
}, },
"document-meta": { "document-meta": {
"size": "大小", "size": "大小",
@ -99,5 +108,24 @@
"recommended-products-desc": "探索我们的精选产品,满足您的各种需求。无论是创新技术还是经典设计,我们都为您提供优质选择。", "recommended-products-desc": "探索我们的精选产品,满足您的各种需求。无论是创新技术还是经典设计,我们都为您提供优质选择。",
"recommended-solutions": "推荐解决方案", "recommended-solutions": "推荐解决方案",
"recommended-solutions-desc": "了解我们的定制解决方案,帮助您优化业务流程,提高效率。" "recommended-solutions-desc": "了解我们的定制解决方案,帮助您优化业务流程,提高效率。"
} },
"page-title": {
"homepage": "首页",
"products": "产品中心",
"solutions": "解决方案",
"support": "服务支持",
"faq": "常见问题",
"documents": "文档资料",
"contact-us": "联系我们",
"download": "文档下载",
"preview": "文档预览",
"about-us": "关于我们"
},
"product-tab": {
"details": "产品详情",
"specs": "技术规格",
"faq": "常见问题",
"documents": "相关文档"
},
"redirecting": "正在跳转..."
} }

View File

@ -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: '/jinshen-logo.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',

View File

@ -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
View File

@ -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/logo196x196.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
public/logo512x512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

20
public/manifest.json Normal file
View 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
View 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;
});

View 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;
});

View 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;
});

View 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);
});

View 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);
});

View 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;
});

View File

@ -0,0 +1,6 @@
import { productService } from '~~/server/services/cms/productService';
export default defineEventHandler(async (event) => {
const locale = getHeader(event, 'x-locale') || 'zh-CN';
return productService.getProductList(locale);
});

View File

@ -0,0 +1,16 @@
import { questionService } from '~~/server/services/cms/questionService';
export default defineEventHandler(async (event) => {
const locale = getHeader(event, 'x-locale') || 'zh-CN';
const questions = await questionService.getQuestionList(locale);
questions.forEach((question) => {
question.content = rewriteAssetUrls(
question.content,
useRuntimeConfig().public.directus.publicUrl,
'/api/assets'
);
});
return questions;
});

View File

@ -0,0 +1,22 @@
import { solutionService } from '~~/server/services/cms/solutionService';
export default defineEventHandler(async (event) => {
const id = getRouterParam(event, 'id');
if (!id)
throw createError({
statusCode: 400,
statusMessage: 'Solution ID is required',
});
const locale = getHeader(event, 'x-locale') || 'zh-CN';
const solution = await solutionService.getSolutionById(id, locale);
solution.content = rewriteAssetUrls(
solution.content,
useRuntimeConfig().public.directus.publicUrl,
'/api/assets'
);
return solution;
});

View File

@ -0,0 +1,7 @@
import { solutionService } from '~~/server/services/cms/solutionService';
export default defineEventHandler(async (event) => {
const locale = getHeader(event, 'x-locale') || 'zh-CN';
return solutionService.getSolutionList(locale);
});

37
server/api/search.get.ts Normal file
View File

@ -0,0 +1,37 @@
import { toSearchItemView } from '../mappers/searchItemMapper';
import { getMeiliService } from '../services/search';
export default defineEventHandler(async (event) => {
const query = getQuery(event);
const q = String(query.query || '');
const locale = getHeader(event, 'x-locale') || 'zh-CN';
logger.info(`Search query: "${q}" for locale: "${locale}"`);
if (!q) return [];
const meili = getMeiliService();
const sections = await meili.search(q, { limit: 500 }, locale);
// 空Section过滤
const filteredSections = sections.filter(
(section) => section.hits.length > 0
);
const typeMap = {
products: 'products',
solutions: 'solutions',
questions: 'questions',
product_documents: 'product_documents',
} as const;
const hits = filteredSections.flatMap((section) => {
const type = typeMap[section.rawIndex as keyof typeof typeMap];
if (!type) return [];
return section.hits.map((hit) => ({ type, content: hit }));
});
return hits.map((hit) => {
return toSearchItemView(hit.content, hit.type);
});
});

16
server/api/version.ts Normal file
View File

@ -0,0 +1,16 @@
import { existsSync, readFileSync } from 'fs';
import { execSync } from 'child_process';
export default defineEventHandler(() => {
const path = process.cwd() + '/version.json';
if (existsSync(path)) {
return JSON.parse(readFileSync(path, 'utf-8'));
}
return {
buildTime: new Date().toISOString(),
gitCommit: execSync('git rev-parse --short HEAD').toString().trim(),
generated: true,
};
});

Some files were not shown because too many files have changed in this diff Show More