index.vue
6.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<template>
<div class="hager-solution-index">
<el-image :style="{ width: '100%', height: top_img_height }" fit="cover" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"></el-image>
<hager-box class="box-n">
<hager-h1 title="行业解决方案" sub="Industry Solutions" style="margin: 2rem 0;"></hager-h1>
<div> 海格电气产品已广泛应用于电子产品制造业,为其供配电系统稳定、可靠的运行提供可靠保障。 </div>
<div v-if="!is_xs" class="hager-industry-solutions">
<div @click="goToSolution(item)" class="card" v-for="(item, index) in solution_list" :key="index">
<img :src="item.src" alt="学校图片" class="card-image">
<div class="card-content">
<div class="card-title" style="">
<span>{{ item.title }}</span>
<i class="el-icon-right"></i>
</div>
<p class="card-sub">{{ item.sub }}</p>
</div>
</div>
</div>
<div v-else style="margin: 1rem 0;">
<swiper ref="mySolutionSwiper" class="swiper" :options="swiperOption" @slideChange="onSlideChange">
<swiper-slide v-for="(item, index) in solution_list" :key="index">
<div @click="goToSolution(item)" class="card" style="margin-bottom: 1rem;">
<img :src="item.src" alt="学校图片" class="card-image">
<div class="card-content">
<div class="card-title">
<span>{{ item.title }}</span>
<i class="el-icon-right"></i>
</div>
<p class="card-sub">{{ item.sub }}</p>
</div>
</div>
</swiper-slide>
</swiper>
<div class="xs-control">
<div>
<i :class="['el-icon-arrow-left', activeIndex === 0 ? 'disabled' : '']" @click="prevSolutionBtn()"></i>
<i :class="['el-icon-arrow-right', reach_end ? 'disabled' : '']" @click="nextSolutionBtn()"></i>
</div>
</div>
</div>
</hager-box>
</div>
</template>
<script>
import mixin from 'common/mixin';
import hagerBox from '@/components/common/hagerBox';
import hagerH1 from '@/components/common/hagerH1.vue';
import hagerMore from '@/components/hagerMore.vue';
export default {
components: { hagerBox, hagerH1, hagerMore },
mixins: [mixin.init],
data () {
return {
solution_list: [{
src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
title: '1住宅解决方案',
sub: 'Residential Solution Case'
}, {
src: 'https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg',
title: '2住宅解决方案',
sub: 'Residential Solution Case'
}, {
src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
title: '3住宅解决方案',
sub: 'Residential Solution Case'
}, {
src: 'https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg',
title: '4住宅解决方案',
sub: 'Residential Solution Case'
}, {
src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
title: '1住宅解决方案',
sub: 'Residential Solution Case'
}, {
src: 'https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg',
title: '2住宅解决方案',
sub: 'Residential Solution Case'
}, {
src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
title: '3住宅解决方案',
sub: 'Residential Solution Case'
}, {
src: 'https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg',
title: '4住宅解决方案',
sub: 'Residential Solution Case'
}],
swiperOption: {
slidesPerView: 2,
spaceBetween: 50,
preventClicks : true,
slideToClickedSlide: false,
touchRatio: 0,
breakpoints: {
1024: {
slidesPerView: 4,
spaceBetween: 40
},
768: {
slidesPerView: 3,
spaceBetween: 30
},
640: {
slidesPerView: 2,
spaceBetween: 20
},
320: {
slidesPerView: 2,
spaceBetween: 10
},
160: {
slidesPerView: 1,
spaceBetween: 0
}
}
},
activeIndex: 0,
reach_end: false,
}
},
mounted () {
},
methods: {
goToSolution (v) {
this.$router.push({
path: '/solution/detail',
query: {
id: v.id
}
});
},
prevSolutionBtn () {
this.$refs.mySolutionSwiper.$swiper.slidePrev();
},
nextSolutionBtn () {
this.$refs.mySolutionSwiper.$swiper.slideNext();
},
onSlideChange (swiper) {
this.activeIndex = swiper.activeIndex;
const isEnd = swiper.isEnd;
if (isEnd) {
this.reach_end = true;
} else {
this.reach_end = false;
}
},
}
}
</script>
<style lang="less" scoped>
.hager-solution-index {
.hager-industry-solutions {
margin: 2rem 0;
display: grid;
grid-template-columns: repeat(4, 1fr); /* 一行显示4个 */
gap: 1.5rem; /* 每个项目之间的间距 */
.case-item {
position: relative;
height: 12rem;
padding: 1.5rem;
text-align: center;
color: #FFF;
border-radius: 8px;
// background-image: url('https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg');
background-size: cover;
background-position: top center;
transition: transform 0.3s ease-in-out;
&:hover {
transform: scale(1.05);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
cursor: pointer;
}
}
}
.card {
// width: 300px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
overflow: hidden;
background-color: #fff;
margin: 0;
transition: transform 0.3s ease-in-out;
&:hover {
// transform: scale(1.05);
// box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
cursor: pointer;
}
.card-image {
width: 100%;
height: 12rem;
object-fit: cover;
}
.card-content {
padding: 15px;
.card-title {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 1rem;
color: #0072c6;
margin-bottom: 10px;
}
.card-sub {
font-size: 0.85rem;
color: #333;
line-height: 1.6;
margin-bottom: 15px;
}
}
}
.xs-control {
display: flex;
justify-content: flex-end;
margin-top: 1rem;
margin-bottom: 1rem;
i {
font-size: 1.35rem;
color: #EE6D10;
&:hover {
cursor: pointer;
}
&.disabled {
color: #ccc;
}
}
}
}
</style>