Browse Source

dev: init build logic

Roxas 4 years ago
parent
commit
abe1f2004b
49 changed files with 23423 additions and 273 deletions
  1. 19
    0
      .babelrc
  2. 37
    0
      config-overrides.js
  3. 12
    0
      lib/Common/index.js
  4. 1
    0
      lib/Common/index.js.map
  5. 19
    0
      lib/Payment/index.js
  6. 1
    0
      lib/Payment/index.js.map
  7. 5772
    0
      lib/index-c6999c10.js
  8. 1
    0
      lib/index-c6999c10.js.map
  9. 84
    0
      lib/index.js
  10. 1
    0
      lib/index.js.map
  11. 227
    0
      lib/style-inject.es-c386372b.js
  12. 1
    0
      lib/style-inject.es-c386372b.js.map
  13. 75
    0
      lib/test-dadf718e.js
  14. 1
    0
      lib/test-dadf718e.js.map
  15. 14707
    0
      package-lock.json
  16. 53
    7
      package.json
  17. 109
    0
      rollup.config.js
  18. 1
    0
      src/components/Common/index.ts
  19. 3
    0
      src/components/Common/test.less
  20. 233
    0
      src/components/Common/test.tsx
  21. 60
    0
      src/components/Payment/Common/ConsumeListView/ConsumeListView.less
  22. 3
    0
      src/components/Payment/Common/ConsumeListView/README.md
  23. 166
    0
      src/components/Payment/Common/ConsumeListView/index.tsx
  24. 101
    0
      src/components/Payment/Common/PayPlatformOptions/PayPlatformOptions.less
  25. 3
    0
      src/components/Payment/Common/PayPlatformOptions/README.md
  26. 231
    0
      src/components/Payment/Common/PayPlatformOptions/index.tsx
  27. 133
    0
      src/components/Payment/Common/PriceOptions/PriceOptions.less
  28. 3
    0
      src/components/Payment/Common/PriceOptions/README.md
  29. 96
    0
      src/components/Payment/Common/PriceOptions/index.tsx
  30. 3
    0
      src/components/Payment/Common/WaitPayInfoView/README.md
  31. 7
    0
      src/components/Payment/Common/WaitPayInfoView/WaitPayInfoView.less
  32. 56
    0
      src/components/Payment/Common/WaitPayInfoView/index.tsx
  33. BIN
      src/components/Payment/Common/assets/btn_toggle.png
  34. 19
    0
      src/components/Payment/Common/assets/icon-info-blue@2x.svg
  35. BIN
      src/components/Payment/Common/assets/kcxq_popovers_icon_alipay@2x.png
  36. BIN
      src/components/Payment/Common/assets/kcxq_popovers_icon_paypal@2x.png
  37. BIN
      src/components/Payment/Common/assets/kcxq_popovers_icon_wechatpay@2x.png
  38. BIN
      src/components/Payment/Common/assets/payment_btn_pay_alipay@2x.png
  39. BIN
      src/components/Payment/Common/assets/payment_btn_pay_paypal@2x.png
  40. BIN
      src/components/Payment/Common/assets/payment_btn_pay_wechatpay@2x.png
  41. BIN
      src/components/Payment/Common/assets/popovers_list_huangguan.png
  42. 36
    0
      src/components/Payment/Utils/utils.ts
  43. 4
    0
      src/components/Payment/index.ts
  44. 9
    0
      src/lang/en.json
  45. 9
    0
      src/lang/zh.json
  46. 3
    0
      src/lib-build.js
  47. 11
    0
      src/typings/index.d.ts
  48. 5
    0
      tsconfig.json
  49. 1108
    266
      yarn.lock

+ 19
- 0
.babelrc View File

@@ -0,0 +1,19 @@
1
+{
2
+  "presets": [
3
+    "@babel/preset-env",
4
+    "@babel/preset-react",
5
+    "@babel/preset-typescript"
6
+  ],
7
+  "plugins": [
8
+    [
9
+      "import",
10
+      {
11
+        "libraryName": "antd",
12
+        "style": true,   // or 'css'
13
+        "libraryDirectory": "es"
14
+      }
15
+    ],
16
+    "@babel/plugin-proposal-class-properties"
17
+    // "@babel/plugin-proposal-export-default-from"
18
+  ]
19
+}

+ 37
- 0
config-overrides.js View File

@@ -0,0 +1,37 @@
1
+const fs = require('fs');
2
+const path = require('path');
3
+
4
+const rootPath = fs.realpathSync(process.cwd());
5
+const srcPath = path.resolve(rootPath, )
6
+
7
+module.exports = function override(config, env) {
8
+  console.log('config: ', config);
9
+  console.log('env: ', env);
10
+  config.resolve.extensions = ['.js', '.jsx', '.ts', '.tsx', '.less', '.json'];
11
+  config.resolve.alias = {
12
+    '@': srcPath,
13
+    '@components': `${srcPath}srcPath/components`,
14
+  };
15
+  config.module.rules.push({
16
+    test: /\.less$/,
17
+    use: [
18
+    'style-loader', 
19
+    {
20
+      loader: 'css-loader',// translates CSS into CommonJS
21
+      options: {
22
+        modules: {
23
+          localIdentName: '[name]__[local]___[hash:base64:5]',
24
+        },
25
+      }
26
+    },
27
+    'postcss-loader',
28
+    {
29
+      loader: 'less-loader',
30
+      options: {
31
+        javascriptEnabled: true,
32
+      },
33
+    }],
34
+    exclude: /node_modules|antd\.less/,
35
+  });
36
+  return config;
37
+}

+ 12
- 0
lib/Common/index.js View File

@@ -0,0 +1,12 @@
1
+'use strict';
2
+
3
+Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+require('../style-inject.es-c386372b.js');
6
+require('react');
7
+var test = require('../test-dadf718e.js');
8
+
9
+
10
+
11
+exports.Test = test.Test;
12
+//# sourceMappingURL=index.js.map

+ 1
- 0
lib/Common/index.js.map View File

@@ -0,0 +1 @@
1
+{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}

+ 19
- 0
lib/Payment/index.js View File

@@ -0,0 +1,19 @@
1
+'use strict';
2
+
3
+Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+require('../style-inject.es-c386372b.js');
6
+require('react');
7
+var index = require('../index-c6999c10.js');
8
+require('antd/es/input/style');
9
+require('antd/es/input');
10
+require('antd/es/button/style');
11
+require('antd/es/button');
12
+
13
+
14
+
15
+exports.ConsumeListView = index.ConsumeListView;
16
+exports.PayPlatformOptions = index.PayPlatformOptions;
17
+exports.PriceOptions = index.PriceOptions;
18
+exports.WaitPayInfoView = index.WaitPayInfoView;
19
+//# sourceMappingURL=index.js.map

+ 1
- 0
lib/Payment/index.js.map View File

@@ -0,0 +1 @@
1
+{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}

+ 5772
- 0
lib/index-c6999c10.js
File diff suppressed because it is too large
View File


+ 1
- 0
lib/index-c6999c10.js.map
File diff suppressed because it is too large
View File


+ 84
- 0
lib/index.js View File

@@ -0,0 +1,84 @@
1
+'use strict';
2
+
3
+Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+require('./style-inject.es-c386372b.js');
6
+require('react');
7
+require('./test-dadf718e.js');
8
+var index = require('./index-c6999c10.js');
9
+require('antd/es/input/style');
10
+require('antd/es/input');
11
+require('antd/es/button/style');
12
+require('antd/es/button');
13
+
14
+// type TransmitImgTxtData = {
15
+//   user_id?: string|number;
16
+//   anonymity?: boolean;
17
+//   avatar?: string;
18
+//   nickname?: string;
19
+//   is_long?: boolean;
20
+// }
21
+// interface TransmitCardProps {
22
+//   type: TransmitType;
23
+//   data: TransmitImgTxtData;
24
+// }
25
+// export class TransmitCard extends React.PureComponent<TransmitCardProps, {}> {
26
+//   renderVideo() {
27
+//     return <div className={styles.transmitVideoCard}>Video</div>;
28
+//   }
29
+//   renderImgTxt() {
30
+//     const { data } = this.props;
31
+//     const {
32
+//       user_id,
33
+//       anonymity,
34
+//       avatar,
35
+//       nickname,
36
+//       is_long,
37
+//     } = data;
38
+//     return (
39
+//       <div className={styles.transmitImgTxtCard}>
40
+//         <div className={styles.header}>
41
+//           <UserLink user_id={user_id} anonymity={anonymity}>
42
+//             <Avatar
43
+//               id={user_id}
44
+//               image={avatar}
45
+//               follow={false}
46
+//               size="cover"
47
+//               className={styles.ava}
48
+//               anonymity={anonymity}
49
+//             />
50
+//           </UserLink>
51
+//           <div className={styles.nickname}>
52
+//             <UserLink user_id={user_id} anonymity={anonymity}>
53
+//               {nickname}
54
+//             </UserLink>
55
+//           </div>
56
+//           <div className={styles.type}>
57
+//             {is_long
58
+//               ? intl.get('bilingually.imgtxt.article')
59
+//               : intl.get('bilingually.imgtxt')}
60
+//           </div>
61
+//         </div>
62
+//       </div>
63
+//     );
64
+//   }
65
+//   render() {
66
+//     const { type } = this.props;
67
+//     if (type === 'imgTxt') {
68
+//       this.renderImgTxt();
69
+//     }
70
+//     if (type === 'shortVideo' || type === 'microVideo') {
71
+//       this.renderVideo();
72
+//     }
73
+//     return null;
74
+//   }
75
+// }
76
+
77
+var Test = "TestComponent";
78
+
79
+exports.ConsumeListView = index.ConsumeListView;
80
+exports.PayPlatformOptions = index.PayPlatformOptions;
81
+exports.PriceOptions = index.PriceOptions;
82
+exports.WaitPayInfoView = index.WaitPayInfoView;
83
+exports.Test = Test;
84
+//# sourceMappingURL=index.js.map

+ 1
- 0
lib/index.js.map
File diff suppressed because it is too large
View File


+ 227
- 0
lib/style-inject.es-c386372b.js View File

@@ -0,0 +1,227 @@
1
+'use strict';
2
+
3
+function _classCallCheck(instance, Constructor) {
4
+  if (!(instance instanceof Constructor)) {
5
+    throw new TypeError("Cannot call a class as a function");
6
+  }
7
+}
8
+
9
+function _defineProperties(target, props) {
10
+  for (var i = 0; i < props.length; i++) {
11
+    var descriptor = props[i];
12
+    descriptor.enumerable = descriptor.enumerable || false;
13
+    descriptor.configurable = true;
14
+    if ("value" in descriptor) descriptor.writable = true;
15
+    Object.defineProperty(target, descriptor.key, descriptor);
16
+  }
17
+}
18
+
19
+function _createClass(Constructor, protoProps, staticProps) {
20
+  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
21
+  if (staticProps) _defineProperties(Constructor, staticProps);
22
+  return Constructor;
23
+}
24
+
25
+function _defineProperty(obj, key, value) {
26
+  if (key in obj) {
27
+    Object.defineProperty(obj, key, {
28
+      value: value,
29
+      enumerable: true,
30
+      configurable: true,
31
+      writable: true
32
+    });
33
+  } else {
34
+    obj[key] = value;
35
+  }
36
+
37
+  return obj;
38
+}
39
+
40
+function _inherits(subClass, superClass) {
41
+  if (typeof superClass !== "function" && superClass !== null) {
42
+    throw new TypeError("Super expression must either be null or a function");
43
+  }
44
+
45
+  subClass.prototype = Object.create(superClass && superClass.prototype, {
46
+    constructor: {
47
+      value: subClass,
48
+      writable: true,
49
+      configurable: true
50
+    }
51
+  });
52
+  if (superClass) _setPrototypeOf(subClass, superClass);
53
+}
54
+
55
+function _getPrototypeOf(o) {
56
+  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
57
+    return o.__proto__ || Object.getPrototypeOf(o);
58
+  };
59
+  return _getPrototypeOf(o);
60
+}
61
+
62
+function _setPrototypeOf(o, p) {
63
+  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
64
+    o.__proto__ = p;
65
+    return o;
66
+  };
67
+
68
+  return _setPrototypeOf(o, p);
69
+}
70
+
71
+function _assertThisInitialized(self) {
72
+  if (self === void 0) {
73
+    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
74
+  }
75
+
76
+  return self;
77
+}
78
+
79
+function _possibleConstructorReturn(self, call) {
80
+  if (call && (typeof call === "object" || typeof call === "function")) {
81
+    return call;
82
+  }
83
+
84
+  return _assertThisInitialized(self);
85
+}
86
+
87
+function _slicedToArray(arr, i) {
88
+  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
89
+}
90
+
91
+function _arrayWithHoles(arr) {
92
+  if (Array.isArray(arr)) return arr;
93
+}
94
+
95
+function _iterableToArrayLimit(arr, i) {
96
+  if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
97
+    return;
98
+  }
99
+
100
+  var _arr = [];
101
+  var _n = true;
102
+  var _d = false;
103
+  var _e = undefined;
104
+
105
+  try {
106
+    for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
107
+      _arr.push(_s.value);
108
+
109
+      if (i && _arr.length === i) break;
110
+    }
111
+  } catch (err) {
112
+    _d = true;
113
+    _e = err;
114
+  } finally {
115
+    try {
116
+      if (!_n && _i["return"] != null) _i["return"]();
117
+    } finally {
118
+      if (_d) throw _e;
119
+    }
120
+  }
121
+
122
+  return _arr;
123
+}
124
+
125
+function _nonIterableRest() {
126
+  throw new TypeError("Invalid attempt to destructure non-iterable instance");
127
+}
128
+
129
+var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
130
+
131
+function unwrapExports (x) {
132
+	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
133
+}
134
+
135
+function createCommonjsModule(fn, module) {
136
+	return module = { exports: {} }, fn(module, module.exports), module.exports;
137
+}
138
+
139
+var classnames = createCommonjsModule(function (module) {
140
+/*!
141
+  Copyright (c) 2017 Jed Watson.
142
+  Licensed under the MIT License (MIT), see
143
+  http://jedwatson.github.io/classnames
144
+*/
145
+/* global define */
146
+
147
+(function () {
148
+
149
+	var hasOwn = {}.hasOwnProperty;
150
+
151
+	function classNames () {
152
+		var classes = [];
153
+
154
+		for (var i = 0; i < arguments.length; i++) {
155
+			var arg = arguments[i];
156
+			if (!arg) continue;
157
+
158
+			var argType = typeof arg;
159
+
160
+			if (argType === 'string' || argType === 'number') {
161
+				classes.push(arg);
162
+			} else if (Array.isArray(arg) && arg.length) {
163
+				var inner = classNames.apply(null, arg);
164
+				if (inner) {
165
+					classes.push(inner);
166
+				}
167
+			} else if (argType === 'object') {
168
+				for (var key in arg) {
169
+					if (hasOwn.call(arg, key) && arg[key]) {
170
+						classes.push(key);
171
+					}
172
+				}
173
+			}
174
+		}
175
+
176
+		return classes.join(' ');
177
+	}
178
+
179
+	if ( module.exports) {
180
+		classNames.default = classNames;
181
+		module.exports = classNames;
182
+	} else {
183
+		window.classNames = classNames;
184
+	}
185
+}());
186
+});
187
+
188
+function styleInject(css, ref) {
189
+  if ( ref === void 0 ) ref = {};
190
+  var insertAt = ref.insertAt;
191
+
192
+  if (!css || typeof document === 'undefined') { return; }
193
+
194
+  var head = document.head || document.getElementsByTagName('head')[0];
195
+  var style = document.createElement('style');
196
+  style.type = 'text/css';
197
+
198
+  if (insertAt === 'top') {
199
+    if (head.firstChild) {
200
+      head.insertBefore(style, head.firstChild);
201
+    } else {
202
+      head.appendChild(style);
203
+    }
204
+  } else {
205
+    head.appendChild(style);
206
+  }
207
+
208
+  if (style.styleSheet) {
209
+    style.styleSheet.cssText = css;
210
+  } else {
211
+    style.appendChild(document.createTextNode(css));
212
+  }
213
+}
214
+
215
+exports._classCallCheck = _classCallCheck;
216
+exports._createClass = _createClass;
217
+exports._defineProperty = _defineProperty;
218
+exports._getPrototypeOf = _getPrototypeOf;
219
+exports._inherits = _inherits;
220
+exports._possibleConstructorReturn = _possibleConstructorReturn;
221
+exports._slicedToArray = _slicedToArray;
222
+exports.classnames = classnames;
223
+exports.commonjsGlobal = commonjsGlobal;
224
+exports.createCommonjsModule = createCommonjsModule;
225
+exports.styleInject = styleInject;
226
+exports.unwrapExports = unwrapExports;
227
+//# sourceMappingURL=style-inject.es-c386372b.js.map

+ 1
- 0
lib/style-inject.es-c386372b.js.map View File

@@ -0,0 +1 @@
1
+{"version":3,"file":"style-inject.es-c386372b.js","sources":["../node_modules/classnames/index.js","../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["/*!\n  Copyright (c) 2017 Jed Watson.\n  Licensed under the MIT License (MIT), see\n  http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","function styleInject(css, ref) {\n  if ( ref === void 0 ) ref = {};\n  var insertAt = ref.insertAt;\n\n  if (!css || typeof document === 'undefined') { return; }\n\n  var head = document.head || document.getElementsByTagName('head')[0];\n  var style = document.createElement('style');\n  style.type = 'text/css';\n\n  if (insertAt === 'top') {\n    if (head.firstChild) {\n      head.insertBefore(style, head.firstChild);\n    } else {\n      head.appendChild(style);\n    }\n  } else {\n    head.appendChild(style);\n  }\n\n  if (style.styleSheet) {\n    style.styleSheet.cssText = css;\n  } else {\n    style.appendChild(document.createTextNode(css));\n  }\n}\n\nexport default styleInject;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,CAAC,YAAY;;CAGZ,IAAI,MAAM,GAAG,EAAE,CAAC,cAAc,CAAC;;CAE/B,SAAS,UAAU,IAAI;EACtB,IAAI,OAAO,GAAG,EAAE,CAAC;;EAEjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;GAC1C,IAAI,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;GACvB,IAAI,CAAC,GAAG,EAAE,SAAS;;GAEnB,IAAI,OAAO,GAAG,OAAO,GAAG,CAAC;;GAEzB,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,QAAQ,EAAE;IACjD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClB,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE;IAC5C,IAAI,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACxC,IAAI,KAAK,EAAE;KACV,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACpB;IACD,MAAM,IAAI,OAAO,KAAK,QAAQ,EAAE;IAChC,KAAK,IAAI,GAAG,IAAI,GAAG,EAAE;KACpB,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE;MACtC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;MAClB;KACD;IACD;GACD;;EAED,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;EACzB;;CAED,IAAI,CAAiC,MAAM,CAAC,OAAO,EAAE;EACpD,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC;EAChC,cAAc,GAAG,UAAU,CAAC;EAC5B,MAAM,AAKA;EACN,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;EAC/B;CACD,EAAE,EAAE;;;ACnDL,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;EAC7B,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;EAC/B,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;;EAE5B,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;;EAExD,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;EACrE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;EAC5C,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;;EAExB,IAAI,QAAQ,KAAK,KAAK,EAAE;IACtB,IAAI,IAAI,CAAC,UAAU,EAAE;MACnB,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;KAC3C,MAAM;MACL,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KACzB;GACF,MAAM;IACL,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;GACzB;;EAED,IAAI,KAAK,CAAC,UAAU,EAAE;IACpB,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG,CAAC;GAChC,MAAM;IACL,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;GACjD;CACF;;;;;;;;;;;;;;;"}

+ 75
- 0
lib/test-dadf718e.js View File

@@ -0,0 +1,75 @@
1
+'use strict';
2
+
3
+var styleInject_es = require('./style-inject.es-c386372b.js');
4
+require('react');
5
+
6
+var css = ".test_red__36-3- {\n  color: red;\n}\n";
7
+styleInject_es.styleInject(css);
8
+
9
+// type TransmitImgTxtData = {
10
+//   user_id?: string|number;
11
+//   anonymity?: boolean;
12
+//   avatar?: string;
13
+//   nickname?: string;
14
+//   is_long?: boolean;
15
+// }
16
+// interface TransmitCardProps {
17
+//   type: TransmitType;
18
+//   data: TransmitImgTxtData;
19
+// }
20
+// export class TransmitCard extends React.PureComponent<TransmitCardProps, {}> {
21
+//   renderVideo() {
22
+//     return <div className={styles.transmitVideoCard}>Video</div>;
23
+//   }
24
+//   renderImgTxt() {
25
+//     const { data } = this.props;
26
+//     const {
27
+//       user_id,
28
+//       anonymity,
29
+//       avatar,
30
+//       nickname,
31
+//       is_long,
32
+//     } = data;
33
+//     return (
34
+//       <div className={styles.transmitImgTxtCard}>
35
+//         <div className={styles.header}>
36
+//           <UserLink user_id={user_id} anonymity={anonymity}>
37
+//             <Avatar
38
+//               id={user_id}
39
+//               image={avatar}
40
+//               follow={false}
41
+//               size="cover"
42
+//               className={styles.ava}
43
+//               anonymity={anonymity}
44
+//             />
45
+//           </UserLink>
46
+//           <div className={styles.nickname}>
47
+//             <UserLink user_id={user_id} anonymity={anonymity}>
48
+//               {nickname}
49
+//             </UserLink>
50
+//           </div>
51
+//           <div className={styles.type}>
52
+//             {is_long
53
+//               ? intl.get('bilingually.imgtxt.article')
54
+//               : intl.get('bilingually.imgtxt')}
55
+//           </div>
56
+//         </div>
57
+//       </div>
58
+//     );
59
+//   }
60
+//   render() {
61
+//     const { type } = this.props;
62
+//     if (type === 'imgTxt') {
63
+//       this.renderImgTxt();
64
+//     }
65
+//     if (type === 'shortVideo' || type === 'microVideo') {
66
+//       this.renderVideo();
67
+//     }
68
+//     return null;
69
+//   }
70
+// }
71
+
72
+var Test = "TestComponent";
73
+
74
+exports.Test = Test;
75
+//# sourceMappingURL=test-dadf718e.js.map

+ 1
- 0
lib/test-dadf718e.js.map
File diff suppressed because it is too large
View File


+ 14707
- 0
package-lock.json
File diff suppressed because it is too large
View File


+ 53
- 7
package.json View File

@@ -1,25 +1,31 @@
1 1
 {
2
-  "name": "my-app",
2
+  "name": "bilingo-ui",
3 3
   "version": "0.1.0",
4 4
   "private": true,
5
+  "main": "lib/index.js",
5 6
   "dependencies": {
6 7
     "@testing-library/jest-dom": "^4.2.4",
7 8
     "@testing-library/react": "^9.3.2",
8 9
     "@testing-library/user-event": "^7.1.2",
10
+    "@types/classnames": "^2.2.9",
9 11
     "@types/jest": "^24.0.0",
10 12
     "@types/node": "^12.0.0",
11 13
     "@types/react": "^16.9.0",
12 14
     "@types/react-dom": "^16.9.0",
13
-    "react": "^16.12.0",
14
-    "react-dom": "^16.12.0",
15
+    "@types/react-intl": "^3.0.0",
16
+    "classnames": "^2.2.6",
17
+    "react-intl": "^3.9.2",
15 18
     "react-scripts": "3.3.0",
16 19
     "typescript": "~3.7.2"
17 20
   },
18 21
   "scripts": {
19
-    "start": "react-scripts start",
20
-    "build": "react-scripts build",
21
-    "test": "react-scripts test",
22
-    "eject": "react-scripts eject"
22
+    "start": "react-app-rewired start",
23
+    "build": "react-app-rewired build",
24
+    "test": "react-app-rewired test",
25
+    "eject": "react-app-rewired eject",
26
+    "build:lib": "rimraf lib && babel src/components --out-dir lib  --source-maps  --copy-files --extensions \".ts,.tsx\"",
27
+    "build:css:": "",
28
+    "build:rollup": "rimraf lib && rollup -c ./rollup.config.js"
23 29
   },
24 30
   "eslintConfig": {
25 31
     "extends": "react-app"
@@ -35,5 +41,45 @@
35 41
       "last 1 firefox version",
36 42
       "last 1 safari version"
37 43
     ]
44
+  },
45
+  "devDependencies": {
46
+    "@babel/cli": "^7.7.5",
47
+    "@babel/core": "^7.7.5",
48
+    "@babel/plugin-proposal-class-properties": "^7.7.4",
49
+    "@babel/plugin-proposal-export-default-from": "^7.7.4",
50
+    "@babel/polyfill": "^7.7.0",
51
+    "@babel/preset-env": "^7.7.6",
52
+    "@babel/preset-react": "^7.7.4",
53
+    "@babel/preset-typescript": "^7.7.4",
54
+    "@rollup/plugin-alias": "^3.0.0",
55
+    "@rollup/plugin-commonjs": "^11.0.0",
56
+    "@rollup/plugin-image": "^2.0.0",
57
+    "@rollup/plugin-node-resolve": "^6.0.0",
58
+    "@rollup/plugin-url": "^4.0.0",
59
+    "autoprefixer": "^9.7.3",
60
+    "babel-loader": "^8.0.6",
61
+    "babel-plugin-import": "^1.13.0",
62
+    "cross-env": "^6.0.3",
63
+    "less": "^3.10.3",
64
+    "node-eval": "^2.0.0",
65
+    "postcss-url": "^8.0.0",
66
+    "react-app-rewired": "^2.1.5",
67
+    "rimraf": "^3.0.0",
68
+    "rollup": "^1.27.13",
69
+    "rollup-plugin-alias": "^2.2.0",
70
+    "rollup-plugin-babel": "^4.3.3",
71
+    "rollup-plugin-eslint": "^7.0.0",
72
+    "rollup-plugin-json": "^4.0.0",
73
+    "rollup-plugin-less": "^1.1.2",
74
+    "rollup-plugin-node-resolve": "^5.2.0",
75
+    "rollup-plugin-peer-deps-external": "^2.2.0",
76
+    "rollup-plugin-postcss-modules": "^2.0.1",
77
+    "rollup-plugin-replace": "^2.2.0",
78
+    "ts-loader": "^6.2.1"
79
+  },
80
+  "peerDependencies": {
81
+    "antd": "^3.26.4",
82
+    "react": "^16.12.0",
83
+    "react-dom": "^16.12.0"
38 84
   }
39 85
 }

+ 109
- 0
rollup.config.js View File

@@ -0,0 +1,109 @@
1
+import resolve from "@rollup/plugin-node-resolve";
2
+import commonjs from "@rollup/plugin-commonjs";
3
+import image from '@rollup/plugin-image';
4
+import alias from '@rollup/plugin-alias';
5
+import postcss from 'rollup-plugin-postcss-modules'
6
+import babel from "rollup-plugin-babel";
7
+import json from "rollup-plugin-json";
8
+import autoprefixer from 'autoprefixer';
9
+import postcssUrl from 'postcss-url';
10
+import peerDepsExternal from 'rollup-plugin-peer-deps-external';
11
+// import url from '@rollup/plugin-url';
12
+// import less from "rollup-plugin-less";
13
+import nodeEval from 'node-eval';
14
+
15
+export function getModuleExports(moduleId) {
16
+  const id = require.resolve(moduleId)
17
+  const moduleOut = nodeEval(fs.readFileSync(id).toString(), id)
18
+  let result = []
19
+  const excludeExports = /^(default|__)/
20
+  if (moduleOut && typeof moduleOut === 'object') {
21
+      result = Object.keys(moduleOut)
22
+          .filter(name => !excludeExports.test(name))
23
+  }
24
+  return result
25
+}
26
+
27
+export function getNamedExports(moduleIds) {
28
+  const result = {}
29
+  moduleIds.forEach( id => {
30
+      result[id] = getModuleExports(id)
31
+  })
32
+  return result
33
+}
34
+
35
+const fs = require('fs');
36
+const path = require('path');
37
+const componentFold = 'src/components';
38
+const cModuleNames = fs.readdirSync(path.resolve(componentFold));
39
+const cModuleMap = cModuleNames.reduce((prev, name) => {
40
+  prev[name] = `${componentFold}/${name}/index.ts`;
41
+  return prev;
42
+}, {});
43
+console.log('cModuleMap: ', cModuleMap);
44
+
45
+const extensions = ['.js', '.jsx', '.ts', '.tsx'];
46
+
47
+export default {
48
+  input: {
49
+    '.': "src/lib-build.js",
50
+    ...cModuleMap
51
+  },
52
+  output: [
53
+    {
54
+      dir: "lib",
55
+      sourcemap: true,
56
+      entryFileNames: '[name]/index.js',
57
+      exports: 'named',
58
+      // file: "lib/bundle.js",
59
+      format: "cjs"
60
+    }
61
+  ],
62
+  plugins: [
63
+    peerDepsExternal(),
64
+    resolve({
65
+      mainFields: ['jsnext'],
66
+      preferBuiltins: true,
67
+      browser: true,
68
+      extensions,
69
+    }),
70
+    commonjs({
71
+      include: 'node_modules/**',
72
+      browser: true,
73
+      namedExports: getNamedExports([
74
+        'prop-types',
75
+      ])
76
+    }),
77
+    babel({
78
+      exclude: "node_modules/**",
79
+      runtimeHelpers: true,
80
+      extensions,
81
+    }),
82
+    image(),
83
+    json(),
84
+    // url(),
85
+    // less(),
86
+    postcss({
87
+      extensions: ['.css', '.less'],
88
+      plugins: [
89
+        autoprefixer(),
90
+        postcssUrl({
91
+          url: 'inline'
92
+        }),
93
+      ],
94
+      modules: true,
95
+    }),
96
+    alias({
97
+      entries: [
98
+        { find: '@components', replacement: 'src/components' },
99
+      ]
100
+    }),
101
+  ],
102
+  onwarn: function(warning) {
103
+    // Skip certain warnings
104
+    // should intercept ... but doesn't in some rollup versions
105
+    if ( warning.code === 'THIS_IS_UNDEFINED' ) { return; }
106
+    // console.warn everything else
107
+    console.warn( warning.message );
108
+  }
109
+};

+ 1
- 0
src/components/Common/index.ts View File

@@ -0,0 +1 @@
1
+export { Test } from './test';

+ 3
- 0
src/components/Common/test.less View File

@@ -0,0 +1,3 @@
1
+.red {
2
+  color: red;
3
+}

+ 233
- 0
src/components/Common/test.tsx View File

@@ -0,0 +1,233 @@
1
+import React, { PureComponent } from "react";
2
+import classnames from 'classnames';
3
+
4
+import styles from './test.less';
5
+
6
+export const ImgRowList = (
7
+  imglist: Array<string>,
8
+  outterKey: string,
9
+  type: string | null = 'normal',
10
+) => {
11
+  if (!imglist || !Array.isArray(imglist)) return null;
12
+  return (
13
+    <div
14
+      className={classnames(styles.normal_img_row_list, {
15
+        [styles.middle_type]: type === 'middle',
16
+      })}
17
+    >
18
+      {imglist.map((image_url: string, index: number) => {
19
+        return (
20
+          <span key={`${outterKey}_${image_url}`}>
21
+            <img src={image_url} alt={`comment ${index}`} />
22
+          </span>
23
+        );
24
+      })}
25
+    </div>
26
+  );
27
+};
28
+
29
+interface MyNormalListProps {
30
+  style?: any;
31
+  renderItem: Function | any;
32
+  renderData: Array<any>;
33
+}
34
+export class MyNormalList extends PureComponent<MyNormalListProps, {}> {
35
+  render() {
36
+    const {
37
+      style: innerStyle = {},
38
+      renderItem = () => {},
39
+      renderData = [],
40
+    } = this.props;
41
+
42
+    if (!renderData || !Array.isArray(renderData)) {
43
+      console.error('MyNormalList Components renderData Props must be Array');
44
+      return null;
45
+    }
46
+
47
+    return (
48
+      <div className={styles.normal_list_wrapper} style={innerStyle}>
49
+        {renderData.map((value, index, arr) => renderItem(value, index))}
50
+      </div>
51
+    );
52
+  }
53
+}
54
+
55
+interface NormalCardProps {
56
+  key: any;
57
+  userinfo: {
58
+    nickname: string | any;
59
+    avatar: string | any;
60
+    created: string | number;
61
+  };
62
+  main_content: any;
63
+  append_content?: any;
64
+  content_img_assets?: Array<string>;
65
+  options?: {
66
+    header_size?: 'small' | 'normal' | 'middle';
67
+    bottom_divider?: boolean;
68
+  };
69
+}
70
+export class NormalCard extends PureComponent<NormalCardProps, {}> {
71
+  render() {
72
+    const {
73
+      userinfo: { nickname, avatar, created } = {
74
+        nickname: '',
75
+        avatar: '',
76
+        created: '',
77
+      },
78
+      main_content = null,
79
+      append_content = null,
80
+      content_img_assets = [],
81
+      options = {
82
+        header_size: 'normal',
83
+        bottom_divider: false,
84
+      },
85
+    } = this.props;
86
+    //
87
+
88
+    const RENDEROPTIONS_showImgList =
89
+      content_img_assets && content_img_assets.length > 0;
90
+
91
+    return (
92
+      <div
93
+        className={classnames(styles.normal_card_wrapper, {
94
+          [styles.header_middle]: options.header_size === 'middle', // default
95
+          [styles.header_small]: options.header_size === 'small',
96
+          [styles.bottom_border]: options.bottom_divider,
97
+        })}
98
+      >
99
+        <time>{created}</time>
100
+        <header>
101
+          {typeof avatar === 'string' ? (
102
+            <div className={styles.avatar_wrapper}>
103
+              <img src={avatar} alt="user_avatar" />
104
+            </div>
105
+          ) : (
106
+            avatar
107
+          )}
108
+          <div className={styles.nickname_wrapper}>{nickname}</div>
109
+        </header>
110
+        <div className={styles.main_content_wrapper}>
111
+          {main_content}
112
+          {RENDEROPTIONS_showImgList
113
+            ? ImgRowList(content_img_assets, this.props.key)
114
+            : null}
115
+        </div>
116
+        <div className={styles.append_wrapper}>{append_content}</div>
117
+      </div>
118
+    );
119
+  }
120
+}
121
+
122
+interface ShareCardProps {
123
+  isMobile: boolean | any;
124
+  mode: 'line' | 'block';
125
+  render_mode: 'text' | 'object';
126
+  share_data: any;
127
+}
128
+export class ShareCard extends PureComponent<ShareCardProps, {}> {
129
+  render() {
130
+    const {
131
+      isMobile = false,
132
+      render_mode = 'text',
133
+      mode = 'line',
134
+      share_data = '',
135
+    } = this.props;
136
+
137
+    return (
138
+      <div
139
+        className={classnames(styles.share_card_wrapper, {
140
+          [styles.mobile_mode]: isMobile,
141
+          [styles.mode_line]: mode === 'line', // default
142
+          [styles.mode_block]: mode === 'block',
143
+        })}
144
+      >
145
+        {render_mode === 'text' ? share_data : null}
146
+      </div>
147
+    );
148
+  }
149
+}
150
+
151
+// type TransmitType = 'imgTxt' | 'shortVideo' | 'microVideo';
152
+// type TransmitImgTxtData = {
153
+//   user_id?: string|number;
154
+//   anonymity?: boolean;
155
+//   avatar?: string;
156
+//   nickname?: string;
157
+//   is_long?: boolean;
158
+// }
159
+
160
+// interface TransmitCardProps {
161
+//   type: TransmitType;
162
+//   data: TransmitImgTxtData;
163
+// }
164
+
165
+// export class TransmitCard extends React.PureComponent<TransmitCardProps, {}> {
166
+//   renderVideo() {
167
+//     return <div className={styles.transmitVideoCard}>Video</div>;
168
+//   }
169
+
170
+//   renderImgTxt() {
171
+//     const { data } = this.props;
172
+//     const {
173
+//       user_id,
174
+//       anonymity,
175
+//       avatar,
176
+//       nickname,
177
+//       is_long,
178
+//     } = data;
179
+
180
+//     return (
181
+//       <div className={styles.transmitImgTxtCard}>
182
+//         <div className={styles.header}>
183
+//           <UserLink user_id={user_id} anonymity={anonymity}>
184
+//             <Avatar
185
+//               id={user_id}
186
+//               image={avatar}
187
+//               follow={false}
188
+//               size="cover"
189
+//               className={styles.ava}
190
+//               anonymity={anonymity}
191
+//             />
192
+//           </UserLink>
193
+//           <div className={styles.nickname}>
194
+//             <UserLink user_id={user_id} anonymity={anonymity}>
195
+//               {nickname}
196
+//             </UserLink>
197
+//           </div>
198
+//           <div className={styles.type}>
199
+//             {is_long
200
+//               ? intl.get('bilingually.imgtxt.article')
201
+//               : intl.get('bilingually.imgtxt')}
202
+//           </div>
203
+//         </div>
204
+//       </div>
205
+//     );
206
+//   }
207
+
208
+//   render() {
209
+//     const { type } = this.props;
210
+//     if (type === 'imgTxt') {
211
+//       this.renderImgTxt();
212
+//     }
213
+//     if (type === 'shortVideo' || type === 'microVideo') {
214
+//       this.renderVideo();
215
+//     }
216
+//     return null;
217
+//   }
218
+// }
219
+
220
+export const Test = "TestComponent";
221
+export const TestRedTxt = () => (
222
+  <div className={styles.red}>
223
+    RedTxt
224
+  </div>
225
+)
226
+
227
+export default {
228
+  MyNormalList,
229
+  NormalCard,
230
+  ShareCard,
231
+  Test,
232
+  // TransmitCard
233
+};

+ 60
- 0
src/components/Payment/Common/ConsumeListView/ConsumeListView.less View File

@@ -0,0 +1,60 @@
1
+.wrapper {
2
+  display: flex;
3
+  justify-content: center;
4
+
5
+  .consumelist {
6
+    padding: 0;
7
+    margin: 0;
8
+    display: flex;
9
+    flex-wrap: wrap;
10
+    padding-top: 10px;
11
+
12
+    li {
13
+      list-style: none;
14
+    }
15
+
16
+    .consumeItem {
17
+      margin: 0 6px 10px;
18
+      text-align: center;
19
+      position: relative;
20
+
21
+      .kingdomIcon {
22
+        position: absolute;
23
+        width: 24px;
24
+        height: 22px;
25
+        left: -6px;
26
+        top: -12px;
27
+      }
28
+
29
+      .avatar {
30
+        margin: 0 auto 4px;
31
+        width: 36px;
32
+        height: 36px;
33
+        background-size: cover;
34
+        border-radius: 50%;
35
+      }
36
+
37
+      .gray {
38
+        color: #9b9b9b;
39
+        font-size: 12px;
40
+      }
41
+    }
42
+
43
+    .toggle {
44
+      margin: 0 6px 10px;
45
+      width: 36px;
46
+      height: 36px;
47
+      line-height: 36px;
48
+      background-color: #ececec;
49
+      border-radius: 50%;
50
+      color: #a8adb6;
51
+      cursor: pointer;
52
+      background-image: url(../assets/btn_toggle.png);
53
+      background-position: center;
54
+
55
+      &.expand {
56
+        transform: rotate(180deg);
57
+      }
58
+    }
59
+  }
60
+}

+ 3
- 0
src/components/Payment/Common/ConsumeListView/README.md View File

@@ -0,0 +1,3 @@
1
+# ConsumeListView
2
+
3
+- 简单介绍

+ 166
- 0
src/components/Payment/Common/ConsumeListView/index.tsx View File

@@ -0,0 +1,166 @@
1
+import React, { Component } from 'react';
2
+import classnames from 'classnames';
3
+
4
+// import { DEFAULT_AVATAR } from '@/constants';
5
+import { addImageProcess } from '../../Utils/utils';
6
+import KingDomPic from '../assets/popovers_list_huangguan.png';
7
+
8
+import styles from './ConsumeListView.less';
9
+
10
+const DEFAULT_AVATAR =
11
+  '//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180820/Kgka4_oU1.jpeg';
12
+
13
+type Props = {
14
+  isToggle: boolean;
15
+  onToggleChange: Function;
16
+  dataSource: Array<{
17
+    id?: string|number;
18
+    user_avatar?: string;
19
+    bill_price?: number;
20
+  }>;
21
+  listLength: number;
22
+  showLength: number;
23
+  options: {
24
+    avatarSize: number,
25
+    avatarMarginLeftAndRight: number,
26
+    kingdomWidth: number,
27
+    kingdomHeight: number,
28
+    kingdomPosition: [number, number],
29
+  },
30
+}
31
+
32
+class ConsumeListView extends Component<Props> {
33
+  static defaultProps: Props = {
34
+    isToggle: false,
35
+    onToggleChange: () => {},
36
+    dataSource: [],
37
+    listLength: 0,
38
+    showLength: 6,
39
+    options: {
40
+      avatarSize: 36,
41
+      avatarMarginLeftAndRight: 6,
42
+      kingdomWidth: 24,
43
+      kingdomHeight: 22,
44
+      kingdomPosition: [-6, -12],
45
+    },
46
+  }
47
+
48
+  renderConsumeItem() {
49
+    const {
50
+      dataSource,
51
+      isToggle,
52
+      showLength,
53
+      listLength,
54
+      options,
55
+    } = this.props;
56
+    const {
57
+      kingdomWidth,
58
+      kingdomHeight,
59
+      kingdomPosition,
60
+      avatarSize,
61
+      avatarMarginLeftAndRight,
62
+    } = options;
63
+
64
+    let renderData = dataSource;
65
+    if (!isToggle && listLength > showLength) {
66
+      renderData = dataSource.slice(0, showLength - 1);
67
+    }
68
+
69
+    return renderData.map((v, i) => {
70
+      let kingdom = null;
71
+      if (i === 0) {
72
+        kingdom = (
73
+          <img
74
+            className={styles.kingdomIcon}
75
+            src={KingDomPic}
76
+            alt="reward top user"
77
+            style={{
78
+              width: `${kingdomWidth}px`,
79
+              height: `${kingdomHeight}px`,
80
+              left: `${kingdomPosition[0]}px`,
81
+              top: `${kingdomPosition[1]}px`,
82
+            }}
83
+          />
84
+        );
85
+      }
86
+      return (
87
+        <li
88
+          key={v.id}
89
+          className={styles.consumeItem}
90
+          style={{ margin: `0 ${avatarMarginLeftAndRight}px 10px` }}
91
+        >
92
+          {kingdom}
93
+          <div
94
+            className={styles.avatar}
95
+            style={{
96
+              backgroundImage: `url(${addImageProcess(
97
+                v.user_avatar || DEFAULT_AVATAR,
98
+                {
99
+                  small: true,
100
+                },
101
+              )})`,
102
+              width: `${avatarSize}px`,
103
+              height: `${avatarSize}px`,
104
+            }}
105
+          />
106
+          <span className={styles.gray}>
107
+            {/* {intl.get('bilingually.gift.item', {
108
+              nums: v.bill_price / 100,
109
+            }) /* {item.num}另币 */}
110
+          </span>
111
+        </li>
112
+      );
113
+    });
114
+  }
115
+
116
+  renderToggleButton() {
117
+    const {
118
+      isToggle,
119
+      onToggleChange,
120
+      listLength,
121
+      showLength,
122
+      options,
123
+    } = this.props;
124
+    const { avatarSize, avatarMarginLeftAndRight } = options;
125
+
126
+    if (listLength <= showLength) {
127
+      return null;
128
+    }
129
+
130
+    return (
131
+      <li
132
+        onClick={() => onToggleChange()}
133
+        className={classnames(styles.toggle, {
134
+          [styles.expand]: isToggle,
135
+        })}
136
+        style={{
137
+          width: `${avatarSize}px`,
138
+          height: `${avatarSize}px`,
139
+          lineHeight: `${avatarSize}px`,
140
+          margin: `0 ${avatarMarginLeftAndRight}px 10px`,
141
+        }}
142
+      />
143
+    );
144
+  }
145
+
146
+  render() {
147
+    const { showLength, options } = this.props;
148
+    const { avatarSize, avatarMarginLeftAndRight } = options;
149
+    return (
150
+      <div className={styles.wrapper}>
151
+        <ul
152
+          className={styles.consumelist}
153
+          style={{
154
+            width: `calc(${avatarMarginLeftAndRight * 2 +
155
+              avatarSize}px * ${showLength})`,
156
+          }}
157
+        >
158
+          {this.renderConsumeItem()}
159
+          {this.renderToggleButton()}
160
+        </ul>
161
+      </div>
162
+    );
163
+  }
164
+}
165
+
166
+export default ConsumeListView;

+ 101
- 0
src/components/Payment/Common/PayPlatformOptions/PayPlatformOptions.less View File

@@ -0,0 +1,101 @@
1
+.flexContainer {
2
+  display: flex;
3
+  justify-content: space-around;
4
+  align-items: center;
5
+
6
+  .flexItem {
7
+
8
+  }
9
+}
10
+
11
+
12
+.label {
13
+  font-size: 14px;
14
+  font-weight: 400;
15
+  color: #616A79;
16
+}
17
+.payment-method-box {
18
+  padding: 20px 10px 10px 10px;
19
+  text-align: center;
20
+
21
+  .payment-method {
22
+      display: inline-block;
23
+      margin: 0;
24
+      width: 60%;
25
+      vertical-align: middle;
26
+      &-before {
27
+          // TODO pseudo doesn't work
28
+          // content: '';
29
+          display: inline-block;
30
+          height: 100%;
31
+          vertical-align: middle;
32
+      }
33
+  }
34
+
35
+  .payitem {
36
+      display: flex;
37
+      justify-content: center;
38
+      align-items: center;
39
+      cursor: pointer;
40
+      border: 1px solid transparent;
41
+      height: 66px;
42
+      line-height: 66px;
43
+
44
+      .platformName {
45
+        text-align: center;
46
+        white-space: nowrap;
47
+      }
48
+
49
+      &.small {
50
+        width: 88px;
51
+        height: 36px;
52
+        line-height: 36px;
53
+        
54
+        .payment-method {
55
+          margin: 0;
56
+        }
57
+      }
58
+
59
+      &.active {
60
+          border-radius: 5px;
61
+          border-color:#1790FF;
62
+          box-shadow: 0px 2px 6px 0px rgba(163,163,163,0.3);
63
+      }
64
+
65
+      &.en {
66
+        font-size: 12px;
67
+      }
68
+  }
69
+
70
+  &.mobile {
71
+      padding: 8px 10px 10px 8px;
72
+      .payitem {
73
+          display: inline-block;
74
+          width: 78px;
75
+          height: 80px;
76
+          border: 1px solid transparent;
77
+
78
+          &.active {
79
+              border-radius: 4px;
80
+              border-color: #1790FF;
81
+          }
82
+
83
+          .payment-method {
84
+              display: inline-block;
85
+              width: 34px;
86
+              height: 34px;
87
+          }
88
+      }
89
+  }
90
+}
91
+
92
+@media (max-width: 768px) {
93
+  .payitem {
94
+      cursor: pointer;
95
+      border: 1px solid transparent;
96
+      &.active {
97
+          border-radius: 5px;
98
+          border-color:#1790FF;
99
+      }
100
+  }
101
+}

+ 3
- 0
src/components/Payment/Common/PayPlatformOptions/README.md View File

@@ -0,0 +1,3 @@
1
+# PayPlatformOptions
2
+
3
+- 简单介绍

+ 231
- 0
src/components/Payment/Common/PayPlatformOptions/index.tsx View File

@@ -0,0 +1,231 @@
1
+import React, { PureComponent } from "react";
2
+import classnames from "classnames";
3
+import { FormattedMessage } from "react-intl";
4
+
5
+import iconAlipay from "../assets/kcxq_popovers_icon_alipay@2x.png";
6
+import iconWechatpay from "../assets/kcxq_popovers_icon_wechatpay@2x.png";
7
+import iconPaypal from "../assets/kcxq_popovers_icon_paypal@2x.png";
8
+import mobileIconAlipay from "../assets/payment_btn_pay_alipay@2x.png";
9
+import mobileIconWechatpay from "../assets/payment_btn_pay_wechatpay@2x.png";
10
+import mobileIconPaypal from "../assets/payment_btn_pay_paypal@2x.png";
11
+
12
+import styles from "./PayPlatformOptions.less";
13
+
14
+type PAY_CHANNEL_VALUE =
15
+  | "PAYPAL_PAYPAL"
16
+  | "ALI_WEB"
17
+  | "ALI_WAP"
18
+  | "WX_WAP"
19
+  | "WX_NATIVE";
20
+type PAY_CHANNEL_TYPE = {
21
+  PAYPAL: PAY_CHANNEL_VALUE;
22
+  ALI_WEB: PAY_CHANNEL_VALUE;
23
+  ALI_WAP: PAY_CHANNEL_VALUE;
24
+  WX_WAP: PAY_CHANNEL_VALUE;
25
+  WX_NATIVE: PAY_CHANNEL_VALUE;
26
+};
27
+
28
+type Props = {
29
+  payitem: PAY_CHANNEL_VALUE;
30
+  onPayItemChange: (value: PAY_CHANNEL_VALUE) => void;
31
+  isMobile: boolean;
32
+  size: "small" | "normal" | "large";
33
+  withTitle: boolean;
34
+  locale: "zh" | "en";
35
+};
36
+
37
+export const PAY_CHANNEL: PAY_CHANNEL_TYPE = {
38
+  PAYPAL: "PAYPAL_PAYPAL", // PAYPAL_LIVE
39
+  ALI_WEB: "ALI_WEB",
40
+  ALI_WAP: "ALI_WAP",
41
+  WX_WAP: "WX_WAP",
42
+  WX_NATIVE: "WX_NATIVE"
43
+};
44
+
45
+class PayPlatformOptions extends PureComponent<Props, {}> {
46
+  render() {
47
+    const {
48
+      payitem,
49
+      onPayItemChange,
50
+      isMobile = false,
51
+      size = "normal",
52
+      withTitle = true,
53
+      locale = "zh"
54
+    } = this.props;
55
+
56
+    let titleDOM = null;
57
+    if (withTitle) {
58
+      titleDOM = (
59
+        <div className={styles.label}>
60
+          <FormattedMessage id="pay.channel.select.text" />
61
+        </div>
62
+      );
63
+    }
64
+
65
+    if (isMobile) {
66
+      return (
67
+        <div>
68
+          {titleDOM}
69
+          <div
70
+            className={classnames(styles["payment-method-box"], {
71
+              [styles.mobile]: isMobile
72
+            })}
73
+          >
74
+            <div className={styles.flexContainer}>
75
+              <div className={styles.flexItem}>
76
+                <div
77
+                  className={classnames(
78
+                    {
79
+                      [styles.payitem]: true,
80
+                      [styles.active]: payitem === PAY_CHANNEL.ALI_WEB,
81
+                      [styles.small]: size === "small"
82
+                    },
83
+                    styles[locale]
84
+                  )}
85
+                  onClick={() => {
86
+                    onPayItemChange(PAY_CHANNEL.ALI_WEB);
87
+                  }}
88
+                >
89
+                  <img
90
+                    src={mobileIconAlipay}
91
+                    alt="alipay"
92
+                    className={styles["payment-method"]}
93
+                  />
94
+                  <div className={styles.platformName}>
95
+                    <FormattedMessage id="pay.channel.ali" />
96
+                  </div>
97
+                </div>
98
+              </div>
99
+              <div className={styles.flexItem}>
100
+                <div
101
+                  className={classnames(
102
+                    {
103
+                      [styles.payitem]: true,
104
+                      [styles.active]: payitem === PAY_CHANNEL.WX_NATIVE,
105
+                      [styles.small]: size === "small"
106
+                    },
107
+                    styles[locale]
108
+                  )}
109
+                  onClick={() => {
110
+                    onPayItemChange(PAY_CHANNEL.WX_NATIVE);
111
+                  }}
112
+                >
113
+                  <img
114
+                    src={mobileIconWechatpay}
115
+                    alt="wechatpay"
116
+                    className={styles["payment-method"]}
117
+                  />
118
+                  <div className={styles.platformName}>
119
+                    <FormattedMessage id="pay.channel.wechat" />
120
+                  </div>
121
+                </div>
122
+              </div>
123
+              <div className={styles.flexItem}>
124
+                <div
125
+                  className={classnames(
126
+                    {
127
+                      [styles.payitem]: true,
128
+                      [styles.active]: payitem === PAY_CHANNEL.PAYPAL,
129
+                      [styles.small]: size === "small"
130
+                    },
131
+                    styles[locale]
132
+                  )}
133
+                  onClick={() => {
134
+                    onPayItemChange(PAY_CHANNEL.PAYPAL);
135
+                  }}
136
+                >
137
+                  <img
138
+                    src={mobileIconPaypal}
139
+                    alt="paypal"
140
+                    className={styles["payment-method"]}
141
+                  />
142
+                  <div className={styles.platformName}>
143
+                    <FormattedMessage id="pay.channel.paypal" />
144
+                  </div>
145
+                </div>
146
+              </div>
147
+            </div>
148
+          </div>
149
+        </div>
150
+      );
151
+    }
152
+
153
+    return (
154
+      <div>
155
+        {titleDOM}
156
+        <div className={styles["payment-method-box"]}>
157
+          <div className={styles.flexContainer}>
158
+            <div className={styles.flexItem}>
159
+              <div
160
+                className={classnames(
161
+                  {
162
+                    [styles.payitem]: true,
163
+                    [styles.active]: payitem === PAY_CHANNEL.ALI_WEB,
164
+                    [styles.small]: size === "small"
165
+                  },
166
+                  styles[locale]
167
+                )}
168
+                onClick={() => {
169
+                  onPayItemChange(PAY_CHANNEL.ALI_WEB);
170
+                }}
171
+              >
172
+                <span className={styles["payment-method-before"]} />
173
+                <img
174
+                  src={iconAlipay}
175
+                  alt="alipay"
176
+                  className={styles["payment-method"]}
177
+                />
178
+              </div>
179
+            </div>
180
+            <div className={styles.flexItem}>
181
+              <div
182
+                className={classnames(
183
+                  {
184
+                    [styles.payitem]: true,
185
+                    [styles.active]: payitem === PAY_CHANNEL.WX_NATIVE,
186
+                    [styles.small]: size === "small"
187
+                  },
188
+                  styles[locale]
189
+                )}
190
+                onClick={() => {
191
+                  onPayItemChange(PAY_CHANNEL.WX_NATIVE);
192
+                }}
193
+              >
194
+                <span className={styles["payment-method-before"]} />
195
+                <img
196
+                  src={iconWechatpay}
197
+                  alt="wechatpay"
198
+                  className={styles["payment-method"]}
199
+                />
200
+              </div>
201
+            </div>
202
+            <div className={styles.flexItem}>
203
+              <div
204
+                className={classnames(
205
+                  {
206
+                    [styles.payitem]: true,
207
+                    [styles.active]: payitem === PAY_CHANNEL.PAYPAL,
208
+                    [styles.small]: size === "small"
209
+                  },
210
+                  styles[locale]
211
+                )}
212
+                onClick={() => {
213
+                  onPayItemChange(PAY_CHANNEL.PAYPAL);
214
+                }}
215
+              >
216
+                <span className={styles["payment-method-before"]} />
217
+                <img
218
+                  src={iconPaypal}
219
+                  alt="paypal"
220
+                  className={styles["payment-method"]}
221
+                />
222
+              </div>
223
+            </div>
224
+          </div>
225
+        </div>
226
+      </div>
227
+    );
228
+  }
229
+}
230
+
231
+export default PayPlatformOptions;

+ 133
- 0
src/components/Payment/Common/PriceOptions/PriceOptions.less View File

@@ -0,0 +1,133 @@
1
+@item_width: 70px;
2
+@item_margin: 6px;
3
+.options{
4
+  padding: 20px 50px;
5
+  border-bottom: 1px dashed #00000017;
6
+  p {
7
+    font-size:14px;
8
+    font-weight:400;
9
+    color:rgba(97,106,121,1);
10
+    margin-bottom: 20px;
11
+  }
12
+  .infoItem {
13
+    padding-right: 0;
14
+    .priceItem {
15
+      background:rgba(243,243,243,0.14);
16
+      border-radius:4px;
17
+      border:1px solid rgba(207,207,207,1);
18
+      font-size:14px;
19
+      font-weight:600;
20
+      color:rgba(97,106,121,1);
21
+      display: inline-block;
22
+      text-align: center;
23
+      vertical-align: top;
24
+      height: 30px;
25
+      width: @item_width;
26
+      line-height: 30px;
27
+      cursor: pointer;
28
+      margin: @item_margin;
29
+
30
+      &.active {
31
+        background:rgba(255,50,102,0.1);
32
+        border-radius:4px;
33
+        border:1px solid rgba(255,50,102,1);
34
+        color:rgba(97,106,121,1);
35
+      }
36
+    }
37
+    .priceInput {
38
+        display: inline-block;
39
+        min-width: 70px;
40
+        width: auto;
41
+        margin: @item_margin;
42
+        text-align: center;
43
+    }
44
+    button {
45
+        border-top-left-radius: 0;
46
+        border-bottom-left-radius: 0;
47
+        height: 30px;
48
+        width: 50px;
49
+        vertical-align: top;
50
+        padding: 0 5px;
51
+    }
52
+    .rate {
53
+        margin-left: 10px;
54
+        i {
55
+            margin-right: 5px;
56
+            color: #1790FF;
57
+        }
58
+    }
59
+  }
60
+
61
+  &.small {
62
+    @item_width: 72px;
63
+    @item_margin: 19px;
64
+
65
+    padding: 0 0 12px 0;
66
+    // padding: 12px 20px;
67
+    border-bottom: none;
68
+    p {
69
+      margin-bottom: 8px;
70
+    }
71
+    .infoItem {
72
+      text-align: center;
73
+
74
+      .priceItem {
75
+        border-radius:6px;
76
+        height: 32px;
77
+        width: @item_width;
78
+        margin: 0 0 (@item_margin - 7px) @item_margin;
79
+      }
80
+      .priceItem:first-child{
81
+        margin: 0 0 (@item_margin - 7px) 0px;
82
+      }
83
+
84
+      .priceInput {
85
+        display: block;
86
+        width: @item_width*3+@item_margin*2;
87
+        border-radius: 6px;
88
+        height: 32px;
89
+      }
90
+    }
91
+  }
92
+}
93
+
94
+@media (max-width: 768px) {
95
+  .options {
96
+    padding: 20px 20px;
97
+    p{
98
+      font-size:14px;
99
+      font-weight:400;
100
+      color:rgba(97,106,121,1);
101
+    }
102
+    .infoItem {
103
+      padding-right: 0;
104
+      display: flex;
105
+      flex-direction: column;
106
+      justify-content: center;
107
+      .priceBtn{
108
+        display: flex;
109
+        justify-content: space-between;
110
+      }
111
+      .priceItem {
112
+        display: inline-block;
113
+        background-color: #fff;
114
+        width:74px;
115
+        height:36px;
116
+        line-height: 36px;
117
+        border-radius:6px;
118
+        border:1px solid rgba(207,207,207,1);
119
+          &.active {
120
+          background-color: #fff;
121
+          color: #FF3266FF;
122
+          border-radius:4px;
123
+          border:1px solid rgba(255,50,102,1);
124
+        }
125
+      }
126
+      .priceInput {
127
+        border-radius:6px;
128
+        height: 36px;
129
+        width: auto;
130
+      }
131
+    }
132
+  }
133
+}

+ 3
- 0
src/components/Payment/Common/PriceOptions/README.md View File

@@ -0,0 +1,3 @@
1
+# PriceOptions
2
+
3
+- 简单介绍

+ 96
- 0
src/components/Payment/Common/PriceOptions/index.tsx View File

@@ -0,0 +1,96 @@
1
+import React, { useState } from 'react';
2
+import { Input } from 'antd';
3
+import { FormattedMessage, useIntl } from 'react-intl';
4
+import classnames from 'classnames';
5
+import { formatMoney } from '../../Utils/utils';
6
+
7
+import styles from './PriceOptions.less';
8
+
9
+type Props = {
10
+  price: number;
11
+  onPriceChange: (v: number) => void;
12
+  size: "small" | "normal" | "large";
13
+  focusScroll: boolean;
14
+  withTitle: boolean;
15
+  inputRef: React.RefObject<Input>;
16
+}
17
+
18
+const PriceOptions = ({
19
+  price,
20
+  onPriceChange,
21
+  size = 'normal',
22
+  focusScroll = true,
23
+  withTitle = true,
24
+  inputRef,
25
+}: Props) => {
26
+  const intl = useIntl();
27
+  const defaultOptions = [100, 600, 800];
28
+  // 控制是否为其他金额输入情况
29
+  const [inputStatus, setInputStatus] = useState(false);
30
+
31
+  return (
32
+    <div
33
+      className={classnames(styles.options, {
34
+        [styles[size]]: true,
35
+      })}
36
+    >
37
+      {withTitle ? <p><FormattedMessage id="pay.price.select.text" /></p> : null}
38
+      <div className={styles.infoItem} style={{ marginBottom: '-12px' }}>
39
+        <span className={styles.priceBtn}>
40
+          {defaultOptions.map(item => (
41
+            <span
42
+              className={classnames({
43
+                [styles.priceItem]: true,
44
+                [styles.active]: price === item && !inputStatus,
45
+              })}
46
+              key={item}
47
+              onClick={() => {
48
+                onPriceChange(item);
49
+                setInputStatus(false);
50
+              }}
51
+            >
52
+              <FormattedMessage
53
+                id="pay.price.money.text"
54
+                values={{
55
+                  value: formatMoney(item / 100, 0)
56
+                }}
57
+              />
58
+            </span>
59
+          ))}
60
+        </span>
61
+        <Input
62
+          ref={inputRef}
63
+          onMouseEnter={() => {
64
+            if (inputStatus && inputRef && inputRef.current) {
65
+              inputRef.current.focus();
66
+              inputRef.current.select();
67
+            }
68
+          }}
69
+          suffix="¥"
70
+          className={styles.priceInput}
71
+          value={inputStatus ? (price / 100 || '') : ''}
72
+          placeholder={intl.formatMessage({ id: 'pay.price.money.others' })}
73
+          onChange={e => {  
74
+            const n = +e.target.value;
75
+            if (Number.isNaN(n)) {
76
+              return;
77
+            }
78
+            // 测试暂时改成1分
79
+            onPriceChange(n * 100);
80
+          }}
81
+          onClick={e => {
82
+            onPriceChange(0);
83
+            setInputStatus(true);
84
+          }}
85
+          onFocus={e => {
86
+            if (focusScroll) {
87
+              e.target.scrollIntoView();
88
+            }
89
+          }}
90
+        />
91
+      </div>
92
+    </div>
93
+  );
94
+};
95
+
96
+export default PriceOptions;

+ 3
- 0
src/components/Payment/Common/WaitPayInfoView/README.md View File

@@ -0,0 +1,3 @@
1
+# WaitPayInfoView
2
+
3
+简单介绍

+ 7
- 0
src/components/Payment/Common/WaitPayInfoView/WaitPayInfoView.less View File

@@ -0,0 +1,7 @@
1
+.waitingContainer {
2
+  display: flex;
3
+  flex-direction: column;
4
+  justify-content: center;
5
+  align-items: center;
6
+
7
+}

+ 56
- 0
src/components/Payment/Common/WaitPayInfoView/index.tsx View File

@@ -0,0 +1,56 @@
1
+import React, { Component } from 'react';
2
+import { Button } from 'antd';
3
+import classnames from 'classnames';
4
+import styles from './WaitPayInfoView.less';
5
+
6
+import infoIconImg from '../assets/icon-info-blue@2x.svg';
7
+
8
+type Props = {
9
+  onClickPayed?: Function;
10
+  onClickProblem?: Function;
11
+}
12
+
13
+export class WaitPayInfoView extends Component<Props, {}> {
14
+  static defaultProps = {
15
+    onClickPayed: () => { console.log("onClickPayed"); },
16
+    onClickProblem: () => { console.log("onClickProblem"); }
17
+  }
18
+
19
+  render() {
20
+    const { onClickPayed, onClickProblem } = this.props;
21
+
22
+    return (
23
+      <div className={styles.waitingContainer}>
24
+        <div className={styles.infoIconImgContainer}>
25
+          <img src={infoIconImg} alt="info label icon" />
26
+        </div>
27
+        <div>
28
+          <div className={styles.pay_text}>
29
+            {"live.course_info.pay.notification"}
30
+          </div>
31
+          <div className={styles.btn_row}>
32
+            <Button
33
+              className={classnames(styles.pay_btn, styles.btn_default)}
34
+              size="small"
35
+              onClick={() => { onClickPayed && onClickPayed() }}
36
+            >
37
+              {"live.course_info.pay.payed"}
38
+            </Button>
39
+            <Button
40
+              className={styles.btn_default}
41
+              size="small"
42
+              style={{
43
+                marginLeft: '16px',
44
+              }}
45
+              onClick={() => { onClickProblem && onClickProblem() }}
46
+            >
47
+              {"live.course_info.pay.help"}
48
+            </Button>
49
+          </div>
50
+        </div>
51
+      </div>
52
+    );
53
+  }
54
+}
55
+
56
+export default WaitPayInfoView;

BIN
src/components/Payment/Common/assets/btn_toggle.png View File


+ 19
- 0
src/components/Payment/Common/assets/icon-info-blue@2x.svg View File

@@ -0,0 +1,19 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<svg width="48px" height="43px" viewBox="0 0 48 43" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+    <!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
4
+    <title>kcxq_popovers_icon_tanhao</title>
5
+    <desc>Created with Sketch.</desc>
6
+    <defs></defs>
7
+    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
8
+        <g id="另客网_直播课_课程介绍详情_购买提示弹窗" transform="translate(-936.000000, -190.000000)" fill-rule="nonzero">
9
+            <g id="Group-22" transform="translate(690.000000, 110.000000)">
10
+                <g id="kcxq_popovers_icon_tanhao" transform="translate(246.000000, 80.000000)">
11
+                    <path d="M48,21.5 C48,33.3736626 38.3645756,43 26.4797048,43 C21.1306273,43 17.0391144,42.1506173 13.2841328,38.9300412 C11.8140221,37.6736626 1.700369,43.2123457 0.177121771,39.2839506 C-1.06273063,36.0987654 5.95129151,29.2506173 5.31365314,27.0740741 C4.76457565,25.1806584 4.95940959,23.5703704 4.95940959,21.5 C4.95940959,9.62633745 14.5948339,0 26.4797048,0 C38.3645756,0 48,9.62633745 48,21.5 Z" id="Shape" fill="#1790FF"></path>
12
+                    <g id="Group" transform="translate(23.848708, 8.193416)" fill="#FFFFFF">
13
+                        <path d="M2.5,27.4971098 C1.13235294,27.4971098 0,26.3794628 0,24.9971098 C0,23.6147569 1.13235294,22.4971098 2.5,22.4971098 C3.86764706,22.4971098 5,23.6147569 5,24.9971098 C5,26.3794628 3.86764706,27.4971098 2.5,27.4971098 Z M2.5,19.4219653 C1.13235294,19.4219653 0,18.1919075 0,16.6705202 L0,2.75144509 C0,1.24624277 1.13235294,0 2.5,0 C3.86764706,0 5,1.2300578 5,2.75144509 L5,16.6705202 C5,18.1919075 3.86764706,19.4219653 2.5,19.4219653 Z" id="Shape"></path>
14
+                    </g>
15
+                </g>
16
+            </g>
17
+        </g>
18
+    </g>
19
+</svg>

BIN
src/components/Payment/Common/assets/kcxq_popovers_icon_alipay@2x.png View File


BIN
src/components/Payment/Common/assets/kcxq_popovers_icon_paypal@2x.png View File


BIN
src/components/Payment/Common/assets/kcxq_popovers_icon_wechatpay@2x.png View File


BIN
src/components/Payment/Common/assets/payment_btn_pay_alipay@2x.png View File


BIN
src/components/Payment/Common/assets/payment_btn_pay_paypal@2x.png View File


BIN
src/components/Payment/Common/assets/payment_btn_pay_wechatpay@2x.png View File


BIN
src/components/Payment/Common/assets/popovers_list_huangguan.png View File


+ 36
- 0
src/components/Payment/Utils/utils.ts View File

@@ -0,0 +1,36 @@
1
+
2
+export const IMAGE_PROCESS = '?x-oss-process=image/resize,h_350';
3
+export const IMAGE_PROCESS_SMALL = '?x-oss-process=image/resize,h_100';
4
+export const IMAGE_PROCESS_LARGE = '?x-oss-process=image/resize,h_500';
5
+
6
+type AddImageProcessOptions = {
7
+  small?: boolean;
8
+  large?: boolean;
9
+  custom?: boolean;
10
+  width?: string;
11
+  height?: string;
12
+}
13
+
14
+export function addImageProcess(url: string, options: AddImageProcessOptions = { width: '36px', height: '36px' }) {
15
+  // 防止重复添加导致的url不正确
16
+  if (url && url.indexOf('x-oss-process') > -1) {
17
+    return url;
18
+  }
19
+  if (options.small) {
20
+    return url + IMAGE_PROCESS_SMALL;
21
+  }
22
+  if (options.large) {
23
+    return url + IMAGE_PROCESS_LARGE;
24
+  }
25
+  if (options.custom) {
26
+    return `${url}?x-oss-process=image/resize,limit_0,m_fill,w_${options.width},h_${options.height}`;
27
+  }
28
+  return url + IMAGE_PROCESS;
29
+}
30
+
31
+export function formatMoney(input: any, fuzz = 2) {
32
+  if (isNaN(+input)) {
33
+    return input;
34
+  }
35
+  return (+input).toFixed(fuzz);
36
+}

+ 4
- 0
src/components/Payment/index.ts View File

@@ -0,0 +1,4 @@
1
+export { default as ConsumeListView } from './Common/ConsumeListView';
2
+export { default as PayPlatformOptions } from './Common/PayPlatformOptions';
3
+export { default as PriceOptions } from './Common/PriceOptions';
4
+export { default as WaitPayInfoView } from './Common/WaitPayInfoView';

+ 9
- 0
src/lang/en.json View File

@@ -0,0 +1,9 @@
1
+{
2
+  "pay.channel.select.text": "Select Your Platform",
3
+  "pay.channel.ali": "Alipay",
4
+  "pay.channel.wechat": "WeChat Pay",
5
+  "pay.channel.paypal": "PayPal",
6
+  "pay.price.select.text": "Select Your Reward",
7
+  "pay.price.money.text": "{value}¥",
8
+  "pay.price.money.others": "others value"
9
+}

+ 9
- 0
src/lang/zh.json View File

@@ -0,0 +1,9 @@
1
+{
2
+  "pay.channel.select.text": "选择你的支付平台",
3
+  "pay.channel.ali": "支付宝",
4
+  "pay.channel.wechat": "微信",
5
+  "pay.channel.paypal": "PayPal",
6
+  "pay.price.select.text": "选择打赏金额",
7
+  "pay.price.money.text": "{value}¥",
8
+  "pay.price.money.others": "其他金额"
9
+}

+ 3
- 0
src/lib-build.js View File

@@ -0,0 +1,3 @@
1
+export { Test } from '@components/Common/test.tsx';
2
+export * from '@components/Common/index.ts';
3
+export * from '@components/Payment/index.ts';

+ 11
- 0
src/typings/index.d.ts View File

@@ -0,0 +1,11 @@
1
+declare module "*.png";
2
+declare module "*.svg";
3
+
4
+declare module "*.less";
5
+
6
+declare module "*.json";
7
+
8
+declare module "*.md";
9
+
10
+declare module 'storybook-addon-intl';
11
+declare module '@storybook/addon-console';

+ 5
- 0
tsconfig.json View File

@@ -19,6 +19,11 @@
19 19
     "noEmit": true,
20 20
     "jsx": "react"
21 21
   },
22
+  "baseUrl": ".",
23
+  "paths": {
24
+    "@/*": [ "src/*" ],
25
+    "@components/*": [ "src/components/*" ]
26
+  },
22 27
   "include": [
23 28
     "src"
24 29
   ]

+ 1108
- 266
yarn.lock
File diff suppressed because it is too large
View File