Compare commits
6 Commits
06c30a7ea3
...
853046d633
| Author | SHA1 | Date | |
|---|---|---|---|
| 853046d633 | |||
| 0996e910d9 | |||
| 52048fc2a6 | |||
| fc164beaf3 | |||
| 3b6857637b | |||
| d076088747 |
@ -83,4 +83,10 @@
|
||||
border-radius: 5px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.homepage-carousel .el-carousel__item {
|
||||
height: 50vw;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -7,19 +7,20 @@
|
||||
<div v-if="!pending">
|
||||
<el-carousel
|
||||
class="recommend-carousel"
|
||||
height="auto"
|
||||
:height="carouselHeight"
|
||||
arrow="never"
|
||||
indicator-position="outside"
|
||||
:autoplay="false"
|
||||
>
|
||||
<el-carousel-item
|
||||
v-for="n in Math.floor(products.length / 3) + 1"
|
||||
v-for="n in pages"
|
||||
ref="carouselItem"
|
||||
:key="n"
|
||||
class="recommend-list"
|
||||
>
|
||||
<div class="recommend-card-group">
|
||||
<el-card
|
||||
v-for="(item, index) in products.slice((n - 1) * 3, n * 3)"
|
||||
v-for="(item, index) in pageProducts(n)"
|
||||
:key="index"
|
||||
class="recommend-card"
|
||||
@click="handleProductCardClick(item.id.toString() || '')"
|
||||
@ -64,9 +65,32 @@
|
||||
},
|
||||
});
|
||||
|
||||
const carouselHeight = ref<string>('auto');
|
||||
const perPage = ref(3);
|
||||
const carouselItem = ref<HTMLElement | null>(null);
|
||||
|
||||
const { getImageUrl } = useDirectusImage();
|
||||
const { height } = useElementSize(carouselItem);
|
||||
|
||||
const products = computed(() => props.homepageData?.recommendProducts || []);
|
||||
const pages = computed(() =>
|
||||
Math.ceil(products.value.length / perPage.value)
|
||||
);
|
||||
|
||||
const updatePerPage = () => {
|
||||
const width = window.innerWidth;
|
||||
if (width < 768) {
|
||||
perPage.value = 1;
|
||||
} else if (width < 1024) {
|
||||
perPage.value = 2;
|
||||
} else {
|
||||
perPage.value = 3;
|
||||
}
|
||||
};
|
||||
|
||||
const pageProducts = (n: number) => {
|
||||
return products.value.slice((n - 1) * perPage.value, n * perPage.value);
|
||||
};
|
||||
|
||||
const handleProductCardClick = (documentId: string) => {
|
||||
// 使用路由导航到产品详情页
|
||||
@ -76,6 +100,21 @@
|
||||
router.push(localePath(`/products/${documentId}`));
|
||||
}
|
||||
};
|
||||
|
||||
watch(height, (h) => {
|
||||
if (h > 0) {
|
||||
carouselHeight.value = h + 40 + 'px';
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
updatePerPage();
|
||||
window.addEventListener('resize', updatePerPage);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', updatePerPage);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -126,7 +165,7 @@
|
||||
.recommend-list {
|
||||
display: flex;
|
||||
padding: 1rem;
|
||||
height: 400px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.recommend-card-group {
|
||||
@ -134,7 +173,7 @@
|
||||
gap: 1rem;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.recommend-card {
|
||||
@ -173,4 +212,16 @@
|
||||
width: 100%;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.recommend-card {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.recommend-card {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -5,19 +5,20 @@
|
||||
<div v-if="!pending">
|
||||
<el-carousel
|
||||
class="recommend-carousel"
|
||||
height="auto"
|
||||
:height="carouselHeight"
|
||||
arrow="never"
|
||||
indicator-position="outside"
|
||||
:autoplay="false"
|
||||
>
|
||||
<el-carousel-item
|
||||
v-for="n in Math.floor(solutions.length / 3) + 1"
|
||||
v-for="n in pages"
|
||||
ref="carouselItem"
|
||||
:key="n"
|
||||
class="recommend-list"
|
||||
>
|
||||
<div class="recommend-card-group">
|
||||
<el-card
|
||||
v-for="(item, index) in solutions.slice((n - 1) * 3, n * 3)"
|
||||
v-for="(item, index) in pageSolutions(n)"
|
||||
:key="index"
|
||||
class="recommend-card"
|
||||
@click="handleSolutionCardClick(item.id.toString() || '')"
|
||||
@ -62,11 +63,34 @@
|
||||
},
|
||||
});
|
||||
|
||||
const carouselHeight = ref<string>('auto');
|
||||
const perPage = ref(3);
|
||||
const carouselItem = ref<HTMLElement | null>(null);
|
||||
|
||||
const { getImageUrl } = useDirectusImage();
|
||||
const { height } = useElementSize(carouselItem);
|
||||
|
||||
const solutions = computed(
|
||||
() => props.homepageData?.recommendSolutions || []
|
||||
);
|
||||
const pages = computed(() =>
|
||||
Math.ceil(solutions.value.length / perPage.value)
|
||||
);
|
||||
|
||||
const updatePerPage = () => {
|
||||
const width = window.innerWidth;
|
||||
if (width < 768) {
|
||||
perPage.value = 1;
|
||||
} else if (width < 1024) {
|
||||
perPage.value = 2;
|
||||
} else {
|
||||
perPage.value = 3;
|
||||
}
|
||||
};
|
||||
|
||||
const pageSolutions = (n: number) => {
|
||||
return solutions.value.slice((n - 1) * perPage.value, n * perPage.value);
|
||||
};
|
||||
|
||||
const handleSolutionCardClick = (documentId: string) => {
|
||||
// 使用路由导航到产品详情页
|
||||
@ -76,6 +100,21 @@
|
||||
router.push(localePath(`/solutions/${documentId}`));
|
||||
}
|
||||
};
|
||||
|
||||
watch(height, (h) => {
|
||||
if (h > 0) {
|
||||
carouselHeight.value = h + 40 + 'px';
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
updatePerPage();
|
||||
window.addEventListener('resize', updatePerPage);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', updatePerPage);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -126,7 +165,7 @@
|
||||
.recommend-list {
|
||||
display: flex;
|
||||
padding: 1rem;
|
||||
height: 400px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.recommend-card-group {
|
||||
@ -134,7 +173,7 @@
|
||||
gap: 1rem;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.recommend-card {
|
||||
@ -173,4 +212,16 @@
|
||||
width: 100%;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.recommend-card {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.recommend-card {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -42,4 +42,11 @@
|
||||
color: var(--el-text-color-primary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.product-tabs ::v-deep(.el-tabs__nav) {
|
||||
float: none;
|
||||
min-width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<el-carousel
|
||||
v-else
|
||||
class="product-carousel"
|
||||
height="500px"
|
||||
height="auto"
|
||||
:autoplay="false"
|
||||
:loop="false"
|
||||
arrow="always"
|
||||
@ -18,8 +18,9 @@
|
||||
<el-carousel-item
|
||||
v-for="(item, index) in product.images || []"
|
||||
:key="index"
|
||||
class="product-carousel-item"
|
||||
>
|
||||
<div class="product-carousel-item">
|
||||
<div>
|
||||
<el-image
|
||||
:src="getImageUrl(item.image || '')"
|
||||
:alt="product.name"
|
||||
@ -59,6 +60,10 @@
|
||||
gap: 3rem;
|
||||
}
|
||||
|
||||
.product-carousel-item {
|
||||
height: 500px;
|
||||
}
|
||||
|
||||
.product-image .el-image {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
@ -99,4 +104,23 @@
|
||||
line-height: 1.6;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.product-header {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.product-carousel-item {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.product-image .el-image {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.product-info h1 {
|
||||
font-size: 1.5rem;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<footer class="jinshen-footer">
|
||||
<div class="footer-container">
|
||||
<div class="footer-container hide-on-mobile">
|
||||
<!-- Logo 和公司信息 -->
|
||||
<div class="footer-section">
|
||||
<div class="footer-logo">
|
||||
@ -250,6 +250,10 @@
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 768px) {
|
||||
.hide-on-mobile {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.footer-container {
|
||||
grid-template-columns: 1fr;
|
||||
padding: 1.5rem 1rem;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="question-category">
|
||||
<el-row :gutter="12">
|
||||
<el-row class="hide-on-mobile" :gutter="12">
|
||||
<el-col :span="8">
|
||||
<span class="select-label">产品分类</span>
|
||||
<el-select
|
||||
@ -43,6 +43,48 @@
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="display-on-mobile" :gutter="12">
|
||||
<el-col :span="12">
|
||||
<span class="select-label">产品分类</span>
|
||||
<el-select
|
||||
v-model="model.selectedType"
|
||||
placeholder="选择产品类型"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="type in productTypeOptions"
|
||||
:key="type.id"
|
||||
:label="type.name"
|
||||
:value="type.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<span class="select-label">产品系列</span>
|
||||
<el-select
|
||||
v-model="model.selectedProduct"
|
||||
placeholder="选择系列产品"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="product in productOptions"
|
||||
:key="product.id"
|
||||
:label="product.name"
|
||||
:value="product.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="display-on-mobile">
|
||||
<span class="select-label">关键词</span>
|
||||
<el-input
|
||||
v-model="model.keyword"
|
||||
placeholder="输入关键词..."
|
||||
clearable
|
||||
:prefix-icon="Search"
|
||||
/>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -82,4 +124,18 @@
|
||||
height: 40px;
|
||||
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>
|
||||
|
||||
@ -34,10 +34,4 @@
|
||||
.page-footer {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.page-footer {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -86,7 +86,8 @@
|
||||
}
|
||||
|
||||
.card-group {
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 50px;
|
||||
justify-content: space-around;
|
||||
margin-bottom: 2rem;
|
||||
@ -121,4 +122,15 @@
|
||||
border-radius: 4px;
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
section {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.card-group {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user