diff --git a/src/api/publicService/productCenter.js b/src/api/publicService/productCenter.js index 890c977..8c8c9e7 100644 --- a/src/api/publicService/productCenter.js +++ b/src/api/publicService/productCenter.js @@ -17,3 +17,13 @@ export function getProductCenterDetailAPI(data) { data, }) } + +// 查询产品中心详情 +export function getProductCenterCaseDetailAPI(data) { + return request({ + url: '/product/screen/getProductDetailsById', + method: 'POST', + data, + }) +} + diff --git a/src/router/index.js b/src/router/index.js index 71d64e3..5d0c307 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -123,6 +123,19 @@ export const constantRoutes = [ name: 'ProductDetail', meta: { showSearch: false } // 不需要搜索框 }, + + + // 产品中心 ---- 查看产品案例详情页面 + { + path: 'productCenter/caseDetail/:id', + component: () => + import( + '@/views/publicService/productCenter/product-case-detail.vue' + ), + name: 'ProductCaseDetail', + meta: { showSearch: false } // 不需要搜索框 + }, + // 产品中心 ---- 查看案例页面 { path: 'productCenter/caseList', diff --git a/src/views/dataManage/product-center/components/addAndEditForm.vue b/src/views/dataManage/product-center/components/addAndEditForm.vue index 73f5490..39a7d3a 100644 --- a/src/views/dataManage/product-center/components/addAndEditForm.vue +++ b/src/views/dataManage/product-center/components/addAndEditForm.vue @@ -193,16 +193,15 @@ @@ -324,10 +323,31 @@ export default { ], caseImage: [ { - required: true, - trigger: 'change', - message: '请上传案例图片', - }, + validator: (rule, value, callback) => { + console.log('【校验案例图片】当前图片列表:', value); + + // 确保是数组 + if (!Array.isArray(value)) { + return callback(new Error('请上传案例图片')); + } + + // 过滤出上传成功或已有 url 的有效图片 + const validFiles = value.filter(file => { + return file.url || (file.response && file.response.url) || file.status === 'success'; + }); + + if (validFiles.length === 0) { + callback(new Error('请上传案例图片')); + } else if (validFiles.length < 5) { + callback(new Error(`请至少上传 5 张案例图片,当前已上传 ${validFiles.length} 张`)); + } else if (validFiles.length > 10) { + callback(new Error('最多上传 10 张案例图片')); + } else { + callback(); // 校验通过 + } + }, + trigger: 'change' // 图片变化时触发 + } ], caseSort: [ {required: true, message: '请输入排序', trigger: 'blur'}, @@ -464,13 +484,25 @@ export default { } }) - // 检查案例图片(如果需要必填的话) - if (isValid && tab.formInfo.caseImage.length === 0) { - isValid = false - errorMessage = `案例${ - tabIndex + 1 - }请至少上传一张案例图片` - errorCaseIndex = tabIndex + // 检查图片数量(5~10 张) + if (isValid) { + const validImages = tab.formInfo.caseImage.filter(file => { + return file.url || (file.response && file.response.url) || file.status === 'success' + }) + + if (validImages.length === 0) { + isValid = false + errorMessage = `案例${tabIndex + 1}请上传案例图片` + errorCaseIndex = tabIndex + } else if (validImages.length < 5) { + isValid = false + errorMessage = `案例${tabIndex + 1}请至少上传 5 张案例图片,当前已上传 ${validImages.length} 张` + errorCaseIndex = tabIndex + } else if (validImages.length > 10) { + isValid = false + errorMessage = `案例${tabIndex + 1}最多上传 10 张案例图片,当前已上传 ${validImages.length} 张` + errorCaseIndex = tabIndex + } } }) } diff --git a/src/views/publicService/productCenter/components/case-container-old.vue b/src/views/publicService/productCenter/components/case-container-old.vue new file mode 100644 index 0000000..e0f4fbc --- /dev/null +++ b/src/views/publicService/productCenter/components/case-container-old.vue @@ -0,0 +1,417 @@ + + + + + {{ cardTitle }} + 查看更多 + + + + + + + + + + + + + + + + + + + {{ item.caseCompany }} + + + + + {{ item.caseIntroduction }} + + + {{ item.caseIntroduction }} + + + + + + {{ item.caseIntroduction }} + + + + + + + + + + + + + + + diff --git a/src/views/publicService/productCenter/components/case-container.vue b/src/views/publicService/productCenter/components/case-container.vue index e0f4fbc..25c7244 100644 --- a/src/views/publicService/productCenter/components/case-container.vue +++ b/src/views/publicService/productCenter/components/case-container.vue @@ -1,417 +1,279 @@ - - - - {{ cardTitle }} - 查看更多 - - - - - - - - - - - - - - - - - - - {{ item.caseCompany }} - - - - - {{ item.caseIntroduction }} - - - {{ item.caseIntroduction }} - - - - - - {{ item.caseIntroduction }} - - - - - - - - - + + + + {{ cardTitle }} + + + + + + + + + + + + + + + + + + + + {{ item.caseCompany }} + + + + + + + + + 加载更多 + + + + diff --git a/src/views/publicService/productCenter/product-case-detail.vue b/src/views/publicService/productCenter/product-case-detail.vue new file mode 100644 index 0000000..de1c076 --- /dev/null +++ b/src/views/publicService/productCenter/product-case-detail.vue @@ -0,0 +1,1018 @@ + + + + + 产品中心 + > + 产品详情 + > + 产品案例详情 + > + {{ productDetail.caseCompany }} + + + + 返回 + + + + + + + {{ productDetail.caseCompany }} + + + + + + + + + {{ item.originalName }} + + + + + + + + + + + + + + + 案例介绍 + + + + + {{ productDetail.caseIntroduction }} + + + + + + + + + diff --git a/src/views/publicService/productCenter/product-detail.vue b/src/views/publicService/productCenter/product-detail.vue index c8e6d19..d83728a 100644 --- a/src/views/publicService/productCenter/product-detail.vue +++ b/src/views/publicService/productCenter/product-detail.vue @@ -53,14 +53,17 @@ - + + + {{ productDetail.introduction }} +