Commit 0b6f8a2e by zhujian

'fix'

parent 532c00df
...@@ -27,6 +27,8 @@ class GraphicsEditor extends React.Component { ...@@ -27,6 +27,8 @@ class GraphicsEditor extends React.Component {
this.bindClick(); this.bindClick();
} }
componentWillUnmount() { componentWillUnmount() {
this.resetIndex(); this.resetIndex();
this.removeBus(); this.removeBus();
......
...@@ -8,7 +8,9 @@ import Service from "@/common/js/service"; ...@@ -8,7 +8,9 @@ import Service from "@/common/js/service";
import _ from 'underscore' import _ from 'underscore'
import GraphicsEditor from '../../course-manage/components/GraphicsEditor'; import GraphicsEditor from '../../course-manage/components/GraphicsEditor';
import SelectPaperModal from './SelectPaperModal' import SelectPaperModal from './SelectPaperModal'
import PreviewModal from './PreviewModal'
import './AddExam.less'; import './AddExam.less';
import { get } from '_@types_jquery@3.5.5@@types/jquery';
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
...@@ -32,6 +34,8 @@ function AddExam(props: any) { ...@@ -32,6 +34,8 @@ function AddExam(props: any) {
const [passScore, setPassScore] = useState(100); const [passScore, setPassScore] = useState(100);
const [desclen, setDescLen] = useState(0); const [desclen, setDescLen] = useState(0);
const [check, setCheck] = useState(false); const [check, setCheck] = useState(false);
const [getData, setGetData] = useState(false);
const [preview, setPreview] = useState(false);
const timer = useRef({}); const timer = useRef({});
const request = useRef(false); const request = useRef(false);
const { match } = props; const { match } = props;
...@@ -82,6 +86,7 @@ function AddExam(props: any) { ...@@ -82,6 +86,7 @@ function AddExam(props: any) {
setPassScore(result.passScore) setPassScore(result.passScore)
setResultContent(result.resultContent) setResultContent(result.resultContent)
setResultShow(result.resultShow) setResultShow(result.resultShow)
setGetData(true)
}) })
} }
...@@ -221,6 +226,7 @@ function AddExam(props: any) { ...@@ -221,6 +226,7 @@ function AddExam(props: any) {
}) })
} }
return <div className="page examPage"> return <div className="page examPage">
<Breadcrumbs navList={props.type === 'edit' ? "编辑考试" : "新建考试"} goBack={handleGoBack} /> <Breadcrumbs navList={props.type === 'edit' ? "编辑考试" : "新建考试"} goBack={handleGoBack} />
...@@ -250,7 +256,7 @@ function AddExam(props: any) { ...@@ -250,7 +256,7 @@ function AddExam(props: any) {
<Button onClick={() => { setShowModal(true) }} >{paperInfo.paperId ? '重新选择' : '选择试卷'}</Button> <Button onClick={() => { setShowModal(true) }} >{paperInfo.paperId ? '重新选择' : '选择试卷'}</Button>
{ {
paperInfo.paperId && <div className="paperTitle"><img src="https://image.xiaomaiketang.com/xm/pY5imEhjzw.png" alt=""/> {paperInfo.paperName}</div> paperInfo.paperId && <div className="paperTitle"><img src="https://image.xiaomaiketang.com/xm/pY5imEhjzw.png" alt="" /> {paperInfo.paperName}</div>
} }
...@@ -338,14 +344,17 @@ function AddExam(props: any) { ...@@ -338,14 +344,17 @@ function AddExam(props: any) {
</Form.Item> </Form.Item>
<Form.Item label="考试说明" > <Form.Item label="考试说明" >
<GraphicsEditor {
maxLimit={1000} (getData || (props.type !== 'edit')) && <GraphicsEditor
isIntro={true} maxLimit={1000}
detail={{ isIntro={true}
content: examDesc detail={{
}} content: examDesc
onChange={(val: any, len: any) => { setExamDesc(val); setDescLen(len) }} }}
/> onChange={(val: any, len: any) => { setExamDesc(val); setDescLen(len) }}
/>
}
</Form.Item> </Form.Item>
<div className="title" style={{ marginTop: 40 }}>考试设置</div> <div className="title" style={{ marginTop: 40 }}>考试设置</div>
<Form.Item label="身份验证" required> <Form.Item label="身份验证" required>
...@@ -409,11 +418,12 @@ function AddExam(props: any) { ...@@ -409,11 +418,12 @@ function AddExam(props: any) {
} }
<div className="footer"> <div className="footer">
<Button onClick={handleGoBack}>取消</Button> <Button onClick={handleGoBack}>取消</Button>
<Button onClick={() => { }}>预览</Button> <Button onClick={() => { setPreview(true) }}>预览</Button>
<Button type="primary" onClick={handleSave}>保存</Button> <Button type="primary" onClick={handleSave}>保存</Button>
</div> </div>
{
preview && <PreviewModal onClose={() => { setPreview(false) }}></PreviewModal>
}
</div> </div>
} }
......
.ExamPreviewModal{
display: flex;
.left{
width: 460px;
background:url(https://image.xiaomaiketang.com/xm/PpKc6zYKCG.png) ;
height:746px ;
background-size: 100% 100%;
}
}
\ No newline at end of file
import React, { useState, useRef, useEffect, useContext } from 'react'
import { Input, Select, DatePicker, Tooltip, Button, Table, Dropdown, Menu, Modal } from 'antd';
import './PreviewModal.less'
function PreviewModal(props: any) {
return <Modal
title="预览"
onCancel={props.onClose}
onOk={props.onClose}
maskClosable={true}
visible={true}
footer={null}
closable={true}
width={800}
>
<div className="ExamPreviewModal">
<div className="left">
<div className="phone"></div>
</div>
<div className="right"></div>
</div>
</Modal>
}
export default PreviewModal
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment