Commit acf55d6b authored by GaiaXalter's avatar GaiaXalter 💬

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

parent cab5ce83
Pipeline #24358 failed with stages
in 6 seconds
...@@ -10,154 +10,159 @@ const URL = "https://sapi.moecube.com:444/ygopro/arena" ...@@ -10,154 +10,159 @@ const URL = "https://sapi.moecube.com:444/ygopro/arena"
export default class Api { export default class Api {
static uploadUrl = `${URL}/upload` static uploadUrl = `${URL}/upload`
static implUrl = `${URL}/impltrack`
static clkUrl = `${URL}/clktrack`
static getMonthlyWinRate() {
let monthlyWinRateUrl = 'https://sapi.moecube.com:444/ygopro/analytics/matchup/type?source=mycard-athletic'
return Vue.http.get(monthlyWinRateUrl)
}
static getDownloadUrl(url) {
url = url.slice(7)
var downloadUrl = `${URL}/download/${url}`
return downloadUrl
}
static getCount(opt) {
var request = query.stringify(opt);
const url = `${config.COUNTER_URL}?${request}`;
return Vue.http.get(url);
}
static getUserInfo(opt) {
var request = query.stringify(opt);
const url = `${URL}/user?${request}`;
return Vue.http.get(url);
}
static getUsers(opt) {
var request = query.stringify(opt);
const url = `${URL}/users?${request}`;
return Vue.http.get(url);
}
static getUserDueHistory(opt) {
return Vue.http.get(`${URL}/history`, { 'params': opt });
}
static getDownloadUrls() {
return Vue.http.get('https://api.github.com/repos/mycard/mycard/releases/latest')
}
static getAvatar(opt) {
return Vue.http.get(`https://sapi.moecube.com:444/accounts/users/${opt.username}.avatar`)
}
static getCardInfo(opt) {
var request = query.stringify(opt);
const url = `${URL}/cardinfo?${request}`;
return Vue.http.get(url);
}
static getDeckInfo(opt) {
return Vue.http.get(`${URL}/deckinfo`, { 'params': opt });
}
static saveDeck(opt) {
const url = `${URL}/deckinfo`
return Vue.http.post(url, opt, { 'emulateJSON': true });
}
static saveDeckDemo(opt) {
const url = `${URL}/deckdemo`
return Vue.http.post(url, opt, { 'emulateJSON': true });
}
static getReport(opt) {
return Vue.http.get(`${URL}/report`, { 'params': opt });
}
static getVoteList(opt) {
return Vue.http.get(`${URL}/votes`, { 'params': opt });
}
static saveVote(opt) {
const url = `${URL}/votes`
return Vue.http.post(url, opt, { 'emulateJSON': true });
}
static voteStatus(opt) {
const url = `${URL}/voteStatus`
return Vue.http.post(url, opt, { 'emulateJSON': true });
}
static getVote(opt) {
return Vue.http.get(`${URL}/vote`, { 'params': opt });
}
static submitVote(opt) {
const url = `${URL}/submitVote`
return Vue.http.post(url, opt, { 'emulateJSON': true });
}
static saveAds(opt) {
const url = `${URL}/ads`
return Vue.http.post(url, opt, { 'emulateJSON': true });
}
static getAdsList(opt) {
return Vue.http.get(`${URL}/ads`, { 'params': opt });
}
static adsStatus(opt) {
const url = `${URL}/adsStatus`
return Vue.http.post(url, opt, { 'emulateJSON': true });
}
static getAd(opt) {
return Vue.http.get(`${URL}/getAd`, { 'params': opt });
}
static adClick(opt) {
const url = `${URL}/adClick`
return Vue.http.post(url, opt, { 'emulateJSON': true });
}
static adImpl(opt) {
const url = `${URL}/adImpl`
return Vue.http.post(url, opt, { 'emulateJSON': true });
}
static getFirstWin(opt) {
var request = query.stringify(opt);
const url = `${URL}/firstwin?${request}`;
return Vue.http.get(url);
}
static adSwitchChange(opt) {
const url = `${URL}/adSwitchChange`
return Vue.http.post(url, opt, { 'emulateJSON': true });
}
static saveActivity(opt) {
const url = `${URL}/activity`
return Vue.http.post(url, opt, { 'emulateJSON': true });
}
static saveLabel(opt) {
const url = `${URL}/label`
return Vue.http.post(url, opt, { 'emulateJSON': true });
}
static getLabel(opt) {
return Vue.http.get(`${URL}/label`, { 'params': {} });
}
static implUrl = `${URL}/impltrack`
static clkUrl = `${URL}/clktrack`
static getMonthlyWinRate() {
let monthlyWinRateUrl = 'https://sapi.moecube.com:444/ygopro/analytics/matchup/type?source=mycard-athletic'
return Vue.http.get(monthlyWinRateUrl)
}
static getDownloadUrl(url) {
url = url.slice(7)
var downloadUrl = `${URL}/download/${url}`
return downloadUrl
}
static getCount(opt) {
var request = query.stringify(opt);
const url = `${config.COUNTER_URL}?${request}`;
return Vue.http.get(url);
}
static getUserInfo(opt) {
var request = query.stringify(opt);
const url = `${URL}/user?${request}`;
return Vue.http.get(url);
}
static getUsers(opt) {
var request = query.stringify(opt);
const url = `${URL}/users?${request}`;
return Vue.http.get(url);
}
static getUserDueHistory(opt) {
return Vue.http.get(`${URL}/history`, {'params': opt});
}
static getDownloadUrls() {
return Vue.http.get('https://api.github.com/repos/mycard/mycard/releases/latest')
}
static getAvatar(opt) {
return Vue.http.get(`https://sapi.moecube.com:444/accounts/users/${opt.username}.avatar`)
}
static getCardInfo(opt) {
var request = query.stringify(opt);
const url = `${URL}/cardinfo?${request}`;
return Vue.http.get(url);
}
static getDeckInfo(opt) {
return Vue.http.get(`${URL}/deckinfo`, {'params': opt});
}
static saveDeck(opt) {
const url = `${URL}/deckinfo`
return Vue.http.post(url, opt, {'emulateJSON': true});
}
static saveDeckDemo(opt) {
const url = `${URL}/deckdemo`
return Vue.http.post(url, opt, {'emulateJSON': true});
}
static getReport(opt) {
return Vue.http.get(`${URL}/report`, {'params': opt});
}
static getVoteList(opt) {
return Vue.http.get(`${URL}/votes`, {'params': opt});
}
static saveVote(opt) {
const url = `${URL}/votes`
return Vue.http.post(url, opt, {'emulateJSON': true});
}
static voteStatus(opt) {
const url = `${URL}/voteStatus`
return Vue.http.post(url, opt, {'emulateJSON': true});
}
static getVote(opt) {
return Vue.http.get(`${URL}/vote`, {'params': opt});
}
static submitVote(opt) {
const url = `${URL}/submitVote`
return Vue.http.post(url, opt, {'emulateJSON': true});
}
static saveAds(opt) {
const url = `${URL}/ads`
return Vue.http.post(url, opt, {'emulateJSON': true});
}
static getAdsList(opt) {
return Vue.http.get(`${URL}/ads`, {'params': opt});
}
static adsStatus(opt) {
const url = `${URL}/adsStatus`
return Vue.http.post(url, opt, {'emulateJSON': true});
}
static getAd(opt) {
return Vue.http.get(`${URL}/getAd`, {'params': opt});
}
static adClick(opt) {
const url = `${URL}/adClick`
return Vue.http.post(url, opt, {'emulateJSON': true});
}
static adImpl(opt) {
const url = `${URL}/adImpl`
return Vue.http.post(url, opt, {'emulateJSON': true});
}
static getFirstWin(opt) {
var request = query.stringify(opt);
const url = `${URL}/firstwin?${request}`;
return Vue.http.get(url);
}
static adSwitchChange(opt) {
const url = `${URL}/adSwitchChange`
return Vue.http.post(url, opt, {'emulateJSON': true});
}
static saveActivity(opt) {
const url = `${URL}/activity`
return Vue.http.post(url, opt, {'emulateJSON': true});
}
static saveLabel(opt) {
const url = `${URL}/label`
return Vue.http.post(url, opt, {'emulateJSON': true});
}
static getLabel(opt) {
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,64 +36,71 @@ ...@@ -36,64 +36,71 @@
<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>
<div class="tab-content"> <div class="tab-content">
<div role="tabpanel" class="tab-pane" :class="{ active: isActive }" v-if="isActive" <div role="tabpanel" class="tab-pane" :class="{ active: isActive }" v-if="isActive"
id="tab-0"> id="tab-0">
<br> <br>
<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="deck" class="table table-striped table-bordered table-hover example" <table id="deck" class="table table-striped table-bordered table-hover example"
:width="width"></table> :width="width"></table>
</div> </div>
</div> </div>
...@@ -101,7 +108,7 @@ ...@@ -101,7 +108,7 @@
<br> <br>
<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="monster" class="table table-striped table-bordered table-hover example" <table id="monster" class="table table-striped table-bordered table-hover example"
:width="width"></table> :width="width"></table>
</div> </div>
</div> </div>
...@@ -109,7 +116,7 @@ ...@@ -109,7 +116,7 @@
<br> <br>
<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="spell" class="table table-striped table-bordered table-hover example" <table id="spell" class="table table-striped table-bordered table-hover example"
:width="width"></table> :width="width"></table>
</div> </div>
</div> </div>
...@@ -117,7 +124,7 @@ ...@@ -117,7 +124,7 @@
<br> <br>
<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="trap" class="table table-striped table-bordered table-hover example" <table id="trap" class="table table-striped table-bordered table-hover example"
:width="width"></table> :width="width"></table>
</div> </div>
</div> </div>
...@@ -125,7 +132,7 @@ ...@@ -125,7 +132,7 @@
<br> <br>
<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="side" class="table table-striped table-bordered table-hover example" <table id="side" class="table table-striped table-bordered table-hover example"
:width="width"></table> :width="width"></table>
</div> </div>
</div> </div>
...@@ -133,13 +140,14 @@ ...@@ -133,13 +140,14 @@
<br> <br>
<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="ex" class="table table-striped table-bordered table-hover example" <table id="ex" class="table table-striped table-bordered table-hover example"
:width="width"></table> :width="width"></table>
</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>
</div> </div>
...@@ -154,300 +162,345 @@ ...@@ -154,300 +162,345 @@
</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: '请输入卡片名..',
components: { }
Footads export default {
}, components: {
created: function() { Footads
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 u = navigator.userAgent; var regex_match =
if (null == u) { /(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;
return true; var u = navigator.userAgent;
} if (null == u) {
var result = regex_match.exec(u); return true;
if (null == result) {} else { }
this.width = "250%" var result = regex_match.exec(u);
} if (null == result) {
var lang = localStorage.getItem('lang') || 'cn'; } else {
this.init(lang) this.width = "250%"
}
var lang = localStorage.getItem('lang') || 'cn';
this.init(lang)
},
mounted: function () {
this.init2();
},
data() {
return {
totalDeck: 0,
type: "",
isActive: true,
width: "100%",
img0: img0,
img1: img1,
img2: img2,
img3: img3,
img4: img4,
img5: img5,
}
},
computed: {
...mapGetters({
lang: 'getLang',
}),
},
watch: {
lang: function (val) {
// console.log('lang change1', val)
this.init2()
}, },
mounted: function() { },
this.init2(); methods: {
// 计算禁卡表发布时间间隔
// period() {
// const today = new Date();
// 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])
}, },
data() { init: function (lang) {
return { if (lang === "cn") {
this.isActive = true;
isActive: true, } else {
totalDeck: 0, this.isActive = false;
width: "100%",
img0: img0,
img1: img1,
img2: img2,
img3: img3,
img4: img4,
img5: img5,
} }
// this.lang = language[lang]
this.getCount()
}, },
computed: { init2: function () {
...mapGetters({ var lang = localStorage.getItem('lang') || 'cn';
lang: 'getLang', if (lang === "cn") {
}), this.isActive = true;
}, } else {
watch: { this.isActive = false;
lang: function(val) { }
// console.log('lang change1', val)
this.init2() var self = this;
},
}, function renderPage() {
methods: { if (monsterTable) {
navClick(data){ monsterTable.clear();
console.log('%c ---------------------src'+'\\'+'components'+'\\'+'Cards.vue---------------------%c:238','background:#f034c6','background:#14f1a4', monsterTable.destroy();
data)
$(".input-sm").attr("placeholder",placeholder[data])
},
init: function(lang) {
if (lang === "cn") {
this.isActive = true;
} else {
this.isActive = false;
} }
// this.lang = language[lang] if (spellTable) {
this.getCount() spellTable.clear();
}, spellTable.destroy();
init2: function() { }
var lang = localStorage.getItem('lang') || 'cn'; if (trapTable) {
if (lang === "cn") { trapTable.clear();
this.isActive = true; trapTable.destroy();
} else { }
this.isActive = false; if (exTable) {
exTable.clear();
exTable.destroy();
}
if (sideTable) {
sideTable.clear();
sideTable.destroy();
} }
function renderPage() { var server = $("#server").val() || "mycard"
if (monsterTable) { var source = $("#source").val() || "athletic"
monsterTable.clear(); var final_source = server + "-" + source
monsterTable.destroy();
} $.get('https://sapi.moecube.com:444/ygopro/analytics/single/type', {
if (spellTable) { type: $("#type").val(),
spellTable.clear(); lang: localStorage.getItem('lang') || 'cn',
spellTable.destroy(); extra: 'name',
} source: final_source
if (trapTable) { }, function (data) {
trapTable.clear(); var monster = data.monster;
trapTable.destroy(); var spell = data.spell;
} var trap = data.trap;
if (exTable) { var side = data.side;
exTable.clear(); var ex = data.ex;
exTable.destroy();
} monsterTable = renderTable("#monster", monster);
if (sideTable) { spellTable = renderTable("#spell", spell);
sideTable.clear(); trapTable = renderTable("#trap", trap);
sideTable.destroy(); exTable = renderTable("#ex", ex);
sideTable = renderTable("#side", side);
});
var lang = localStorage.getItem('lang') || 'cn';
if (lang === "cn") {
if (deckTable) {
deckTable.clear();
deckTable.destroy();
} }
var server = $("#server").val() || "mycard"
var source = $("#source").val() || "athletic" $.get('https://sapi.moecube.com:444/ygopro/analytics/deck/type', {
var final_source = server + "-" + source
$.get('https://sapi.moecube.com:444/ygopro/analytics/single/type', {
type: $("#type").val(), type: $("#type").val(),
lang: localStorage.getItem('lang') || 'cn',
extra: 'name',
source: final_source source: final_source
}, function(data) { }, function (data) {
var monster = data.monster; var obj = data;
var spell = data.spell; if (typeof obj === 'string')
var trap = data.trap; obj = JSON.parse(data);
var side = data.side;
var ex = data.ex; var rank = 1;
monsterTable = renderTable("#monster", monster) var processData = obj.map(function (x) {
spellTable = renderTable("#spell", spell) var tagStr = [];
trapTable = renderTable("#trap", trap) var deckName = x.name;
exTable = renderTable("#ex", ex) for (var i = 0; i < x.tags.length; i++) {
sideTable = renderTable("#side", side) var tagName = x.tags[i].name || x.tags[i].toString() || "";
}); var short_tagName = tagName.replace(deckName + "-", "");
//卡组api https://sapi.moecube.com:444/ygopro/analytics/deck/type?type=day&source=mycard-entertain tagStr.push(short_tagName)
//只显示中文 }
var lang = localStorage.getItem('lang') || 'cn'; var PickRate = (0 < (x.count / (self.totalDeck)) && (x.count / (self.totalDeck)) < 1)
if (lang === "cn") { ? ((x.count / (self.totalDeck) * 100)).toFixed(2) + "%" : "-";
if (deckTable) {
deckTable.clear(); // 出现-是数据算出来不在0-1之间
deckTable.destroy(); return [rank++, x.name, x.count, PickRate, tagStr.join(" , ")];
} });
$.get('https://sapi.moecube.com:444/ygopro/analytics/deck/type', {
type: $("#type").val(), deckTable = $("#deck").DataTable({
source: final_source data: processData,
}, function(data) { pageLength: 25,
var obj = data; order: [
if (typeof obj === 'string') [2, "desc"]
obj = JSON.parse(data); ],
var rank = 1; ordering: true,
var processData = obj.map(function(x) { columns: [
var tagStr = []; {title: tb_language[lang].rank},
var deckName = x.name; {title: tb_language[lang].deck},
for (var i = 0; i < x.tags.length; i++) { {title: tb_language[lang].count},
var tagName = x.tags[i].name || x.tags[i].toString() || ""; {title: tb_language[lang].PickRate},
var short_tagName = tagName.replace(deckName + "-", ""); {title: tb_language[lang].topTags},
tagStr.push(short_tagName) ],
} columnDefs: [
return [rank++, x.name, x.count, tagStr.join(" , ")]; {
}); render: function (data, type, row) {
deckTable = $("#deck").DataTable({ return "<a href='?name=" + data + "#/deck'>" + data + "</a>";
data: processData,
pageLength: 25,
order: [
[2, "desc"]
],
"ordering": true,
columns: [{
title: tb_language[lang].rank
},
{
title: tb_language[lang].deck
},
{
title: tb_language[lang].count
},
{
title: tb_language[lang].topTags
},
],
"columnDefs": [{
"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 targets: 1
}, ], }
"language": tb_language[lang] ],
}); language: tb_language[lang]
}); });
} });
} }
}
function renderTable(tableID, tableData) { function renderTable(tableID, tableData) {
tableData = tableData || []; tableData = tableData || [];
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) + "%" : "-";
});
var table = $(tableID).DataTable({ // 使用率出现-是数据算出来不在0-1之间
data: processData, return [
pageLength: 50, rank++, d.name ? d.name[langIndex] : "未知卡片",
order: [ d.frequency,
[2, "desc"] PickRate,
], d.putone,
"ordering": true, d.puttwo,
columns: [{ d.putthree,
title: tb_language[lang].rank d.id
}, ];
{ });
title: tb_language[lang].cardName
}, var table = $(tableID).DataTable({
{ data: processData,
title: tb_language[lang].used pageLength: 50,
}, order: [[2, "desc"]],
{ ordering: true,
title: tb_language[lang].put1 columns: [
}, {title: tb_language[lang].rank},
{ {title: tb_language[lang].cardName},
title: tb_language[lang].put2 {title: tb_language[lang].used},
}, {title: tb_language[lang].PickRate},
{ {title: tb_language[lang].put1},
title: tb_language[lang].put3 {title: tb_language[lang].put2},
}, {title: tb_language[lang].put3},
], ],
"columnDefs": [{ columnDefs: [
"render": function(data, type, row) { {
return "<a href='https://www.ourocg.cn/search/" + row[6] + render: function (data, type, row) {
"'>" + data + "</a>"; return "<a href='https://www.ourocg.cn/search/" + row[7] + "'>" + data + "</a>";
}, },
"targets": 1 targets: 1
}, ], },
"language": tb_language[lang] ],
}); language: tb_language[lang]
$(".input-sm").attr("placeholder",placeholder.Deck)
return table;
}
renderPage();
$("#search").click(function() {
renderPage();
return false;
})
},
onChange: function() {
$("#search").trigger('click')
this.getCount()
},
getCount: function() {
var server = $("#server").val() || "mycard"
var source = $("#source").val() || "athletic"
var opt = {
type: $("#type").val() || "day",
source: server + "-" + source
}
var self = this
API.getCount(opt).then((res) => {
if (isNaN(res.data)) {
self.totalDeck = 0
} else {
self.totalDeck = res.data
}
}); });
$(".input-sm").attr("placeholder", placeholder.Deck);
return table;
} }
renderPage();
$("#search").click(function () {
renderPage();
return false;
});
}, },
events: { onChange: function () {
'lang-change': function(lang) { var self = this;
this.init(lang) this.getCount().then(function () {
this.onChange() self.init2();
} });
}, },
}
getCount: function () {
var server = $("#server").val() || "mycard"
var source = $("#source").val() || "athletic"
var opt = {
type: $("#type").val() || "day",
source: server + "-" + source
};
var self = this;
return API.getCount(opt).then((res) => {
if (isNaN(res.data)) {
return 0;
} else {
this.totalDeck = res.data;
return res.data;
}
});
}
},
events: {
'lang-change': function (lang) {
this.init(lang)
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>
\ No newline at end of file
...@@ -6,121 +6,139 @@ ...@@ -6,121 +6,139 @@
<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>
</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.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,99 +153,99 @@ ...@@ -138,99 +153,99 @@
</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'
var rankTable; import tb_language from './tb_lang.js'
var rankTable2;
import moment from 'moment'
import tb_language from './tb_lang.js' var rankTable;
var rankTable2;
export default { var rankTable3;
data() {
return {
isMobile: false, export default {
activity: { data() {
today: 0, return {
name: '新年充电活动', isMobile: false,
max: '15' activity: {
}, today: 0,
showActivity: false, name: '新年充电活动',
user_info: { max: '15'
exp: 0, },
pt: 500, showActivity: false,
entertain_win: 0, user_info: {
entertain_lose: 0, exp: 0,
entertain_draw: 0, pt: 500,
entertain_all: 0, entertain_win: 0,
entertain_wl_ratio: 0, entertain_lose: 0,
exp_rank: 0, entertain_draw: 0,
athletic_win: 0, entertain_all: 0,
athletic_lose: 0, entertain_wl_ratio: 0,
athletic_draw: 0, exp_rank: 0,
athletic_all: 0, athletic_win: 0,
athletic_wl_ratio: 0, athletic_lose: 0,
arena_rank: 0 athletic_draw: 0,
} athletic_all: 0,
} athletic_wl_ratio: 0,
}, arena_rank: 0
computed: { },
...mapGetters({ }
lang: 'getLang', },
user: 'getUser' computed: {
}), ...mapGetters({
}, lang: 'getLang',
user: 'getUser'
}),
},
mounted: function () {
var _this = this
$("#search").click(function () { mounted: function () {
_this.renderPage(); var _this = this
}) $("#search").click(function () {
// this.init() _this.renderPage();
// window.onhashchange = this.init; })
this.renderPage(); // this.init()
}, // window.onhashchange = this.init;
this.renderPage();
},
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 u = navigator.userAgent; 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;
if (null == u) { var u = navigator.userAgent;
return true; if (null == u) {
} return true;
var result = regex_match.exec(u); }
if (null == result) { var result = regex_match.exec(u);
this.isMobile = false; if (null == result) {
} else { this.isMobile = false;
this.isMobile = true; } else {
} this.isMobile = true;
}
let opt = {
'username': this.user.username let opt = {
} 'username': this.user.username
}
API.getUserInfo(opt).then((res) => {
this.user_info = res.data API.getUserInfo(opt).then((res) => {
console.log('%c ---------------------src'+'\\'+'components'+'\\'+'Profile.vue---------------------%c:219','background:#ed162b','background:#7d382d', this.user_info = res.data
res) // console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:219', 'background:#ed162b', 'background:#7d382d',
}); // res)
}, });
},
methods: {
methods: {
exchangeUserInfo(info){
let userName=this.user.username exchangeUserInfo(info) {
let exchangeInfo=info let userName = this.user.username
if(info.usernamea!=userName) let exchangeInfo = info
{ 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,157 +261,251 @@ ...@@ -246,157 +261,251 @@
"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', }
exchangeInfo) // console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:227', 'background:#1b5fbd', 'background:#ce8e6b',
return exchangeInfo // exchangeInfo)
}, return exchangeInfo
init: function () { },
},
init: function () {
},
renderPage: function () {
if (rankTable) {
rankTable.destroy();
}
if (rankTable2) {
rankTable2.destroy();
}
if (rankTable3) {
rankTable3.destroy();
}
var username = this.user.username
var type = 1;
rankTable = this.renderRankTable("#athletic_rank", [], "DP");
rankTable2 = this.renderRankTable("#entertain_rank", [], "");
rankTable3 = this.renderRankTable3("#monthly_rank", [], "");
if (!username) return;
API.getUserDueHistory({username: username, type: "1", page_num: 100}).then((res) => {
renderPage: function () {
if (rankTable) { if (rankTable) {
rankTable.destroy(); rankTable.destroy();
} }
rankTable = this.renderRankTable("#athletic_rank", res.data.data, "DP")
}, (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, "")
}, (res) => {
// console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:258', 'background:#ef98b5', 'background:#53116e',
// res)
});
var username = this.user.username // 获取用户每个月的战斗历史数据
var type = 1; var monthly = [];
function fetchData(username, monthOffset) {
rankTable = this.renderRankTable("#athletic_rank", [], "DP"); var date = moment().subtract(monthOffset, 'months').format('YYYY-MM');
rankTable2 = this.renderRankTable("#entertain_rank", [], ""); let opt = {
'username': username,
if (!username) return; 'season': date,
};
API.getUserDueHistory({ username: username, type: "1", page_num: 100 }).then((res) => { return API.getMonthlyHistory(opt)
.then(response => {
if (rankTable) { const res = response.data;
rankTable.destroy(); // console.log(res);
} // 判断是否有返回数据
rankTable = this.renderRankTable("#athletic_rank", res.data.data, "DP") if (res) {
// 继续请求前一个月的数据
}, (res) => { monthly.push(res);
return fetchData(username, monthOffset + 1);
}); } else {
// 当不再返回数据时,结束递归,并返回最终的 monthly 数组
API.getUserDueHistory({ username: username, type: "2", page_num: 100 }).then((res) => { return monthly;
if (rankTable2) { }
rankTable2.destroy(); });
} }
rankTable2 = this.renderRankTable("#entertain_rank", res.data.data, "") fetchData(username, 1).then(res => {
}, (res) => { if (rankTable3) {
console.log('%c ---------------------src'+'\\'+'components'+'\\'+'Profile.vue---------------------%c:258','background:#ef98b5','background:#53116e', rankTable3.destroy();
res) }
}); rankTable3 = this.renderRankTable3("#monthly_rank", monthly, "")
});
var _this = this;
API.getFirstWin({ username: username }).then((res) => {
_this.activity = res.data
if (_this.activity.name && _this.activity.name.trim().length > 0) {
_this.showActivity = true;
}
}, (res) => {
console.log('%c ---------------------src'+'\\'+'components'+'\\'+'Profile.vue---------------------%c:271','background:#c85336','background:#a4c933',
res)
});
},
renderRankTable: function (id, tableData, ttype) {
tableData = tableData || [];
var lang = localStorage.getItem('lang') || 'cn';
var rank = 1; var _this = this;
console.log('%c ---------------------src'+'\\'+'components'+'\\'+'Profile.vue---------------------%c:284','background:#c896f3','background:#f332b2', API.getFirstWin({username: username}).then((res) => {
tableData) _this.activity = res.data
if (_this.activity.name && _this.activity.name.trim().length > 0) {
_this.showActivity = true;
}
}, (res) => {
// console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:271', 'background:#c85336', 'background:#a4c933',
// res)
});
},
let that=this renderRankTable: function (id, tableData, ttype) {
var processData = tableData.map(function (d) { tableData = tableData || [];
d=that.exchangeUserInfo(d) var lang = localStorage.getItem('lang') || 'cn';
return [d.usernamea, d.usernameb, moment(d.start_time).format('YYYY-MM-DD HH:mm'), var rank = 1;
// console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:284', 'background:#c896f3', 'background:#f332b2',
// tableData)
let that = this
var processData = tableData.map(function (d) {
d = that.exchangeUserInfo(d)
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];
}); });
var table = $(id).DataTable({ var table = $(id).DataTable({
paging: true, paging: true,
searching: false, searching: false,
ordering: false, ordering: false,
lengthChange: false, lengthChange: false,
info: false, info: false,
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": [
{ {
"render": function (data, type, row) { "render": function (data, type, row) {
var userscorea = row[4]; var userscorea = row[4];
var userscoreb = row[5]; var userscoreb = row[5];
var diff = (parseFloat(row[6]) - parseFloat(row[7])).toFixed(2) var diff = (parseFloat(row[6]) - parseFloat(row[7])).toFixed(2)
if (diff > 0) { if (diff > 0) {
diff = "+" + diff diff = "+" + diff
} }
var append = diff + ttype var append = diff + ttype
if (ttype === "") { if (ttype === "") {
append = "" append = ""
} }
if (userscorea < 0) { if (userscorea < 0) {
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'><span class='label label-danger'>" + data + "</span></a> " + append; return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'><span class='label label-danger'>" + data + "</span></a> " + append;
} }
if (userscorea > userscoreb) { if (userscorea > userscoreb) {
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'><span class='label label-success'>" + data + "</span></a> " + append; return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'><span class='label label-success'>" + data + "</span></a> " + append;
} }
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'><span class='label label-info'>" + data + "</span></a> " + append; return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'><span class='label label-info'>" + data + "</span></a> " + append;
},
"targets": 0
}, },
{ "targets": 0
"render": function (data, type, row) { },
var userscorea = row[4]; {
var userscoreb = row[5]; "render": function (data, type, row) {
var diff = (parseFloat(row[8]) - parseFloat(row[9])).toFixed(2) var userscorea = row[4];
if (diff > 0) { var userscoreb = row[5];
diff = "+" + diff var diff = (parseFloat(row[8]) - parseFloat(row[9])).toFixed(2)
} if (diff > 0) {
var append = diff + ttype diff = "+" + diff
if (ttype === "") { }
append = "" var append = diff + ttype
} if (ttype === "") {
if (userscoreb < 0) { append = ""
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'><span class='label label-danger'>" + data + "</span></a> " + append; }
} if (userscoreb < 0) {
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'><span class='label label-danger'>" + data + "</span></a> " + append;
if (userscorea < userscoreb) { }
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'><span class='label label-success'>" + data + "</span></a> " + append;
} if (userscorea < userscoreb) {
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'><span class='label label-success'>" + data + "</span></a> " + append;
return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'><span class='label label-info'>" + data + "</span></a> " + append; }
},
"targets": 1 return "<a href='#/userinfo?username=" + encodeURIComponent(data) + "'><span class='label label-info'>" + data + "</span></a> " + append;
}, },
], "targets": 1
"language": lang === 'en' ? tb_language.en : tb_language.cn },
}); ],
"language": lang === 'en' ? tb_language.en : tb_language.cn
});
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>
\ No newline at end of file
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
}, },
mounted: function() { mounted: function() {
this.init2(); this.init2();
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
...@@ -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, // 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].name visible: false, // Hide the username column,
}, },
{ {
title: tb_language[lang].exp title: tb_language[lang].pt,
}, },
{ {
title: tb_language[lang].win title: tb_language[lang].win,
}, },
{ {
title: tb_language[lang].lose 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>';
},
}, },
{ {
title: tb_language[lang].pt visible: false, // Hide the username column
},
{
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();
...@@ -245,9 +276,9 @@ ...@@ -245,9 +276,9 @@
renderPage(); renderPage();
return false; return false;
}) })
} }
}, },
...@@ -255,7 +286,7 @@ ...@@ -255,7 +286,7 @@
'lang-change': function(lang) { 'lang-change': function(lang) {
this.init(lang) this.init(lang)
$("#search").trigger('click') $("#search").trigger('click')
} }
}, },
} }
...@@ -270,4 +301,17 @@ ...@@ -270,4 +301,17 @@
.scroll { .scroll {
width: 250%; width: 250%;
} }
</style> </style>
\ No newline at end of file <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.',
......
module.exports = { module.exports = {
cn: { cn: {
"sProcessing": "处理中...", "sProcessing": "处理中...",
"sLengthMenu": "显示 _MENU_ 项结果", "sLengthMenu": "显示 _MENU_ 项结果",
"sZeroRecords": "没有匹配结果", "sZeroRecords": "没有匹配结果",
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项", "sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项", "sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
"sInfoFiltered": "(由 _MAX_ 项结果过滤)", "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
"sInfoPostFix": "", "sInfoPostFix": "",
"sSearch": "搜索:", "sSearch": "搜索:",
"sUrl": "", "sUrl": "",
"sEmptyTable": "表中数据为空", "sEmptyTable": "表中数据为空",
"sLoadingRecords": "载入中...", "sLoadingRecords": "载入中...",
"sInfoThousands": ",", "sInfoThousands": ",",
"oPaginate": { "oPaginate": {
"sFirst": "首页", "sFirst": "首页",
"sPrevious": "上页", "sPrevious": "上页",
"sNext": "下页", "sNext": "下页",
"sLast": "末页" "sLast": "末页"
}, },
"oAria": { "oAria": {
"sSortAscending": ": 以升序排列此列", "sSortAscending": ": 以升序排列此列",
"sSortDescending": ": 以降序排列此列" "sSortDescending": ": 以降序排列此列"
}, },
rank: "排名", rank: "排名",
name: "用户名", name: "用户名",
exp: "EXP", exp: "EXP",
pt: "D.P", pt: "D.P",
win: "胜局", win: "胜局",
lose: "负局", lose: "负局",
wl: "胜率", wl: "胜率",
athleticWin:'竞技场胜利',
cardName: "卡名", athleticLose:'竞技场失败',
used: "使用量", season:'时间',
put1: "投入1", total:'合计',
put2: "投入2", cardName: "卡名",
put3: "投入3", used: "使用量",
put1: "投入1",
put2: "投入2",
put3: "投入3",
deck: "卡组", deck: "卡组",
count: "使用数", count: "使用数",
topTags: "热门标签", PickRate : "使用率",
topTags: "热门标签",
playerA: '玩家A', playerA: '玩家A',
playerB: '玩家B', playerB: '玩家B',
startTime: '开始时间', startTime: '开始时间',
endTime: '结束时间', endTime: '结束时间',
},
en: {
"oPaginate": {
"sPrevious": "Pre",
}, },
en: { rank: "Rank",
"oPaginate": { name: "Name",
"sPrevious": "Pre", exp: "EXP",
}, pt: "D.P",
rank: "Rank", win: "Win",
name: "Name", lose: "Lose",
exp: "EXP", wl: "W/L",
pt: "D.P",
win: "Win",
lose: "Lose",
wl: "W/L",
cardName: "Card Name",
used: "Used",
put1: "Put one ",
put2: "Put two ",
put3: "Put three ",
deck: "Deck", cardName: "Card Name",
count: "Count", used: "Used",
topTags: "Top Tags", PickRate:"Pick Rate",
put1: "Put one ",
put2: "Put two ",
put3: "Put three ",
athleticWin:'Win',
athleticLose:'Lose',
season:'Time',
total:'Total',
deck: "Deck",
count: "Count",
topTags: "Top Tags",
playerA: 'PlayerA', playerA: 'PlayerA',
playerB: 'PlayerA', playerB: 'PlayerA',
startTime: 'Start Time', startTime: 'Start Time',
endTime: 'End Time', endTime: 'End Time',
} }
} }
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