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

PCqiandao
cxt 5 years ago
commit b9fc977bf2

@ -130,16 +130,17 @@ class CoursesBanner extends Component {
axios.get(url,{params:
dataqueryss
}).then((result) => {
if(result.data.status===-2){
// this.setState({
// AccountProfiletype:true,
// content:result.data.message,
// okText:"立即认证",
// cannelText:"稍后认证",
// okHref:`/account/certification`,
// Accounturltype:true
// })
}else{
try {
if(result.data.status===-2){
// this.setState({
// AccountProfiletype:true,
// content:result.data.message,
// okText:"立即认证",
// cannelText:"稍后认证",
// okHref:`/account/certification`,
// Accounturltype:true
// })
}else{
if( result!=undefined){
let data = result.data;
this.setState({
@ -150,8 +151,12 @@ class CoursesBanner extends Component {
}else{
this.onloadupdatabanner()
}
}
}catch (e) {
}
})
};
foo=(url)=> {

@ -42,8 +42,8 @@ class ModulationModal_exercise extends Component {
}
componentDidMount = () => {
console.log("ModulationModal_exercise");
console.log(this.props);
// console.log("ModulationModal_exercise");
// console.log(this.props);
this.setState({
subjective_score: this.props.subjective_score,
objective_score: this.props.objective_score,

@ -75,9 +75,10 @@ class ExerciseListItem extends Component{
let{item,checkBox,index}=this.props;
let {coursesId,Id}=this.props.match.params
const IsAdmin =this.props.isAdmin();
const IsStudent =this.props.isStudent();
const isAssistant=this.props.isAssistant();
const IsStudent =this.props.isStudent();
// console.log(this.props.current_user.user_id)
return(
<div className="workList_Item" style={{cursor : IsAdmin ? "pointer" : "default",padding:"30px" }} onClick={() => window.$(`.exerciseitem${index} input`).click() }>
{
@ -189,8 +190,31 @@ class ExerciseListItem extends Component{
{ IsAdmin &&<div className="homepagePostSetting" style={{"right":"-17px","top":"46px","display":"block","width":"200px"}}>
<a className="btn colorblue font-16 ml20" onClick={()=>this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情</a>
<Link className="btn colorblue font-16 ml20" to={`/classrooms/${coursesId}/exercises/${item.id}/edit`}>编辑</Link>
{
isAssistant===true?
(
item&&item.assistant_auth===true?
<a className="btn colorblue font-16 ml20" onClick={()=>this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情</a>
:
<a className="btn colorblue font-16 " style={{
marginLeft: "73px"
}} onClick={()=>this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情</a>
)
:
<a className="btn colorblue font-16 ml20" onClick={()=>this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情</a>
}
{
isAssistant===true?
(
item&&item.assistant_auth===true?
<Link className="btn colorblue font-16 ml20" to={`/classrooms/${coursesId}/exercises/${item.id}/edit`}>编辑</Link>
:
""
)
:
<Link className="btn colorblue font-16 ml20" to={`/classrooms/${coursesId}/exercises/${item.id}/edit`}>编辑</Link>
}
<Link className="btn colorblue ml20 font-16" to={`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=3`}>设置</Link>
</div> }

@ -75,10 +75,11 @@ class Exercisesetting extends Component{
limit:10,
searchtext:"",
order: "end_at",
assistant_auth:false
}
console.log("Exercisesetting");
console.log("69");
console.log(props);
// console.log("Exercisesetting");
// console.log("69");
// console.log(props);
}
_getRequestParams() {
const { order, exercise_group_id,searchtext, page ,limit} = this.state
@ -92,6 +93,12 @@ class Exercisesetting extends Component{
}
//加载
componentDidMount=()=>{
this.setState({
assistant_auth:this.props.assistant_auth,
})
this.getSettingInfo();
// window.addEventListener('click', this.handleClick);
@ -108,11 +115,34 @@ class Exercisesetting extends Component{
if(this.props.isAdmin() === false){
this.cancelEdit()
}
try {
//是否为助教
if(this.props.isAssistant()===true){
//如果是助教是否有权限
if(this.props.assistant_auth===true){
this.setState({
flagPageEdit:true
})
}else{
this.setState({
flagPageEdit:false
})
}
}
}catch (e) {
}
}
componentDidUpdate = (prevProps) => {
if(prevProps.Commonheadofthetestpaper!= this.props.Commonheadofthetestpaper){
this.editSetting()
}
if(prevProps.assistant_auth!= this.props.assistant_auth){
this.setState({
assistant_auth:this.props.assistant_auth,
})
}
}
_getRequestParams() {
@ -348,10 +378,16 @@ class Exercisesetting extends Component{
this.commitSetting((result)=>{
console.log(result)
if(result.status==200){
if(result.status===200){
this.props.showNotification(`${result.data.message}`);
this.getSettingInfo(1);
this.cancelEdit();
try {
this.props.assistantauthoritys(this.state.assistant_auth);
}catch (e) {
}
}
})
}
@ -371,6 +407,12 @@ class Exercisesetting extends Component{
this.props.showNotification(`${result.data.message}`);
this.cancelEdit();
this.getSettingInfo(1);
try {
this.props.assistantauthoritys(this.state.assistant_auth);
}catch (e) {
}
}
});
@ -386,11 +428,12 @@ class Exercisesetting extends Component{
publish_time:this.state.publish_time,
end_time:this.state.end_time,
show_statistic:this.state.show_statistic,
choice_random:this.state.choice_random,
choice_random:this.state.choice_random,
score_open:this.state.score_open,
answer_open:this.state.answer_open,
question_random:this.state.question_random,
time:this.state.time,
assistant_auth:this.state.assistant_auth,
}
}else{
let list=this.state.rules;
@ -403,7 +446,6 @@ class Exercisesetting extends Component{
}
lists.push(newlist)
})
params={
unified_setting:this.state.unified_setting,
show_statistic:this.state.show_statistic,
@ -413,6 +455,7 @@ class Exercisesetting extends Component{
answer_open:this.state.answer_open,
publish_time_groups:lists,
time:this.state.time,
assistant_auth:this.state.assistant_auth,
}
}
axios.post((url),params).then((result)=>{
@ -491,6 +534,12 @@ class Exercisesetting extends Component{
})
}
assistantauthority=(e)=>{
this.setState({
assistant_auth:e.target.checked
})
}
onChangeTimepublish=(date, dateString)=>{
if(date===null){
this.setState({
@ -555,9 +604,33 @@ class Exercisesetting extends Component{
modalSave:this.cancelBox
})
}else{
this.setState({
flagPageEdit:true
})
if(this.props.isAdmin()===true){
try {
//是否为助教
if(this.props.isAssistant()===true){
//如果是助教是否有权限
if(this.props.assistant_auth===true){
this.setState({
flagPageEdit:true
})
}else{
this.setState({
flagPageEdit:false
})
}
}else{
//是老师
this.setState({
flagPageEdit:true
})
}
}catch (e) {
this.setState({
flagPageEdit:true
})
}
}
}
}
//取消编辑
@ -608,7 +681,9 @@ class Exercisesetting extends Component{
// console.log("asdasdasda");
// console.log(this.props);
// console.log(this.props.Commonheadofthetestpaper);
return(
return(
<div>
<Modals
modalsType={modalsType}
@ -623,13 +698,22 @@ class Exercisesetting extends Component{
<span className="font-16 fl">发布设置<span className="color-grey-c font-14"></span></span>
{
!flagPageEdit&&this.props.isAdmin()===true ?
<a className="fr mr6 white-btn edu-blueline-btn lineh-24" onClick={this.editSetting}>
编辑设置
{/*<Tooltip title="编辑">*/}
{/*<i className="iconfont icon-bianjidaibeijing font-20 color-green"></i>*/}
{/*</Tooltip>*/}
</a>
:""
(
this.props.isAssistant()===true?
(
this.props.assistant_auth===true?
<a className="fr mr6 white-btn edu-blueline-btn lineh-24" onClick={this.editSetting}>
编辑设置
</a>
:
""
)
:
<a className="fr mr6 white-btn edu-blueline-btn lineh-24" onClick={this.editSetting}>
编辑设置
</a>
)
:""
}
</p>
@ -769,7 +853,7 @@ class Exercisesetting extends Component{
<div className="padding20-30">
<p className="mb30 clearfix font-16">公开设置</p>
<p className="mb30 clearfix font-16">属性设置</p>
<div className="pl33">
<p className="mb20">
@ -790,7 +874,7 @@ class Exercisesetting extends Component{
</Form.Item>
<span className="color-grey-c">(选中则在试卷截止时间之后已提交答题的学生可以查看试卷题目的答案否则不能查看)</span>
</p>
<p className="clearfix mb5">
<p className="clearfix mb20">
<Form.Item className="fl pollForm">
{getFieldDecorator('show_statistic')
(
@ -799,6 +883,15 @@ class Exercisesetting extends Component{
</Form.Item>
<span className="color-grey-c">(选中则在试卷截止时间之后已提交答题的学生可以查看答题统计否则不能查看)</span>
</p>
<p className="clearfix mb5">
<Form.Item className="fl pollForm">
{getFieldDecorator('assistantauthority')
(
<Checkbox disabled={this.props.isAdmin()===true?!flagPageEdit:true} className="mr15 font-16 color-grey-6" checked={this.state.assistant_auth} onChange={this.assistantauthority}>助教权限</Checkbox>
)}
</Form.Item>
<span className="color-grey-c">(勾选则允许助教查看答案)</span>
</p>
</div>
</div>
@ -808,7 +901,10 @@ class Exercisesetting extends Component{
<div className="clearfix mt30 ml40" style={{paddingBottom:'40px'}}>
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">提交</Button>
<a className="defalutCancelbtn fl" onClick={this.cancelEdit}>取消</ a>
</div>:""
</div>
:""
}
</Form>
@ -820,70 +916,3 @@ const WrappedExercisesetting = Form.create({ name: 'exercisesetting' })(Exercise
export default WrappedExercisesetting;
// //提交form表单
// handleSubmit = (e) => {
//
// let{unified_setting,answer_open}=this.state;
// e.preventDefault();
// let exercise_id=this.props.match.params.Id;
//
// this.props.form.validateFieldsAndScroll((err, values) => {
// debugger
// if(!err){
// // 第一次进行问卷设置或者勾选了统一设置
// if(unified_setting==true){
// if(this.state.p_flag == false && this.state.e_flag == true){
// // 选择了发布时间但截至时间没有选择
// this.setState({
// modalsType:true,
// modalsTopval:"请选择截止时间",
// loadtype:true,
// modalSave:this.cancelBox
// })
// return;
// }else if(this.state.p_flag == true && this.state.e_flag == true){
// // 如果两个时间都没有填写则弹出立即发布弹框
// let{publish_time,end_time}=this.state
// if(publish_time==undefined && end_time ==undefined){
//
// }else{
// // 否则就是选择的时间错误
// this.setState({
// modalsType:true,
// modalsTopval:"请选择正确的发布时间和截止时间",
// loadtype:true,
// modalSave:this.cancelBox
// })
// }
// return;
// }
// }
//
// let url=`/exercises/${exercise_id}/commit_setting.json`;
// let params=[];
// if(values.unitSet){
// params={
// unified_setting:values.unitSet,
// publish_time:this.state.publish_time,
// end_time:this.state.end_time,
// show_result:values.public,
// un_anonymous:values.real
// }
// }else{
// params={
// unified_setting:values.unitSet,
// show_result:values.public,
// un_anonymous:values.real,
// publish_time_groups:this.state.rules
// }
// }
// axios.post((url),{params}).then((result)=>{
// if(result.status==200){
// this.props.showNotification(`${result.data.message}`);
// }
// }).catch((error)=>{
// console.log(error);
// })
// }
// })
// }

@ -1158,8 +1158,24 @@ class Studentshavecompletedthelist extends Component {
<span>
{
record.submitstate === "未提交"||record.commit_method===5?
<a style={{textAlign: "center"}} className="color-blue"
target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a>
(//是否助教
this.props.isAssistant()&&this.props.isAssistant()===true?
(//助教是否有权限
this.props.assistant_auth&&this.props.assistant_auth===true?
(//是否截止
this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3?
<a style={{textAlign: "center"}} className="color-blue"
target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a>
:
<span style={{textAlign: "center", color: '#999999'}}>--</span>
)
:
<span style={{textAlign: "center", color: '#999999'}}>--</span>
)
:
<a style={{textAlign: "center"}} className="color-blue"
target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a>
)
:record.submitstate === "已提交"?
<a style={{textAlign: "center"}} className="color-blue"
target="_blank"
@ -1167,7 +1183,7 @@ class Studentshavecompletedthelist extends Component {
:
<span style={{textAlign: "center", color: '#999999'}}>--</span>
}
</span>
</span>
)
},
],
@ -1376,8 +1392,24 @@ class Studentshavecompletedthelist extends Component {
<span>
{
record.submitstate === "未提交"||record.commit_method===5?
<a style={{textAlign: "center"}} className="color-blue"
target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a>
(//是否助教
this.props.isAssistant()&&this.props.isAssistant()===true?
(//助教是否有权限
this.props.assistant_auth&&this.props.assistant_auth===true?
(//是否截止
this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3?
<a style={{textAlign: "center"}} className="color-blue"
target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a>
:
<span style={{textAlign: "center", color: '#999999'}}>--</span>
)
:
<span style={{textAlign: "center", color: '#999999'}}>--</span>
)
:
<a style={{textAlign: "center"}} className="color-blue"
target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a>
)
:record.submitstate === "已提交"?
<a style={{textAlign: "center"}} className="color-blue"
target="_blank"
@ -1385,7 +1417,7 @@ class Studentshavecompletedthelist extends Component {
:
<span style={{textAlign: "center", color: '#999999'}}>--</span>
}
</span>
</span>
)
},
],//columnsystwo 也会被columnsys当作参数接收
@ -2772,8 +2804,16 @@ class Studentshavecompletedthelist extends Component {
}
// 调分
Adjustment = (e) => {
console.log("Adjustment");
console.log(e);
// console.log("Adjustment");
// console.log(e);
if(this.state.objective_score===0&&this.state.subjective_score===0){
this.props.showNotification('试卷题型分被限制为0分不能调分请点击编辑试卷修改题型分数');
return
}
this.setState({
testpapergradingboll: true,
exeuserid: e,
@ -2828,8 +2868,8 @@ class Studentshavecompletedthelist extends Component {
// //console.log("this.props.Commonheadofthetestpaper.exercise_status");
// //console.log(this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status);
// //console.log(exercise_status);
console.log("Studentshavecompletedthelis123123t");
console.log(columnss);
// console.log("Studentshavecompletedthelis123123t");
// console.log(columnss);
return (
isAdmin === true ?
(

@ -35,6 +35,7 @@ class Testpapersettinghomepage extends Component{
DownloadMessageval:undefined,
donwloading:false,
exercise_status:3,
assistant_auth:false, //设置助教
}
}
//切换tab
@ -72,6 +73,7 @@ class Testpapersettinghomepage extends Component{
Commonheadofthetestpaper:response.data,
current_status:response.data.user_permission.current_status,
exercise_status:response.data.exercise_status,
assistant_auth:response.data.assistant_auth,
})
// console.log(JSON.stringify(response.data.show_statistic));
@ -85,6 +87,12 @@ class Testpapersettinghomepage extends Component{
}
assistantauthoritys=(bool)=>{
this.setState({
assistant_auth:bool,
})
}
Ecerciseacallagain=()=>{
this.setState({
visible:true
@ -287,9 +295,11 @@ class Testpapersettinghomepage extends Component{
this.props.history.goBack()
}
render(){
let {tab,visible,Commonheadofthetestpaper,exercise_status}=this.state;
let {tab,visible,Commonheadofthetestpaper,exercise_status,assistant_auth}=this.state;
const isAdmin =this.props.isAdmin();
const isStudent = this.props.isStudent();
const isAssistant=this.props.isAssistant();
const isStudent = this.props.isStudent();
// TODO
//console.log(Commonheadofthetestpaper.exercise_status);
@ -353,7 +363,26 @@ class Testpapersettinghomepage extends Component{
<div className="stud-class-set bor-bottom-greyE ">
<div className=" clearfix edu-back-white pl30 pr30">
<div className="fl task_menu_ul">
{this.props.isAdmin()===true?
{isAssistant===true?
(
assistant_auth===true?
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}>
<Menu.Item key="0" className={"exercisesafonts"}>答题列表</Menu.Item>
<Menu.Item key="1" className={"exercisesafonts"}>统计结果</Menu.Item>
<Menu.Item key="2" className={"exercisesafonts"}>试卷预览</Menu.Item>
<Menu.Item key="3" className={"exercisesafonts"}>设置</Menu.Item>
</Menu>
:
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}>
<Menu.Item key="0" className={"exercisesafonts"}>答题列表</Menu.Item>
{Commonheadofthetestpaper&&Commonheadofthetestpaper.show_statistic===true?
Commonheadofthetestpaper && Commonheadofthetestpaper.exercise_status===3?
<Menu.Item key="1" className={"exercisesafonts"}>统计结果</Menu.Item>:"":""}
<Menu.Item key="3" className={"exercisesafonts"}>设置</Menu.Item>
</Menu>
)
:
this.props.isAdmin()===true?
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}>
<Menu.Item key="0" className={"exercisesafonts"}>答题列表</Menu.Item>
<Menu.Item key="1" className={"exercisesafonts"}>统计结果</Menu.Item>
@ -437,7 +466,23 @@ class Testpapersettinghomepage extends Component{
getsetdata={this.getsetdata}
></ImmediatelyPublish>
:"":""}
{isAdmin === true? <Link className="fr color-blue font-16 mt20 mr20" to={`/classrooms/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/edit`}>编辑试卷</Link>:""}
{/*const isAdminOrTeacher*/}
{/*assistant_auth===true*/}
{/**/}
{isAdmin === true?
(
isAssistant===true?
(
assistant_auth===true?
<Link className="fr color-blue font-16 mt20 mr20" to={`/classrooms/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/edit`}>编辑试卷</Link>
:
""
)
:
<Link className="fr color-blue font-16 mt20 mr20" to={`/classrooms/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/edit`}>编辑试卷</Link>
)
:""}
{isAdmin === false && this.props.current_user !== undefined?
Commonheadofthetestpaper&&Commonheadofthetestpaper.user_permission.current_status===2?
@ -461,22 +506,22 @@ class Testpapersettinghomepage extends Component{
/>
{
// 教师列表
parseInt(tab[0])==0 ? <Studentshavecompletedthelist {...this.props} {...this.state} triggerRef={this.bindRef} setcourse_groupysls={(value)=>this.setcourse_groupysls(value)} current_status = {this.state.current_status} Commonheadofthetestpaper={this.state.Commonheadofthetestpaper} yslstustate={[`${polls_status[Commonheadofthetestpaper && Commonheadofthetestpaper.exercise_status]}`]}></Studentshavecompletedthelist>:""
parseInt(tab[0])==0 ? <Studentshavecompletedthelist {...this.props} {...this.state} assistant_auth={assistant_auth} triggerRef={this.bindRef} setcourse_groupysls={(value)=>this.setcourse_groupysls(value)} current_status = {this.state.current_status} Commonheadofthetestpaper={this.state.Commonheadofthetestpaper} yslstustate={[`${polls_status[Commonheadofthetestpaper && Commonheadofthetestpaper.exercise_status]}`]}></Studentshavecompletedthelist>:""
}
{/*统计结果*/}
{
parseInt(tab[0])==1 ? <Exercisestatisticalresult {...this.props} {...this.state} triggerRef={this.bindRef}></Exercisestatisticalresult>:""
parseInt(tab[0])==1 ? <Exercisestatisticalresult {...this.props} {...this.state} assistant_auth={assistant_auth} triggerRef={this.bindRef}></Exercisestatisticalresult>:""
}
{
parseInt(tab[0])==2 ? <ExerciseDisplay {...this.props} {...this.state} triggerRef={this.bindRef}></ExerciseDisplay>:""
parseInt(tab[0])==2 ? <ExerciseDisplay {...this.props} {...this.state} assistant_auth={assistant_auth} triggerRef={this.bindRef}></ExerciseDisplay>:""
}
{
parseInt(tab[0])==3 ? <WrappedExercisesetting Commonheadofthetestpaper={this.state.Commonheadofthetestpaper} {...this.props} {...this.state} triggerRef={this.bindRef} Commonheadofthetestpapers={this.Commonheadofthetestpaper}></WrappedExercisesetting>:""
parseInt(tab[0])==3 ? <WrappedExercisesetting Commonheadofthetestpaper={this.state.Commonheadofthetestpaper} {...this.props} {...this.state} assistant_auth={assistant_auth} triggerRef={this.bindRef} Commonheadofthetestpapers={this.Commonheadofthetestpaper} assistantauthoritys={(bool)=>this.assistantauthoritys(bool)}></WrappedExercisesetting>:""
}
</div>
</div>

@ -276,6 +276,10 @@ export function TPMIndexHOC(WrappedComponent) {
isAdminOrTeacher = () => {
return this.state.coursedata&&this.state.coursedata.course_identity < 4
}
// 助教===4
isAssistant=()=>{
return this.state.coursedata&&this.state.coursedata.course_identity ===4
}
// 超管、运维、课堂管理、老师、助教0-4
isAdmin = () => {
return this.state.coursedata&&this.state.coursedata.course_identity < 5
@ -711,6 +715,7 @@ export function TPMIndexHOC(WrappedComponent) {
isAdmin: this.isAdmin,
isAdminOrTeacher: this.isAdminOrTeacher,
isAssistant:this.isAssistant,
isStudent: this.isStudent,
isAdminOrStudent: this.isAdminOrStudent,
isNotMember: this.isNotMember,

Loading…
Cancel
Save