-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
502 lines (458 loc) · 18.7 KB
/
index.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
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
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
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
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
461
462
463
464
465
466
467
468
469
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
499
500
501
502
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="도전하고 싶으신가요? 피버타임과 함께하세요 !!">
<!-- title -->
<title>피버타임</title>
<!-- bootstrap css-->
<!-- favicon -->
<link rel="shortcut icon" type="image/png"
href="./static/assets/img/favicon.svg">
<!-- google font -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Poppins:400,700&display=swap" rel="stylesheet">
<!-- fontawesome -->
<link rel="stylesheet" href="./static/assets/css/all.min.css">
<!-- bootstrap -->
<link rel="stylesheet" href="./static/assets/bootstrap/css/bootstrap.min.css">
<!-- owl carousel -->
<link rel="stylesheet" href="./static/assets/css/owl.carousel.css">
<!-- magnific popup -->
<link rel="stylesheet" href="./static/assets/css/magnific-popup.css">
<!-- animate css -->
<link rel="stylesheet" href="./static/assets/css/animate.css">
<!-- mean menu css -->
<link rel="stylesheet" href="./static/assets/css/meanmenu.min.css">
<!-- main style -->
<link rel="stylesheet" href="./static/assets/css/main.css">
<!-- responsive -->
<link rel="stylesheet" href="./static/assets/css/responsive.css">
<!-- jquery -->
<script src="./static/assets/js/jquery-1.11.3.min.js"></script>
<!-- kakao login-->
<script src="https://developers.kakao.com/sdk/js/kakao.js"></script>
<script src="static/assets/js/kakao-login.js"></script>
<style>
#add-btn {
background-color: white;
border: solid #F28123;
color: #F28123;
}
#add-btn:hover {
background-color: #F28123;
border: solid white;
color: white;
}
.product-image img {
width: 250px;
height: 200px;
}
a.btnp {
background-color: #4e555b;
}
.product-lists {
height: auto !important;
}
.single-product-item {
position: relative !important;
}
.btn {
margin-right: 10px;
width: 80px;
height: 50px;
font-weight: bold;
color: black;
font-size: medium;
border: black solid 2px;
background-color: white;
border-radius: 30px;
}
.btn:hover {
background-color: #F28123;
border: solid white;
color: white;
}
</style>
<script>
$(document).ready(function () {
getChallenges("All");
loginStatus();
$("input:button[name='button']").on('click', function () {
getChallenges($(this).val());
});
$.ajaxSetup({
error: function (jqXHR, exception) {
switch (jqXHR.status) {
case 401:
alert('로그인을 해주세요.');
break;
}
},
});
})
function getChallenges(kind) {
$.ajax({
type: "GET",
url: `https://api.fevertime.shop/challenges?kind=${kind}`,
data: {},
success: function (response) {
showChallenges(response)
}
})
}
function showChallenges(challenges) {
console.log(challenges);
if (challenges.length === 0) {
$('#no_challenge').show()
$('#challenge-list').empty()
return
}
$('#no_challenge').hide();
$('#challenge-list').empty();
for (let i = 0; i < challenges.length; i++) {
let id = challenges[i]['challengeId'];
let title = challenges[i]['title'];
// let desc = challenges[i]['description'];
let img = challenges[i]['imgUrl'];
let start = challenges[i]['startDate'];
let end = challenges[i]['endDate'];
let limitPerson = challenges[i]['limitPerson'];
let participants = challenges[i]['participants'];
let endDate = new Date(challenges[i]['endDate'])
let temp_html = `<div class="col-lg-4 col-md-6 text-center product-lists">
<div class="single-product-item">
<div class="product-image">
<a onclick="location.href='challenge-detail.html?challengeId=${id}'">
<img src="${img}"
alt="">
</a>
</div>
<h3>${title}</h3>
<p class="product-price">
<span>
<i class="far fa-calendar-alt"></i> ${start} ~ ${end}
</span>
${participants}/${limitPerson}명
</p>
<div id="${id}-check-challenge">
</div>
</div>
</div>`
$('#challenge-list').append(temp_html)
plusButton(id, endDate)
}
}
//기간 종료 버튼
function plusButton(id, endDate) {
let nowDate = new Date()
if (nowDate > endDate.setHours(23, 59, 59)) {
let temp_html = `<a class="cart-btn btnp" onclick="location.href='challenge-detail.html?challengeId=${id}'">
<i class="fas fa-bolt"></i>챌린지 기간 종료
</a>
`
$(`#${id}-check-challenge`).append(temp_html);
} else {
let temp_html = `
<a onclick="location.href='challenge-detail.html?challengeId=${id}'" class="cart-btn">
<i class="fas fa-bolt"></i> View Details
</a>`
$(`#${id}-check-challenge`).append(temp_html);
}
}
//로그인되어있을때는 로그아웃 버튼 보이기
function loginStatus() {
if (localStorage.getItem("token") == null) {
$('#logout').hide();
$('#login').show();
} else {
$('#login').hide();
$('#logout').show();
}
}
function logout() {
localStorage.removeItem("token");
location.href = "index.html";
}
function onClickCreateChallenge() {
if (localStorage.getItem("token") == null) {
alert("로그인 후 생성해주세요 !!")
} else {
// 챌린지 생성 3개 제한
$.ajax({
type: "GET",
url: "https://api.fevertime.shop/user/challenges/create",
data: {},
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'Bearer ' + localStorage.getItem('token'));
},
success: function (response) {
if (response.length >= 3) {
alert("챌린지는 3개까지 생성할 수 있어요!")
} else {
window.location.href = "challenge-create.html"
}
},
error: function () {
alert("로그인 후 생성해주세요 !!")
}
})
}
}
function getSearchChallenges() {
let search = $("#search-input").val();
if (search == "") {
alert("검색어를 입력해주세요.")
return
}
$.ajax({
type: "GET",
url: "https://api.fevertime.shop/challenges/search",
data: {"search": search},
success: function (response) { // 성공하면
$(".search-area").toggleClass("search-active")
$('#challenge-list').empty();
showChallenges(response)
}
})
}
function onClickMyPage() {
if (localStorage.getItem("token") == null) {
alert("로그인을 해주세요!");
} else {
location.href = "user.html";
}
}
</script>
</head>
<body>
<!--PreLoader start -->
<div class="loader">
<div class="loader-inner">
<div class="circle"></div>
</div>
</div>
<!--PreLoader end-->
<!-- header start -->
<div class="top-header-area" id="sticker">
<div class="container">
<div class="row">
<div class="col-lg-12 col-sm-12 text-center">
<div class="main-menu-wrap">
<!-- logo -->
<div class="site-logo" style="padding: 0;">
<a href="index.html">
<img src="./static/assets/img/logo.png" alt="">
</a>
</div>
<!-- logo -->
<!-- menu start -->
<nav class="main-menu">
<ul>
<li class="current-list-item">
<a href="index.html">Home</a>
</li>
<li>
<a href="feed.html">Feed</a>
</li>
<li>
<a href="#" style="margin-right: 150px">User</a>
<ul class="sub-menu">
<li><a href="#" onclick="onClickMyPage()">My Page</a></li>
<li id="login"><a href="#" data-toggle="modal"
data-target="#exampleModal">Login</a></li>
<li id="logout"><a href="#" onclick="logout()">Logout</a></li>
</ul>
</li>
<li>
<div class="header-icons">
<a class="mobile-hide search-bar-icon" href="#">
<i class="fas fa-search"></i>
</a>
</div>
</li>
</ul>
</nav>
<a class="mobile-show search-bar-icon" href="#"><i class="fas fa-search"></i></a>
<div class="mobile-menu"></div>
<!-- menu end -->
</div>
</div>
</div>
</div>
</div>
<!-- header end -->
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Login</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" style="">
<img onclick="loginWithKakao()" style="cursor:pointer;"
src="static/assets/img/kakao_login_large_wide.png" alt="카카오 로그인"/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- search area start-->
<div class="search-area">
<div class="container">
<div class="row">
<div class="col-lg-12">
<span class="close-btn"><i class="fas fa-window-close"></i></span>
<div class="search-bar">
<div class="search-bar-tablecell">
<h3>Search For:</h3>
<input type="text" id="search-input" placeholder="Keywords" name="search">
<button type="submit" onclick="getSearchChallenges()">Search <i class="fas fa-search"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- search area end -->
<!-- breadcrumb-section start -->
<div class="breadcrumb-section breadcrumb-bg">
<div class="container">
<div class="row">
<div class="col-lg-8 offset-lg-2 text-center">
<div style="cursor: pointer;" onclick="location.href='index.html'" class="breadcrumb-text">
<p>습관, 목표 관리 애플리케이션</p>
<h1>피버타임</h1>
</div>
</div>
</div>
</div>
</div>
<!-- breadcrumb section end -->
<!-- features list section -->
<div class="list-section" style="padding: 60px">
<div class="container">
<h4 style="margin-bottom: 40px">피버타임 규칙</h4>
<div>
<h5><i class="fa fa-check" aria-hidden="true" style="margin: 10px;color: #F28123;"></i>챌린지는 1인당 3개까지 생성
가능합니다
</h5>
</div>
<div>
<h5><i class="fa fa-check" aria-hidden="true" style="margin: 10px;color: #F28123;"></i>챌린지별 인증은 하루에 한번만 할 수
있습니다
</h5>
</div>
</div>
</div>
<!-- end features list section -->
<!-- products -->
<div class="product-section mt-150 mb-150">
<div class="container" style="text-align: center">
<div class="row" id="container__category">
<div class="col-md-12">
<div class="product-filters">
<ul>
<input type="button" id="All" name="button" value="All" class="btn btn-outline-light"/>
<input type="button" id="운동" name="button" value="운동" class="btn btn-outline-light"/>
<input type="button" id="공부" name="button" value="공부" class="btn btn-outline-light"/>
<input type="button" id="취미" name="button" value="취미" class="btn btn-outline-light"/>
<input type="button" id="독서" name="button" value="독서" class="btn btn-outline-light"/>
<input type="button" id="기타" name="button" value="기타" class="btn btn-outline-light"/>
</ul>
</div>
</div>
</div>
<div id="no_challenge" style="display: none">
<img src="./static/assets/img/error.svg" width="300" height="300"
alt="">
<h4 style="margin-top: 30px">챌린지가 없습니다😥</h4>
</div>
<div class="row product-lists" id="challenge-list">
</div>
<!--
// 페이지 이동 주석
<div class="row">
<div class="col-lg-12 text-center">
<div class="pagination-wrap">
<ul>
<li><a href="#">Prev</a></li>
<li><a href="#">1</a></li>
<li><a class="active" href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">Next</a></li>
</ul>
</div>
</div>
</div>
-->
<div class="row">
<div class="col-md-12 text-center">
<div class="pagination-wrap">
<a id="add-btn" class="cart-btn" onclick="onClickCreateChallenge()">
<i class="fas fa-plus"></i> Add new Challenge
</a>
</div>
</div>
</div>
</div>
</div>
<!-- end products -->
<!-- copyright start -->
<div class="copyright">
<div class="container">
<div class="row">
<div class="col-lg-6 col-md-12">
<p>Copyrights © 2021 - 피버타임, All Rights
Reserved.
</p>
<!-- <a href="https://imransdesign.com/">Imran Hossain</a> -->
</div>
<div class="col-lg-6 text-right col-md-12">
<div class="social-icons">
<!-- <ul>
<li><a href="#" target="_blank"><i class="fab fa-facebook-f"></i></a></li>
<li><a href="#" target="_blank"><i class="fab fa-twitter"></i></a></li>
<li><a href="#" target="_blank"><i class="fab fa-instagram"></i></a></li>
<li><a href="#" target="_blank"><i class="fab fa-linkedin"></i></a></li>
<li><a href="#" target="_blank"><i class="fab fa-dribbble"></i></a></li>
</ul> -->
</div>
</div>
</div>
</div>
</div>
<!-- copyright end -->
<!-- bootstrap js start -->
<!-- jquery -->
<script src="./static/assets/js/jquery-1.11.3.min.js"></script>
<!-- bootstrap -->
<script src="./static/assets/bootstrap/js/bootstrap.min.js"></script>
<!-- count down -->
<script src="./static/assets/js/jquery.countdown.js"></script>
<!-- isotope -->
<script src="./static/assets/js/jquery.isotope-3.0.6.min.js"></script>
<!-- waypoints -->
<script src="./static/assets/js/waypoints.js"></script>
<!-- owl carousel -->
<script src="./static/assets/js/owl.carousel.min.js"></script>
<!-- magnific popup -->
<script src="./static/assets/js/jquery.magnific-popup.min.js"></script>
<!-- mean menu -->
<script src="./static/assets/js/jquery.meanmenu.min.js"></script>
<!-- sticker js -->
<script src="./static/assets/js/sticker.js"></script>
<!-- main js -->
<script src="./static/assets/js/main.js"></script>
<!-- bootstrap js end -->
</body>
</html>