김명주

Update kart recommend page

Showing 104 changed files with 256 additions and 8 deletions
...@@ -48,15 +48,32 @@ app.get("/inf/result",(req,res)=>{ ...@@ -48,15 +48,32 @@ app.get("/inf/result",(req,res)=>{
48 48
49 app.post("/game/result",(req,res)=>{ 49 app.post("/game/result",(req,res)=>{
50 vec=req.body.test; 50 vec=req.body.test;
51 + var item=["empty", "추억", "empty", "신중함","안정적","empty","열정","책임감","아이템","스피드","믿음직","호기심","헌신적","자유로움"];
52 + keyword=[];
53 + for(var i=1; i<vec.length; i++){
54 + if(i%2!=0){
55 + if(vec[i]=="1"){
56 + keyword.push(item[i-1]);
57 + }
58 + else{
59 + keyword.push(item[i]);
60 + }
61 + }
62 + }
51 }) 63 })
52 64
53 app.get("/game/result",(req,res)=>{ 65 app.get("/game/result",(req,res)=>{
66 + var temp="";
67 + for(var i=0; i<vec.length; i++){
68 + if(i!=2 && i!=3 && i!=4 && i!=5 && i!=10 && i!=11)
69 + temp+=vec[i];
70 + }
54 var fs=require('fs'); 71 var fs=require('fs');
55 - var url="kart_special"+vec+"/"; 72 + var url="kart_find"+temp+"/";
56 - var testFolder="metadata/kart_special"+vec; 73 + var testFolder="metadata/kart_find"+temp;
57 fs.readdir(testFolder, function(error, list){ 74 fs.readdir(testFolder, function(error, list){
58 var rand=Math.floor(Math.random()*list.length); 75 var rand=Math.floor(Math.random()*list.length);
59 - res.render('game_result',{url:url,body:list[rand]}); 76 + res.render('game_result',{url:url,body:list[rand],keyword:keyword});
60 }); 77 });
61 }); 78 });
62 79
......
1 +#total
2 +{
3 + position:absolute;
4 + background-image:url("result/background.png");
5 + top:50%;
6 + left:50%;
7 + width:1300px;
8 + height:650px;
9 + margin:-325px 0px 0px -650px;
10 +}
11 +#words
12 +{
13 + position:absolute;
14 + top:42%;
15 + left:16%;
16 + width:400px;
17 + height:350px;
18 + margin:-75px 0px 0px 0px;
19 +}
20 +#imgkey
21 +{
22 + position:relative;
23 + left:15%;
24 +}
25 +#rkart
26 +{
27 + position:absolute;
28 + background-image: url("result/kart.png");
29 + width:350px;
30 + height:350px;
31 + top:30%;
32 + left:60%;
33 +}
34 +#imgId
35 +{
36 + position:relative;
37 + top:20%;
38 + left:15%;
39 + width:70%;
40 + height:60%;
41 +
42 +}
43 +#word1
44 +{
45 + position:relative;
46 + font-family: 'Nanum Gothic';
47 + font-size:large;
48 + font-weight: bold;
49 + top:10%;
50 + width:160px;
51 + height:40px;
52 + border-radius: 30px;
53 + border:0;
54 + background: rgb(192, 234, 250);
55 + box-shadow: 3px 3px 3px rgb(209, 207, 207);
56 +}
57 +#word2
58 +{
59 + position:relative;
60 + font-family: 'Nanum Gothic';
61 + font-size:large;
62 + font-weight: bold;
63 + top:19%;
64 + left:15%;
65 + width:160px;
66 + height:40px;
67 + border-radius: 30px;
68 + border:0;
69 + background: rgb(192, 234, 250);
70 + box-shadow: 3px 3px 3px rgb(209, 207, 207);
71 +}
72 +#word3
73 +{
74 + position:relative;
75 + font-family: 'Nanum Gothic';
76 + font-size:large;
77 + font-weight: bold;
78 + top:19%;
79 + width:160px;
80 + height:40px;
81 + border-radius: 30px;
82 + border:0;
83 + background: rgb(192, 234, 250);
84 + box-shadow: 3px 3px 3px rgb(209, 207, 207);
85 +}
86 +#word4
87 +{
88 + position:relative;
89 + font-family: 'Nanum Gothic';
90 + font-size:large;
91 + font-weight: bold;
92 + top:28%;
93 + left:15%;
94 + width:160px;
95 + height:40px;
96 + border-radius: 30px;
97 + border:0;
98 + background: rgb(192, 234, 250);
99 + box-shadow: 3px 3px 3px rgb(209, 207, 207);
100 +}
101 +#word5
102 +{
103 + position:relative;
104 + font-family: 'Nanum Gothic';
105 + font-size:large;
106 + font-weight: bold;
107 + top:28%;
108 + width:160px;
109 + height:40px;
110 + border-radius: 30px;
111 + border:0;
112 + background: rgb(192, 234, 250);
113 + box-shadow: 3px 3px 3px rgb(209, 207, 207);
114 +}
115 +#word6
116 +{
117 + position:relative;
118 + font-family: 'Nanum Gothic';
119 + font-size:large;
120 + font-weight: bold;
121 + top:35%;
122 + left:15%;
123 + width:160px;
124 + height:40px;
125 + border-radius: 30px;
126 + border:0;
127 + background: rgb(192, 234, 250);
128 + box-shadow: 3px 3px 3px rgb(209, 207, 207);
129 +}
130 +#word7
131 +{
132 + position:relative;
133 + font-family: 'Nanum Gothic';
134 + font-size:large;
135 + font-weight: bold;
136 + top:38%;
137 + width:160px;
138 + height:40px;
139 + border-radius: 30px;
140 + border:0;
141 + background: rgb(192, 234, 250);
142 + box-shadow: 3px 3px 3px rgb(209, 207, 207);
143 +}
144 +#text1
145 +{
146 + position:relative;
147 + left:15%;
148 + font-family: 'Nanum Gothic';
149 + font-size:50px;
150 + font-weight: bold;
151 +}
152 +#text2
153 +{
154 + position:relative;
155 + left:15%;
156 + font-family: 'Nanum Gothic';
157 + font-size:70px;
158 + font-weight: bold;
159 + color:rgb(0, 153, 255);
160 +}
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.
1 -212라인 안함
2 -1라인 안함
...\ No newline at end of file ...\ No newline at end of file
1 +#uni
2 +{
3 + position:absolute;
4 + top:60%;
5 + left:80%;
6 +}
7 +#dao
8 +{
9 + position:absolute;
10 + top:55%;
11 +}
12 +
1 div 13 div
2 { 14 {
3 width: 500px; 15 width: 500px;
...@@ -60,3 +72,10 @@ div ...@@ -60,3 +72,10 @@ div
60 border-radius: 50%; 72 border-radius: 50%;
61 animation: spin 1s linear infinite; 73 animation: spin 1s linear infinite;
62 } 74 }
75 +
76 +#index
77 +{
78 + position:absolute;
79 + left:55%;
80 +
81 +}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -35,7 +35,10 @@ ...@@ -35,7 +35,10 @@
35 </head> 35 </head>
36 36
37 <body> 37 <body>
38 + <img id="dao" src="image/bdao.png"></img>
39 + <img id="uni" src="image/buni.png"></img>
38 <div class="box" id="div1"> 40 <div class="box" id="div1">
41 + <img id="index" src="image/one.png"></img>
39 <text id="tex1">Q1.</text><br> 42 <text id="tex1">Q1.</text><br>
40 <text id="tex2">대표 카트를 지정할 때</text> 43 <text id="tex2">대표 카트를 지정할 때</text>
41 <button id="btn" onClick="any(1,1)">가장 좋은 신규 카트로 전시한다.</button> 44 <button id="btn" onClick="any(1,1)">가장 좋은 신규 카트로 전시한다.</button>
...@@ -43,6 +46,7 @@ ...@@ -43,6 +46,7 @@
43 </div> 46 </div>
44 47
45 <div class="box" id="div2" style="display:none"> 48 <div class="box" id="div2" style="display:none">
49 + <img id="index" src="image/two.png"></img>
46 <text id="tex1">Q2.</text><br> 50 <text id="tex1">Q2.</text><br>
47 <text id="tex2">3....2.....1 GAME START</text> 51 <text id="tex2">3....2.....1 GAME START</text>
48 <button id="btn" onClick="any(2,1)">부스터를 사용하여 치고나간다.</button> 52 <button id="btn" onClick="any(2,1)">부스터를 사용하여 치고나간다.</button>
...@@ -50,6 +54,7 @@ ...@@ -50,6 +54,7 @@
50 </div> 54 </div>
51 55
52 <div class="box" id="div3" style="display:none"> 56 <div class="box" id="div3" style="display:none">
57 + <img id="index" src="image/three.png"></img>
53 <text id="tex1">Q3.</text><br> 58 <text id="tex1">Q3.</text><br>
54 <text id="tex2">스피드 전에서 중요하게 생각하는 것</text> 59 <text id="tex2">스피드 전에서 중요하게 생각하는 것</text>
55 <button id="btn" onClick="any(3,1)">부스터 갯수</button> 60 <button id="btn" onClick="any(3,1)">부스터 갯수</button>
...@@ -57,6 +62,7 @@ ...@@ -57,6 +62,7 @@
57 </div> 62 </div>
58 63
59 <div class="box" id="div4" style="display:none"> 64 <div class="box" id="div4" style="display:none">
65 + <img id="index" src="image/four.png"></img>
60 <text id="tex1">Q4.</text><br> 66 <text id="tex1">Q4.</text><br>
61 <text id="tex2">팀전을 하는 경우</text> 67 <text id="tex2">팀전을 하는 경우</text>
62 <button id="btn" onClick="any(4,1)">1등이 우선! 혼자 치고 나가기</button> 68 <button id="btn" onClick="any(4,1)">1등이 우선! 혼자 치고 나가기</button>
...@@ -64,6 +70,7 @@ ...@@ -64,6 +70,7 @@
64 </div> 70 </div>
65 71
66 <div class="box" id="div5" style="display:none"> 72 <div class="box" id="div5" style="display:none">
73 + <img id="index" src="image/five.png"></img>
67 <text id="tex1">Q5.</text><br> 74 <text id="tex1">Q5.</text><br>
68 <text id="tex2">현재 1등을 잡기위해</text> 75 <text id="tex2">현재 1등을 잡기위해</text>
69 <button id="btn" onClick="any(5,1)">아이템을 사용하여 격추한다.</button> 76 <button id="btn" onClick="any(5,1)">아이템을 사용하여 격추한다.</button>
...@@ -71,6 +78,7 @@ ...@@ -71,6 +78,7 @@
71 </div> 78 </div>
72 79
73 <div class="box" id="div6" style="display:none"> 80 <div class="box" id="div6" style="display:none">
81 + <img id="index" src="image/six.png"></img>
74 <text id="tex1">Q6.</text><br> 82 <text id="tex1">Q6.</text><br>
75 <text id="tex2">나는 카트를 볼 때</text> 83 <text id="tex2">나는 카트를 볼 때</text>
76 <button id="btn" onClick="any(6,1)">성능이 우선이다.</button> 84 <button id="btn" onClick="any(6,1)">성능이 우선이다.</button>
...@@ -78,11 +86,11 @@ ...@@ -78,11 +86,11 @@
78 </div> 86 </div>
79 87
80 <div class="box" id="div7" style="display:none"> 88 <div class="box" id="div7" style="display:none">
89 + <img id="index" src="image/seven.png"></img>
81 <text id="tex1">Q7.</text><br> 90 <text id="tex1">Q7.</text><br>
82 <text id="tex2">넥슨 캐쉬가 생겼다.</text> 91 <text id="tex2">넥슨 캐쉬가 생겼다.</text>
83 <button id="btn" onClick="any2(1); location.href='game/result'">유료 카트를 구매한다.</button> 92 <button id="btn" onClick="any2(1); location.href='game/result'">유료 카트를 구매한다.</button>
84 <button id="btn" onClick="any2(2); location.href='game/result'">다른 게임(피파, 메이플)에 투자</button> 93 <button id="btn" onClick="any2(2); location.href='game/result'">다른 게임(피파, 메이플)에 투자</button>
85 </div> 94 </div>
86 -
87 </body> 95 </body>
88 </html> 96 </html>
...\ No newline at end of file ...\ No newline at end of file
......
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 +<link rel="stylesheet" type="text/css" href="game_result.css" />
5 +</head>
4 <script> 6 <script>
5 var item='<%- body %>'; 7 var item='<%- body %>';
6 var url='<%- url %>'; 8 var url='<%- url %>';
9 + var stritem=item.split(".");
10 + function load() {
11 + return fetch("kart.json")
12 + .then((response) => response.json())
13 + .then((json) => json.kart);
14 + }
15 + load().then((kart) => {
16 + const div_target = document.querySelector("#total");
17 + var obj = document.createElement('text');
18 + var obj2=document.createElement('text');
19 + for (var i = 0; i < kart.length; i++) {
20 + if (kart[i]['id'] == stritem[0]) {
21 + obj.id="text1";
22 + obj2.id="text2";
23 + obj.innerText = "나에게 맞는 카트는 ";
24 + obj2.innerText=kart[i]['name'];
25 + break;
26 + }
27 + }
28 + div_target.append(obj);
29 + div_target.append(obj2);
30 + });
31 +
7 function Img() { 32 function Img() {
8 return url+item; 33 return url+item;
9 } 34 }
10 </script> 35 </script>
11 -</head>
12 <body> 36 <body>
37 + <div id="total">
38 + <div id="words">
39 + <img id="imgkey" src="result/keyword.png">
40 + </div>
41 + <div id="rkart">
13 <img id="imgId" src=""> 42 <img id="imgId" src="">
14 <script>document.getElementById("imgId").src = Img()</script> 43 <script>document.getElementById("imgId").src = Img()</script>
15 - 44 + </div>
45 + </div>
16 </body> 46 </body>
47 +<script>
48 + var keyword="<%- keyword %>";
49 + var keyarr=keyword.split(',');
50 + const div_target=document.querySelector("#words");
51 + var i=0, index=0;
52 + while(index<7){
53 + if(keyarr[index]!="empty"){
54 + var obj=document.createElement('button');
55 + obj.id="word"+(i+1);
56 + obj.innerText='#'+keyarr[index];
57 + div_target.append(obj);
58 + i++;
59 + }
60 + index++;
61 + }
62 +</script>
17 </html> 63 </html>
...\ No newline at end of file ...\ No newline at end of file
......
This diff is collapsed. Click to expand it.