diff --git a/public/react/src/App.js b/public/react/src/App.js index db6b6f43b..d178a3565 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -258,7 +258,12 @@ class App extends Component { // //TODO 这里如果样式变了会出现css不加载的情况 // }); } - + //修改登录方法 + Modifyloginvalue=()=>{ + this.setState({ + isRender:false, + }) + } render() { @@ -268,7 +273,7 @@ class App extends Component { - + this.Modifyloginvalue()}> diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 8cca8205f..5721c88a9 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -18,9 +18,10 @@ function locationurl(list){ } // TODO 开发期多个身份切换 -const debugType =window.location.search.indexOf('debug=t') != -1 ? 'teacher' : - window.location.search.indexOf('debug=s') != -1 ? 'mfp2guqj3' : 'admin' -window._debugType = debugType; +const debugType ="" +// window.location.search.indexOf('debug=t') != -1 ? 'teacher' : +// window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin' +// window._debugType = debugType; export function initAxiosInterceptors(props) { // TODO 避免重复的请求 https://github.com/axios/axios#cancellation diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index 94fe000e6..e8bd8b9cf 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -49,10 +49,22 @@ class Addcourses extends Component{ }) } - + openNotification = (messge) => { + notification.open({ + message: "提示", + description: + messge, + onClick: () => { + console.log('Notification Clicked!'); + }, + }); + }; inputjoinclassvalue=(e)=>{ - + if(e.target.value.length>=7){ + this.openNotification("请输入5位课堂邀请码或6位分班邀请码!"); + return + } this.setState({ invite_code:e.target.value }) @@ -198,7 +210,9 @@ class Addcourses extends Component{ student:student } ).then((response) => { - + if(response === undefined){ + return + } if(response.data.status===0){ // course_id: 1545 // message: "成功" diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 136e50d6e..c5d0009c1 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -361,7 +361,7 @@ class CoursesNew extends Component { render() { let {datatime} = this.state; const {getFieldDecorator} = this.props.form; - const options = this.state.searchlist.map(d => ); + const options = this.state.searchlist && this.state.searchlist.map(d => ); const optionschool = this.state.searchlistscholl.map(z => ); // console.log(this.props.current_user.user_school) return ( diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js index 54fe17b9f..7629eeef2 100644 --- a/public/react/src/modules/login/LoginDialog.js +++ b/public/react/src/modules/login/LoginDialog.js @@ -329,6 +329,11 @@ class LoginDialog extends Component { this.setState({ isRender: false }) + try { + this.props.Modifyloginvalue(); + }catch (e) { + + } } loginEDU=()=>{ @@ -370,11 +375,16 @@ class LoginDialog extends Component { window.location.reload(); } } + try { + this.props.Modifyloginvalue(); + }catch (e) { + } }).catch((error) => { console.log("356"); console.log(error) }) + } onKeydowns=(e)=>{ let {disabled}=this.state; @@ -383,6 +393,9 @@ class LoginDialog extends Component { console.log(1) } } + getloginurl=(url)=>{ + window.location.href = url; + } render() { let{open,login,speedy,loginValue,regular,isGoing,isGoingValue,disabled,bottonclass, dialogBox,shortcutnum,disabledType,gaincode,authCodeType,authCodeclass, isRender}=this.state; @@ -403,7 +416,7 @@ class LoginDialog extends Component { -
+
  • {this.enter(0)}}>登录
  • {/*
  • {this.register(0)}}>快捷登录
  • */} @@ -475,8 +488,8 @@ class LoginDialog extends Component { - 忘记密码 - 注册 + this.getloginurl("/changepassword")} className="mr3 color-grey-9">忘记密码 + this.getloginurl("/register")} className="color-grey-9">注册

    diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 2455b0be4..354452d3f 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -12,7 +12,7 @@ import { getImageUrl, toPath } from 'educoder' import axios from 'axios'; -import { Modal,Checkbox ,Radio,Input,message } from 'antd'; +import { Modal,Checkbox ,Radio,Input,message,notification } from 'antd'; import Addcourses from '../courses/coursesPublic/Addcourses'; @@ -113,6 +113,16 @@ class NewHeader extends Component { // // } } + openNotification = (messge) => { + notification.open({ + message: "提示", + description: + messge, + onClick: () => { + console.log('Notification Clicked!'); + }, + }); + }; componentWillReceiveProps(newProps, oldProps) { this.setState({ user:newProps.user @@ -158,12 +168,38 @@ class NewHeader extends Component { } tojoinclass=()=>{ + let{user} =this.state; + if(user===undefined){ + this.setState({ + isRender:true + }) + return + } + if(user&&user.login===""){ + this.setState({ + isRender:true + }) + return; + } this.setState({ Addcoursestypes:true, }) } tojoinitem=()=>{ + let{user} =this.state; + if(user===undefined){ + this.setState({ + isRender:true + }) + return + } + if(user&&user.login===""){ + this.setState({ + isRender:true + }) + return; + } this.setState({ tojoinitemtype:true }) @@ -235,7 +271,7 @@ class NewHeader extends Component { }) } educoderlogin=()=>{ - //退出账号 + //登录账号 this.setState({ isRender:true }) @@ -305,21 +341,21 @@ submittojoinclass=(value)=>{ return } let newrolearr=rolearr; - if(value===1){ + // if(value===1){ if(tojoinclasstitle.length<6){ this.setState({ code_notice:true }) return } - }else if(value===0){ - if(tojoinclasstitle.length<5){ - this.setState({ - code_notice:true - }) - return - } - } + // }else if(value===0){ + // if(tojoinclasstitle.length<5){ + // this.setState({ + // code_notice:true + // }) + // return + // } + // } if(tojoinclasstitle===""||tojoinclasstitle===undefined){ this.setState({ code_notice:true @@ -402,7 +438,7 @@ submittojoinclass=(value)=>{ } if(value===1){ - let url="/applied_project/applied_project_info.json" + let url="/api/applied_project/applied_project_info.json" const form = new FormData(); form.append('invite_code', tojoinclasstitle); form.append('member', RadioGroupvalue); @@ -440,6 +476,11 @@ submittojoinclass=(value)=>{ } inputjoinclassvalue=(e)=>{ + console.log(e.target.value.length); + if(e.target.value.length>=7){ + this.openNotification("请输入6位项目邀请码!"); + return + } this.setState({ tojoinclasstitle:e.target.value }) @@ -483,6 +524,35 @@ submittojoinclass=(value)=>{ } ) } + //头部获取是否已经登录了 + getUser=(url)=>{ + console.log("点击了503") + console.log(url); + let{user} =this.state; + if(user===undefined){ + this.setState({ + isRender:true + }) + return + } + if(user&&user.login===""){ + this.setState({ + isRender:true + }) + return; + } + if(url !== undefined || url!==""){ + window.location.href = url; + } + } + + //修改登录方法 + Modifyloginvalue=()=>{ + this.setState({ + isRender:false, + }) + } + render() { const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 const {match ,} = this.props; @@ -529,12 +599,12 @@ submittojoinclass=(value)=>{ // rolearr:["",""], // console.log("618"); // console.log(user_phone_binded); - return (
    {isRender===true?this.Modifyloginvalue()} {...this.state} {...this.props} />:""} @@ -705,10 +775,12 @@ submittojoinclass=(value)=>{
      @@ -739,12 +811,12 @@ submittojoinclass=(value)=>{ + placeholder="请输入6位项目邀请码" value={tojoinclasstitle} onInput={this.inputjoinclassvalue}/>

      请输入5位项目邀请码或6位分班邀请码

      + style={{marginLeft: '90px',display:code_notice===true?'block':"none"}}>请输入6位项目邀请码