전수민

photo

......@@ -90,17 +90,19 @@
<div class="row" id="cardBody">
</div>
<!-- <script>
var result_entertainment = []
</script> -->
<script>
var result_entertainment = []
var result_entertainment = [];
</script>
<script>
var entName = '';
var entType = '';
var card = '';
var map;
var service;
var _length =0;
var _temp = 0;
function initMap() {
// Try HTML5 geolocation.
......@@ -126,32 +128,34 @@
searchPlace('night_club', 'entertainment');
searchPlace('shopping_mall', 'entertainment');
searchPlace('zoo', 'entertainment');
if (_temp ==5)
makecard(_length);
});
}
}
async function searchPlace(str, placeType) {
function searchPlace(str, placeType) {
switch (placeType) {
case 'food':
service.nearbySearch({
location: pos,
radius: 500,
type: [str]
}, await callback_foods);
}, callback_foods);
break;
case 'entertainment':
service.nearbySearch({
location: pos,
radius: 500,
type: [str]
}, await callback_entertainment);
}, callback_entertainment);
break;
case 'room':
service.nearbySearch({
location: pos,
radius: 500,
type: [str]
}, await callback_rooms);
}, callback_rooms);
break;
default:
break;
......@@ -161,12 +165,41 @@
function callback_entertainment(results, status) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
console.log(results[i]);
result_entertainment.push(results[i])
//console.log(results[i]);
result_entertainment.push(results[i]);
_length +=1;
console.log(_length);
if (_length ==2)
makecard(_length);
//console.log(result_entertainment[i]);
_temp = 5;
}
}
}
function makecard(_length)
{
console.log("make")
for(var i =0;i<_length;i++)
{
//console.log(result_entertainment[i]);
entName = result_entertainment[i].name;
console.log(entName);
var tmp = '<div class="col-xl-6 col-sm-6 mb-3">' +
'<div class="card text-white bg-light o-hidden h-100">' +
'<div class="card-body"' + ' style="height:350px; background-image:url(' + "'entertainment.jpg'" + '); background-size: 100% 100%; background-repeat: no-repeat;">' + // place photo
'<div class="mr-5" id="nameDiv">'+entName+'</div>'+ // place name
//'<div class="mr-5" id="typeDiv">'+entType+'</div>'+ // place type
'</div>' +
'</div>' +
'</div>';
//card+=tmp;
console.log(tmp);
document.getElementById("cardBody").innerHTML = tmp;
}
}
// const id = result['id'];
// const place_id =result['place_id'];
// const name = result['name'];
......@@ -178,23 +211,29 @@
// const lng = result.geometry.viewport.ea.j;
// const lat =result.geometry.viewport.la.j;
setTimeout(function(){
for (var i = 0; i < result_entertainment.length; i++) {
entName = result_entertainment[i][name];
entType = "result_entertainment[i][types];"
var tmp = '<div class="col-xl-6 col-sm-6 mb-3">' +
'<div class="card text-white bg-light o-hidden h-100">' +
'<div class="card-body"' + ' style="height:350px; background-image:url(' + "'entertainment.jpg'" + '); background-size: 100% 100%; background-repeat: no-repeat;">' + // place photo
'<div class="mr-5" id="nameDiv">'+entName+'</div>'+ // place name
'<div class="mr-5" id="typeDiv">'+entType+'</div>'+ // place type
'</div>' +
'</div>' +
'</div>';
card+=tmp;
}
}, 5000);
// for (var i = 0; i <result_entertainment.length; i++) {
// console.log("AAA");
// entName = result_entertainment[i][name];
// entType = result_entertainment[i][types];
// console.log(result_entertainment[i]);
// console.log(result_entertainment[i]);
// // if(result_entertainment[i][photo]==undefined){
// // entPhoto = "noimage.png";
// // }
// // else{
// // entPhoto = entList[i][photo];
// var tmp = '<div class="col-xl-6 col-sm-6 mb-3">' +
// '<div class="card text-white bg-light o-hidden h-100">' +
// '<div class="card-body"' + ' style="height:350px; background-image:url(' + "'2.jpg'" + '); background-size: 100% 100%; background-repeat: no-repeat;">' + // place photo
// '<div class="mr-5" id="nameDiv">'+entName+'</div>'+ // place name
// '<div class="mr-5" id="typeDiv">'+entType+'</div>'+ // place type
// '</div>' +
// '</div>' +
// '</div>';
// card+=tmp;
// }
document.getElementById("cardBody").innerHTML = card;
</script>
......@@ -203,6 +242,10 @@
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDg4CkUEEt_96n1ork1nL5t4E_SpdKrgMI&libraries=places&callback=initMap"
async defer></script>
<p class="small text-center text-muted my-5">
<em>More chart examples coming soon...</em>
</p>
</div>
<!-- /.container-fluid -->
......
......@@ -23,6 +23,8 @@
<!-- Custom styles for this template-->
<link href="css/sb-admin.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Do+Hyeon&amp;subset=korean" rel="stylesheet">
</head>
<body id="page-top">
......@@ -88,10 +90,6 @@
<script src="js/showFood.js"></script>
</div>
<p class="small text-center text-muted my-5">
<em>More chart examples coming soon...</em>
</p>
</div>
<!-- /.container-fluid -->
......