Commit d6cce876 authored by 铃兰's avatar 铃兰

纠正api.js中的错误

parent 4df00855
......@@ -8,6 +8,7 @@
"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",
......@@ -19,7 +20,7 @@
"glob-parent": "^6.0.2",
"is-svg": "^4.3.2",
"js-yaml": "2.1.3",
"moment": "^2.29.1",
"moment": "^2.29.4",
"normalize-wheel": "^1.0.1",
"parse-asn1": "^5.1.6",
"resize-observer-polyfill": "^1.5.1",
......@@ -29,7 +30,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",
......@@ -335,6 +336,11 @@
"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)",
......@@ -358,6 +364,16 @@
"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,
......@@ -1680,6 +1696,17 @@
"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,
......@@ -2154,6 +2181,14 @@
"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"
......@@ -2826,9 +2861,9 @@
"license": "MIT"
},
"node_modules/follow-redirects": {
"version": "1.14.7",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
"funding": [
{
"type": "individual",
......@@ -2851,6 +2886,19 @@
"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,
......@@ -4022,7 +4070,6 @@
},
"node_modules/mime-db": {
"version": "1.51.0",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.6"
......@@ -4030,7 +4077,6 @@
},
"node_modules/mime-types": {
"version": "2.1.34",
"dev": true,
"license": "MIT",
"dependencies": {
"mime-db": "1.51.0"
......@@ -4111,8 +4157,9 @@
}
},
"node_modules/moment": {
"version": "2.29.1",
"license": "MIT",
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
"engines": {
"node": "*"
}
......@@ -5346,6 +5393,11 @@
"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,
......@@ -6836,7 +6888,8 @@
},
"node_modules/vue-resource": {
"version": "1.3.4",
"license": "MIT",
"resolved": "https://registry.npmjs.org/vue-resource/-/vue-resource-1.3.4.tgz",
"integrity": "sha512-YG0ImXwgukCuGrH9PkftyKprdp5Xv62csda1f+ST2nYqCujXfXyredZPViRo/8LtgtlHQyyXFiZSVAsIwBLJrA==",
"dependencies": {
"got": "^7.0.0"
}
......@@ -7681,6 +7734,11 @@
"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"
},
......@@ -7696,6 +7754,16 @@
"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,
......@@ -8762,6 +8830,14 @@
"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
......@@ -9125,6 +9201,11 @@
"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"
},
......@@ -9601,13 +9682,23 @@
"dev": true
},
"follow-redirects": {
"version": "1.14.7",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ=="
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
},
"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
......@@ -10367,12 +10458,10 @@
"dev": true
},
"mime-db": {
"version": "1.51.0",
"dev": true
"version": "1.51.0"
},
"mime-types": {
"version": "2.1.34",
"dev": true,
"requires": {
"mime-db": "1.51.0"
}
......@@ -10424,7 +10513,9 @@
}
},
"moment": {
"version": "2.29.1"
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
},
"ms": {
"version": "2.0.0"
......@@ -11320,6 +11411,11 @@
"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
......@@ -12364,6 +12460,8 @@
},
"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,6 +10,7 @@
"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",
......@@ -21,7 +22,7 @@
"glob-parent": "^6.0.2",
"is-svg": "^4.3.2",
"js-yaml": "2.1.3",
"moment": "^2.29.1",
"moment": "^2.29.4",
"normalize-wheel": "^1.0.1",
"parse-asn1": "^5.1.6",
"resize-observer-polyfill": "^1.5.1",
......@@ -31,7 +32,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,11 +16,13 @@ export default class Api {
static clkUrl = `${URL}/clktrack`
static getMonthlyHistory(opt) {
const url = `https://sapi.moecube.com:444/ygopro/arena/historyScore`;
return Vue.http.get(url, { params: opt });
static getMonthlyWinRate() {
let monthlyWinRateUrl = 'https://sapi.moecube.com:444/ygopro/analytics/matchup/type?source=mycard-athletic'
return Vue.http.get(monthlyWinRateUrl)
}
// https://sapi.moecube.com:444/ygopro/arena/historyScore?username=id&season=yyyy-mm
static getDownloadUrl(url) {
url = url.slice(7)
......@@ -39,15 +41,6 @@ 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);
......@@ -59,9 +52,6 @@ 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')
}
......@@ -170,4 +160,9 @@ 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,12 +158,14 @@
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() {
......@@ -190,7 +192,7 @@ export default {
athletic_all: 0,
athletic_wl_ratio: 0,
arena_rank: 0
}
},
}
},
computed: {
......@@ -232,8 +234,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)
});
},
......@@ -266,8 +268,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 () {
......@@ -312,33 +314,52 @@ 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 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 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 _this = this;
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)
});
},
......@@ -347,8 +368,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