| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 | import React, { Component } from "react";import { Modal, Icon, Upload } from "antd";import { timingSafeEqual } from "crypto";class PicturesWall extends Component {  constructor(props) {    super(props);    this.state = {      previewVisible: false,      previewImage: "",      fileList: this.props.pictureUrl,    };    this.handleCancel = this.handleCancel.bind(this);    this.handleChange = this.handleChange.bind(this);    this.handlePreview = this.handlePreview.bind(this);  }  handleCancel() {    this.setState({      previewVisible: false,    });  }  handlePreview(file) {    this.setState({      previewImage: file.url || file.thumbUrl,      previewVisible: true,    });  }  handleChange(info) {    let fileList = info.fileList;    this.setState({      fileList,    });    this.props.fileList(fileList);  }  componentWillReceiveProps(nextProps) {    this.state.fileList = nextProps.pictureUrl;    this.state.pojectApplicationUrl = undefined;  }  render() {    const { previewVisible, previewImage, fileList } = this.state;    const uploadButton = (      <div>        <Icon type="plus" />        <div className="ant-upload-text">点击上传</div>      </div>    );    return (      <div style={{ display: "inline-block" }}>        <Upload          action={globalConfig.context + this.props.url}          data={{ sign: this.props.sign }}          listType="picture-card"          fileList={fileList}          onPreview={this.handlePreview}          onChange={this.handleChange}        >          {fileList.length >= 1 ? null : uploadButton}        </Upload>        <Modal          maskClosable={false}          visible={previewVisible}          footer={null}          onCancel={this.handleCancel}        >          <img alt="example" style={{ width: "100%" }} src={previewImage} />        </Modal>      </div>    );  }}export default PicturesWall;
 |