@kmkf-fe-packages/services-components 0.3.1-alpha.8 → 0.3.1-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ declare type PlatBuyerProp = {
3
+ shopId: string;
4
+ buyerNick: string;
5
+ buyerOpenUid: string;
6
+ shopList: any[];
7
+ };
8
+ declare const PlatBuyer: ({ shopId, buyerNick, buyerOpenUid, shopList }: PlatBuyerProp) => JSX.Element;
9
+ export default PlatBuyer;
@@ -0,0 +1,45 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ import React, { useMemo } from 'react';
8
+ import { CopyOutlined } from '@ant-design/icons';
9
+ import { message } from 'antd';
10
+ import { CopyToClipboard } from 'react-copy-to-clipboard';
11
+ import { PlatData } from '@kmkf-fe-packages/kmkf-utils';
12
+ import Wangwang from "../Wangwang";
13
+ var PlatBuyer = function PlatBuyer(_ref) {
14
+ var _platInfo$shopId;
15
+ var shopId = _ref.shopId,
16
+ buyerNick = _ref.buyerNick,
17
+ buyerOpenUid = _ref.buyerOpenUid,
18
+ shopList = _ref.shopList;
19
+ var platList = PlatData.getInstance().getPlatData();
20
+ var platInfo = useMemo(function () {
21
+ var info = {};
22
+ (shopList || []).forEach(function (item) {
23
+ var plat = platList.find(function (t) {
24
+ return +t.platformType === +item.shopSource;
25
+ });
26
+ plat && (info[item.shopId] = _objectSpread({}, plat));
27
+ });
28
+ return info;
29
+ }, [platList, shopList]);
30
+ return (platInfo === null || platInfo === void 0 ? void 0 : (_platInfo$shopId = platInfo[shopId]) === null || _platInfo$shopId === void 0 ? void 0 : _platInfo$shopId.platformTypeStr) === 'TAOBAO' ? /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Wangwang, {
31
+ nick: buyerNick,
32
+ buyerOpenUid: buyerOpenUid
33
+ })) : /*#__PURE__*/React.createElement(CopyToClipboard, {
34
+ text: buyerNick,
35
+ onCopy: function onCopy() {
36
+ message.success('复制成功');
37
+ }
38
+ }, /*#__PURE__*/React.createElement("span", {
39
+ style: {
40
+ paddingLeft: '4px',
41
+ cursor: 'pointer'
42
+ }
43
+ }, /*#__PURE__*/React.createElement(CopyOutlined, null)));
44
+ };
45
+ export default PlatBuyer;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare type WangwangProps = {
3
+ nick: string;
4
+ buyerOpenUid: string;
5
+ };
6
+ declare const Wangwang: (props: WangwangProps) => JSX.Element;
7
+ export default Wangwang;
@@ -0,0 +1,31 @@
1
+ /*
2
+ * @Description:
3
+ * @Author: litian
4
+ * @Date: 2022-07-27 16:36:49
5
+ * @LastEditors: litian
6
+ * @LastEditTime: 2022-08-26 15:27:11
7
+ */
8
+ import React from 'react';
9
+ import wangImg from "./img/wang.gif";
10
+ var Wangwang = function Wangwang(props) {
11
+ var nick = props.nick,
12
+ buyerOpenUid = props.buyerOpenUid;
13
+ var isOSX = function isOSX() {
14
+ return /Mac OS X/i.test(navigator.userAgent);
15
+ };
16
+ var openWangwang = function openWangwang() {
17
+ var url = isOSX() ? "//amos.alicdn.com/getcid.aw?v=2&uid=".concat(decodeURIComponent(nick), "&site=cntaobao&s=1&groupid=0&openAppkey=21819818&openUID=").concat(buyerOpenUid, "&charset=utf-8") : "aliim:sendmsg?&touid=cntaobao".concat(decodeURIComponent(nick), "&siteid=cntaobao&status=2&portalId=&gid=&itemsId=&scene=&toRole=&source=light&client=false&encryptUID=&bizDomain=taobao&openAppkey=21819818&openUID=").concat(buyerOpenUid);
18
+ window.open(url);
19
+ };
20
+ return /*#__PURE__*/React.createElement("span", {
21
+ onClick: function onClick() {
22
+ openWangwang();
23
+ }
24
+ }, /*#__PURE__*/React.createElement("img", {
25
+ alt: "\u8BF7\u70B9\u51FB\u76F4\u63A5\u8BBF\u95EE",
26
+ src: wangImg
27
+ }), /*#__PURE__*/React.createElement("span", {
28
+ className: "fc_blue wangwangname"
29
+ }, nick));
30
+ };
31
+ export default Wangwang;
@@ -12,6 +12,7 @@ import React from 'react';
12
12
  import { BuyerNick } from '@kmkf-fe-packages/basic-components';
13
13
  import GetFormItem from "../GetFormItem";
14
14
  import ItemView from "../../commonComponents/ItemView";
15
+ import PlatBuyer from "../../commonComponents/PlatBuyer";
15
16
  import { isNull } from '@kmkf-fe-packages/kmkf-utils';
16
17
  var EBuyerNick = /*#__PURE__*/_createClass(function EBuyerNick(options) {
17
18
  var _this = this,
@@ -40,6 +41,7 @@ var EBuyerNick = /*#__PURE__*/_createClass(function EBuyerNick(options) {
40
41
  }) : null;
41
42
  });
42
43
  _defineProperty(this, "renderPc", function (value, record) {
44
+ var _this$effects;
43
45
  var buyerOpenUid = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_buyerOpenUid")];
44
46
  var buyerNick = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_buyerNick")];
45
47
  if (buyerNick === undefined && buyerOpenUid === undefined) {
@@ -48,22 +50,23 @@ var EBuyerNick = /*#__PURE__*/_createClass(function EBuyerNick(options) {
48
50
  return /*#__PURE__*/React.createElement("span", null, buyerNick && /*#__PURE__*/React.createElement(PlatBuyer, {
49
51
  shopId: record === null || record === void 0 ? void 0 : record.shopId,
50
52
  buyerNick: buyerNick,
51
- buyerOpenUid: buyerOpenUid
53
+ buyerOpenUid: buyerOpenUid,
54
+ shopList: (_this === null || _this === void 0 ? void 0 : (_this$effects = _this.effects) === null || _this$effects === void 0 ? void 0 : _this$effects.shopList) || []
52
55
  }));
53
56
  });
54
57
  _defineProperty(this, "renderExport", function (value, record) {
55
58
  return record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_buyerNick")];
56
59
  });
57
60
  _defineProperty(this, "editRender", function (value) {
58
- var _this$componentConfig, _this$componentConfig2, _this$effects, _this$effects2;
61
+ var _this$componentConfig, _this$componentConfig2, _this$effects2, _this$effects3;
59
62
  return /*#__PURE__*/React.createElement(GetFormItem, {
60
63
  title: _this.name,
61
64
  name: _this.id,
62
65
  rules: _this.rules,
63
66
  required: (_this$componentConfig = (_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.required) !== null && _this$componentConfig !== void 0 ? _this$componentConfig : false,
64
67
  component: /*#__PURE__*/React.createElement(BuyerNick, _extends({}, _this.componentConfig, {
65
- shopId: (_this$effects = _this.effects) === null || _this$effects === void 0 ? void 0 : _this$effects.shopId,
66
- shopList: (_this$effects2 = _this.effects) === null || _this$effects2 === void 0 ? void 0 : _this$effects2.shopList,
68
+ shopId: (_this$effects2 = _this.effects) === null || _this$effects2 === void 0 ? void 0 : _this$effects2.shopId,
69
+ shopList: (_this$effects3 = _this.effects) === null || _this$effects3 === void 0 ? void 0 : _this$effects3.shopList,
67
70
  onBlur: value === null || value === void 0 ? void 0 : value.onBlur
68
71
  }))
69
72
  });
@@ -11,6 +11,7 @@ declare class BuyerNick implements ComponentInterface {
11
11
  dataType: DataType;
12
12
  showContains: boolean;
13
13
  componentConfig: ComponentInterface["componentConfig"];
14
+ effects: ComponentInterface["effects"];
14
15
  align: ALignType;
15
16
  width: number;
16
17
  constructor(options: PickOption);
@@ -15,6 +15,7 @@ import React from 'react';
15
15
  import { ApaasInput } from '@kmkf-fe-packages/basic-components';
16
16
  import GetFormItem from "../GetFormItem";
17
17
  import ItemView from "../../commonComponents/ItemView";
18
+ import PlatBuyer from "../../commonComponents/PlatBuyer";
18
19
  import { isNull } from '@kmkf-fe-packages/kmkf-utils';
19
20
  var BuyerNick = /*#__PURE__*/_createClass(function BuyerNick(options) {
20
21
  var _this = this;
@@ -29,6 +30,7 @@ var BuyerNick = /*#__PURE__*/_createClass(function BuyerNick(options) {
29
30
  _defineProperty(this, "dataType", void 0);
30
31
  _defineProperty(this, "showContains", void 0);
31
32
  _defineProperty(this, "componentConfig", void 0);
33
+ _defineProperty(this, "effects", void 0);
32
34
  _defineProperty(this, "align", void 0);
33
35
  _defineProperty(this, "width", void 0);
34
36
  _defineProperty(this, "render", function (value) {
@@ -52,6 +54,7 @@ var BuyerNick = /*#__PURE__*/_createClass(function BuyerNick(options) {
52
54
  });
53
55
  });
54
56
  _defineProperty(this, "renderPc", function (value, record) {
57
+ var _this$effects;
55
58
  if (value === undefined) {
56
59
  return /*#__PURE__*/React.createElement("span", null, "--");
57
60
  }
@@ -68,7 +71,8 @@ var BuyerNick = /*#__PURE__*/_createClass(function BuyerNick(options) {
68
71
  return /*#__PURE__*/React.createElement("span", null, value && /*#__PURE__*/React.createElement(PlatBuyer, {
69
72
  shopId: record === null || record === void 0 ? void 0 : record.shopId,
70
73
  buyerNick: value,
71
- buyerOpenUid: buyerOpenUid
74
+ buyerOpenUid: buyerOpenUid,
75
+ shopList: (_this === null || _this === void 0 ? void 0 : (_this$effects = _this.effects) === null || _this$effects === void 0 ? void 0 : _this$effects.shopList) || []
72
76
  }));
73
77
  });
74
78
  _defineProperty(this, "renderExport", function (value) {
@@ -100,6 +104,7 @@ var BuyerNick = /*#__PURE__*/_createClass(function BuyerNick(options) {
100
104
  this.showContains = false;
101
105
  this.dataType = 'string';
102
106
  this.componentConfig = options.componentConfig;
107
+ this.effects = options.effects;
103
108
  this.rules = [];
104
109
  this.align = 'left';
105
110
  this.width = 200;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "0.3.1-alpha.8",
3
+ "version": "0.3.1-alpha.9",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@kmkf-fe-packages/basic-components": "^0.3.1-alpha.2",
25
- "@kmkf-fe-packages/kmkf-utils": "^0.3.1-alpha.2"
25
+ "@kmkf-fe-packages/kmkf-utils": "^0.3.1-alpha.9"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@ant-design/icons": "^4.7.0",
@@ -35,5 +35,5 @@
35
35
  "gitHooks": {
36
36
  "pre-commit": "lint-staged"
37
37
  },
38
- "gitHead": "a0d5e3494e12c801dd8fa11677aa8b56ad29333d"
38
+ "gitHead": "828d5931a29f07b5b9146946c6c482ec865103db"
39
39
  }