|
@@ -1,10 +1,9 @@
|
|
import React, { Component } from 'react';
|
|
import React, { Component } from 'react';
|
|
-import { Icon, message, Spin, Upload, Progress } from 'antd';
|
|
|
|
|
|
+import { Icon, message, Spin, Upload, Progress, Modal } from 'antd';
|
|
import './index.less';
|
|
import './index.less';
|
|
import Viewer from 'viewerjs';
|
|
import Viewer from 'viewerjs';
|
|
import 'viewerjs/dist/viewer.css';
|
|
import 'viewerjs/dist/viewer.css';
|
|
import PropTypes from 'prop-types';
|
|
import PropTypes from 'prop-types';
|
|
-// import PDFView from "../pdfupload";
|
|
|
|
import pdfimg from '../../../../image/pdf_logo.png';
|
|
import pdfimg from '../../../../image/pdf_logo.png';
|
|
|
|
|
|
const uploadButton = (
|
|
const uploadButton = (
|
|
@@ -151,15 +150,14 @@ class ImgList extends Component {
|
|
onPreview={(file) => {
|
|
onPreview={(file) => {
|
|
let types = file.name.substr(file.name.lastIndexOf(".") + 1)
|
|
let types = file.name.substr(file.name.lastIndexOf(".") + 1)
|
|
if (!!file.type && file.type.split('/')[0] == "application" || types == "pdf") {
|
|
if (!!file.type && file.type.split('/')[0] == "application" || types == "pdf") {
|
|
- // let url = file.url || file.thumbUrl
|
|
|
|
- // this.setState({
|
|
|
|
- // isPDF: true,
|
|
|
|
- // file: url,
|
|
|
|
- // })
|
|
|
|
let url = file.response.data.indexOf("/upload") == -1
|
|
let url = file.response.data.indexOf("/upload") == -1
|
|
? globalConfig.avatarHost + "/upload" + file.response.data
|
|
? globalConfig.avatarHost + "/upload" + file.response.data
|
|
: file.response.data
|
|
: file.response.data
|
|
- window.open(url)
|
|
|
|
|
|
+ this.setState({
|
|
|
|
+ isPDF: true,
|
|
|
|
+ file: url,
|
|
|
|
+ })
|
|
|
|
+ // window.open(url)
|
|
} else {
|
|
} else {
|
|
if (Object.keys(this.props.uploadConfig).length !== 0) {
|
|
if (Object.keys(this.props.uploadConfig).length !== 0) {
|
|
//TODO 上传组件,查看图片临时解决方法,无法查看下一张
|
|
//TODO 上传组件,查看图片临时解决方法,无法查看下一张
|
|
@@ -260,15 +258,26 @@ class ImgList extends Component {
|
|
/>
|
|
/>
|
|
<div className='promptText'>文件上传中...</div>
|
|
<div className='promptText'>文件上传中...</div>
|
|
</div> : <div />}
|
|
</div> : <div />}
|
|
- {/* {
|
|
|
|
|
|
+ {
|
|
|
|
+ // PDF文件预览弹窗
|
|
this.state.isPDF &&
|
|
this.state.isPDF &&
|
|
- <PDFView
|
|
|
|
- fileType="pdf"
|
|
|
|
|
|
+ <Modal
|
|
|
|
+ wrapClassName={"pdfmodal"}
|
|
visible={this.state.isPDF}
|
|
visible={this.state.isPDF}
|
|
- file={this.state.file}
|
|
|
|
- closeFile={() => { this.setState({ isPDF: false }) }}
|
|
|
|
- />
|
|
|
|
- } */}
|
|
|
|
|
|
+ className="admin-desc-content"
|
|
|
|
+ footer=""
|
|
|
|
+ title=""
|
|
|
|
+ width="1200px"
|
|
|
|
+ onCancel={() => {
|
|
|
|
+ this.setState({
|
|
|
|
+ isPDF: false,
|
|
|
|
+ file: "",
|
|
|
|
+ })
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <embed src={this.state.file} type="application/pdf" style={{ width: "100%", height: 700 }} />
|
|
|
|
+ </Modal>
|
|
|
|
+ }
|
|
</div>
|
|
</div>
|
|
)
|
|
)
|
|
}
|
|
}
|