Commit 354655dc authored by GaiaXalter's avatar GaiaXalter 💬

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

parent 76ec88ce
......@@ -35,11 +35,11 @@ background-color: #1D252F;
height: 72px;
width: 120px;
}
.table-responsive {
/* .table-responsive {
border: 0px solid transparent!important;
overflow: hidden!important;
}
} */
.search-form div.input-group-addon {
background: #1D252F;
......@@ -238,4 +238,27 @@ background-color: #1a4861;
margin: 10px 0;
overflow: hidden;
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 @@
<ul class="nav nav-tabs">
<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 :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>
<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>
<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>
<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>
<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>
</ul>
......@@ -179,6 +179,14 @@
var exTable;
var sideTable;
var deckTable;
const placeholder={
Deck:'请输入卡组名..',
Monster:'请输入怪兽卡名..',
Spell:'请输入魔法卡名..',
Trap:'请输入陷阱卡名..',
Side:'请输入卡片名..',
Extra:'请输入卡片名..',
}
export default {
components: {
Footads
......@@ -202,6 +210,7 @@
},
data() {
return {
isActive: true,
totalDeck: 0,
width: "100%",
......@@ -225,6 +234,13 @@
},
},
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) {
if (lang === "cn") {
this.isActive = true;
......@@ -389,7 +405,8 @@
}, ],
"language": tb_language[lang]
});
return table;
$(".input-sm").attr("placeholder",placeholder.Deck)
return table;
}
renderPage();
$("#search").click(function() {
......
......@@ -60,7 +60,7 @@
self.downloadUrls['windows'] = "https://mycard.moe"
self.downloadUrls['mac'] = "https://mycard.moe"
// 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) => {
// let assets = res.data.assets
// for (let i of assets) {
......
......@@ -8,10 +8,12 @@
<label class="control-label" for="searchText" v-if="hasError">{{lang.battle.notfound}}</label>
<div class="input-group">
<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">
<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>
......@@ -56,90 +58,76 @@
import Footads from './Footads'
import tb_language from './tb_lang.js'
import API from '../api';
import { mapGetters } from 'vuex'
import {
mapGetters
} from 'vuex'
const placeholder='请输入用户名..'
var expTable, ptTable
export default {
components: {
Footads
},
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;
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 u = navigator.userAgent;
if (null == u) {
return true;
}
var result = regex_match.exec(u);
if (null == result) {
} else {
if (null == result) {} else {
this.width = "250%"
}
var lang = localStorage.getItem('lang') || 'cn';
this.init(lang)
API.getLabel({}).then((res) => {
this.labelone = res.data.text;
}, (res) => {
})
}, (res) => {})
},
data() {
return {
placeholder,
width: "100%",
searchText: "",
hasError: false,
username: "",
labelone:"",
labelone: "",
}
},
watch: {
lang: function (val) {
lang: function(val) {
console.log('lang change1', val)
this.init2()
},
},
mounted: function () {
mounted: function() {
this.init2();
},
computed: {
...mapGetters({
lang: 'getLang',
}),
},
methods: {
init: function (lang) {
},
onSubmit: function () {
init: function(lang) {},
onSubmit: function() {
var url = `#/userinfo?username=${encodeURIComponent(this.searchText)}`
window.location.href = url
},
init2: function () {
init2: function() {
function renderPage() {
if (ptTable) {
ptTable.destroy();
}
if (expTable) {
expTable.destroy();
}
expTable = renderExpTable();
ptTable = renderArenaTable();
API.getUsers({ o: 'pt' }).then((res) => {
API.getUsers({
o: 'pt'
}).then((res) => {
if (ptTable) {
ptTable.destroy();
}
......@@ -147,8 +135,9 @@
}, (res) => {
console.log(res)
});
API.getUsers({ o: 'exp' }).then((res) => {
API.getUsers({
o: 'exp'
}).then((res) => {
if (expTable) {
expTable.destroy();
}
......@@ -156,49 +145,58 @@
}, (res) => {
console.log(res)
});
$('#exp_table').onPostBody = function() {
$('.search .search-input').attr('placeholder', '请输入要查找的名称');
}
}
function renderExpTable(tableData) {
tableData = tableData || [];
var lang = localStorage.getItem('lang') || 'cn';
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];
});
var table = $('#exp_table').DataTable({
data: processData,
pageLength: 25,
order: [[0, "asc"]],
"ordering": true,
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 },
order: [
[0, "asc"]
],
"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) {
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'>" + data + "</a>";
},
"targets": 1
title: tb_language[lang].lose
},
],
"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
});
$(".input-sm").attr("placeholder",placeholder)
return table;
}
function renderArenaTable(tableData) {
tableData = tableData || [];
var lang = localStorage.getItem('lang') || 'cn';
var rank = 1;
var processData = tableData.map(function (d) {
var processData = tableData.map(function(d) {
let ratio = 0
if (d.athletic_all > 0) {
ratio = (d.athletic_win / d.athletic_all * 100).toFixed(2)
......@@ -208,56 +206,67 @@
var table = $('#pt_table').DataTable({
data: processData,
pageLength: 25,
order: [[0, "asc"]],
"ordering": true,
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 },
order: [
[0, "asc"]
],
"columnDefs": [
"ordering": true,
columns: [{
title: tb_language[lang].rank
},
{
title: tb_language[lang].name
},
{
title: tb_language[lang].pt
},
{
"render": function (data, type, row) {
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'>" + data + "</a>";
},
"targets": 1
title: tb_language[lang].win
},
{
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]
});
$(".input-sm").attr("placeholder",placeholder)
return table;
}
renderPage();
$("#search").click(function () {
$("#search").click(function() {
renderPage();
return false;
})
}
},
events: {
'lang-change': function (lang) {
'lang-change': function(lang) {
this.init(lang)
$("#search").trigger('click')
}
},
}
</script>
<style scoped>
.fck {
margin-bottom: 20px;
margin-top: -30px;
}
.scroll {
width: 250%;
}
......
......@@ -277,9 +277,10 @@
let tempFirstStrikeWinRate = Math.round(firstStrikeJson.win / (totalFsMatch) * 1000) /
10
let tempSecondStrikeWinRate = Math.round(secondStrikeJson.lose / (totalScMatch) * 1000) /
10
let totalWinrate = Math.round((tempFirstStrikeWinRate + tempSecondStrikeWinRate) * 100) /
(2 * 100)
10 //该卡组对手先攻输-该卡组后攻赢
let totalWinrate = Math.round((firstStrikeJson.win + secondStrikeJson.lose )/ (totalFsMatch+totalScMatch)* 10000) /
( 100)
//(勇者先攻赢+勇者后攻赢)/(勇者先攻赢+勇者先攻平+勇者先攻输+勇者后攻赢+勇者后攻输+勇者后攻平)
tempWinRate.push(tempFirstStrikeWinRate)
tempWinRate.push(tempSecondStrikeWinRate)
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