Merge branches 'dev_Ysm' and 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysm

dev_hs
杨树明 5 years ago
commit c6485a8f14

@ -56,7 +56,11 @@ class CommonWorkAnswer extends Component{
}
componentDidMount() {
this.fetchData()
try {
this.props.triggerRef(this);
}catch (e) {
}
on('commonwork_fetch_all', this.fetchAllListener)
}
componentWillUnmount() {

@ -17,7 +17,7 @@ import PublishRightnow from './PublishRightnow'
import '../css/Courses.css'
import CBreadcrumb from '../common/CBreadcrumb'
import DownloadMessageysl from "../../modals/DownloadMessageysl";
import ConnectProject from './ConnectProject'
import { Spin } from 'antd'
//引入对应跳转的组件
@ -158,6 +158,30 @@ class CommonWorkDetailIndex extends Component{
}
bindRef = ref => { this.child = ref };
// 关联项目
openConnectionProject = (work) => {
this.refs['connectProject'].openConnectionProject(work)
}
connectSuccess = () => {
this.child.fetchData && this.child.fetchData()
}
cancelConnectionProject = (work) => {
let workId=this.props.match.params.workId;
let courseId=this.props.match.params.coursesId;
const url = `/homework_commons/${work.homework_id}/student_works/cancel_relate_project.json`
axios.get(url).then((response)=> {
if (response.data.status == 0) {
this.child.fetchData && this.child.fetchData()
this.props.showNotification('取消关联成功')
}
}).catch((error)=>{
console.log(error)
})
}
// 关联项目 END
render() {
let {course_name, homework_name, homework_status, noTab
@ -180,7 +204,8 @@ class CommonWorkDetailIndex extends Component{
const childModuleName = this.state.moduleName
const commonHandler = {
initWorkDetailCommonState: this.initWorkDetailCommonState
initWorkDetailCommonState: this.initWorkDetailCommonState,
triggerRef: this.bindRef
}
const isAdmin = this.props.isAdmin()
@ -191,7 +216,7 @@ class CommonWorkDetailIndex extends Component{
let params = {}
if (isListModule) {
// TODO
if(this.child!=undefined) {
if(this.child && this.child._getRequestParams) {
params = this.child._getRequestParams() !== undefined ? this.child._getRequestParams() : {};
}
}
@ -341,6 +366,20 @@ class CommonWorkDetailIndex extends Component{
{/*<a className={"fr color-blue font-16"}>项目在线质量检测</a>*/}
{isAdmin && <a className={"fr color-blue font-16"} onClick={() => this.props.toEditPage(this.props.match.params, workId)}>编辑作业</a>}
{ //
work_statuses && work_statuses.indexOf('关联项目') != -1 &&
<React.Fragment>
<ConnectProject ref="connectProject" {...this.props} connectSuccess={this.connectSuccess}></ConnectProject>
<WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.openConnectionProject({ homework_id: workId })}>关联项目</WordsBtn>
<WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.props.toCreateProject()}>创建项目</WordsBtn>
</React.Fragment>
}
{ //
work_statuses && work_statuses.indexOf('取消关联') != -1 &&
<WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.cancelConnectionProject( {homework_id: workId} )}>取消关联</WordsBtn>
}
{work_statuses && work_statuses.indexOf('提交作品') != -1 && <a className={"fr color-blue font-16"} href={"javascript:void(0)"}
onClick={() => { this.props.toWorkPostPage(this.props.match.params)}}
>提交作品</a>}

@ -38,10 +38,10 @@ function renderScore(score, content) {
function getScoreTip(score, dom) {
return score == '--' ? '未评分' : score == '**' ? '未公开' : dom
}
function buildColumns(that, student_works) {
function buildColumns(that, student_works, studentData) {
let gotWorkGroup = false;
let gotProjectInfo = false;
if (student_works) {
if (student_works && student_works.length) {
student_works.forEach(item => {
if (item.work_group) {
gotWorkGroup = true
@ -50,6 +50,13 @@ function buildColumns(that, student_works) {
gotProjectInfo = true;
}
})
} else if (studentData && studentData[0]) {
if (studentData[0].work_group) {
gotWorkGroup = true
}
if (studentData[0].project_info) {
gotProjectInfo = true;
}
}
let courseId= that.props.match.params.coursesId;
let workId= that.props.match.params.workId;
@ -431,6 +438,9 @@ class CommonWorkList extends Component{
group_id:arg_course_group,
}
}
fetchData = () => {
this.fetchList()
}
fetchList = () => {
let workId=this.props.match.params.workId;
let courseId=this.props.match.params.coursesId;
@ -542,7 +552,7 @@ class CommonWorkList extends Component{
late_penalty, absence_penalty, appeal_penalty
,end_immediately ,publish_immediately
, homework_id, visible
, homework_id, visible, work_group, project_info
} =this.state;
@ -566,7 +576,6 @@ class CommonWorkList extends Component{
return { label: `${item.name}(${item.count})`, value: item.id }
})
const columns = buildColumns(this, student_works)
const isAdmin = this.props.isAdmin()
const isStudent = this.props.isStudent()
@ -579,9 +588,11 @@ class CommonWorkList extends Component{
}else{
StudentData=isStudent ? [{ id, user_name, user_login, student_id, group_name, work_status, update_time, teacher_score, teaching_asistant_score, student_score,
ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count,
late_penalty, absence_penalty, appeal_penalty,
work_group: '', isMine: true }] : []
late_penalty, absence_penalty, appeal_penalty, project_info,
work_group, isMine: true }] : []
}
const columns = buildColumns(this, student_works, StudentData)
let params = this._getRequestParams()
let exportUrl = `/api/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}`;
const exportResultUrl = `/api/homework_commons/${workId}/works_list.xlsx`;

@ -55,7 +55,11 @@ class CommonWorkQuestion extends Component{
}
componentDidMount() {
this.fetchData()
try {
this.props.triggerRef(this);
}catch (e) {
}
on('commonwork_fetch_all', this.fetchAllListener)
}
componentWillUnmount() {

@ -77,7 +77,7 @@ class CommonWorkSetting extends Component{
}
}
getsettings=()=>{
fetchData=()=>{
let workId=this.props.match.params.workId;
const isAdmin = this.props.isAdmin()
const url = `/homework_commons/${workId}/settings.json`
@ -160,14 +160,19 @@ class CommonWorkSetting extends Component{
componentDidMount(){
this.getsettings();
this.fetchData();
try {
this.props.triggerRef(this);
}catch (e) {
}
on('commonwork_fetch_all', this.fetchAllListener)
}
componentWillUnmount() {
off('commonwork_fetch_all', this.fetchAllListener)
}
fetchAllListener = () => {
this.getsettings()
this.fetchData()
}
@ -477,7 +482,7 @@ class CommonWorkSetting extends Component{
// checkBoxValues:[],
// checkAllValue:false
// })
// this.getsettings();
// this.fetchData();
// }
// }).catch((error)=>{
@ -988,11 +993,11 @@ class CommonWorkSetting extends Component{
Saves={Saves}
course_groups={course_groups}
/> */}
<PublishRightnow ref={this.publishModal} showActionButton={false} {...this.props} checkBoxValues={[workId]} action={this.getsettings}
<PublishRightnow ref={this.publishModal} showActionButton={false} {...this.props} checkBoxValues={[workId]} action={this.fetchData}
isPublish={true} doWhenSuccess={this.doWhenSuccess} checkBeforePost={this.saveWorkSetting}
onToPublishClick={this.onToPublishClick}
></PublishRightnow>
<PublishRightnow ref={this.endModal} showActionButton={false} {...this.props} checkBoxValues={[workId]} action={this.getsettings}
<PublishRightnow ref={this.endModal} showActionButton={false} {...this.props} checkBoxValues={[workId]} action={this.fetchData}
isPublish={false} doWhenSuccess={this.doWhenSuccess}></PublishRightnow>
<style>{`

@ -322,14 +322,16 @@ class ExerciceNew extends Component{
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification('删除成功')
const { exercise_questions } = this.state
const index = this.findIndexById(question_id)
this.fetchExercise()
// const { exercise_questions } = this.state
// const index = this.findIndexById(question_id)
this.setState(
(prevState) => ({
exercise_questions : update(prevState.exercise_questions, {$splice: [[index, 1]]})
})
)
// this.setState(
// (prevState) => ({
// exercise_questions : update(prevState.exercise_questions, {$splice: [[index, 1]]})
// })
// )
}
})
.catch(function (error) {

@ -60,13 +60,11 @@ class SingleEditor extends Component{
}
const intScore = parseFloat(question_score)
if(!question_score || intScore == NaN) {
if (intScore == 0) {
this.props.showNotification('分值必须大于0'); return;
} else if(!question_score || intScore == NaN) {
this.props.showNotification('分值:不能为空'); return;
} else {
if (intScore == 0) {
this.props.showNotification('分值必须大于0'); return;
}
}
}
if(!answerArray || answerArray.length == 0) {
this.props.showNotification('必须设置标准答案'); return;
}
@ -217,7 +215,7 @@ class SingleEditor extends Component{
<div>
分值
<InputNumber step={0.1} precision={1} min={0.1} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
<InputNumber step={0.1} precision={1} min={0} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
disabled={exerciseIsPublish}
></InputNumber>

@ -51,13 +51,11 @@ class MainEditor extends Component{
}
const intScore = parseFloat(question_score)
if(!question_score || intScore == NaN) {
if (intScore == 0) {
this.props.showNotification('分值必须大于0'); return;
} else if(!question_score || intScore == NaN) {
this.props.showNotification('分值:不能为空'); return;
} else {
if (intScore == 0) {
this.props.showNotification('分值必须大于0'); return;
}
}
}
// if(!answerArray || answerArray.length == 0 || !answerArray[0]) {
// this.props.showNotification('请输入参考答案'); return;
// }
@ -168,7 +166,7 @@ class MainEditor extends Component{
<div className="mt10">
分值
<InputNumber step={0.1} precision={1} min={0.1} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
<InputNumber step={0.1} precision={1} min={0} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
disabled={exerciseIsPublish}
></InputNumber>

@ -74,13 +74,13 @@ class NullEditor extends Component{
}
const intScore = parseFloat(question_score)
if(!question_score || intScore == NaN) {
if (intScore == 0) {
this.props.showNotification('分值必须大于0'); return;
} else if(!question_score || intScore == NaN) {
this.props.showNotification('分值:不能为空'); return;
} else {
if (intScore == 0) {
this.props.showNotification('分值必须大于0'); return;
}
}
}
let isEmpty = false;
standard_answers.forEach((answers, index) => {
answerArray.push({
@ -340,7 +340,7 @@ class NullEditor extends Component{
</div>
<div className="clearfix mt20">
分值
<InputNumber step={0.1} precision={1} min={0.1} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
<InputNumber step={0.1} precision={1} min={0} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
disabled={exerciseIsPublish} placeholder="请填写分数"
></InputNumber >

@ -268,7 +268,7 @@ class ShixunEditor extends Component{
</div>
<div>
<InputNumber step={0.1} precision={1} min={0.1} max={100}
<InputNumber step={0.1} precision={1} min={0} max={100}
style={{width: 100}} value={question_scores[index]}
placeholder="请填写分数" disabled={exerciseIsPublish}
onChange={(e) => this.on_question_score_change(e, index)}></InputNumber>

@ -92,14 +92,13 @@ class SingleEditor extends Component{
}
const intScore = parseFloat(question_score)
if(!question_score || intScore == NaN) {
this.props.showNotification('分值不能为空'); return;
} else {
if (intScore == 0) {
this.props.showNotification('分值必须大于0'); return;
}
}
if (intScore == 0) {
this.props.showNotification('分值必须大于0'); return;
} else if(!question_score || intScore == NaN) {
this.props.showNotification('分值:不能为空'); return;
}
if(!answerArray || answerArray.length == 0) {
this.props.showNotification('请先点击选择本选择题的正确选项'); return;
}
@ -301,7 +300,7 @@ class SingleEditor extends Component{
<div>
分值
<InputNumber step={0.1} precision={1} min={0.1} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
<InputNumber step={0.1} precision={1} min={0} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
disabled={exerciseIsPublish}
></InputNumber>&nbsp;

@ -171,8 +171,8 @@ class TaskResultLayer extends Component {
<p className="inline inlines"><span className=" goldring"/>
{currentPassedGameGainGold >= 0 ? `+${currentPassedGameGainGold}` : '+0'}
</p>
<p className="inline exp">
<img src={empiricgreenImg} className=" mt5 fl"/>
<p className="inline inlines exp">
<img src={empiricgreenImg} className="mr8 mt5 fl"/>
{currentPassedGameGainExperience >= 0 ? `+${currentPassedGameGainExperience}` : '+0'}
</p>
</div>

@ -435,7 +435,7 @@ function VideoUploadList (props) {
</div>
{/* windows video/* 不管用 TODO */}
<input type="file" id="fileUpload" style={{display: 'none'}} onChange={onUploadChange}
accept=".flv, .f4v, .rmvb, .swf, video/mp4,video/x-m4v,video/flv,video/f4v,video/rmvb,video/swf,video/*"
accept=".mkv, .flv, .f4v, .rmvb, .swf, video/mp4,video/x-m4v,video/flv,video/f4v,video/rmvb,video/swf,video/*"
></input>
</div>
)

Loading…
Cancel
Save