Merge remote-tracking branch 'origin/master'

dev_forum
杨树林 5 years ago
commit 2f0ddc7da4

@ -35,6 +35,10 @@
.editormd .CodeMirror-linenumbers { .editormd .CodeMirror-linenumbers {
padding: 0; padding: 0;
} }
.editormd-html-preview hr, .editormd-preview-container hr {
/* 颜色加深 */
border-top: 1px solid #ccc;
}
/* 重置掉antd的一些样式 */ /* 重置掉antd的一些样式 */
html, body { html, body {

@ -1719,6 +1719,10 @@ const options = [{
label: '其他' label: '其他'
}], }],
}]; }];
function filter(inputValue, path) {
return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
}
class City extends Component{ class City extends Component{
constructor(props){ constructor(props){
super(props); super(props);
@ -1739,11 +1743,16 @@ class City extends Component{
} }
} }
render(){ render(){
const { defaultValue } = this.props const { defaultValue, matchInputWidth, className, popupClassName } = this.props
const { value } = this.state const { value } = this.state
// 这里用请选择所在省市的话会触发chrome的地址选择
return( return(
<Cascader allowClear size="large" options={options} placeholder="请选择所在省市" onChange={this.onChange} <Cascader allowClear size="large" options={options} placeholder="请选择所在地" onChange={this.onChange}
matchInputWidth={matchInputWidth}
value={value} value={value}
showSearch={{ filter }}
className={className}
popupClassName={popupClassName}
></Cascader> ></Cascader>
) )
} }

@ -50,3 +50,4 @@ export { default as DMDEditor } from './components/markdown/DMDEditor'
export { default as ImageLayerHook } from './hooks/ImageLayerHook'

@ -0,0 +1,47 @@
import React, { useState, useEffect, memo } from 'react'
import ImageLayer from '../../modules/page/layers/ImageLayer'
import { isImageExtension } from 'educoder'
function ImageLayerHook(props) {
const [showImage, setShowImage] = useState(false)
const [imageSrc, setImageSrc] = useState('')
const { parentSel, childSel, watchPropsArray } = props
const onImageLayerClose = () => {
setShowImage(false)
setImageSrc('')
}
const onDelegateClick = (event) => {
const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href')
// 判断imageSrc是否是图片
const fileName = event.target.innerHTML.trim()
if (isImageExtension(imageSrc.trim()) || isImageExtension(fileName) || event.target.tagName == 'IMG' || imageSrc.indexOf('base64,') != -1) {
// 非回复里的头像图片; 非emoticons
if (imageSrc.indexOf('/images/avatars/User') === -1 &&
imageSrc.indexOf('kindeditor/plugins/emoticons') === -1 ) {
setShowImage(true)
setImageSrc(imageSrc)
}
event.stopPropagation()
event.preventDefault && event.preventDefault()
event.originalEvent.preventDefault()
// event.originalEvent.stopPropagation()
// event.originalEvent.cancelBubble = true
return false;
}
}
useEffect(() => {
$(parentSel)
.delegate(childSel, "click", onDelegateClick);
return () => {
$(parentSel).undelegate(childSel, "click", onDelegateClick )
}
})
return (
<ImageLayer showImage={showImage} imageSrc={imageSrc} onImageLayerClose={onImageLayerClose}></ImageLayer>
)
}
export default memo(ImageLayerHook)

@ -424,7 +424,7 @@ pop_box_new(htmlvalue, 480, 182);
*/ */
let user = resData.user; let user = resData.user;
user.username = resData.user.name; user.username = resData.user.name;
user.user_url = `/user/${resData.user.login}`; user.user_url = `/users/${resData.user.login}`;
// user.image_url = resData.image_url; // user.image_url = resData.image_url;
user.is_teacher = resData.is_teacher; user.is_teacher = resData.is_teacher;
resData.user = user; resData.user = user;

@ -11,7 +11,10 @@ class PathModal extends Component{
Searchvalue:undefined, Searchvalue:undefined,
type:'all', type:'all',
page:1, page:1,
patheditarry:undefined patheditarry:undefined,
newshixunmodallist:undefined,
hometypepvisible: false,
shixunmodallist:undefined,
} }
} }
@ -19,14 +22,78 @@ class PathModal extends Component{
this.props.hidecouseShixunModal() this.props.hidecouseShixunModal()
} }
componentDidMount(){
this.setState({
hometypepvisible: true,
patheditarry: [],
checkBoxValues: [],
})
let coursesId = this.props.match.params.coursesId;
let url = "/courses/" + coursesId + "/homework_commons/subjects.json";
axios.get(url).then((result) => {
if (result.status === 200) {
this.setState({
shixunpath: true,
shixunmodallist: result.data,
hometypepvisible: false,
newshixunmodallist: result.data.subject_list,
})
}
}).catch((error) => {
console.log(error);
})
}
funshixunpathlist=(search,type,loading,page)=>{
let{newshixunmodallist}=this.state;
let newshixunmodallists=[]
if(page>1){
newshixunmodallists=newshixunmodallist;
}
this.setState({
hometypepvisible:loading
})
let coursesId=this.props.match.params.coursesId;
let url ="/courses/"+coursesId+"/homework_commons/subjects.json";
axios.get(url, {
params: {
search: search,
type:type,
page:page
}
}).then((result)=>{
if(result.status===200){
let shixun_list=result.data.subject_list;
for(var i=0; i<shixun_list.length;i++){
newshixunmodallists.push(shixun_list[i])
}
this.setState({
shixunpath:true,
shixunmodallist:result.data,
newshixunmodallist:newshixunmodallists,
hometypepvisible:false
})
}
}).catch((error)=>{
console.log(error);
})
}
//tag //tag
changeTag=(types)=>{ changeTag=(types)=>{
let {Searchvalue}=this.state; let {Searchvalue}=this.state;
this.setState({ this.setState({
type:types, type:types,
page:1, page:1,
newshixunmodallist:undefined
}) })
this.props.funshixunpathlist(Searchvalue,types,true,1) this.funshixunpathlist(Searchvalue,types,true,1)
} }
//搜索 //搜索
@ -40,7 +107,7 @@ class PathModal extends Component{
this.setState({ this.setState({
page:1, page:1,
}) })
this.props.funshixunpathlist(value,type,true,1) this.funshixunpathlist(value,type,true,1)
} }
@ -59,7 +126,7 @@ class PathModal extends Component{
let {Searchvalue,type,page,shixunpathlist}=this.state; let {Searchvalue,type,page,shixunpathlist}=this.state;
let newpage=page+1 let newpage=page+1
this.props.funshixunpathlist(Searchvalue,type,true,newpage) this.funshixunpathlist(Searchvalue,type,true,newpage)
this.setState({ this.setState({
page:newpage page:newpage
}) })
@ -69,19 +136,24 @@ class PathModal extends Component{
} }
//提交 //提交
savecouseShixunModal=()=>{ savecouseShixunModal=()=>{
this.setState({
hometypepvisible:true
})
let {patheditarry}=this.state; let {patheditarry}=this.state;
let {coursesId,Coursename,page,order,category_id,datas}=this.props; let {coursesId}=this.props;
let url="/courses/"+coursesId+"/homework_commons/create_subject_homework.json"; let url="/courses/"+coursesId+"/homework_commons/create_subject_homework.json";
if(patheditarry===undefined){ if(patheditarry===undefined){
this.setState({ this.setState({
patheditarrytype:true, patheditarrytype:true,
patheditarryvalue:"请先选择实践课程" patheditarryvalue:"请先选择实践课程",
hometypepvisible:false
}) })
return return
}else if(patheditarry.length===0){ }else if(patheditarry.length===0){
this.setState({ this.setState({
patheditarrytype:true, patheditarrytype:true,
patheditarryvalue:"请先选择实践课程" patheditarryvalue:"请先选择实践课程",
hometypepvisible:false
}) })
return return
} }
@ -114,14 +186,16 @@ class PathModal extends Component{
// this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
// } // }
this.setState({
hometypepvisible:false
})
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
} }
render(){ render(){
let {Searchvalue,type,Modalstype}=this.state; let {Searchvalue,type,Modalstype,newshixunmodallist,hometypepvisible,shixunmodallist}=this.state;
let {visible,shixunmodallist,hometypepvisible,newshixunmodallist}=this.props; let {visible}=this.props;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />; const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
return( return(
@ -164,7 +238,7 @@ class PathModal extends Component{
<span className="fl color-grey-9 font-16 mt3"> <span className="fl color-grey-9 font-16 mt3">
<span></span> <span></span>
<span className="color-orange-tip">{shixunmodallist === undefined ? "":shixunmodallist.subjects_count}</span> <span className="color-orange-tip">{shixunmodallist === undefined ? "":shixunmodallist.subjects_count}</span>
<span>个实</span> <span>个实践课程</span>
</span> </span>
<div className="fr search-new"> <div className="fr search-new">
<Search <Search
@ -200,6 +274,7 @@ class PathModal extends Component{
style={{"Height":"204px"}}> style={{"Height":"204px"}}>
<Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}> <Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
{ {
newshixunmodallist&&newshixunmodallist.map((item,key)=>{ newshixunmodallist&&newshixunmodallist.map((item,key)=>{
return( return(
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}> <div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>

@ -6,6 +6,7 @@ import axios from'axios';
const Option = Select.Option; const Option = Select.Option;
const Search = Input.Search; const Search = Input.Search;
class ShixunModal extends Component{ class ShixunModal extends Component{
constructor(props){ constructor(props){
super(props); super(props);
@ -13,12 +14,68 @@ class ShixunModal extends Component{
Searchvalue:undefined, Searchvalue:undefined,
type:'all', type:'all',
category_id:0, category_id:0,
page:1 page:1,
shixunmodallist:undefined,
hometypepvisible:false,
newshixunmodallist:undefined,
} }
} }
componentDidMount() { componentDidMount() {
this.setState({
hometypepvisible:true,
})
let coursesId=this.props.match.params.coursesId;
let url ="/courses/"+coursesId+"/homework_commons/shixuns.json";
axios.get(url).then((result)=>{
if(result.status===200){
this.setState({
shixunmodallist:result.data,
hometypepvisible:false,
newshixunmodallist:result.data.shixun_list,
})
}
}).catch((error)=>{
console.log(error);
})
}
setupdatalist=(search,type,loading,page)=>{
let{newshixunmodallist}=this.state;
let newshixunmodallists=[]
if(page>1){
newshixunmodallists=newshixunmodallist;
}
this.setState({
hometypepvisible:loading
})
let coursesId=this.props.match.params.coursesId;
let url ="/courses/"+coursesId+"/homework_commons/shixuns.json";
axios.get(url, {
params: {
search: search,
type:type,
page:page
}
}).then((result)=>{
if(result.status===200){
let shixun_list=result.data.shixun_list;
for(var i=0; i<shixun_list.length;i++){
newshixunmodallists.push(shixun_list[i])
}
this.setState({
shixunmodallist:result.data,
newshixunmodallist:newshixunmodallists,
hometypepvisible:false
})
}
}).catch((error)=>{
console.log(error);
})
} }
//勾选实训 //勾选实训
@ -43,16 +100,13 @@ class ShixunModal extends Component{
contentViewScrolledit=(e)=>{ contentViewScrolledit=(e)=>{
//滑动到底判断 //滑动到底判断
if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
let {Searchvalue,type,page}=this.state; let {Searchvalue,type,page}=this.state;
let newpage=page+1 let newpage=page+1
this.props.funshixunmodallist(Searchvalue,type,true,newpage) this.setupdatalist(Searchvalue,type,true,newpage)
this.setState({ this.setState({
page:newpage page:newpage
}) })
} }
} }
@ -69,7 +123,7 @@ class ShixunModal extends Component{
page:1, page:1,
}) })
this.props.funshixunmodallist(value,type,true,1) this.setupdatalist(value,type,true,1)
this.props.funpatheditarry([]) this.props.funpatheditarry([])
} }
@ -79,9 +133,10 @@ class ShixunModal extends Component{
this.setState({ this.setState({
type:types, type:types,
page:1, page:1,
newshixunmodallist:undefined
}) })
this.props.funshixunmodallist(Searchvalue,types,true,1) this.setupdatalist(Searchvalue,types,true,1)
this.props.funpatheditarry([]) this.props.funpatheditarry([])
} }
@ -91,17 +146,24 @@ class ShixunModal extends Component{
} }
savecouseShixunModal=()=>{ savecouseShixunModal=()=>{
this.setState({
hometypepvisible:true
})
let {coursesId,patheditarry,datas}=this.props; let {coursesId,patheditarry,datas}=this.props;
let{category_id}=this.state; let{category_id}=this.state;
if (this.props.chooseShixun) { if (this.props.chooseShixun) {
this.props.chooseShixun(patheditarry) this.props.chooseShixun(patheditarry)
this.setState({
hometypepvisible:false
})
return; return;
} }
if(patheditarry.length===0){ if(patheditarry.length===0){
this.setState({ this.setState({
shixunmodelchke:true, shixunmodelchke:true,
chekicmessage:"请先选择实训" chekicmessage:"请先选择实训",
hometypepvisible:false
}) })
return return
@ -119,7 +181,9 @@ class ShixunModal extends Component{
this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
this.props.hidecouseShixunModal() this.props.hidecouseShixunModal()
} }
this.setState({
hometypepvisible:false
})
// category_id: 3 // category_id: 3
// homework_ids: (5) [9171, 9172, 9173, 9174, 9175] // homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
}).catch((error) => { }).catch((error) => {
@ -133,8 +197,8 @@ class ShixunModal extends Component{
}) })
} }
render(){ render(){
let {Searchvalue,type,category_id}=this.state; let {Searchvalue,type,hometypepvisible,shixunmodallist,newshixunmodallist,}=this.state;
let {visible,shixunmodallist,hometypepvisible,newshixunmodallist,patheditarry}=this.props; let {visible,patheditarry}=this.props;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />; const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
// console.log(patheditarry) // console.log(patheditarry)
return( return(
@ -205,7 +269,7 @@ class ShixunModal extends Component{
` `
} }
</style> </style>
<div className="clearfix mb10 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div"> <div className="clearfix mb10 shixun_work_div newshixun_tab_div cdefault" id="shixun_tab_div">
<li className="fl mr5 mt5"> <li className="fl mr5 mt5">
<a onClick={()=>this.changeTag("all")} className={ type==="all" ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a> <a onClick={()=>this.changeTag("all")} className={ type==="all" ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a>
@ -277,6 +341,9 @@ class ShixunModal extends Component{
width: 11%; width: 11%;
box-sizing: border-box; box-sizing: border-box;
} }
.pl12{
padding-left: 12px;
}
` `
} }
</style> </style>
@ -298,7 +365,7 @@ class ShixunModal extends Component{
</li> </li>
<li className="fl with25 edu-txt-left task-hide paddingl5">{item.school}</li> <li className="fl with25 edu-txt-left task-hide paddingl5">{item.school}</li>
<li className="fl with11 paddingl10">{item.myshixuns_count}</li> <li className="fl with11 paddingl10">{item.myshixuns_count}</li>
<li className="fl with11 color-orange-tip paddingl10">{item.level}</li> <li className="fl with11 color-orange-tip paddingl10 pl12">{item.level}</li>
<Tooltip title="新窗口查看详情"> <Tooltip title="新窗口查看详情">
<li className="fl with11"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li> <li className="fl with11"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li>
</Tooltip> </Tooltip>

@ -1,4 +1,4 @@
import React, { useState, useEffect, useRef, memo } from 'react' import React, { useState, useEffect, useRef, useMemo } from 'react'
import { trigger } from 'educoder' import { trigger } from 'educoder'
import { Input, Checkbox } from "antd"; import { Input, Checkbox } from "antd";
import CourseGroupChooser from '../CourseGroupChooser' import CourseGroupChooser from '../CourseGroupChooser'
@ -105,4 +105,4 @@ function CourseGroupChooserModal({ course_groups = [], isAdminOrCreator, item, i
</ModalWrapper> </ModalWrapper>
) )
} }
export default memo(CourseGroupChooserModal) export default useMemo(CourseGroupChooserModal)

@ -454,20 +454,6 @@ class ShixunHomework extends Component{
checkBoxValues:[] checkBoxValues:[]
}) })
let coursesId=this.props.match.params.coursesId;
let url ="/courses/"+coursesId+"/homework_commons/shixuns.json";
axios.get(url).then((result)=>{
if(result.status===200){
this.setState({
shixunmodallist:result.data,
hometypepvisible:false,
newshixunmodallist:result.data.shixun_list,
})
}
}).catch((error)=>{
console.log(error);
})
} }
@ -477,25 +463,11 @@ class ShixunHomework extends Component{
this.setState({ this.setState({
hometypepvisible:true, hometypepvisible:true,
patheditarry:[], patheditarry:[],
checkBoxValues:[] checkBoxValues:[],
})
let coursesId=this.props.match.params.coursesId;
let url ="/courses/"+coursesId+"/homework_commons/subjects.json";
axios.get(url).then((result)=>{
if(result.status===200){
this.setState({
shixunpath: true, shixunpath: true,
shixunpathlist:result.data,
hometypepvisible:false,
newshixunpathlist:result.data.subject_list,
})
}
}).catch((error)=>{
console.log(error);
}) })
} }
@ -508,116 +480,80 @@ class ShixunHomework extends Component{
}) })
} }
funshixunmodallist=(search,type,loading,page)=>{ // funshixunmodallist=(search,type,loading,page)=>{
let{newshixunmodallist}=this.state; // let{newshixunmodallist}=this.state;
let newshixunmodallists=[] // let newshixunmodallists=[]
if(page>1){ // if(page>1){
newshixunmodallists=newshixunmodallist; // newshixunmodallists=newshixunmodallist;
} // }
this.setState({ // this.setState({
hometypepvisible:loading // hometypepvisible:loading
}) // })
let coursesId=this.props.match.params.coursesId; // let coursesId=this.props.match.params.coursesId;
let url ="/courses/"+coursesId+"/homework_commons/shixuns.json"; // let url ="/courses/"+coursesId+"/homework_commons/shixuns.json";
//
axios.get(url, { // axios.get(url, {
params: { // params: {
search: search, // search: search,
type:type, // type:type,
page:page // page:page
} // }
}).then((result)=>{ // }).then((result)=>{
if(result.status===200){ // if(result.status===200){
//
let shixun_list=result.data.shixun_list; // let shixun_list=result.data.shixun_list;
for(var i=0; i<shixun_list.length;i++){ // for(var i=0; i<shixun_list.length;i++){
newshixunmodallists.push(shixun_list[i]) // newshixunmodallists.push(shixun_list[i])
} // }
this.setState({ // this.setState({
shixunmodal:true, // shixunmodal:true,
shixunmodallist:result.data, // shixunmodallist:result.data,
newshixunmodallist:newshixunmodallists, // newshixunmodallist:newshixunmodallists,
hometypepvisible:false // hometypepvisible:false
}) // })
} // }
}).catch((error)=>{ // }).catch((error)=>{
console.log(error); // console.log(error);
}) // })
} // }
funshixunpathlist=(search,type,loading,page)=>{
let{newshixunpathlist}=this.state;
let newshixunmodallists=[]
if(page>1){
newshixunmodallists=newshixunpathlist;
}
this.setState({
hometypepvisible:loading
})
let coursesId=this.props.match.params.coursesId;
let url ="/courses/"+coursesId+"/homework_commons/subjects.json";
axios.get(url, {
params: {
search: search,
type:type,
page:page
}
}).then((result)=>{
if(result.status===200){
let shixun_list=result.data.subject_list;
for(var i=0; i<shixun_list.length;i++){
newshixunmodallists.push(shixun_list[i])
}
this.setState({
shixunpath:true,
shixunpathlist:result.data,
newshixunpathlist:newshixunmodallists,
hometypepvisible:false
})
}
}).catch((error)=>{
console.log(error);
})
}
funshixunpathlist=(search,type,loading,page)=>{
let{newshixunpathlist}=this.state;
let newshixunmodallists=[]
if(page>1){
newshixunmodallists=newshixunpathlist;
}
this.setState({
hometypepvisible:loading
})
let coursesId=this.props.match.params.coursesId;
let url ="/courses/"+coursesId+"/homework_commons/subjects.json";
axios.get(url, { // funshixunpathlist=(search,type,loading,page)=>{
params: { // let{newshixunpathlist}=this.state;
search: search, // let newshixunmodallists=[]
type:type, // if(page>1){
page:page // newshixunmodallists=newshixunpathlist;
} // }
}).then((result)=>{ // this.setState({
if(result.status===200){ // hometypepvisible:loading
// })
let shixun_list=result.data.subject_list; // let coursesId=this.props.match.params.coursesId;
for(var i=0; i<shixun_list.length;i++){ // let url ="/courses/"+coursesId+"/homework_commons/subjects.json";
newshixunmodallists.push(shixun_list[i]) //
} // axios.get(url, {
this.setState({ // params: {
shixunpath:true, // search: search,
shixunpathlist:result.data, // type:type,
newshixunpathlist:newshixunmodallists, // page:page
hometypepvisible:false // }
}) // }).then((result)=>{
} // if(result.status===200){
}).catch((error)=>{ //
console.log(error); // let shixun_list=result.data.subject_list;
}) // for(var i=0; i<shixun_list.length;i++){
} // newshixunmodallists.push(shixun_list[i])
// }
// this.setState({
// shixunpath:true,
// shixunpathlist:result.data,
// newshixunpathlist:newshixunmodallists,
// hometypepvisible:false
// })
// }
// }).catch((error)=>{
// console.log(error);
// })
// }
PaginationCourse=(pageNumber)=>{ PaginationCourse=(pageNumber)=>{
let {Coursename,order}=this.state; let {Coursename,order}=this.state;
@ -1012,13 +948,16 @@ class ShixunHomework extends Component{
course_groups={course_groups} course_groups={course_groups}
getcourse_groupslist={(id)=>this.getcourse_groupslist(id)} getcourse_groupslist={(id)=>this.getcourse_groupslist(id)}
/>:""} />:""}
{/*选择实训*/} {/*选择实训*/}
{shixunmodal===true?<ShixunModal {shixunmodal===true?<ShixunModal
{...this.props}
{...this.state}
datas={datas} datas={datas}
category_id={this.props.match.params.category_id} category_id={this.props.match.params.category_id}
visible={shixunmodal} visible={shixunmodal}
shixunmodallist={shixunmodallist} shixunmodallist={shixunmodallist}
funshixunmodallist={(search,type,loading,page)=>this.funshixunmodallist(search,type,loading,page)} // funshixunmodallist={(search,type,loading,page)=>this.funshixunmodallist(search,type,loading,page)}
hometypepvisible={hometypepvisible} hometypepvisible={hometypepvisible}
hidecouseShixunModal={this.hidecouseShixunModal} hidecouseShixunModal={this.hidecouseShixunModal}
newshixunmodallist={newshixunmodallist} newshixunmodallist={newshixunmodallist}
@ -1027,6 +966,7 @@ class ShixunHomework extends Component{
funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)} funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)}
patheditarry={patheditarry} patheditarry={patheditarry}
/>:""} />:""}
{shixunmodal===true||shixunpath===true?<style> {shixunmodal===true||shixunpath===true?<style>
{ {
` `
@ -1038,11 +978,13 @@ class ShixunHomework extends Component{
</style>:""} </style>:""}
{/*选择实训路径*/} {/*选择实训路径*/}
{shixunpath===true? <PathModal {shixunpath===true? <PathModal
{...this.props}
{...this.state}
datas={datas} datas={datas}
visible={shixunpath} visible={shixunpath}
shixunmodallist={this.state.shixunpathlist} shixunmodallist={this.state.shixunpathlist}
newshixunmodallist={this.state.newshixunpathlist} newshixunmodallist={this.state.newshixunpathlist}
funshixunpathlist={(search,type,loading,page)=>this.funshixunpathlist(search,type,loading,page)} // funshixunpathlist={(search,type,loading,page)=>this.funshixunpathlist(search,type,loading,page)}
hometypepvisible={hometypepvisible} hometypepvisible={hometypepvisible}
hidecouseShixunModal={this.hidecouseShixunModal} hidecouseShixunModal={this.hidecouseShixunModal}
coursesId={this.props.match.params.coursesId} coursesId={this.props.match.params.coursesId}

@ -126,4 +126,5 @@
display: inline-block; display: inline-block;
height: 10px; height: 10px;
margin: 5px 0; margin: 5px 0;
float: right;
} }

@ -184,8 +184,8 @@ class CodeEvaluateView extends Component {
{ headIconClass && <i className={`fa ${ headIconClass } fr mt2 ml5 font-16`}></i> } { headIconClass && <i className={`fa ${ headIconClass } fr mt2 ml5 font-16`}></i> }
{ _headLockIconClass && <i className={`fa ${ _headLockIconClass } fr mt2 ml5 font-16`}></i> } { _headLockIconClass && <i className={`fa ${ _headLockIconClass } fr mt2 ml5 font-16`}></i> }
{ item.ts_memo && <span className="fr description">消耗内存{item.ts_memo}MB</span> } { item.ts_mem && <span className="fr description">消耗内存{item.ts_mem}MB</span> }
{ item.ts_memo && item.ts_time && <span className="split"></span> } { item.ts_mem && item.ts_time && <span className="split"></span> }
{ item.ts_time && <span className="fr description">代码执行时长{item.ts_time}</span> } { item.ts_time && <span className="fr description">代码执行时长{item.ts_time}</span> }
</p> </p>

@ -79,6 +79,22 @@ class AccountPage extends Component {
.accountPage { .accountPage {
display: flex; display: flex;
} }
.basicFormWrap{
flex:1;
width: 0;
}
/* 左侧 */
.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;
height:418px;
}
`}</style> `}</style>
<AccountNav {...this.props} {...common}></AccountNav> <AccountNav {...this.props} {...common}></AccountNav>
<div className="basicFormWrap"> <div className="basicFormWrap">

@ -3,7 +3,7 @@ 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' import './common.css'
import { getHiddenName } from './AccountBasicEdit'
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
const Option = Select.Option const Option = Select.Option
@ -70,7 +70,7 @@ class AccountBasicEdit extends Component {
label="姓名" label="姓名"
className="display formItemInline" className="display formItemInline"
> >
{basicInfo && basicInfo.name} {basicInfo && (basicInfo.show_realname == true ? basicInfo.name : getHiddenName(basicInfo.name))}
</Form.Item> </Form.Item>
<Form.Item <Form.Item

@ -10,6 +10,14 @@ const RadioGroup = Radio.Group;
const Option = Select.Option; const Option = Select.Option;
const map = identityMap // {"teacher":"教师", "student":"学生", "professional":"专业人士"} const map = identityMap // {"teacher":"教师", "student":"学生", "professional":"专业人士"}
export function getHiddenName(name) {
if (!name) return ''
let len=parseInt(name.length)-1;
let str="";
for(var i = 0; i < len; i++){ str += "*"; }
const newName = name.substr(0,1)+str;
return newName
}
class AccountBasic extends Component { class AccountBasic extends Component {
constructor(props){ constructor(props){
super(props); super(props);
@ -110,11 +118,7 @@ class AccountBasic extends Component {
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
console.log(values); console.log(values);
let {basicInfo}=this.props; let {basicInfo}=this.props;
// TODO 为什么modal里的form影响到这里的了 if(!err ){
if (err) {
delete err.depart
}
if(!err || Object.keys(err).length == 0){
let url=`/users/accounts/${basicInfo.id}.json` let url=`/users/accounts/${basicInfo.id}.json`
axios.put((url),{ axios.put((url),{
nickname:values.nickname, nickname:values.nickname,
@ -158,19 +162,10 @@ class AccountBasic extends Component {
} }
} }
getHiddenName(name) {
if (!name) return ''
let len=parseInt(name.length)-1;
let str="";
for(var i = 0; i < len; i++){ str += "*"; }
const newName = name.substr(0,1)+str;
return newName
}
// 将名字隐藏起来 // 将名字隐藏起来
hideRealName=(name)=>{ hideRealName=(name)=>{
this.setState({ realName: name }) this.setState({ realName: name })
const newName = this.getHiddenName(name) const newName = getHiddenName(name)
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
name: newName name: newName
@ -202,6 +197,7 @@ class AccountBasic extends Component {
} }
//搜索部门 //搜索部门
searchDepartment=(e)=>{ searchDepartment=(e)=>{
if (e) {
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
org2:e org2:e
}) })
@ -213,6 +209,7 @@ class AccountBasic extends Component {
departmentsName:e departmentsName:e
}) })
} }
}
// 选择部门、学院 // 选择部门、学院
changeDepartment=(e)=>{ changeDepartment=(e)=>{
@ -251,6 +248,9 @@ class AccountBasic extends Component {
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
org2:result.data.departments[0].name org2:result.data.departments[0].name
}) })
this.setState({
department_id: result.data.departments[0].id
})
} }
} }
}).catch((error)=>{ }).catch((error)=>{
@ -303,12 +303,15 @@ class AccountBasic extends Component {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
let{basicInfo}=this.props let{basicInfo}=this.props
// form合并了
const propsWithoutForm = Object.assign({}, this.props)
delete propsWithoutForm.form
return ( return (
<div> <div>
<ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school} <ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school}
{...this.props}></ApplyForAddOrgModal> {...propsWithoutForm}></ApplyForAddOrgModal>
<ApplyForAddChildOrgModal ref="applyForAddChildOrgModal" schoolName={school} schoolId={school_id} departmentName={departmentsName} <ApplyForAddChildOrgModal ref="applyForAddChildOrgModal" schoolName={school} schoolId={school_id} departmentName={departmentsName}
{...this.props} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form} ></ApplyForAddChildOrgModal> {...propsWithoutForm} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form} ></ApplyForAddChildOrgModal>
<div className="basicForm"> <div className="basicForm">
<style>{` <style>{`
@ -360,7 +363,7 @@ class AccountBasic extends Component {
font-size:14px; font-size:14px;
} }
.resetCityStyle .ant-form-item-control{ .resetCityStyle .ant-form-item-control{
width:190px; width:220px;
} }
`}</style> `}</style>
<div className="title">基本信息</div> <div className="title">基本信息</div>
@ -402,7 +405,7 @@ class AccountBasic extends Component {
<span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span> <span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span>
</React.Fragment> : </React.Fragment> :
<div className="df" style={{ 'justify-content': 'center' }}> <div className="df" style={{ 'justify-content': 'center' }}>
<span className="mr8" >{showRealName ? this.props.basicInfo.name : this.getHiddenName(this.props.basicInfo.name)}</span> <span className="mr8" >{showRealName ? this.props.basicInfo.name : getHiddenName(this.props.basicInfo.name)}</span>
<i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"} <i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"}
onClick={()=>this.showOrHide(showRealName)}></i> onClick={()=>this.showOrHide(showRealName)}></i>
<span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span> <span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span>

@ -21,8 +21,60 @@ class AccountNav extends Component {
const isSecure = path.indexOf('secure') != -1 const isSecure = path.indexOf('secure') != -1
return ( return (
<div className="accountNav fl"> <div className="accountNav fl">
<style>{`
.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;
}
.color-green-light{
color: #45E660!important;
}
`}</style>
{ {
basicInfo && basicInfo && basicInfo.id &&
<React.Fragment> <React.Fragment>
<div className="accountInfo"> <div className="accountInfo">
<AccountImg src={basicInfo.avatar_url} {...this.props}></AccountImg> <AccountImg src={basicInfo.avatar_url} {...this.props}></AccountImg>

@ -35,6 +35,9 @@ class AccountSecure extends Component {
// 获取验证码倒计时 // 获取验证码倒计时
remainTime=()=>{ remainTime=()=>{
this.setState({
seconds: 60
})
this.timer = setInterval(() => { this.timer = setInterval(() => {
let { seconds } =this.state; let { seconds } =this.state;
let s = parseInt(seconds)-1; let s = parseInt(seconds)-1;
@ -53,7 +56,7 @@ class AccountSecure extends Component {
// 获取验证码 // 获取验证码
getCode=(index)=>{ getCode=(index)=>{
let url=`/account/get_verification_code.json` let url=`/accounts/get_verification_code.json`
let login = ''; let login = '';
let values=this.props.form.getFieldsValue(); let values=this.props.form.getFieldsValue();
if(index == 3){ if(index == 3){
@ -199,8 +202,10 @@ class AccountSecure extends Component {
InputNewPassword=(rule,value,callback)=>{ InputNewPassword=(rule,value,callback)=>{
const { form } = this.props; const { form } = this.props;
if (value.length<8 || value.length>12) { if (!value) {
callback("请输入8-12个字符的新密码区分大小写"); callback("请输入8-16位字符的新密码区分大小写");
} else if (value.length<8 || value.length>16) {
callback("请输入8-16位字符的新密码区分大小写");
} else { } else {
callback(); callback();
} }
@ -283,7 +288,7 @@ class AccountSecure extends Component {
: :
<span style={{color: '#EA320E'}}>未绑定</span> <span style={{color: '#EA320E'}}>未绑定</span>
} }
绑定手机号码将获得500金币的奖励哟手机号码仅自己可见~ {basicInfo.phone ? '仅自己可见可用手机号码登录EduCoder' : '绑定手机号码将获得500金币的奖励哟手机号码仅自己可见~'}
</div> </div>
{ {
updating != PHONE && updating != PHONE &&
@ -305,10 +310,10 @@ class AccountSecure extends Component {
rules: [{ rules: [{
// initialValue: this.state.cityDefaultValue, // initialValue: this.state.cityDefaultValue,
required: true, required: true,
message: '请输入要绑定的手机号码', message: `请输入要${basicInfo.phone ? '更换' : '绑定'}的手机号码`,
}], }],
})( })(
<Input placeholder="请输入要绑定的手机号码"></Input> <Input placeholder={`请输入要${basicInfo.phone ? '更换' : '绑定'}的手机号码`}></Input>
)} )}
</Form.Item> </Form.Item>
@ -442,10 +447,6 @@ class AccountSecure extends Component {
> >
{getFieldDecorator('p_new', { {getFieldDecorator('p_new', {
rules: [{ rules: [{
// initialValue: this.state.cityDefaultValue,
required: true,
message: '请输入816位的新密码区分大小写',
},{
validator:this.InputNewPassword validator:this.InputNewPassword
}], }],
})( })(

@ -18,9 +18,7 @@
.flexRow { .flexRow {
display: flex; display: flex;
} }
.color-green-light{
color: #45E660!important;
}
.mb15{margin-bottom: 15px!important;} .mb15{margin-bottom: 15px!important;}
/* BUTTOn */ /* BUTTOn */
.ant-btn { .ant-btn {
@ -45,10 +43,7 @@ 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;
@ -56,61 +51,3 @@ 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;
height:418px;
}
.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;
}

@ -40,9 +40,9 @@ class ApplyForAddOrgModal extends Component{
if(!err){ if(!err){
let url=`/add_school_applies.json`; let url=`/add_school_applies.json`;
axios.post(url,{ axios.post(url,{
schoolName:values.name, schoolName:values.schoolName,
province:values.city[0], province:values.city && values.city[0],
city:values.city[1], city:values.city && values.city[1],
address:values.address, address:values.address,
remarks:values.remarks remarks:values.remarks
}).then((result)=>{ }).then((result)=>{
@ -95,6 +95,10 @@ class ApplyForAddOrgModal extends Component{
.explain .ant-form-explain{ .explain .ant-form-explain{
top:36px; top:36px;
} }
.addOrg ul.ant-cascader-menu {
width: 196px;
}
`}</style> `}</style>
<Form onSubmit={this.onOk}> <Form onSubmit={this.onOk}>
<Form.Item <Form.Item
@ -132,7 +136,7 @@ class ApplyForAddOrgModal extends Component{
{getFieldDecorator('city', { {getFieldDecorator('city', {
rules: [], rules: [],
})( })(
<City ></City> <City matchInputWidth={true} popupClassName={"addOrg"}></City>
)} )}
</Form.Item> </Form.Item>

@ -2,7 +2,7 @@ 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,getImageUrl } from 'educoder' import { City, getUploadActionUrl, getImageUrl, ImageLayerHook } from 'educoder'
import '../account/common.css' import '../account/common.css'
import authImg from '../../../images/account/auth.png' import authImg from '../../../images/account/auth.png'
@ -202,6 +202,10 @@ class RealNameCertificationModal extends Component{
.applyForModal .ant-form-item-label label { .applyForModal .ant-form-item-label label {
color: #979797 color: #979797
} }
.applyForModal .ant-upload.ant-upload-drag .ant-upload {
padding: 0px;
}
.certificationModal .ant-modal-body{ .certificationModal .ant-modal-body{
padding:20px; padding:20px;
} }
@ -295,9 +299,9 @@ class RealNameCertificationModal extends Component{
</span> </span>
<Dragger {...uploadProps2}> <Dragger {...uploadProps2}>
{imageUrl2 ? {imageUrl2 ?
<a href={imageUrl2} target="_blank" title="点击重新上传图片"> // <a href={imageUrl2} target="_blank" title="点击重新上传图片"></a>
<img src={imageUrl2} alt="avatar" style={{ maxHeight: '110px'}}/> <img src={imageUrl2} alt="avatar" style={{ maxHeight: '110px'}}/>
</a> : :
<React.Fragment> <React.Fragment>
<p className="ant-upload-drag-icon"> <p className="ant-upload-drag-icon">
<i className="iconfont icon-cuban2shangchuanyunduan" style={{color:"#4B667F",font:"42px"}}></i> <i className="iconfont icon-cuban2shangchuanyunduan" style={{color:"#4B667F",font:"42px"}}></i>
@ -311,7 +315,9 @@ class RealNameCertificationModal extends Component{
<div className="df mt10 color-grey-9" style={{ justifyContent: 'center' }} > <div className="df mt10 color-grey-9" style={{ justifyContent: 'center' }} >
<span className="fl mr20 edu-txt-center" style={{width:"160px"}}>示例图片</span> <span className="fl mr20 edu-txt-center" style={{width:"160px"}}>示例图片</span>
<span className="fl edu-txt-center mr20" style={{width:"160px"}}> <span className="fl edu-txt-center mr20" style={{width:"160px"}}>
<a href="javascript:void(0)" className="color-orange" style={{borderBottom:"1px solid #ff6800"}}>查看大图</a> <ImageLayerHook parentSel={'#imageLayerBtn'} parentSel={'#imageLayerBtn'}
></ImageLayerHook>
<a href="javascript:void(0)" id="imageLayerBtn" src={imageUrl || imageUrl2} className="color-orange" style={{borderBottom:"1px solid #ff6800"}}>查看大图</a>
</span> </span>
</div> </div>
</div> </div>

Loading…
Cancel
Save