김동근

upload

...@@ -10,119 +10,9 @@ let globalDecks ...@@ -10,119 +10,9 @@ let globalDecks
10 //result.ejs 렌더링 전 수행됨. 현재 덱 ID와 상대 직업을 가지고 상대의 점유율 상위 3개 덱과, 내 덱의 추천 멀리건 출력 10 //result.ejs 렌더링 전 수행됨. 현재 덱 ID와 상대 직업을 가지고 상대의 점유율 상위 3개 덱과, 내 덱의 추천 멀리건 출력
11 //return : 렌더링 된 result.ejs 11 //return : 렌더링 된 result.ejs
12 exports.GetResult=(req,res)=>{ 12 exports.GetResult=(req,res)=>{
13 - const deckId=req.session.deckId 13 + //const deckId=req.session.deckId
14 const opponentClass=req.session.opponentClass 14 const opponentClass=req.session.opponentClass
15 - //덱 ID와 상대 직업 정보 체크 15 +
16 - const DataCheck=()=>{
17 - return new Promise((resolve,reject)=>{
18 - if (!deckId || !opponentClass){
19 - return reject({
20 - code:'query_error',
21 - message:'query error',
22 - })
23 - }
24 - resolve()
25 - })
26 - }
27 - //현재 덱ID를 바탕으로 카드정보 가져오기
28 - const GetCardId=()=>{
29 - return getCardId.GetCardId(deckId)
30 - }
31 - //가져온 카드 정보를 바탕으로, hsreplay.net에서, 덱 검색하기, 검색한 결과의 html을 반환
32 - const GetMulContent=(cardIds)=>{
33 - cardIds=JSON.stringify(cardIds)
34 - cardIds=JSON.parse(cardIds)
35 - //검색을 위한 쿼리스트링
36 - let idInQuery=cardIds[0].cardId
37 - //cardIds.length
38 - for(let i=1;i< cardIds.length;i++){
39 - if(cardIds[i].cardId != '0')
40 - idInQuery+= '%2C'+cardIds[i].cardId
41 - }
42 - //var url = 'https://hsreplay.net/decks/#timeRange=LAST_30_DAYS&includedCards=' + idInQuery
43 -
44 - /*request(url, function(err, res, html){
45 - if(!err){
46 - return cheerio.load(html)
47 - }
48 - })*/
49 - return new Promise((resolve,reject)=>{
50 - const asyncFunc=async ()=>{
51 - const browser=await puppeteer.launch()
52 - try{
53 - const page=await browser.newPage()
54 - await page.setViewport({width:1366,height:768})
55 - //idInQuery = '180%2C48886%2C904%2C461'
56 - console.log(idInQuery)
57 - await page.goto(`https://hsreplay.net/decks/#timeRange=LAST_30_DAYS&includedCards=${idInQuery}`,{waitUntil: 'networkidle2'})
58 - const content=await page.content()
59 - browser.close()
60 - return content
61 - }
62 - catch(err)
63 - {
64 - console.log(err)
65 - browser.close()
66 - }
67 - }
68 - resolve(asyncFunc())
69 - })
70 - }
71 - //검색한 html을 가지고, 검색결과로 부터 덱의 url 파싱
72 - const GetDeckHref=(content)=>{
73 - return new Promise((resolve,reject)=>{
74 - const $=cheerio.load(content)
75 - let deck=$('#decks-container > main > div.deck-list-wrapper > section > ul > li:nth-child(2) > a')
76 - const deckHref=$(deck).attr('href')
77 - console.log(deckHref)
78 - resolve(deckHref)
79 - })
80 - }
81 - //덱의 url을 이용, 해당 덱의 정보를 나타내는 페이지 불러온 후 html로 반환
82 - const GetDeckContent=(href)=>{
83 - return new Promise((resolve,reject)=>{
84 - const asyncFunc=async ()=>{
85 - const browser=await puppeteer.launch()
86 - try{
87 - const page=await browser.newPage()
88 - await page.setViewport({width:1366,height:768})
89 - await page.goto(`https://hsreplay.net${href}?hl=ko`,{waitUntil: 'networkidle2'})
90 - const content=await page.content()
91 - browser.close()
92 - return content
93 - }
94 - catch(err)
95 - {
96 - console.log(err)
97 - browser.close()
98 - }
99 - }
100 - resolve(asyncFunc())
101 - })
102 - }
103 - //받아온 html에서 카드 이름과 멀리건 부분 추출
104 - const GetMulligan=(content)=>{
105 - return new Promise((resolve,reject)=>{
106 - const $=cheerio.load(content)
107 - let cardNames=$('.card-name')
108 - let cardWinRates=$('.table-cell')
109 - let cards=[]
110 - for(let i=0;i<cardNames.length;i++){
111 - let cardName=$(cardNames[i]).text()
112 - let cardWinRate=$(cardWinRates[6*i]).text()
113 - //문자 삭제하고, 멀리건의 승률이 숫자로만 나타나도록
114 - cardWinRate=cardWinRate.replace('▼','')
115 - cardWinRate=cardWinRate.replace('▲','')
116 - cardWinRate=cardWinRate.replace('%','')
117 - cards.push({cardName:cardName,cardWinRate:cardWinRate})
118 - }
119 - //카드를 멀리건 승률 순서대로 정렬
120 - cards.sort((a,b)=>{
121 - return a.cardWinRate<b.cardWinRate ? 1:-1
122 - })
123 - resolve(cards)
124 - })
125 - }
126 //상대 직업을 가지고 hsreplay.net에서 검색, html로 반환 16 //상대 직업을 가지고 hsreplay.net에서 검색, html로 반환
127 const GetOppContent=()=>{ 17 const GetOppContent=()=>{
128 return new Promise((resolve,reject)=>{ 18 return new Promise((resolve,reject)=>{
...@@ -131,7 +21,8 @@ exports.GetResult=(req,res)=>{ ...@@ -131,7 +21,8 @@ exports.GetResult=(req,res)=>{
131 try{ 21 try{
132 const page=await browser.newPage() 22 const page=await browser.newPage()
133 await page.setViewport({width:1366,height:768}) 23 await page.setViewport({width:1366,height:768})
134 - await page.goto(`https://hsreplay.net/decks/#playerClasses=${opponentClass}`,{waitUntil: 'networkidle2'}) 24 + await page.goto('https://hsreplay.net/meta/#tab=archetypes',{waitUntil: 'networkidle2'})
25 + await page.click('#table1-column0')
135 const content=await page.content() 26 const content=await page.content()
136 browser.close() 27 browser.close()
137 return content 28 return content
...@@ -149,38 +40,30 @@ exports.GetResult=(req,res)=>{ ...@@ -149,38 +40,30 @@ exports.GetResult=(req,res)=>{
149 const GetDeckInfo=(content)=>{ 40 const GetDeckInfo=(content)=>{
150 return new Promise((resolve,reject)=>{ 41 return new Promise((resolve,reject)=>{
151 const $=cheerio.load(content) 42 const $=cheerio.load(content)
152 - let deckNames=$('.deck-name') 43 + let index = 0
153 - let deckGames=$('.game-count') 44 + if(opponentClass == "DRUID"){ index = 1 }
45 + else if(opponentClass == "HUNTER"){ index = 2 }
46 + else if(opponentClass == "MAGE"){ index = 3 }
47 + else if(opponentClass == "PALADIN"){ index = 4 }
48 + else if(opponentClass == "PRIEST"){ index = 5 }
49 + else if(opponentClass == "ROGUE"){ index = 6 }
50 + else if(opponentClass == "SHAMAN"){ index = 7 }
51 + else if(opponentClass == "WARLOCK"){ index = 8 }
52 + else if(opponentClass == "WARRIOR"){ index = 9 }
53 + let deckNames=$('#archetypes > div > div:nth-child(' + index + ') > div.box-content > div > div:nth-child(1) > div:nth-child(3) > div > div > a')
54 + let deckRates=$('#archetypes > div > div:nth-child(' + index + ') > div.box-content > div > div:nth-child(1) > div:nth-child(4) > div > div > a')
55 + let len = deckNames.length - 1
154 let decks=[] 56 let decks=[]
155 - for(let i=0;decks.length<3;i++) { 57 + for(let i=0; i < len; i++) {
156 - let deckName = $(deckNames[i]).text() 58 + if(i == 3) break
157 - let deckGame = $(deckGames[i]).text() 59 + let deckName = $($('#table' + index + '-row' + i)[1]).text()
158 - let j=0 60 + let deckRate = $(deckRates[3 * i]).text()
159 - for(;j<decks.length;j++){ 61 + decks.push({deckTitle:deckName,deckWinRate:deckRate})
160 - if(deckName===decks[j].deckTitle)
161 - break
162 - }
163 - if(j===decks.length){
164 - decks.push({deckTitle:deckName,deckGame:deckGame})
165 - }
166 } 62 }
167 resolve(decks) 63 resolve(decks)
168 }) 64 })
169 } 65 }
170 - DataCheck() 66 + GetOppContent()
171 - .then(GetCardId)
172 - //.then(CrawlerMulligan)
173 - .then(GetMulContent)
174 - .then(GetDeckHref)
175 - .then(GetDeckContent)
176 - .then(GetMulligan)
177 - .then((cards)=>{
178 - return new Promise((resolve,reject)=>{
179 - globalMulligan=cards
180 - resolve()
181 - })
182 - })
183 - .then(GetOppContent)
184 .then(GetDeckInfo) 67 .then(GetDeckInfo)
185 .then((decks)=>{ 68 .then((decks)=>{
186 return new Promise((resolve,reject)=>{ 69 return new Promise((resolve,reject)=>{
...@@ -197,7 +80,7 @@ exports.GetResult=(req,res)=>{ ...@@ -197,7 +80,7 @@ exports.GetResult=(req,res)=>{
197 }) 80 })
198 }) 81 })
199 .then((result)=>{ 82 .then((result)=>{
200 - fs.readFile('./views/ejs/result.ejs','utf-8',(err,data)=>{ 83 + fs.readFile('./views/ejs/deck_result.ejs','utf-8',(err,data)=>{
201 res.writeHead(200,{'Content-Type':'text/html'}) 84 res.writeHead(200,{'Content-Type':'text/html'})
202 res.end(ejs.render(data,{ 85 res.end(ejs.render(data,{
203 cards:globalMulligan || [], 86 cards:globalMulligan || [],
......
1 +//const getCardId=require('./getCardId')
2 +const puppeteer=require('puppeteer')
3 +const request = require('request')
4 +const cheerio=require('cheerio')
5 +const fs=require('fs')
6 +const ejs=require('ejs')
7 +let globalMulligan
8 +let globalDecks
9 +
10 +//result.ejs 렌더링 전 수행됨. 현재 덱 ID와 상대 직업을 가지고 상대의 점유율 상위 3개 덱과, 내 덱의 추천 멀리건 출력
11 +//return : 렌더링 된 result.ejs
12 +exports.GetResults=(req,res)=>{
13 + //const opponentClass=req.session.opponentClass
14 + //덱 ID와 상대 직업 정보 체크
15 + const DataCheck=()=>{
16 + return new Promise((resolve,reject)=>{
17 + if (!deckId || !opponentClass){
18 + return reject({
19 + code:'query_error',
20 + message:'query error',
21 + })
22 + }
23 + resolve()
24 + })
25 + }
26 + //현재 덱ID를 바탕으로 카드정보 가져오기
27 + const GetCardId=()=>{
28 + return getCardId.GetCardId(deckId)
29 + }
30 + //가져온 카드 정보를 바탕으로, hsreplay.net에서, 덱 검색하기, 검색한 결과의 html을 반환
31 + const GetMulContent=()=>{
32 + //cardIds=JSON.stringify(cardIds)
33 + //cardIds=JSON.parse(cardIds)
34 +
35 + return new Promise((resolve,reject)=>{
36 + const asyncFunc=async ()=>{
37 + const browser=await puppeteer.launch()
38 + try{
39 + const page=await browser.newPage()
40 + await page.setViewport({width:1366,height:768})
41 + await page.goto(`https://www.heartharena.com/ko/tierlist`,{waitUntil: 'networkidle2'})
42 + let index = 0
43 + if(opponentClass == "DRUID"){ index = 1 }
44 + else if(opponentClass == "HUNTER"){ index = 2 }
45 + else if(opponentClass == "MAGE"){ index = 3 }
46 + else if(opponentClass == "PALADIN"){ index = 4 }
47 + else if(opponentClass == "PRIEST"){ index = 5 }
48 + else if(opponentClass == "ROGUE"){ index = 6 }
49 + else if(opponentClass == "SHAMAN"){ index = 7 }
50 + else if(opponentClass == "WARLOCK"){ index = 8 }
51 + else if(opponentClass == "WARRIOR"){ index = 9 }
52 + if(index != 1)
53 + await page.click('#tier-list > div > section.navs > section.tierlist-selection > nav > ul > li:nth-child(' + index)
54 + const content=await page.content()
55 + browser.close()
56 + return content
57 + }
58 + catch(err)
59 + {
60 + console.log(err)
61 + browser.close()
62 + }
63 + }
64 + resolve(asyncFunc())
65 + })
66 + }
67 + //검색한 html을 가지고, 검색결과로 부터 덱의 url 파싱
68 + const GetDeckHref=(content)=>{
69 + return new Promise((resolve,reject)=>{
70 + const $=cheerio.load(content)
71 + let deck=$('#decks-container > main > div.deck-list-wrapper > section > ul > li:nth-child(2) > a')
72 + const deckHref=$(deck).attr('href')
73 + console.log(deckHref)
74 + resolve(deckHref)
75 + })
76 + }
77 + //덱의 url을 이용, 해당 덱의 정보를 나타내는 페이지 불러온 후 html로 반환
78 + const GetDeckContent=(href)=>{
79 + return new Promise((resolve,reject)=>{
80 + const asyncFunc=async ()=>{
81 + const browser=await puppeteer.launch()
82 + try{
83 + const page=await browser.newPage()
84 + await page.setViewport({width:1366,height:768})
85 + await page.goto(`https://hsreplay.net${href}?hl=ko`,{waitUntil: 'networkidle2'})
86 + const content=await page.content()
87 + browser.close()
88 + return content
89 + }
90 + catch(err)
91 + {
92 + console.log(err)
93 + browser.close()
94 + }
95 + }
96 + resolve(asyncFunc())
97 + })
98 + }
99 + //받아온 html에서 카드 이름과 멀리건 부분 추출
100 + const GetMulligan=(content)=>{
101 + return new Promise((resolve,reject)=>{
102 + const $=cheerio.load(content)
103 + let cardNames=$('.card-name')
104 + let cardWinRates=$('.table-cell')
105 + let cards=[]
106 + for(let i=0;i<cardNames.length;i++){
107 + let cardName=$(cardNames[i]).text()
108 + let cardWinRate=$(cardWinRates[6*i]).text()
109 + //문자 삭제하고, 멀리건의 승률이 숫자로만 나타나도록
110 + cardWinRate=cardWinRate.replace('▼','')
111 + cardWinRate=cardWinRate.replace('▲','')
112 + cardWinRate=cardWinRate.replace('%','')
113 + cards.push({cardName:cardName,cardWinRate:cardWinRate})
114 + }
115 + //카드를 멀리건 승률 순서대로 정렬
116 + cards.sort((a,b)=>{
117 + return a.cardWinRate<b.cardWinRate ? 1:-1
118 + })
119 + resolve(cards)
120 + })
121 + }
122 + //상대 직업을 가지고 hsreplay.net에서 검색, html로 반환
123 + const GetOppContent=()=>{
124 + return new Promise((resolve,reject)=>{
125 + const asyncFunc=async ()=>{
126 + const browser=await puppeteer.launch()
127 + try{
128 + const page=await browser.newPage()
129 + await page.setViewport({width:1366,height:768})
130 + await page.goto(`https://www.heartharena.com/ko/tierlist`,{waitUntil: 'networkidle2'})
131 + let index = 0
132 + if(opponentClass == "DRUID"){ index = 1 }
133 + else if(opponentClass == "HUNTER"){ index = 2 }
134 + else if(opponentClass == "MAGE"){ index = 3 }
135 + else if(opponentClass == "PALADIN"){ index = 4 }
136 + else if(opponentClass == "PRIEST"){ index = 5 }
137 + else if(opponentClass == "ROGUE"){ index = 6 }
138 + else if(opponentClass == "SHAMAN"){ index = 7 }
139 + else if(opponentClass == "WARLOCK"){ index = 8 }
140 + else if(opponentClass == "WARRIOR"){ index = 9 }
141 + if(index != 1)
142 + await page.click('#tier-list > div > section.navs > section.tierlist-selection > nav > ul > li:nth-child(' + index)
143 + const content=await page.content()
144 + browser.close()
145 + return content
146 + }
147 + catch(err)
148 + {
149 + console.log(err)
150 + browser.close()
151 + }
152 + }
153 + resolve(asyncFunc())
154 + })
155 + }
156 + //받아온 html로부터 덱의 이름, 게임 횟수 추출
157 + const GetDeckInfo=(content)=>{
158 + return new Promise((resolve,reject)=>{
159 + const $=cheerio.load(content)
160 + let deckNames=$('.deck-name')
161 + let deckGames=$('.game-count')
162 + let decks=[]
163 + for(let i=0;decks.length<3;i++) {
164 + let deckName = $(deckNames[i]).text()
165 + let deckGame = $(deckGames[i]).text()
166 + let j=0
167 + for(;j<decks.length;j++){
168 + if(deckName===decks[j].deckTitle)
169 + break
170 + }
171 + if(j===decks.length){
172 + decks.push({deckTitle:deckName,deckGame:deckGame})
173 + }
174 + }
175 + resolve(decks)
176 + })
177 + }
178 + //DataCheck()
179 + //.then(GetCardId)
180 + //.then(CrawlerMulligan)
181 + /*GetMulContent()
182 + .then(GetDeckHref)
183 + .then(GetDeckContent)
184 + .then(GetMulligan)
185 + .then((cards)=>{
186 + return new Promise((resolve,reject)=>{
187 + globalMulligan=cards
188 + resolve()
189 + })
190 + })
191 + .then(GetOppContent)*/
192 + GetOppContent()
193 + .then(GetDeckInfo)
194 + .then((decks)=>{
195 + return new Promise((resolve,reject)=>{
196 + globalDecks=decks
197 + resolve()
198 + })
199 + })
200 + .then(()=>{
201 + return new Promise((resolve,reject)=>{
202 + let result={}
203 + result.cards=globalMulligan
204 + result.decks=globalDecks
205 + resolve(result)
206 + })
207 + })
208 + .then((result)=>{
209 + fs.readFile('./views/ejs/score_result.ejs','utf-8',(err,data)=>{
210 + res.writeHead(200,{'Content-Type':'text/html'})
211 + res.end(ejs.render(data,{
212 + cards:globalMulligan || [],
213 + decks:globalDecks || [],
214 + }))
215 + })
216 + })
217 + .catch((err)=>{
218 + console.log(err)
219 + })
220 +}
...\ No newline at end of file ...\ No newline at end of file
1 +const getCardId=require('./getCardId')
2 +const puppeteer=require('puppeteer')
3 +const request = require('request')
4 +const cheerio=require('cheerio')
5 +const mysql=require('mysql')
6 +const fs=require('fs')
7 +const ejs=require('ejs')
8 +let globalMulligan
9 +let globalDecks
10 +
11 +//result.ejs 렌더링 전 수행됨. 현재 덱 ID와 상대 직업을 가지고 상대의 점유율 상위 3개 덱과, 내 덱의 추천 멀리건 출력
12 +//return : 렌더링 된 result.ejs
13 +exports.GetResult=(req,res)=>{
14 + const opponentClass=req.session.opponentClass
15 + try{
16 + fs.readFile('./views/ejs/score_result.ejs','utf-8',(err,data)=>{
17 + res.writeHead(200,{'Content-Type':'text/html'})
18 + res.end(ejs.render(data,{
19 + MineClass:opponentClass || []
20 + }))
21 + })
22 + }finally{
23 +
24 + }
25 +}
...\ No newline at end of file ...\ No newline at end of file
1 +//result 출력 전, 선택한 상대 직업을 세션에 저장
2 +//return: response status code\
3 +exports.SetMineClass=(req,res)=>{
4 + const mineClass=req.body.mineClass
5 + const DataCheck=()=>{
6 + return new Promise((resolve,reject)=>{
7 + if(!mineClass){
8 + reject(({
9 + query:'request_body_error'
10 + }))
11 + }
12 + else resolve()
13 + })
14 + }
15 + const Set=()=>{
16 + req.session.mineClass=req.body.mineClass
17 + return
18 + }
19 + DataCheck()
20 + .then(Set)
21 + .then(()=>{
22 + res.status(200).json({message:'complete setting opponent class'})
23 + })
24 + .catch((err)=>{
25 + res.status(500).json(err||err.message)
26 + })
27 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -61,6 +61,14 @@ app.get('/login',(req,res)=>{ ...@@ -61,6 +61,14 @@ app.get('/login',(req,res)=>{
61 }) 61 })
62 }) 62 })
63 63
64 +app.get('/menulist',(req,res)=>{
65 + fs.readFile('./views/html/menulist.html',(err,data)=>{
66 + res.writeHead(200,{'Content-Type':'text/html'})
67 + res.end(data)
68 + })
69 +})
70 +
71 +
64 app.post('/logout',(req,res)=>{ 72 app.post('/logout',(req,res)=>{
65 delete req.session.deckId 73 delete req.session.deckId
66 delete req.session.sid 74 delete req.session.sid
...@@ -90,12 +98,25 @@ app.get('/decklist',(req,res)=>{ ...@@ -90,12 +98,25 @@ app.get('/decklist',(req,res)=>{
90 98
91 }) 99 })
92 100
93 -app.get('/ingame/:deckId',(req,res)=>{ 101 +app.get('/select_opponent',(req,res)=>{
102 + if(!req.session.sid)
103 + res.redirect('/login')
104 + else{
105 + req.session.deckId=req.params.deckId
106 + fs.readFile('./views/html/select_opponent.html',(err,data)=>{
107 + res.writeHead(200,{'Content-Type':'text/html'})
108 + res.end(data)
109 + })
110 + }
111 +
112 +})
113 +
114 +app.get('/select_mine',(req,res)=>{
94 if(!req.session.sid) 115 if(!req.session.sid)
95 res.redirect('/login') 116 res.redirect('/login')
96 else{ 117 else{
97 req.session.deckId=req.params.deckId 118 req.session.deckId=req.params.deckId
98 - fs.readFile('./views/html/ingame.html',(err,data)=>{ 119 + fs.readFile('./views/html/select_mine.html',(err,data)=>{
99 res.writeHead(200,{'Content-Type':'text/html'}) 120 res.writeHead(200,{'Content-Type':'text/html'})
100 res.end(data) 121 res.end(data)
101 }) 122 })
...@@ -116,7 +137,7 @@ app.get('/newdeck',(req,res)=>{ ...@@ -116,7 +137,7 @@ app.get('/newdeck',(req,res)=>{
116 137
117 const getResult=require('./api/card/getResult') 138 const getResult=require('./api/card/getResult')
118 139
119 -app.get('/result',(req,res)=>{ 140 +app.get('/deck_result',(req,res)=>{
120 if(!req.session.sid) 141 if(!req.session.sid)
121 res.redirect('/login') 142 res.redirect('/login')
122 else{ 143 else{
...@@ -126,6 +147,41 @@ app.get('/result',(req,res)=>{ ...@@ -126,6 +147,41 @@ app.get('/result',(req,res)=>{
126 } 147 }
127 }) 148 })
128 149
150 +const getResultMine1=require('./api/card/getresultmine1')
151 +
152 +app.get('/score_result',(req,res)=>{
153 + if(!req.session.sid)
154 + res.redirect('/login')
155 + else{
156 + (async ()=>{
157 + await getResultMine1.GetResult(req,res)
158 + })()
159 + }
160 +})
161 +
162 +const getResultMine=require('./api/card/getresultmine')
163 +
164 +app.get('/score_result_',(req,res)=>{
165 + if(!req.session.sid)
166 + res.redirect('/login')
167 + else{
168 + (async ()=>{
169 + await getResultMine.GetResults(req,res)
170 + })()
171 + }
172 +})
173 +
174 +app.get('/prob_result/:deckId',(req,res)=>{
175 + if(!req.session.sid)
176 + res.redirect('/login')
177 + else{
178 + fs.readFile('./views/html/prob_result.html',(err,data)=>{
179 + res.writeHead(200,{'Content-Type':'text/html'})
180 + res.end(data)
181 + })
182 + }
183 +})
184 +
129 app.listen(process.env.SERVER_PORT || 3000,()=>{ 185 app.listen(process.env.SERVER_PORT || 3000,()=>{
130 console.log('sample server is listening to port ' + process.env.SERVER_PORT) 186 console.log('sample server is listening to port ' + process.env.SERVER_PORT)
131 }) 187 })
...\ No newline at end of file ...\ No newline at end of file
......
This diff is collapsed. Click to expand it.
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 +<head>
4 + <meta charset="utf-8">
5 + <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 + <meta name="viewport" content="width=device-width, initial-scale=1">
7 + <title>HearthCompare - 하스스톤 도우미</title>
8 +
9 + <!-- 부트스트랩 -->
10 + <link href="../../static/bootstrap-3.3.2-dist/css/bootstrap.min.css?ver=1" rel="stylesheet">
11 + <link href="../../static/main.css" rel="stylesheet">
12 + <!-- IE8 에서 HTML5 요소와 미디어 쿼리를 위한 HTML5 shim 와 Respond.js -->
13 + <!-- WARNING: Respond.js 는 당신이 file:// 을 통해 페이지를 볼 때는 동작하지 않습니다. -->
14 + <!--[if lt IE 9]>
15 + <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
16 + <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
17 + <![endif]-->
18 + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
19 + <script>
20 + $(document).ready(function(){
21 + $('#logoutButton').click(function(){
22 + $.ajax({
23 + type:'POST',
24 + url:'/logout',
25 + success:function(result){
26 + alert('로그아웃에 성공하였습니다.\n로그인 화면으로 이동합니다.')
27 + window.location.href='/'
28 + },
29 + error:function(result){
30 + alert('로그아웃에 실패하였습니다.')
31 + return false
32 + }
33 + })
34 + })
35 + $('#backToSelectMine').click(function(){
36 + window.history.back()
37 + })
38 + })
39 + </script>
40 +</head>
41 +<body>
42 + <nav class="navbar-default navbar-fixed-top">
43 + <div class="container">
44 + <div class="navbar-header">
45 + <button class="navbar-toggle collapsed" aria-expanded="false" aria-controls="navbar" type="button" data-toggle="collapse" data-target="#navbar">
46 + <span class="sr-only">Toggle navigation</span>
47 + <span class="icon-bar"></span>
48 + <span class="icon-bar"></span>
49 + <span class="icon-bar"></span>
50 + </button>
51 + <a class="navbar-brand" href="/menulist">HearthCompare</a>
52 + </div>
53 + <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;">
54 + <ul class="nav navbar-nav">
55 + </ul>
56 + <div class="navbar-right">
57 + <input type="button" class="btn navbar-btn" id="logoutButton" style="color:#000;" value="로그아웃" />
58 + </div>
59 + </div>
60 + </div>
61 + </nav>
62 +
63 + <div class="container show-grid" >
64 + <div class="padding" style="width:100px"></div>
65 + <br>
66 + <br>
67 + <h3 class="form-signin-heading">상대편 직업의 주요 덱</h3>
68 + <div id="opponentDecks">
69 + <table class="table" style="text-align: center;">
70 + <thead>
71 + <td>덱 이름</td>
72 + <td>승률</td>
73 + </thead>
74 + <tbody>
75 + <% for(var i=0;i<decks.length;i++){%>
76 + <tr>
77 + <td><a class="list-group-item"><%= decks[i].deckTitle %></a></td>
78 + <td><a class="list-group-item"><%= decks[i].deckWinRate %></a></td>
79 + </tr>
80 + <%}%>
81 + </tbody>
82 + </table>
83 + </div>
84 + <br><br><br><br><br>
85 + <div class="row">
86 + <div class="col-md-6">
87 + <a href="/menulist"><input class="btn btn-lg btn-primary btn-block" type="button" id="backToMenuList" value="메뉴 선택으로 돌아가기" /></a>
88 + </div>
89 + <div class="col-md-6">
90 + <a href="/select_opponent"><input class="btn btn-lg btn-primary btn-block" type="button" id="backToSelectOpponent" value="상대 직업 선택으로 돌아가기" /></a>
91 + </div>
92 + </div>
93 + </div>
94 +
95 + <!-- jQuery (부트스트랩의 자바스크립트 플러그인을 위해 필요합니다) -->
96 + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
97 + <!-- 모든 컴파일된 플러그인을 포함합니다 (아래), 원하지 않는다면 필요한 각각의 파일을 포함하세요 -->
98 + <script src="../../static/bootstrap-3.3.2-dist/js/bootstrap.min.js"></script>
99 +</body>
100 +</html>
...\ No newline at end of file ...\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1"> 6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 - <title>Who Are You? - 하스스톤 멀리건 도우미</title> 7 + <title>HearthCompare - 하스스톤 도우미</title>
8 8
9 <!-- 부트스트랩 --> 9 <!-- 부트스트랩 -->
10 <link href="../../static/bootstrap-3.3.2-dist/css/bootstrap.min.css?ver=1" rel="stylesheet"> 10 <link href="../../static/bootstrap-3.3.2-dist/css/bootstrap.min.css?ver=1" rel="stylesheet">
...@@ -23,16 +23,23 @@ ...@@ -23,16 +23,23 @@
23 type:'POST', 23 type:'POST',
24 url:'/logout', 24 url:'/logout',
25 success:function(result){ 25 success:function(result){
26 - alert('로그아웃 성공!') 26 + alert('로그아웃에 성공하였습니다.\n로그인 화면으로 이동합니다.')
27 window.location.href='/' 27 window.location.href='/'
28 }, 28 },
29 error:function(result){ 29 error:function(result){
30 - alert('로그아웃 실패!') 30 + alert('로그아웃에 실패하였습니다.')
31 return false 31 return false
32 } 32 }
33 }) 33 })
34 }) 34 })
35 + for ( var i=0;i<decks.length;i++) {
36 + $('#delButton_'+(i+1)).click(function () {
37 + let sql = "select * from deck"
38 +
39 + })
40 + }
35 }) 41 })
42 +
36 </script> 43 </script>
37 </head> 44 </head>
38 <body> 45 <body>
...@@ -45,7 +52,7 @@ ...@@ -45,7 +52,7 @@
45 <span class="icon-bar"></span> 52 <span class="icon-bar"></span>
46 <span class="icon-bar"></span> 53 <span class="icon-bar"></span>
47 </button> 54 </button>
48 - <a class="navbar-brand" href="/main">Who Are You?</a> 55 + <a class="navbar-brand" href="/menulist">HearthCompare</a>
49 </div> 56 </div>
50 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;"> 57 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;">
51 <ul class="nav navbar-nav"> 58 <ul class="nav navbar-nav">
...@@ -62,14 +69,25 @@ ...@@ -62,14 +69,25 @@
62 <div class="container" style="width:50%;"> 69 <div class="container" style="width:50%;">
63 <div class="row"> 70 <div class="row">
64 <h3 class="form-signin-heading col-md-10" style="text-align: left;">내 덱 리스트</h3> 71 <h3 class="form-signin-heading col-md-10" style="text-align: left;">내 덱 리스트</h3>
65 - <a href="/newdeck"><input type="button" class="btn col-md-2" value="+" style="margin-top: 18px;" /></a> 72 + <a href="/newdeck"><input type="button" class="btn col-md-2" value="+" style="margin-left: 345px;" /></a>
66 - </div> 73 + </div>
67 <br> 74 <br>
68 - <table class="table"> 75 + <table class="table" style="width:100%">
69 <% for ( var i=0;i<decks.length;i++) { %> 76 <% for ( var i=0;i<decks.length;i++) { %>
70 - <tr><td style="text-align: center;"><a class="list-group-item" href="/ingame/<%= decks[i].id %>"><%= decks[i].deckTitle %></a></td></tr> 77 + <tr id="rm<%=(i+1)%>">
78 + <td style="text-align: center; width:500px"><a class="list-group-item" href="/prob_result/<%= decks[i].id %>"><%= decks[i].deckTitle %></a></td>
79 + <td><input type="button" class="btn btn-lg btn-info" style="width:100px; height:42px" value=삭제 id ="delButton_<%= (i+1)%> "/></td>
80 + </tr>
71 <% } %> 81 <% } %>
72 </table> 82 </table>
83 +
84 + </div>
85 + <br><br><br><br><br><br><br><br><br><br>
86 + <div class="row">
87 + <div class="col-md-4"></div>
88 + <div class="col-md-4">
89 + <a href="/menulist"><input class="btn btn-lg btn-primary btn-block" type="button" id="backToMenuList" value="메뉴 선택으로 돌아가기" /></a>
90 + </div>
73 </div> 91 </div>
74 </div> 92 </div>
75 93
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1"> 6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 - <title>Who Are You? - 하스스톤 멀리건 도우미</title> 7 + <title>HearthCompare - 하스스톤 도우미</title>
8 8
9 <!-- 부트스트랩 --> 9 <!-- 부트스트랩 -->
10 <link href="../../static/bootstrap-3.3.2-dist/css/bootstrap.min.css?ver=1" rel="stylesheet"> 10 <link href="../../static/bootstrap-3.3.2-dist/css/bootstrap.min.css?ver=1" rel="stylesheet">
...@@ -23,18 +23,15 @@ ...@@ -23,18 +23,15 @@
23 type:'POST', 23 type:'POST',
24 url:'/logout', 24 url:'/logout',
25 success:function(result){ 25 success:function(result){
26 - alert('로그아웃 성공!') 26 + alert('로그아웃에 성공하였습니다.\n로그인 화면으로 이동합니다.')
27 window.location.href='/' 27 window.location.href='/'
28 }, 28 },
29 error:function(result){ 29 error:function(result){
30 - alert('로그아웃 실패!') 30 + alert('로그아웃에 실패하였습니다.')
31 return false 31 return false
32 } 32 }
33 }) 33 })
34 }) 34 })
35 - $('#backToSelectOpponent').click(function(){
36 - window.history.back()
37 - })
38 }) 35 })
39 </script> 36 </script>
40 </head> 37 </head>
...@@ -48,11 +45,10 @@ ...@@ -48,11 +45,10 @@
48 <span class="icon-bar"></span> 45 <span class="icon-bar"></span>
49 <span class="icon-bar"></span> 46 <span class="icon-bar"></span>
50 </button> 47 </button>
51 - <a class="navbar-brand" href="/">Who Are You?</a> 48 + <a class="navbar-brand" href="/menulist">HearthCompare</a>
52 </div> 49 </div>
53 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;"> 50 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;">
54 - <ul class="nav navbar-nav"> 51 + <ul class="nav navbar-nav"></ul>
55 - </ul>
56 <div class="navbar-right"> 52 <div class="navbar-right">
57 <input type="button" class="btn navbar-btn" id="logoutButton" style="color:#000;" value="로그아웃" /> 53 <input type="button" class="btn navbar-btn" id="logoutButton" style="color:#000;" value="로그아웃" />
58 </div> 54 </div>
...@@ -60,57 +56,58 @@ ...@@ -60,57 +56,58 @@
60 </div> 56 </div>
61 </nav> 57 </nav>
62 58
63 - <div class="container show-grid" > 59 + <div class="container show-grid">
64 - <div class="padding" style="width:100px"></div> 60 + <div class="padding-top" style="width:100px"></div>
65 - <br> 61 + <br><br><br><br><br>
66 - <br> 62 + <h3 class="form-signin-heading">내 덱</h3>
67 - <h3 class="form-signin-heading">상대편의 주요 덱</h3>
68 <div id="opponentDecks"> 63 <div id="opponentDecks">
69 <table class="table" style="text-align: center;"> 64 <table class="table" style="text-align: center;">
70 <thead> 65 <thead>
71 - <td>덱 이름</td> 66 + <td>덱 이름</td>
72 - <td>플레이 수</td> 67 + <td>승률</td>
73 </thead> 68 </thead>
74 - <tbody > 69 + <tbody>
75 - <% for(var i=0;i<decks.length;i++){%> 70 + <% for(var i=0;i<decks.length;i++){%>
76 - <tr> 71 + <tr>
77 - <td><a class="list-group-item"><%= decks[i].deckTitle %></a></td> 72 + <td><a class="list-group-item"><%= decks[i].deckTitle %></a></td>
78 - <td><a class="list-group-item"><%= decks[i].deckGame %></a></td> 73 + <td><a class="list-group-item"><%= decks[i].deckWinRate %></a></td>
79 - </tr> 74 + </tr>
80 - <%}%> 75 + <%}%>
81 </tbody> 76 </tbody>
82 </table> 77 </table>
83 </div> 78 </div>
84 <br> 79 <br>
85 <br> 80 <br>
86 - <h3 class="form-signin-heading">내 덱의 추천 멀리건</h3> 81 + <h3 class="form-signin-heading">멀리건 승률</h3>
87 <div id="yourMulligan"> 82 <div id="yourMulligan">
88 - <table class="table" style="text-align: center;"> 83 + <form method="get" action="/save.php">
89 - <thead> 84 + <table class="table" style="text-align: center;">
90 - <td>카드 이름</td> 85 + <thead>
91 - <td>멀리건 승률</td> 86 + <td>카드 이름</td>
92 - </thead> 87 + <td>멀리건 승률</td>
93 - <tbody> 88 + </thead>
94 - <% for(var i=0;i<cards.length;i++){%> 89 + <tbody>
95 - <tr> 90 + <% for(var i=0;i<cards.length;i++){%>
96 - <td><a class="list-group-item"><%= cards[i].cardName %></a></td> 91 + <tr>
97 - <td><a class="list-group-item"><%= cards[i].cardWinRate %></a></td> 92 + <td><input type="text" class="btn-block" name="keyword" style="height:42px; text-align:center;"/></td>
98 - </tr> 93 + <td><a class="list-group-item"><%= cards[i].cardWinRate %></a></td>
99 - <%}%> 94 + </tr>
100 - </tbody> 95 + <%}%>
101 - </table> 96 + </tbody>
102 - </div> 97 + </table>
98 + <button type="submit" class="btn btn-primary btn-block" id="show_prob">멀리건 승률 표출하기</button>
99 + </form>
100 + </div>
103 <br> 101 <br>
104 <br> 102 <br>
105 <div class="row"> 103 <div class="row">
106 <div class="col-md-6"> 104 <div class="col-md-6">
107 - <a href="/decklist"><input class="btn btn-lg btn-primary btn-block" type="button" id="backToDeckList" value="덱 선택으로 돌아가기" /></a> 105 + <a href="/menulist"><input class="btn btn-lg btn-primary btn-block" type="button" id="backToMenuList" value="메뉴 선택으로 돌아가기" /></a>
108 </div> 106 </div>
109 <div class="col-md-6"> 107 <div class="col-md-6">
110 - <input class="btn btn-lg btn-primary btn-block" type="button" id="backToSelectOpponent" value="상대편 직업 선택으로 돌아가기"/> 108 + <a href="/decklist"><input class="btn btn-lg btn-primary btn-block" type="button" id="backToDeckList" value="내 덱 리스트로 돌아가기" /></a>
111 </div> 109 </div>
112 </div> 110 </div>
113 - <div class="padding" style="width:100px"></div>
114 </div> 111 </div>
115 112
116 <!-- jQuery (부트스트랩의 자바스크립트 플러그인을 위해 필요합니다) --> 113 <!-- jQuery (부트스트랩의 자바스크립트 플러그인을 위해 필요합니다) -->
......
1 +<!DOCTYPE html>
2 +<html lang="ko">
3 +<head>
4 + <meta charset="utf-8">
5 + <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 + <meta name="viewport" content="width=device-width, initial-scale=1">
7 + <title>HearthCompare - 하스스톤 도우미</title>
8 +
9 + <!-- 부트스트랩 -->
10 + <link href="../../static/bootstrap-3.3.2-dist/css/bootstrap.min.css?ver=1" rel="stylesheet">
11 + <link href="../../static/main.css" rel="stylesheet">
12 + <!-- IE8 에서 HTML5 요소와 미디어 쿼리를 위한 HTML5 shim 와 Respond.js -->
13 + <!-- WARNING: Respond.js 는 당신이 file:// 을 통해 페이지를 볼 때는 동작하지 않습니다. -->
14 + <!--[if lt IE 9]>
15 + <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
16 + <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
17 + <![endif]-->
18 + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
19 + <script>
20 + $(document).ready(function(){
21 + $('#logoutButton').click(function(){
22 + $.ajax({
23 + type:'POST',
24 + url:'/logout',
25 + success:function(result){
26 + alert('로그아웃에 성공하였습니다.\n로그인 화면으로 이동합니다.')
27 + window.location.href='/'
28 + },
29 + error:function(result){
30 + alert('로그아웃에 실패하였습니다.')
31 + return false
32 + }
33 + })
34 + })
35 + $('#showprob').click(function(){
36 + var obj = new Object()
37 + obj.value1 = $('#btn1').val()
38 + obj.value2 = $('#btn2').val()
39 + obj.value3 = $('#btn3').val()
40 + const stringData = JSON.stringify(obj)
41 + $.ajax({
42 + type:'POST',
43 + url:'/api/card/setopponentclass',
44 + data:stringData,
45 + dataType:'JSON',
46 + contentType:'application/json; charset=utf-8',
47 + traditional:true,
48 + processdata:false,
49 + success:function(result){
50 + alert('검색 성공')
51 + window.location.href='/score_result_'
52 + },
53 + error:function(request,status,error){
54 + alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
55 + }
56 + })
57 + })
58 + })
59 + </script>
60 +</head>
61 +<body>
62 + <nav class="navbar-default navbar-fixed-top">
63 + <div class="container">
64 + <div class="navbar-header">
65 + <button class="navbar-toggle collapsed" aria-expanded="false" aria-controls="navbar" type="button" data-toggle="collapse" data-target="#navbar">
66 + <span class="sr-only">Toggle navigation</span>
67 + <span class="icon-bar"></span>
68 + <span class="icon-bar"></span>
69 + <span class="icon-bar"></span>
70 + </button>
71 + <a class="navbar-brand" href="/menulist">HearthCompare</a>
72 + </div>
73 + <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;">
74 + <ul class="nav navbar-nav"></ul>
75 + <div class="navbar-right">
76 + <input type="button" class="btn navbar-btn" id="logoutButton" style="color:#000;" value="로그아웃" />
77 + </div>
78 + </div>
79 + </div>
80 + </nav>
81 +
82 + <div class="container show-grid">
83 + <div class="padding-top" style="width:100px"></div>
84 + <br><br><br><br><br>
85 + <h3 class="form-signin-heading">내 직업</h3>
86 + <div id="opponentDecks">
87 + <table class="table" style="text-align: center;">
88 + <thead>
89 + <td>직업</td>
90 + </thead>
91 + <tbody>
92 + <tr>
93 + <td><a class="list-group-item"><%= MineClass %></a></td>
94 + </tr>
95 + </tbody>
96 + </table>
97 + </div>
98 + <br>
99 + <br>
100 + <h3 class="form-signin-heading">투기장 카드 점수</h3>
101 + <div id="yourMulligan">
102 + <table class="table" style="text-align: center;">
103 + <thead>
104 + <td>카드 이름</td>
105 + <td>카드 점수</td>
106 + </thead>
107 + <tbody>
108 + <tr>
109 + <td><input type="text" class="btn-block" id="btn1" name="keyword" style="height:42px; text-align:center;" /></td>
110 + <td><a class="list-group-item">카드</a></td>
111 + </tr>
112 + <tr>
113 + <td><input type="text" class="btn-block" id="btn2" name="keyword" style="height:42px; text-align:center;" /></td>
114 + <td><a class="list-group-item">이름</a></td>
115 + </tr>
116 + <tr>
117 + <td><input type="text" class="btn-block" id="btn3" name="keyword" style="height:42px; text-align:center;" /></td>
118 + <td><a class="list-group-item">입력!!</a></td>
119 + </tr>
120 + </tbody>
121 + </table>
122 + <button type="button" class="btn btn-primary btn-block" id="showprob">카드 점수 표출하기</button>
123 + </div>
124 + <br>
125 + <br>
126 + <div class="row">
127 + <div class="col-md-6">
128 + <a href="/menulist"><input class="btn btn-lg btn-primary btn-block" type="button" id="backToMenuList" value="메뉴 선택으로 돌아가기" /></a>
129 + </div>
130 + <div class="col-md-6">
131 + <a href="/select_mine"><input class="btn btn-lg btn-primary btn-block" type="button" id="backToMine" value="내 직업 선택으로 돌아가기" /></a>
132 + </div>
133 + </div>
134 + </div>
135 +
136 + <!-- jQuery (부트스트랩의 자바스크립트 플러그인을 위해 필요합니다) -->
137 + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
138 + <!-- 모든 컴파일된 플러그인을 포함합니다 (아래), 원하지 않는다면 필요한 각각의 파일을 포함하세요 -->
139 + <script src="../../static/bootstrap-3.3.2-dist/js/bootstrap.min.js"></script>
140 +</body>
141 +</html>
...\ No newline at end of file ...\ No newline at end of file
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
48 <span class="icon-bar"></span> 48 <span class="icon-bar"></span>
49 <span class="icon-bar"></span> 49 <span class="icon-bar"></span>
50 </button> 50 </button>
51 - <a class="navbar-brand" href="/">HearthCompare</a> 51 + <a class="navbar-brand" href="/menulist">HearthCompare</a>
52 </div> 52 </div>
53 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;"> 53 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;">
54 <ul class="nav navbar-nav"> 54 <ul class="nav navbar-nav">
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
45 <span class="icon-bar"></span> 45 <span class="icon-bar"></span>
46 <span class="icon-bar"></span> 46 <span class="icon-bar"></span>
47 </button> 47 </button>
48 - <a class="navbar-brand" href="/main">HearthCompare</a> 48 + <a class="navbar-brand" href="/menulist">HearthCompare</a>
49 </div> 49 </div>
50 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;"> 50 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;">
51 <ul class="nav navbar-nav"> 51 <ul class="nav navbar-nav">
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
45 <span class="icon-bar"></span> 45 <span class="icon-bar"></span>
46 <span class="icon-bar"></span> 46 <span class="icon-bar"></span>
47 </button> 47 </button>
48 - <a class="navbar-brand" href="/main">HearthCompare</a> 48 + <a class="navbar-brand" href="/menulist">HearthCompare</a>
49 </div> 49 </div>
50 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;"> 50 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;">
51 <ul class="nav navbar-nav"></ul> 51 <ul class="nav navbar-nav"></ul>
......
...@@ -50,10 +50,12 @@ ...@@ -50,10 +50,12 @@
50 alert('덱 추가를 성공하였습니다.\n내 덱 리스트 화면으로 이동합니다.') 50 alert('덱 추가를 성공하였습니다.\n내 덱 리스트 화면으로 이동합니다.')
51 window.location.href='/decklist' 51 window.location.href='/decklist'
52 }, 52 },
53 - error:function(result){ 53 + error:function(request,status,error){
54 - alert(`덱 추가를 실패하였습니다.\nmessage:${result['message']}`) 54 + alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);}
55 - return false 55 + //error:function(result){
56 - } 56 + // alert(`덱 추가를 실패하였습니다.\nmessage:${result['message']}`)
57 + // return false
58 + //}
57 }) 59 })
58 }) 60 })
59 }) 61 })
...@@ -69,7 +71,7 @@ ...@@ -69,7 +71,7 @@
69 <span class="icon-bar"></span> 71 <span class="icon-bar"></span>
70 <span class="icon-bar"></span> 72 <span class="icon-bar"></span>
71 </button> 73 </button>
72 - <a class="navbar-brand" href="/">HearthCompare</a> 74 + <a class="navbar-brand" href="/menulist">HearthCompare</a>
73 </div> 75 </div>
74 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;"> 76 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;">
75 <ul class="nav navbar-nav"> 77 <ul class="nav navbar-nav">
...@@ -81,7 +83,7 @@ ...@@ -81,7 +83,7 @@
81 </div> 83 </div>
82 </nav> 84 </nav>
83 85
84 - <div class="container show-grid" > 86 + <div class="container show-grid">
85 <div class="padding" style="width:100px"></div> 87 <div class="padding" style="width:100px"></div>
86 <div class="container" style="width:50%;"> 88 <div class="container" style="width:50%;">
87 <h3 class="form-signin-heading">덱 추가</h3> 89 <h3 class="form-signin-heading">덱 추가</h3>
...@@ -93,6 +95,16 @@ ...@@ -93,6 +95,16 @@
93 </form> 95 </form>
94 <input type="button" class="btn btn-primary btn-block" id="newDeckButton" value="확인" /> 96 <input type="button" class="btn btn-primary btn-block" id="newDeckButton" value="확인" />
95 </div> 97 </div>
98 + <br>
99 + <br>
100 + <div class="row">
101 + <div class="col-md-6">
102 + <a href="/menulist"><input class="btn btn-lg btn-primary btn-block" type="button" id="backToMenuList" value="메뉴 선택으로 돌아가기" /></a>
103 + </div>
104 + <div class="col-md-6">
105 + <a href="/decklist"><input class="btn btn-lg btn-primary btn-block" type="button" id="backToDeckList" value="내 덱 리스트로 돌아가기" /></a>
106 + </div>
107 + </div>
96 </div> 108 </div>
97 109
98 <!-- jQuery (부트스트랩의 자바스크립트 플러그인을 위해 필요합니다) --> 110 <!-- jQuery (부트스트랩의 자바스크립트 플러그인을 위해 필요합니다) -->
......
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
32 } 32 }
33 }) 33 })
34 }) 34 })
35 + $('#show_prob').click(function(){
36 +
37 + })
35 }) 38 })
36 </script> 39 </script>
37 </head> 40 </head>
...@@ -78,31 +81,35 @@ ...@@ -78,31 +81,35 @@
78 <br> 81 <br>
79 <h3 class="form-signin-heading">멀리건 승률</h3> 82 <h3 class="form-signin-heading">멀리건 승률</h3>
80 <div id="yourMulligan"> 83 <div id="yourMulligan">
81 - <table class="table" style="text-align: center;"> 84 + <form method="get" action="/save.php">
82 - <thead> 85 + <!-- method - 통신 방식의 메소드를 결정하며 get/post에서 선택함
83 - <td>카드 이름</td> 86 + action - 값을 전달할 서버 페이지 위치 -->
84 - <td>멀리건 승률</td> 87 + <table class="table" style="text-align: center;">
85 - </thead> 88 + <thead>
86 - <tbody> 89 + <td>카드 이름</td>
87 - <tr> 90 + <td>멀리건 승률</td>
88 - <td><a class="list-group-item">카드 이름</a></td> 91 + </thead>
89 - <td><a class="list-group-item">60</a></td> 92 + <tbody>
90 - </tr> 93 + <tr>
91 - <tr> 94 + <td><input type="text" class="btn-block" name="keyword" style="height:42px; text-align:center;"/></td>
92 - <td><a class="list-group-item">카드 이름</a></td> 95 + <td><a class="list-group-item">60</a></td>
93 - <td><a class="list-group-item">59</a></td> 96 + </tr>
94 - </tr> 97 + <tr>
95 - <tr> 98 + <td><input type="text" class="btn-block" name="keyword" style="height:42px; text-align:center;" /></td>
96 - <td><a class="list-group-item">카드 이름</a></td> 99 + <td><a class="list-group-item">59</a></td>
97 - <td><a class="list-group-item">58</a></td> 100 + </tr>
98 - </tr> 101 + <tr>
99 - <tr> 102 + <td><input type="text" class="btn-block" name="keyword" style="height:42px; text-align:center;" /></td>
100 - <td><a class="list-group-item">카드 이름</a></td> 103 + <td><a class="list-group-item">58</a></td>
101 - <td><a class="list-group-item">57</a></td> 104 + </tr>
102 - </tr> 105 + <tr>
103 - </tbody> 106 + <td><input type="text" class="btn-block" name="keyword" style="height:42px; text-align:center;" /></td>
104 - </table> 107 + <td><a class="list-group-item">57</a></td>
105 - <input type="button" class="btn btn-primary btn-block" id="newDeckButton" value="멀리건 승률 표출하기" /> 108 + </tr>
109 + </tbody>
110 + </table>
111 + <button type="submit" class="btn btn-primary btn-block" id="show_prob">멀리건 승률 표출하기</button>
112 + </form>
106 </div> 113 </div>
107 <br> 114 <br>
108 <br> 115 <br>
......
...@@ -32,6 +32,30 @@ ...@@ -32,6 +32,30 @@
32 } 32 }
33 }) 33 })
34 }) 34 })
35 + $('#show_prob').click(function(){
36 + var Data = new Object()
37 + Data.value1 = $('#btn1').val()
38 + Data.value2 = $('#btn2').val()
39 + Data.value3 = $('#btn3').val()
40 + const stringData = JSON.stringify(Data)
41 + alert('검색중입니다!')
42 + $.ajax({
43 + typ:'GET',
44 + url:'/api/card/getResultMine',
45 + data:stringData,
46 + dataType:'JSON',
47 + contentType:'application/json; charset=utf-8',
48 + traditional:true,
49 + processdata:false,
50 + success:function(result){
51 + alert('검색 성공!')
52 + },
53 + error:function(result){
54 + alert('검색 실패!')
55 + return false
56 + }
57 + })
58 + })
35 }) 59 })
36 </script> 60 </script>
37 </head> 61 </head>
...@@ -45,7 +69,7 @@ ...@@ -45,7 +69,7 @@
45 <span class="icon-bar"></span> 69 <span class="icon-bar"></span>
46 <span class="icon-bar"></span> 70 <span class="icon-bar"></span>
47 </button> 71 </button>
48 - <a class="navbar-brand" href="/">HearthCompare</a> 72 + <a class="navbar-brand" href="/menulist">HearthCompare</a>
49 </div> 73 </div>
50 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;"> 74 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;">
51 <ul class="nav navbar-nav"></ul> 75 <ul class="nav navbar-nav"></ul>
...@@ -67,7 +91,7 @@ ...@@ -67,7 +91,7 @@
67 </thead> 91 </thead>
68 <tbody> 92 <tbody>
69 <tr> 93 <tr>
70 - <td><a class="list-group-item">드루이드</a></td> 94 + <td><a class="list-group-item"></a></td>
71 </tr> 95 </tr>
72 </tbody> 96 </tbody>
73 </table> 97 </table>
...@@ -76,28 +100,31 @@ ...@@ -76,28 +100,31 @@
76 <br> 100 <br>
77 <h3 class="form-signin-heading">투기장 카드 점수</h3> 101 <h3 class="form-signin-heading">투기장 카드 점수</h3>
78 <div id="yourMulligan"> 102 <div id="yourMulligan">
79 - <table class="table" style="text-align: center;"> 103 + <form method="get" action="/save.php">
80 - <thead> 104 + <!-- method - 통신 방식의 메소드를 결정하며 get/post에서 선택함
81 - <td>카드 이름</td> 105 + action - 값을 전달할 서버 페이지 위치 -->
82 - <td>카드 점수</td> 106 + <table class="table" style="text-align: center;">
83 - </thead> 107 + <thead>
84 - <tbody> 108 + <td>카드 이름</td>
85 - <tr> 109 + <td>카드 점수</td>
86 - <td><a class="list-group-item">카드 이름</a></td> 110 + </thead>
87 - <td><a class="list-group-item">60</a></td> 111 + <tbody>
88 - </tr> 112 + <tr>
89 - <tr> 113 + <td><input type="text" class="btn-block" id="btn1" name="keyword" style="height:42px; text-align:center;" /></td>
90 - <td><a class="list-group-item">카드 이름</a></td> 114 + <td><a class="list-group-item">0</a></td>
91 - <td><a class="list-group-item">59</a></td> 115 + </tr>
92 - </tr> 116 + <tr>
93 - <tr> 117 + <td><input type="text" class="btn-block" id="btn2" name="keyword" style="height:42px; text-align:center;" /></td>
94 - <td><a class="list-group-item">카드 이름</a></td> 118 + <td><a class="list-group-item">0</a></td>
95 - <td><a class="list-group-item">58</a></td> 119 + </tr>
96 - </tr> 120 + <tr>
97 - 121 + <td><input type="text" class="btn-block" id="btn3" name="keyword" style="height:42px; text-align:center;" /></td>
98 - </tbody> 122 + <td><a class="list-group-item">0</a></td>
99 - </table> 123 + </tr>
100 - <input type="button" class="btn btn-primary btn-block" id="newDeckButton" value="카드 점수 표출하기" /> 124 + </tbody>
125 + </table>
126 + <button type="submit" class="btn btn-primary btn-block" id="show_prob">카드 점수 표출하기</button>
127 + </form>
101 </div> 128 </div>
102 <br> 129 <br>
103 <br> 130 <br>
......
...@@ -37,17 +37,16 @@ ...@@ -37,17 +37,16 @@
37 let opponentClass=$('input[name="checkOpponent"]:checked').val() 37 let opponentClass=$('input[name="checkOpponent"]:checked').val()
38 data.opponentClass=opponentClass 38 data.opponentClass=opponentClass
39 const stringData = JSON.stringify(data) 39 const stringData = JSON.stringify(data)
40 - alert('')
41 $.ajax({ 40 $.ajax({
42 type:'POST', 41 type:'POST',
43 - url:'/api/card/setopponentclass', 42 + url:'/api/card/setOpponentClass',
44 data:stringData, 43 data:stringData,
45 dataType:'JSON', 44 dataType:'JSON',
46 contentType:'application/json; charset=utf-8', 45 contentType:'application/json; charset=utf-8',
47 traditional:true, 46 traditional:true,
48 processdata:false, 47 processdata:false,
49 success:function(){ 48 success:function(){
50 - window.location.href='/deck_result' 49 + window.location.href='/score_result'
51 }, 50 },
52 error:function(){ 51 error:function(){
53 alert('내 직업 선택에 실패했습니다.') 52 alert('내 직업 선택에 실패했습니다.')
...@@ -68,7 +67,7 @@ ...@@ -68,7 +67,7 @@
68 <span class="icon-bar"></span> 67 <span class="icon-bar"></span>
69 <span class="icon-bar"></span> 68 <span class="icon-bar"></span>
70 </button> 69 </button>
71 - <a class="navbar-brand" href="/">HearthCompare</a> 70 + <a class="navbar-brand" href="/menulist">HearthCompare</a>
72 </div> 71 </div>
73 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;"> 72 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;">
74 <ul class="nav navbar-nav"> 73 <ul class="nav navbar-nav">
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
68 <span class="icon-bar"></span> 68 <span class="icon-bar"></span>
69 <span class="icon-bar"></span> 69 <span class="icon-bar"></span>
70 </button> 70 </button>
71 - <a class="navbar-brand" href="/">HearthCompare</a> 71 + <a class="navbar-brand" href="/menulist">HearthCompare</a>
72 </div> 72 </div>
73 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;"> 73 <div class="navbar-collapse collapse" id="navbar" aria-expanded="false" style="height: 1px;">
74 <ul class="nav navbar-nav"></ul> 74 <ul class="nav navbar-nav"></ul>
......