培训类型 显示

考试 暂存
播放时间记忆
This commit is contained in:
wyw 2026-04-02 09:22:22 +08:00
parent 57fa6c09d5
commit fef5ced63e
2 changed files with 168 additions and 18 deletions

View File

@ -219,6 +219,7 @@ class SE018EditPage extends React.Component {
}; };
render() { render() {
const { data, missUsers, leaveUsers } = this.state; 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") 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 <div> return <div>
<div> <div>
@ -262,7 +263,7 @@ class SE018EditPage extends React.Component {
<td colSpan={4} rowSpan={1} className={styles.fontBold}>培训类型</td> <td colSpan={4} rowSpan={1} className={styles.fontBold}>培训类型</td>
<td colSpan={4} rowSpan={1} >{data && data.Nav_Notify.Nav_TrainType ? data.Nav_Notify.Nav_TrainType.NAME : null}</td> <td colSpan={4} rowSpan={1} >{data && data.Nav_Notify.Nav_TrainType ? data.Nav_Notify.Nav_TrainType.NAME : null}</td>
<td colSpan={4} rowSpan={1} className={styles.fontBold}>培训级别</td> <td colSpan={4} rowSpan={1} className={styles.fontBold}>培训级别</td>
<td colSpan={4} rowSpan={1} >{data && this.props.app.enums.FMDepartmentType.enums[data.Nav_Notify.LEVEL]}</td> <td colSpan={4} rowSpan={1} >{data && enums.FMDepartmentType.enums[data.Nav_Notify.LEVEL]}</td>
<td colSpan={4} rowSpan={1} className={styles.fontBold}>组织部门</td> <td colSpan={4} rowSpan={1} className={styles.fontBold}>组织部门</td>
<td colSpan={4} rowSpan={1} >{data && data.Nav_Notify && data.Nav_Notify.Nav_LaunchDepartment ? data.Nav_Notify.Nav_LaunchDepartment.NAME : null}</td> <td colSpan={4} rowSpan={1} >{data && data.Nav_Notify && data.Nav_Notify.Nav_LaunchDepartment ? data.Nav_Notify.Nav_LaunchDepartment.NAME : null}</td>
</tr> </tr>
@ -278,10 +279,10 @@ class SE018EditPage extends React.Component {
<td colSpan={4} rowSpan={1} className={styles.fontBold}>培训老师</td> <td colSpan={4} rowSpan={1} className={styles.fontBold}>培训老师</td>
<td colSpan={4} rowSpan={1} >{data && data.Nav_Notify ? data.Nav_Notify.TRAIN_TEACHER : null}</td> <td colSpan={4} rowSpan={1} >{data && data.Nav_Notify ? data.Nav_Notify.TRAIN_TEACHER : null}</td>
<td colSpan={4} rowSpan={1} className={styles.fontBold}>培训形式</td> <td colSpan={4} rowSpan={1} className={styles.fontBold}>培训形式</td>
<td colSpan={4} rowSpan={1} >{data && this.returnModel(data.Nav_Notify.TRAIN_MODEL)}</td> <td colSpan={4} rowSpan={1} >{data&& data.Nav_Notify && data.Nav_Notify.TRAINTYPE && enums.TrainType.enums[data.Nav_Notify.TRAINTYPE]}</td>
<td colSpan={4} rowSpan={1} className={styles.fontBold}>考核方式</td> <td colSpan={4} rowSpan={1} className={styles.fontBold}>考核方式</td>
{/* <td colSpan={4} rowSpan={1} >{data && data.Nav_Notify && data.Nav_Notify.Nav_TrainCheckType ? data.Nav_Notify.Nav_TrainCheckType.NAME : null}</td> */} {/* <td colSpan={4} rowSpan={1} >{data && data.Nav_Notify && data.Nav_Notify.Nav_TrainCheckType ? data.Nav_Notify.Nav_TrainCheckType.NAME : null}</td> */}
<td colSpan={4} rowSpan={1} >{data && data.Nav_Notify && data.Nav_Notify.CHECKTYPE && this.props.app.enums.PlanCheckType.enums[data.Nav_Notify.CHECKTYPE]}</td> <td colSpan={4} rowSpan={1} >{data && data.Nav_Notify && data.Nav_Notify.CHECKTYPE && enums.PlanCheckType.enums[data.Nav_Notify.CHECKTYPE]}</td>
</tr> </tr>
<tr> <tr>
<td colSpan={4} rowSpan={1} className={styles.fontBold}>培训内容</td> <td colSpan={4} rowSpan={1} className={styles.fontBold}>培训内容</td>

View File

@ -54,6 +54,16 @@ class SE018PaperPage extends React.Component {
title: "", title: "",
visible: false, 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() { componentDidMount() {
@ -197,11 +207,17 @@ class SE018PaperPage extends React.Component {
let notify = record ? record.Nav_Notify : null; let notify = record ? record.Nav_Notify : null;
let NAME = record.Nav_Notify.NAME; let NAME = record.Nav_Notify.NAME;
let hasAnswered = false; let hasAnswered = false;
for (let i = 0; i < ret.Nav_Papers.length; i++) {
if (ret.Nav_Papers[i].ANSWER !== 0) { // for (let i = 0; i < ret.Nav_Papers.length; i++) {
hasAnswered = true; // 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 = [] var perPaper = []
if (isCourEdit == false) if (isCourEdit == false)
@ -217,7 +233,8 @@ class SE018PaperPage extends React.Component {
isCourEdit: isCourEdit, isCourEdit: isCourEdit,
listPath: this.state.listPath, listPath: this.state.listPath,
btnText: this.state.btnText, btnText: this.state.btnText,
STATUS_RECORD: STATUS_RECORD STATUS_RECORD: STATUS_RECORD,
listViewInfo: ret.ListViewInfo
}) })
if (isCourEdit == true) { if (isCourEdit == true) {
this.onSave() this.onSave()
@ -306,33 +323,47 @@ class SE018PaperPage extends React.Component {
} }
this.state.filepath = this.state.listPath[this.state.indexCour] this.state.filepath = this.state.listPath[this.state.indexCour]
var perPaper = this.state.papers.filter(e => e.FILE_PATH == this.state.filepath) 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) { if (this.state.filepath.indexOf('/VIDEO/') > -1) {
this.state.isViedo = true this.state.isViedo = true
this.state.isVideoEnd = false
this.state.filepath = configc.videoServerHost + this.state.filepath this.state.filepath = configc.videoServerHost + this.state.filepath
this.state.filepathf = [] this.state.filepathf = []
if (ISEND && VIEWSEC == 0) {
ISEND = false
}
} else if (this.state.filepath.indexOf('.mp4') > -1 || this.state.filepath } else if (this.state.filepath.indexOf('.mp4') > -1 || this.state.filepath
.indexOf('.avi') > -1) { .indexOf('.avi') > -1) {
//暂时不应该进来 //暂时不应该进来
this.state.isViedo = true 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.filepath = configc.picServerHost + this.state.filepath
this.state.filepathf = [] this.state.filepathf = []
} else { } else {
this.state.isViedo = false this.state.isViedo = false
this.state.isVideoEnd = true // this.state.isVideoEnd = true
this.state.filepath = this.state.filepath this.state.filepath = this.state.filepath
this.state.filepathf = getFileShow(this.state.filepath) this.state.filepathf = getFileShow(this.state.filepath)
} }
this.setState({ this.setState({
indexCour: this.state.indexCour, indexCour: this.state.indexCour,
btnText: this.state.btnText, btnText: this.state.btnText,
perPaper: perPaper, perPaper: perPaper,
filepath: this.state.filepath, filepath: this.state.filepath,
isViedo: this.state.isViedo, isViedo: this.state.isViedo,
isVideoEnd: this.state.isVideoEnd, isVideoEnd: ISEND,// this.state.isVideoEnd,
VIEWSEC: VIEWSEC,
filepathf: this.state.filepathf, filepathf: this.state.filepathf,
}) })
} }
@ -466,19 +497,132 @@ class SE018PaperPage extends React.Component {
return ret; return ret;
} }
onEnd = () => { 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({ 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 = () => { TimeUpdate = () => {
const currentTime = this.videoRef.current.currentTime; 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) { if (currentTime > this.lastTimeRef.current + 1) {
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 this.videoRef.current.currentTime = this.lastTimeRef.current
message.error(`禁止快进`); message.error(`禁止快进`);
}
} else { } else {
this.lastTimeRef.current = currentTime 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() { render() {
const { record, perPaper, SelUsrID, UserList, notify, btnText, filepath, isViedo, isCourEdit, isVideoEnd, filepathf, STATUS_RECORD } = this.state; 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); const SelUsr = SelUsrID && UserList.find(it => it.ID === SelUsrID);
@ -514,6 +658,11 @@ class SE018PaperPage extends React.Component {
content={() => this.componentRef} content={() => this.componentRef}
/> />
<Button style={{ marginLeft: '8px' }} onClick={() => this.onTableBtnExport()} icon="export" >导出</Button> <Button style={{ marginLeft: '8px' }} onClick={() => this.onTableBtnExport()} icon="export" >导出</Button>
{
!this.state.readonly && (
<Button type="primary" style={{ marginLeft: '8px' }} onClick={() => { this.onTempSave(); }}>暂存</Button>
)
}
{ {
!this.state.readonly && ( !this.state.readonly && (
<Button type="primary" style={{ marginLeft: '8px' }} onClick={() => { this.onSave(); }}>{btnText}</Button> <Button type="primary" style={{ marginLeft: '8px' }} onClick={() => { this.onSave(); }}>{btnText}</Button>