sanmu
authored
about a year ago
1
2
<template>
<v-container>
3
<div>
4
<!-- <v-breadcrumbs divider="/" style="padding-top: 0">
5
6
7
8
9
10
11
<template v-for="(item, index) in items" :key="index">
<v-breadcrumbs-item
:disabled="item.disabled"
:href="item.href"
:class="{
'breadcrumb-disabled': item.disabled,
'breadcrumb-active': !item.disabled,
12
'breadcrumb-last': index === items.length - 1,
13
}"
14
15
16
17
18
:style="
index === items.length - 1
? 'color: black;font-size:15px'
: 'font-size:15px;'
"
19
20
21
22
23
24
25
>
{{ item.title }}
</v-breadcrumbs-item>
<span v-if="index < items.length - 1" class="breadcrumb-divider"
>/</span
>
</template>
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
</v-breadcrumbs> -->
<v-breadcrumbs divider="/" style="padding-top: 0">
<template v-for="(item, index) in items" :key="index">
<v-breadcrumbs-item
:disabled="item.disabled"
:href="item.href"
:class="{
'breadcrumb-disabled': item.disabled,
'breadcrumb-active': !item.disabled,
}"
style="font-size: 14px"
>
{{ item.title }}
</v-breadcrumbs-item>
<!-- 添加分隔符,排除最后一个 item -->
<span
v-if="index < items.length - 1"
class="breadcrumb-divider"
style="color: gray"
>/</span
>
</template>
48
49
</v-breadcrumbs>
</div>
sanmu
authored
about a year ago
50
<v-row class="mb-16 ma-0">
51
<v-col cols="12" sm="5" class="carousel-container">
52
<v-carousel
53
class="tw-float-left tw-sticky tw-top-[16px]"
54
55
56
height="450"
v-model="slide"
hide-delimiter-background
57
style="top: 16px"
58
59
60
>
<v-carousel-item
cover
61
v-for="(slide, i) in info?.productimageliststore"
62
63
64
65
:src="slide.url"
:key="i"
:alt="info.name"
>
sanmu
authored
about a year ago
66
67
68
</v-carousel-item>
</v-carousel>
</v-col>
69
70
<v-col cols="12" sm="7" class="table-container">
<!-- <v-row class="bg-white mb-sm-10 text-h4 font-weight-medium">
sanmu
authored
about a year ago
71
<v-col>{{ info.name }}</v-col>
72
</v-row> -->
73
<h1 class="tw-m-[12px] tw-mb-[36px]">{{ info.name }}</h1>
sanmu
authored
about a year ago
74
<div class="tw-flex tw-flex-wrap">
75
76
<div class="tw-w-1/2 tw-mb-[12px]">
<span class="tw-leading-[10px] tw-m-[12px]">
77
78
Brand:{{ info.brandName }}
</span>
sanmu
authored
about a year ago
79
80
</div>
<div class="tw-w-1/2 tw-mb-[12px]">
81
<span class="tw-leading-[10px] tw-m-[12px]"
82
83
>Product Model:{{ info.model }}</span
>
sanmu
authored
about a year ago
84
85
</div>
<div class="tw-w-1/2 tw-mb-[12px]" v-if="info.basename1">
86
<span class="tw-leading-[10px] tw-m-[12px]"
87
88
>{{ info.basename1 }}:{{ info.basecore1 }}</span
>
sanmu
authored
about a year ago
89
90
</div>
<div class="tw-w-1/2 tw-mb-[12px]" v-if="info.basename2">
91
<span class="tw-leading-[10px] tw-m-[12px]"
92
93
>{{ info.basename2 }}:{{ info.basecore2 }}</span
>
sanmu
authored
about a year ago
94
95
</div>
<div class="tw-w-1/2 tw-mb-[12px]" v-if="info.basename3">
96
<span class="tw-leading-[10px] tw-m-[12px]"
97
98
>{{ info.basename3 }}:{{ info.basecore3 }}</span
>
sanmu
authored
about a year ago
99
100
</div>
</div>
101
102
103
104
105
106
107
108
109
110
111
<div
class="tw-flex tw-flex-wrap"
v-if="
info.productAttributeList && info.productAttributeList.length > 0
"
>
<div
v-for="(attribute, index) in info.productAttributeList"
:key="index"
class="tw-w-1/2 tw-mb-[12px]"
>
112
113
<span
class="tw-leading-normal tw-m-0 tw-block tw-max-w-full tw-break-words tw-ml-[12px]"
114
115
>{{ attribute.name }}:{{ attribute.value }}</span
>
116
117
</div>
</div>
118
<!-- <v-table
119
120
121
density="comfortable"
class="table1 tw-mt-[32px]"
v-if="info.ticketTypes?.length"
122
123
124
125
126
> -->
<v-table
density="comfortable"
class="table1 tw-mt-[32px] tw-overflow-x-auto"
v-if="info.ticketTypes?.length"
127
>
sanmu
authored
about a year ago
128
129
<thead>
<tr class="bg-grey-lighten-3">
130
131
132
133
134
135
136
137
138
139
140
141
<th class="text-left headerBorder text-grey-darken-1">
Product Name / Code
</th>
<th class="text-left headerBorder text-grey-darken-1">
Specification and model
</th>
<th
v-if="info.priceShow !== undefined && info.priceShow"
class="text-left headerBorder text-grey-darken-1"
>
Price
</th>
142
<th class="text-left headerBorder text-grey-darken-1">Actions</th>
sanmu
authored
about a year ago
143
144
145
</tr>
</thead>
<tbody>
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<tr
class="tr"
v-for="item in info.ticketTypes || []"
:key="item.rank"
>
<td class="td text-grey-darken-4 font-weight-medium">
{{ item.rank }}
</td>
<td class="td text-grey-darken-4 font-weight-medium">
{{ item.typeName }}
</td>
<td v-if="item.priceShow" class="td">
{{ item.price + " " + item.priceUnit }}
</td>
sanmu
authored
about a year ago
160
<td class="td">
161
162
163
164
165
<v-btn
size="small"
color="blue-darken-1"
@click="router.push('/contact')"
>
166
167
<!-- Quotation Inquiry -->
Quote
sanmu
authored
about a year ago
168
169
170
171
172
173
174
175
176
177
</v-btn>
</td>
</tr>
</tbody>
</v-table>
<!-- <v-dialog v-model="dialog" activator="parent" width="auto">
<v-card> Contact us Email: contact@canrd.com QQ: 3003597584 / 2902385824 </v-card>
</v-dialog> -->
</v-col>
</v-row>
178
179
<v-tabs
class="tabs"
180
181
v-model="tabRecomHot"
style="margin-top: 25px"
182
183
184
185
color="white"
bg-color="#eeeeee"
slider-color="blue-lighten-1"
selected-class="active"
186
v-if="recommendImagesHot[0] !== null"
187
>
188
<v-tab :value="1">Best Sellers</v-tab>
189
190
<!-- <v-tab :value="3">商品百科</v-tab> -->
</v-tabs>
191
<div id="image-container" v-if="recommendImagesHot[0] !== null">
192
193
194
195
196
<div class="recommend-left-box">
<v-img
src="https://m-canrd.oss-cn-shenzhen.aliyuncs.com/crmebimage/public/maintain/2024/09/14/76c987e13a334be481a346c19c2284f3qy4tjnxps7.png"
alt="往左移"
class="recommend-img-left"
197
@click="toggleRowLeft"
198
199
/>
</div>
200
<div class="image-row" id="row1">
201
202
203
204
205
206
207
208
<!-- <img
v-for="(imageObj, index) in recommendImages.slice(0, 5)"
:key="'row1-' + index"
:src="imageObj[0]?.url"
:alt="'Image ' + (index + 1)"
style="margin: 0 5px; width: 200px; height: 200px"
/> -->
<div
209
v-for="(imageObj, index) in recommendImagesHot"
210
:key="'row1-' + index"
211
class="imageTotal"
212
213
214
215
216
>
<a v-if="imageObj" :href="imageObj[0]?.productUrl" target="_blank">
<img
:src="imageObj[0]?.url"
:alt="'Image ' + (index + 1)"
217
class="item-imgHot"
218
/>
219
<span class="image-name">
220
221
222
223
224
225
226
227
228
229
230
{{ imageObj[0]?.name }}
</span>
</a>
<div v-else style="width: 200px; height: 200px"></div>
</div>
</div>
<div class="recommend-right-box">
<v-img
src="https://m-canrd.oss-cn-shenzhen.aliyuncs.com/crmebimage/public/maintain/2024/09/14/b5daa0a8f2f140f5b406e984c730a453iznzlekysg.png"
alt="往右移"
class="recommend-img-right"
231
@click="toggleRowRight"
232
233
234
/>
</div>
</div>
235
236
237
238
239
240
241
242
243
244
245
246
247
<div style="display: flex; width: 100%; box-sizing: border-box">
<div
class="tw-pb-[64px]"
style="
width: 70%;
margin-right: 10px;
display: flex;
flex-direction: column;
flex-wrap: wrap;
overflow: auto;
"
>
248
249
250
251
252
253
254
<v-tabs
class="tabs"
v-model="tab"
color="white"
bg-color="#eeeeee"
slider-color="blue-lighten-1"
selected-class="active"
255
style="width: 100%"
256
257
258
259
260
>
<v-tab :value="1">Product Details</v-tab>
<v-tab :value="2">Specification</v-tab>
<!-- <v-tab :value="3">商品百科</v-tab> -->
</v-tabs>
261
262
263
<v-window
v-model="tab"
class="tw-p-[24px]"
264
265
266
267
268
269
270
style="
min-height: 500px;
height: auto;
overflow-wrap: break-word;
word-wrap: break-word;
white-space: pre-wrap;
"
271
>
272
<v-window-item key="1" :value="1">
273
<!-- 修改位置 1: 使用 clearSpanStyle 方法清理 info.advantage -->
274
275
276
<div v-if="info.advantage" class="tw-mb-[24px]">
<div class="text-h6">Advantage</div>
<v-divider class="tw-mb-[12px]"></v-divider>
277
<div v-html="clearSpanStyle(info.advantage)"></div>
278
</div>
279
<!-- 修改位置 2: 使用 clearSpanStyle 方法清理 info.physicalproperty -->
280
281
<div v-if="info.physicalproperty" class="tw-mb-[24px]">
<div class="text-h6">Physical Property</div>
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
<v-divider class="tw-mb-[12px] html-content"></v-divider>
<div v-html="clearSpanStyle(info.physicalproperty)"></div>
</div>
<!-- 修改位置 3: 使用 clearSpanStyle 方法清理 info.storage -->
<div v-if="info.storage" class="tw-mb-[24px]">
<div class="text-h6">Storage</div>
<v-divider class="tw-mb-[12px]"></v-divider>
<div v-html="clearSpanStyle(info.storage)"></div>
</div>
<!-- 修改位置 4: 使用 clearSpanStyle 方法清理 info.introduction -->
<div v-if="info.introduction" class="tw-mb-[24px]">
<div class="text-h6">Introduction</div>
<v-divider class="tw-mb-[12px]"></v-divider>
<div v-html="clearSpanStyle(info.introduction)"></div>
</div>
<!-- 修改位置 5: 使用 clearSpanStyle 方法清理 info.description -->
<div v-if="info.description" class="tw-mb-[24px]">
<div class="text-h6">Description</div>
<v-divider class="tw-mb-[12px]"></v-divider>
<div v-html="clearSpanStyle(info.description)"></div>
</div>
</v-window-item>
<!-- <div v-if="info.advantage" class="tw-mb-[24px]">
<div class="text-h6">Advantage</div>
306
<v-divider class="tw-mb-[12px]"></v-divider>
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<div v-html="info.advantage"></div>
</div>
<div v-if="info.physicalproperty" class="tw-mb-[24px]">
<div class="text-h6">Physical Property</div>
<v-divider class="tw-mb-[12px] html-content"></v-divider>
<div
v-html="info.physicalproperty"
style="
overflow-wrap: break-word;
word-wrap: break-word;
white-space: pre-wrap;
line-height: 1.5;
"
></div>
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
</div>
<div v-if="info.storage" class="tw-mb-[24px]">
<div class="text-h6">Storage</div>
<v-divider class="tw-mb-[12px]"></v-divider>
<div v-html="info.storage"></div>
</div>
<div v-if="info.introduction" class="tw-mb-[24px]">
<div class="text-h6">Introduction</div>
<v-divider class="tw-mb-[12px]"></v-divider>
<div v-html="info.introduction"></div>
</div>
<div v-if="info.description" class="tw-mb-[24px]">
<div class="text-h6">Description</div>
<v-divider class="tw-mb-[12px]"></v-divider>
<div v-html="info.description"></div>
</div>
337
</v-window-item> -->
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
<v-window-item key="2" :value="2">
<v-table density="compact" class="table2">
<tbody>
<tr
class="tr"
v-for="item in info.productAttributeList || []"
:key="item.name"
>
<td class="td tw-w-[400px]">{{ item.name }}</td>
<td class="td">{{ item.value }}</td>
</tr>
</tbody>
</v-table>
</v-window-item>
<!-- <v-window-item key="3" :value="3"> 2 </v-window-item> -->
</v-window>
</div>
<div style="width: 30%">
<v-tabs
v-model="tabPeriodical"
color="white"
bg-color="#eeeeee"
slider-color="blue-lighten-1"
selected-class="active"
grow
>
364
<v-tab value="one">Product-related Journals</v-tab>
365
</v-tabs>
366
367
<v-list>
<v-list-item
368
369
370
371
372
v-for="item in info.journals"
:key="item.id"
@click="navigateToUrl(item.link)"
@mouseenter="hoveredItem = item.id"
@mouseleave="hoveredItem = null"
373
374
>
<v-list-item-title>
375
376
377
378
379
<span
:class="['title', { 'full-title': hoveredItem === item.id }]"
>
{{ item.title }}
</span>
380
381
382
</v-list-item-title>
</v-list-item>
</v-list>
383
384
385
386
</div>
</div>
<v-tabs
class="tabs"
387
v-model="tabRecom"
388
389
390
391
color="white"
bg-color="#eeeeee"
slider-color="blue-lighten-1"
selected-class="active"
392
v-if="recommendImages[0] !== null"
393
>
394
<v-tab :value="1">Related Products</v-tab>
395
396
<!-- <v-tab :value="3">商品百科</v-tab> -->
</v-tabs>
397
<div id="image-container" v-if="recommendImages[0] !== null">
398
399
400
401
402
<div class="recommend-left-box">
<v-img
src="https://m-canrd.oss-cn-shenzhen.aliyuncs.com/crmebimage/public/maintain/2024/09/14/76c987e13a334be481a346c19c2284f3qy4tjnxps7.png"
alt="往左移"
class="recommend-img-left"
403
@click="toggleRow"
404
405
/>
</div>
406
<div v-if="currentIndex === 0" class="image-row" id="row1">
407
408
409
410
411
412
413
414
<!-- <img
v-for="(imageObj, index) in recommendImages.slice(0, 5)"
:key="'row1-' + index"
:src="imageObj[0]?.url"
:alt="'Image ' + (index + 1)"
style="margin: 0 5px; width: 200px; height: 200px"
/> -->
<div
415
v-for="(imageObj, index) in recommendImages.slice(0, 5)"
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
:key="'row1-' + index"
class="imageTotal"
>
<a v-if="imageObj" :href="imageObj[0]?.productUrl" target="_blank">
<img
:src="imageObj[0]?.url"
:alt="'Image ' + (index + 1)"
class="item-imgHot"
/>
<span class="image-name">
{{ imageObj[0]?.name }}
</span>
</a>
<div v-else style="width: 200px; height: 200px"></div>
</div>
</div>
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
<div v-else class="image-row" id="row2">
<!-- <img
v-for="(imageObj, index) in recommendImages.slice(5, 10)"
:key="'row2-' + index"
:src="imageObj[0]?.url"
:alt="'Image ' + (index + 6)"
style="margin: 0 5px; width: 200px; height: 200px"
/> -->
<div
v-for="(imageObj, index) in recommendImages.slice(5, 10)"
:key="'row2-' + index"
class="imageTotal"
>
<a v-if="imageObj" :href="imageObj[0]?.productUrl" target="_blank">
<img
:src="imageObj[0]?.url"
:alt="'Image ' + (index + 6)"
class="item-imgHot"
/>
<span class="image-name">
{{ imageObj[0]?.name }}
</span>
</a>
<div
v-else
style="width: 200px; height: 200px; margin-right: 10px"
></div>
</div>
</div>
461
462
463
464
465
<div class="recommend-right-box">
<v-img
src="https://m-canrd.oss-cn-shenzhen.aliyuncs.com/crmebimage/public/maintain/2024/09/14/b5daa0a8f2f140f5b406e984c730a453iznzlekysg.png"
alt="往右移"
class="recommend-img-right"
466
@click="toggleRow"
467
/>
468
</div>
sanmu
authored
about a year ago
469
</div>
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
<div class="social-share-container">
<SocialShare
network="facebook"
:styled="true"
:label="true"
:title="info.name"
:url="currentUrl"
style="color: #1e88e5; width: 140px"
/>
<SocialShare
network="twitter"
:styled="true"
:label="true"
:title="info.name"
:url="currentUrl"
style="color: #1e88e5; width: 140px"
/>
<SocialShare
network="linkedin"
:styled="true"
:label="true"
:title="info.name"
:url="currentUrl"
style="color: #1e88e5; width: 140px"
/>
</div>
sanmu
authored
about a year ago
499
500
501
502
</v-container>
</template>
<script setup lang="ts">
503
import type { Product, ProductImage } from "~/type";
504
import { defineProps, onMounted, ref } from "vue";
505
import { useDialogStore } from "~/stores/dialog";
506
507
508
import { useRouter, useRoute } from "vue-router";
import { useRouteQuery } from "@/stores/route_query";
509
510
511
512
513
514
const recommendList = ref();
const recommendImages = ref();
const selectedItem = ref();
const tabRecom = ref(0);
const tabRecommend = ref(0);
const tabPeriodical = ref(0);
515
516
517
const route = useRoute();
const router = useRouter();
const routeQuery = useRouteQuery();
518
const dialogStore = useDialogStore();
519
520
const href1 = ref("/products");
const href2 = ref("/products");
521
const idHref = ref("/products");
522
const hoveredItem = ref(null);
523
const productStore = useProductListStore();
524
525
526
527
528
const maxPage = ref(1);
const tabRecomHot = ref();
const recommendListHot = ref();
const recommendImagesHot = ref();
const currentIndexHot = ref(1);
529
const currentUrl = ref("https://www.canrud.com/products");
530
531
532
533
534
535
536
537
538
539
540
// 定义单个 item 的接口
interface BreadcrumbItem {
title: string; // 标题
disabled: boolean; // 是否禁用
href: string; // 链接地址
}
// 示例数据
const items = ref<BreadcrumbItem[]>([
{
title: "Products",
disabled: false,
541
href: "https://www.canrud.com/products",
542
543
544
545
546
547
548
},
{
title: "CATEGORY",
disabled: false,
href: href1.value,
},
{
549
title: "Not specified",
550
551
552
553
disabled: false,
href: href2.value,
},
{
554
title: "Not specified",
555
556
557
558
disabled: false,
href: "/products",
},
]);
sanmu
authored
about a year ago
559
560
const props = defineProps<{
561
562
563
info: Product;
}>();
const info = props.info;
564
let { data: resData } = await useAsyncData(
565
"list",
566
567
568
569
570
571
572
573
574
575
576
577
578
() =>
$fetch("/shop/product/list", {
method: "GET",
params: {
pageNo: 1,
pageSize: 20,
ids: info.relatedProductIds,
},
}),
{
server: true, // 仅在服务器端获取数据
}
);
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
const loadHotProducts = async () => {
let { data: hotProducts } = await useAsyncData(
"hotProducts",
() =>
$fetch("/shop/product/hotProducts", {
method: "GET",
params: {
pageNo: currentIndexHot.value,
pageSize: 5,
},
}),
{
server: true, // 仅在服务器端获取数据
}
);
recommendListHot.value = hotProducts.value.data.records;
maxPage.value = hotProducts.value.data.pages;
// recommendImages.value = recommendList.value.slice(0, 10).map((item) => {
recommendImagesHot.value = Array.from({ length: 5 }).map((_, index) => {
const item = recommendListHot.value[index];
if (!item) {
return null;
}
// 检查 productimageliststore 是否为字符串格式,如果是,则尝试解析
if (typeof item.productimageliststore === "string") {
try {
item.productimageliststore = JSON.parse(item.productimageliststore);
} catch (error) {
item.productimageliststore = []; // 解析失败时,设置为空数组
}
}
const ree = (item.productimageliststore = item?.productimageliststore.map(
(productItem: ProductImage) => ({
...productItem,
// url: `http://112.74.45.244:8100/api/show/image?fileKey=${item.fileKey}`,
url: `https://www.canrud.com/api/show/image?fileKey=${productItem.fileKey}&psize=p256`,
name: item.name,
productUrl: `https://www.canrud.com/products/detail/${item.id}`,
})
));
return ree;
});
};
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
const clearSpanStyle = (htmlContent) => {
if (!htmlContent) return ""; // 检查是否为空
// 创建一个 DOM 解析器
const parser = new DOMParser();
const doc = parser.parseFromString(htmlContent, "text/html");
// 清理 span 的 style 属性
const spans = doc.querySelectorAll("span");
spans.forEach((span) => {
span.removeAttribute("style"); // 清空 style 属性
});
// 修改 img 的 style 属性,追加 width: 100%
const imgs = doc.querySelectorAll("img");
imgs.forEach((img) => {
const style = img.getAttribute("style") || ""; // 获取现有 style
if (!style.includes("width: 100%")) {
img.setAttribute("style", `${style} width: 100%;`.trim()); // 添加 width: 100%
}
});
// 返回处理后的 HTML
return doc.body.innerHTML;
};
646
647
let intervalId: any;
648
const toggleRowLeft = () => {
649
650
651
652
if (currentIndexHot.value !== 1) {
currentIndexHot.value--;
} else if (currentIndexHot.value == 1) {
currentIndexHot.value = maxPage.value;
653
}
654
startTimer();
655
656
};
const toggleRowRight = () => {
657
658
659
660
if (currentIndexHot.value < maxPage.value) {
currentIndexHot.value++;
} else if (currentIndexHot.value == maxPage.value) {
currentIndexHot.value = 1;
661
}
662
663
664
665
666
667
668
669
startTimer();
};
const startTimer = () => {
// 清除已有计时器,防止重复
clearInterval(intervalId);
intervalId = setInterval(() => {
toggleRowRight();
}, 5000); // 每6秒调用一次
670
};
671
672
673
674
675
onMounted(() => {
startTimer();
});
676
677
678
679
680
681
682
watch(currentIndexHot, (newIndex) => {
loadHotProducts(); // Call loadHotProducts when currentIndex changes
});
// Initial load of hot products
await loadHotProducts(); // Load hot products the first time
683
watchEffect(() => {
684
currentUrl.value = "https://www.canrud.com/products/detail/" + info.id;
685
686
687
if (info?.productCrumbsVO?.category1 && productStore.keyword) {
items.value[1].title = info.productCrumbsVO.category1;
items.value[1].href =
688
689
690
691
692
"https://www.canrud.com/products?categories=" +
info.productCrumbsVO.category1;
href1.value =
"https://www.canrud.com/products?categories=" +
info.productCrumbsVO.category1;
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
if (info?.productCrumbsVO?.category2) {
items.value[2].title = info.productCrumbsVO.category2;
href2.value = href1.value + "," + info.productCrumbsVO.category2;
items.value[2].href = href1.value + "," + info.productCrumbsVO.category2;
}
if (info?.productCrumbsVO?.function) {
// items.value.push({
// title: info.productCrumbsVO.function,
// disabled: false,
// href: href2.value + "&function=" + info.productCrumbsVO.function,
// });
items.value[3].title = info.productCrumbsVO.function;
items.value[3].href =
href2.value + "&function=" + info.productCrumbsVO.function;
}
} else if (routeQuery.categories) {
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
if (!routeQuery.categories.includes("Energy materials")) {
routeQuery.updateFunction("Not specified");
}
const categories = routeQuery.categories.split(",");
const mainCategory = categories[0].trim(); // 取第一个值
const subCategoryName = ref(
categories[1] ? categories[1].trim() : "Not specified"
); // 取第二个值(如果存在)
if (subCategoryName.value == "Accessories & fixtures") {
subCategoryName.value = encodeURIComponent("Accessories & fixtures");
items.value[2].title = "Accessories & fixtures";
} else {
items.value[2].title = subCategoryName.value;
}
items.value[1].title = mainCategory;
724
725
items.value[1].href =
"https://www.canrud.com/products?categories=" + mainCategory;
726
href1.value = "https://www.canrud.com/products?categories=" + mainCategory;
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
// items.value[1].title = subCategoryName.value;
href2.value = href1.value + "," + subCategoryName.value;
items.value[2].href = href1.value + "," + subCategoryName.value;
if (routeQuery?.selectedFunction) {
// items.value.push({
// title: routeQuery.selectedFunction,
// disabled: false,
// href: href2.value + "&function=" + routeQuery.selectedFunction,
// });
items.value[3].title = routeQuery.selectedFunction;
items.value[3].href =
href2.value + "&function=" + routeQuery.selectedFunction;
// routeQuery.updateFunction(null);
}
} else if (info?.productCrumbsVO?.category1) {
items.value[1].title = info.productCrumbsVO.category1;
items.value[1].href =
744
745
746
747
748
"https://www.canrud.com/products?categories=" +
info.productCrumbsVO.category1;
href1.value =
"https://www.canrud.com/products?categories=" +
info.productCrumbsVO.category1;
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
if (info?.productCrumbsVO?.category2) {
items.value[2].title = info.productCrumbsVO.category2;
href2.value = href1.value + "," + info.productCrumbsVO.category2;
items.value[2].href = href1.value + "," + info.productCrumbsVO.category2;
}
if (info?.productCrumbsVO?.function) {
// items.value.push({
// title: info.productCrumbsVO.function,
// disabled: false,
// href: href2.value + "&function=" + info.productCrumbsVO.function,
// });
items.value[3].title = info.productCrumbsVO.function;
items.value[3].href =
href2.value + "&function=" + info.productCrumbsVO.function;
}
}
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
recommendList.value = resData.value.data.records;
// recommendImages.value = recommendList.value.slice(0, 10).map((item) => {
recommendImages.value = Array.from({ length: 10 }).map((_, index) => {
const item = recommendList.value[index];
if (!item) {
return null;
}
// 检查 productimageliststore 是否为字符串格式,如果是,则尝试解析
if (typeof item.productimageliststore === "string") {
try {
item.productimageliststore = JSON.parse(item.productimageliststore);
} catch (error) {
item.productimageliststore = []; // 解析失败时,设置为空数组
}
}
const ree = (item.productimageliststore = item?.productimageliststore.map(
(productItem: ProductImage) => ({
...productItem,
// url: `http://112.74.45.244:8100/api/show/image?fileKey=${item.fileKey}`,
785
url: `https://www.canrud.com/api/show/image?fileKey=${productItem.fileKey}&psize=p256`,
786
name: item.name,
787
productUrl: `https://www.canrud.com/products/detail/${item.id}`,
788
789
790
791
})
));
return ree;
});
792
});
sanmu
authored
about a year ago
793
794
795
// onMounted(() => {
// dialogStore.updateDialog(true)
// })
796
797
const currentIndex = ref(0);
const navigateToUrl = (url) => {
798
window.open(url); // 在新标签页中打开链接
799
800
801
802
};
const toggleRow = () => {
currentIndex.value = currentIndex.value === 0 ? 1 : 0;
};
sanmu
authored
about a year ago
803
804
805
const tab = ref(0);
const slide = ref(0);
sanmu
authored
about a year ago
806
807
808
809
810
811
812
</script>
<style lang="scss" scoped>
.headerBorder {
border-top: 3px solid #1f88e5 !important;
}
813
814
815
@media screen and (min-width: 1537px) {
.tabs {
border-bottom: 2px solid #1f88e5;
816
margin: 0px auto 20px;
817
818
819
820
821
822
width: 100%;
}
}
@media screen and (max-width: 1536px) and (min-width: 1281px) {
.tabs {
border-bottom: 2px solid #1f88e5;
823
margin: 0px auto 40px;
824
825
width: 100%;
}
sanmu
authored
about a year ago
826
}
827
828
829
@media screen and (max-width: 1280px) {
.tabs {
border-bottom: 2px solid #1f88e5;
830
margin: 0px auto 40px;
831
832
833
834
835
836
837
width: 100%;
}
}
// .tabs {
// border-bottom: 2px solid #1f88e5;
// }
sanmu
authored
about a year ago
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
.active {
background-color: #1086e8;
}
.td,
th {
border: 1px solid #dcdcdc;
border-right: 0px;
border-bottom: 0px !important;
height: 50px !important;
&:last-child {
border: 1px solid #dcdcdc;
}
}
.tr:last-child {
.td {
border-bottom: 1px solid #dcdcdc !important;
}
}
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
.tw-sticky {
position: sticky;
}
.carousel-container {
position: relative;
}
.table-container {
overflow-x: auto; /* 防止表格超出页面宽度 */
}
.table1 {
width: 100%;
min-width: 600px; /* 设置表格最小宽度 */
}
.tr {
border-bottom: 1px solid #e0e0e0; /* 表格行样式 */
}
.headerBorder {
border-bottom: 2px solid #ccc; /* 表头边框 */
}
.text-grey-darken-4 {
color: #333; /* 表格文字颜色 */
}
.breadcrumb-disabled {
color: black;
pointer-events: none; /* 禁用点击 */
text-decoration: none; /* 移除链接样式 */
}
.breadcrumb-active {
896
color: #1e88e5;
897
}
898
899
900
901
902
903
904
@media screen and (min-width: 1537px) {
#image-container {
display: flex;
align-items: center;
justify-content: center;
height: 320px;
905
906
margin: 10px auto 80px;
width: 100%;
907
908
909
910
911
912
913
914
}
}
@media screen and (max-width: 1536px) and (min-width: 1281px) {
#image-container {
display: flex;
align-items: center;
justify-content: center;
height: 320px;
915
margin: 10px auto 0px;
916
917
918
width: 80%;
padding: 0;
}
919
}
920
921
922
923
924
925
@media screen and (max-width: 1280px) {
#image-container {
display: flex;
align-items: center;
justify-content: center;
height: 320px;
926
margin: 10px auto 0px;
927
928
929
930
width: 80%;
padding: 0;
}
}
931
932
933
934
.image-row {
display: flex;
height: 245px;
}
935
936
937
938
939
@media screen and (min-width: 1537px) {
.imageTotal {
display: inline-block;
margin: 0 5px;
text-align: center;
940
width: 300px;
941
942
943
944
945
946
947
948
949
950
}
}
@media screen and (max-width: 1536px) and (min-width: 1281px) {
.imageTotal {
display: inline-block;
margin: 0 5px;
text-align: center;
width: 200px;
}
}
951
952
953
954
955
956
957
958
@media screen and (max-width: 1280px) {
.imageTotal {
display: inline-block;
margin: 0 5px;
text-align: center;
width: 200px;
}
}
959
960
@media screen and (min-width: 1537px) {
.image-row img {
961
962
width: 200px;
height: 200px;
963
964
965
966
967
968
969
970
}
}
@media screen and (max-width: 1536px) and (min-width: 1281px) {
.image-row img {
width: 140px;
height: 140px;
}
}
971
972
973
974
975
976
@media screen and (max-width: 1280px) {
.image-row img {
width: 160px;
height: 160px;
}
}
977
978
@media screen and (min-width: 1537px) {
.image-name {
979
980
981
982
983
display: -webkit-box; /* Enables multi-line text handling */
-webkit-box-orient: vertical; /* Defines the vertical orientation of the box */
-webkit-line-clamp: 3; /* Limits the text to 3 lines */
overflow: hidden; /* Hides the overflowed text */
text-overflow: ellipsis; /* Adds an ellipsis when the text overflows */
984
985
986
987
margin-top: 5px;
font-size: 16px;
width: 180px;
color: #555;
988
989
text-align: center; /* Centers the text horizontally */
margin-left: 50px;
990
991
992
993
}
}
@media screen and (max-width: 1536px) and (min-width: 1281px) {
.image-name {
994
995
996
997
998
display: -webkit-box; /* Enables multi-line text handling */
-webkit-box-orient: vertical; /* Defines the vertical orientation of the box */
-webkit-line-clamp: 3; /* Limits the text to 3 lines */
overflow: hidden; /* Hides the overflowed text */
text-overflow: ellipsis; /* Adds an ellipsis when the text overflows */
999
1000
1001
1002
margin-top: 5px;
font-size: 16px;
width: 180px;
color: #555;
1003
text-align: center; /* Centers the text horizontally */
1004
1005
margin-left: 10px;
}
1006
}
1007
1008
@media screen and (max-width: 1280px) {
.image-name {
1009
1010
1011
1012
1013
display: -webkit-box; /* Enables multi-line text handling */
-webkit-box-orient: vertical; /* Defines the vertical orientation of the box */
-webkit-line-clamp: 3; /* Limits the text to 3 lines */
overflow: hidden; /* Hides the overflowed text */
text-overflow: ellipsis; /* Adds an ellipsis when the text overflows */
1014
1015
1016
1017
margin-top: 5px;
font-size: 16px;
width: 180px;
color: #555;
1018
text-align: center; /* Centers the text horizontally */
1019
1020
1021
margin-left: 20px;
}
}
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
button .recommendButton {
margin: 0 0px;
cursor: pointer;
}
.recommend-left-box {
}
.recommend-img-left {
width: 26px;
height: 27px;
margin-right: 30px;
1035
margin-bottom: 50px;
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
}
.recommend-img-left:hover {
cursor: pointer;
}
.recommend-right-box {
}
.recommend-img-right {
width: 26px;
height: 27px;
margin-left: 30px;
1048
margin-bottom: 50px;
1049
1050
1051
1052
1053
}
.recommend-img-right:hover {
cursor: pointer;
}
1054
1055
1056
1057
1058
.social-share-container {
display: flex;
flex-direction: row; /* 父容器横向排列 */
gap: 1rem; /* 设置每个分享项之间的间距 */
1059
margin-top: 40px;
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
}
.social-share-item {
display: flex;
flex-direction: row; /* 每个分享项横向排列 */
align-items: center; /* 垂直居中对齐 */
gap: 0.5rem; /* 标题与按钮之间的间距 */
}
.social-share-title {
font-size: 1rem;
font-weight: bold;
}
1073
1074
1075
.title {
font-size: 15px; /* 设置字体大小为24px */
1076
color: black; /* 设置字体颜色为黑色 */
1077
1078
1079
display: -webkit-box; /* 使用盒模型显示多行文本 */
-webkit-line-clamp: 2; /* 限制为两行 */
-webkit-box-orient: vertical; /* 盒子方向为垂直 */
1080
overflow: hidden; /* 超过部分隐藏 */
1081
1082
1083
1084
1085
1086
1087
transition: max-height 0.3s ease; /* 过渡效果 */
}
.full-title {
display: block; /* 当悬浮时显示为块级元素 */
color: #1e88e5;
white-space: normal; /* 允许换行 */
1088
overflow: visible; /* 显示全部内容 */
1089
}
sanmu
authored
about a year ago
1090
</style>