1 |
- {"version":3,"file":"index.js","sources":["../../src/components/Payment/WantedPublishModal/index.tsx"],"sourcesContent":["import React, { Component } from \"react\";\n\nimport Modal, { ModalProps } from \"../../Common/Modal\";\nimport WantedPublishView from \"../WantedPublishView\";\nimport styles from \"./WantedPublishModal.less\";\n\ninterface WantedPublishModalProps {\n modalConfig?: ModalProps;\n handleConfirm?: Function;\n}\n\ninterface WantedPublishModalState {\n modalVisible: boolean;\n current_wanted: number | string | null;\n}\n\nexport class WantedPublishModal extends Component<\n WantedPublishModalProps,\n WantedPublishModalState\n> {\n constructor(props: WantedPublishModalProps) {\n super(props);\n this.state = {\n modalVisible: false,\n current_wanted: null\n };\n }\n\n handleModalShow = () => {};\n\n handleClose = () => {\n const { handleConfirm } = this.props;\n if (handleConfirm) {\n this.handleUpdateCurrentWanted(\n this.state.current_wanted,\n (value: string) => {\n handleConfirm(Number(value).toFixed(2));\n }\n );\n }\n this.setState({ modalVisible: false });\n };\n\n handleUpdateCurrentWanted = (\n value: string | number | null,\n afterUpdate?: Function\n ) => {\n if (!value) return;\n let result: string | number;\n result = value;\n if (parseInt(`${value}`, 10) === value) {\n // 无小数判断\n result = Number(value);\n }\n if (!result) return;\n if (result > 10000) result = 10000;\n if (result < 5) result = 5;\n this.setState(\n { current_wanted: result },\n () => afterUpdate && afterUpdate(result)\n );\n };\n\n clearCurrentWanted = (cb: Function) => {\n this.setState(\n {\n current_wanted: null\n },\n () => cb()\n );\n };\n\n renderMain() {\n const { current_wanted } = this.state;\n return (\n <WantedPublishView\n wrapperClass={styles.modalBg}\n current_wanted={current_wanted}\n InputWantedValueChange={(v: string) =>\n this.setState({ current_wanted: v })\n }\n InputWantedPressEnter={(v: string) =>\n this.handleUpdateCurrentWanted(v, this.handleClose)\n }\n InputWantedOnBlur={(v: string) => this.handleUpdateCurrentWanted(v)}\n InputWantedClear={() => this.clearCurrentWanted(this.handleClose)}\n CloseFunction={this.handleClose}\n />\n );\n }\n\n render() {\n return (\n <>\n <div onClick={() => this.setState({ modalVisible: true })}>\n {this.props.children}\n </div>\n <Modal visible={this.state.modalVisible} onCancel={this.handleClose}>\n {this.renderMain()}\n </Modal>\n </>\n );\n }\n}\n\nexport default WantedPublishModal;\n"],"names":["WantedPublishModal","props","handleModalShow","handleClose","handleConfirm","_this","handleUpdateCurrentWanted","state","current_wanted","value","Number","toFixed","setState","modalVisible","afterUpdate","result","parseInt","clearCurrentWanted","cb","React","createElement","WantedPublishView","wrapperClass","styles","modalBg","InputWantedValueChange","v","_this2","InputWantedPressEnter","InputWantedOnBlur","InputWantedClear","CloseFunction","Fragment","onClick","_this3","children","Modal","visible","onCancel","renderMain","Component"],"mappings":";;;;;;;;;;;;;;;;;IAgBaA,kBAAb;AAAA;AAAA,oBAAA;;;8BAIcC,OAA8B;;;;;4FAClCA;;UAORC,kBAAkB,YAAK;;UAEvBC,cAAc,YAAK;UACTC,aADS,GACSC,MAAKJ,KAAL,CAAlBG;;UACJA,eAAe;cACZE,0BACHD,MAAKE,KAAL,CAAWC,gBACX,UAACC,KAAD,EAAkB;AAChBL,UAAAA,aAAa,CAACM,MAAM,CAACD,KAAD,CAAN,CAAcE,OAAd,CAAsB,CAAtB,CAAD,CAAb;AAHJ;;;YAOGC,SAAS;AAAEC,QAAAA,YAAY,EAAE;AAAhB;AAVhB;;UAaAP,4BAA4B,UAC1BG,KAD0B,EAE1BK,WAF0B,EAGxB;UACE,CAACL,OAAO;UACRM;AACJA,MAAAA,MAAM,GAAGN,KAAT;;UACIO,QAAQ,WAAIP,MAAJ,EAAa,EAAb,CAAR,KAA6BA,OAAO;AAEtCM,QAAAA,MAAM,GAAGL,MAAM,CAACD,KAAD,CAAf;;;UAEE,CAACM,QAAQ;UACTA,MAAM,GAAG,OAAOA,MAAM,GAAG,KAAT;UAChBA,MAAM,GAAG,GAAGA,MAAM,GAAG,CAAT;;YACXH,SACH;AAAEJ,QAAAA,cAAc,EAAEO;AAAlB,SACA;eAAMD,WAAW,IAAIA,WAAW,CAACC,MAAD;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