박민근

Add Player infomations

......@@ -42,8 +42,17 @@ body{
.center2{
width:100vw;
height:1vh;
height:2vh;
display:flex;
align-items:center;
justify-content:space-around;
}
.champImage{
resize: both;
max_width: 100px;
height: auto;
}
.fontsizeup{
font-size: 15px;
}
......
......@@ -2,7 +2,7 @@ module.exports = function(app){
var request = require("request");
var urlenconde = require('urlencode');
var apikey = "RGAPI-a7c53f9b-e980-42b3-af78-a3bc291bec7a"//api
var apikey = "RGAPI-4e323f5e-baf1-416c-bf8b-1375163564b1"//api
var profileIconId; //아이콘 번호
var revisionDate; //수정날짜
......@@ -11,10 +11,6 @@ var accountId; //계정Id
var name; //소환사 이름
var summonerLevel; //소환사 레벨
var startIndex;
var endIndex;
var totalGames;
var matches; //경기정보
app.get('/', function(req, res) {
res.render('main', { title: 'R U TROLL?' });
......@@ -62,6 +58,38 @@ var matches; //경기정보
}
}
}
var userLeagueUrl = "https://kr.api.riotgames.com/lol/league/v3/positions/by-summoner/"+ urlenconde(id)+"?api_key=" + apikey;
request(userLeagueUrl,function(error,response,body){
var info_user_league_json = JSON.parse(body);
if(info_user_league_json[0] != null){
var leagueId = info_user_league_json[0]["leagueId"];
var wins = info_user_league_json[0]["wins"];
var losses = info_user_league_json[0]["losses"];
var leagueName = info_user_league_json[0]["leagueName"]
var tier = info_user_league_json[0]["tier"];
var rank = info_user_league_json[0]["rank"];
var leaguePoints = info_user_league_json[0]["leaguePoints"];
var img_tier;
if(tier == "MASTER"){
img_tier = "https://i.imgur.com/nvQjonh.png";
}else if(tier == "CHALLENGER"){
img_tier = "https://i.imgur.com/sbK1Edj.png";
}else if(tier == "DIAMOND"){
img_tier = "https://i.imgur.com/5VBu8PF.png"
}else if(tier == "PLATINUM"){
img_tier = "https://i.imgur.com/Eqi6858.png"
}else if(tier == "GRANDMASTER"){
img_tier = "https://i.imgur.com/mcEhz1o.png"
}else if(tier == "GOLD"){
img_tier = "https://i.imgur.com/Ec4hPuO.png"
}else if(tier == "SILVER"){
img_tier = "https://i.imgur.com/GKnPu7s.png"
}else if(tier == "BRONZE"){
img_tier ="https://i.imgur.com/TPZVXIr.png"
}else{
img_tier = "https://i.imgur.com/kcdoC4r.png"
}
}
champ_name[champ_name.length] = "total";
var temp_id;
var temp_name;
......@@ -90,10 +118,17 @@ var matches; //경기정보
c_name: champ_name,
c_point: champ_point,
c_pic: champ_pic,
c_summoner: summoner
c_summoner: summoner,
c_wins: wins,
c_losses: losses,
c_tier: tier,
c_imgtier: img_tier,
c_rank: rank,
c_leaguePoint: leaguePoints
});
});
});
});
});
});
};
......
......@@ -14,7 +14,6 @@
$("button#searchButton").click(function(){
var name = $("input").val();
alert(name);
location.href = "http://localhost:3000/search/" + name;
})
});
......@@ -25,22 +24,43 @@
<div class="center">
<img src="http://postfiles5.naver.net/MjAxNzA1MTRfMjYz/MDAxNDk0NjkzMzQyMjA1.q2Lr8tHc36PRcyVYhCplqB4J868vV67CQr8l1MSduCkg.sfF_kI6oJZpMdOeKzFucmZXRoQXuSOI4M1IZhMPTp30g.PNG.yoonty21/logo.png?type=w580">
</div>
<div class="center2">
<div class="center">
<input type="text" class="input_text" placeholder="소환사 이름">
<span class="input-group-btn">
<button id="searchButton" class="btn btn-primary" type="button" onclick="search(name)">검색!</button>
</span>
</div>
<div class="center2">
<%= c_summoner %>
<br></br>
<font size=10em>
<strong>
<%= c_summoner + "\n"%>
</strong>
</font>
<div class="center">
<img src= <%=c_imgtier%> width=120, height=120>
<span class="center">
<%= "Tier : " + c_tier + " " + c_rank + " / " + c_leaguePoint + "점"%>
</span>
<br class="center">
<%= "Win : " + c_wins + " / Lose : " + c_losses%>
</br>
</div>
<div class="center">
<%= "승률 : " + ((c_wins/(c_wins+c_losses))*100).toFixed(2) + "%" %>
</div>
<br></br>
<div class="center">
<strong>
<%= "트롤력" %>
<%= "point: " + 1000000/c_point[c_id.length-1] %>
<%= "point: " + (1000000/c_point[c_id.length-1]).toFixed(2) %>
</strong>
</div>
<% for (var i=0; i<c_id.length-1; i++){ %>
<div class="center2">
<img src= <%=c_pic[i]%> >
<div class="champImage">
<div class="center">
<img src= <%=c_pic[i]%> width=50, height=50>
<%= c_name[i] %>
<%= "point: " + 1000000/c_point[i] %>
<%= "point: " + (1000000/c_point[i]).toFixed(2) %>
<% } %>
</div>
</div>
......
......@@ -14,7 +14,6 @@
$("button#searchButton").click(function(){
var name = $("input").val();
alert(name);
location.href = "http://localhost:3000/search/" + name;
})
});
......