|
|
@@ -8,8 +8,7 @@ import { MessageFu } from '@/utils/message'
|
|
|
import { A5typeSelectType } from '../data'
|
|
|
import ZupOne from '@/components/ZupOne'
|
|
|
import MyPopconfirm from '@/components/MyPopconfirm'
|
|
|
-import ZupTypes from '@/components/ZupTypes'
|
|
|
-import TextArea from 'antd/es/input/TextArea'
|
|
|
+import ZRichTextOne from '@/components/ZRichTextOne'
|
|
|
|
|
|
type Props = {
|
|
|
txt: AddTxtType
|
|
|
@@ -32,8 +31,8 @@ function A5add({ txt, _id, closeFu, addTableFu, editTableFu }: Props) {
|
|
|
// 文档的ref
|
|
|
const ZupDocRef = useRef<any>(null)
|
|
|
|
|
|
- // 图片的ref
|
|
|
- const ZupImgRef = useRef<any>(null)
|
|
|
+ // 图片富文本的ref
|
|
|
+ const ZRichTextRef = useRef<any>(null)
|
|
|
|
|
|
const [type, setType] = useState('')
|
|
|
|
|
|
@@ -55,11 +54,8 @@ function A5add({ txt, _id, closeFu, addTableFu, editTableFu }: Props) {
|
|
|
compressedUrl: ''
|
|
|
})
|
|
|
} else if (type === '图片资料') {
|
|
|
- // 设置附件类型
|
|
|
- ZupImgRef.current?.setFileComFileFu({
|
|
|
- type: ['img'],
|
|
|
- fileList: infoRef.current.fileDetails || []
|
|
|
- })
|
|
|
+ // 设置富文本
|
|
|
+ ZRichTextRef.current?.ritxtShowFu(infoRef.current.imgTxt)
|
|
|
} else if (type === '档案文件') {
|
|
|
// 设置文档
|
|
|
ZupDocRef.current?.setFileComFileFu({
|
|
|
@@ -110,7 +106,8 @@ function A5add({ txt, _id, closeFu, addTableFu, editTableFu }: Props) {
|
|
|
let docUrl = ''
|
|
|
let docName = ''
|
|
|
|
|
|
- let fileIds = []
|
|
|
+ // 富文本
|
|
|
+ const rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
|
|
|
|
|
|
if (type === '视频素材') {
|
|
|
// 封面图
|
|
|
@@ -123,18 +120,6 @@ function A5add({ txt, _id, closeFu, addTableFu, editTableFu }: Props) {
|
|
|
if (!videoUrlObj.originalUrl) return MessageFu.warning('请上传视频')
|
|
|
videoUrl = videoUrlObj.originalUrl || ''
|
|
|
videoName = videoUrlObj.originalName || ''
|
|
|
- } else if (type === '图片资料') {
|
|
|
- // 文件类型
|
|
|
- const {
|
|
|
- sonIsOk,
|
|
|
- sonFileIds,
|
|
|
- cover: cover2,
|
|
|
- coverSmall: coverSmall2
|
|
|
- } = ZupImgRef.current?.fileComFileResFu()
|
|
|
- if (sonIsOk) return MessageFu.warning('请上传图片')
|
|
|
- cover = cover2
|
|
|
- coverSmall = coverSmall2
|
|
|
- fileIds = sonFileIds || []
|
|
|
} else if (type === '档案文件') {
|
|
|
const docUrlObj = ZupDocRef.current?.fileComFileResFu()
|
|
|
if (!docUrlObj.originalUrl) return MessageFu.warning('请上传文档')
|
|
|
@@ -152,7 +137,7 @@ function A5add({ txt, _id, closeFu, addTableFu, editTableFu }: Props) {
|
|
|
videoName,
|
|
|
docUrl,
|
|
|
docName,
|
|
|
- fileIds
|
|
|
+ imgTxt: rtf.val || ''
|
|
|
}
|
|
|
|
|
|
// if (1 + 1 === 2) {
|
|
|
@@ -176,168 +161,157 @@ function A5add({ txt, _id, closeFu, addTableFu, editTableFu }: Props) {
|
|
|
|
|
|
return (
|
|
|
<div className={styles.A5add}>
|
|
|
- <Form
|
|
|
- scrollToFirstError={true}
|
|
|
- ref={FormBoxRef}
|
|
|
- name='basic'
|
|
|
- onFinish={onFinish}
|
|
|
- onFinishFailed={onFinishFailed}
|
|
|
- autoComplete='off'
|
|
|
- >
|
|
|
- <Form.Item
|
|
|
- label='标题'
|
|
|
- name='name'
|
|
|
- rules={[{ required: true, message: '请输入标题' }]}
|
|
|
- getValueFromEvent={e => e.target.value.trim()}
|
|
|
+ <div className='A5main'>
|
|
|
+ <Form
|
|
|
+ scrollToFirstError={true}
|
|
|
+ ref={FormBoxRef}
|
|
|
+ name='basic'
|
|
|
+ onFinish={onFinish}
|
|
|
+ onFinishFailed={onFinishFailed}
|
|
|
+ autoComplete='off'
|
|
|
>
|
|
|
- <Input readOnly={txt === '查看'} maxLength={30} showCount placeholder='请输入内容' />
|
|
|
- </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label='标题'
|
|
|
+ name='name'
|
|
|
+ rules={[{ required: true, message: '请输入标题' }]}
|
|
|
+ getValueFromEvent={e => e.target.value.trim()}
|
|
|
+ >
|
|
|
+ <Input readOnly={txt === '查看'} maxLength={30} showCount placeholder='请输入内容' />
|
|
|
+ </Form.Item>
|
|
|
|
|
|
- <Form.Item
|
|
|
- label='发布日期'
|
|
|
- name='releaseDate'
|
|
|
- rules={[{ required: true, message: '请选择发布日期' }]}
|
|
|
- >
|
|
|
- <DatePicker disabled={txt === '查看'} allowClear={false} />
|
|
|
- </Form.Item>
|
|
|
-
|
|
|
- <Form.Item label='类别' name='type' rules={[{ required: true, message: '请选择类别' }]}>
|
|
|
- <Select
|
|
|
- value={type}
|
|
|
- onChange={e => setType(e)}
|
|
|
- disabled={txt === '查看'}
|
|
|
- style={{ width: 150 }}
|
|
|
- options={A5typeSelectType}
|
|
|
- placeholder='请选择'
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
-
|
|
|
- {type && type === '视频素材' ? (
|
|
|
- <div className='formBox'>
|
|
|
- <div className='formBoxll'>
|
|
|
- <span>* </span>封面:
|
|
|
- </div>
|
|
|
- <div className='formBoxrr'>
|
|
|
- <ZupOne
|
|
|
- ref={ZupThumbRef}
|
|
|
- isLook={txt === '查看'}
|
|
|
- fileCheck={fileCheck}
|
|
|
- myUrl='file/upload?upPath=A5share'
|
|
|
- format={['image/jpeg', 'image/png']}
|
|
|
- formatTxt='png、jpg和jpeg'
|
|
|
- checkTxt='请上传封面图'
|
|
|
- upTxt='最多1张'
|
|
|
- myType='thumb'
|
|
|
- size={5}
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- ) : null}
|
|
|
+ <Form.Item
|
|
|
+ label='发布日期'
|
|
|
+ name='releaseDate'
|
|
|
+ rules={[{ required: true, message: '请选择发布日期' }]}
|
|
|
+ >
|
|
|
+ <DatePicker disabled={txt === '查看'} allowClear={false} />
|
|
|
+ </Form.Item>
|
|
|
|
|
|
- {type === '视频素材' ? (
|
|
|
- <div className='formBox'>
|
|
|
- <div className='formBoxll'>
|
|
|
- <span>* </span>视频:
|
|
|
- </div>
|
|
|
- <div className='formBoxrr'>
|
|
|
- <ZupOne
|
|
|
- ref={ZupVideoRef}
|
|
|
- isLook={txt === '查看'}
|
|
|
- fileCheck={fileCheck}
|
|
|
- myUrl='file/upload?upPath=A5share'
|
|
|
- format={['video/mp4']}
|
|
|
- formatTxt='mp4'
|
|
|
- checkTxt='请上传视频'
|
|
|
- upTxt='最多1个'
|
|
|
- myType='video'
|
|
|
- size={500}
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- ) : null}
|
|
|
+ <Form.Item label='类别' name='type' rules={[{ required: true, message: '请选择类别' }]}>
|
|
|
+ <Select
|
|
|
+ value={type}
|
|
|
+ onChange={e => setType(e)}
|
|
|
+ disabled={txt === '查看'}
|
|
|
+ style={{ width: 150 }}
|
|
|
+ options={A5typeSelectType}
|
|
|
+ placeholder='请选择'
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
|
|
|
- {type === '图片资料' ? (
|
|
|
- <>
|
|
|
+ {type && type === '视频素材' ? (
|
|
|
<div className='formBox'>
|
|
|
<div className='formBoxll'>
|
|
|
- <span>* </span>图片:
|
|
|
+ <span>* </span>封面:
|
|
|
</div>
|
|
|
<div className='formBoxrr'>
|
|
|
- <ZupTypes
|
|
|
- ref={ZupImgRef}
|
|
|
- selecFlag='图片'
|
|
|
+ <ZupOne
|
|
|
+ ref={ZupThumbRef}
|
|
|
+ isLook={txt === '查看'}
|
|
|
fileCheck={fileCheck}
|
|
|
myUrl='file/upload?upPath=A5share'
|
|
|
+ format={['image/jpeg', 'image/png']}
|
|
|
+ formatTxt='png、jpg和jpeg'
|
|
|
+ checkTxt='请上传封面图'
|
|
|
+ upTxt='最多1张'
|
|
|
+ myType='thumb'
|
|
|
+ size={5}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
+
|
|
|
+ {type === '视频素材' ? (
|
|
|
+ <div className='formBox'>
|
|
|
+ <div className='formBoxll'>
|
|
|
+ <span>* </span>视频:
|
|
|
+ </div>
|
|
|
+ <div className='formBoxrr'>
|
|
|
+ <ZupOne
|
|
|
+ ref={ZupVideoRef}
|
|
|
isLook={txt === '查看'}
|
|
|
- imgLength={20}
|
|
|
- multipleImg={true}
|
|
|
- oneIsCover={true}
|
|
|
- isTypeShow={true}
|
|
|
+ fileCheck={fileCheck}
|
|
|
+ myUrl='file/upload?upPath=A5share'
|
|
|
+ format={['video/mp4']}
|
|
|
+ formatTxt='mp4'
|
|
|
+ checkTxt='请上传视频'
|
|
|
+ upTxt='最多1个'
|
|
|
+ myType='video'
|
|
|
+ size={500}
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <Form.Item label='图片介绍' name='imgTxt'>
|
|
|
- <TextArea
|
|
|
- readOnly={txt === '查看'}
|
|
|
- maxLength={200}
|
|
|
- showCount
|
|
|
- placeholder='请输入内容'
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </>
|
|
|
- ) : null}
|
|
|
+ ) : null}
|
|
|
+
|
|
|
+ {type === '图片资料' ? (
|
|
|
+ <>
|
|
|
+ <div className='formBox'>
|
|
|
+ <div className='formBoxll'>内容:</div>
|
|
|
+ <div className='formBoxrr'>
|
|
|
+ <ZRichTextOne
|
|
|
+ check={false}
|
|
|
+ myUrl='file/upload?upPath=A5share'
|
|
|
+ isLook={txt === '查看'}
|
|
|
+ ref={ZRichTextRef}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ ) : null}
|
|
|
|
|
|
- {type === '档案文件' ? (
|
|
|
- <div className='formBox'>
|
|
|
- <div className='formBoxll'>
|
|
|
- <span>* </span>文档:
|
|
|
+ {type === '档案文件' ? (
|
|
|
+ <div className='formBox'>
|
|
|
+ <div className='formBoxll'>
|
|
|
+ <span>* </span>文档:
|
|
|
+ </div>
|
|
|
+ <div className='formBoxrr'>
|
|
|
+ <ZupOne
|
|
|
+ ref={ZupDocRef}
|
|
|
+ isLook={txt === '查看'}
|
|
|
+ fileCheck={fileCheck}
|
|
|
+ myUrl='file/upload?upPath=A5share'
|
|
|
+ format={['video/mp4']}
|
|
|
+ formatTxt='pdf/doc/docx'
|
|
|
+ checkTxt='请上传文档'
|
|
|
+ upTxt='最多1个'
|
|
|
+ myType='pdf'
|
|
|
+ size={50}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div className='formBoxrr'>
|
|
|
- <ZupOne
|
|
|
- ref={ZupDocRef}
|
|
|
- isLook={txt === '查看'}
|
|
|
- fileCheck={fileCheck}
|
|
|
- myUrl='file/upload?upPath=A5share'
|
|
|
- format={['video/mp4']}
|
|
|
- formatTxt='pdf/doc/docx'
|
|
|
- checkTxt='请上传文档'
|
|
|
- upTxt='最多1个'
|
|
|
- myType='pdf'
|
|
|
- size={50}
|
|
|
- />
|
|
|
+ ) : null}
|
|
|
+
|
|
|
+ <div className='sortForm'>
|
|
|
+ <Form.Item
|
|
|
+ label='排序值'
|
|
|
+ name='sort'
|
|
|
+ initialValue={999}
|
|
|
+ rules={[{ required: true, message: '请输入排序值' }]}
|
|
|
+ >
|
|
|
+ <InputNumber readOnly={txt === '查看'} min={1} max={999} placeholder='请输入' />
|
|
|
+ </Form.Item>
|
|
|
+ <div className='fromRowTit'>
|
|
|
+ 请输入1~999的数字。数字越大,排序越靠前。数字相同时,更新发布的内容排在前面
|
|
|
</div>
|
|
|
</div>
|
|
|
- ) : null}
|
|
|
-
|
|
|
- <div className='sortForm'>
|
|
|
- <Form.Item
|
|
|
- label='排序值'
|
|
|
- name='sort'
|
|
|
- initialValue={999}
|
|
|
- rules={[{ required: true, message: '请输入排序值' }]}
|
|
|
- >
|
|
|
- <InputNumber readOnly={txt === '查看'} min={1} max={999} placeholder='请输入' />
|
|
|
- </Form.Item>
|
|
|
- <div className='fromRowTit'>
|
|
|
- 请输入1~999的数字。数字越大,排序越靠前。数字相同时,更新发布的内容排在前面
|
|
|
+ {/* 确定和取消按钮 */}
|
|
|
+ <div className='BtnForm'>
|
|
|
+ <Form.Item>
|
|
|
+ {txt === '查看' ? (
|
|
|
+ <Button onClick={closeFu}>返回</Button>
|
|
|
+ ) : (
|
|
|
+ <>
|
|
|
+ <Button type='primary' htmlType='submit'>
|
|
|
+ 提交
|
|
|
+ </Button>
|
|
|
+ <br />
|
|
|
+ <br />
|
|
|
+ <MyPopconfirm txtK='取消' onConfirm={closeFu} />
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ </Form.Item>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- {/* 确定和取消按钮 */}
|
|
|
- <div className='BtnForm'>
|
|
|
- <Form.Item>
|
|
|
- {txt === '查看' ? (
|
|
|
- <Button onClick={closeFu}>返回</Button>
|
|
|
- ) : (
|
|
|
- <>
|
|
|
- <Button type='primary' htmlType='submit'>
|
|
|
- 提交
|
|
|
- </Button>
|
|
|
- <MyPopconfirm txtK='取消' onConfirm={closeFu} />
|
|
|
- </>
|
|
|
- )}
|
|
|
- </Form.Item>
|
|
|
- </div>
|
|
|
- </Form>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
)
|
|
|
}
|