説明なし

index.js 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. import { a as _inherits, b as _classCallCheck, c as _possibleConstructorReturn, d as _getPrototypeOf, e as _createClass } from '../inherits-6cb67931.js';
  2. import React from 'react';
  3. import 'react-dom';
  4. import { Modal } from '../Modal/index.js';
  5. import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
  6. import { Tooltip, Input, Button, Popover } from 'antd';
  7. var 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";
  8. var css = ".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";
  9. var styles = {
  10. "wantedModalContent": "AllocWantedModal_wantedModalContent__1VodF",
  11. "title": "AllocWantedModal_title__31i9F",
  12. "wantedValueText": "AllocWantedModal_wantedValueText___uNQe",
  13. "wantedInputNumber": "AllocWantedModal_wantedInputNumber__3MyO5",
  14. "wantedValueTipBottom": "AllocWantedModal_wantedValueTipBottom__3WBt0",
  15. "buttonRow": "AllocWantedModal_buttonRow__FegZX",
  16. "confirmButton": "AllocWantedModal_confirmButton__1yXDN",
  17. "tipsButton": "AllocWantedModal_tipsButton__UmFpw",
  18. "closeButton": "AllocWantedModal_closeButton__1d4p-",
  19. "tipsView": "AllocWantedModal_tipsView__3my0J",
  20. "outRangeTextTip": "AllocWantedModal_outRangeTextTip__3R4mw"
  21. };
  22. styleInject(css);
  23. var AllocWantedModal =
  24. /*#__PURE__*/
  25. function (_React$Component) {
  26. _inherits(AllocWantedModal, _React$Component);
  27. function AllocWantedModal(props) {
  28. var _this;
  29. _classCallCheck(this, AllocWantedModal);
  30. _this = _possibleConstructorReturn(this, _getPrototypeOf(AllocWantedModal).call(this, props));
  31. _this.handleSendValueChange = function (v) {
  32. if (_this.state.outRangeTip) {
  33. _this.setState({
  34. outRangeTip: !_this.checkSendValue()
  35. });
  36. }
  37. _this.setState({
  38. sendValue: v
  39. });
  40. };
  41. _this.checkSendValue = function () {
  42. var sendValueRange = _this.props.sendValueRange;
  43. var sendValue = _this.state.sendValue;
  44. var min = 0;
  45. var max = Number(_this.props.allocValue);
  46. if (sendValueRange) {
  47. min = Number(sendValueRange[0]);
  48. max = Number(sendValueRange[1]);
  49. }
  50. if (sendValue > max) {
  51. _this.setState({
  52. outRangeTip: true
  53. });
  54. return false;
  55. } else if (sendValue < min) {
  56. _this.setState({
  57. outRangeTip: true
  58. });
  59. return false;
  60. }
  61. return true;
  62. };
  63. _this.handleCloseAction = function () {
  64. _this.setState({
  65. visible: false,
  66. sendValue: 0,
  67. outRangeTip: false
  68. }, function () {
  69. _this.props.handleVisibleChange(false);
  70. });
  71. };
  72. _this.handleShowAction = function () {
  73. _this.setState({
  74. visible: true
  75. }, function () {
  76. _this.props.handleVisibleChange(true);
  77. });
  78. };
  79. _this.handleConfirm = function () {
  80. var sendGiftData = _this.props.sendGiftData;
  81. var checkResult = _this.checkSendValue();
  82. if (!checkResult) {
  83. return null;
  84. }
  85. Promise.resolve(_this.props.sendRequest({
  86. business_type: 14,
  87. ref_id: sendGiftData.answerId.toString(),
  88. origin_id: sendGiftData.questionId,
  89. to_user: sendGiftData.toUserId,
  90. goods_id: 2,
  91. num: Number(_this.state.sendValue)
  92. })).then(function (res) {
  93. console.log("res: ", res);
  94. if (res) {
  95. _this.handleCloseAction();
  96. } else {
  97. _this.handleCloseAction();
  98. }
  99. });
  100. };
  101. _this.renderCloseButton = function () {
  102. return React.createElement("div", {
  103. role: "button",
  104. tabIndex: -1,
  105. className: styles.closeButton,
  106. onClick: function onClick() {
  107. _this.handleCloseAction();
  108. }
  109. }, React.createElement("img", {
  110. src: img,
  111. alt: "close button for send wanted"
  112. }));
  113. };
  114. _this.renderModalContent = function () {
  115. return React.createElement("div", {
  116. className: styles.wantedModalContent,
  117. ref: _this.ModalContentRef
  118. }, _this.renderCloseButton(), React.createElement("h4", {
  119. className: styles.title
  120. }, "\u5206\u914D\u60AC\u8D4F\u5956\u91D1"), React.createElement("div", {
  121. className: styles.wantedValueText
  122. }, "\u5269\u4F59\u53EF\u5206\u914D ".concat(_this.props.allocValue, "\u5143")), React.createElement(Tooltip, {
  123. visible: _this.state.outRangeTip,
  124. title: "\u8D85\u8FC7\u8303\u56F4\u503C",
  125. placement: "bottom",
  126. overlayClassName: styles.outRangeTextTip,
  127. getTooltipContainer: function getTooltipContainer() {
  128. return _this.ModalContentRef && _this.ModalContentRef.current;
  129. }
  130. }, React.createElement(Input, {
  131. ref: _this.ModalInputRef,
  132. className: styles.wantedInputNumber,
  133. suffix: "\u5143",
  134. value: _this.state.sendValue,
  135. onChange: function onChange(e) {
  136. return _this.handleSendValueChange(e.target.value);
  137. },
  138. onFocus: function onFocus(e) {
  139. return e.target.setSelectionRange(0, String(_this.state.sendValue).length);
  140. }
  141. })), React.createElement("div", {
  142. className: styles.wantedValueTipBottom
  143. }, "\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"), React.createElement("div", {
  144. className: styles.buttonRow
  145. }, React.createElement("div", {
  146. className: styles.tipsButton
  147. }), React.createElement(Button, {
  148. className: styles.confirmButton,
  149. onClick: _this.handleConfirm
  150. }, "\u786E\u8BA4"), React.createElement("div", {
  151. className: styles.tipsButton
  152. }, React.createElement(Popover, {
  153. placement: "bottom",
  154. trigger: "click",
  155. getPopupContainer: function getPopupContainer() {
  156. return _this.ModalContentRef && _this.ModalContentRef.current;
  157. },
  158. overlayStyle: {
  159. width: "320px"
  160. },
  161. content: React.createElement("div", {
  162. className: styles.tipsView
  163. }, React.createElement("h6", null, "1\u3001\u5982\u4F55\u53C2\u4E0E\u60AC\u8D4F\uFF1F"), React.createElement("div", null, "\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"), React.createElement("h6", null, "2\u3001\u8D4F\u91D1\u5982\u4F55\u5206\uFF1F"), React.createElement("div", null, "\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"), React.createElement("h6", null, "3\u3001\u8D4F\u91D1\u80FD\u9000\u6B3E\u5417\uFF1F"), React.createElement("div", null, "\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"))
  164. }, React.createElement("i", {
  165. className: "schedule schedule-icon_rewardtips"
  166. })))));
  167. };
  168. _this.state = {
  169. visible: false,
  170. sendValue: 0,
  171. outRangeTip: false
  172. };
  173. _this.ModalContentRef = React.createRef();
  174. _this.ModalInputRef = React.createRef();
  175. return _this;
  176. }
  177. _createClass(AllocWantedModal, [{
  178. key: "render",
  179. value: function render() {
  180. var _this2 = this;
  181. var children = this.props.children;
  182. return React.createElement(React.Fragment, null, React.createElement("div", {
  183. className: styles.wrapper,
  184. onClick: function onClick() {
  185. return _this2.handleShowAction();
  186. }
  187. }, children), React.createElement(Modal, {
  188. visible: this.state.visible,
  189. onCancel: function onCancel() {
  190. return _this2.handleCloseAction();
  191. }
  192. }, this.renderModalContent()));
  193. }
  194. }]);
  195. return AllocWantedModal;
  196. }(React.Component);
  197. export default AllocWantedModal;
  198. //# sourceMappingURL=index.js.map