|
@@ -121,6 +121,7 @@ Page({
|
|
|
that.setData({ match_id: options.match_id, group_id: options.group_id, project_id: options.project_id })
|
|
|
await this.search();
|
|
|
await this.searchUser();
|
|
|
+ that.searchLevel();
|
|
|
},
|
|
|
/**
|
|
|
* 查询函数
|
|
@@ -161,6 +162,48 @@ Page({
|
|
|
this.setTopPlayerName();
|
|
|
}
|
|
|
},
|
|
|
+ searchLevel: function (e) {
|
|
|
+ const that = this;
|
|
|
+ let nodes = that.data.winData.nodes;
|
|
|
+ nodes = nodes.filter(f => !f.id.includes('l'));
|
|
|
+ let mls = nodes.map(i => i.level);
|
|
|
+ let marr = [];
|
|
|
+ for (const i of mls) {
|
|
|
+ if (!marr.includes(i)) marr.push(i)
|
|
|
+ }
|
|
|
+ const group = marr.map(i => {
|
|
|
+ const list = nodes.filter(f => f.level == i)
|
|
|
+ return list;
|
|
|
+ })
|
|
|
+ const schList = that.data.schList;
|
|
|
+ for (const i of nodes) {
|
|
|
+ const { level, id } = i;
|
|
|
+ const r1 = group.find(f => f[0].level == level)
|
|
|
+ let J1 = r1.length, J2 = J1 / 2;
|
|
|
+ const r2 = schList.find(f => f.player_one_node == id)
|
|
|
+ if (!r2) continue;
|
|
|
+ r2.J1 = J1, r2.J2 = J2;
|
|
|
+ }
|
|
|
+ // let levels = {};
|
|
|
+ // for (const val of nodes) {
|
|
|
+ // let level = val.level;
|
|
|
+ // levels[level];
|
|
|
+ // if (levels[level]) {
|
|
|
+ // levels[level].push(val);
|
|
|
+ // } else {
|
|
|
+ // let dui = [val];
|
|
|
+ // levels[level] = dui;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // for (const val of nodes) {
|
|
|
+ // let level = val.level;
|
|
|
+ // let node = schList.find((i) => i.player_one_node == val.id);
|
|
|
+ // let J1 = levels[level].length;
|
|
|
+ // let J2 = levels[level].length / 2;
|
|
|
+ // if (node) node.J1 = J1, node.J2 = J2;
|
|
|
+ // }
|
|
|
+ that.setData({ schList: schList })
|
|
|
+ },
|
|
|
/**
|
|
|
* 同步图与赛程的人名
|
|
|
* @param {Object} data 赛程数据
|