dev_forum
杨树林 5 years ago
parent 32fa240e08
commit 0e8eb1aaf3

@ -258,7 +258,12 @@ class App extends Component {
// //TODO 这里如果样式变了会出现css不加载的情况
// });
}
//修改登录方法
Modifyloginvalue=()=>{
this.setState({
isRender:false,
})
}
render() {
@ -268,7 +273,7 @@ class App extends Component {
<MuiThemeProvider theme={theme}>
<LoginDialog {...this.props} {...this.state}></LoginDialog>
<LoginDialog {...this.props} {...this.state} Modifyloginvalue={()=>this.Modifyloginvalue()}></LoginDialog>
<Notcompletedysl {...this.props} {...this.state}></Notcompletedysl>
<Trialapplicationysl {...this.props} {...this.state}></Trialapplicationysl>
<Trialapplicationreview {...this.props} {...this.state}></Trialapplicationreview>

@ -18,9 +18,9 @@ function locationurl(list){
}
// TODO 开发期多个身份切换
const debugType =""
// window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
// window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin'
const 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) {

@ -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("只能输入小于7位数的邀请码!");
return
}
this.setState({
invite_code:e.target.value
})
@ -187,7 +199,9 @@ class Addcourses extends Component{
student:student
}
).then((response) => {
if(response === undefined){
return
}
if(response.data.status===0){
// course_id: 1545
// message: "成功"

@ -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;
@ -475,8 +488,8 @@ class LoginDialog extends Component {
</span>
<span className="fr">
<a href={"/changepassword"} className="mr3 color-grey-9">忘记密码</a><em className="vertical-line"></em>
<a href={"/register"} className="color-grey-9">注册</a>
<a onClick={(url)=>this.getloginurl("/changepassword")} className="mr3 color-grey-9">忘记密码</a><em className="vertical-line"></em>
<a onClick={(url)=>this.getloginurl("/register")} className="color-grey-9">注册</a>
</span>
</p>

@ -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
})
@ -440,6 +476,11 @@ submittojoinclass=(value)=>{
}
inputjoinclassvalue=(e)=>{
console.log(e.target.value.length);
if(e.target.value.length>=7){
this.openNotification("只能输入小于7位数的邀请码!");
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 (
<div className="newHeader" id="nHeader" >
{isRender===true?<LoginDialog
Modifyloginvalue={()=>this.Modifyloginvalue()}
{...this.state}
{...this.props}
/>:""}
@ -705,10 +775,12 @@ submittojoinclass=(value)=>{
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div>
<ul className="fl with50 edu-txt-center pr ul-leftline">
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":<li><Link to={"/courses/new"}>新建课堂</Link></li>}
<li><a href="/shixuns/new">新建实训</a></li>
<li><a href={this.props.Headertop===undefined?"":"/paths/new"}>新建实践课程</a></li>
<li><a href={"/projects/new"} target="_blank">新建项目</a></li>
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":<li><a onClick={(url)=>this.getUser("/courses/new")}>新建课堂</a></li>}
<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训</a></li>
{this.props.Headertop===undefined?"":
<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>
}
<li><a onClick={(url)=>this.getUser("/projects/new")} target="_blank">新建项目</a></li>
</ul>
<ul className="fl with50 edu-txt-center">

Loading…
Cancel
Save