This commit is contained in:
caishi 2021-03-23 17:00:09 +08:00
parent 68b1296652
commit 9c22457249
1 changed files with 2 additions and 167 deletions

View File

@ -339,174 +339,17 @@ class NewHeader extends Component {
})
}
submittojoinclass = (value) => {
let { tojoinclasstitle, rolearr, RadioGroupvalue } = this.state;
if (tojoinclasstitle === undefined) {
this.setState({
code_notice: true
})
return
}
let newrolearr = rolearr;
if (tojoinclasstitle.length < 6) {
this.setState({
code_notice: true
})
return
}
if (tojoinclasstitle === "" || tojoinclasstitle === undefined) {
this.setState({
code_notice: true
})
return
} else {
this.setState({
code_notice: false
})
}
let pamst = [];
let num = 0;
for (var i = 0; i < newrolearr.length; i++) {
if (newrolearr[i] !== "") {
pamst.push(newrolearr[i])
} else {
num = num + 1
}
}
if (num === 2 && value === 0) {
this.setState({
checked_notice: true
})
return
}
if (value === 1 && RadioGroupvalue === undefined) {
this.setState({
checked_notice: true
})
return
}
if (value === 1) {
let url = "/project_applies.json";
axios.post(url, {
code: tojoinclasstitle,
role: RadioGroupvalue
}
).then((response) => {
if (response.data.status === 1) {
this.submitstatevalue(1, "您输入的邀请码错误")
} else if (response.data.status === 2) {
this.submitstatevalue(1, "您已经是该项目成员", response.data.project)
} else if (response.data.status === 3) {
this.submitstatevalue(1, "请选择一个角色")
} else if (response.data.status === 4) {
this.submitstatevalue(1, "您的申请已提交,请等待项目管理员审批")
} else if (response.data.status === 5) {
this.submitstatevalue(1, "您已经申请加入该项目了,请耐心等待")
} else if (response.data.status === 6) {
this.submitstatevalue(1, "您已成功加入项目", response.data.project)
} else if (response.data.status === 0) {
if (RadioGroupvalue === "reporter") {
this.openNotification("您加入项目成功!");
window.location.href = `/projects/${response.data.project_id}`;
} else {
this.openNotification("您的申请已提交,请等待项目管理员审批!");
}
}
})
}
this.hidetojoinclass()
}
// 关闭
cancelModulationModels = () => {
this.setState({ isRenders: false })
}
inputjoinclassvalue = (e) => {
if (e.target.value.length >= 7) {
this.openNotification("请输入6位项目邀请码!");
return
}
this.setState({
tojoinclasstitle: e.target.value
})
}
showSearchOpen = (e) => {
this.setState({
showSearchOpentype: true
})
}
hideshowSearchOpen = (e) => {
let { setevaluatinghides } = this.state;
if (setevaluatinghides === true) {
this.setState({
showSearchOpentype: false,
setevaluatinghides: false
})
}
}
onKeywordSearchKeyDown = (value) => {
let url = `/search?value=${value}`;
this.props.history.push(url)
}
onKeywordSearchKeyDowns = () => {
this.setState({
setevaluatinghides: false
})
}
setevaluatinghides = () => {
this.setState({
setevaluatinghides: true
})
}
//头部获取是否已经登录了
getUser = (url, type) => {
if (type === "projects") {
if (this.props.user && this.props.user.email === undefined || this.props.user && this.props.user.email === null || this.props.user && this.props.user.email === "") {
this.openNotification("请先绑定邮箱,谢谢");
return
}
}
let { user } = this.state;
if (user === undefined) {
this.setState({
isRender: true
})
return
}
if (user && user.login === "") {
this.setState({
isRender: true
})
return;
}
if (user && user.profile_completed === false) {
this.setState({
AccountProfiletype: true
})
return;
}
if (type === "newshixuns") {
if (this.props && this.props.current_user && this.props.current_user.is_shixun_marker === false) {
this.setgoshowqqgtounp(true);
return;
}
}
if (url !== undefined || url !== "") {
window.location.href = url;
}
}
//修改登录方法
Modifyloginvalue = () => {
this.setState({
@ -850,22 +693,14 @@ class NewHeader extends Component {
</div>
</Modal>
</div>
{user === undefined ?
<span className="font-15">
{!user || (user && !user.login) ?
<span className="font-15 ml30">
<a onClick={() => this.educoderlogin()} className="mr5 color-white">登录</a>
{
settings && settings.new_course && settings.new_course.register_url &&
<span><em className="vertical-line"></em><a className="ml5 color-white" href={`${settings.new_course.register_url}`} target="_blank"></a></span>
}
</span>
: user.login === "" ?
<span className="font-15">
<a onClick={() => this.educoderlogin()} className="mr5 color-white">登录</a>
{
settings && settings.new_course && settings.new_course.register_url &&
<span><em className="vertical-line"></em><a className="color-white ml5" href={`${settings.new_course.register_url}`} target="_blank"></a></span>
}
</span>
:
<div className="ml30 edu-menu-panel" style={{ height: "70px", lineHeight: "70px" }}>
<a href={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/courses`}>