index.tsx 1001 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import React, { useMemo } from 'react'
  2. import styles from './index.module.scss'
  3. import succImg from '@/assets/img/order/succ.png'
  4. import infoImg from '@/assets/img/order/info.png'
  5. // import errImg from '@/assets/img/order/err.png'
  6. type Props = {
  7. type: 'succ' | 'info' | 'err'
  8. callFu: () => void
  9. txt1?: string
  10. txt2?: string
  11. }
  12. function ZinfoPop({ type, callFu, txt1 = '预约成功', txt2 = '工作人员将尽快与您取得联系' }: Props) {
  13. const infoObj = useMemo(() => {
  14. let obj = {
  15. img: succImg,
  16. tit1: txt1,
  17. txt2: txt2
  18. }
  19. if (type === 'info') obj.img = infoImg
  20. return obj
  21. }, [txt1, txt2, type])
  22. return (
  23. <div id='openDom' className={styles.ZinfoPop}>
  24. <div className={`ZIbox ZI${type}`}>
  25. <img src={infoObj.img} alt='' />
  26. <h2>{infoObj.tit1}</h2>
  27. <p>{infoObj.txt2}</p>
  28. <div onClick={callFu}>确认</div>
  29. </div>
  30. </div>
  31. )
  32. }
  33. const MemoZinfoPop = React.memo(ZinfoPop)
  34. export default MemoZinfoPop