Commit acf55d6b authored by GaiaXalter's avatar GaiaXalter 💬

fix:同步生产版本且修复单卡链接

parent cab5ce83
Pipeline #24358 failed with stages
in 6 seconds
...@@ -49,7 +49,7 @@ export default class Api { ...@@ -49,7 +49,7 @@ export default class Api {
} }
static getUserDueHistory(opt) { static getUserDueHistory(opt) {
return Vue.http.get(`${URL}/history`, { 'params': opt }); return Vue.http.get(`${URL}/history`, {'params': opt});
} }
static getDownloadUrls() { static getDownloadUrls() {
...@@ -67,72 +67,72 @@ export default class Api { ...@@ -67,72 +67,72 @@ export default class Api {
} }
static getDeckInfo(opt) { static getDeckInfo(opt) {
return Vue.http.get(`${URL}/deckinfo`, { 'params': opt }); return Vue.http.get(`${URL}/deckinfo`, {'params': opt});
} }
static saveDeck(opt) { static saveDeck(opt) {
const url = `${URL}/deckinfo` const url = `${URL}/deckinfo`
return Vue.http.post(url, opt, { 'emulateJSON': true }); return Vue.http.post(url, opt, {'emulateJSON': true});
} }
static saveDeckDemo(opt) { static saveDeckDemo(opt) {
const url = `${URL}/deckdemo` const url = `${URL}/deckdemo`
return Vue.http.post(url, opt, { 'emulateJSON': true }); return Vue.http.post(url, opt, {'emulateJSON': true});
} }
static getReport(opt) { static getReport(opt) {
return Vue.http.get(`${URL}/report`, { 'params': opt }); return Vue.http.get(`${URL}/report`, {'params': opt});
} }
static getVoteList(opt) { static getVoteList(opt) {
return Vue.http.get(`${URL}/votes`, { 'params': opt }); return Vue.http.get(`${URL}/votes`, {'params': opt});
} }
static saveVote(opt) { static saveVote(opt) {
const url = `${URL}/votes` const url = `${URL}/votes`
return Vue.http.post(url, opt, { 'emulateJSON': true }); return Vue.http.post(url, opt, {'emulateJSON': true});
} }
static voteStatus(opt) { static voteStatus(opt) {
const url = `${URL}/voteStatus` const url = `${URL}/voteStatus`
return Vue.http.post(url, opt, { 'emulateJSON': true }); return Vue.http.post(url, opt, {'emulateJSON': true});
} }
static getVote(opt) { static getVote(opt) {
return Vue.http.get(`${URL}/vote`, { 'params': opt }); return Vue.http.get(`${URL}/vote`, {'params': opt});
} }
static submitVote(opt) { static submitVote(opt) {
const url = `${URL}/submitVote` const url = `${URL}/submitVote`
return Vue.http.post(url, opt, { 'emulateJSON': true }); return Vue.http.post(url, opt, {'emulateJSON': true});
} }
static saveAds(opt) { static saveAds(opt) {
const url = `${URL}/ads` const url = `${URL}/ads`
return Vue.http.post(url, opt, { 'emulateJSON': true }); return Vue.http.post(url, opt, {'emulateJSON': true});
} }
static getAdsList(opt) { static getAdsList(opt) {
return Vue.http.get(`${URL}/ads`, { 'params': opt }); return Vue.http.get(`${URL}/ads`, {'params': opt});
} }
static adsStatus(opt) { static adsStatus(opt) {
const url = `${URL}/adsStatus` const url = `${URL}/adsStatus`
return Vue.http.post(url, opt, { 'emulateJSON': true }); return Vue.http.post(url, opt, {'emulateJSON': true});
} }
static getAd(opt) { static getAd(opt) {
return Vue.http.get(`${URL}/getAd`, { 'params': opt }); return Vue.http.get(`${URL}/getAd`, {'params': opt});
} }
static adClick(opt) { static adClick(opt) {
const url = `${URL}/adClick` const url = `${URL}/adClick`
return Vue.http.post(url, opt, { 'emulateJSON': true }); return Vue.http.post(url, opt, {'emulateJSON': true});
} }
static adImpl(opt) { static adImpl(opt) {
const url = `${URL}/adImpl` const url = `${URL}/adImpl`
return Vue.http.post(url, opt, { 'emulateJSON': true }); return Vue.http.post(url, opt, {'emulateJSON': true});
} }
static getFirstWin(opt) { static getFirstWin(opt) {
...@@ -143,21 +143,26 @@ export default class Api { ...@@ -143,21 +143,26 @@ export default class Api {
static adSwitchChange(opt) { static adSwitchChange(opt) {
const url = `${URL}/adSwitchChange` const url = `${URL}/adSwitchChange`
return Vue.http.post(url, opt, { 'emulateJSON': true }); return Vue.http.post(url, opt, {'emulateJSON': true});
} }
static saveActivity(opt) { static saveActivity(opt) {
const url = `${URL}/activity` const url = `${URL}/activity`
return Vue.http.post(url, opt, { 'emulateJSON': true }); return Vue.http.post(url, opt, {'emulateJSON': true});
} }
static saveLabel(opt) { static saveLabel(opt) {
const url = `${URL}/label` const url = `${URL}/label`
return Vue.http.post(url, opt, { 'emulateJSON': true }); return Vue.http.post(url, opt, {'emulateJSON': true});
} }
static getLabel(opt) { static getLabel(opt) {
return Vue.http.get(`${URL}/label`, { 'params': {} }); return Vue.http.get(`${URL}/label`, {'params': {}});
} }
static getMonthlyHistory(opt) {
const url = `https://sapi.moecube.com:444/ygopro/arena/historyScore`;
return Vue.http.get(url, {params: opt});
}
// https://sapi.moecube.com:444/ygopro/arena/historyScore?username=id&season=yyyy-mm
} }
...@@ -5,26 +5,26 @@ ...@@ -5,26 +5,26 @@
<div> <div>
<h4 class="color-blue"> <h4 class="color-blue">
<i class="glyphicon glyphicon-filter"></i> <i class="glyphicon glyphicon-filter"></i>
{{lang.qc}} {{ lang.qc }}
</h4> </h4>
<div class="well"> <div class="well">
<form action="" method="get" role="form" class="form-inline form-filter"> <form action="" method="get" role="form" class="form-inline form-filter">
<div class="form-group" style="margin-right: 10px;"> <div class="form-group" style="margin-right: 10px;">
<div class="input-group"> <div class="input-group">
<div class="input-group-addon">{{lang.time}}</div> <div class="input-group-addon">{{ lang.time }}</div>
<select name="type" class="form-control" id="type" v-on:change="onChange"> <select name="type" class="form-control" id="type" v-on:change="onChange">
<option value="day">{{lang.today}}</option> <option value="day">{{ lang.today }}</option>
<option value="week">{{lang.week}}</option> <option value="week">{{ lang.week }}</option>
<option value="halfmonth">{{lang.half_month}}</option> <option value="halfmonth">{{ lang.half_month }}</option>
<option value="month">{{lang.month}}</option> <option value="month">{{ lang.month }}</option>
<option value="season">{{lang.season}}</option> <option value="season">{{ lang.season }}</option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group" style="margin-right: 10px;"> <div class="form-group" style="margin-right: 10px;">
<div class="input-group"> <div class="input-group">
<div class="input-group-addon">{{lang.source}}</div> <div class="input-group-addon">{{ lang.source }}</div>
<select name="server" class="form-control" id="server" v-on:change="onChange"> <select name="server" class="form-control" id="server" v-on:change="onChange">
<option value="mycard">MCPro</option> <option value="mycard">MCPro</option>
<option value="233">233</option> <option value="233">233</option>
...@@ -36,53 +36,60 @@ ...@@ -36,53 +36,60 @@
<div class="form-group" style="margin-right: 10px;"> <div class="form-group" style="margin-right: 10px;">
<div class="input-group"> <div class="input-group">
<div class="input-group-addon">{{lang.type}}</div> <div class="input-group-addon">{{ lang.type }}</div>
<select name="source" class="form-control" id="source" v-on:change="onChange"> <select name="source" class="form-control" id="source" v-on:change="onChange">
<option value="athletic">{{lang.athletic}}</option> <option value="athletic">{{ lang.athletic }}</option>
<option value="entertain">{{lang.entertain}}</option> <option value="entertain">{{ lang.entertain }}</option>
<option value="custom">{{lang.custom}}</option> <option value="custom">{{ lang.custom }}</option>
<option value="tag">{{lang.tag}}</option> <option value="tag">{{ lang.tag }}</option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group" style="margin-right: 10px;"> <div class="form-group" style="margin-right: 10px;">
<div class="input-group"> <div class="input-group">
<div class="input-group-addon">{{lang.totalDeck}}</div> <div class="input-group-addon">{{ lang.totalDeck }}</div>
<span class="form-control">{{totalDeck}}</span> <span class="form-control">{{ totalDeck }}</span>
</div> </div>
</div> </div>
<div class="form-group" style="display:none"> <div class="form-group" style="display:none">
<button type="submit" id="search" <button type="submit" id="search"
class="form-control btn btn-primary">{{lang.search}}</button> class="form-control btn btn-primary">{{ lang.search }}
</button>
</div> </div>
</form> </form>
</div> </div>
<h4 class="color-blue"><i class="glyphicon glyphicon-list-alt"></i> {{lang.table_data}} </h4> <h4 class="color-blue"><i class="glyphicon glyphicon-list-alt"></i> {{ lang.table_data }} </h4>
<div> <div>
<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" @click='navClick("Deck")'><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" @click='navClick("Monster")'><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" @click='navClick("Spell")'><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" @click='navClick("Trap")' ><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" @click='navClick("Side")'><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" @click='navClick("Extra")'><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>
...@@ -139,7 +146,8 @@ ...@@ -139,7 +146,8 @@
<div class="form-group" style="display:none"> <div class="form-group" style="display:none">
<button type="submit" id="search" <button type="submit" id="search"
class="form-control btn btn-primary">{{lang.search}}</button> class="form-control btn btn-primary">{{ lang.search }}
</button>
</div> </div>
</div> </div>
...@@ -154,44 +162,46 @@ ...@@ -154,44 +162,46 @@
</template> </template>
<script> <script>
import Footads from './Footads' import Footads from './Footads'
import tb_language from './tb_lang.js' import tb_language from './tb_lang.js'
import { import {
mapGetters mapGetters
} from 'vuex' } from 'vuex'
import API from '../api'; import API from '../api';
import img0 from '../assets/img/500x300_deck.png' import img0 from '../assets/img/500x300_deck.png'
import img1 from '../assets/img/500x300_monster.png' import img1 from '../assets/img/500x300_monster.png'
import img2 from '../assets/img/500x300_Spell.png' import img2 from '../assets/img/500x300_Spell.png'
import img3 from '../assets/img/500x300_Trap.png' import img3 from '../assets/img/500x300_Trap.png'
import img4 from '../assets/img/500x300_side.png' import img4 from '../assets/img/500x300_side.png'
import img5 from '../assets/img/ExtraWithBorder.png' import img5 from '../assets/img/ExtraWithBorder.png'
var dt = require('datatables.net')
var dt2 = require('datatables.net-bs') var dt = require('datatables.net')
import "../assets/css/dataTables.bootstrap.min.css" var dt2 = require('datatables.net-bs')
var monsterTable; import "../assets/css/dataTables.bootstrap.min.css"
var spellTable;
var trapTable; var monsterTable;
var exTable; var spellTable;
var sideTable; var trapTable;
var deckTable; var exTable;
const placeholder={ var sideTable;
Deck:'请输入卡组名..', var deckTable;
Monster:'请输入怪兽卡名..', const placeholder = {
Spell:'请输入魔法卡名..', Deck: '请输入卡组名..',
Trap:'请输入陷阱卡名..', Monster: '请输入怪兽卡名..',
Side:'请输入卡片名..', Spell: '请输入魔法卡名..',
Extra:'请输入卡片名..', Trap: '请输入陷阱卡名..',
} Side: '请输入卡片名..',
export default { Extra: '请输入卡片名..',
}
export default {
components: { components: {
Footads Footads
}, },
created: function() { created: function () {
var regex_match = 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; /(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;
...@@ -199,20 +209,21 @@ ...@@ -199,20 +209,21 @@
return true; return true;
} }
var result = regex_match.exec(u); var result = regex_match.exec(u);
if (null == result) {} else { if (null == result) {
} 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)
}, },
mounted: function() { mounted: function () {
this.init2(); this.init2();
}, },
data() { data() {
return { return {
isActive: true,
totalDeck: 0, totalDeck: 0,
type: "",
isActive: true,
width: "100%", width: "100%",
img0: img0, img0: img0,
img1: img1, img1: img1,
...@@ -228,20 +239,47 @@ ...@@ -228,20 +239,47 @@
}), }),
}, },
watch: { watch: {
lang: function(val) { lang: function (val) {
// console.log('lang change1', val) // console.log('lang change1', val)
this.init2() this.init2()
}, },
}, },
methods: { methods: {
navClick(data){ // 计算禁卡表发布时间间隔
console.log('%c ---------------------src'+'\\'+'components'+'\\'+'Cards.vue---------------------%c:238','background:#f034c6','background:#14f1a4', // period() {
data) // const today = new Date();
$(".input-sm").attr("placeholder",placeholder[data]) // const year = today.getFullYear();
// const dates = [
// new Date(year, 0, 1),
// new Date(year, 3, 1),
// new Date(year, 6, 1),
// new Date(year, 9, 1),
// ];
// const season = dates.reduce((min, date) => {
// const diff = Math.floor((today - date) / (1000 * 60 * 60 * 24));
// if (today >= date && diff >= 0 && diff < min) {
// return diff;
// }
// return min;
// }, Infinity);
// // 根据select设定对应天数
// const periodMap = {
// day: 1,
// week: 7,
// halfmonth: 15,
// month: 30,
// season: season
// };
// var selectedType = $("#type").val();
// return periodMap[selectedType] || 1;
// },
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;
} else { } else {
...@@ -250,7 +288,7 @@ ...@@ -250,7 +288,7 @@
// this.lang = language[lang] // this.lang = language[lang]
this.getCount() this.getCount()
}, },
init2: function() { init2: function () {
var lang = localStorage.getItem('lang') || 'cn'; var lang = localStorage.getItem('lang') || 'cn';
if (lang === "cn") { if (lang === "cn") {
this.isActive = true; this.isActive = true;
...@@ -258,6 +296,8 @@ ...@@ -258,6 +296,8 @@
this.isActive = false; this.isActive = false;
} }
var self = this;
function renderPage() { function renderPage() {
if (monsterTable) { if (monsterTable) {
monsterTable.clear(); monsterTable.clear();
...@@ -279,43 +319,47 @@ ...@@ -279,43 +319,47 @@
sideTable.clear(); sideTable.clear();
sideTable.destroy(); sideTable.destroy();
} }
var server = $("#server").val() || "mycard" var server = $("#server").val() || "mycard"
var source = $("#source").val() || "athletic" var source = $("#source").val() || "athletic"
var final_source = server + "-" + source var final_source = server + "-" + source
$.get('https://sapi.moecube.com:444/ygopro/analytics/single/type', { $.get('https://sapi.moecube.com:444/ygopro/analytics/single/type', {
type: $("#type").val(), type: $("#type").val(),
lang: localStorage.getItem('lang') || 'cn', lang: localStorage.getItem('lang') || 'cn',
extra: 'name', extra: 'name',
source: final_source source: final_source
}, function(data) { }, function (data) {
var monster = data.monster; var monster = data.monster;
var spell = data.spell; var spell = data.spell;
var trap = data.trap; var trap = data.trap;
var side = data.side; var side = data.side;
var ex = data.ex; var ex = data.ex;
monsterTable = renderTable("#monster", monster)
spellTable = renderTable("#spell", spell) monsterTable = renderTable("#monster", monster);
trapTable = renderTable("#trap", trap) spellTable = renderTable("#spell", spell);
exTable = renderTable("#ex", ex) trapTable = renderTable("#trap", trap);
sideTable = renderTable("#side", side) exTable = renderTable("#ex", ex);
sideTable = renderTable("#side", side);
}); });
//卡组api https://sapi.moecube.com:444/ygopro/analytics/deck/type?type=day&source=mycard-entertain
//只显示中文
var lang = localStorage.getItem('lang') || 'cn'; var lang = localStorage.getItem('lang') || 'cn';
if (lang === "cn") { if (lang === "cn") {
if (deckTable) { if (deckTable) {
deckTable.clear(); deckTable.clear();
deckTable.destroy(); deckTable.destroy();
} }
$.get('https://sapi.moecube.com:444/ygopro/analytics/deck/type', { $.get('https://sapi.moecube.com:444/ygopro/analytics/deck/type', {
type: $("#type").val(), type: $("#type").val(),
source: final_source source: final_source
}, function(data) { }, function (data) {
var obj = data; var obj = data;
if (typeof obj === 'string') if (typeof obj === 'string')
obj = JSON.parse(data); obj = JSON.parse(data);
var rank = 1; var rank = 1;
var processData = obj.map(function(x) { var processData = obj.map(function (x) {
var tagStr = []; var tagStr = [];
var deckName = x.name; var deckName = x.name;
for (var i = 0; i < x.tags.length; i++) { for (var i = 0; i < x.tags.length; i++) {
...@@ -323,38 +367,36 @@ ...@@ -323,38 +367,36 @@
var short_tagName = tagName.replace(deckName + "-", ""); var short_tagName = tagName.replace(deckName + "-", "");
tagStr.push(short_tagName) tagStr.push(short_tagName)
} }
return [rank++, x.name, x.count, tagStr.join(" , ")]; var PickRate = (0 < (x.count / (self.totalDeck)) && (x.count / (self.totalDeck)) < 1)
? ((x.count / (self.totalDeck) * 100)).toFixed(2) + "%" : "-";
// 出现-是数据算出来不在0-1之间
return [rank++, x.name, x.count, PickRate, tagStr.join(" , ")];
}); });
deckTable = $("#deck").DataTable({ deckTable = $("#deck").DataTable({
data: processData, data: processData,
pageLength: 25, pageLength: 25,
order: [ order: [
[2, "desc"] [2, "desc"]
], ],
"ordering": true, ordering: true,
columns: [{ columns: [
title: tb_language[lang].rank {title: tb_language[lang].rank},
}, {title: tb_language[lang].deck},
{ {title: tb_language[lang].count},
title: tb_language[lang].deck {title: tb_language[lang].PickRate},
}, {title: tb_language[lang].topTags},
{ ],
title: tb_language[lang].count columnDefs: [
},
{ {
title: tb_language[lang].topTags render: function (data, type, row) {
return "<a href='?name=" + data + "#/deck'>" + data + "</a>";
}, },
targets: 1
}
], ],
"columnDefs": [{ language: tb_language[lang]
"render": function(data, type, row) {
// return "<span title='" + data + "'>" + data + "</span>";
// return "<img src='imag.png' />";
return "<a href='?name=" + data + "#/deck'>" +
data + "</a>";
},
"targets": 1
}, ],
"language": tb_language[lang]
}); });
}); });
} }
...@@ -365,89 +407,100 @@ ...@@ -365,89 +407,100 @@
var lang = localStorage.getItem('lang') || 'cn'; var lang = localStorage.getItem('lang') || 'cn';
var langIndex = (lang === 'en' ? 'en-US' : 'zh-CN'); var langIndex = (lang === 'en' ? 'en-US' : 'zh-CN');
var rank = 1; var rank = 1;
var processData = tableData.map(function(d) { var processData = tableData.map(function (d) {
return [rank++, d.name ? d.name[langIndex] : "未知卡片", d.frequency, d.putone, d // var period = self.period();
.puttwo, d.putthree, d.id var PickRate = (parseInt(d.putone) + parseInt(d.puttwo) + parseInt(d.putthree)) / self.totalDeck;
PickRate = (0 < PickRate && PickRate < 1) ? (PickRate * 100).toFixed(2) + "%" : "-";
// 使用率出现-是数据算出来不在0-1之间
return [
rank++, d.name ? d.name[langIndex] : "未知卡片",
d.frequency,
PickRate,
d.putone,
d.puttwo,
d.putthree,
d.id
]; ];
}); });
var table = $(tableID).DataTable({ var table = $(tableID).DataTable({
data: processData, data: processData,
pageLength: 50, pageLength: 50,
order: [ order: [[2, "desc"]],
[2, "desc"] ordering: true,
columns: [
{title: tb_language[lang].rank},
{title: tb_language[lang].cardName},
{title: tb_language[lang].used},
{title: tb_language[lang].PickRate},
{title: tb_language[lang].put1},
{title: tb_language[lang].put2},
{title: tb_language[lang].put3},
], ],
"ordering": true, columnDefs: [
columns: [{
title: tb_language[lang].rank
},
{
title: tb_language[lang].cardName
},
{
title: tb_language[lang].used
},
{ {
title: tb_language[lang].put1 render: function (data, type, row) {
return "<a href='https://www.ourocg.cn/search/" + row[7] + "'>" + data + "</a>";
}, },
{ targets: 1
title: tb_language[lang].put2
},
{
title: tb_language[lang].put3
}, },
], ],
"columnDefs": [{ language: tb_language[lang]
"render": function(data, type, row) {
return "<a href='https://www.ourocg.cn/search/" + row[6] +
"'>" + data + "</a>";
},
"targets": 1
}, ],
"language": tb_language[lang]
}); });
$(".input-sm").attr("placeholder",placeholder.Deck)
$(".input-sm").attr("placeholder", placeholder.Deck);
return table; return table;
} }
renderPage(); renderPage();
$("#search").click(function() {
$("#search").click(function () {
renderPage(); renderPage();
return false; return false;
}) });
}, },
onChange: function() { onChange: function () {
$("#search").trigger('click') var self = this;
this.getCount() this.getCount().then(function () {
self.init2();
});
}, },
getCount: function() {
getCount: function () {
var server = $("#server").val() || "mycard" var server = $("#server").val() || "mycard"
var source = $("#source").val() || "athletic" var source = $("#source").val() || "athletic"
var opt = { var opt = {
type: $("#type").val() || "day", type: $("#type").val() || "day",
source: server + "-" + source source: server + "-" + source
} };
var self = this var self = this;
API.getCount(opt).then((res) => { return API.getCount(opt).then((res) => {
if (isNaN(res.data)) { if (isNaN(res.data)) {
self.totalDeck = 0 return 0;
} else { } else {
self.totalDeck = res.data this.totalDeck = res.data;
return res.data;
} }
}); });
} }
}, },
events: { events: {
'lang-change': function(lang) { 'lang-change': function (lang) {
this.init(lang) this.init(lang)
this.onChange() this.onChange()
} }
}, },
} }
</script> </script>
<style scoped> <style scoped>
#deck { #deck {
margin-top:20px!important; margin-top: 20px !important;
border:1px solid black; border: 1px solid black;
} }
</style> </style>
...@@ -6,47 +6,48 @@ ...@@ -6,47 +6,48 @@
<div class="thumbnail"> <div class="thumbnail">
<img v-bind:src="user.avatar_url" style="height:200px;margin-top:13px;"> <img v-bind:src="user.avatar_url" style="height:200px;margin-top:13px;">
<div class="caption"> <div class="caption">
<h3> <i class="glyphicon glyphicon-user"></i> <strong>{{user.username}}</strong></h3> <h3><i class="glyphicon glyphicon-user"></i> <strong>{{ user.username }}</strong></h3>
<p class="text-muted" style="font-size:20px;">今日首胜: {{activity.today}}/1 </p> <p class="text-muted" style="font-size:20px;">今日首胜: {{ activity.today }}/1 </p>
<p class="text-muted" v-if="showActivity" style="font-size:20px;">{{activity.name}}首胜: {{activity.total}}/{{activity.max}} </p> <p class="text-muted" v-if="showActivity" style="font-size:20px;">{{ activity.name }}首胜:
{{ activity.total }}/{{ activity.max }} </p>
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-9"> <div class="col-md-9">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">{{lang.athletic}} </h3> <h3 class="panel-title">{{ lang.athletic }} </h3>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-bordered table-hover"> <table class="table table-striped table-bordered table-hover">
<tbody> <tbody>
<tr> <tr>
<td>D.P </td> <td>D.P</td>
<td>{{user_info.pt}} </td> <td>{{ user_info.pt }}</td>
</tr> </tr>
<tr> <tr>
<td>{{lang.athletic_rank}} </td> <td>{{ lang.athletic_rank }}</td>
<td>{{user_info.arena_rank}} </td> <td>{{ user_info.arena_rank }}</td>
</tr> </tr>
<tr> <tr>
<td>{{lang.win}} </td> <td>{{ lang.win }}</td>
<td>{{user_info.athletic_win}} </td> <td>{{ user_info.athletic_win }}</td>
</tr> </tr>
<tr> <tr>
<td>{{lang.lose}} </td> <td>{{ lang.lose }}</td>
<td>{{user_info.athletic_lose}} </td> <td>{{ user_info.athletic_lose }}</td>
</tr> </tr>
<tr> <tr>
<td>{{lang.draw}} </td> <td>{{ lang.draw }}</td>
<td>{{user_info.athletic_draw}} </td> <td>{{ user_info.athletic_draw }}</td>
</tr> </tr>
<tr> <tr>
<td>{{lang.all}} </td> <td>{{ lang.all }}</td>
<td>{{user_info.athletic_all}} </td> <td>{{ user_info.athletic_all }}</td>
</tr> </tr>
<tr> <tr>
<td>{{lang.ratio}} </td> <td>{{ lang.ratio }}</td>
<td>{{user_info.athletic_wl_ratio}}% </td> <td>{{ user_info.athletic_wl_ratio }}%</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
...@@ -54,73 +55,90 @@ ...@@ -54,73 +55,90 @@
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">{{lang.entertain}} </h3> <h3 class="panel-title">{{ lang.entertain }} </h3>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-bordered table-hover"> <table class="table table-striped table-bordered table-hover">
<tbody> <tbody>
<tr> <tr>
<td>EXP </td> <td>EXP</td>
<td>{{user_info.exp}} </td> <td>{{ user_info.exp }}</td>
</tr> </tr>
<tr> <tr>
<td>{{lang.exp_rank}} </td> <td>{{ lang.exp_rank }}</td>
<td>{{user_info.exp_rank}} </td> <td>{{ user_info.exp_rank }}</td>
</tr> </tr>
<tr> <tr>
<td>{{lang.win}} </td> <td>{{ lang.win }}</td>
<td>{{user_info.entertain_win}} </td> <td>{{ user_info.entertain_win }}</td>
</tr> </tr>
<tr> <tr>
<td>{{lang.lose}} </td> <td>{{ lang.lose }}</td>
<td>{{user_info.entertain_lose}} </td> <td>{{ user_info.entertain_lose }}</td>
</tr> </tr>
<tr> <tr>
<td>{{lang.draw}} </td> <td>{{ lang.draw }}</td>
<td>{{user_info.entertain_draw}} </td> <td>{{ user_info.entertain_draw }}</td>
</tr> </tr>
<tr> <tr>
<td>{{lang.all}} </td> <td>{{ lang.all }}</td>
<td>{{user_info.entertain_all}} </td> <td>{{ user_info.entertain_all }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{{ lang.monthlyHistory }} </h3>
</div>
<!--<div class="panel-body">-->
<!--<div style="width:100%;overflow-x:auto;overflow-y:hidden;">
<table id="rank" class="table table-striped table-bordered table-hover example" ></table>
</div>-->
<div class="table-responsive" style="width:100%;overflow-x:auto;overflow-y:hidden;">
<table id="monthly_rank" class="table table-striped table-bordered table-hover example"
:class="{ scroll: isMobile }"></table>
</div>
</div>
<div class="alert alert-info alert-dismissible" role="alert"> <div class="alert alert-info alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button> {{lang.tagInfo}} <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
{{ lang.tagInfo }}
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">{{lang.athleticDueHistory}} </h3> <h3 class="panel-title">{{ lang.athleticDueHistory }} </h3>
</div> </div>
<!--<div class="panel-body">--> <!--<div class="panel-body">-->
<!--<div style="width:100%;overflow-x:auto;overflow-y:hidden;"> <!--<div style="width:100%;overflow-x:auto;overflow-y:hidden;">
<table id="rank" class="table table-striped table-bordered table-hover example" ></table> <table id="rank" class="table table-striped table-bordered table-hover example" ></table>
</div>--> </div>-->
<div class="table-responsive" style="width:100%;overflow-x:auto;overflow-y:hidden;"> <div class="table-responsive" style="width:100%;overflow-x:auto;overflow-y:hidden;">
<table id="athletic_rank" class="table table-striped table-bordered table-hover example" :class="{ scroll: isMobile }"></table> <table id="athletic_rank" class="table table-striped table-bordered table-hover example"
:class="{ scroll: isMobile }"></table>
</div> </div>
<!--</div>--> <!--</div>-->
<!--<div class="table-responsive" style="width:100%;overflow-x:auto;overflow-y:hidden;"> <!--<div class="table-responsive" style="width:100%;overflow-x:auto;overflow-y:hidden;">
<table id="rank" class="table table-striped table-bordered table-hover example" :class="{ scroll: isMobile }" ></table> <table id="rank" class="table table-striped table-bordered table-hover example" :class="{ scroll: isMobile }" ></table>
</div>--> </div>-->
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">{{lang.entertainDueHistory}} </h3> <h3 class="panel-title">{{ lang.entertainDueHistory }} </h3>
</div> </div>
<!--<div class="panel-body">--> <!--<div class="panel-body">-->
<!--<div style="width:100%;overflow-x:auto;overflow-y:hidden;"> <!--<div style="width:100%;overflow-x:auto;overflow-y:hidden;">
<table id="rank" class="table table-striped table-bordered table-hover example" ></table> <table id="rank" class="table table-striped table-bordered table-hover example" ></table>
</div>--> </div>-->
<div class="table-responsive" style="width:100%;overflow-x:auto;overflow-y:hidden;"> <div class="table-responsive" style="width:100%;overflow-x:auto;overflow-y:hidden;">
<table id="entertain_rank" class="table table-striped table-bordered table-hover example" :class="{ scroll: isMobile }"></table> <table id="entertain_rank" class="table table-striped table-bordered table-hover example"
:class="{ scroll: isMobile }"></table>
</div> </div>
<!--</div>--> <!--</div>-->
<!--<div class="table-responsive" style="width:100%;overflow-x:auto;overflow-y:hidden;"> <!--<div class="table-responsive" style="width:100%;overflow-x:auto;overflow-y:hidden;">
...@@ -128,9 +146,6 @@ ...@@ -128,9 +146,6 @@
</div>--> </div>-->
</div> </div>
</div> </div>
</div> </div>
</div> </div>
...@@ -138,16 +153,19 @@ ...@@ -138,16 +153,19 @@
</template> </template>
<script> <script>
import querystring from 'querystring'; import querystring from 'querystring';
import API from '../api' import API from '../api'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
import moment from 'moment'
import tb_language from './tb_lang.js'
var rankTable; var rankTable;
var rankTable2; var rankTable2;
import moment from 'moment' var rankTable3;
import tb_language from './tb_lang.js'
export default {
export default {
data() { data() {
return { return {
isMobile: false, isMobile: false,
...@@ -172,7 +190,7 @@ ...@@ -172,7 +190,7 @@
athletic_all: 0, athletic_all: 0,
athletic_wl_ratio: 0, athletic_wl_ratio: 0,
arena_rank: 0 arena_rank: 0
} },
} }
}, },
computed: { computed: {
...@@ -183,7 +201,6 @@ ...@@ -183,7 +201,6 @@
}, },
mounted: function () { mounted: function () {
var _this = this var _this = this
$("#search").click(function () { $("#search").click(function () {
...@@ -195,7 +212,6 @@ ...@@ -195,7 +212,6 @@
}, },
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;
...@@ -216,21 +232,20 @@ ...@@ -216,21 +232,20 @@
API.getUserInfo(opt).then((res) => { API.getUserInfo(opt).then((res) => {
this.user_info = res.data this.user_info = res.data
console.log('%c ---------------------src'+'\\'+'components'+'\\'+'Profile.vue---------------------%c:219','background:#ed162b','background:#7d382d', // console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:219', 'background:#ed162b', 'background:#7d382d',
res) // res)
}); });
}, },
methods: { methods: {
exchangeUserInfo(info){ exchangeUserInfo(info) {
let userName=this.user.username let userName = this.user.username
let exchangeInfo=info let exchangeInfo = info
if(info.usernamea!=userName) if (info.usernamea != userName) {
{ exchangeInfo = {
exchangeInfo={ "type": info.type,
"type":info.type, "start_time": info.start_time,
"start_time":info.start_time,
"isfirstwin": info.isfirstwin, "isfirstwin": info.isfirstwin,
"end_time": info.end_time, "end_time": info.end_time,
"usernamea": info.usernameb, "usernamea": info.usernameb,
...@@ -246,15 +261,37 @@ ...@@ -246,15 +261,37 @@
"pta_ex": info.ptb_ex, "pta_ex": info.ptb_ex,
"ptb_ex": info.pta_ex, "ptb_ex": info.pta_ex,
"winner": info.winner, "winner": info.winner,
} }
}
// console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:227', 'background:#1b5fbd', 'background:#ce8e6b',
// exchangeInfo)
return exchangeInfo
},
exchangeUserInfo3(info) {
let userName = this.user.username
let exchangeInfo = info
if (info.usernamea !== userName) {
exchangeInfo = {
"username":info.username,
"season": info.season,
"rank": info.rank,
"pt": info.pt,
"note": info.note,
"entertainmentWin": info.entertainmentWin,
"entertainmentLose": info.entertainmentLose,
"entertainmentDraw": info.entertainmentDraw,
"correction": info.correction,
"athleticWin": info.athleticWin,
"athleticLose": info.athleticLose,
"athleticDraw": info.athleticDraw,
}
} }
console.log('%c ---------------------src'+'\\'+'components'+'\\'+'Profile.vue---------------------%c:227','background:#1b5fbd','background:#ce8e6b', // console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:227', 'background:#1b5fbd', 'background:#ce8e6b',
exchangeInfo) // exchangeInfo)
return exchangeInfo return exchangeInfo
}, },
init: function () { init: function () {
}, },
...@@ -267,15 +304,20 @@ ...@@ -267,15 +304,20 @@
rankTable2.destroy(); rankTable2.destroy();
} }
if (rankTable3) {
rankTable3.destroy();
}
var username = this.user.username var username = this.user.username
var type = 1; var type = 1;
rankTable = this.renderRankTable("#athletic_rank", [], "DP"); rankTable = this.renderRankTable("#athletic_rank", [], "DP");
rankTable2 = this.renderRankTable("#entertain_rank", [], ""); rankTable2 = this.renderRankTable("#entertain_rank", [], "");
rankTable3 = this.renderRankTable3("#monthly_rank", [], "");
if (!username) return; if (!username) return;
API.getUserDueHistory({ username: username, type: "1", page_num: 100 }).then((res) => { API.getUserDueHistory({username: username, type: "1", page_num: 100}).then((res) => {
if (rankTable) { if (rankTable) {
rankTable.destroy(); rankTable.destroy();
...@@ -286,41 +328,68 @@ ...@@ -286,41 +328,68 @@
}); });
API.getUserDueHistory({ username: username, type: "2", page_num: 100 }).then((res) => { API.getUserDueHistory({username: username, type: "2", page_num: 100}).then((res) => {
if (rankTable2) { if (rankTable2) {
rankTable2.destroy(); rankTable2.destroy();
} }
rankTable2 = this.renderRankTable("#entertain_rank", res.data.data, "") rankTable2 = this.renderRankTable("#entertain_rank", res.data.data, "")
}, (res) => { }, (res) => {
console.log('%c ---------------------src'+'\\'+'components'+'\\'+'Profile.vue---------------------%c:258','background:#ef98b5','background:#53116e', // console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:258', 'background:#ef98b5', 'background:#53116e',
res) // res)
});
// 获取用户每个月的战斗历史数据
var monthly = [];
function fetchData(username, monthOffset) {
var date = moment().subtract(monthOffset, 'months').format('YYYY-MM');
let opt = {
'username': username,
'season': date,
};
return API.getMonthlyHistory(opt)
.then(response => {
const res = response.data;
// console.log(res);
// 判断是否有返回数据
if (res) {
// 继续请求前一个月的数据
monthly.push(res);
return fetchData(username, monthOffset + 1);
} else {
// 当不再返回数据时,结束递归,并返回最终的 monthly 数组
return monthly;
}
});
}
fetchData(username, 1).then(res => {
if (rankTable3) {
rankTable3.destroy();
}
rankTable3 = this.renderRankTable3("#monthly_rank", monthly, "")
}); });
var _this = this;
API.getFirstWin({ username: username }).then((res) => { var _this = this;
API.getFirstWin({username: username}).then((res) => {
_this.activity = res.data _this.activity = res.data
if (_this.activity.name && _this.activity.name.trim().length > 0) { if (_this.activity.name && _this.activity.name.trim().length > 0) {
_this.showActivity = true; _this.showActivity = true;
} }
}, (res) => { }, (res) => {
console.log('%c ---------------------src'+'\\'+'components'+'\\'+'Profile.vue---------------------%c:271','background:#c85336','background:#a4c933', // console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:271', 'background:#c85336', 'background:#a4c933',
res) // res)
}); });
}, },
renderRankTable: function (id, tableData, ttype) { renderRankTable: function (id, tableData, ttype) {
tableData = tableData || []; tableData = tableData || [];
var lang = localStorage.getItem('lang') || 'cn'; var lang = localStorage.getItem('lang') || 'cn';
var rank = 1; var rank = 1;
console.log('%c ---------------------src'+'\\'+'components'+'\\'+'Profile.vue---------------------%c:284','background:#c896f3','background:#f332b2', // console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:284', 'background:#c896f3', 'background:#f332b2',
tableData) // tableData)
let that = this
let that=this
var processData = tableData.map(function (d) { var processData = tableData.map(function (d) {
d=that.exchangeUserInfo(d) d = that.exchangeUserInfo(d)
return [d.usernamea, d.usernameb, moment(d.start_time).format('YYYY-MM-DD HH:mm'), return [d.usernamea, d.usernameb, moment(d.start_time).format('YYYY-MM-DD HH:mm'),
moment(d.end_time).format('YYYY-MM-DD HH:mm'), d.userscorea, d.userscoreb, moment(d.end_time).format('YYYY-MM-DD HH:mm'), d.userscorea, d.userscoreb,
d.pta, d.pta_ex, d.ptb, d.ptb_ex]; d.pta, d.pta_ex, d.ptb, d.ptb_ex];
...@@ -334,10 +403,10 @@ ...@@ -334,10 +403,10 @@
data: processData, data: processData,
columns: [ columns: [
{ title: tb_language[lang].playerA }, {title: tb_language[lang].playerA},
{ title: tb_language[lang].playerB }, {title: tb_language[lang].playerB},
{ title: tb_language[lang].startTime }, {title: tb_language[lang].startTime},
{ title: tb_language[lang].endTime }, {title: tb_language[lang].endTime},
], ],
"columnDefs": [ "columnDefs": [
...@@ -395,8 +464,48 @@ ...@@ -395,8 +464,48 @@
return table; return table;
}, },
renderRankTable3: function (id, tableData) {
tableData = tableData || [];
var lang = localStorage.getItem('lang') || 'cn'
let that = this
var processData = tableData.map(function (d) {
console.log(tableData)
d = that.exchangeUserInfo3(d);
var pt=Math.round(d.pt);
var totoal=d.athleticWin+d.athleticLose;
return [
moment(d.season).format('YYYY-MM'),
d.rank,
pt,
d.athleticWin,
d.athleticLose,
totoal
];
});
var table = $(id).DataTable({
paging: true,
searching: false,
ordering: false,
lengthChange: false,
info: false,
data: processData,
"pageLength": 12, // 设置每页显示12行数据
columns: [
{title: tb_language[lang].season},
{title: tb_language[lang].rank},
{title: tb_language[lang].pt},
{title: tb_language[lang].athleticWin},
{title: tb_language[lang].athleticLose},
{title: tb_language[lang].total},
],
"columnDefs": [
],
"language": lang === 'en' ? tb_language.en : tb_language.cn
});
return table;
}, },
} },
}
</script> </script>
...@@ -150,74 +150,108 @@ ...@@ -150,74 +150,108 @@
} }
} }
function renderExpTable(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) {
return [rank++, d.username, parseInt(d.exp), d.entertain_win, d.entertain_lose]; let ratio = 0
if (d.athletic_all > 0) {
ratio = (d.athletic_win / d.athletic_all * 100).toFixed(2)
}
var iconSrc = 'https://sapi.moecube.com:444/avatar/avatar/' + d.username + '/100/pic.png';
return [rank++, iconSrc, String(d.username), parseInt(d.pt), d.athletic_win, d.athletic_lose, ratio + "%"];
}); });
var table = $('#exp_table').DataTable({ var table = $('#pt_table').DataTable({
"autoWidth": false,
data: processData, data: processData,
pageLength: 25, pageLength: 25,
order: [ order: [
[0, "asc"] [0, "asc"]
], ],
"ordering": true, "ordering": true,
columns: [{ columns: [
title: tb_language[lang].rank {
title: tb_language[lang].rank,
}, },
{ {
title: tb_language[lang].name title: tb_language[lang].name, // Display icon + username in this column
render: function (data, type, row) {
var iconSrcWithUsername = row[1]; // 获取图像链接
var username = row[2]; // 获取用户名
return '<div style="display: flex; align-items: center;">' +
'<img src="' + iconSrcWithUsername + '" style="width: 35px; height: 35px; margin-right: 3px;"> ' +
'<a href="#/userinfo?username=' + encodeURIComponent(username) + '">' + username + '</a>' +
'</div>';
},
}, },
{ {
title: tb_language[lang].exp visible: false, // Hide the username column,
}, },
{ {
title: tb_language[lang].win title: tb_language[lang].pt,
}, },
{ {
title: tb_language[lang].lose title: tb_language[lang].win,
},
{
title: tb_language[lang].lose,
},
{
title: tb_language[lang].wl,
}, },
], ],
"columnDefs": [{ "columnDefs": [{
"render": function(data, type, row) { "render": function (data, type, row) {
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'>" + data + "</a>"; return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'>" + data + "</a>";
}, },
"targets": 1 "targets": 2
}, ], },],
"language": lang === 'en' ? tb_language.en : tb_language.cn "language": tb_language[lang],
}); });
$(".input-sm").attr("placeholder",placeholder) $(".input-sm").attr("placeholder", placeholder)
return table; return table;
} }
function renderArenaTable(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) {
let ratio = 0 var iconSrc = 'https://sapi.moecube.com:444/avatar/avatar/' + d.username + '/100/pic.png';
if (d.athletic_all > 0) { return [rank++, iconSrc, String(d.username), parseInt(d.exp), d.entertain_win, d.entertain_lose];
ratio = (d.athletic_win / d.athletic_all * 100).toFixed(2)
}
return [rank++, d.username, parseInt(d.pt), d.athletic_win, d.athletic_lose, ratio + "%"];
}); });
var table = $('#pt_table').DataTable({
var table = $('#exp_table').DataTable({
data: processData, data: processData,
pageLength: 25, pageLength: 25,
order: [ order: [[0, "asc"]],
[0, "asc"]
],
"ordering": true, "ordering": true,
columns: [{ columns: [
{
title: tb_language[lang].rank title: tb_language[lang].rank
}, },
{ {
title: tb_language[lang].name title: tb_language[lang].name, // Display icon + username in this column
render: function (data, type, row) {
var iconSrcWithUsername = row[1]; // 获取图像链接
var username = row[2]; // 获取用户名
return '<div style="display: flex; align-items: center;"><img src="' + iconSrcWithUsername + '" style="width: 35px; height: 35px; margin-right: 3px;"> <a href="#/userinfo?username=' + encodeURIComponent(username) + '">' + username + '</a></div>';
},
},
{
visible: false, // Hide the username column
}, },
{ {
title: tb_language[lang].pt title: tb_language[lang].exp
}, },
{ {
title: tb_language[lang].win title: tb_language[lang].win
...@@ -225,19 +259,16 @@ ...@@ -225,19 +259,16 @@
{ {
title: tb_language[lang].lose title: tb_language[lang].lose
}, },
],
"columnDefs": [
{ {
title: tb_language[lang].wl "targets": [0, 3, 4, 5], // Target other columns (exp, win, lose) to make them non-orderable
"orderable": false
}, },
], ],
"columnDefs": [{ "language": lang === 'en' ? tb_language.en : tb_language.cn,
"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) $(".input-sm").attr("placeholder", placeholder);
return table; return table;
} }
renderPage(); renderPage();
...@@ -271,3 +302,16 @@ ...@@ -271,3 +302,16 @@
width: 250%; width: 250%;
} }
</style> </style>
<style>
#pt_table tr td:first-child, #pt_table tr th:first-child, #exp_table tr td:first-child, #exp_table tr th:first-child {
width: 1%;
white-space: nowrap;
}
#pt_table td, #pt_table th {
text-align: left;
vertical-align: middle}
#epx_table td, #exp_table th {
text-align: left;
vertical-align: middle}
</style>
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
class="winRateTitle-color-3">上月胜率</div>。在每个月<div class="winRateTitle-color-3">20日</div> class="winRateTitle-color-3">上月胜率</div>。在每个月<div class="winRateTitle-color-3">20日</div>
以及之后,胜率为<div class="winRateTitle-color-3">当月胜率</div> </div>--> 以及之后,胜率为<div class="winRateTitle-color-3">当月胜率</div> </div>-->
<div id="winRateTitle-2">更新:<div class="winRateTitle-color-3">每天更新,当月胜率</div></div> <div id="winRateTitle-2">更新:<div class="winRateTitle-color-3">每天更新,当月胜率</div></div>
</div> </div>
<div class='winRateContent'> <div class='winRateContent'>
<div class='winRateContent-Tabs'> <div class='winRateContent-Tabs'>
......
...@@ -41,6 +41,7 @@ module.exports = { ...@@ -41,6 +41,7 @@ module.exports = {
dueHistory: '最近决斗记录', dueHistory: '最近决斗记录',
athleticDueHistory: '竞技场决斗记录', athleticDueHistory: '竞技场决斗记录',
entertainDueHistory: '娱乐场决斗记录', entertainDueHistory: '娱乐场决斗记录',
monthlyHistory: '每月决斗记录',
tagInfo: '绿色表示获胜方,红色则表示掉线。', tagInfo: '绿色表示获胜方,红色则表示掉线。',
rates: '卡组胜率', rates: '卡组胜率',
...@@ -155,6 +156,7 @@ module.exports = { ...@@ -155,6 +156,7 @@ module.exports = {
side: 'Side', side: 'Side',
extra: 'Extra', extra: 'Extra',
dueHistory: 'Recent Due History', dueHistory: 'Recent Due History',
monthlyHistory: 'Monthly Rank Record',
athleticDueHistory: 'Athletic Due History', athleticDueHistory: 'Athletic Due History',
entertainDueHistory: 'Entertain Due History', entertainDueHistory: 'Entertain Due History',
tagInfo: 'Green tag represents the winner.Red tag represents player lost connection.', tagInfo: 'Green tag represents the winner.Red tag represents player lost connection.',
......
...@@ -29,7 +29,10 @@ module.exports = { ...@@ -29,7 +29,10 @@ module.exports = {
win: "胜局", win: "胜局",
lose: "负局", lose: "负局",
wl: "胜率", wl: "胜率",
athleticWin:'竞技场胜利',
athleticLose:'竞技场失败',
season:'时间',
total:'合计',
cardName: "卡名", cardName: "卡名",
used: "使用量", used: "使用量",
put1: "投入1", put1: "投入1",
...@@ -38,6 +41,7 @@ module.exports = { ...@@ -38,6 +41,7 @@ module.exports = {
deck: "卡组", deck: "卡组",
count: "使用数", count: "使用数",
PickRate : "使用率",
topTags: "热门标签", topTags: "热门标签",
playerA: '玩家A', playerA: '玩家A',
...@@ -59,10 +63,14 @@ module.exports = { ...@@ -59,10 +63,14 @@ module.exports = {
cardName: "Card Name", cardName: "Card Name",
used: "Used", used: "Used",
PickRate:"Pick Rate",
put1: "Put one ", put1: "Put one ",
put2: "Put two ", put2: "Put two ",
put3: "Put three ", put3: "Put three ",
athleticWin:'Win',
athleticLose:'Lose',
season:'Time',
total:'Total',
deck: "Deck", deck: "Deck",
count: "Count", count: "Count",
topTags: "Top Tags", topTags: "Top Tags",
......
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