Нема описа

1
  1. {"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\";\nimport { Input, Button, Popover, Tooltip } from \"antd\";\nimport { Modal } from \"@/components/Common/Modal/index.tsx\";\n\nimport CloseButtonIcon from \"../assets/icon/close.png\";\n\nimport styles from \"./AllocWantedModal.less\";\n\ninterface AllocWantedModalProps {\n allocValue: string | number | null;\n sendValueRange: Array<string | number>;\n sendRequest: Function;\n sendGiftData: {\n answerId: string | number;\n questionId: string | number;\n toUserId: string | number;\n };\n handleVisibleChange: (visible: boolean) => void;\n}\ninterface AllocWantedModalState {\n visible: boolean;\n outRangeTip: boolean;\n sendValue: string | number;\n}\n\nclass AllocWantedModal extends React.Component<\n AllocWantedModalProps,\n AllocWantedModalState\n> {\n ModalInputRef: RefObject<Input>;\n ModalContentRef: RefObject<any>;\n\n constructor(props: AllocWantedModalProps) {\n super(props);\n this.state = {\n visible: false,\n sendValue: 0,\n outRangeTip: false\n };\n this.ModalContentRef = React.createRef();\n this.ModalInputRef = React.createRef();\n }\n\n handleSendValueChange = (v: string | number) => {\n if (this.state.outRangeTip) {\n this.setState({\n outRangeTip: !this.checkSendValue()\n });\n }\n this.setState({\n sendValue: v\n });\n };\n\n checkSendValue = () => {\n const { sendValueRange } = this.props;\n const { sendValue } = this.state;\n let min = 0;\n let max = Number(this.props.allocValue);\n if (sendValueRange) {\n min = Number(sendValueRange[0]);\n max = Number(sendValueRange[1]);\n }\n if (sendValue > max) {\n this.setState({\n // sendValue: max,\n outRangeTip: true\n });\n return false;\n } else if (sendValue < min) {\n this.setState({\n // sendValue: max,\n outRangeTip: true\n });\n return false;\n }\n return true;\n };\n\n handleCloseAction = () => {\n this.setState(\n {\n visible: false,\n sendValue: 0,\n outRangeTip: false\n },\n () => {\n this.props.handleVisibleChange(false);\n }\n );\n };\n\n handleShowAction = () => {\n this.setState(\n {\n visible: true\n },\n () => {\n this.props.handleVisibleChange(true);\n }\n );\n };\n\n handleConfirm = () => {\n const { sendGiftData } = this.props;\n const checkResult = this.checkSendValue();\n if (!checkResult) {\n // 未通过验证\n return null;\n }\n // 进行分配请求\n Promise.resolve(\n this.props.sendRequest({\n business_type: 14, // 表示悬赏答案\n ref_id: sendGiftData.answerId.toString(), // 对应回答的id\n origin_id: sendGiftData.questionId, // 对应问题的id\n to_user: sendGiftData.toUserId, // 悬赏给谁\n goods_id: 2, // 礼物id 帮币的话为2\n num: Number(this.state.sendValue) // 礼物数量\n })\n ).then((res: any) => {\n if (res) {\n this.handleCloseAction();\n } else {\n this.handleCloseAction();\n }\n });\n };\n\n renderCloseButton = () => {\n return (\n <div\n role=\"button\"\n tabIndex={-1}\n className={styles.closeButton}\n onClick={() => {\n this.handleCloseAction();\n }}\n >\n <img src={CloseButtonIcon} alt=\"close button for send wanted\" />\n </div>\n );\n // return null;\n };\n\n renderModalContent = () => {\n return (\n <div className={styles.wantedModalContent} ref={this.ModalContentRef}>\n {this.renderCloseButton()}\n <h4 className={styles.title}>分配悬赏奖金</h4>\n <div\n className={styles.wantedValueText}\n >{`剩余可分配 ${this.props.allocValue}元`}</div>\n <Tooltip\n visible={this.state.outRangeTip}\n title=\"超过范围值\"\n placement=\"bottom\"\n overlayClassName={styles.outRangeTextTip}\n getTooltipContainer={() =>\n this.ModalContentRef && this.ModalContentRef.current\n }\n >\n <Input\n ref={this.ModalInputRef}\n className={styles.wantedInputNumber}\n suffix=\"元\"\n value={this.state.sendValue}\n onChange={e => this.handleSendValueChange(e.target.value)}\n onFocus={e =>\n e.target.setSelectionRange(0, String(this.state.sendValue).length)\n }\n />\n </Tooltip>\n <div className={styles.wantedValueTipBottom}>\n 需要在悬赏时间结束前将奖金分配完成, 否则将按照规则自动分配\n </div>\n <div className={styles.buttonRow}>\n <div className={styles.tipsButton} />\n <Button className={styles.confirmButton} onClick={this.handleConfirm}>\n 确认\n </Button>\n <div className={styles.tipsButton}>\n <Popover\n placement=\"bottom\"\n trigger=\"click\"\n getPopupContainer={() =>\n this.ModalContentRef && this.ModalContentRef.current\n }\n overlayStyle={{\n width: \"320px\"\n }}\n content={\n <div className={styles.tipsView}>\n <h6>1、如何参与悬赏?</h6>\n <div>\n 悬赏问题皆有有效期,默认为120小时(5天),在有效期内回复的答案,才有资格被选为最佳答案,以及分得赏金。\n </div>\n <h6>2、赏金如何分?</h6>\n <div>\n 悬赏时间结束前,提问者可随时选出最优答案,并对赏金进行分配,直至赏金被分完或时间到期为止。若悬赏时间到期,悬赏者仍未分配赏金,且回答数大于等于2,系统则默认将赏金平分给点赞数前3名的回答。\n </div>\n <h6>3、赏金能退款吗?</h6>\n <div>\n 赏金只会在以下2种情况进行退款:一、悬赏时间到期,回答数小于2,赏金将自动退还至提问者的钱包;二、悬赏时间到期,悬赏者未分配完赏金,系统自动将剩余的赏金退还至提问者的钱包。\n </div>\n </div>\n }\n >\n <i className=\"schedule schedule-icon_rewardtips\" />\n </Popover>\n </div>\n </div>\n </div>\n );\n };\n\n render() {\n const { children } = this.props;\n return (\n <>\n <div className={styles.wrapper} onClick={() => this.handleShowAction()}>\n {children}\n </div>\n <Modal\n visible={this.state.visible}\n onCancel={() => this.handleCloseAction()}\n >\n {this.renderModalContent()}\n </Modal>\n </>\n );\n }\n}\n\nexport default AllocWantedModal;\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","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;;;;;0FAChCA;;UAURC,wBAAwB,UAACC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