반응형
💡수업 목표💡
- 파이썬 기초 문법을 안다.
- 원하는 페이지를 크롤링 할 수 있다.
- pymongo를 통해 mongoDB를 제어할 수 있다.
2022.08.26 - [스파르타코딩클럽/웹개발종합반] - 웹개발종합반 개발일지 | 3주차 - 1강 파이썬 설치 및 Pycharm 설정
2주차 OpenAPI 복습
http://spartacodingclub.shop/web/movie
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<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://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<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 href="https://fonts.googleapis.com/css2?family=Gowun+Dodum&display=swap" rel="stylesheet">
<title>스파르타코딩클럽 | 내 생애 최고의 영화들</title>
<style>
* {
font-family: 'Gowun Dodum', sans-serif;
}
.myTitle {
background-color: darkgreen;
width: 100%;
height: 250px;
color: #fff;
background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("https://movie-phinf.pstatic.net/20210715_95/1626338192428gTnJl_JPEG/movie_image.jpg");
background-position: center;
background-size: cover;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.myTitle .mybtn {
width: 200px;
height: 50px;
background-color: transparent;
color: #fff;
border-radius: 50px;
border: solid 1px #fff;
margin-top: 10px;
}
.myTitle .mybtn:hover {
border: solid 2px #fff;
}
.wrap {
width: 95%;
max-width: 1200px;
margin: 20px auto 0px;
}
.myPost {
width: 95%;
max-width: 500px;
box-shadow: 0px 0px 3px 0px gray;
padding: 20px;
margin: 20px auto;
display: none;
}
.mybtn {
display: flex;
justify-content: center;
align-items: center;
margin: 10px;
}
.mybtn button {
margin-right: 10px;
}
</style>
<script>
$(document).ready(function () {
listing();
$.ajax({
type: "GET",
url: "http://spartacodingclub.shop/web/api/movie",
data: {},
success: function (response) {
console.log(response)
let rows = response['movies'];
for (let i = 0; i < rows.length; i++) {
let comment = rows[i]['comment'];
let desc = rows[i]['desc'];
let image = rows[i]['image'];
let star = rows[i]['star'];
let title = rows[i]['title'];
let star_image = "⭐".repeat(star);
let temp_html = `<div class="col">
<div class="card">
<img src="${image}"
class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">${title}</h5>
<p class="card-text">${desc}</p>
<p>${star_image}</p>
<p>${comment}</p>
</div>
</div>
</div>`; // ` backtick
$("#cards-box").append(temp_html);
}
}
})
});
function listing() {
console.log("화면 로딩 후 잘 실행되었습니다.");
}
function open_box() {
alert("박스열기");
$("#post-box").show();
}
function close_box() {
alert("박스닫기");
$("#post-box").hide();
}
</script>
</head>
<body>
<div class="myTitle">
<h1>내 생애 최고의 영화들</h1>
<button class="mybtn" onclick="open_box();">영화 기록하기</button>
</div>
<div class="myPost" id="post-box">
<div class="form-floating mb-3">
<input type="text" class="form-control" id="url" placeholder="name@example.com">
<label for="url">영화URL</label>
</div>
<div class="input-group mb-3">
<label class="input-group-text" for="score">별점</label>
<select class="form-select" id="score">
<option selected>선택하기</option>
<option value="1">⭐</option>
<option value="2">⭐⭐</option>
<option value="3">⭐⭐⭐</option>
<option value="4">⭐⭐⭐⭐</option>
<option value="5">⭐⭐⭐⭐⭐</option>
</select>
</div>
<div class="form-floating">
<textarea class="form-control" placeholder="Leave a comment here" id="comment"></textarea>
<label for="comment">코멘트</label>
</div>
<div class="mybtn">
<button type="button" class="btn btn-dark">기록하기</button>
<button type="button" class="btn btn-outline-dark" onclick="close_box();">닫기</button>
</div>
</div>
<div class="wrap">
<div id='cards-box' class="row row-cols-1 row-cols-md-4 g-4">
<div class="col">
<div class="card">
<img src="https://movie-phinf.pstatic.net/20210728_221/1627440327667GyoYj_JPEG/movie_image.jpg"
class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to
additional content. This content is a little bit longer.</p>
<p>⭐⭐⭐</p>
<p>여기 코멘트가 들어갑니다</p>
</div>
</div>
</div>
<div class="col">
<div class="card">
<img src="https://movie-phinf.pstatic.net/20210728_221/1627440327667GyoYj_JPEG/movie_image.jpg"
class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to
additional content. This content is a little bit longer.</p>
<p>⭐⭐⭐</p>
<p>여기 코멘트가 들어갑니다</p>
</div>
</div>
</div>
<div class="col">
<div class="card">
<img src="https://movie-phinf.pstatic.net/20210728_221/1627440327667GyoYj_JPEG/movie_image.jpg"
class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to
additional content.</p>
<p>⭐⭐⭐</p>
<p>여기 코멘트가 들어갑니다</p>
</div>
</div>
</div>
<div class="col">
<div class="card">
<img src="https://movie-phinf.pstatic.net/20210728_221/1627440327667GyoYj_JPEG/movie_image.jpg"
class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to
additional content. This content is a little bit longer.</p>
<p>⭐⭐⭐</p>
<p>여기 코멘트가 들어갑니다</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
반응형
'스파르타코딩클럽 > 웹개발' 카테고리의 다른 글
웹개발종합반 개발일지 | 3주차 - 9,10,11강 mongoDB Atlas로 시작하기 (1) | 2022.08.27 |
---|---|
웹개발종합반 개발일지 | 3주차 - 3,4,5,6,7,8강 (0) | 2022.08.26 |
웹개발종합반 개발일지 | 3주차 - 1강 파이썬 설치 및 Pycharm 설정 (0) | 2022.08.26 |
웹개발종합반 개발일지 | 2주차 (0) | 2022.08.17 |
웹개발종합반 개발일지 | 2주차 - 숙제 (0) | 2022.08.17 |