|
|
|
@ -123,19 +123,23 @@ class Registration extends React.Component {
|
|
|
|
|
if (result) {
|
|
|
|
|
if (result.data) {
|
|
|
|
|
//// //console.log(result);
|
|
|
|
|
if (result.data.count === 0) {
|
|
|
|
|
if (result.data.my_teams.length === 0) {
|
|
|
|
|
// 没有创建数据的
|
|
|
|
|
if (admin === true) {
|
|
|
|
|
//管理员
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 4,
|
|
|
|
|
count: result.data.count,
|
|
|
|
|
data: result.data.my_teams,
|
|
|
|
|
competition_teams: result.data.competition_teams
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
//普通账号
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 1,
|
|
|
|
|
count: result.data.count,
|
|
|
|
|
data: result.data.my_teams,
|
|
|
|
|
competition_teams: result.data.competition_teams
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
@ -186,16 +190,86 @@ class Registration extends React.Component {
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 4,
|
|
|
|
|
count: 0,
|
|
|
|
|
competition_teams: [],
|
|
|
|
|
data: [],
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
//普通账号
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 1,
|
|
|
|
|
count: 0,
|
|
|
|
|
competition_teams: [],
|
|
|
|
|
data: [],
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Getdatatype5 = (keyword, page, per_page, admin) => {
|
|
|
|
|
//搜索关键字 keyword
|
|
|
|
|
//页数 page
|
|
|
|
|
//分页 per_page
|
|
|
|
|
const datas = {
|
|
|
|
|
keyword: keyword,
|
|
|
|
|
page: page,
|
|
|
|
|
per_page: per_page,
|
|
|
|
|
};
|
|
|
|
|
let url = `/competitions/${"gcc-course-2019"}/competition_teams.json`;
|
|
|
|
|
axios.get((url), {params: datas}).then((result) => {
|
|
|
|
|
if (result) {
|
|
|
|
|
if (result.data) {
|
|
|
|
|
//// //console.log(result);
|
|
|
|
|
if (result.data.my_teams.length === 0) {
|
|
|
|
|
// 没有创建数据的
|
|
|
|
|
//管理员
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 4,
|
|
|
|
|
count: result.data.count,
|
|
|
|
|
competition_teams: result.data.competition_teams,
|
|
|
|
|
data: result.data.my_teams,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
//有数据的
|
|
|
|
|
if (result.data.my_teams[0].manage_permission === true) {
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 5,
|
|
|
|
|
data: result.data.my_teams,
|
|
|
|
|
count: result.data.count,
|
|
|
|
|
competition_teams: result.data.competition_teams
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 4,
|
|
|
|
|
data: result.data.my_teams,
|
|
|
|
|
count: result.data.count,
|
|
|
|
|
competition_teams: result.data.competition_teams
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
if (admin === true) {
|
|
|
|
|
//管理员
|
|
|
|
|
this.setState({
|
|
|
|
|
count: 0,
|
|
|
|
|
competition_teams: [],
|
|
|
|
|
data: [],
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
//普通账号
|
|
|
|
|
this.setState({
|
|
|
|
|
count: 0,
|
|
|
|
|
competition_teams: [],
|
|
|
|
|
data: [],
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
paginationonChangestwo = (pageNumber) => {
|
|
|
|
|
this.setState({
|
|
|
|
|
pages: pageNumber,
|
|
|
|
@ -394,7 +468,16 @@ class Registration extends React.Component {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//搜索战队
|
|
|
|
|
RegistrationSearchvalue = (value) => {
|
|
|
|
|
console.log("RegistrationSearchvalue");
|
|
|
|
|
console.log(this.props.user.admin);
|
|
|
|
|
this.setState({
|
|
|
|
|
pages: 1,
|
|
|
|
|
limit: 20,
|
|
|
|
|
})
|
|
|
|
|
this.Getdata(value, 1, 20, this.props.user.admin);
|
|
|
|
|
}
|
|
|
|
|
render() {
|
|
|
|
|
const {test, page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams} = this.state;
|
|
|
|
|
var listItems = "";
|
|
|
|
@ -459,7 +542,8 @@ class Registration extends React.Component {
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
type === 4 || type === 5 ?
|
|
|
|
|
<RegistrationSearch count={count}></RegistrationSearch>
|
|
|
|
|
<RegistrationSearch count={count}
|
|
|
|
|
RegistrationSearchvalue={(value) => this.RegistrationSearchvalue(value)}></RegistrationSearch>
|
|
|
|
|
: ""
|
|
|
|
|
}
|
|
|
|
|
{/*<Registrationitem></Registrationitem>*/}
|
|
|
|
|