-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmap.php
More file actions
302 lines (270 loc) · 11 KB
/
Copy pathmap.php
File metadata and controls
302 lines (270 loc) · 11 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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MAP</title>
<!-- 부트스트랩 -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.1/font/bootstrap-icons.css">
<!-- 산돌구름 폰트 -->
<script type="module"
src="https://8fl3k30sy0.execute-api.ap-northeast-2.amazonaws.com/v1/api/fontstream/djs/?sid=gAAAAABlsHgJBHM1QHBIdMVd5ZQPii4NpDMf_Qs3jmFS5yt3_xJpQkJWj6G4pOi1XU3WVZc8ZhL3cnzME82ZgdxRheBEr_edqd3mvpja2g5UTyMvZ318m8QKGy0DEWyKHFL-owjPot0HXKViPw61I1yvg8SFrLRXb6LRnB1r-ASpwdwYSk-pKFR-AjjyUsNHhQgwKXdTXRNZSYBwdzD0lf0j2hJLR33glHxsMjxgxz0UXtK6u34ulMFFJsj03iwd21meQBSKY7Ax"
charset="utf-8"></script>
<!-- 구글폰트 -->
<link href="https://fonts.googleapis.com/css?family=Cherry+Bomb" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Abhaya+Libre&family=Sniglet:wght@800&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="./css/nav.css">
<link rel="stylesheet" href="./css/footer.css">
<link rel="stylesheet" href="./css/map.css">
<!--favicon-->
<link rel="icon" href="./favicon.png">
<style>
.hashtag {
display: none;
}
</style>
</head>
<body>
<!--상단 nav-->
<nav>
<logo>
<a href="./index.html">
<img src="./assets/logo2.png">
</a>
</logo>
<menu>
<ul>
<li><a href="./index.php" class="top-nav">MAIN</a></li>
<li><a href="./search_test.php" class="top-nav">SEARCH</a></li>
<li><a href="./map.php" class="top-nav">PIN!MAP</a></li>
<li><a href="./mypage_H.php" class="top-nav">MYPAGE</a></li>
</ul>
</menu>
<!-- <input type="button" value="LOGIN" class="login-Btn"> -->
<button type="submit" class="login-Btn">
<a href="login.html" style="color: #FF47CB; text-decoration: none;">
LOGIN
</a>
</button>
</nav>
<!--메인-->
<main>
<div class="title">
<h1>지도</h1>
<p style="margin: 10px;">핀으로 설정한 매장을 간편하게 모아 보세요.</p>
</div>
<div class="brandshop-box">
</div>
<!-- 지도 이미지 -->
<div class="map-img" style="margin-left: -50px;">
<img id="hokkaido-img" src="./assets/Hokkaido_off.png" alt="">
<img id="honshu-img" src="./assets/Honshu_off.png" alt="">
<img id="shikoku-img" src="./assets/Shikoku_off.png" alt="">
<img id="kyushu-img" src="./assets/Kyushu_off.png" alt="">
</div>
<!-- 해시태그 -->
<div class="hashtag-container">
<div>
<span class="hashtag" id="hokkaido-hashtag">#훗카이도</span>
<span class="hashtag" id="honshu-hashtag">#혼슈</span>
<span class="hashtag" id="shikoku-hashtag">#시코쿠</span>
<span class="hashtag" id="kyushu-hashtag">#규슈</span>
</div>
<div style="text-align: right;">
<span class="pinCount" style="font-size: 24px;">나의 핀 <span style="color: #FF47CB;">15개</span></span>
</div>
</div>
<!-- 회색 점선 -->
<br>
<div class="grey-line"></div> <br>
<?php
include ('db_conn.php');
// 데이터베이스 연결 오류 확인
if ($conn->connect_error) {
die("<script>console.error('데이터베이스 연결 실패: " . addslashes($conn->connect_error) . "');</script>");
}
$sql = "SELECT shop_name, tag_region, tag_location, tag_style, tag_brand, shop_img_path, price_min, price_max FROM vintageshop";
$result = $conn->query($sql); // 쿼리 실행
if (!$result) {
die("<script>console.error('쿼리 실행 실패: " . addslashes($conn->error) . "');</script>");
}
$allRows = [];
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$allRows[] = $row;
}
$jsonAllRows = json_encode($allRows);
} else {
$jsonAllRows = json_encode([]);
}
?>
<!-- 결과 -->
<div class="center-container">
<!-- Cards container -->
<div class="card-container" id="card-container">
<?php
foreach ($allRows as $index => $row) {
?>
<div class="card" data-index="<?php echo $index + 1; ?>">
<div class="heart">
<i class="bi bi-heart-fill" style="color: red;"></i>
</div>
<div class="cardImg">
<a href="#">
<img src="<?php echo $row["shop_img_path"]; ?>" alt="">
</a>
</div>
<div class="cardTitle"><?php echo $row["shop_name"]; ?></div>
<div class="cardHashtag_container">
<div class="cardHashtag">#<?php echo $row["tag_location"]; ?></div>
<div class="cardHashtag">#<?php echo $row["tag_style"]; ?></div>
<div class="cardHashtag">#<?php echo $row["tag_brand"]; ?></div>
</div>
<div class="price">
<img src="" alt="">
<p><?php echo $row["price_min"]; ?>¥ ~ <?php echo $row["price_max"]; ?>¥</p>
</div>
</div>
<?php
}
?>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const regions = [
{
name: 'hokkaido',
img: document.getElementById('hokkaido-img'),
hashtag: document.getElementById('hokkaido-hashtag'),
imgOn: './assets/Hokkaido_on.png',
imgOff: './assets/Hokkaido_off.png',
clicked: false,
filter: (index) => (index % 2 === 1) // 홀수 인덱스 (1의 배수)
},
{
name: 'honshu',
img: document.getElementById('honshu-img'),
hashtag: document.getElementById('honshu-hashtag'),
imgOn: './assets/Honshu_on.png',
imgOff: './assets/Honshu_off.png',
clicked: false,
filter: (index) => (index % 3 === 0) // 3의 배수
},
{
name: 'shikoku',
img: document.getElementById('shikoku-img'),
hashtag: document.getElementById('shikoku-hashtag'),
imgOn: './assets/Shikoku_on.png',
imgOff: './assets/Shikoku_off.png',
clicked: false,
filter: (index) => (index % 4 === 0) // 4의 배수
},
{
name: 'kyushu',
img: document.getElementById('kyushu-img'),
hashtag: document.getElementById('kyushu-hashtag'),
imgOn: './assets/Kyushu_on.png',
imgOff: './assets/Kyushu_off.png',
clicked: false,
filter: (index) => (index % 5 === 0) // 5의 배수
}
];
function filterCards() {
const cards = document.querySelectorAll('.card');
const anyRegionClicked = regions.some(region => region.clicked);
cards.forEach(card => {
const index = parseInt(card.getAttribute('data-index'), 10);
const showCard = regions.some(region => region.clicked && region.filter(index));
if (anyRegionClicked) {
card.style.display = showCard ? 'block' : 'none';
} else {
card.style.display = 'block'; // 모든 이미지가 Off일 때는 모든 카드 보이기
}
});
}
function handleClick(region) {
region.clicked = !region.clicked;
region.img.src = region.clicked ? region.imgOn : region.imgOff;
region.hashtag.style.display = region.clicked ? 'inline' : 'none';
filterCards();
}
regions.forEach(region => {
region.img.addEventListener('click', () => handleClick(region));
region.hashtag.addEventListener('click', () => handleClick(region));
});
});
</script>
</main>
<!-- 푸터 -->
<footer>
<div class="contributor">
<div class="jiwoo">
<ul>
<li>김지우</li>
<li>📖 Backend Developer</li>
<li>🛠️ VScode / Github</li>
<li><a href="https://github.com/jiwoo1087">😺 깃허브</a></li>
<li>📩 s2205@e-mirim.hs.kr</li>
</ul>
</div>
<div class="khyunji">
<ul>
<li>김현지</li>
<li>📖 FullStack Developer</li>
<li>🛠️ VScode / FileZila / Github</li>
<li><a href="https://github.com/de-quei">😺 깃허브</a></li>
<li>📩 s2208@e-mirim.hs.kr</li>
</ul>
</div>
<div class="heeyoung">
<ul>
<li>김희영</li>
<li>📖 Frontend Developer</li>
<li>🛠️ VScode / Github</li>
<li><a href="https://github.com/gmldrnfl">😺 깃허브</a></li>
<li>📩 w2225@e-mirim.hs.kr</li>
</ul>
</div>
<div class="goeun">
<ul>
<li>고은</li>
<li>📖 Frontend Developer</li>
<li>🛠️ VScode / Github</li>
<li><a href="https://github.com/Silversi06">😺 깃허브</a></li>
<li>📩 w2219@e-mirim.hs.kr</li>
</ul>
</div>
<div class="hyobeen">
<ul>
<li>홍효빈</li>
<li>📖 Frontend Developer</li>
<li>🛠️ VScode / Github</li>
<li><a href="https://github.com/honghyobin">😺 깃허브</a></li>
<li>📩 w234@e-mirim.hs.kr</li>
</ul>
</div>
<div class="nhyunji">
<ul>
<li>노현지</li>
<li>📖 Designer</li>
<li>🛠️ Figma</li>
<li><a href="https://www.instagram.com/shgusw1/">🩷인스타그램</a></li>
<li>📩 d2204@e-mirim.hs.kr</li>
</ul>
</div>
</div>
<div class="footer-nav">
<img src="./assets/logo2.png" style="width: 150px; margin-top: 20px;">
<h4>TEAM カピバラ</h4>
</div>
</footer>
<script src="./js/map.js"></script>
</body>
</html>