Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
cxt 5 years ago
commit bad0158971

@ -46,7 +46,8 @@ class CoursesNew extends Component {
let coursesId = this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
let user_school=this.props.current_user&&this.props.current_user.user_school; let user_school=this.props.current_user&&this.props.current_user.user_school;
this.getschool("")
this.Searchvalue("")
if (coursesId != undefined) { if (coursesId != undefined) {
let url = "/courses/" + coursesId + "/settings.json" let url = "/courses/" + coursesId + "/settings.json"
axios.get(url).then((result) => { axios.get(url).then((result) => {
@ -85,8 +86,7 @@ class CoursesNew extends Component {
}) })
} }
this.getschool("")
this.Searchvalue("")
} }
componentDidUpdate(prevProps){ componentDidUpdate(prevProps){
@ -152,7 +152,7 @@ class CoursesNew extends Component {
} }
if(values.school===""||values.school===undefined){ if(values.school===""||values.school===undefined){
this.scrollToAnchor("isschool") // this.scrollToAnchor("isschool")
return return
} }
@ -220,7 +220,7 @@ class CoursesNew extends Component {
return return
} }
if(values.school===""||values.school===undefined){ if(values.school===""||values.school===undefined){
this.scrollToAnchor("isschool") // this.scrollToAnchor("isschool")
return return
} }
@ -292,7 +292,8 @@ class CoursesNew extends Component {
search:value search:value
}).then((result)=>{ }).then((result)=>{
// console.log(result.data) // console.log(result.data)
if (result.data.status===0) { if (result.data.message===undefined) {
this.setState({ this.setState({
searchlist: result.data.course_lists, searchlist: result.data.course_lists,
// course:value, // course:value,
@ -357,7 +358,9 @@ class CoursesNew extends Component {
}; };
getschool=(value)=>{ getschool=(value)=>{
this.props.form.setFieldsValue({
school: value
})
let url="/schools/school_list.json"; let url="/schools/school_list.json";
axios.get(url,{ axios.get(url,{
params: { params: {
@ -369,9 +372,7 @@ class CoursesNew extends Component {
searchlistscholl: result.data.school_names, searchlistscholl: result.data.school_names,
school: value school: value
}) })
this.props.form.setFieldsValue({
school: value
})
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)
@ -389,7 +390,7 @@ class CoursesNew extends Component {
const optionschool = this.state.searchlistscholl&&this.state.searchlistscholl.map(z => <Option key={z} value={z}>{z}</Option>); const optionschool = this.state.searchlistscholl&&this.state.searchlistscholl.map(z => <Option key={z} value={z}>{z}</Option>);
// console.log(this.props.current_user.user_school) // console.log(this.props.current_user.user_school)
// form合并了 // form合并了
// console.log(optionschool) console.log(options)
return ( return (
<React.Fragment> <React.Fragment>

@ -114,7 +114,7 @@ class MainContent extends Component {
? ?
readRepoTimeout === true ? <div className="readRepoFailed"> readRepoTimeout === true ? <div className="readRepoFailed">
代码加载失败<a className="retry" 代码加载失败<a className="retry"
onClick={() => this.props.fetchRepositoryCode(this.props, null, null, true)}>重试</a> onClick={() => this.props.fetchRepositoryCode(this.props, null, null, true, true)}>重试</a>
</div> : </div> :
<React.Fragment> <React.Fragment>
<div style={{display: (codeLoading ? 'block' : 'none'), textAlign: 'center'}}> <div style={{display: (codeLoading ? 'block' : 'none'), textAlign: 'center'}}>

@ -235,7 +235,7 @@ class MainContentContainer extends Component {
} }
// arg_path 点击文件目录树时传入的点击节点对应的path // arg_path 点击文件目录树时传入的点击节点对应的path
fetchRepositoryCode( props, arg_path, type, isRetry) { fetchRepositoryCode( props, arg_path, type, isRetry, retryAndRefresh) {
const { challenge, showSnackbar, game, shixun, myshixun, hide_code } = props ? props : this.props; const { challenge, showSnackbar, game, shixun, myshixun, hide_code } = props ? props : this.props;
if (shixun.vnc == true) { if (shixun.vnc == true) {
// vnc模式下不需要加载代码 // vnc模式下不需要加载代码
@ -293,6 +293,10 @@ class MainContentContainer extends Component {
// that._cancel = c; // that._cancel = c;
// }) // })
}).then((fetchRepositoryCodeResponse) => { }).then((fetchRepositoryCodeResponse) => {
if (retryAndRefresh && fetchRepositoryCodeResponse.data.content) {
window.location.reload()
return;
}
// 空字符串还是正常切换 // 空字符串还是正常切换
if (fetchRepositoryCodeResponse.data.status == 0) { if (fetchRepositoryCodeResponse.data.status == 0) {
readingRepoTimes = readingRepoTimes + 1; readingRepoTimes = readingRepoTimes + 1;

@ -192,6 +192,8 @@ class InterestpageComponent extends Component {
ints.push(this.state.gouxuans4[i].id); ints.push(this.state.gouxuans4[i].id);
} }
} }
console.log("195195");
console.log(ints);
if(ints.length<1){ if(ints.length<1){
this.openNotification("请至少选择一个您感兴趣的内容"); this.openNotification("请至少选择一个您感兴趣的内容");
return return

@ -182,10 +182,6 @@ class InterestpageMax extends Component {
//兴趣页面点击 //兴趣页面点击
Interestcompletionpage(){ Interestcompletionpage(){
this.setState({
setpagecomplet:true
})
if(this.state.gouxuans.length === 0){ if(this.state.gouxuans.length === 0){
this.openNotification("请选择职业"); this.openNotification("请选择职业");
return return
@ -197,6 +193,8 @@ class InterestpageMax extends Component {
ints.push(this.state.gouxuans4[i].id); ints.push(this.state.gouxuans4[i].id);
} }
} }
console.log("200200");
console.log(ints);
if(ints.length<1){ if(ints.length<1){
this.openNotification("请至少选择一个您感兴趣的内容"); this.openNotification("请至少选择一个您感兴趣的内容");
return return
@ -302,7 +300,7 @@ class InterestpageMax extends Component {
) )
})} })}
</div> </div>
<Button className="yslbutton2" size={"large"} type="primary"onClick={this.state.setpagecomplet===true?"":()=>this.Interestcompletionpage()} style={{width:"255px",height: "35px",background: "#4CACFF",marginTop: "17px"} }>完成</Button> <Button className="yslbutton2" size={"large"} type="primary"onClick={()=>this.Interestcompletionpage()} style={{width:"255px",height: "35px",background: "#4CACFF",marginTop: "17px"} }>完成</Button>
</div> </div>
</div> </div>

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { SnackbarHOC, getImageUrl, City, ConditionToolTip } from 'educoder'; import { SnackbarHOC, getImageUrl, City, ConditionToolTip } from 'educoder';
import { Form, Button, Input, Radio, Select, Tooltip, Icon } from 'antd' import { Form, Button, Input, Radio, Select, Tooltip, Icon, AutoComplete } 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' import axios from 'axios'
@ -84,14 +84,29 @@ class AccountBasic extends Component {
} }
// 获取学校、单位 // 获取学校、单位
getSchoolList=(basicInfo)=>{ getSchoolList=(basicInfo, selectedName)=>{
let url=`/schools/for_option.json`; let url=`/schools/for_option.json`;
axios.get(url).then((result)=>{ axios.get(url).then((result)=>{
if(result){ if(result){
this.setState({ this.setState({
schoolList:result.data.schools schoolList:result.data.schools
}) })
if(basicInfo && basicInfo.school_name){ if (selectedName) {
let school_id
result.data.schools.reverse().some( item => {
if (item.name == selectedName) {
school_id = item.id
return true;
}
})
this.props.form.setFieldsValue({
org: selectedName
})
this.setState({
school_id,
school: selectedName
})
} else if(basicInfo && basicInfo.school_name){
this.setState({ this.setState({
school:basicInfo.school_name, school:basicInfo.school_name,
filterSchoolList:this.state.schoolList.filter(function(item){ filterSchoolList:this.state.schoolList.filter(function(item){
@ -119,6 +134,15 @@ class AccountBasic extends Component {
console.log(values); console.log(values);
let {basicInfo}=this.props; let {basicInfo}=this.props;
if(!err ){ if(!err ){
if (!this.state.school_id) {
this.props.showNotification('请先请先选择学校/单位')
return;
}
if (!this.state.department_id) {
this.props.showNotification('请先选择院系/部门')
return;
}
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,
@ -187,6 +211,10 @@ class AccountBasic extends Component {
school:e, school:e,
filterSchoolList:arr filterSchoolList:arr
}) })
} else {
this.setState({
school: '',
})
} }
// else{ // else{
// let {school}=this.state; // let {school}=this.state;
@ -208,17 +236,30 @@ class AccountBasic extends Component {
filterDepartments:arr, filterDepartments:arr,
departmentsName:e departmentsName:e
}) })
} else {
this.setState({
filterDepartments: this.state.departments
})
} }
} }
// 选择部门、学院 // 选择部门、学院
changeDepartment=(e)=>{ changeDepartment=(e)=>{
let arr= this.state.departments && this.state.departments.filter ? this.state.departments.filter(function(item){ let arr = this.state.departments && this.state.departments.filter ? this.state.departments.filter(function(item){
return item.name == e; return item.name == e;
}) : []; }) : [];
if (!arr[0]) {
this.setState({
department_id: '',
departmentsName: e,
})
this.this_department_id = ''
return;
}
this.this_department_id = arr[0].id
this.setState({ this.setState({
departmentsName:e, departmentsName:e,
department_id:arr[0].id department_id: arr[0].id
}) })
} }
@ -231,20 +272,57 @@ class AccountBasic extends Component {
let arr=this.state.schoolList.filter(function(item){ let arr=this.state.schoolList.filter(function(item){
return item.name == e; return item.name == e;
}); });
if (!arr[0]) {
// 没找到学校,清空部门
this.setState({
departments: [],
filterDepartments: [],
school_id: '',
department_id: '',
})
this.this_school_id = ''
this.props.form.setFieldsValue({
org2: ''
})
return;
}
this.props.form.setFieldsValue({
org: arr[0].name
})
this.filterList(e)
// 保存选择的学校id // 保存选择的学校id
this.this_school_id = arr[0].id
this.setState({ this.setState({
school_id:arr[0].id, school_id: arr[0].id,
school:e, school:e,
}) })
let url=`/schools/${arr[0].id}/departments/for_option.json`; this._getDepartments(arr[0].id, flag)
}
_getDepartments = (schoolId, flag, selectedName) => {
let url=`/schools/${schoolId || this.state.school_id}/departments/for_option.json`;
axios.get(url).then((result)=>{ axios.get(url).then((result)=>{
if(result){ if(result){
this.setState({ this.setState({
departments:result.data.departments, departments:result.data.departments,
filterDepartments:result.data.departments filterDepartments:result.data.departments
}) })
// 切换学校后,部门默认选择第一个 if (selectedName) {
if(result.data.departments && result.data.departments.length>0 && flag==true){ let department_id
result.data.departments.reverse().some( item => {
if (item.name == selectedName) {
department_id = item.id
return true;
}
})
this.props.form.setFieldsValue({
org2: selectedName
})
this.setState({
department_id,
// school: selectedName
})
} else if(result.data.departments && result.data.departments.length>0 && flag==true){
// 切换学校后,部门默认选择第一个
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
org2:result.data.departments[0].name org2:result.data.departments[0].name
}) })
@ -273,6 +351,23 @@ class AccountBasic extends Component {
} }
} }
addOrgSuccess = (name) => {
// const schoolList = this.state.schoolList.slice(0)
// schoolList.push({ id: schoolList.length + 2000, name: name})
// this.setState({ schoolList })
this.getSchoolList(this.props.basicInfo, name);
this.props.form.setFieldsValue({
name: name
})
}
addChildOrgSuccess = (deptName) => {
this._getDepartments(this.state.school_id, false, deptName);
}
showApplyForAddOrgModal = () => { showApplyForAddOrgModal = () => {
this.applyForAddOrgForm.setVisible(true) this.applyForAddOrgForm.setVisible(true)
@ -309,19 +404,22 @@ class AccountBasic extends Component {
return ( return (
<div> <div>
<ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school} <ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school}
{...propsWithoutForm}></ApplyForAddOrgModal> {...propsWithoutForm} addOrgSuccess={this.addOrgSuccess}
></ApplyForAddOrgModal>
<ApplyForAddChildOrgModal ref="applyForAddChildOrgModal" schoolName={school} schoolId={school_id} departmentName={departmentsName} <ApplyForAddChildOrgModal ref="applyForAddChildOrgModal" schoolName={school} schoolId={school_id} departmentName={departmentsName}
{...propsWithoutForm} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form} ></ApplyForAddChildOrgModal> {...propsWithoutForm} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form}
addChildOrgSuccess={this.addChildOrgSuccess}
></ApplyForAddChildOrgModal>
<div className="basicForm"> <div className="basicForm">
<style>{` <style>{`
.formItemInline { .formItemInline {
display: flex; display: flex;
margin-bottom: 20px; margin-bottom: 10px;
position:relative; position:relative;
} }
.formItemInline .ant-form-explain{ .formItemInline .ant-form-explain{
position:absolute; /* position:absolute;*/
bottom:-20px; bottom:-20px;
left:0px; left:0px;
width:100%; width:100%;
@ -544,19 +642,29 @@ class AccountBasic extends Component {
// type: 'array', // type: 'array',
required: true, required: true,
message: '请先选择学校/单位', message: '请先选择学校/单位',
// 做不了输入时和submit时都会执行这里
// validator: (rule, value, callback) => {
// if (this.this_school_id) {
// callback();
// return;
// }
// callback('请先选择学校/单位');
// }
}], }],
})( })(
<Select width={400} showSearch onSearch={this.filterList} onChange={this.changeList}> <AutoComplete width={400} showSearch onSearch={this.filterList} onChange={this.changeList}>
{ {
filterSchoolList && filterSchoolList.map((item,key)=>{ filterSchoolList && filterSchoolList.map((item,key)=>{
return(<Option value={item.name} key={item.id}>{item.name}</Option>) return(<Option value={item.name} key={item.id}>{item.name}</Option>)
}) })
} }
</Select> </AutoComplete>
)} )}
</Form.Item> </Form.Item>
<div style={{marginLeft: '100px',height:"20px",lineHeight:"20px"}}> <div style={{marginLeft: '100px',height:"20px",lineHeight:"20px"}}>
{!filterSchoolList || (filterSchoolList && filterSchoolList.length==0 )&& {!filterSchoolList || (filterSchoolList && filterSchoolList.length==0 )&& school &&
<span> <span>
<span style={{color: '#CDCDCD'}}>未找到包含{school}的高校</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>
@ -573,9 +681,16 @@ class AccountBasic extends Component {
// type: 'array', // type: 'array',
required: true, required: true,
message: '请先选择院系/部门', message: '请先选择院系/部门',
// validator: (rule, value, callback) => {
// if (this.this_department_id) {
// callback();
// return;
// }
// callback('请先选择院系/部门');
// }
}], }],
})( })(
<Select width={400} showSearch onSearch={this.searchDepartment} onChange={this.changeDepartment}> <AutoComplete width={400} showSearch onSearch={this.searchDepartment} onChange={this.changeDepartment}>
{ {
filterDepartments && filterDepartments.map((item,key)=>{ filterDepartments && filterDepartments.map((item,key)=>{
return( return(
@ -583,12 +698,12 @@ class AccountBasic extends Component {
) )
}) })
} }
</Select> </AutoComplete>
)} )}
</Form.Item> </Form.Item>
<div style={{marginLeft: '100px',height:"20px",lineHeight:"20px"}}> <div style={{marginLeft: '100px',height:"20px",lineHeight:"20px"}}>
{ {
!filterDepartments || (filterDepartments && filterDepartments.length==0 )&& !filterDepartments || (filterDepartments && filterDepartments.length==0 )&& departmentsName &&
<span> <span>
<span style={{color: '#CDCDCD'}}>未找到包含{departmentsName}的院系/部门</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>

@ -43,12 +43,14 @@ class ApplyForAddChildOrgModal extends Component{
let{schoolId,departmentName}=this.props let{schoolId,departmentName}=this.props
let url=`/add_department_applies.json`; let url=`/add_department_applies.json`;
axios.post(url,{ axios.post(url,{
name:departmentName, name: values.depart,
school_id:schoolId, school_id: schoolId,
remarks:values.desc remarks: values.desc
}).then((result)=>{ }).then((result)=>{
if(result){ if(result){
this.props.showNotification("新增院系/部门成功!"); this.props.showNotification("新增院系/部门成功!");
this.props.addChildOrgSuccess(values.depart)
this.setVisible(false); this.setVisible(false);
} }
}).catch((error)=>{ }).catch((error)=>{

@ -48,6 +48,7 @@ class ApplyForAddOrgModal extends Component{
}).then((result)=>{ }).then((result)=>{
if(result){ if(result){
this.props.showNotification("新增学校/单位成功!"); this.props.showNotification("新增学校/单位成功!");
this.props.addOrgSuccess(values.schoolName)
this.setVisible(false); this.setVisible(false);
} }
}).catch((error)=>{ }).catch((error)=>{

Loading…
Cancel
Save