Commit 70426323 authored by Tang Xinwei's avatar Tang Xinwei

Revert "纠正api.js中的错误"

This reverts commit d6cce876.
parent 57c7d822
......@@ -8,7 +8,6 @@
"name": "ygopro-arena-web",
"version": "1.0.0",
"dependencies": {
"axios": "^1.4.0",
"bootstrap": "5.1.3",
"chokidar": "^3.5.2",
"datatables.net": "1.11.3",
......@@ -20,7 +19,7 @@
"glob-parent": "^6.0.2",
"is-svg": "^4.3.2",
"js-yaml": "2.1.3",
"moment": "^2.29.4",
"moment": "^2.29.1",
"normalize-wheel": "^1.0.1",
"parse-asn1": "^5.1.6",
"resize-observer-polyfill": "^1.5.1",
......@@ -30,7 +29,7 @@
"uuid": "3.1.0",
"vue": "2.5.17",
"vue-clipboard2": "0.3.1",
"vue-resource": "^1.3.4",
"vue-resource": "1.3.4",
"vue-router": "2.2.0",
"vuex": "2.4.0",
"watchpack": "2.3.1",
......@@ -336,11 +335,6 @@
"babel-runtime": "6.x"
}
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/atob": {
"version": "2.1.2",
"license": "(MIT OR Apache-2.0)",
......@@ -364,16 +358,6 @@
"postcss-value-parser": "^3.2.3"
}
},
"node_modules/axios": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz",
"integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==",
"dependencies": {
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/babel-code-frame": {
"version": "6.26.0",
"dev": true,
......@@ -1696,17 +1680,6 @@
"has": "^1.0.1"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/commander": {
"version": "2.17.1",
"dev": true,
......@@ -2181,14 +2154,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/delegate": {
"version": "3.2.0",
"license": "MIT"
......@@ -2861,9 +2826,9 @@
"license": "MIT"
},
"node_modules/follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
"version": "1.14.7",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
"funding": [
{
"type": "individual",
......@@ -2886,19 +2851,6 @@
"node": ">=0.10.0"
}
},
"node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/forwarded": {
"version": "0.2.0",
"dev": true,
......@@ -4070,6 +4022,7 @@
},
"node_modules/mime-db": {
"version": "1.51.0",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.6"
......@@ -4077,6 +4030,7 @@
},
"node_modules/mime-types": {
"version": "2.1.34",
"dev": true,
"license": "MIT",
"dependencies": {
"mime-db": "1.51.0"
......@@ -4157,9 +4111,8 @@
}
},
"node_modules/moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
"version": "2.29.1",
"license": "MIT",
"engines": {
"node": "*"
}
......@@ -5393,11 +5346,6 @@
"node": ">= 0.10"
}
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"node_modules/prr": {
"version": "1.0.1",
"dev": true,
......@@ -6888,8 +6836,7 @@
},
"node_modules/vue-resource": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/vue-resource/-/vue-resource-1.3.4.tgz",
"integrity": "sha512-YG0ImXwgukCuGrH9PkftyKprdp5Xv62csda1f+ST2nYqCujXfXyredZPViRo/8LtgtlHQyyXFiZSVAsIwBLJrA==",
"license": "MIT",
"dependencies": {
"got": "^7.0.0"
}
......@@ -7734,11 +7681,6 @@
"babel-runtime": "6.x"
}
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"atob": {
"version": "2.1.2"
},
......@@ -7754,16 +7696,6 @@
"postcss-value-parser": "^3.2.3"
}
},
"axios": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz",
"integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==",
"requires": {
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"babel-code-frame": {
"version": "6.26.0",
"dev": true,
......@@ -8830,14 +8762,6 @@
"has": "^1.0.1"
}
},
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": {
"delayed-stream": "~1.0.0"
}
},
"commander": {
"version": "2.17.1",
"dev": true
......@@ -9201,11 +9125,6 @@
"version": "1.0.0",
"dev": true
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
},
"delegate": {
"version": "3.2.0"
},
......@@ -9682,23 +9601,13 @@
"dev": true
},
"follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
"version": "1.14.7",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ=="
},
"for-in": {
"version": "1.0.2"
},
"form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
},
"forwarded": {
"version": "0.2.0",
"dev": true
......@@ -10458,10 +10367,12 @@
"dev": true
},
"mime-db": {
"version": "1.51.0"
"version": "1.51.0",
"dev": true
},
"mime-types": {
"version": "2.1.34",
"dev": true,
"requires": {
"mime-db": "1.51.0"
}
......@@ -10513,9 +10424,7 @@
}
},
"moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
"version": "2.29.1"
},
"ms": {
"version": "2.0.0"
......@@ -11411,11 +11320,6 @@
"ipaddr.js": "1.9.1"
}
},
"proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"prr": {
"version": "1.0.1",
"dev": true
......@@ -12460,8 +12364,6 @@
},
"vue-resource": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/vue-resource/-/vue-resource-1.3.4.tgz",
"integrity": "sha512-YG0ImXwgukCuGrH9PkftyKprdp5Xv62csda1f+ST2nYqCujXfXyredZPViRo/8LtgtlHQyyXFiZSVAsIwBLJrA==",
"requires": {
"got": "^7.0.0"
}
......
......@@ -10,7 +10,6 @@
"replace": "sed -r -i 's/href=\\.\\//href=https:\\/\\/cdn02.moecube.com:444\\/ygopro\\//g' ./dist/index.html"
},
"dependencies": {
"axios": "^1.4.0",
"bootstrap": "5.1.3",
"chokidar": "^3.5.2",
"datatables.net": "1.11.3",
......@@ -22,7 +21,7 @@
"glob-parent": "^6.0.2",
"is-svg": "^4.3.2",
"js-yaml": "2.1.3",
"moment": "^2.29.4",
"moment": "^2.29.1",
"normalize-wheel": "^1.0.1",
"parse-asn1": "^5.1.6",
"resize-observer-polyfill": "^1.5.1",
......@@ -32,7 +31,7 @@
"uuid": "3.1.0",
"vue": "2.5.17",
"vue-clipboard2": "0.3.1",
"vue-resource": "^1.3.4",
"vue-resource": "1.3.4",
"vue-router": "2.2.0",
"vuex": "2.4.0",
"watchpack": "2.3.1",
......
......@@ -16,13 +16,11 @@ export default class Api {
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 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
static getDownloadUrl(url) {
url = url.slice(7)
......@@ -41,6 +39,15 @@ export default class Api {
const url = `${URL}/user?${request}`;
return Vue.http.get(url);
}
static getUserInfoMonth(opt) {
var request = query.stringify(opt);
const url = `${URL}/user?${request}`;
return Vue.http.get(url);
}
// https://sapi.moecube.com:444/ygopro/arena/historyScore?username=id&season=yyyy-mm
static getUsers(opt) {
var request = query.stringify(opt);
......@@ -52,6 +59,9 @@ export default class Api {
return Vue.http.get(`${URL}/history`, {'params': opt});
}
static getDownloadUrls() {
return Vue.http.get('https://api.github.com/repos/mycard/mycard/releases/latest')
}
......@@ -160,9 +170,4 @@ export default class Api {
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
}
......@@ -158,14 +158,12 @@
import querystring from 'querystring';
import API from '../api'
import {mapGetters} from 'vuex'
import moment from 'moment'
import tb_language from './tb_lang.js'
var rankTable;
var rankTable2;
var rankTable3;
import moment from 'moment'
import tb_language from './tb_lang.js'
export default {
data() {
......@@ -192,7 +190,7 @@ export default {
athletic_all: 0,
athletic_wl_ratio: 0,
arena_rank: 0
},
}
}
},
computed: {
......@@ -234,8 +232,8 @@ export default {
API.getUserInfo(opt).then((res) => {
this.user_info = res.data
// console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:219', 'background:#ed162b', 'background:#7d382d',
// res)
console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:219', 'background:#ed162b', 'background:#7d382d',
res)
});
},
......@@ -268,8 +266,8 @@ export default {
}
// 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',
exchangeInfo)
return exchangeInfo
},
init: function () {
......@@ -314,52 +312,33 @@ export default {
}
rankTable2 = this.renderRankTable("#entertain_rank", res.data.data, "")
}, (res) => {
// console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:258', 'background:#ef98b5', 'background:#53116e',
// res)
console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:258', 'background:#ef98b5', 'background:#53116e',
res)
});
// 每月决斗记录数据获取
var monthly = [];
function fetchData(username, monthOffset) {
var date = moment().subtract(monthOffset, 'months').format('YYYY-MM');
// 发送请求获取数据
var opt = { username: username, season: date };
return API.getMonthlyHistory(opt)
.then(response => {
const res = response.data;
// 判断是否有返回数据
if (res && res.length > 0) {
// 将每次收到的数据按照season从今日往更早的顺序存储在monthly数组中
console.log(opt);
console.log(res);
monthly.unshift(...res);
// 继续请求前一个月的数据
return fetchData(username, monthOffset + 1);
} else {
// 当不再返回数据时,结束递归,并返回最终的monthly数组
console.log(opt);
console.log('之后没数据了');
return monthly;
}});}
// 调用递归函数开始请求数据
fetchData(username, -1);
console.log(111)
console.log(monthly)
var season = new Date().toISOString().slice(0, 7);
API.getMonthlyHistory({username: username, season:season}).then((res) => {
if (rankTable3) {
rankTable3.destroy();
}
rankTable3 = this.renderRankTable("#monthly_rank", res.data.data, "")
}, (res) => {
console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:258', 'background:#ef98b5', 'background:#53116e',
res)
});
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)
console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:271', 'background:#c85336', 'background:#a4c933',
res)
});
},
......@@ -368,8 +347,8 @@ export default {
var lang = localStorage.getItem('lang') || 'cn';
var rank = 1;
// console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:284', 'background:#c896f3', 'background:#f332b2',
// tableData)
console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:284', 'background:#c896f3', 'background:#f332b2',
tableData)
let that = this
......
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