박민근

Add Player infomations

...@@ -42,8 +42,17 @@ body{ ...@@ -42,8 +42,17 @@ body{
42 42
43 .center2{ 43 .center2{
44 width:100vw; 44 width:100vw;
45 - height:1vh; 45 + height:2vh;
46 display:flex; 46 display:flex;
47 align-items:center; 47 align-items:center;
48 justify-content:space-around; 48 justify-content:space-around;
49 } 49 }
50 +
51 +.champImage{
52 + resize: both;
53 + max_width: 100px;
54 + height: auto;
55 +}
56 +.fontsizeup{
57 + font-size: 15px;
58 +}
......
...@@ -2,7 +2,7 @@ module.exports = function(app){ ...@@ -2,7 +2,7 @@ module.exports = function(app){
2 2
3 var request = require("request"); 3 var request = require("request");
4 var urlenconde = require('urlencode'); 4 var urlenconde = require('urlencode');
5 -var apikey = "RGAPI-a7c53f9b-e980-42b3-af78-a3bc291bec7a"//api 5 +var apikey = "RGAPI-4e323f5e-baf1-416c-bf8b-1375163564b1"//api
6 6
7 var profileIconId; //아이콘 번호 7 var profileIconId; //아이콘 번호
8 var revisionDate; //수정날짜 8 var revisionDate; //수정날짜
...@@ -11,10 +11,6 @@ var accountId; //계정Id ...@@ -11,10 +11,6 @@ var accountId; //계정Id
11 var name; //소환사 이름 11 var name; //소환사 이름
12 var summonerLevel; //소환사 레벨 12 var summonerLevel; //소환사 레벨
13 13
14 -var startIndex;
15 -var endIndex;
16 -var totalGames;
17 -var matches; //경기정보
18 14
19 app.get('/', function(req, res) { 15 app.get('/', function(req, res) {
20 res.render('main', { title: 'R U TROLL?' }); 16 res.render('main', { title: 'R U TROLL?' });
...@@ -62,6 +58,38 @@ var matches; //경기정보 ...@@ -62,6 +58,38 @@ var matches; //경기정보
62 } 58 }
63 } 59 }
64 } 60 }
61 + var userLeagueUrl = "https://kr.api.riotgames.com/lol/league/v3/positions/by-summoner/"+ urlenconde(id)+"?api_key=" + apikey;
62 + request(userLeagueUrl,function(error,response,body){
63 + var info_user_league_json = JSON.parse(body);
64 + if(info_user_league_json[0] != null){
65 + var leagueId = info_user_league_json[0]["leagueId"];
66 + var wins = info_user_league_json[0]["wins"];
67 + var losses = info_user_league_json[0]["losses"];
68 + var leagueName = info_user_league_json[0]["leagueName"]
69 + var tier = info_user_league_json[0]["tier"];
70 + var rank = info_user_league_json[0]["rank"];
71 + var leaguePoints = info_user_league_json[0]["leaguePoints"];
72 + var img_tier;
73 + if(tier == "MASTER"){
74 + img_tier = "https://i.imgur.com/nvQjonh.png";
75 + }else if(tier == "CHALLENGER"){
76 + img_tier = "https://i.imgur.com/sbK1Edj.png";
77 + }else if(tier == "DIAMOND"){
78 + img_tier = "https://i.imgur.com/5VBu8PF.png"
79 + }else if(tier == "PLATINUM"){
80 + img_tier = "https://i.imgur.com/Eqi6858.png"
81 + }else if(tier == "GRANDMASTER"){
82 + img_tier = "https://i.imgur.com/mcEhz1o.png"
83 + }else if(tier == "GOLD"){
84 + img_tier = "https://i.imgur.com/Ec4hPuO.png"
85 + }else if(tier == "SILVER"){
86 + img_tier = "https://i.imgur.com/GKnPu7s.png"
87 + }else if(tier == "BRONZE"){
88 + img_tier ="https://i.imgur.com/TPZVXIr.png"
89 + }else{
90 + img_tier = "https://i.imgur.com/kcdoC4r.png"
91 + }
92 +}
65 champ_name[champ_name.length] = "total"; 93 champ_name[champ_name.length] = "total";
66 var temp_id; 94 var temp_id;
67 var temp_name; 95 var temp_name;
...@@ -90,10 +118,17 @@ var matches; //경기정보 ...@@ -90,10 +118,17 @@ var matches; //경기정보
90 c_name: champ_name, 118 c_name: champ_name,
91 c_point: champ_point, 119 c_point: champ_point,
92 c_pic: champ_pic, 120 c_pic: champ_pic,
93 - c_summoner: summoner 121 + c_summoner: summoner,
122 + c_wins: wins,
123 + c_losses: losses,
124 + c_tier: tier,
125 + c_imgtier: img_tier,
126 + c_rank: rank,
127 + c_leaguePoint: leaguePoints
94 }); 128 });
95 }); 129 });
96 }); 130 });
97 }); 131 });
132 + });
98 }); 133 });
99 }; 134 };
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
14 14
15 $("button#searchButton").click(function(){ 15 $("button#searchButton").click(function(){
16 var name = $("input").val(); 16 var name = $("input").val();
17 - alert(name);
18 location.href = "http://localhost:3000/search/" + name; 17 location.href = "http://localhost:3000/search/" + name;
19 }) 18 })
20 }); 19 });
...@@ -25,22 +24,43 @@ ...@@ -25,22 +24,43 @@
25 <div class="center"> 24 <div class="center">
26 <img src="http://postfiles5.naver.net/MjAxNzA1MTRfMjYz/MDAxNDk0NjkzMzQyMjA1.q2Lr8tHc36PRcyVYhCplqB4J868vV67CQr8l1MSduCkg.sfF_kI6oJZpMdOeKzFucmZXRoQXuSOI4M1IZhMPTp30g.PNG.yoonty21/logo.png?type=w580"> 25 <img src="http://postfiles5.naver.net/MjAxNzA1MTRfMjYz/MDAxNDk0NjkzMzQyMjA1.q2Lr8tHc36PRcyVYhCplqB4J868vV67CQr8l1MSduCkg.sfF_kI6oJZpMdOeKzFucmZXRoQXuSOI4M1IZhMPTp30g.PNG.yoonty21/logo.png?type=w580">
27 </div> 26 </div>
28 - <div class="center2"> 27 + <div class="center">
29 <input type="text" class="input_text" placeholder="소환사 이름"> 28 <input type="text" class="input_text" placeholder="소환사 이름">
30 <span class="input-group-btn"> 29 <span class="input-group-btn">
31 <button id="searchButton" class="btn btn-primary" type="button" onclick="search(name)">검색!</button> 30 <button id="searchButton" class="btn btn-primary" type="button" onclick="search(name)">검색!</button>
32 </span> 31 </span>
33 </div> 32 </div>
34 - <div class="center2"> 33 + <br></br>
35 - <%= c_summoner %> 34 + <font size=10em>
35 + <strong>
36 + <%= c_summoner + "\n"%>
37 + </strong>
38 + </font>
39 + <div class="center">
40 + <img src= <%=c_imgtier%> width=120, height=120>
41 + <span class="center">
42 + <%= "Tier : " + c_tier + " " + c_rank + " / " + c_leaguePoint + "점"%>
43 + </span>
44 + <br class="center">
45 + <%= "Win : " + c_wins + " / Lose : " + c_losses%>
46 + </br>
47 + </div>
48 + <div class="center">
49 + <%= "승률 : " + ((c_wins/(c_wins+c_losses))*100).toFixed(2) + "%" %>
50 + </div>
51 + <br></br>
52 + <div class="center">
53 + <strong>
36 <%= "트롤력" %> 54 <%= "트롤력" %>
37 - <%= "point: " + 1000000/c_point[c_id.length-1] %> 55 + <%= "point: " + (1000000/c_point[c_id.length-1]).toFixed(2) %>
56 + </strong>
38 </div> 57 </div>
39 <% for (var i=0; i<c_id.length-1; i++){ %> 58 <% for (var i=0; i<c_id.length-1; i++){ %>
40 - <div class="center2"> 59 + <div class="champImage">
41 - <img src= <%=c_pic[i]%> > 60 + <div class="center">
61 + <img src= <%=c_pic[i]%> width=50, height=50>
42 <%= c_name[i] %> 62 <%= c_name[i] %>
43 - <%= "point: " + 1000000/c_point[i] %> 63 + <%= "point: " + (1000000/c_point[i]).toFixed(2) %>
44 <% } %> 64 <% } %>
45 </div> 65 </div>
46 </div> 66 </div>
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
14 14
15 $("button#searchButton").click(function(){ 15 $("button#searchButton").click(function(){
16 var name = $("input").val(); 16 var name = $("input").val();
17 - alert(name);
18 location.href = "http://localhost:3000/search/" + name; 17 location.href = "http://localhost:3000/search/" + name;
19 }) 18 })
20 }); 19 });
......