No Description

index.js 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. import {
  2. a as _inherits,
  3. b as _classCallCheck,
  4. c as _possibleConstructorReturn,
  5. d as _getPrototypeOf,
  6. e as _createClass
  7. } from "../inherits-6cb67931.js";
  8. import React from "react";
  9. import "react-dom";
  10. import { Modal } from "../Modal/index.js";
  11. import { s as styleInject } from "../style-inject.es-1f59c1d0.js";
  12. import { Tooltip, Input, Button, Popover } from "antd";
  13. var img =
  14. "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";
  15. var css =
  16. ".AllocWantedModal_wantedModalContent__1VodF {\n background-color: white;\n width: 360px;\n height: 314px;\n padding: 22px 28px;\n border-radius: 7px;\n}\n.AllocWantedModal_wantedModalContent__1VodF .AllocWantedModal_title__31i9F {\n font-size: 18px;\n font-weight: 400;\n text-align: center;\n}\n.AllocWantedModal_wantedModalContent__1VodF .AllocWantedModal_wantedValueText___uNQe {\n color: #565656;\n margin-top: 48px;\n font-size: 14px;\n line-height: 20px;\n text-align: center;\n}\n.AllocWantedModal_wantedModalContent__1VodF .AllocWantedModal_wantedInputNumber__3MyO5 {\n margin: 11px auto;\n text-align: center;\n}\n.AllocWantedModal_wantedModalContent__1VodF .AllocWantedModal_wantedInputNumber__3MyO5 .ant-input {\n color: #FB4B56;\n}\n.AllocWantedModal_wantedModalContent__1VodF .AllocWantedModal_wantedValueTipBottom__3WBt0 {\n margin: 0 auto;\n font-size: 12px;\n text-align: center;\n width: 208px;\n color: #9B9B9B;\n}\n.AllocWantedModal_wantedModalContent__1VodF .AllocWantedModal_buttonRow__FegZX {\n display: flex;\n justify-content: center;\n align-items: center;\n margin-top: 23px;\n}\n.AllocWantedModal_wantedModalContent__1VodF .AllocWantedModal_buttonRow__FegZX .AllocWantedModal_confirmButton__1yXDN {\n color: white;\n background-color: #71C135;\n width: 170px;\n height: 36px;\n}\n.AllocWantedModal_wantedModalContent__1VodF .AllocWantedModal_buttonRow__FegZX .AllocWantedModal_confirmButton__1yXDN:hover,\n.AllocWantedModal_wantedModalContent__1VodF .AllocWantedModal_buttonRow__FegZX .AllocWantedModal_confirmButton__1yXDN:focus {\n outline: none;\n border-color: #8cd158;\n}\n.AllocWantedModal_wantedModalContent__1VodF .AllocWantedModal_buttonRow__FegZX .AllocWantedModal_tipsButton__UmFpw {\n margin-left: 22px;\n width: 20px;\n}\n.AllocWantedModal_wantedModalContent__1VodF .AllocWantedModal_buttonRow__FegZX .AllocWantedModal_tipsButton__UmFpw .schedule {\n font-size: 18px;\n cursor: pointer;\n}\n.AllocWantedModal_closeButton__1d4p- {\n position: absolute;\n right: 10px;\n top: 10px;\n display: block;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n cursor: pointer;\n}\n.AllocWantedModal_closeButton__1d4p- img {\n width: 100%;\n height: 100%;\n}\n.AllocWantedModal_tipsView__3my0J h6 {\n margin: 0;\n font-size: 12px;\n line-height: 22px;\n color: #3D3D3D;\n}\n.AllocWantedModal_tipsView__3my0J div {\n font-size: 12px;\n}\n.AllocWantedModal_outRangeTextTip__3R4mw .ant-tooltip-inner {\n color: red;\n}\n";
  17. var styles = {
  18. wantedModalContent: "AllocWantedModal_wantedModalContent__1VodF",
  19. title: "AllocWantedModal_title__31i9F",
  20. wantedValueText: "AllocWantedModal_wantedValueText___uNQe",
  21. wantedInputNumber: "AllocWantedModal_wantedInputNumber__3MyO5",
  22. wantedValueTipBottom: "AllocWantedModal_wantedValueTipBottom__3WBt0",
  23. buttonRow: "AllocWantedModal_buttonRow__FegZX",
  24. confirmButton: "AllocWantedModal_confirmButton__1yXDN",
  25. tipsButton: "AllocWantedModal_tipsButton__UmFpw",
  26. closeButton: "AllocWantedModal_closeButton__1d4p-",
  27. tipsView: "AllocWantedModal_tipsView__3my0J",
  28. outRangeTextTip: "AllocWantedModal_outRangeTextTip__3R4mw"
  29. };
  30. styleInject(css);
  31. var AllocWantedModal =
  32. /*#__PURE__*/
  33. (function(_React$Component) {
  34. _inherits(AllocWantedModal, _React$Component);
  35. function AllocWantedModal(props) {
  36. var _this;
  37. _classCallCheck(this, AllocWantedModal);
  38. _this = _possibleConstructorReturn(
  39. this,
  40. _getPrototypeOf(AllocWantedModal).call(this, props)
  41. );
  42. _this.handleSendValueChange = function(v) {
  43. if (_this.state.outRangeTip) {
  44. _this.setState({
  45. outRangeTip: !_this.checkSendValue()
  46. });
  47. }
  48. _this.setState({
  49. sendValue: v
  50. });
  51. };
  52. _this.checkSendValue = function() {
  53. var sendValueRange = _this.props.sendValueRange;
  54. var sendValue = _this.state.sendValue;
  55. var min = 0;
  56. var max = Number(_this.props.allocValue);
  57. if (sendValueRange) {
  58. min = Number(sendValueRange[0]);
  59. max = Number(sendValueRange[1]);
  60. }
  61. if (sendValue > max) {
  62. _this.setState({
  63. outRangeTip: true
  64. });
  65. return false;
  66. } else if (sendValue < min) {
  67. _this.setState({
  68. outRangeTip: true
  69. });
  70. return false;
  71. }
  72. return true;
  73. };
  74. _this.handleCloseAction = function() {
  75. _this.setState(
  76. {
  77. visible: false,
  78. sendValue: 0,
  79. outRangeTip: false
  80. },
  81. function() {
  82. _this.props.handleVisibleChange(false);
  83. }
  84. );
  85. };
  86. _this.handleShowAction = function() {
  87. _this.setState(
  88. {
  89. visible: true
  90. },
  91. function() {
  92. _this.props.handleVisibleChange(true);
  93. }
  94. );
  95. };
  96. _this.handleConfirm = function() {
  97. var sendGiftData = _this.props.sendGiftData;
  98. var checkResult = _this.checkSendValue();
  99. if (!checkResult) {
  100. return null;
  101. }
  102. Promise.resolve(
  103. _this.props.sendRequest({
  104. business_type: 14,
  105. ref_id: sendGiftData.answerId.toString(),
  106. origin_id: sendGiftData.questionId,
  107. to_user: sendGiftData.toUserId,
  108. goods_id: 2,
  109. num: Number(_this.state.sendValue)
  110. })
  111. ).then(function(res) {
  112. console.log("res: ", res);
  113. if (res) {
  114. _this.handleCloseAction();
  115. } else {
  116. _this.handleCloseAction();
  117. }
  118. });
  119. };
  120. _this.renderCloseButton = function() {
  121. return React.createElement(
  122. "div",
  123. {
  124. role: "button",
  125. tabIndex: -1,
  126. className: styles.closeButton,
  127. onClick: function onClick() {
  128. _this.handleCloseAction();
  129. }
  130. },
  131. React.createElement("img", {
  132. src: img,
  133. alt: "close button for send wanted"
  134. })
  135. );
  136. };
  137. _this.renderModalContent = function() {
  138. return React.createElement(
  139. "div",
  140. {
  141. className: styles.wantedModalContent,
  142. ref: _this.ModalContentRef
  143. },
  144. _this.renderCloseButton(),
  145. React.createElement(
  146. "h4",
  147. {
  148. className: styles.title
  149. },
  150. "\u5206\u914D\u60AC\u8D4F\u5956\u91D1"
  151. ),
  152. React.createElement(
  153. "div",
  154. {
  155. className: styles.wantedValueText
  156. },
  157. "\u5269\u4F59\u53EF\u5206\u914D ".concat(
  158. _this.props.allocValue,
  159. "\u5143"
  160. )
  161. ),
  162. React.createElement(
  163. Tooltip,
  164. {
  165. visible: _this.state.outRangeTip,
  166. title: "\u8D85\u8FC7\u8303\u56F4\u503C",
  167. placement: "bottom",
  168. overlayClassName: styles.outRangeTextTip,
  169. getTooltipContainer: function getTooltipContainer() {
  170. return _this.ModalContentRef && _this.ModalContentRef.current;
  171. }
  172. },
  173. React.createElement(Input, {
  174. ref: _this.ModalInputRef,
  175. className: styles.wantedInputNumber,
  176. suffix: "\u5143",
  177. value: _this.state.sendValue,
  178. onChange: function onChange(e) {
  179. return _this.handleSendValueChange(e.target.value);
  180. },
  181. onFocus: function onFocus(e) {
  182. return e.target.setSelectionRange(
  183. 0,
  184. String(_this.state.sendValue).length
  185. );
  186. }
  187. })
  188. ),
  189. React.createElement(
  190. "div",
  191. {
  192. className: styles.wantedValueTipBottom
  193. },
  194. "\u9700\u8981\u5728\u60AC\u8D4F\u65F6\u95F4\u7ED3\u675F\u524D\u5C06\u5956\u91D1\u5206\u914D\u5B8C\u6210, \u5426\u5219\u5C06\u6309\u7167\u89C4\u5219\u81EA\u52A8\u5206\u914D"
  195. ),
  196. React.createElement(
  197. "div",
  198. {
  199. className: styles.buttonRow
  200. },
  201. React.createElement("div", {
  202. className: styles.tipsButton
  203. }),
  204. React.createElement(
  205. Button,
  206. {
  207. className: styles.confirmButton,
  208. onClick: _this.handleConfirm
  209. },
  210. "\u786E\u8BA4"
  211. ),
  212. React.createElement(
  213. "div",
  214. {
  215. className: styles.tipsButton
  216. },
  217. React.createElement(
  218. Popover,
  219. {
  220. placement: "bottom",
  221. trigger: "click",
  222. getPopupContainer: function getPopupContainer() {
  223. return (
  224. _this.ModalContentRef && _this.ModalContentRef.current
  225. );
  226. },
  227. overlayStyle: {
  228. width: "320px"
  229. },
  230. content: React.createElement(
  231. "div",
  232. {
  233. className: styles.tipsView
  234. },
  235. React.createElement(
  236. "h6",
  237. null,
  238. "1\u3001\u5982\u4F55\u53C2\u4E0E\u60AC\u8D4F\uFF1F"
  239. ),
  240. React.createElement(
  241. "div",
  242. null,
  243. "\u60AC\u8D4F\u95EE\u9898\u7686\u6709\u6709\u6548\u671F\uFF0C\u9ED8\u8BA4\u4E3A120\u5C0F\u65F6\uFF085\u5929\uFF09\uFF0C\u5728\u6709\u6548\u671F\u5185\u56DE\u590D\u7684\u7B54\u6848\uFF0C\u624D\u6709\u8D44\u683C\u88AB\u9009\u4E3A\u6700\u4F73\u7B54\u6848\uFF0C\u4EE5\u53CA\u5206\u5F97\u8D4F\u91D1\u3002"
  244. ),
  245. React.createElement(
  246. "h6",
  247. null,
  248. "2\u3001\u8D4F\u91D1\u5982\u4F55\u5206\uFF1F"
  249. ),
  250. React.createElement(
  251. "div",
  252. null,
  253. "\u60AC\u8D4F\u65F6\u95F4\u7ED3\u675F\u524D\uFF0C\u63D0\u95EE\u8005\u53EF\u968F\u65F6\u9009\u51FA\u6700\u4F18\u7B54\u6848\uFF0C\u5E76\u5BF9\u8D4F\u91D1\u8FDB\u884C\u5206\u914D\uFF0C\u76F4\u81F3\u8D4F\u91D1\u88AB\u5206\u5B8C\u6216\u65F6\u95F4\u5230\u671F\u4E3A\u6B62\u3002\u82E5\u60AC\u8D4F\u65F6\u95F4\u5230\u671F\uFF0C\u60AC\u8D4F\u8005\u4ECD\u672A\u5206\u914D\u8D4F\u91D1\uFF0C\u4E14\u56DE\u7B54\u6570\u5927\u4E8E\u7B49\u4E8E2\uFF0C\u7CFB\u7EDF\u5219\u9ED8\u8BA4\u5C06\u8D4F\u91D1\u5E73\u5206\u7ED9\u70B9\u8D5E\u6570\u524D3\u540D\u7684\u56DE\u7B54\u3002"
  254. ),
  255. React.createElement(
  256. "h6",
  257. null,
  258. "3\u3001\u8D4F\u91D1\u80FD\u9000\u6B3E\u5417\uFF1F"
  259. ),
  260. React.createElement(
  261. "div",
  262. null,
  263. "\u8D4F\u91D1\u53EA\u4F1A\u5728\u4EE5\u4E0B2\u79CD\u60C5\u51B5\u8FDB\u884C\u9000\u6B3E\uFF1A\u4E00\u3001\u60AC\u8D4F\u65F6\u95F4\u5230\u671F\uFF0C\u56DE\u7B54\u6570\u5C0F\u4E8E2\uFF0C\u8D4F\u91D1\u5C06\u81EA\u52A8\u9000\u8FD8\u81F3\u63D0\u95EE\u8005\u7684\u94B1\u5305\uFF1B\u4E8C\u3001\u60AC\u8D4F\u65F6\u95F4\u5230\u671F\uFF0C\u60AC\u8D4F\u8005\u672A\u5206\u914D\u5B8C\u8D4F\u91D1\uFF0C\u7CFB\u7EDF\u81EA\u52A8\u5C06\u5269\u4F59\u7684\u8D4F\u91D1\u9000\u8FD8\u81F3\u63D0\u95EE\u8005\u7684\u94B1\u5305\u3002"
  264. )
  265. )
  266. },
  267. React.createElement("i", {
  268. className: "schedule schedule-icon_rewardtips"
  269. })
  270. )
  271. )
  272. )
  273. );
  274. };
  275. _this.state = {
  276. visible: false,
  277. sendValue: 0,
  278. outRangeTip: false
  279. };
  280. _this.ModalContentRef = React.createRef();
  281. _this.ModalInputRef = React.createRef();
  282. return _this;
  283. }
  284. _createClass(AllocWantedModal, [
  285. {
  286. key: "render",
  287. value: function render() {
  288. var _this2 = this;
  289. var children = this.props.children;
  290. return React.createElement(
  291. React.Fragment,
  292. null,
  293. React.createElement(
  294. "div",
  295. {
  296. className: styles.wrapper,
  297. onClick: function onClick() {
  298. return _this2.handleShowAction();
  299. }
  300. },
  301. children
  302. ),
  303. React.createElement(
  304. Modal,
  305. {
  306. visible: this.state.visible,
  307. onCancel: function onCancel() {
  308. return _this2.handleCloseAction();
  309. }
  310. },
  311. this.renderModalContent()
  312. )
  313. );
  314. }
  315. }
  316. ]);
  317. return AllocWantedModal;
  318. })(React.Component);
  319. export default AllocWantedModal;
  320. //# sourceMappingURL=index.js.map