dev_sync_trustie
杨树林 5 years ago
parent 6f927424d3
commit ae2270307c

@ -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>*/}

@ -24,15 +24,22 @@ class RegistrationSearch extends React.Component {
this.setState({
keywords: e.target.value
})
};
setdatafuns = (value) => {
//console.log("点击了搜索");
console.log("setdatafuns点击了搜索");
console.log(value);
this.setState({
keywords: value
})
this.props.RegistrationSearchvalue(value);
};
myonPressEnter = (e) => {
console.log("点击了回车setdatafunsval点击了搜索");
console.log(e.target.value);
this.props.RegistrationSearchvalue(e.target.value);
}
render() {
return (
<div className="searchhead">
@ -42,7 +49,9 @@ class RegistrationSearch extends React.Component {
value={this.state.keywords}
enterButton={<span>搜索</span>}
onInput={(e) => this.setdatafunsval(e)}
onSearch={(value) => this.setdatafuns(value)}/>
onSearch={(value) => this.setdatafuns(value)}
onPressEnter={(e) => this.myonPressEnter(e)}
/>
<p style={{color: "#07140E", fontSize: "16px", marginTop: "7px", marginLeft: "760px"}}>战队总数<span
style={{color: "#459BE5", fontSize: "16px"}}>{this.props.count}</span></p>

Loading…
Cancel
Save