{"version":3,"file":"index.js","sources":["../../src/components/Payment/assets/icon/close.png","../../src/components/Payment/AllocWantedModal/index.tsx"],"sourcesContent":["const img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAACMUlEQVQ4T52Uz4tSURTHPxP9oCkKy0UuIqvZSAsrHHgLEaFSDCJoU0GpQaBgqOCmP6AWKrR5kIELNzZZUUQLlReFFowOboQK2oyLkgExsxqJoprixlx5yXs1dXbvnO/93HPPO+dM8WfbCuwANgNfgA/A0OzIlElgH3AIsBrEl4EXwEvguz4+CdsIHAV2/yVjEX4PVFez/SXXwzYAJ4GdawBJyWfggQTqYSKj/f8AklKR4V1gRcJ2rWY1Zvl8PqumaW8n4YFAwFqpVCb988BzCTsCzMiDDodjut1uX11YWGh4PJ470p/L5ZRIJHI+kUhcU1V1UXfRR+CWhF0ARPHHpqrqbCwWC7darXm32z2Xz+fdoVDobL1ef+z1eu8ZlOO2gIkeChrVKpPJHEylUhd7vd5rm822V9O0it/vf2hS16qAbQfOmBW+3W6HnU6nMhgMlux2+5XRaLRion0iYJuAsJGgWq2e8Pv9x5vN5lOXy6V0Op1XiqLkh8PhNwN9WdbsHLBFL6jVaqc8Hs+xYrE4FwwGnyWTyZl0On2p2+0uKopyo9/vf9XpfwA3JcwNHND/zUajcblUKpWj0WhT+qPRqD2bzUbi8fj1QqHwRgfrA/clbBtwGlgnBRaLZb3Rc0z8j4COfgJmgcP/MQEiw/LkbAqwGCmxMdZq7wDRKmI9/Tbo8ltk6NQ/2YTcAWrA+EeY7TPRewK4B5jWwcRB8Syxy5YmLzGD6XViQuSm/QSINjC0n/ltqZBTCKFgAAAAAElFTkSuQmCC\";\n export default img;","import React, { RefObject } from \"react\";\r\nimport { Input, Button, Popover, Tooltip } from \"antd\";\r\nimport { Modal } from \"@/components/Common/Modal/index.tsx\";\r\n\r\nimport CloseButtonIcon from \"../assets/icon/close.png\";\r\n\r\nimport styles from \"./AllocWantedModal.less\";\r\n\r\ninterface AllocWantedModalProps {\r\n allocValue: string | number | null;\r\n sendValueRange: Array;\r\n sendRequest: Function;\r\n sendGiftData: {\r\n answerId: string | number;\r\n questionId: string | number;\r\n toUserId: string | number;\r\n };\r\n handleVisibleChange: (visible: boolean) => void;\r\n}\r\ninterface AllocWantedModalState {\r\n visible: boolean;\r\n outRangeTip: boolean;\r\n sendValue: string | number;\r\n}\r\n\r\nclass AllocWantedModal extends React.Component<\r\n AllocWantedModalProps,\r\n AllocWantedModalState\r\n> {\r\n ModalInputRef: RefObject;\r\n ModalContentRef: RefObject;\r\n\r\n constructor(props: AllocWantedModalProps) {\r\n super(props);\r\n this.state = {\r\n visible: false,\r\n sendValue: 0,\r\n outRangeTip: false\r\n };\r\n this.ModalContentRef = React.createRef();\r\n this.ModalInputRef = React.createRef();\r\n }\r\n\r\n handleSendValueChange = (v: string | number) => {\r\n if (this.state.outRangeTip) {\r\n this.setState({\r\n outRangeTip: !this.checkSendValue()\r\n });\r\n }\r\n this.setState({\r\n sendValue: v\r\n });\r\n };\r\n\r\n checkSendValue = () => {\r\n const { sendValueRange } = this.props;\r\n const { sendValue } = this.state;\r\n let min = 0;\r\n let max = Number(this.props.allocValue);\r\n if (sendValueRange) {\r\n min = Number(sendValueRange[0]);\r\n max = Number(sendValueRange[1]);\r\n }\r\n if (sendValue > max) {\r\n this.setState({\r\n // sendValue: max,\r\n outRangeTip: true\r\n });\r\n return false;\r\n } else if (sendValue < min) {\r\n this.setState({\r\n // sendValue: max,\r\n outRangeTip: true\r\n });\r\n return false;\r\n }\r\n return true;\r\n };\r\n\r\n handleCloseAction = () => {\r\n this.setState(\r\n {\r\n visible: false,\r\n sendValue: 0,\r\n outRangeTip: false\r\n },\r\n () => {\r\n this.props.handleVisibleChange(false);\r\n }\r\n );\r\n };\r\n\r\n handleShowAction = () => {\r\n this.setState(\r\n {\r\n visible: true\r\n },\r\n () => {\r\n this.props.handleVisibleChange(true);\r\n }\r\n );\r\n };\r\n\r\n handleConfirm = () => {\r\n const { sendGiftData } = this.props;\r\n const checkResult = this.checkSendValue();\r\n if (!checkResult) {\r\n // 未通过验证\r\n return null;\r\n }\r\n // 进行分配请求\r\n Promise.resolve(\r\n this.props.sendRequest({\r\n business_type: 14, // 表示悬赏答案\r\n ref_id: sendGiftData.answerId.toString(), // 对应回答的id\r\n origin_id: sendGiftData.questionId, // 对应问题的id\r\n to_user: sendGiftData.toUserId, // 悬赏给谁\r\n goods_id: 2, // 礼物id 帮币的话为2\r\n num: Number(this.state.sendValue) // 礼物数量\r\n })\r\n ).then((res: any) => {\r\n console.log(\"res: \", res);\r\n if (res) {\r\n this.handleCloseAction();\r\n } else {\r\n this.handleCloseAction();\r\n }\r\n });\r\n };\r\n\r\n renderCloseButton = () => {\r\n return (\r\n {\r\n this.handleCloseAction();\r\n }}\r\n >\r\n \"close\r\n \r\n );\r\n // return null;\r\n };\r\n\r\n renderModalContent = () => {\r\n return (\r\n
\r\n {this.renderCloseButton()}\r\n

分配悬赏奖金

\r\n {`剩余可分配 ${this.props.allocValue}元`}
\r\n this.ModalContentRef && this.ModalContentRef.current}\r\n >\r\n this.handleSendValueChange(e.target.value)}\r\n onFocus={e =>\r\n e.target.setSelectionRange(0, String(this.state.sendValue).length)\r\n }\r\n />\r\n \r\n
\r\n 需要在悬赏时间结束前将奖金分配完成, 否则将按照规则自动分配\r\n
\r\n
\r\n
\r\n \r\n
\r\n this.ModalContentRef && this.ModalContentRef.current}\r\n overlayStyle={{\r\n width: \"320px\"\r\n }}\r\n content={\r\n
\r\n
1、如何参与悬赏?
\r\n
\r\n 悬赏问题皆有有效期,默认为120小时(5天),在有效期内回复的答案,才有资格被选为最佳答案,以及分得赏金。\r\n
\r\n
2、赏金如何分?
\r\n
\r\n 悬赏时间结束前,提问者可随时选出最优答案,并对赏金进行分配,直至赏金被分完或时间到期为止。若悬赏时间到期,悬赏者仍未分配赏金,且回答数大于等于2,系统则默认将赏金平分给点赞数前3名的回答。\r\n
\r\n
3、赏金能退款吗?
\r\n
\r\n 赏金只会在以下2种情况进行退款:一、悬赏时间到期,回答数小于2,赏金将自动退还至提问者的钱包;二、悬赏时间到期,悬赏者未分配完赏金,系统自动将剩余的赏金退还至提问者的钱包。\r\n
\r\n
\r\n }\r\n >\r\n \r\n \r\n
\r\n
\r\n
\r\n );\r\n };\r\n\r\n render() {\r\n const { children } = this.props;\r\n return (\r\n <>\r\n
this.handleShowAction()}>\r\n {children}\r\n
\r\n this.handleCloseAction()}\r\n >\r\n {this.renderModalContent()}\r\n \r\n \r\n );\r\n }\r\n}\r\n\r\nexport default AllocWantedModal;\r\n"],"names":["img","AllocWantedModal","props","handleSendValueChange","v","_this","state","outRangeTip","setState","checkSendValue","sendValue","sendValueRange","min","max","Number","allocValue","handleCloseAction","visible","handleVisibleChange","handleShowAction","handleConfirm","sendGiftData","checkResult","Promise","resolve","sendRequest","business_type","ref_id","answerId","toString","origin_id","questionId","to_user","toUserId","goods_id","num","then","res","console","log","renderCloseButton","React","createElement","role","tabIndex","className","styles","closeButton","onClick","src","CloseButtonIcon","alt","renderModalContent","wantedModalContent","ref","ModalContentRef","title","wantedValueText","Tooltip","placement","overlayClassName","outRangeTextTip","getTooltipContainer","current","Input","ModalInputRef","wantedInputNumber","suffix","value","onChange","e","target","onFocus","setSelectionRange","String","length","wantedValueTipBottom","buttonRow","tipsButton","Button","confirmButton","Popover","trigger","getPopupContainer","overlayStyle","width","content","tipsView","createRef","children","Fragment","wrapper","_this2","Modal","onCancel","Component"],"mappings":";;;;;;;;;;;;;;AAAA,IAAMA,GAAG,GAAG,g1BAAZ;;;;;;;;;;;;;;;;;;ICyBMC;;;;;4BAOQC,OAA4B;;;;;4GAChCA;;UAURC,wBAAwB,UAACC,CAAD,EAAuB;UACzCC,MAAKC,KAAL,CAAWC,aAAa;cACrBC,SAAS;AACZD,UAAAA,WAAW,EAAE,CAACF,MAAKI,cAAL;AADF;;;YAIXD,SAAS;AACZE,QAAAA,SAAS,EAAEN;AADC;AANhB;;UAWAK,iB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