dev_sync_trustie
杨树林 5 years ago
parent 6a45593ec0
commit 7ceca2da75

@ -88,6 +88,7 @@ class Registration extends React.Component {
// this.Getdata(keyword, page, per_page, this.props.isAdmin()); // this.Getdata(keyword, page, per_page, this.props.isAdmin());
// this.GetenrollmentAPI(); // this.GetenrollmentAPI();
} }
//取模式
this.Getdataheader(); this.Getdataheader();
} }
@ -100,6 +101,7 @@ class Registration extends React.Component {
////console.log(this.props.user.admin); ////console.log(this.props.user.admin);
const {keyword, page, per_page} = this.state; const {keyword, page, per_page} = this.state;
this.Getdata(keyword, page, per_page, this.props.user.admin); this.Getdata(keyword, page, per_page, this.props.user.admin);
//取报名配置
this.GetenrollmentAPI(); this.GetenrollmentAPI();
} }
@ -144,6 +146,7 @@ class Registration extends React.Component {
}) })
try { try {
//获取学生是否被限制多次报名
if (result.data.member_staff) { if (result.data.member_staff) {
this.setState({ this.setState({
mutiple_limited: result.data.member_staff.mutiple_limited, mutiple_limited: result.data.member_staff.mutiple_limited,
@ -157,6 +160,7 @@ class Registration extends React.Component {
} }
try { try {
//获取老师是否被限制多次报名
if (result.data.teacher_staff) { if (result.data.teacher_staff) {
this.setState({ this.setState({
teamutiple_limited: result.data.teacher_staff.mutiple_limited teamutiple_limited: result.data.teacher_staff.mutiple_limited
@ -167,6 +171,7 @@ class Registration extends React.Component {
} }
//是否是个人赛做处理
if (result.data.personal === true) { if (result.data.personal === true) {
if (result.data.enroll_ended === true) { if (result.data.enroll_ended === true) {
this.setState({ this.setState({
@ -211,6 +216,17 @@ class Registration extends React.Component {
// 没有创建数据的 // 没有创建数据的
if (admin === true) { if (admin === true) {
//管理员 //管理员
try {
this.setState({
type: result.data.competition_teams.length === 0 ? 1 : 4,
count: result.data.count,
data: result.data.my_teams,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
})
} catch (e) {
this.setState({ this.setState({
type: 4, type: 4,
count: result.data.count, count: result.data.count,
@ -220,6 +236,8 @@ class Registration extends React.Component {
competition_name: result.data.competition_name, competition_name: result.data.competition_name,
members_count: result.data.members_count members_count: result.data.members_count
}) })
}
} else { } else {
//普通账号 //普通账号
this.setState({ this.setState({
@ -463,6 +481,17 @@ class Registration extends React.Component {
* 加入战队 * 加入战队
* */ * */
Jointheteam = () => { Jointheteam = () => {
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog()
return
}
if (this.props.checkIfProfileCompleted() === false) {
this.props.showProfileCompleteDialog()
return
}
if (this.props.user.is_teacher === true) { if (this.props.user.is_teacher === true) {
try { try {
if (this.state.teamutiple_limited === true) { if (this.state.teamutiple_limited === true) {
@ -544,7 +573,16 @@ class Registration extends React.Component {
* 创建战队 * 创建战队
**/ **/
Createateam = () => { Createateam = () => {
// if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog()
return
}
if (this.props.checkIfProfileCompleted() === false) {
this.props.showProfileCompleteDialog()
return
}
if (this.props.user.is_teacher === true) { if (this.props.user.is_teacher === true) {
try { try {

@ -516,6 +516,7 @@ export function TPMIndexHOC(WrappedComponent) {
isloginCancel:"iscancel" isloginCancel:"iscancel"
}) })
} }
//验证登录是否成功方法
checkIfLogin = () => { checkIfLogin = () => {
return this.state.current_user && this.state.current_user.login != '' return this.state.current_user && this.state.current_user.login != ''
} }
@ -531,6 +532,7 @@ export function TPMIndexHOC(WrappedComponent) {
AccountProfiletype: true AccountProfiletype: true
}) })
} }
//验证是否完善资料
checkIfProfileCompleted = () => { checkIfProfileCompleted = () => {
return this.state.current_user && this.state.current_user.profile_completed return this.state.current_user && this.state.current_user.profile_completed
} }

Loading…
Cancel
Save