@kmkf-fe-packages/kmkf-utils 0.7.1-alpha.0 → 0.7.1-alpha.4
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.
package/README.md
CHANGED
|
@@ -14,8 +14,18 @@ export default class logisticsAddressData {
|
|
|
14
14
|
constructor();
|
|
15
15
|
initData: () => OptionsItem[] | undefined;
|
|
16
16
|
getAddressData: () => OptionsItem[] | undefined;
|
|
17
|
-
|
|
17
|
+
setaddressData: (val: OptionsItem[]) => OptionsItem[];
|
|
18
18
|
getItemByUk: (uk: string) => OptionsItem | undefined;
|
|
19
|
+
getCpListByCompany(company: string): OptionsItem[];
|
|
20
|
+
getUkByInfo({ cpCode, province, city, district, detail, userName, mobile, }: {
|
|
21
|
+
cpCode: string;
|
|
22
|
+
province: string | number;
|
|
23
|
+
city: string | number;
|
|
24
|
+
district: string | number;
|
|
25
|
+
detail: string;
|
|
26
|
+
userName: string;
|
|
27
|
+
mobile: string;
|
|
28
|
+
}): string;
|
|
19
29
|
static getInstance(): logisticsAddressData;
|
|
20
30
|
}
|
|
21
31
|
export {};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
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
2
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
3
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
4
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -8,6 +6,8 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
8
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
7
|
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); }
|
|
10
8
|
import request from "../request";
|
|
9
|
+
import address from "../addressData";
|
|
10
|
+
var Address = address.getInstance();
|
|
11
11
|
var logisticsAddressData = /*#__PURE__*/function () {
|
|
12
12
|
function logisticsAddressData() {
|
|
13
13
|
var _this = this;
|
|
@@ -21,13 +21,22 @@ var logisticsAddressData = /*#__PURE__*/function () {
|
|
|
21
21
|
data: {}
|
|
22
22
|
}).then(function (res) {
|
|
23
23
|
var data = res.data;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
// setTimeout(() => {
|
|
25
|
+
// const addressList = data.map((item: OptionsItem) => {
|
|
26
|
+
// return {
|
|
27
|
+
// ...item,
|
|
28
|
+
// label: `${Address.getNameByCode(item?.province) || ""}${
|
|
29
|
+
// Address.getNameByCode(item?.city) || ""
|
|
30
|
+
// }${Address.getNameByCode(item?.district) || ""}${item.detail} ${
|
|
31
|
+
// item?.userName
|
|
32
|
+
// }:${item?.mobile}`,
|
|
33
|
+
// value: item.uk,
|
|
34
|
+
// };
|
|
35
|
+
// });
|
|
36
|
+
|
|
37
|
+
// this.addressData = data;
|
|
38
|
+
// });
|
|
39
|
+
_this.addressData = data;
|
|
31
40
|
}).catch(function (e) {
|
|
32
41
|
console.log(e);
|
|
33
42
|
});
|
|
@@ -37,7 +46,7 @@ var logisticsAddressData = /*#__PURE__*/function () {
|
|
|
37
46
|
if (((_this$addressData = _this.addressData) === null || _this$addressData === void 0 ? void 0 : _this$addressData.length) > 0) return _this.addressData;
|
|
38
47
|
_this.initData();
|
|
39
48
|
});
|
|
40
|
-
_defineProperty(this, "
|
|
49
|
+
_defineProperty(this, "setaddressData", function (val) {
|
|
41
50
|
return _this.addressData = val;
|
|
42
51
|
});
|
|
43
52
|
_defineProperty(this, "getItemByUk", function (uk) {
|
|
@@ -47,7 +56,29 @@ var logisticsAddressData = /*#__PURE__*/function () {
|
|
|
47
56
|
});
|
|
48
57
|
this.initData();
|
|
49
58
|
}
|
|
50
|
-
_createClass(logisticsAddressData,
|
|
59
|
+
_createClass(logisticsAddressData, [{
|
|
60
|
+
key: "getCpListByCompany",
|
|
61
|
+
value: function getCpListByCompany(company) {
|
|
62
|
+
return (this.addressData || []).filter(function (item) {
|
|
63
|
+
return item.cpCode === company;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
key: "getUkByInfo",
|
|
68
|
+
value: function getUkByInfo(_ref) {
|
|
69
|
+
var _find;
|
|
70
|
+
var cpCode = _ref.cpCode,
|
|
71
|
+
province = _ref.province,
|
|
72
|
+
city = _ref.city,
|
|
73
|
+
district = _ref.district,
|
|
74
|
+
detail = _ref.detail,
|
|
75
|
+
userName = _ref.userName,
|
|
76
|
+
mobile = _ref.mobile;
|
|
77
|
+
return ((_find = (this.addressData || []).find(function (item) {
|
|
78
|
+
return item.cpCode == cpCode && item.province == province && item.city == city && item.district == district && item.detail == detail && item.userName == userName && item.mobile == mobile;
|
|
79
|
+
})) === null || _find === void 0 ? void 0 : _find.uk) || "";
|
|
80
|
+
}
|
|
81
|
+
}], [{
|
|
51
82
|
key: "getInstance",
|
|
52
83
|
value: function getInstance() {
|
|
53
84
|
if (!logisticsAddressData.instance) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/kmkf-utils",
|
|
3
|
-
"version": "0.7.1-alpha.
|
|
3
|
+
"version": "0.7.1-alpha.4",
|
|
4
4
|
"module": "dist/esm/index.js",
|
|
5
5
|
"typings": "dist/esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"gitHooks": {
|
|
43
43
|
"pre-commit": "lint-staged"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "cfcd8b059aa1b677c22edbff10af2fde967c2c6d"
|
|
46
46
|
}
|