diff --git a/src/components/CustomPages/SE/SE018EditPage.js b/src/components/CustomPages/SE/SE018EditPage.js index 1a684c4..06101d3 100644 --- a/src/components/CustomPages/SE/SE018EditPage.js +++ b/src/components/CustomPages/SE/SE018EditPage.js @@ -219,6 +219,7 @@ class SE018EditPage extends React.Component { }; render() { const { data, missUsers, leaveUsers } = this.state; + const enums = this.props.data.enums ? this.props.data.enums : this.props.app.enums; const signable = this.state.isView && data && data.STATUS == 1 && data.Nav_Users && data.Nav_Users.find(it => it.USER_ID === this.props.login.user.ID) && (this.props.data.tableKey == "1") return
@@ -262,7 +263,7 @@ class SE018EditPage extends React.Component { 培训类型 {data && data.Nav_Notify.Nav_TrainType ? data.Nav_Notify.Nav_TrainType.NAME : null} 培训级别 - {data && this.props.app.enums.FMDepartmentType.enums[data.Nav_Notify.LEVEL]} + {data && enums.FMDepartmentType.enums[data.Nav_Notify.LEVEL]} 组织部门 {data && data.Nav_Notify && data.Nav_Notify.Nav_LaunchDepartment ? data.Nav_Notify.Nav_LaunchDepartment.NAME : null} @@ -278,10 +279,10 @@ class SE018EditPage extends React.Component { 培训老师 {data && data.Nav_Notify ? data.Nav_Notify.TRAIN_TEACHER : null} 培训形式 - {data && this.returnModel(data.Nav_Notify.TRAIN_MODEL)} + {data&& data.Nav_Notify && data.Nav_Notify.TRAINTYPE && enums.TrainType.enums[data.Nav_Notify.TRAINTYPE]} 考核方式 {/* {data && data.Nav_Notify && data.Nav_Notify.Nav_TrainCheckType ? data.Nav_Notify.Nav_TrainCheckType.NAME : null} */} - {data && data.Nav_Notify && data.Nav_Notify.CHECKTYPE && this.props.app.enums.PlanCheckType.enums[data.Nav_Notify.CHECKTYPE]} + {data && data.Nav_Notify && data.Nav_Notify.CHECKTYPE && enums.PlanCheckType.enums[data.Nav_Notify.CHECKTYPE]} 培训内容 diff --git a/src/components/CustomPages/SE/SE018PaperPage.js b/src/components/CustomPages/SE/SE018PaperPage.js index 555312d..b9ba962 100644 --- a/src/components/CustomPages/SE/SE018PaperPage.js +++ b/src/components/CustomPages/SE/SE018PaperPage.js @@ -54,6 +54,16 @@ class SE018PaperPage extends React.Component { title: "", visible: false, }, + listViewInfo: [], + VIEWSEC: 0 + // { + // USER_ID: this.props.login.user.ID, + // RECORD_ID: null, + // TEXT_ID: null, + // EDU_CARD_ID: null, + // ISEND: false, + // VIEWSEC: null + // }] }; }; componentDidMount() { @@ -197,11 +207,17 @@ class SE018PaperPage extends React.Component { let notify = record ? record.Nav_Notify : null; let NAME = record.Nav_Notify.NAME; let hasAnswered = false; - for (let i = 0; i < ret.Nav_Papers.length; i++) { - if (ret.Nav_Papers[i].ANSWER !== 0) { - hasAnswered = true; - } - } + + // for (let i = 0; i < ret.Nav_Papers.length; i++) { + // if (ret.Nav_Papers[i].ANSWER !== 0) { + // hasAnswered = true; + // } + // } + var check = ret.Nav_Papers.filter(e => e.ANSWER == 0) + if (check != null || check.length > 0) + hasAnswered = false + else + hasAnswered = true var perPaper = [] if (isCourEdit == false) @@ -217,7 +233,8 @@ class SE018PaperPage extends React.Component { isCourEdit: isCourEdit, listPath: this.state.listPath, btnText: this.state.btnText, - STATUS_RECORD: STATUS_RECORD + STATUS_RECORD: STATUS_RECORD, + listViewInfo: ret.ListViewInfo }) if (isCourEdit == true) { this.onSave() @@ -306,33 +323,47 @@ class SE018PaperPage extends React.Component { } this.state.filepath = this.state.listPath[this.state.indexCour] var perPaper = this.state.papers.filter(e => e.FILE_PATH == this.state.filepath) - + var ISEND = true + var VIEWSEC = 0 + if (this.state.listViewInfo != null && this.state.listViewInfo.length > 0 && perPaper != null && perPaper.length > 0) { + var checkV = this.state.listViewInfo.filter(e => e.EDU_CARD_ID == perPaper[0].EDU_CARD_ID) + if (checkV != null && checkV.length > 0) { + ISEND = checkV[0].ISEND + VIEWSEC = checkV[0].VIEWSEC + } + } + if (this.state.filepath.indexOf('/VIDEO/') > -1) { this.state.isViedo = true - this.state.isVideoEnd = false this.state.filepath = configc.videoServerHost + this.state.filepath this.state.filepathf = [] + if (ISEND && VIEWSEC == 0) { + ISEND = false + } } else if (this.state.filepath.indexOf('.mp4') > -1 || this.state.filepath .indexOf('.avi') > -1) { //暂时不应该进来 this.state.isViedo = true - this.state.isVideoEnd = false + if (ISEND) { + ISEND = false + } + // this.state.isVideoEnd = false this.state.filepath = configc.picServerHost + this.state.filepath this.state.filepathf = [] } else { this.state.isViedo = false - this.state.isVideoEnd = true + // this.state.isVideoEnd = true this.state.filepath = this.state.filepath this.state.filepathf = getFileShow(this.state.filepath) } - this.setState({ indexCour: this.state.indexCour, btnText: this.state.btnText, perPaper: perPaper, filepath: this.state.filepath, isViedo: this.state.isViedo, - isVideoEnd: this.state.isVideoEnd, + isVideoEnd: ISEND,// this.state.isVideoEnd, + VIEWSEC: VIEWSEC, filepathf: this.state.filepathf, }) } @@ -466,19 +497,132 @@ class SE018PaperPage extends React.Component { return ret; } onEnd = () => { + var check = this.state.listViewInfo.filter(e => e.EDU_CARD_ID == this.state.perPaper[0].EDU_CARD_ID) + if (check == null || check.length < 1) { + this.state.listViewInfo.push({ + ID: guid(), + ORG_ID: this.state.perPaper[0].ORG_ID, + EDU_CARD_ID: this.state.perPaper[0].EDU_CARD_ID, + USER_ID: this.state.perPaper[0].USER_ID, + RECORD_ID: this.state.perPaper[0].RECORD_ID, + TEXT_ID: this.state.perPaper[0].TEXT_ID, + EDU_CARD_ID: this.state.perPaper[0].EDU_CARD_ID, + ISEND: true, + VIEWSEC: parseInt(this.videoRef.current.currentTime) + 1, + }) + } else { + this.state.listViewInfo.forEach(e => { + if (e.EDU_CARD_ID == this.state.perPaper[0].EDU_CARD_ID) { + e.ISEND = true + e.VIEWSEC = parseInt(this.videoRef.current.currentTime) + 1 + } + }); + } + this.setState({ - isVideoEnd: true + isVideoEnd: true, + listViewInfo: this.state.listViewInfo }) } + // TimeUpdate = () => { + // const currentTime = this.videoRef.current.currentTime; + // if (currentTime > this.lastTimeRef.current + 1) { + // this.videoRef.current.currentTime = this.lastTimeRef.current + // message.error(`禁止快进`); + // } else { + // this.lastTimeRef.current = currentTime + // } + // } + + TimeUpdate = () => { const currentTime = this.videoRef.current.currentTime; + if (Math.abs(this.videoRef.current.currentTime - this.state.VIEWSEC) < 1) { + // this.lastTimeRef = React.createRef(this.state.VIEWSEC); + this.lastTimeRef.current = this.state.VIEWSEC + } if (currentTime > this.lastTimeRef.current + 1) { - this.videoRef.current.currentTime = this.lastTimeRef.current - message.error(`禁止快进`); + if (this.state.isVideoEnd || this.videoRef.current.currentTime < this.state.VIEWSEC) { + //已看完 或者 观看时间大于当前拉的进度 + } else { + // this.videoRef.current.currentTime = (this.state.VIEWSEC > this.lastTimeRef.current ? this.state.VIEWSEC : this.lastTimeRef.current) + this.videoRef.current.currentTime = this.lastTimeRef.current + message.error(`禁止快进`); + } } else { this.lastTimeRef.current = currentTime } } + + //暂存 + onTempSave = () => { + if (this.state.readonly) { + return; + } + if (this.state.isViedo) { + var check = this.state.listViewInfo.filter(e => e.EDU_CARD_ID == this.state.perPaper[0].EDU_CARD_ID) + if (check == null || check.length < 1) { + this.state.listViewInfo.push({ + ID: guid(), + ORG_ID: this.state.perPaper[0].ORG_ID, + EDU_CARD_ID: this.state.perPaper[0].EDU_CARD_ID, + USER_ID: this.state.perPaper[0].USER_ID, + RECORD_ID: this.state.perPaper[0].RECORD_ID, + TEXT_ID: this.state.perPaper[0].TEXT_ID, + EDU_CARD_ID: this.state.perPaper[0].EDU_CARD_ID, + ISEND: false, + VIEWSEC: parseInt(this.videoRef.current.currentTime) - 1, + }) + } else if (!check.ISEND) { + this.state.listViewInfo.forEach(e => { + e.VIEWSEC = parseInt(this.videoRef.current.currentTime) - 1 + }) + } + } + // if (this.state.indexCour > -1) { + // let data = JSON.parse(JSON.stringify(this.state.perPaper)); + // var replaceModel = {} + // this.state.papers.forEach(e => { + // replaceModel = this.state.perPaper.filter(ep => e.ID == ep.ID) + // if (replaceModel != null) { + // e = replaceModel + // } + // }) + // } + let saveData = () => { + let data = { + Nav_Config: JSON.parse(JSON.stringify(this.state.config)), + Nav_Papers: JSON.parse(JSON.stringify(this.state.papers)), + TaskID: this.props.data.TaskID, + TEXT_ID: this.props.data.id, + ListViewInfo: this.state.listViewInfo + } + this.props.dispatch({ + type: 'app/getDataByPost', + payload: data, + url: 'SE/SETrainRecord/SavePapersTemp', + onComplete: (ret) => { + if (ret && ret.IsOperateSuccessful) { + message.success('执行成功'); + } else { + message.error('提交失败,请稍后重试'); + } + this.BtnClose(); + } + }); + } + Modal.confirm({ + title: '提示', + content: '确定暂存答题?', + onOk: () => { + saveData(); + }, + onCancel() { + }, + }) + + } + render() { const { record, perPaper, SelUsrID, UserList, notify, btnText, filepath, isViedo, isCourEdit, isVideoEnd, filepathf, STATUS_RECORD } = this.state; const SelUsr = SelUsrID && UserList.find(it => it.ID === SelUsrID); @@ -514,6 +658,11 @@ class SE018PaperPage extends React.Component { content={() => this.componentRef} /> + { + !this.state.readonly && ( + + ) + } { !this.state.readonly && (