-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathview.html
117 lines (89 loc) · 4.26 KB
/
view.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Repfind - Product</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<link type="text/css" rel="stylesheet" href="styles/main.css" />
<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
<script src="https://unpkg.com/[email protected]/dist/aos.js"></script>
</head>
<body>
<div id="products-container">
</div>
<script>
const prms = new URLSearchParams(window.location.search);
const productId = prms.get('id');
fetch('./data/products.json')
.then(response => response.json())
.then(data => {
const product = data.find(item => item.id === productId);
console.log(product)
if (product) {
const productContainer = document.getElementById('products-container');
const productHTML = `
<div class="product-view">
<img src="${product.image}" alt="${product.name}">
<h3>${product.name}</h3>
<p>Category: ${product.category}</p>
<p>Description: ${product.description}</p>
<p>Price (CNY): ${product.prices.cny}</p>
<p>Price (USD): ${product.prices.usd}</p>
<a class="btn" href="${product.link}" target="_blank">Open Link</a>
<h1 class="center" style="margin-top: 30px; text-decoration:underline;">QC Images</h1>
<div id="pictures"></div>
</div>
`;
productContainer.innerHTML = productHTML;
} else {
const productContainer = document.getElementById('product-container');
productContainer.innerHTML = "<p>Product not found.</p>";
}
let imgContainer = document.getElementById('pictures');
imgContainer.innerHTML = "<h2>No Images Found.</h2>"
fetch(`https://api.qc.photos/v3/getProductInfo/pandabuy?url=${product.link}&view=true`)
.then(response => response.json())
.then(data => {
const imgSets = data['data']['qc_image_set_container']['qc_image_sets'];
let imgCode = '';
imgSets.forEach(imgSet => {
imgSet['images'].forEach(image => {
imgCode += `<img data-aos="zoom-in" style="margin: 10px;" src="${image['qc_image_url']}">`;
});
});
imgContainer.innerHTML = imgCode;
});
fetch(`https://api.qc.photos/v3/getProductInfo/superbuy?url=${product.link}&view=true`)
.then(response => response.json())
.then(data => {
const imgSets = data['data']['qc_image_set_container']['qc_image_sets'];
let imgCode = '';
imgSets.forEach(imgSet => {
imgSet['images'].forEach(image => {
imgCode += `<img data-aos="zoom-in" style="margin: 10px;" src="${image['qc_image_url']}">`;
});
});
imgContainer.innerHTML = imgCode;
});
fetch(`https://api.qc.photos/v3/getProductInfo/cssbuy?url=${product.link}&view=true`)
.then(response => response.json())
.then(data => {
const imgSets = data['data']['qc_image_set_container']['qc_image_sets'];
let imgCode = '';
imgSets.forEach(imgSet => {
imgSet['images'].forEach(image => {
imgCode += `<img data-aos="zoom-in" style="margin: 10px;" src="${image['qc_image_url']}">`;
});
});
imgContainer.innerHTML = imgCode;
});
console.log(imgCode);
})
.catch(error => {
console.error('Error fetching product data:', error);
});
AOS.init();
</script>
</body>
</html>