1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import React, { useState, useEffect } from 'react';
  2. import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert, Card, Modal } from 'antd';
  3. import { FormattedMessage } from 'umi-plugin-react/locale';
  4. import router from 'umi/router';
  5. import apis from '../../../../services/apis';
  6. import request from '../../../../utils/request';
  7. import Wangedit from '../../../../components/Wangedit/Wangedit'
  8. import moment from 'moment';
  9. const { Meta } = Card
  10. const H5Card = props => {
  11. const { h5Data } = props
  12. const colerArr = ["#2db7f5", "#87d068", "#108ee9", "magenta", "red", "volcano", "orange", "green", "geekblue", "purple"]
  13. const toEdit = () => {
  14. router.push({
  15. pathname: '/sample/h5/edit',
  16. query: {
  17. id: h5Data.sampleId
  18. },
  19. });
  20. }
  21. const deleteSample = () => {
  22. const title = '确认将所选数据删除?可删除条件:无关联的H5需求单'
  23. Modal.confirm({
  24. title: title,
  25. okText: '确认',
  26. cancelText: '取消',
  27. onOk() {
  28. request({ ...apis.sample.puth5, urlData: { id: h5Data.sampleId } }).then((data) => {
  29. message.info('操作成功!')
  30. props.onChange()
  31. }).catch((err) => {
  32. console.log(err)
  33. message.info(err.msg || err.message)
  34. })
  35. }
  36. });
  37. }
  38. return (
  39. <>
  40. <Card
  41. hoverable
  42. style={{
  43. minWidth: '240px',
  44. marginRight: '0.1rem',
  45. height: '2.1rem',
  46. background: 'rgba(255, 255, 255, 1)',
  47. boxShadow: '0px 0px 16px 2px rgba(0, 0, 0, 0.12)',
  48. borderRadius: '12px',
  49. marginBottom: '0.1rem',
  50. position: 'relative',
  51. padding: '0.1rem'
  52. }}
  53. // style={{ width: 480,height: 450,marginTop: 50,position: "relative" }}
  54. cover={<img width="100%" style={{height:'1.3rem'}} alt="example" onClick={toEdit} src={h5Data.coverImg} />}
  55. extra={<a onClick={deleteSample}>删除</a>}
  56. title={h5Data.status == 1 ? '已发布' : h5Data.status == 0 ? '未发布' : ''}
  57. >
  58. <Meta onClick={toEdit} title={h5Data.sampleName} />
  59. <div style={{ position: "absolute", bottom: "50px", right: "20px", margin: '20px 0' }}>
  60. {(h5Data.tags || []).map((x, i) => {
  61. return <Tag color={colerArr[i]}>{x}</Tag>
  62. })}
  63. </div>
  64. </Card>
  65. </>
  66. )
  67. }
  68. export default H5Card