Commit 354655dc authored by GaiaXalter's avatar GaiaXalter 💬

决斗数据库 1.均胜率算法调整 2.下载安卓端链接更换 3.卡片排行导航栏修改 4.滚动条修改

parent 76ec88ce
...@@ -35,11 +35,11 @@ background-color: #1D252F; ...@@ -35,11 +35,11 @@ background-color: #1D252F;
height: 72px; height: 72px;
width: 120px; width: 120px;
} }
.table-responsive { /* .table-responsive {
border: 0px solid transparent!important; border: 0px solid transparent!important;
overflow: hidden!important; overflow: hidden!important;
} } */
.search-form div.input-group-addon { .search-form div.input-group-addon {
background: #1D252F; background: #1D252F;
...@@ -238,4 +238,27 @@ background-color: #1a4861; ...@@ -238,4 +238,27 @@ background-color: #1a4861;
margin: 10px 0; margin: 10px 0;
overflow: hidden; overflow: hidden;
background-color: #e5e5e5; background-color: #e5e5e5;
} }
\ No newline at end of file
::-webkit-scrollbar {
height: 10px;
}
::-webkit-scrollbar-track {
background-color: #283044;
}
::-webkit-scrollbar-thumb {
background-color: #161b22;
}
::-webkit-scrollbar-button{
color:white;
background-color: #161b22;
}
...@@ -67,22 +67,22 @@ ...@@ -67,22 +67,22 @@
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li :class="{ active: isActive }" v-if="isActive"> <li :class="{ active: isActive }" v-if="isActive">
<a href="#tab-0" role="tab" data-toggle="tab"><img class="tab-img" :src="img0"></a> <a href="#tab-0" role="tab" data-toggle="tab" @click='navClick("Deck")'><img class="tab-img" :src="img0" ></a>
</li> </li>
<li :class="{ active: !isActive }"> <li :class="{ active: !isActive }">
<a href="#tab-1" role="tab" data-toggle="tab"><img class="tab-img" :src="img1"></a> <a href="#tab-1" role="tab" data-toggle="tab" @click='navClick("Monster")'><img class="tab-img" :src="img1"></a>
</li> </li>
<li> <li>
<a href="#tab-2" role="tab" data-toggle="tab"><img class="tab-img" :src="img2"></a> <a href="#tab-2" role="tab" data-toggle="tab" @click='navClick("Spell")'><img class="tab-img" :src="img2"></a>
</li> </li>
<li> <li>
<a href="#tab-3" role="tab" data-toggle="tab"><img class="tab-img" :src="img3"></a> <a href="#tab-3" role="tab" data-toggle="tab" @click='navClick("Trap")' ><img class="tab-img" :src="img3"></a>
</li> </li>
<li> <li>
<a href="#tab-4" role="tab" data-toggle="tab"><img class="tab-img" :src="img4"></a> <a href="#tab-4" role="tab" data-toggle="tab" @click='navClick("Side")'><img class="tab-img" :src="img4"></a>
</li> </li>
<li> <li>
<a href="#tab-5" role="tab" data-toggle="tab"><img class="tab-img" :src="img5"></a> <a href="#tab-5" role="tab" data-toggle="tab" @click='navClick("Extra")'><img class="tab-img" :src="img5"></a>
</li> </li>
</ul> </ul>
...@@ -179,6 +179,14 @@ ...@@ -179,6 +179,14 @@
var exTable; var exTable;
var sideTable; var sideTable;
var deckTable; var deckTable;
const placeholder={
Deck:'请输入卡组名..',
Monster:'请输入怪兽卡名..',
Spell:'请输入魔法卡名..',
Trap:'请输入陷阱卡名..',
Side:'请输入卡片名..',
Extra:'请输入卡片名..',
}
export default { export default {
components: { components: {
Footads Footads
...@@ -202,6 +210,7 @@ ...@@ -202,6 +210,7 @@
}, },
data() { data() {
return { return {
isActive: true, isActive: true,
totalDeck: 0, totalDeck: 0,
width: "100%", width: "100%",
...@@ -225,6 +234,13 @@ ...@@ -225,6 +234,13 @@
}, },
}, },
methods: { methods: {
navClick(data){
console.log('%c ---------------------src'+'\\'+'components'+'\\'+'Cards.vue---------------------%c:238','background:#f034c6','background:#14f1a4',
data)
$(".input-sm").attr("placeholder",placeholder[data])
},
init: function(lang) { init: function(lang) {
if (lang === "cn") { if (lang === "cn") {
this.isActive = true; this.isActive = true;
...@@ -389,7 +405,8 @@ ...@@ -389,7 +405,8 @@
}, ], }, ],
"language": tb_language[lang] "language": tb_language[lang]
}); });
return table; $(".input-sm").attr("placeholder",placeholder.Deck)
return table;
} }
renderPage(); renderPage();
$("#search").click(function() { $("#search").click(function() {
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
self.downloadUrls['windows'] = "https://mycard.moe" self.downloadUrls['windows'] = "https://mycard.moe"
self.downloadUrls['mac'] = "https://mycard.moe" self.downloadUrls['mac'] = "https://mycard.moe"
// self.downloadUrls['android'] = "https://pan.baidu.com/s/1eRWiWRC" // self.downloadUrls['android'] = "https://pan.baidu.com/s/1eRWiWRC"
self.downloadUrls['android'] = "http://www.pgyer.com/page/ygomobile" self.downloadUrls['android'] = "https://www.pgyer.com/ygomobilecn"
// API.getDownloadUrls().then((res) => { // API.getDownloadUrls().then((res) => {
// let assets = res.data.assets // let assets = res.data.assets
// for (let i of assets) { // for (let i of assets) {
......
...@@ -8,10 +8,12 @@ ...@@ -8,10 +8,12 @@
<label class="control-label" for="searchText" v-if="hasError">{{lang.battle.notfound}}</label> <label class="control-label" for="searchText" v-if="hasError">{{lang.battle.notfound}}</label>
<div class="input-group"> <div class="input-group">
<div class="input-group-addon"><span><i class="glyphicon glyphicon-search"></i></span></div> <div class="input-group-addon"><span><i class="glyphicon glyphicon-search"></i></span></div>
<input class="form-control" type="text" id="searchText" v-model="searchText" :placeholder="lang.battle.ph2"> <input class="form-control" type="text" id="searchText" v-model="searchText"
:placeholder="lang.battle.ph2">
<div class="input-group-btn"> <div class="input-group-btn">
<button class="btn btn-default" type="submit">{{lang.battle.search}}</button> <button class="btn btn-default" type="submit">{{lang.battle.search}}</button>
<button class="btn btn-default" style="display:none" type="submit" id="search">{{lang.battle.search}}</button> <button class="btn btn-default" style="display:none" type="submit"
id="search">{{lang.battle.search}}</button>
</div> </div>
</div> </div>
</div> </div>
...@@ -56,90 +58,76 @@ ...@@ -56,90 +58,76 @@
import Footads from './Footads' import Footads from './Footads'
import tb_language from './tb_lang.js' import tb_language from './tb_lang.js'
import API from '../api'; import API from '../api';
import { mapGetters } from 'vuex' import {
mapGetters
} from 'vuex'
const placeholder='请输入用户名..'
var expTable, ptTable var expTable, ptTable
export default { export default {
components: { components: {
Footads Footads
}, },
created: function() {
created: function () { var regex_match =
/(nokia|iphone|android|motorola|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-|longcos|pantech|gionee|^sie-|portalmmm|jigs browser|hiptop|^benq|haier|^lct|operas*mobi|opera*mini|320x320|240x320|176x220)/i;
var regex_match = /(nokia|iphone|android|motorola|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-|longcos|pantech|gionee|^sie-|portalmmm|jigs browser|hiptop|^benq|haier|^lct|operas*mobi|opera*mini|320x320|240x320|176x220)/i;
var u = navigator.userAgent; var u = navigator.userAgent;
if (null == u) { if (null == u) {
return true; return true;
} }
var result = regex_match.exec(u); var result = regex_match.exec(u);
if (null == result) { if (null == result) {} else {
} else {
this.width = "250%" this.width = "250%"
} }
var lang = localStorage.getItem('lang') || 'cn'; var lang = localStorage.getItem('lang') || 'cn';
this.init(lang) this.init(lang)
API.getLabel({}).then((res) => { API.getLabel({}).then((res) => {
this.labelone = res.data.text; this.labelone = res.data.text;
}, (res) => { }, (res) => {})
})
}, },
data() { data() {
return { return {
placeholder,
width: "100%", width: "100%",
searchText: "", searchText: "",
hasError: false, hasError: false,
username: "", username: "",
labelone:"", labelone: "",
} }
}, },
watch: { watch: {
lang: function (val) { lang: function(val) {
console.log('lang change1', val) console.log('lang change1', val)
this.init2() this.init2()
}, },
}, },
mounted: function() {
mounted: function () {
this.init2(); this.init2();
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
lang: 'getLang', lang: 'getLang',
}), }),
}, },
methods: { methods: {
init: function (lang) { init: function(lang) {},
onSubmit: function() {
},
onSubmit: function () {
var url = `#/userinfo?username=${encodeURIComponent(this.searchText)}` var url = `#/userinfo?username=${encodeURIComponent(this.searchText)}`
window.location.href = url window.location.href = url
}, },
init2: function () { init2: function() {
function renderPage() { function renderPage() {
if (ptTable) { if (ptTable) {
ptTable.destroy(); ptTable.destroy();
} }
if (expTable) { if (expTable) {
expTable.destroy(); expTable.destroy();
} }
expTable = renderExpTable(); expTable = renderExpTable();
ptTable = renderArenaTable(); ptTable = renderArenaTable();
API.getUsers({
API.getUsers({ o: 'pt' }).then((res) => { o: 'pt'
}).then((res) => {
if (ptTable) { if (ptTable) {
ptTable.destroy(); ptTable.destroy();
} }
...@@ -147,8 +135,9 @@ ...@@ -147,8 +135,9 @@
}, (res) => { }, (res) => {
console.log(res) console.log(res)
}); });
API.getUsers({
API.getUsers({ o: 'exp' }).then((res) => { o: 'exp'
}).then((res) => {
if (expTable) { if (expTable) {
expTable.destroy(); expTable.destroy();
} }
...@@ -156,49 +145,58 @@ ...@@ -156,49 +145,58 @@
}, (res) => { }, (res) => {
console.log(res) console.log(res)
}); });
$('#exp_table').onPostBody = function() {
$('.search .search-input').attr('placeholder', '请输入要查找的名称');
}
} }
function renderExpTable(tableData) { function renderExpTable(tableData) {
tableData = tableData || []; tableData = tableData || [];
var lang = localStorage.getItem('lang') || 'cn'; var lang = localStorage.getItem('lang') || 'cn';
var rank = 1; var rank = 1;
var processData = tableData.map(function (d) { var processData = tableData.map(function(d) {
return [rank++, d.username, parseInt(d.exp), d.entertain_win, d.entertain_lose]; return [rank++, d.username, parseInt(d.exp), d.entertain_win, d.entertain_lose];
}); });
var table = $('#exp_table').DataTable({ var table = $('#exp_table').DataTable({
data: processData, data: processData,
pageLength: 25, pageLength: 25,
order: [[0, "asc"]], order: [
"ordering": true, [0, "asc"]
columns: [
{ title: tb_language[lang].rank },
{ title: tb_language[lang].name },
{ title: tb_language[lang].exp },
{ title: tb_language[lang].win },
{ title: tb_language[lang].lose },
], ],
"columnDefs": [ "ordering": true,
columns: [{
title: tb_language[lang].rank
},
{
title: tb_language[lang].name
},
{
title: tb_language[lang].exp
},
{
title: tb_language[lang].win
},
{ {
"render": function (data, type, row) { title: tb_language[lang].lose
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'>" + data + "</a>";
},
"targets": 1
}, },
], ],
"columnDefs": [{
"render": function(data, type, row) {
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'>" + data + "</a>";
},
"targets": 1
}, ],
"language": lang === 'en' ? tb_language.en : tb_language.cn "language": lang === 'en' ? tb_language.en : tb_language.cn
}); });
$(".input-sm").attr("placeholder",placeholder)
return table; return table;
} }
function renderArenaTable(tableData) { function renderArenaTable(tableData) {
tableData = tableData || []; tableData = tableData || [];
var lang = localStorage.getItem('lang') || 'cn'; var lang = localStorage.getItem('lang') || 'cn';
var rank = 1; var rank = 1;
var processData = tableData.map(function (d) { var processData = tableData.map(function(d) {
let ratio = 0 let ratio = 0
if (d.athletic_all > 0) { if (d.athletic_all > 0) {
ratio = (d.athletic_win / d.athletic_all * 100).toFixed(2) ratio = (d.athletic_win / d.athletic_all * 100).toFixed(2)
...@@ -208,56 +206,67 @@ ...@@ -208,56 +206,67 @@
var table = $('#pt_table').DataTable({ var table = $('#pt_table').DataTable({
data: processData, data: processData,
pageLength: 25, pageLength: 25,
order: [[0, "asc"]], order: [
"ordering": true, [0, "asc"]
columns: [
{ title: tb_language[lang].rank },
{ title: tb_language[lang].name },
{ title: tb_language[lang].pt },
{ title: tb_language[lang].win },
{ title: tb_language[lang].lose },
{ title: tb_language[lang].wl },
], ],
"columnDefs": [ "ordering": true,
columns: [{
title: tb_language[lang].rank
},
{
title: tb_language[lang].name
},
{
title: tb_language[lang].pt
},
{ {
"render": function (data, type, row) { title: tb_language[lang].win
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'>" + data + "</a>"; },
}, {
"targets": 1 title: tb_language[lang].lose
},
{
title: tb_language[lang].wl
}, },
], ],
"columnDefs": [{
"render": function(data, type, row) {
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'>" + data + "</a>";
},
"targets": 1
}, ],
"language": tb_language[lang] "language": tb_language[lang]
}); });
$(".input-sm").attr("placeholder",placeholder)
return table; return table;
} }
renderPage(); renderPage();
$("#search").click(function() {
$("#search").click(function () {
renderPage(); renderPage();
return false; return false;
}) })
} }
}, },
events: { events: {
'lang-change': function (lang) { 'lang-change': function(lang) {
this.init(lang) this.init(lang)
$("#search").trigger('click') $("#search").trigger('click')
} }
}, },
} }
</script> </script>
<style scoped> <style scoped>
.fck { .fck {
margin-bottom: 20px; margin-bottom: 20px;
margin-top: -30px; margin-top: -30px;
} }
.scroll { .scroll {
width: 250%; width: 250%;
} }
......
...@@ -277,9 +277,10 @@ ...@@ -277,9 +277,10 @@
let tempFirstStrikeWinRate = Math.round(firstStrikeJson.win / (totalFsMatch) * 1000) / let tempFirstStrikeWinRate = Math.round(firstStrikeJson.win / (totalFsMatch) * 1000) /
10 10
let tempSecondStrikeWinRate = Math.round(secondStrikeJson.lose / (totalScMatch) * 1000) / let tempSecondStrikeWinRate = Math.round(secondStrikeJson.lose / (totalScMatch) * 1000) /
10 10 //该卡组对手先攻输-该卡组后攻赢
let totalWinrate = Math.round((tempFirstStrikeWinRate + tempSecondStrikeWinRate) * 100) / let totalWinrate = Math.round((firstStrikeJson.win + secondStrikeJson.lose )/ (totalFsMatch+totalScMatch)* 10000) /
(2 * 100) ( 100)
//(勇者先攻赢+勇者后攻赢)/(勇者先攻赢+勇者先攻平+勇者先攻输+勇者后攻赢+勇者后攻输+勇者后攻平)
tempWinRate.push(tempFirstStrikeWinRate) tempWinRate.push(tempFirstStrikeWinRate)
tempWinRate.push(tempSecondStrikeWinRate) tempWinRate.push(tempSecondStrikeWinRate)
tempWinRate.push(totalWinrate) tempWinRate.push(totalWinrate)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment