Commit b849e68c authored by 铃兰's avatar 铃兰

纠正api.js中的错误

parent d6cce876
Pipeline #22656 passed with stages
in 2 minutes and 23 seconds
...@@ -319,37 +319,6 @@ export default { ...@@ -319,37 +319,6 @@ export default {
}); });
// 每月决斗记录数据获取
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) => { API.getFirstWin({username: username}).then((res) => {
......
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