杨树林 5 years ago
commit 55a874e262

File diff suppressed because one or more lines are too long

@ -7,6 +7,11 @@ let _url_origin = getUrl2()
// let _url_origin = `http://47.96.87.25:48080`; // let _url_origin = `http://47.96.87.25:48080`;
if (!window.Cropper) { if (!window.Cropper) {
$.ajaxSetup({
cache: true
});
$('head').append($('<link rel="stylesheet" type="text/css" />') $('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/react/public/js/cropper/cropper.min.css`)); .attr('href', `${_url_origin}/react/public/js/cropper/cropper.min.css`));
@ -61,7 +66,14 @@ function save_avatar(){
// }); // });
// } // }
} }
/**
props 说明
imageId 源图片标签的id
previewId crop后预览dom的id
imageSrc 源图片src
width 数字格式
height 数字格式
*/
class Cropper extends Component { class Cropper extends Component {
state = { state = {
}; };
@ -70,9 +82,7 @@ class Cropper extends Component {
} }
componentDidMount() { componentDidMount() {
setTimeout(() => { this.options = {
const image = document.getElementById('image');
const cropper = new window.Cropper(image, {
aspectRatio: 1, aspectRatio: 1,
crop(event) { crop(event) {
// console.log(event.detail.x); // console.log(event.detail.x);
@ -84,12 +94,19 @@ class Cropper extends Component {
// console.log(event.detail.scaleY); // console.log(event.detail.scaleY);
}, },
preview: '.img-preview', preview: this.props.previewId ? `#${this.props.previewId}` : '.img-preview',
}); }
}, 3000) setTimeout(() => {
const image = document.getElementById(this.props.imageId || '__image');
this.cropper = new window.Cropper(image, this.options);
}, 1000)
} }
renew = (image) => {
this.cropper && this.cropper.destroy();
this.cropper = new window.Cropper(image, this.options);
}
render() { render() {
const { width, height, previewId, imageSrc } = this.props; const { width, height, previewId, imageSrc } = this.props;
@ -98,8 +115,8 @@ class Cropper extends Component {
{/* This rule is very important, please do not ignore this! */} {/* This rule is very important, please do not ignore this! */}
<style>{` <style>{`
.wrapper { .wrapper {
width: ${ width || '500px'}; width: ${ (width+'px') || '500px'};
height: ${ height || '500px'}; height: ${ (height+'px') || '500px'};
} }
img { img {
max-width: 100%; max-width: 100%;
@ -113,7 +130,7 @@ class Cropper extends Component {
`}</style> `}</style>
<div className="wrapper"> <div className="wrapper">
{/* http://localhost:3007/images/footNavLogo.png 图片转了后不对 */} {/* http://localhost:3007/images/footNavLogo.png 图片转了后不对 */}
<img id="image" src={`${imageSrc || "/images/testPicture.jpg"}`}></img> <img id={this.props.imageId || "__image"} src={`${imageSrc || "/images/testPicture.jpg"}`}></img>
</div> </div>
{/* background: 'aquamarine', {/* background: 'aquamarine',
'border-radius': '128px' 'border-radius': '128px'
@ -124,7 +141,7 @@ class Cropper extends Component {
{/* <img id="showImg" src="http://localhost:3007/images/testPicture.jpg"></img> */} {/* <img id="showImg" src="http://localhost:3007/images/testPicture.jpg"></img> */}
{/* <div id="canvasWrap"></div> */} {/* <div id="canvasWrap"></div> */}
<button onClick={save_avatar.bind(this)}>save </button> {/* <button onClick={save_avatar.bind(this)}>save </button> */}
</div> </div>
); );
} }

@ -1,7 +1,9 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {Link} from 'react-router-dom' import {Link} from 'react-router-dom'
const map={"blue":"blueFull","greyBack":"greyBack","grey":"greyWidthFixed","green":"greenBack"} const map={"blue":"blueFull","greyBack":"greyBack","grey":"greyWidthFixed","green":"greenBack",
'colorBlue': 'colorBlue', // 蓝字白底
}
class ActionBtn extends Component { class ActionBtn extends Component {
constructor(props) { constructor(props) {
super(props); super(props);

@ -28,6 +28,7 @@ export { EDU_ADMIN, EDU_BUSINESS, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CER
, EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from './Const' , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from './Const'
export { ModalHOC } from './components/ModalHOC' export { ModalHOC } from './components/ModalHOC'
export { default as Cropper } from './components/Cropper'
export { default as ConditionToolTip } from './components/ConditionToolTip' export { default as ConditionToolTip } from './components/ConditionToolTip'
export { default as DragValidator } from './components/DragValidator' export { default as DragValidator } from './components/DragValidator'

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

@ -176,8 +176,8 @@ class Fileslists extends Component{
let list=result.data.data; let list=result.data.data;
this.setState({ this.setState({
total_count:list.total_count, total_count:list.total_count,
public_count:list.public_count, publish_count:list.publish_count,
private_count:list.private_count, unpublish_count:list.unpublish_count,
files:list.files, files:list.files,
filesId:list.id, filesId:list.id,
name:list.name, name:list.name,
@ -625,13 +625,12 @@ class Fileslists extends Component{
}) })
} }
render(){ render(){
let { searchValue, let { searchValue,
checkBoxValues, checkBoxValues,
checkAllValue, checkAllValue,
total_count, total_count,
public_count, publish_count,
private_count, unpublish_count,
files, files,
sorttype, sorttype,
Modalstype, Modalstype,
@ -766,8 +765,8 @@ class Fileslists extends Component{
secondRowLeft={ secondRowLeft={
<div style={{"display":"inline-block", "marginTop": "22px"}}> <div style={{"display":"inline-block", "marginTop": "22px"}}>
<span> {total_count} 个资源</span> <span> {total_count} 个资源</span>
<span style={{"marginLeft":"16px"}}>已发布{public_count}</span> <span style={{"marginLeft":"16px"}}>已发布{publish_count}</span>
<span style={{"marginLeft":"16px"}}>未发布{private_count}</span> <span style={{"marginLeft":"16px"}}>未发布{unpublish_count}</span>
</div> </div>
} }
onPressEnter={this.onPressEnter} onPressEnter={this.onPressEnter}

@ -616,12 +616,12 @@ a.white-btn.use_scope-btn:hover{
border-radius: 10px; border-radius: 10px;
} }
.Navmodal .ant-modal-content .ant-modal-header{ .Navmodal .ant-modal-content .ant-modal-header{
border-radius: 10px 10px 0 0; /*border-radius: 10px 10px 0 0;*/
} }
.ant-modal-content{ .ant-modal-content{
-webkit-box-shadow: 0 4px 12px transparent !important; -webkit-box-shadow: 0 4px 12px transparent !important;
box-shadow: 0 4px 12px transparent !important; box-shadow: 0 4px 12px transparent !important;
border-radius: 10px !important; /*border-radius: 10px !important;*/
} }
.Navmodal .ant-modal-body{ .Navmodal .ant-modal-body{
@ -677,6 +677,11 @@ a.white-btn.use_scope-btn:hover{
color: #fff!important; color: #fff!important;
} }
.colorBlue {
background-color: #fff;
color: #4CACFF;
border: 1px solid #4CACFF;
}
.greyBack{ .greyBack{
/* 不要固定宽度 */ /* 不要固定宽度 */
/* width: 64px; */ /* width: 64px; */

@ -74,11 +74,6 @@ class GraduateTopicItem extends Component{
<a className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}</a>: <a className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}</a>:
<a onClick={() => this.toDetailPage(`${discussMessage.id}`)} className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}</a> <a onClick={() => this.toDetailPage(`${discussMessage.id}`)} className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}</a>
} }
{
isAdmin?<a onClick={()=>this.toDetailPage(`${discussMessage.id}`)} className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}</a>:""
}
{ {
isStudent?<a onClick={() => this.toDetailPage(`${discussMessage.id}`)} isStudent?<a onClick={() => this.toDetailPage(`${discussMessage.id}`)}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}</a>:"" className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}</a>:""

@ -324,8 +324,12 @@ class Poll extends Component{
} }
// 题库选用成功后,立即发布,刷新页面 // 题库选用成功后,立即发布,刷新页面
useBankSuccess=(checkValue,value)=>{ useBankSuccess=(checkValue,value)=>{
// let{type,StudentList_value,page}=this.state this.setState({
// this.InitList(type,StudentList_value,page); isSpin:true
})
let{type,StudentList_value,page}=this.state
this.InitList(type,StudentList_value,page);
this.setState({ this.setState({
checkBoxValues:[] checkBoxValues:[]
}) })

@ -84,12 +84,12 @@ class PollDetailIndex extends Component{
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span>问卷详情</span> <span>问卷详情</span>
</p> </p>
<p className="clearfix mb20"> <p className="clearfix mb20 lineh-25">
<span className="color-grey-3 font-24 fl task-hide break-word" style={{maxWidth:"900px",lineHeight:"30px"}} title={`${pollDetail && pollDetail.polls_name}`}>{pollDetail && pollDetail.polls_name}</span> <span className="color-grey-3 font-24 fl task-hide break-word" style={{maxWidth:"900px",lineHeight:"25px"}} title={`${pollDetail && pollDetail.polls_name}`}>{pollDetail && pollDetail.polls_name}</span>
<span className="mt3 fl"> <span className="mt3 fl" style={{height:"25px"}}>
<CoursesListType typelist={[`${map[pollDetail && pollDetail.polls_status]}`]} typesylename={""} /> <CoursesListType typelist={[`${map[pollDetail && pollDetail.polls_status]}`]} typesylename={""} />
</span> </span>
<WordsBtn className="fr font-16 mt5" style="grey" onClick={()=>this.props.history.goBack()}>返回</WordsBtn> <WordsBtn className="fr font-16 mt2" style="grey" onClick={()=>this.props.history.goBack()}>返回</WordsBtn>
</p> </p>
<div> <div>
<div className="clearfix edu-back-white pl30 pr30 bor-bottom-greyE"> <div className="clearfix edu-back-white pl30 pr30 bor-bottom-greyE">

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {getImageUrl} from 'educoder'; import {getImageUrl} from 'educoder';
import {Tooltip} from 'antd'; import {Tooltip,Modal,Icon,Spin,message} from 'antd';
import '../../paths/ShixunPaths.css'; import '../../paths/ShixunPaths.css';
import DetailCardsEditAndAdd from './DetailCardsEditAndAdd'; import DetailCardsEditAndAdd from './DetailCardsEditAndAdd';
import DetailCardsEditAndEdit from './DetailCardsEditAndEdit'; import DetailCardsEditAndEdit from './DetailCardsEditAndEdit';
@ -46,7 +46,8 @@ class DetailCards extends Component{
editbuttomtypeadd:false, editbuttomtypeadd:false,
showparagraph:false, showparagraph:false,
showparagraphkey:"", showparagraphkey:"",
showparagraphindex:"" showparagraphindex:"",
isSpin:false
} }
@ -192,27 +193,60 @@ class DetailCards extends Component{
} }
startgameid=(id)=>{ startgameid=(id)=>{
let url = "/shixuns/" + id + "/shixun_exec.json"; let url = "/shixuns/" + id + "/shixun_exec.json";
axios.get(url).then((response) => { axios.get(url).then((response) => {
if (response.data.status === -2) { if (response.data.status === -2) {
this.setState({ this.setState({
Modalstype:true,
Modalstopval:response.data.message, shixunsreplace:true,
hidestartshixunsreplacevalue:response.data.message+".json"
}) })
} else if (response.data.status === -1) { } else if (response.data.status === -1) {
console.log(response)
}else if(response.data.status===-3){ }else if(response.data.status===-3){
this.setState({ this.setState({
Modalstype:true, shixunsmessage:response.data.message,
Modalstopval:response.data.message, startshixunCombattype:true,
}) })
} else { } else {
window.location.href = "/tasks/" + response.data.game_identifier; window.location.href = "/tasks/" + response.data.game_identifier;
// window.location.href = path
// let path="/tasks/"+response.data.game_identifier; // let path="/tasks/"+response.data.game_identifier;
// this.props.history.push(path); // this.props.history.push(path);
} }
}).catch((error) => { }).catch((error) => {
}); });
}
hidestartshixunsreplace=(url)=>{
this.setState({
isSpin:true,
})
axios.get(url).then((response) => {
debugger
if(response.status===200){
// let path="/shixuns/"+response.data.shixun_identifier+"/challenges";
// this.props.history.push(path);
message.success('重置成功,正在进入实训!');
this.startgameid(response.data.shixun_identifier);
this.setState({
shixunsreplace:false,
isSpin:false,
startbtn:false,
})
// message.success('重置成功,正在进入实训!');
// this.startshixunCombat();
}}
).catch((error) => {
});
} }
cardsModalcancel=()=>{ cardsModalcancel=()=>{
@ -252,6 +286,12 @@ class DetailCards extends Component{
showparagraph:false showparagraph:false
}) })
} }
hidestartshixunCombattype=()=>{
this.setState({
startshixunCombattype:false
})
}
render(){ render(){
let { pathCardsList, let { pathCardsList,
dropid, dropid,
@ -266,14 +306,14 @@ class DetailCards extends Component{
cardsModalsave, cardsModalsave,
cardsModalcancel, cardsModalcancel,
delecttype, delecttype,
editdelectid, hidestartshixunsreplacevalue,
editbuttomtype, editbuttomtype,
editbuttomtypeadd, editbuttomtypeadd,
showparagraph, showparagraph,
showparagraphkey, showparagraphkey,
showparagraphindex showparagraphindex
}=this.state; }=this.state;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
return( return(
<div> <div>
<Modals <Modals
@ -284,6 +324,45 @@ class DetailCards extends Component{
modalSave={delecttype===true?this.delectpathCardseditfun:cardsModalsave} modalSave={delecttype===true?this.delectpathCardseditfun:cardsModalsave}
> >
</Modals> </Modals>
<Modal
keyboard={false}
title="提示"
visible={this.state.startshixunCombattype}
closable={false}
footer={null}
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16 pb20">本实训的开启时间{this.state.shixunsmessage} <br/>开启时间之前不能挑战 </p>
</div>
<div className="task-popup-submit clearfix">
{/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/}
<a className="task-btn task-btn-orange fr"
style={{marginRight:'51px'}}
onClick={this.hidestartshixunCombattype}>知道了</a>
</div>
{/*<p className="inviteTipbtn with100 fl">*/}
{/*<a onClick={this.hidestartshixunCombattype}>知道了</a>*/}
{/*</p>*/}
</Modal>
<Modal
keyboard={false}
title="提示"
visible={this.state.shixunsreplace}
closable={false}
footer={null}
>
<Spin indicator={antIcon} spinning={this.state.isSpin}>
<div className="task-popup-content">
<p className="task-popup-text-center font-16 pb20">实训已经更新了正在为您重置!</p>
</div>
<div className="task-popup-submit clearfix">
<a className="task-btn task-btn-orange fr"
style={{marginRight:'51px'}}
onClick={() => this.hidestartshixunsreplace(hidestartshixunsreplacevalue)}>知道了</a>
</div>
</Spin>
</Modal>
<div className="lesson-saved-list"> <div className="lesson-saved-list">
{ {
pathCardsList && pathCardsList.map((item,key)=>{ pathCardsList && pathCardsList.map((item,key)=>{

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import Cropper from '../../common/components/Cropper' import Cropper from '../../common/components/Cropper'
import ChangeHeaderPicModal from '../user/account/ChangeHeaderPicModal'
class TestCrop extends Component { class TestCrop extends Component {
state = { state = {
}; };
@ -14,6 +14,8 @@ class TestCrop extends Component {
const props = this.props; const props = this.props;
return ( return (
<div> <div>
<button onClick={() => { this.refs['changeHeaderPicModal'].setVisible(true)}}>open</button>
<ChangeHeaderPicModal ref="changeHeaderPicModal"></ChangeHeaderPicModal>
<Cropper></Cropper> <Cropper></Cropper>
</div> </div>
); );

@ -156,8 +156,36 @@ class Challenges extends Component {
} }
} }
startgameid=(id)=>{
let url = "/shixuns/" + id + "/shixun_exec.json";
axios.get(url).then((response) => {
if (response.data.status === -2) {
this.setState({
shixunsreplace:true,
hidestartshixunsreplacevalue:response.data.message+".json"
})
} else if (response.data.status === -1) {
console.log(response)
}else if(response.data.status===-3){
this.setState({
shixunsmessage:response.data.message,
startshixunCombattype:true,
})
} else {
window.location.href = "/tasks/" + response.data.game_identifier;
// window.location.href = path
// let path="/tasks/"+response.data.game_identifier;
// this.props.history.push(path);
}
}).catch((error) => {
});
}
hidestartshixunsreplace=(url)=>{ hidestartshixunsreplace=(url)=>{
this.setState({ this.setState({
isSpin:true, isSpin:true,
@ -167,7 +195,7 @@ class Challenges extends Component {
// let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; // let path="/shixuns/"+response.data.shixun_identifier+"/challenges";
// this.props.history.push(path); // this.props.history.push(path);
message.success('重置成功,正在进入实训!'); message.success('重置成功,正在进入实训!');
this.startshixunCombat(response.data.shixun_identifier); this.startgameid(response.data.shixun_identifier);
this.setState({ this.setState({
shixunsreplace:false, shixunsreplace:false,
isSpin:false, isSpin:false,
@ -179,11 +207,7 @@ class Challenges extends Component {
).catch((error) => { ).catch((error) => {
}); });
this.setState({
startbtn:false,
shixunsreplace:false,
isSpin:false
})
} }
//编辑实训题目选择题 //编辑实训题目选择题
@ -455,48 +479,43 @@ class Challenges extends Component {
{/*判断比较复杂 有排第一不能是灰色按钮*/} {/*判断比较复杂 有排第一不能是灰色按钮*/}
{item.status === 2 ? {item.status === 2 ?
<a className="edu-default-btn edu-blueline-btn fr Finish_button mtf3" <a className={"edu-default-btn edu-blueline-btn fr Finish_button mtf3"}
onClick={() => this.startshixunCombat(false,undefined, item.challenge_id)} onClick={()=>this.startshixunCombat(false,undefined, item.challenge_id)}
// onClick={() => this.startshixunCombat(false)} // onClick={() => this.startshixunCombat(false)}
title={"查看挑战关卡"}
>已完成</a> : "" >已完成</a> : ""
} }
{ {
ChallengesDataList.allow_skip === true && item.status === 1? ChallengesDataList.allow_skip === true && item.status === 1?
<a className="edu-default-btn edu-blueback-btn fr Finish_button" <a className={"edu-default-btn edu-blueback-btn fr Finish_button"}
title={"直接挑战"}
style={{marginTop: '-2px'}} style={{marginTop: '-2px'}}
onClick={() => this.startshixunCombat(false,undefined, item.challenge_id)} onClick={()=>this.startshixunCombat(false,undefined, item.challenge_id)}
// onClick={() => this.startshixunCombat(false)} // onClick={() => this.startshixunCombat(false)}
>直接挑战</a> : "" >直接挑战</a> : ""
} }
{ {
ChallengesDataList.allow_skip === false ? item.status === 1 && newstatus === 2 ? ChallengesDataList.allow_skip === false ? item.status === 1?
<Tooltip placement="bottom" title={item.open_game!=""?"直接挑战":"请先完成前序关卡"}> <Tooltip placement="bottom" title={"直接挑战"}>
<a className={item.open_game!=""?"edu-default-btn edu-blueback-btn fr Finish_button":"edu-default-btn edu-greyback-btn fr Finish_button"} <a className={"edu-default-btn edu-blueback-btn fr Finish_button"}
onClick={item.open_game!=""?()=>this.startshixunCombat(false,undefined, item.challenge_id):""} onClick={()=>this.startshixunCombat(false,undefined, item.challenge_id)}
style={{marginTop: '-2px'}}>直接挑战</a>
</Tooltip>
: item.status === 1 && newstatus === 1 ?
<Tooltip placement="bottom" title={this.props.identity<5?"直接挑战":"请先完成前序关卡"}>
<a className={this.props.identity<5&&item.open_game!=""?"edu-default-btn edu-blueback-btn fr Finish_button":"edu-default-btn edu-greyback-btn fr Finish_button"}
onClick={this.props.identity<5&&item.open_game!=""?()=>this.startshixunCombat(false,undefined, item.challenge_id):""}
style={{marginTop: '-2px'}}>直接挑战</a> style={{marginTop: '-2px'}}>直接挑战</a>
</Tooltip> : "" : "" </Tooltip>:"":""
} }
{ {
item.status === 0 ? item.status === 0 ?
<Tooltip placement="bottom" title={this.props.identity<5&&item.open_game!=""?"直接挑战":"请先完成前序关卡"}> <Tooltip placement="bottom" title={"请先完成前序关卡"}>
<a className={this.props.identity<5&&item.open_game!=""?"edu-default-btn edu-blueback-btn fr Finish_button":"edu-default-btn edu-greyback-btn fr Finish_button"} <a className={"edu-default-btn edu-greyback-btn fr Finish_button"}
onClick={this.props.identity<5&&item.open_game!=""?()=>this.startshixunCombat(false,undefined, item.challenge_id):""} // onClick={this.props.identity<5&&item.open_game!=""?()=>this.startshixunCombat(false,undefined, item.challenge_id):""}
style={{marginTop: '-2px'}}>直接挑战</a> style={{marginTop: '-2px'}}>直接挑战</a>
</Tooltip>: "" </Tooltip>:""
} }
@ -574,3 +593,19 @@ class Challenges extends Component {
} }
export default Challenges; export default Challenges;
// {
// ChallengesDataList.allow_skip === false ? item.status === 1 && newstatus === 2 ?
// <Tooltip placement="bottom" title={"直接挑战"}>
// <a className={"edu-default-btn edu-blueback-btn fr Finish_button"}
// onClick={()=>this.startshixunCombat(false,undefined, item.challenge_id)}
// style={{marginTop: '-2px'}}>直接挑战</a>
// </Tooltip>
//
// : item.status === 1 && newstatus === 1 ?
// <Tooltip placement="bottom" title={"直接挑战"}>
// <a className={"edu-default-btn edu-blueback-btn fr Finish_button"}
// onClick={()=>this.startshixunCombat(false,undefined, item.challenge_id)}
// style={{marginTop: '-2px'}}>直接挑战</a>
// </Tooltip> : "" : ""
//
// }

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import {CNotificationHOC} from '../courses/common/CNotificationHOC'
import Loading from '../../Loading'; import Loading from '../../Loading';
import Loadable from 'react-loadable'; import Loadable from 'react-loadable';
@ -10,6 +10,7 @@ import { TPMIndexHOC } from '../tpm/TPMIndexHOC';
import { SnackbarHOC, getImageUrl } from 'educoder'; import { SnackbarHOC, getImageUrl } from 'educoder';
import AccountNav from './account/AccountNav' import AccountNav from './account/AccountNav'
import axios from 'axios'
const AccountBasic= Loadable({ const AccountBasic= Loadable({
loader: () => import('./account/AccountBasic'), loader: () => import('./account/AccountBasic'),
@ -30,16 +31,52 @@ const AccountSecure= Loadable({
}) })
class AccountPage extends Component { class AccountPage extends Component {
constructor (props) {
super(props)
this.state = {
basicInfo:undefined
}
}
componentDidUpdate =(prevState)=>{
if(this.props.current_user && this.props.current_user != prevState.current_user){
this.getBasicInfo(this.props.current_user.login);
}
}
componentDidMount = () =>{
if(this.props.current_user){
this.getBasicInfo(this.props.current_user.login);
}
}
getBasicInfo=(login)=>{
let url=`/users/accounts/${login}.json`;
axios.get(url).then((result)=>{
if(result.data){
this.setState({
basicInfo:result.data
})
if(result.data && result.data.base_info_completed == false){
this.props.history.push(`/account/basic/edit`);
}
}
}).catch((error)=>{
console.log(error);
})
}
render() { render() {
const common = {} let { basicInfo }=this.state;
const common = { basicInfo, getBasicInfo : this.getBasicInfo }
return ( return (
<div className="newMain clearfix accountPage"> <div className="newMain clearfix">
<div className="educontent df pt20">
<style>{` <style>{`
.accountPage { .accountPage {
display: flex; display: flex;
} }
`}</style> `}</style>
<AccountNav {...this.props}></AccountNav> <AccountNav {...this.props} {...common}></AccountNav>
<Switch {...this.props}> <Switch {...this.props}>
<Route exact path="/account/basic" <Route exact path="/account/basic"
@ -71,10 +108,10 @@ class AccountPage extends Component {
} }
></Route> ></Route>
</Switch> </Switch>
</div>
</div> </div>
); );
} }
} }
export default SnackbarHOC() ( TPMIndexHOC ( AccountPage )); export default CNotificationHOC()(SnackbarHOC() ( TPMIndexHOC ( AccountPage )));

@ -2,22 +2,24 @@ import React, { Component } from 'react';
import { SnackbarHOC, getImageUrl, City } from 'educoder'; import { SnackbarHOC, getImageUrl, City } from 'educoder';
import { Form, Button, Input, Radio, Select, Tooltip, Icon } from 'antd' import { Form, Button, Input, Radio, Select, Tooltip, Icon } from 'antd'
import './common.css'
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
const Option = Select.Option const Option = Select.Option
const radioOptions = [ const radioOptions = [
{ label: '男', value: 'Apple' }, { label: '男', value: 'boy' },
{ label: '女', value: 'Pear' }, { label: '女', value: 'girl' },
]; ];
class AccountBasicEdit extends Component { class AccountBasicEdit extends Component {
handleSubmit = () => { constructor(props){
this.props.form.validateFieldsAndScroll((err, values) => { super(props);
if (!err) {
} }
})
}
render() { render() {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const {basicInfo} =this.props
const showRealName = false; const showRealName = false;
return ( return (
<div className="basicFormWrap"> <div className="basicFormWrap">
@ -29,14 +31,6 @@ class AccountBasicEdit extends Component {
.formItemInline .ant-form-item-control-wrapper { .formItemInline .ant-form-item-control-wrapper {
display: inline-block; display: inline-block;
} }
.basicForm {
background: #fff;
padding: 30px;
width: 930px;
margin: 20px;
margin-bottom: 10px;
}
.basicForm .title { .basicForm .title {
font-size: 16px; font-size: 16px;
padding-left: 30px; padding-left: 30px;
@ -68,21 +62,21 @@ class AccountBasicEdit extends Component {
label="昵称" label="昵称"
className="display formItemInline" className="display formItemInline"
> >
hushasha {basicInfo && basicInfo.nickname}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="姓名" label="姓名"
className="display formItemInline" className="display formItemInline"
> >
* {basicInfo && basicInfo.name}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="性别" label="性别"
className="display formItemInline" className="display formItemInline"
> >
{basicInfo && basicInfo.gender == 0?"男":""}
</Form.Item> </Form.Item>
@ -90,28 +84,28 @@ class AccountBasicEdit extends Component {
label="所在地" label="所在地"
className="display formItemInline" className="display formItemInline"
> >
湖南省 长沙市 {basicInfo && basicInfo.location} {basicInfo && basicInfo.location_city}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="职业" label="职业"
className="display formItemInline" className="display formItemInline"
> >
专业人士 {basicInfo && basicInfo.technical_title}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="学校/单位" label="学校/单位"
className="display formItemInline mb0" className="display formItemInline mb0"
> >
中国移动长沙分公司 {basicInfo && basicInfo.school_name}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="院系/部门" label="院系/部门"
className="display formItemInline mb0" className="display formItemInline mb0"
> >
市场部 {basicInfo && basicInfo.department_name}
</Form.Item> </Form.Item>
</Form> </Form>
</div> </div>

@ -4,51 +4,306 @@ import { SnackbarHOC, getImageUrl, City } from 'educoder';
import { Form, Button, Input, Radio, Select, Tooltip, Icon } from 'antd' import { Form, Button, Input, Radio, Select, Tooltip, Icon } from 'antd'
import ApplyForAddOrgModal from '../modal/ApplyForAddOrgModal' import ApplyForAddOrgModal from '../modal/ApplyForAddOrgModal'
import ApplyForAddChildOrgModal from '../modal/ApplyForAddChildOrgModal' import ApplyForAddChildOrgModal from '../modal/ApplyForAddChildOrgModal'
import axios from 'axios'
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
const Option = Select.Option const Option = Select.Option;
const radioOptions = [
{ label: '男', value: 'Apple' }, const map={"teacher":"教师", "student":"学生", "professional":"专业人士"}
{ label: '女', value: 'Pear' },
];
class AccountBasic extends Component { class AccountBasic extends Component {
constructor(props){
super(props);
this.state={
nameLength:0,
showRealName:true,
schoolList:undefined,
filterSchoolList:undefined,
school:undefined,
departments:undefined,
filterDepartments:undefined,
departmentsName:undefined,
identity:"teacher",
school_id:undefined,
department_id:undefined
}
}
componentDidUpdate =(prevProps)=>{
if(this.props.basicInfo && prevProps.basicInfo == undefined){
this.setValue(this.props.basicInfo);
this.getSchoolList(this.props.basicInfo);
}
}
componentDidMount = () =>{
if(this.props.basicInfo){
this.setValue(this.props.basicInfo);
this.getSchoolList(this.props.basicInfo);
}
}
setValue=(basicInfo)=>{
if(basicInfo){
//if(basicInfo.nickname){
this.setState({
nameLength:basicInfo.nickname?basicInfo.nickname.length:0,
showRealName:basicInfo.show_realname,
identity:basicInfo.identity
})
//}
this.props.form.setFieldsValue({
nickname:basicInfo.nickname,
name:!basicInfo.show_realname ? this.hideRealName(basicInfo.name) : basicInfo.name,
student_No:basicInfo.student_id,
sex:String(basicInfo.gender),
job:map[basicInfo.identity],
org:basicInfo.school_name,
org2:basicInfo.department_name,
job1:basicInfo && basicInfo.identity=="teacher" ? basicInfo.technical_title:"教授",
job2:basicInfo && basicInfo.identity=="professional" ? basicInfo.technical_title:"企业管理者",
city:[basicInfo.location,basicInfo.location_city]
})
}
}
// 获取学校、单位
getSchoolList=(basicInfo)=>{
let url=`/schools/for_option.json`;
axios.get(url).then((result)=>{
if(result){
this.setState({
schoolList:result.data.schools
})
if(basicInfo && basicInfo.school_name){
this.setState({
school:basicInfo.school_name,
filterSchoolList:this.state.schoolList.filter(function(item){
return item.name.indexOf(basicInfo.school_name)>-1;
})
})
this.getDepartments(basicInfo.school_name,false);
}
}
}).catch((error)=>{
console.log(error);
})
}
// 输入昵称时change剩余的字数
changeNickName=(e)=>{
let num= 10 - parseInt(e.target.value.length);
this.setState({
nameLength:num < 0 ? 0 : num
})
}
handleSubmit = () => { handleSubmit = () => {
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) { console.log(values);
let {basicInfo}=this.props;
if(!err){
let url=`/users/accounts/${basicInfo.id}.json`
axios.put((url),{
nickname:values.nickname,
name:values.name,
show_realname:this.state.showRealName,
gender:parseInt(values.sex),
location:values.city[0],
location_city:values.city[1],
identity:values.job=="教师"?"teacher":values.job=="学生"?"student":"professional",
technical_title:values.job1 || values.job2,
student_id:values.job=="学生" ? values.student_No : null,
school_id:this.state.school_id,
department_id:this.state.department_id
}).then((result)=>{
if(result){
this.props.getBasicInfo();
}
}).catch((error)=>{
console.log(error);
})
}
})
}
// 隐藏或显示真实姓名
showOrHide=(flag,name)=>{
this.setState({
showRealName:flag==true?false:true
})
if(flag==true){
this.hideRealName(name);
}else{
this.props.form.setFieldsValue({
name
})
}
}
// 将名字隐藏起来
hideRealName=(name)=>{
let len=parseInt(name.length)-1;
let str="";
for(var i = 0; i < len; i++){ str += "*"; }
name = name.substr(0,1)+str;
this.props.form.setFieldsValue({
name
})
} }
// 过滤学校
filterList=(e)=>{
let arr=[];
if(e){
arr= this.state.schoolList.filter(function(item){
return item.name.indexOf(e)>-1;
});
this.props.form.setFieldsValue({
org:e
})
this.setState({
school:e,
filterSchoolList:arr
})
}
// else{
// let {school}=this.state;
// arr= this.state.schoolList.filter(function(item){
// return item.name.indexOf(school)>-1;
// });
// }
}
//搜索部门
searchDepartment=(e)=>{
this.props.form.setFieldsValue({
org2:e
})
let arr = this.state.departments.filter(function(item){
return item.name.indexOf(e) > -1
})
this.setState({
filterDepartments:arr,
departmentsName:e
}) })
} }
// 选择部门、学院
changeDepartment=(e)=>{
let arr=this.state.departments.filter(function(item){
return item.name == e;
});
this.setState({
departmentsName:e,
department_id:arr[0].id
})
}
// 选择学校(获取对应学校的学院、部门)
changeList=(e)=>{
this.getDepartments(e,true);
}
getDepartments=(e,flag)=>{
let arr=this.state.schoolList.filter(function(item){
return item.name == e;
});
// 保存选择的学校id
this.setState({
school_id:arr[0].id,
school:e,
})
let url=`/schools/${arr[0].id}/departments/for_option.json`;
axios.get(url).then((result)=>{
if(result){
this.setState({
departments:result.data.departments,
filterDepartments:result.data.departments
})
// 切换学校后,部门默认选择第一个
if(result.data.departments && result.data.departments.length>0 && flag==true){
this.props.form.setFieldsValue({
org2:result.data.departments[0].name
})
}
}
}).catch((error)=>{
console.log(error);
})
}
// 切换职称
changeJob=(e)=>{
this.setState({
identity:e
})
let {basicInfo}=this.props;
if(basicInfo){
this.props.form.setFieldsValue({
job1:basicInfo && basicInfo.identity=="teacher" ? basicInfo.technical_title:"教授",
job2:basicInfo && basicInfo.identity=="professional" ? basicInfo.technical_title:"企业管理者",
})
}
}
showApplyForAddOrgModal = () => { showApplyForAddOrgModal = () => {
this.applyForAddOrgForm.setVisible(true) this.applyForAddOrgForm.setVisible(true)
} }
showApplyForAddChildOrgModal = () => { showApplyForAddChildOrgModal = () => {
let{school,schoolList}=this.state;
let arr=schoolList.filter(function(item){
return item.name == school;
});
if(arr.length > 0){
this.applyForAddChildOrgForm.setVisible(true) this.applyForAddChildOrgForm.setVisible(true)
}else{
this.props.showNotification("请先选择正确的单位或者学校!");
}
} }
applyForAddChildOrgForm
render() { render() {
let{
nameLength,
showRealName,
filterSchoolList,
filterDepartments,
school,
school_id,
departmentsName,
identity
}=this.state;
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const showRealName = false; let{basicInfo}=this.props
return ( return (
<div className="basicFormWrap"> <div className="basicFormWrap">
<ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} ></ApplyForAddOrgModal> <ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school}
<ApplyForAddChildOrgModal ref="applyForAddChildOrgModal" wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form} ></ApplyForAddChildOrgModal> {...this.props}></ApplyForAddOrgModal>
<ApplyForAddChildOrgModal ref="applyForAddChildOrgModal" schoolName={school} schoolId={school_id} departmentName={departmentsName}
{...this.props} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form} ></ApplyForAddChildOrgModal>
<div className="basicForm"> <div className="basicForm">
<style>{` <style>{`
.formItemInline { .formItemInline {
display: flex; display: flex;
margin-bottom: 20px;
position:relative;
}
.formItemInline .ant-form-explain{
position:absolute;
bottom:-20px;
left:0px;
width:100%;
} }
.formItemInline .ant-form-item-control-wrapper { .formItemInline .ant-form-item-control-wrapper {
display: inline-block; display: inline-block;
} }
.resetSexStyle .ant-form-item-label,.resetSexStyle .ant-form-item-control-wrapper .ant-form-item-control{
.basicForm { height:25px;
background: #fff; line-height:25px;
padding: 30px;
width: 930px;
margin: 20px;
margin-bottom: 10px;
} }
.basicForm .title { .basicForm .title {
font-size: 16px; font-size: 16px;
@ -73,6 +328,12 @@ class AccountBasic extends Component {
.basicForm .ant-form-item-label label { .basicForm .ant-form-item-label label {
color: #979797 color: #979797
} }
.basicForm .ant-cascader-picker-label{
font-size:14px;
}
.resetCityStyle .ant-form-item-control{
width:190px;
}
`}</style> `}</style>
<div className="title">基本信息</div> <div className="title">基本信息</div>
@ -88,13 +349,15 @@ class AccountBasic extends Component {
message: '请输入您的昵称', message: '请输入您的昵称',
}], }],
})( })(
<Input placeholder="请输入您的昵称10个字以内"></Input> <Input placeholder="请输入您的昵称10个字以内" onInput={this.changeNickName} maxLength="10" suffix ={
<span className="color-grey-6 font-13">{String(nameLength)}/10</span>
}></Input>
)} )}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="姓名" label="姓名"
className="mt15 formItemInline" className="formItemInline"
> >
{getFieldDecorator('name', { {getFieldDecorator('name', {
rules: [{ rules: [{
@ -103,10 +366,8 @@ class AccountBasic extends Component {
message: '请输入您的姓名', message: '请输入您的姓名',
}], }],
})( })(
<Input placeholder="请输入您的姓名" suffix={ <Input placeholder="请输入您的姓名" disabled={!showRealName} suffix={
<Tooltip title=""> <i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"} onClick={()=>this.showOrHide(showRealName,basicInfo.name)}></i>
<Icon type="info-circle" style={{ color: 'rgba(0,0,0,.45)' }} />
</Tooltip>
}></Input> }></Input>
)} )}
<span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span> <span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span>
@ -114,55 +375,124 @@ class AccountBasic extends Component {
<Form.Item <Form.Item
label="性别" label="性别"
className="mt15 formItemInline" className="formItemInline resetSexStyle"
> >
{getFieldDecorator('sex', { {getFieldDecorator('sex', {
rules: [{ rules: [{
// initialValue: this.state.cityDefaultValue,
required: true, required: true,
message: '', message: '请选择性别',
}], }],
})( })(
<RadioGroup options={radioOptions} /> <RadioGroup>
<Radio value="0"></Radio>
<Radio value="1"></Radio>
</RadioGroup>
)} )}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="所在地" label="所在地"
className="mt15 formItemInline" className="formItemInline resetCityStyle"
> >
{getFieldDecorator('city', { {getFieldDecorator('city', {
rules: [{ rules: [{
// initialValue: this.state.cityDefaultValue,
type: 'array', type: 'array',
required: true, required: true,
message: '请先选择所在地', message: '请先选择所在地',
}], }],
})( })(
<City ></City> <City></City>
)} )}
</Form.Item> </Form.Item>
<div className="clearfix">
<Form.Item <Form.Item
label="职业" label="职业"
className="mt15 formItemInline" className="formItemInline fl"
> >
{getFieldDecorator('job', { {getFieldDecorator('job', {
rules: [{ rules: [{
// initialValue: this.state.cityDefaultValue, initialValue:"teacher",
type: 'array',
required: true, required: true,
message: '请先选择职业', message: '请先选择职业',
}], }],
})( })(
<City ></City> <Select style={{width:"190px",marginRight:"20px"}} onChange={this.changeJob}>
<Option value="teacher">教师</Option>
<Option value="student">学生</Option>
<Option value="professional">专业人士</Option>
</Select>
)} )}
</Form.Item> </Form.Item>
{
identity && identity=="student" &&
<Form.Item
label=""
className="formItemInline fl"
// style={{display:identity && identity=="student" ? "block":"none"}}
>
{getFieldDecorator('student_No', {
rules: [{
required: true,
message: '请先输入学号',
}],
})(
<Input type="text" placeholder="请输入学号" style={{width:"190px"}}></Input>
)}
</Form.Item>
}
{
identity && identity=="teacher" &&
<Form.Item
label=""
className="formItemInline fl"
// style={{display:identity && identity=="teacher" ? "block":"none"}}
>
{getFieldDecorator('job1', {
rules: [{
initialValue:"教授",
required: true,
message: '请先选择职称',
}],
})(
<Select style={{width:"190px"}}>
<Option value="教授">教授</Option>
<Option value="副教授">副教授</Option>
<Option value="讲师">讲师</Option>
<Option value="助教">助教</Option>
</Select>
)}
</Form.Item>
}
{
identity && identity=="professional" &&
<Form.Item
label=""
className="formItemInline fl mb0"
// style={{display:identity && identity=="professional" ? "block":"none"}}
>
{getFieldDecorator('job2', {
rules: [{
initialValue:"企业管理者",
required: true,
message: '请先选择职称',
}],
})(
<Select style={{width:"190px"}}>
<Option value="企业管理者">企业管理者</Option>
<Option value="部门管理者">部门管理者</Option>
<Option value="高级工程师">高级工程师</Option>
<Option value="工程师">工程师</Option>
<Option value="助理工程师">助理工程师</Option>
</Select>
)}
</Form.Item>
}
</div>
<Form.Item <Form.Item
label="学校/单位" label="学校/单位"
className="mt15 formItemInline mb0" className="formItemInline mb0"
> >
{getFieldDecorator('org', { {getFieldDecorator('org', {
rules: [{ rules: [{
@ -172,20 +502,26 @@ class AccountBasic extends Component {
message: '请先选择学校/单位', message: '请先选择学校/单位',
}], }],
})( })(
<Select width={400}> <Select width={400} showSearch onSearch={this.filterList} onChange={this.changeList}>
<Option value="1">国防科技大学</Option> {
<Option value="2">国防科技大学1</Option> filterSchoolList && filterSchoolList.map((item,key)=>{
return(<Option value={item.name} key={item.id}>{item.name}</Option>)
})
}
</Select> </Select>
)} )}
</Form.Item> </Form.Item>
<div style={{marginLeft: '100px'}}> <div style={{marginLeft: '100px',height:"20px",lineHeight:"20px"}}>
<span style={{color: '#CDCDCD'}}>未找到包含Test的高校</span> {!filterSchoolList || (filterSchoolList && filterSchoolList.length==0 )&&
<span>
<span style={{color: '#CDCDCD'}}>未找到包含{school}的高校</span>
<span style={{color: '#4CACFF', cursor: 'pointer'}} onClick={this.showApplyForAddOrgModal}>申请新增</span> <span style={{color: '#4CACFF', cursor: 'pointer'}} onClick={this.showApplyForAddOrgModal}>申请新增</span>
</span>
}
</div> </div>
<Form.Item <Form.Item
label="院系/部门" label="院系/部门"
className="mt15 formItemInline mb0" className="formItemInline mb0"
> >
{getFieldDecorator('org2', { {getFieldDecorator('org2', {
rules: [{ rules: [{
@ -195,15 +531,25 @@ class AccountBasic extends Component {
message: '请先选择院系/部门', message: '请先选择院系/部门',
}], }],
})( })(
<Select width={400}> <Select width={400} showSearch onSearch={this.searchDepartment} onChange={this.changeDepartment}>
<Option value="1">计算机学院</Option> {
<Option value="2">数学学院</Option> filterDepartments && filterDepartments.map((item,key)=>{
return(
<Option value={item.name}>{item.name}</Option>
)
})
}
</Select> </Select>
)} )}
</Form.Item> </Form.Item>
<div style={{marginLeft: '100px'}}> <div style={{marginLeft: '100px',height:"20px",lineHeight:"20px"}}>
<span style={{color: '#CDCDCD'}}>未找到包含Test的院系/部门</span> {
!filterDepartments || (filterDepartments && filterDepartments.length==0 )&&
<span>
<span style={{color: '#CDCDCD'}}>未找到包含{departmentsName}的院系/部门</span>
<span style={{color: '#4CACFF', cursor: 'pointer'}} onClick={this.showApplyForAddChildOrgModal}>申请新增</span> <span style={{color: '#4CACFF', cursor: 'pointer'}} onClick={this.showApplyForAddChildOrgModal}>申请新增</span>
</span>
}
</div> </div>
{/* htmlType="submit" */} {/* htmlType="submit" */}

@ -3,26 +3,33 @@ import React, { Component } from 'react';
import { WordsBtn, getImageUrl } from 'educoder'; import { WordsBtn, getImageUrl } from 'educoder';
import RealNameCertificationModal from '../modal/RealNameCertificationModal' import RealNameCertificationModal from '../modal/RealNameCertificationModal'
import '../../courses/css/Courses.css' import '../../courses/css/Courses.css'
import {CNotificationHOC} from '../../courses/common/CNotificationHOC'
class AccountCertification extends Component { class AccountCertification extends Component {
showRealNameCertificationModal = () => { constructor(props){
super(props);
this.state={
certification:1
}
}
showRealNameCertificationModal = (index) => {
this.setState({
certification:index
})
this.realNameCertificationModal.setVisible(true) this.realNameCertificationModal.setVisible(true)
} }
render() { render() {
let {certification}=this.state
let {basicInfo} = this.props;
return ( return (
<div className="basicFormWrap"> <div className="basicFormWrap">
<RealNameCertificationModal ref="realNameCertificationModal" <RealNameCertificationModal ref="realNameCertificationModal" {...this.props}
wrappedComponentRef={(form) => this.realNameCertificationModal = form} wrappedComponentRef={(form) => this.realNameCertificationModal = form} certification={certification}
></RealNameCertificationModal> ></RealNameCertificationModal>
<div className="basicForm"> <div className="basicForm">
<style>{` <style>{`
.basicForm {
background: #fff;
padding: 30px;
width: 930px;
margin: 20px;
margin-bottom: 10px;
}
.basicForm .title { .basicForm .title {
font-size: 16px; font-size: 16px;
padding-left: 30px; padding-left: 30px;
@ -39,7 +46,7 @@ class AccountCertification extends Component {
margin-left: 46px; margin-left: 46px;
} }
.flexRow .description { .flexRow .description {
margin-left: 10px; margin-left: 30px;
flex: 1; flex: 1;
color: #CDCDCD; color: #CDCDCD;
} }
@ -47,33 +54,32 @@ class AccountCertification extends Component {
width: 100px; width: 100px;
color: #28AC7F; color: #28AC7F;
} }
.borderBottom {
border-bottom: 1px solid #4CACFF;
}
`}</style> `}</style>
<div className="title">认证信息</div> <div className="title">认证信息</div>
<div className="flexTable"> <div className="flexTable">
<div className="flexRow"> <div className="flexRow lineh-20 mb20">
<div className="name">实名认证</div> <div className="name">实名认证</div>
<div className="description">有些课程需要实名认证才能加入哟还能获得500金币的奖励~ </div> <div className="description">有些课程需要实名认证才能加入哟还能获得500金币的奖励~ </div>
<div className="status"> <div className="status">
{/* showRealNameCertificationModal */} {
<WordsBtn style="blue" className="borderBottom" basicInfo && basicInfo.authentication =="uncertified" ?
onClick={this.showRealNameCertificationModal} <WordsBtn style="blue" className="borderBottom" onClick={()=>this.showRealNameCertificationModal(1)} >立即认证</WordsBtn>:
>立即认证</WordsBtn> basicInfo && basicInfo.authentication =="applying" ? <span style={{color: '#FF6800'}}>待审核</span>:
<span><i className="iconfont icon-wancheng color-green font-16 mr3"></i></span>
@ }
<span>已认证</span>
</div> </div>
</div> </div>
<div className="flexRow"> <div className="flexRow lineh-20">
<div className="name">职业认证</div> <div className="name">职业认证</div>
<div className="description">教师认证完毕之后可创建课堂发布实训免金币查看所有实训答案.. </div> <div className="description">教师认证完毕之后可创建课堂发布实训免金币查看所有实训答案.. </div>
<div className="status"> <div className="status">
@ {
<WordsBtn style="blue" className="borderBottom">立即认证</WordsBtn> basicInfo && basicInfo.professional_certification =="uncertified" ?
<span style={{color: '#FF6800'}}>待审核</span> <WordsBtn style="blue" className="borderBottom" onClick={()=>this.showRealNameCertificationModal(2)} >立即认证</WordsBtn>:
basicInfo && basicInfo.professional_certification =="applying" ? <span style={{color: '#FF6800'}}>待审核</span>:
<span><i className="iconfont icon-wancheng color-green font-16 mr3"></i></span>
}
</div> </div>
</div> </div>
</div> </div>

@ -1,12 +1,15 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { SnackbarHOC, getImageUrl } from 'educoder'; import { SnackbarHOC, getImageUrl } from 'educoder';
import ChangeHeaderPicModal from './ChangeHeaderPicModal'
class AccountNav extends Component { class AccountNav extends Component {
editImg = () => {
this.refs['picModal'].setVisible(true)
}
render() { render() {
// newMain clearfix
return ( return (
<div className="headphoto mt14"> <div className="headphoto mt14">
<ChangeHeaderPicModal {...this.props} ref="picModal"></ChangeHeaderPicModal>
<style>{` <style>{`
/* /*
.headphoto { .headphoto {
@ -44,7 +47,7 @@ class AccountNav extends Component {
display: block; display: block;
} }
`}</style> `}</style>
<img alt="头像" id="user_avatar_show" nhname="avatar_image" src="https://www.educoder.net/images/avatars/User/b?1532489442"></img> <img alt="头像" id="user_avatar_show" nhname="avatar_image" src={`${getImageUrl("images/"+this.props.src)}`}></img>
<p className="headphoto-black" onClick={this.editImg} >修改头像</p> <p className="headphoto-black" onClick={this.editImg} >修改头像</p>
</div> </div>
); );

@ -13,87 +13,45 @@ class AccountNav extends Component {
this.props.history.push(`/account/secure`) this.props.history.push(`/account/secure`)
} }
render() { render() {
let { basicInfo } = this.props
console.log(this.props);
const path = window.location.pathname const path = window.location.pathname
const isBasic = path.indexOf('basic') != -1 || path == "/account" const isBasic = path.indexOf('basic') != -1 || path == "/account"
const isCertification = path.indexOf('certification') != -1 const isCertification = path.indexOf('certification') != -1
const isSecure = path.indexOf('secure') != -1 const isSecure = path.indexOf('secure') != -1
return ( return (
<div className="accountNav"> <div className="accountNav fl">
<style>{`
.accountNav {
width: 290px;
box-shadow: 0px 4px 9px 0px rgba(11,62,120,0.21);
border-radius: 2px;
padding-top: 8px;
padding-bottom: 32px;
margin: 20px;
}
.accountInfo {
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
}
.accountInfo .name {
color: #05101A;
font-size: 24px;
height: 36px;
}
.accountInfo .role {
color: #666666;
font-size: 14px;
}
.accountManagement {
}
.accountManagement .title {
color: #05101A;
font-size: 18px;
font-weight: bold;
padding: 10px 28px;
margin-top: 6px;
}
.accountManagement .navItem {
font-size: 16px;
padding: 6px 0px;
padding-left: 30px;
border-left: 2px solid #fff;
cursor: pointer;
}
.accountManagement .navItem i{
margin-top: -4px;
display: inline-block;
margin-right: 3px;
}
.accountManagement .navItem i.status{
margin-top: 1px;
margin-right: 24px;
}
.accountManagement .navItem.active {
border-left: 2px solid #4CACFF;
background: #E6F3FF;
}
`}</style>
<div className="accountInfo"> <div className="accountInfo">
<AccountImg></AccountImg> <AccountImg src={basicInfo && basicInfo.avatar_url}></AccountImg>
<span className="name">莎莎</span> <span className="name">{basicInfo && basicInfo.name}</span>
<span className="role">管理员</span> <span className="role">{basicInfo && basicInfo.technical_title}</span>
</div> </div>
<div className="accountManagement"> <div className="accountManagement">
<div className="title">账号管理</div> <div className="title">账号管理</div>
<ul> <ul>
<li className={`navItem ${isBasic ? 'active' : ''}`} onClick={this.toBasic}> <li className={`navItem ${isBasic ? 'active' : ''}`} onClick={this.toBasic}>
<i className="iconfont icon-dianzan color-grey-9 font-16"></i> <i className="iconfont icon-jibenxinxi color-grey-9 font-16"></i>
基本信息 基本信息
<i className="status fr iconfont icon-dianzan color-grey-9 font-16"></i> {
basicInfo && (basicInfo.authentication == 'uncertified' || basicInfo.authentication == 'applying') &&
<i className="status fr iconfont icon-tishi color-red font-16"></i>
}
{
basicInfo && basicInfo.authentication == 'certified' &&
<i className="status fr iconfont icon-wancheng color-green-light font-16"></i>
}
</li> </li>
<li className={`navItem ${isCertification ? 'active' : ''}`} onClick={this.toCertification}> <li className={`navItem ${isCertification ? 'active' : ''}`} onClick={this.toCertification}>
<i className="iconfont icon-dianzan color-grey-9 font-16"></i> <i className="iconfont icon-renzhengxinxi color-grey-9 font-16"></i>
{
basicInfo && basicInfo.professional_certification == 'certified' && basicInfo.authentication == 'certified' ?
<i className="status fr iconfont icon-wancheng color-green-light font-16"></i>:
<i className="status fr iconfont icon-tishi color-red font-16"></i>
}
</li> </li>
<li className={`navItem ${isSecure ? 'active' : ''}`} onClick={this.toSecure}> <li className={`navItem ${isSecure ? 'active' : ''}`} onClick={this.toSecure}>
<i className="iconfont icon-dianzan color-grey-9 font-16"></i> <i className="iconfont icon-anquanshezhi color-grey-9 font-16"></i>
</li> </li>
</ul> </ul>
</div> </div>

@ -5,9 +5,24 @@ import { Form, Button, Input } from 'antd'
import '../../courses/css/Courses.css' import '../../courses/css/Courses.css'
import './common.css' import './common.css'
import axios from 'axios'
const PHONE = 'PHONE' const PHONE = 'PHONE'
const EMAIL = 'EMAIL' const EMAIL = 'EMAIL'
const PASSWORD = 'PASSWORD' const PASSWORD = 'PASSWORD'
function regPhoneAndEmail(value){
if(value.indexOf("@")>-1){
// 加密邮箱
let beforeStr=value.split("@")[0];
let afterStr=value.split("@")[1];
return beforeStr.substr(0,3)+"**"+beforeStr.substr(beforeStr.length-1,1)+"@"+afterStr;
}else{
// 加密手机号码
return value.substr(0,3)+"****"+value.substr(7,4);
}
}
class AccountSecure extends Component { class AccountSecure extends Component {
constructor (props) { constructor (props) {
super(props) super(props)
@ -15,10 +30,41 @@ class AccountSecure extends Component {
updating: '' updating: ''
} }
} }
// 获取验证码
getCode=(index)=>{
let url=`/account/get_verification_code.json`
if(index == 3){
//绑定手机号码
let values=this.props.form.getFieldsValue();
console.log(values);
}
}
onPhoneSubmit = () => { onPhoneSubmit = () => {
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) { if (!err) {
let {login}=this.props.current_user;
let reg=/^1\d{10}$/;
if(reg.test(values.phone)){
let url=`/users/accounts/${login}/phone_bind.json`
axios.post((url),{
phone:values.phone,
code:values.phoneValidateCode
}).then((result)=>{
if(result){
this.props.showNotification("手机号码绑定成功!");
this.setState({
updating:''
})
this.props.getBasicInfo();
}
}).catch((error)=>{
console.log(error);
})
}else{
this.props.showNotification("请输入有效的11位手机号码");
}
} }
}) })
} }
@ -36,7 +82,16 @@ class AccountSecure extends Component {
} }
}) })
} }
//取消编辑
hideUpdating=()=>{
this.setState({
updating:""
})
}
render() { render() {
let {basicInfo}=this.props;
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const { updating } = this.state const { updating } = this.state
return ( return (
@ -70,7 +125,6 @@ class AccountSecure extends Component {
text-align: right; text-align: right;
} }
.flexTable .flexTable { .flexTable .flexTable {
padding-bottom: 24px;
border-bottom: 1px solid #EBEBEB; border-bottom: 1px solid #EBEBEB;
} }
@ -94,6 +148,12 @@ class AccountSecure extends Component {
.settingForm .ant-form-item-label { .settingForm .ant-form-item-label {
width: 204px; width: 204px;
} }
.formItemInline .ant-form-explain{
position:absolute;
bottom:-17px;
left:0px;
width:100%;
}
`}</style> `}</style>
<div className="title">安全设置</div> <div className="title">安全设置</div>
<Form> <Form>
@ -101,25 +161,30 @@ class AccountSecure extends Component {
<div className="flexTable"> <div className="flexTable">
<div className="flexRow"> <div className="flexRow">
<div className="name">手机</div> <div className="name">手机</div>
{/* #EA320E
仅自己可见可用于手机号码登录EduCoder
*/}
<div className="description"> <div className="description">
{
basicInfo && basicInfo.phone ?
<span>{ regPhoneAndEmail(basicInfo.phone) }</span>
:
<span style={{color: '#EA320E'}}>未绑定</span> <span style={{color: '#EA320E'}}>未绑定</span>
}
绑定手机号码将获得500金币的奖励哟手机号码仅自己可见~ 绑定手机号码将获得500金币的奖励哟手机号码仅自己可见~
</div> </div>
{
updating != PHONE &&
<div className="status"> <div className="status">
<WordsBtn style="blue" className="borderBottom" <WordsBtn style="blue" className="borderBottom"
onClick={() => this.setState({updating: PHONE})} onClick={() => this.setState({updating: PHONE})}
>立即绑定</WordsBtn> >{basicInfo && basicInfo.phone ? "更换" : "立即绑定" }</WordsBtn>
</div> </div>
}
</div> </div>
{ updating == PHONE && { updating == PHONE &&
<React.Fragment> <React.Fragment>
<Form.Item <Form.Item
label="你的手机号" label="你的手机号"
className="mt15 formItemInline hideRequireTag mb0" className="formItemInline hideRequireTag mb20"
> >
{getFieldDecorator('phone', { {getFieldDecorator('phone', {
rules: [{ rules: [{
@ -134,7 +199,7 @@ class AccountSecure extends Component {
<Form.Item <Form.Item
label="手机验证码" label="手机验证码"
className="mt15 formItemInline hideRequireTag" className="mb20 formItemInline hideRequireTag"
> >
{getFieldDecorator('phoneValidateCode', { {getFieldDecorator('phoneValidateCode', {
rules: [{ rules: [{
@ -145,12 +210,12 @@ class AccountSecure extends Component {
})( })(
<Input placeholder="请输入手机获取的验证码" className="validateInput"></Input> <Input placeholder="请输入手机获取的验证码" className="validateInput"></Input>
)} )}
<Button type="primary">获取验证码</Button> <Button type="primary" onClick={()=>this.getCode(3)}>获取验证码</Button>
</Form.Item> </Form.Item>
<div style={{ marginLeft: '118px' }}> <div className="mb20" style={{ marginLeft: '118px' }}>
<Button type="primary" onClick={this.onPhoneSubmit}>确定</Button> <Button type="primary" onClick={this.onPhoneSubmit}>确定</Button>
<Button type="primary grayBtn" style={{ marginLeft: '20px'}}>取消</Button> <Button type="primary grayBtn" style={{ marginLeft: '20px'}} onClick={this.hideUpdating}>取消</Button>
</div> </div>
</React.Fragment> } </React.Fragment> }
</div> </div>
@ -159,21 +224,29 @@ class AccountSecure extends Component {
<div className="flexRow"> <div className="flexRow">
<div className="name">邮箱</div> <div className="name">邮箱</div>
<div className="description"> <div className="description">
<span>kuc***w@126.com</span> {
basicInfo && basicInfo.mail ?
<span>{ regPhoneAndEmail(basicInfo.mail) }</span>
:
<span style={{color: '#EA320E'}}>未绑定</span>
}
邮箱账号仅自己可见可用于邮箱账号登录EduCoder 邮箱账号仅自己可见可用于邮箱账号登录EduCoder
</div> </div>
{
updating != EMAIL &&
<div className="status"> <div className="status">
<WordsBtn style="blue" className="borderBottom" <WordsBtn style="blue" className="borderBottom"
onClick={() => this.setState({updating: EMAIL})} onClick={() => this.setState({updating: EMAIL})}
>更换</WordsBtn> >{basicInfo && basicInfo.mail ?"更换":"立即绑定"}</WordsBtn>
</div> </div>
}
</div> </div>
{ updating == EMAIL && { updating == EMAIL &&
<React.Fragment> <React.Fragment>
<Form.Item <Form.Item
label="邮箱地址" label="邮箱地址"
className="mt15 formItemInline hideRequireTag mb0" className="formItemInline hideRequireTag mb20"
> >
{getFieldDecorator('phone', { {getFieldDecorator('phone', {
rules: [{ rules: [{
@ -188,7 +261,7 @@ class AccountSecure extends Component {
<Form.Item <Form.Item
label="邮箱验证码" label="邮箱验证码"
className="mt15 formItemInline hideRequireTag" className="mb20 formItemInline hideRequireTag"
> >
{getFieldDecorator('phoneValidateCode', { {getFieldDecorator('phoneValidateCode', {
rules: [{ rules: [{
@ -202,9 +275,9 @@ class AccountSecure extends Component {
<Button type="primary">获取验证码</Button> <Button type="primary">获取验证码</Button>
</Form.Item> </Form.Item>
<div style={{ marginLeft: '118px' }}> <div className="mb20" style={{ marginLeft: '118px' }}>
<Button type="primary">确定</Button> <Button type="primary" onClick={this.onEmailSubmit}>确定</Button>
<Button type="primary grayBtn" style={{ marginLeft: '20px'}}>取消</Button> <Button type="primary grayBtn" style={{ marginLeft: '20px'}} onClick={this.hideUpdating}>取消</Button>
</div> </div>
</React.Fragment> } </React.Fragment> }
@ -218,18 +291,21 @@ class AccountSecure extends Component {
<span>**********</span> <span>**********</span>
用于保护账户信息和登录安全 用于保护账户信息和登录安全
</div> </div>
{
updating != PASSWORD &&
<div className="status"> <div className="status">
<WordsBtn style="blue" className="borderBottom" <WordsBtn style="blue" className="borderBottom"
onClick={() => this.setState({updating: PASSWORD})} onClick={() => this.setState({updating: PASSWORD})}
>修改</WordsBtn> >修改</WordsBtn>
</div> </div>
}
</div> </div>
{ updating == PASSWORD && { updating == PASSWORD &&
<React.Fragment> <React.Fragment>
<Form.Item <Form.Item
label="旧密码" label="旧密码"
className="mt15 formItemInline hideRequireTag mb0" className="mb20 formItemInline hideRequireTag"
> >
{getFieldDecorator('p_old', { {getFieldDecorator('p_old', {
rules: [{ rules: [{
@ -244,7 +320,7 @@ class AccountSecure extends Component {
<Form.Item <Form.Item
label="新密码" label="新密码"
className="mt15 formItemInline hideRequireTag mb0" className="mb20 formItemInline hideRequireTag"
> >
{getFieldDecorator('p_new', { {getFieldDecorator('p_new', {
rules: [{ rules: [{
@ -259,7 +335,7 @@ class AccountSecure extends Component {
<Form.Item <Form.Item
label="再次输入" label="再次输入"
className="mt15 formItemInline hideRequireTag" className="mb20 formItemInline hideRequireTag"
> >
{getFieldDecorator('p_again', { {getFieldDecorator('p_again', {
rules: [{ rules: [{
@ -272,9 +348,9 @@ class AccountSecure extends Component {
)} )}
</Form.Item> </Form.Item>
<div style={{ marginLeft: '118px' }}> <div className="mb20" style={{ marginLeft: '118px' }}>
<Button type="primary" onClick={this.onPasswordSubmit}>确定</Button> <Button type="primary" onClick={this.onPasswordSubmit}>确定</Button>
<Button type="primary grayBtn" style={{ marginLeft: '20px'}}>取消</Button> <Button type="primary grayBtn" style={{ marginLeft: '20px'}} onClick={this.hideUpdating}>取消</Button>
</div> </div>
</React.Fragment> } </React.Fragment> }
</div> </div>

@ -0,0 +1,166 @@
import React, { Component } from "react";
import { Modal } from "antd";
import axios from 'axios'
import ModalWrapper from "../../courses/common/ModalWrapper"
import { Cropper } from 'educoder'
const imageId = 'changeHeaderPic'
const previewId = 'changeHeader_imagePreview'
let uploadedImageType;
let uploadedImageName;
let uploadedImageURL;
class ChangeHeaderPicModal extends Component{
constructor(props){
super(props);
this.state={
}
}
init = () => {
var inputImage = document.getElementById('inputImage');
const that = this;
inputImage.onchange = function () {
var files = this.files;
var file;
// cropper &&
if (files && files.length) {
file = files[0];
if (/^image\/\w+/.test(file.type)) {
uploadedImageType = file.type;
uploadedImageName = file.name;
if (uploadedImageURL) {
URL.revokeObjectURL(uploadedImageURL);
}
const image = document.getElementById( imageId );
image.src = uploadedImageURL = URL.createObjectURL(file);
that.refs['cropper'].renew(image)
// cropper.destroy();
// cropper = new Cropper(image, options);
inputImage.value = null;
} else {
this.props.showNotification && this.props.showNotification("请选择一个图片格式的文件")
// window.alert('Please choose an image file.');
}
}
};
}
componentDidMount() {
}
setVisible = (visible) => {
this.refs['modalWrapper'].setVisible(visible)
if (visible) {
setTimeout(() => {
this.init()
}, 300)
}
}
onSendOk = () => {
}
onOk = () => {
var img_lg = document.getElementById(previewId);
// 截图小的显示框内的内容
window.html2canvas(img_lg).then((canvas) => {
var dataUrl = canvas.toDataURL("image/jpeg");
console.log(dataUrl)
const url = `/users/accounts/${this.props.userLogin || 'kosasa'}/avatar.json`
axios.put(url, {
image: dataUrl
})
.then((response) => {
// {"status":0,"message":"success","avatar_url":"avatars/User/15739"}
if (response.data.status == 0) {
this.props.showNotification && this.props.showNotification("修改头像成功")
this.setVisible(false)
}
})
.catch(function (error) {
console.log(error);
});
});
}
render(){
const { course_lists } = this.state
const { moduleName } = this.props
return(
<ModalWrapper
ref="modalWrapper"
title={`上传头像`}
{...this.props }
onOk={this.onOk}
okText="保存"
width={552}
className="changeHeaderModal"
>
<style>{`
#changeHeader_imagePreview {
overflow: hidden;
background-color: #fff;
border-radius: 50%;
text-align: center;
width: 120px;
height: 120px;
}
.previewWrap {
flex-direction: column;
justify-content: space-between;
height: 320px;
align-items: center;
margin-left: 36px;
}
.changeHeaderModal .tip {
color: #9B9B9B;
}
.previewWrap .tip {
text-align: center;
margin-top: 2px;
}
#uploadBtn {
color: #4CACFF;
border: 1px solid #4CACFF;
padding: 2px 18px;
cursor: pointer;
}
`}</style>
<div className="df">
<div>
<Cropper
ref="cropper"
imageId={imageId}
previewId="changeHeader_imagePreview"
width={320} height={320}
></Cropper>
<span className="tip">仅支持JPGGIFPNG且文件小于2M</span>
</div>
<div
className="df previewWrap" style ={{flexDirection: 'column'}}
>
<div>
<div id="changeHeader_imagePreview"></div>
<div className="tip">头像预览</div>
</div>
<label id="uploadBtn" for="inputImage">
<input type="file" class="sr-only" id="inputImage" name="file" accept="image/*"></input>
重新上传
</label>
</div>
</div>
</ModalWrapper>
)
}
}
export default ChangeHeaderPicModal;

@ -1,9 +1,10 @@
.basicForm { .basicForm {
background: #fff; background: #fff;
padding: 30px; padding: 30px;
width: 930px;
margin: 20px;
margin-bottom: 10px; margin-bottom: 10px;
box-sizing: border-box;
width: 100%;
min-height: 390px;
} }
.basicForm .title { .basicForm .title {
font-size: 16px; font-size: 16px;
@ -17,7 +18,10 @@
.flexRow { .flexRow {
display: flex; display: flex;
} }
.color-green-light{
color: #45E660!important;
}
.mb15{margin-bottom: 15px!important;}
/* BUTTOn */ /* BUTTOn */
.ant-btn { .ant-btn {
border-radius: 2px; border-radius: 2px;
@ -27,7 +31,7 @@ button.ant-btn.ant-btn-primary.grayBtn {
border-color: #CBCBCB; border-color: #CBCBCB;
} }
.borderBottom { .borderBottom {
border-bottom: 2px solid #4CACFF; border-bottom: 1px solid #4CACFF;
} }
/* form ---------------- START */ /* form ---------------- START */
@ -41,7 +45,10 @@ button.ant-btn.ant-btn-primary.grayBtn {
display: none; display: none;
} }
.basicFormWrap{
flex:1;
width: 0;
}
/* .basicForm .ant-form-item-label { /* .basicForm .ant-form-item-label {
width: 100px; width: 100px;
padding-right: 10px; padding-right: 10px;
@ -49,3 +56,61 @@ button.ant-btn.ant-btn-primary.grayBtn {
.basicForm .ant-form-item-label label { .basicForm .ant-form-item-label label {
color: #979797 color: #979797
} */ } */
/* 左侧 */
.accountNav {
width: 290px;
box-shadow: 0px 4px 9px 0px rgba(11,62,120,0.21);
border-radius: 2px;
padding-top: 8px;
padding-bottom: 30px;
margin-bottom:30px;
margin-right:20px;
max-height:430px;
}
.accountInfo {
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
}
.accountInfo .name {
color: #05101A;
font-size: 24px;
height: 36px;
}
.accountInfo .role {
color: #666666;
font-size: 14px;
}
.accountManagement .title {
color: #05101A;
font-size: 18px;
font-weight: 400;
padding: 10px 28px;
margin-top: 6px;
}
.accountManagement .navItem {
font-size: 16px;
padding: 6px 0px;
padding-left: 30px;
border-left: 2px solid #fff;
cursor: pointer;
color:#4D4D4D;
}
.accountManagement .navItem i{
margin-top: -4px;
display: inline-block;
margin-right: 7px;
}
.accountManagement .navItem i.status{
margin-top: 1px;
margin-right: 24px;
}
.accountManagement .navItem.active {
border-left: 2px solid #4CACFF;
background: #E6F3FF;
}
.accountManagement .navItem.active i:first-child{
color:#4CACFF!important;
}

@ -15,16 +15,47 @@ class ApplyForAddChildOrgModal extends Component{
} }
} }
componentDidMount() { componentDidUpdate=(prevState)=>{
if(this.props.departmentName && prevState.departmentName != this.props.departmentName){
this.setValue(this.props.departmentName)
}
}
componentDidMount=()=>{
if(this.props.departmentName){
this.setValue(this.props.departmentName)
}
}
setValue=(name)=>{
this.props.form.setFieldsValue({
depart:name
})
} }
setVisible = (visible) => { setVisible = (visible) => {
this.refs.modalWrapper.setVisible(visible) this.refs.modalWrapper.setVisible(visible)
} }
onSendOk = () => { onSendOk = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
console.log(values);
if(!err){
let{schoolId,departmentName}=this.props
let url=`/add_department_applies.json`;
axios.post(url,{
name:departmentName,
school_id:schoolId,
remarks:values.desc
}).then((result)=>{
if(result){
this.props.showNotification("新增院系/部门成功!");
this.setVisible(false);
}
}).catch((error)=>{
console.log(error);
})
}
})
} }
onOk = () => { onOk = () => {
@ -43,17 +74,17 @@ class ApplyForAddChildOrgModal extends Component{
{...this.props } {...this.props }
onOk={this.onOk} onOk={this.onOk}
okText="保存" okText="保存"
className="modalForm" className="applyForModal"
> >
<style>{` <style>{`
.modalForm .ant-form-item-label { .applyForModal .ant-form-item-label {
width: 100px; width: 100px;
padding-right: 10px; padding-right: 10px;
} }
.modalForm .ant-form-item-label label { .applyForModal .ant-form-item-label label {
color: #979797 color: #979797
} }
.formItemInline .ant-form-item-control-wrapper { .applyForModal .formItemInline .ant-form-item-control-wrapper {
width: 390px; width: 390px;
} }
`}</style> `}</style>
@ -62,21 +93,21 @@ class ApplyForAddChildOrgModal extends Component{
label="单位名称:" label="单位名称:"
className="mt15 formItemInline hideRequireTag" className="mt15 formItemInline hideRequireTag"
> >
国防科学技术大学 {this.props.schoolName}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="部门名称:" label="部门名称:"
className="mt15 formItemInline" className="mt15 formItemInline"
> >
{getFieldDecorator('re', { {getFieldDecorator('depart', {
rules: [{ rules: [{
// initialValue: this.state.cityDefaultValue, // initialValue: this.state.cityDefaultValue,
required: true, required: true,
message: '请输入部门名称', message: '请输入部门名称',
}], }],
})( })(
<Input ></Input> <Input placeholder="请输入部门或者学院名称" ></Input>
)} )}
</Form.Item> </Form.Item>

@ -15,20 +15,49 @@ class ApplyForAddOrgModal extends Component{
} }
} }
componentDidMount() { componentDidUpdate=(prevState)=>{
if(this.props.schoolName && prevState.schoolName != this.props.schoolName){
this.props.form.setFieldsValue({
schoolName:this.props.schoolName
})
}
}
componentDidMount=()=>{
if(this.props.schoolName){
this.props.form.setFieldsValue({
schoolName:this.props.schoolName
})
} }
}
setVisible = (visible) => { setVisible = (visible) => {
this.refs.modalWrapper.setVisible(visible) this.refs.modalWrapper.setVisible(visible)
} }
onSendOk = () => { onSendOk = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
console.log(values);
if(!err){
let url=`/add_school_applies.json`;
axios.post(url,{
schoolName:values.name,
province:values.city[0],
city:values.city[1],
address:values.address,
remarks:values.remarks
}).then((result)=>{
if(result){
this.props.showNotification("新增学校/单位成功!");
this.setVisible(false);
}
}).catch((error)=>{
console.log(error);
})
}
})
} }
onOk = () => { onOk = () => {
const { course_lists, checkBoxValues } = this.state
this.onSendOk() this.onSendOk()
} }
@ -43,26 +72,36 @@ class ApplyForAddOrgModal extends Component{
{...this.props } {...this.props }
onOk={this.onOk} onOk={this.onOk}
okText="保存" okText="保存"
className="modalForm" className="applyForModal"
> >
<style>{` <style>{`
.modalForm .ant-form-item-label { .applyForModal .ant-form-item-label {
width: 100px; width: 100px;
padding-right: 10px; padding-right: 10px;
} }
.modalForm .ant-form-item-label label { .applyForModal .ant-form-item-label label {
color: #979797 color: #979797
} }
.formItemInline .ant-form-item-control-wrapper { .applyForModal .formItemInline .ant-form-item-control-wrapper{
width: 390px; width: 390px;
} }
.applyForModal .formItemInline .ant-form-item-control .ant-cascader-picker,.applyForModal .formItemInline .ant-cascader-picker-large .ant-input{
width: 100%;
height:32px!important;
}
.applyForModal .formItemInline .ant-input-lg{
font-size:14px!important;
}
.explain .ant-form-explain{
top:36px;
}
`}</style> `}</style>
<Form> <Form onSubmit={this.onOk}>
<Form.Item <Form.Item
label="单位全称:" label="单位全称:"
className="mt15 formItemInline hideRequireTag" className="mt15 formItemInline explain"
> >
{getFieldDecorator('orgName', { {getFieldDecorator('schoolName', {
rules: [{ rules: [{
// initialValue: this.state.cityDefaultValue, // initialValue: this.state.cityDefaultValue,
required: true, required: true,
@ -71,17 +110,18 @@ class ApplyForAddOrgModal extends Component{
})( })(
<Input placeholder="学校或工作单位" className="validateInput"></Input> <Input placeholder="学校或工作单位" className="validateInput"></Input>
)} )}
<div> <div className="df mt18">
<div style={{ height: '22px'}}> <li style={{lineHeight:"22px"}}>示例</li>
<span>示例</span> <ul style={{lineHeight:"22px"}}>
<i className="iconfont icon-dianzan color-grey-9 font-16"></i> <li>
<i className="iconfont icon-chenggong color-green-light font-14 ml2 mr5 fl"></i>
<span> 国防科学技术大学</span> <span> 国防科学技术大学</span>
</div> </li>
<div style={{ height: '22px'}}> <li>
<span>   </span> <i className="iconfont icon-htmal5icon19 font-18 fl mr4" style={{color:"#FF9348"}}></i>
<i className="iconfont icon-dianzan color-grey-9 font-16"></i> <span> 国防科学技术大学开福校区</span>
<span> 国防科学技术大学四方坪校区</span> </li>
</div> </ul>
</div> </div>
</Form.Item> </Form.Item>
@ -89,12 +129,8 @@ class ApplyForAddOrgModal extends Component{
label="地区:" label="地区:"
className="mt15 formItemInline hideRequireTag" className="mt15 formItemInline hideRequireTag"
> >
{getFieldDecorator('re', { {getFieldDecorator('city', {
rules: [{ rules: [],
// initialValue: this.state.cityDefaultValue,
required: true,
message: '请选择地区',
}],
})( })(
<City ></City> <City ></City>
)} )}
@ -104,12 +140,8 @@ class ApplyForAddOrgModal extends Component{
label="详细地址:" label="详细地址:"
className="mt15 formItemInline hideRequireTag" className="mt15 formItemInline hideRequireTag"
> >
{getFieldDecorator('addr', { {getFieldDecorator('address', {
rules: [{ rules: [],
// initialValue: this.state.cityDefaultValue,
required: true,
message: '请填写完整的地址信息',
}],
})( })(
<Input placeholder="请填写完整的地址信息" className="validateInput"></Input> <Input placeholder="请填写完整的地址信息" className="validateInput"></Input>
)} )}
@ -119,7 +151,7 @@ class ApplyForAddOrgModal extends Component{
label="说明:" label="说明:"
className="mt15 formItemInline hideRequireTag" className="mt15 formItemInline hideRequireTag"
> >
{getFieldDecorator('desc', { {getFieldDecorator('remarks', {
})( })(
<TextArea placeholder="再次说明特别情况(选填)" className="validateInput"></TextArea> <TextArea placeholder="再次说明特别情况(选填)" className="validateInput"></TextArea>
)} )}

@ -2,9 +2,12 @@ import React, { Component } from "react";
import { message, Icon, Input, Form, Upload} from "antd"; import { message, Icon, Input, Form, Upload} from "antd";
import axios from 'axios' import axios from 'axios'
import ModalWrapper from "../../courses/common/ModalWrapper" import ModalWrapper from "../../courses/common/ModalWrapper"
import { City, getUploadActionUrl } from 'educoder' import { City, getUploadActionUrl,getImageUrl } from 'educoder'
import '../account/common.css' import '../account/common.css'
import authImg from '../../../images/account/auth.png'
import jobImg from '../../../images/account/job.png'
const { TextArea } = Input; const { TextArea } = Input;
const Dragger = Upload.Dragger; const Dragger = Upload.Dragger;
function getBase64(img, callback) { function getBase64(img, callback) {
@ -39,8 +42,17 @@ class RealNameCertificationModal extends Component{
} }
onSendOk = () => { onSendOk = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
console.log(values);
if(!err){
let{imageUrl2}=this.state;
if(imageUrl2){
}else{
this.props.showNotification("请先上传照片!");
}
}
})
} }
onOk = () => { onOk = () => {
@ -96,16 +108,21 @@ class RealNameCertificationModal extends Component{
className: 'idPic-uploader', className: 'idPic-uploader',
onChange: this.handleChange2, onChange: this.handleChange2,
}; };
let {certification}=this.props;
return( return(
<ModalWrapper <ModalWrapper
ref="modalWrapper" ref="modalWrapper"
title={`实名认证`} title={
certification && certification==1?
<span><i className="iconfont icon-shenfenrenzheng font-18 color-blue mr5" style={{fontWeight:"normal"}}></i></span>:
<span><i className="iconfont icon-zhiyerenzheng font-18 color-blue mr5" style={{fontWeight:"normal"}}></i></span>
}
{...this.props } {...this.props }
onOk={this.onOk} onOk={this.onOk}
okText="保存" okText="保存"
className="modalForm" className="applyForModal certificationModal"
bottomRender={ bottomRender={
certification && certification == 1?
<div className="bottomRender"> <div className="bottomRender">
<p>认证须知</p> <p>认证须知</p>
<p> <p>
@ -121,29 +138,45 @@ class RealNameCertificationModal extends Component{
</p><p> </p><p>
6.如存在恶意乱填写姓名证件号及上传与实名认证证件无关图片者一经发现将冻结EduCoder账号 6.如存在恶意乱填写姓名证件号及上传与实名认证证件无关图片者一经发现将冻结EduCoder账号
</p> </p>
</div>:
<div className="bottomRender">
<p>认证须知</p>
<p>
1.根据职业上传相应的证件照教师教师证专业人士员工证学生学生证请确保证件照内容完整并且清晰可见严禁PS
</p><p>
2.我们将在你提交职业证信息后的24小时不包含节假日内完成审核审核结果将会以系统消息的形式发送给你
</p><p>
3.职业认证审核完成后无法删除请谨慎填写职业变更请选择重新认证
</p><p>
4.职业认证审核完成后系统将自动发放500个金币作为奖励
</p><p>
5.我们会确保你所提供的信息均处于严格的保密状态不会泄露
</p><p>
6.如存在恶意乱填写姓名学号及上传与职业证件无关图片者一经发现将冻结EduCoder账号
</p>
</div> </div>
} }
> >
<style>{` <style>{`
.modalForm .ant-form-item-label { .applyForModal .ant-form-item{
margin-bottom:15px;
}
.applyForModal .ant-form-item-label {
width: 100px; width: 100px;
padding-right: 10px; padding-right: 10px;
} }
.modalForm .ant-form-item-label label { .applyForModal .ant-form-item-label label {
color: #979797 color: #979797
} }
.formItemInline .ant-form-item-control-wrapper { .certificationModal .ant-modal-body{
width: 390px; padding:20px;
}
.certificationModal .formItemInline .ant-form-item-control-wrapper {
width: 448px;
} }
span.idPic-uploader { span.idPic-uploader {
display: inline-block; margin-right:20px;
padding: 20px; height:110px;
padding-bottom: 0px;
width: 160px;
height: 110px;
margin: 0 16px;
} }
.idPic-uploader > .ant-upload { .idPic-uploader > .ant-upload {
width: 160px; width: 160px;
@ -152,40 +185,60 @@ class RealNameCertificationModal extends Component{
.idPic-uploader .ant-upload.ant-upload-drag p.ant-upload-drag-icon { .idPic-uploader .ant-upload.ant-upload-drag p.ant-upload-drag-icon {
margin-bottom: 0px; margin-bottom: 0px;
} }
.idPic-uploader .ant-upload.ant-upload-drag p.ant-upload-text { .idPic-uploader .ant-upload.ant-upload-drag p.ant-upload-drag-icon i{
font-size:42px!important;
color:#4B667F
}
.idPic-uploader .ant-upload.ant-upload-drag p.ant-upload-text a{
font-size: 12px; font-size: 12px;
color:#4B667F;
border-bottom:1px solid #4B667F
} }
.idPic-uploader .ant-upload.ant-upload-drag { .idPic-uploader .ant-upload.ant-upload-drag {
padding: 0px padding: 0px;
border:1px solid rgba(218,218,218,1)!important;
} }
.idPic-uploader img { .idPic-uploader img {
max-height: 110px; width:100%
width: 160px;
} }
.first_uploader { .first_uploader {
margin-left: 42px; margin-left: 42px;
} }
.certificationModal .marginauto{
margin-top:20px!important;
}
.bottomRender { .bottomRender {
padding: 19px; padding: 19px;
background: rgb(245,245,245); background: rgb(245,245,245);
margin-top: 30px; margin-top: 20px;
color: #656565; color: #656565;
} }
span.idPic-uploader.demoImg { span.idPic-uploader.demoImg {
display: flex; width:160px;
flex-direction: column; background:rgba(240,240,240,1);
border:1px solid rgba(218,218,218,1);
border-radius:4px;
padding:0px 5px;
justify-content: center;
align-items: center; align-items: center;
display: -webkit-flex;
}
.formItemInline .ant-form-explain{
position:absolute;
bottom:-20px;
left:0px;
width:100%;
} }
`}</style> `}</style>
<Form> <Form onSubmit={this.handleSubmit}>
{
certification && certification ==1 &&
<Form.Item <Form.Item
label="证件号:" label="证件号:"
className="mt15 formItemInline" className="formItemInline"
> >
{getFieldDecorator('re', { {getFieldDecorator('credentials', {
rules: [{ rules: [{
// initialValue: this.state.cityDefaultValue, // initialValue: this.state.cityDefaultValue,
required: true, required: true,
@ -195,35 +248,17 @@ class RealNameCertificationModal extends Component{
<Input placeholder="请输入证件号" ></Input> <Input placeholder="请输入证件号" ></Input>
)} )}
</Form.Item> </Form.Item>
}
{/* */}
<div style={{ marginLeft: '18px' }}> <div style={{ marginLeft: '18px' }}>
<div> <div>
<span style={{color: '#999999'}}>身份证人像面上传</span> <span style={{color: '#999999'}}>{ certification && certification == 1 ? "身份证(人像面)上传":"职业证照片上传" }</span>
<span style={{color: '#FF6800'}}>png/jpg/bmp格式不超过2MB</span> <span style={{color: '#FF6800'}}>png/jpg/bmp格式不超过2MB</span>
</div> </div>
<div <div className="df mt20" style={{ justifyContent: 'center' }} >
style={{ display: 'flex', justifyContent: 'center', width: '94%', height: '140px' }}
>
<span className="idPic-uploader demoImg"> <span className="idPic-uploader demoImg">
<img src={"https://www.educoder.net/images/avatars/User/b?1532489442"} alt="avatar" style={{ maxHeight: '110px'}}/> <img src={`${certification == 1 ? authImg : jobImg}`} alt="avatar" style={{ maxHeight: '110px'}}/>
<span style={{color: '#999999'}}>示例图片</span>
</span> </span>
{/* <Dragger {...uploadProps} >
{imageUrl ?
<a href={imageUrl} target="_blank">
<img src={imageUrl} alt="avatar" style={{ maxHeight: '110px'}}/>
</a> :
<React.Fragment>
<p className="ant-upload-drag-icon">
<Icon type="inbox" />
</p>
<p className="ant-upload-text">点击或拖拽上传图片</p>
</React.Fragment>
}
</Dragger> */}
<Dragger {...uploadProps2}> <Dragger {...uploadProps2}>
{imageUrl2 ? {imageUrl2 ?
<a href={imageUrl2} target="_blank"> <a href={imageUrl2} target="_blank">
@ -231,14 +266,20 @@ class RealNameCertificationModal extends Component{
</a> : </a> :
<React.Fragment> <React.Fragment>
<p className="ant-upload-drag-icon"> <p className="ant-upload-drag-icon">
<Icon type="inbox" /> <i className="iconfont icon-cuban2shangchuanyunduan" style={{color:"#4B667F",font:"42px"}}></i>
</p> </p>
<p className="ant-upload-text">点击或拖拽上传图片</p> <p className="ant-upload-text mt20"><a>点击或拖拽上传图片</a></p>
{/* <p className="ant-upload-hint">Support for a single or bulk upload. Strictly prohibit from uploading company data or other band files</p> */} {/* <p className="ant-upload-hint">Support for a single or bulk upload. Strictly prohibit from uploading company data or other band files</p> */}
</React.Fragment> </React.Fragment>
} }
</Dragger> </Dragger>
</div> </div>
<div className="df mt10 color-grey-9" style={{ justifyContent: 'center' }} >
<span className="fl mr20 edu-txt-center" style={{width:"160px"}}>示例图片</span>
<span className="fl edu-txt-center mr20" style={{width:"160px"}}>
<a href="javascript:void(0)" className="color-orange" style={{borderBottom:"1px solid #ff6800"}}>查看大图</a>
</span>
</div>
</div> </div>

@ -6,7 +6,7 @@ import Loadable from 'react-loadable';
import Loading from '../../../Loading'; import Loading from '../../../Loading';
import NoneData from '../../courses/coursesPublic/NoneData' import NoneData from '../../courses/coursesPublic/NoneData'
import axios from 'axios'; import axios from 'axios';
import {getImageUrl} from 'educoder'; import {getImageUrl,setImagesUrl} from 'educoder';
import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; import { TPMIndexHOC } from '../../tpm/TPMIndexHOC';
import { CNotificationHOC } from '../../courses/common/CNotificationHOC' import { CNotificationHOC } from '../../courses/common/CNotificationHOC'
import "./usersInfo.css" import "./usersInfo.css"
@ -159,7 +159,7 @@ class InfosPath extends Component{
return( return(
<div className="square-Item" onClick={()=>this.turnToCourses(`/paths/${item.id}`)}> <div className="square-Item" onClick={()=>this.turnToCourses(`/paths/${item.id}`)}>
{ {
item.tag && <div className="tag-green"><span className="tag-name">{item.tag}</span><img src={getImageUrl("/images/educoder/tag2.png")}/></div> item.tag && <div className="tag-green"><span className="tag-name">{item.tag}</span><img src={setImagesUrl("images/educoder/tag2.png")} className="fl"/></div>
} }
<a href="javascript:void(0)" className="square-img"><img alt="Subject12" src={getImageUrl(`${item.image_url}`)}/></a> <a href="javascript:void(0)" className="square-img"><img alt="Subject12" src={getImageUrl(`${item.image_url}`)}/></a>
<div className="square-main"> <div className="square-main">

Loading…
Cancel
Save