picturesWall.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import React, { Component } from "react";
  2. import { Modal, Icon, Upload } from "antd";
  3. import { timingSafeEqual } from "crypto";
  4. import ImgList from "../../../../common/imgList";
  5. class PicturesWall extends Component {
  6. constructor(props) {
  7. super(props);
  8. this.state = {
  9. fileList: this.props.pictureUrl
  10. };
  11. this.handleChange = this.handleChange.bind(this);
  12. }
  13. handleChange(info) {
  14. let fileList = info.fileList;
  15. this.setState({
  16. fileList
  17. });
  18. this.props.fileList(fileList);
  19. }
  20. componentWillReceiveProps(nextProps) {
  21. this.state.fileList = nextProps.pictureUrl;
  22. }
  23. render() {
  24. const { fileList } = this.state;
  25. const { orderNo = undefined, bindId = undefined, deleteApi = "", sign = "" } = this.props
  26. return (
  27. <div style={{ display: "inline-block" }}>
  28. <ImgList
  29. deleteApi={deleteApi} // 删除图片接口
  30. orderNo={orderNo} // 用于订单上传绑定,不是订单上传不需要传
  31. bindId={bindId} // 绑定的编号
  32. sign={sign}
  33. domId={this.props.domId}
  34. uploadConfig={{
  35. action: globalConfig.context + this.props.url,
  36. data: {
  37. orderNo: orderNo,
  38. sign: this.props.sign,
  39. },
  40. multiple: true,
  41. listType: "picture-card",
  42. }}
  43. onChange={(infor) => {
  44. this.handleChange(infor)
  45. }}
  46. fileList={fileList}
  47. />
  48. </div>
  49. );
  50. }
  51. }
  52. export default PicturesWall;