@fle-ui/plus-address-selection 1.0.1
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/LICENSE +1 -0
- package/README.md +17 -0
- package/es/index.d.ts +51 -0
- package/es/index.js +232 -0
- package/es/utils/httpClient.d.ts +13 -0
- package/es/utils/httpClient.js +76 -0
- package/es/utils/index.d.ts +2 -0
- package/es/utils/index.js +2 -0
- package/lib/index.d.ts +51 -0
- package/lib/index.js +241 -0
- package/lib/utils/httpClient.d.ts +13 -0
- package/lib/utils/httpClient.js +83 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +13 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MIT
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @fle-ui/plus-address-selection
|
|
2
|
+
|
|
3
|
+
> @fle-ui/plus-address-selection
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Using npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
$ npm install --save @fle-ui/plus-address-selection
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
or using yarn:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
$ yarn add @fle-ui/plus-address-selection
|
|
17
|
+
```
|
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CascaderProps } from 'antd';
|
|
3
|
+
export declare type CascaderValueType = string | (string | number)[];
|
|
4
|
+
export interface CascaderOptionType {
|
|
5
|
+
value?: string | number;
|
|
6
|
+
label?: React.ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
isLeaf?: boolean;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
children?: Array<CascaderOptionType>;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export interface addressItem {
|
|
14
|
+
value?: string | number;
|
|
15
|
+
code?: string | number;
|
|
16
|
+
name?: string | number;
|
|
17
|
+
label?: string;
|
|
18
|
+
tree?: string;
|
|
19
|
+
level?: string;
|
|
20
|
+
isLeaf?: boolean;
|
|
21
|
+
children?: addressItem[];
|
|
22
|
+
}
|
|
23
|
+
export interface SiteSelectProps extends Omit<CascaderProps<any>, 'options' | 'value'> {
|
|
24
|
+
/**
|
|
25
|
+
* @description 格式化value
|
|
26
|
+
* @default
|
|
27
|
+
*/
|
|
28
|
+
valueDivision?: string;
|
|
29
|
+
/**
|
|
30
|
+
* @description 接口地址 全地址哦
|
|
31
|
+
* @default
|
|
32
|
+
*/
|
|
33
|
+
apiUrl?: string;
|
|
34
|
+
/**
|
|
35
|
+
* @description 地址层级 默认四级
|
|
36
|
+
* @default 4
|
|
37
|
+
*/
|
|
38
|
+
level?: number;
|
|
39
|
+
/**
|
|
40
|
+
* @description 指定选中项
|
|
41
|
+
* @default []
|
|
42
|
+
*/
|
|
43
|
+
value?: CascaderValueType;
|
|
44
|
+
/**
|
|
45
|
+
* @description 可选项数据源
|
|
46
|
+
* @default []
|
|
47
|
+
*/
|
|
48
|
+
options?: CascaderOptionType[];
|
|
49
|
+
}
|
|
50
|
+
declare const AddressSelection: React.FC<SiteSelectProps>;
|
|
51
|
+
export default AddressSelection;
|
package/es/index.js
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
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
|
+
import "antd/es/cascader/style";
|
|
3
|
+
import _Cascader from "antd/es/cascader";
|
|
4
|
+
var _excluded = ["level", "value", "onChange", "valueDivision", "apiUrl", "defaultValue"];
|
|
5
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
7
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
11
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
12
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
13
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
18
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
20
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
|
+
import React, { useEffect, useState } from 'react';
|
|
22
|
+
import _ from 'lodash';
|
|
23
|
+
import { httpClient } from './utils';
|
|
24
|
+
var AddressSelection = function AddressSelection(props) {
|
|
25
|
+
var level = props.level,
|
|
26
|
+
value = props.value,
|
|
27
|
+
onChange = props.onChange,
|
|
28
|
+
valueDivision = props.valueDivision,
|
|
29
|
+
apiUrl = props.apiUrl,
|
|
30
|
+
defaultValue = props.defaultValue,
|
|
31
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
32
|
+
var _useState = useState([]),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
addressList = _useState2[0],
|
|
35
|
+
setAddressList = _useState2[1];
|
|
36
|
+
var _useState3 = useState(false),
|
|
37
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
38
|
+
isLoad = _useState4[0],
|
|
39
|
+
setIsLoad = _useState4[1];
|
|
40
|
+
var _useState5 = useState([]),
|
|
41
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
42
|
+
stateValue = _useState6[0],
|
|
43
|
+
setStateValue = _useState6[1];
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
var __value = (value === null || value === void 0 ? void 0 : value.length) ? value : defaultValue || '';
|
|
46
|
+
if (!isLoad && level) {
|
|
47
|
+
initAddress(formatValue(__value), 0);
|
|
48
|
+
setStateValue(formatValue(__value));
|
|
49
|
+
} else {
|
|
50
|
+
setStateValue([]);
|
|
51
|
+
}
|
|
52
|
+
}, [value, defaultValue, level]);
|
|
53
|
+
var formatValue = function formatValue(value) {
|
|
54
|
+
var localvalue = [];
|
|
55
|
+
if (!!value) {
|
|
56
|
+
if (!!valueDivision && !_.isArray(value)) {
|
|
57
|
+
localvalue = value.split(valueDivision);
|
|
58
|
+
} else {
|
|
59
|
+
localvalue = value;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (_.isArray(localvalue)) {
|
|
63
|
+
var _localvalue;
|
|
64
|
+
localvalue = (_localvalue = localvalue) === null || _localvalue === void 0 ? void 0 : _localvalue.map(function (item) {
|
|
65
|
+
return Number(item);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return localvalue;
|
|
69
|
+
};
|
|
70
|
+
var formatArea = function formatArea(list, isLeaf) {
|
|
71
|
+
return list === null || list === void 0 ? void 0 : list.map(function (item) {
|
|
72
|
+
return {
|
|
73
|
+
value: item.code,
|
|
74
|
+
label: item.name,
|
|
75
|
+
tree: item.tree,
|
|
76
|
+
level: item.level,
|
|
77
|
+
isLeaf: isLeaf
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
var getAddressAPI = /*#__PURE__*/function () {
|
|
82
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
83
|
+
var params,
|
|
84
|
+
_yield$httpClient$pos,
|
|
85
|
+
data,
|
|
86
|
+
_args = arguments;
|
|
87
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
88
|
+
while (1) switch (_context.prev = _context.next) {
|
|
89
|
+
case 0:
|
|
90
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
91
|
+
_context.next = 3;
|
|
92
|
+
return httpClient.post(apiUrl || '/basic/area/areas', params);
|
|
93
|
+
case 3:
|
|
94
|
+
_yield$httpClient$pos = _context.sent;
|
|
95
|
+
data = _yield$httpClient$pos.data;
|
|
96
|
+
return _context.abrupt("return", data);
|
|
97
|
+
case 6:
|
|
98
|
+
case "end":
|
|
99
|
+
return _context.stop();
|
|
100
|
+
}
|
|
101
|
+
}, _callee);
|
|
102
|
+
}));
|
|
103
|
+
return function getAddressAPI() {
|
|
104
|
+
return _ref.apply(this, arguments);
|
|
105
|
+
};
|
|
106
|
+
}();
|
|
107
|
+
var initAddress = /*#__PURE__*/function () {
|
|
108
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(defaultValue, parentCode) {
|
|
109
|
+
var data, provinceList, len, thisAddress, _loop, i;
|
|
110
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context3) {
|
|
111
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
112
|
+
case 0:
|
|
113
|
+
_context3.next = 2;
|
|
114
|
+
return getAddressAPI({
|
|
115
|
+
parentCode: parentCode
|
|
116
|
+
});
|
|
117
|
+
case 2:
|
|
118
|
+
data = _context3.sent;
|
|
119
|
+
provinceList = formatArea(data, level === 1);
|
|
120
|
+
if (!defaultValue) {
|
|
121
|
+
_context3.next = 14;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
len = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length;
|
|
125
|
+
thisAddress = provinceList;
|
|
126
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop(i) {
|
|
127
|
+
var _thisAddress;
|
|
128
|
+
var levelData, thisIndex;
|
|
129
|
+
return _regeneratorRuntime().wrap(function _loop$(_context2) {
|
|
130
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
131
|
+
case 0:
|
|
132
|
+
_context2.next = 2;
|
|
133
|
+
return getAddressAPI({
|
|
134
|
+
parentCode: defaultValue[i]
|
|
135
|
+
});
|
|
136
|
+
case 2:
|
|
137
|
+
levelData = _context2.sent;
|
|
138
|
+
thisIndex = -1;
|
|
139
|
+
(_thisAddress = thisAddress) === null || _thisAddress === void 0 ? void 0 : _thisAddress.forEach(function (item, index) {
|
|
140
|
+
if (item.value === defaultValue[i]) {
|
|
141
|
+
thisIndex = index;
|
|
142
|
+
thisAddress[index].children = formatArea(levelData, level === i + 2);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
if (thisIndex !== -1 && thisAddress[thisIndex].children) {
|
|
146
|
+
thisAddress = thisAddress[thisIndex].children;
|
|
147
|
+
}
|
|
148
|
+
case 6:
|
|
149
|
+
case "end":
|
|
150
|
+
return _context2.stop();
|
|
151
|
+
}
|
|
152
|
+
}, _loop);
|
|
153
|
+
});
|
|
154
|
+
i = 0;
|
|
155
|
+
case 9:
|
|
156
|
+
if (!(i < len - 1)) {
|
|
157
|
+
_context3.next = 14;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
return _context3.delegateYield(_loop(i), "t0", 11);
|
|
161
|
+
case 11:
|
|
162
|
+
i++;
|
|
163
|
+
_context3.next = 9;
|
|
164
|
+
break;
|
|
165
|
+
case 14:
|
|
166
|
+
setAddressList(provinceList);
|
|
167
|
+
case 15:
|
|
168
|
+
case "end":
|
|
169
|
+
return _context3.stop();
|
|
170
|
+
}
|
|
171
|
+
}, _callee2);
|
|
172
|
+
}));
|
|
173
|
+
return function initAddress(_x2, _x3) {
|
|
174
|
+
return _ref2.apply(this, arguments);
|
|
175
|
+
};
|
|
176
|
+
}();
|
|
177
|
+
var loadData = /*#__PURE__*/function () {
|
|
178
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(selectedOptions) {
|
|
179
|
+
var targetOption, data;
|
|
180
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context4) {
|
|
181
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
182
|
+
case 0:
|
|
183
|
+
targetOption = selectedOptions[selectedOptions.length - 1];
|
|
184
|
+
targetOption.loading = true;
|
|
185
|
+
_context4.next = 4;
|
|
186
|
+
return getAddressAPI({
|
|
187
|
+
parentCode: targetOption.value
|
|
188
|
+
});
|
|
189
|
+
case 4:
|
|
190
|
+
data = _context4.sent;
|
|
191
|
+
targetOption.loading = false;
|
|
192
|
+
if (!!data.length) {
|
|
193
|
+
targetOption.children = formatArea(data, targetOption.level + 1 === level);
|
|
194
|
+
} else {
|
|
195
|
+
targetOption.isLeaf = true;
|
|
196
|
+
}
|
|
197
|
+
setIsLoad(true);
|
|
198
|
+
setAddressList(_toConsumableArray(addressList));
|
|
199
|
+
case 9:
|
|
200
|
+
case "end":
|
|
201
|
+
return _context4.stop();
|
|
202
|
+
}
|
|
203
|
+
}, _callee3);
|
|
204
|
+
}));
|
|
205
|
+
return function loadData(_x4) {
|
|
206
|
+
return _ref3.apply(this, arguments);
|
|
207
|
+
};
|
|
208
|
+
}();
|
|
209
|
+
var handleChange = function handleChange(info, selectedOptions) {
|
|
210
|
+
var cascaderValue = info;
|
|
211
|
+
if (!!valueDivision) {
|
|
212
|
+
cascaderValue = cascaderValue.join(valueDivision);
|
|
213
|
+
}
|
|
214
|
+
setStateValue(info);
|
|
215
|
+
onChange && onChange(cascaderValue, selectedOptions);
|
|
216
|
+
};
|
|
217
|
+
return /*#__PURE__*/React.createElement(_Cascader, _extends({}, otherProps, {
|
|
218
|
+
defaultValue: defaultValue,
|
|
219
|
+
loadData: loadData,
|
|
220
|
+
options: addressList,
|
|
221
|
+
onChange: handleChange,
|
|
222
|
+
value: formatValue(value).length === 0 ? stateValue : formatValue(value)
|
|
223
|
+
}));
|
|
224
|
+
};
|
|
225
|
+
AddressSelection.defaultProps = {
|
|
226
|
+
level: 4,
|
|
227
|
+
valueDivision: '',
|
|
228
|
+
value: [],
|
|
229
|
+
onChange: function onChange() {},
|
|
230
|
+
apiUrl: ''
|
|
231
|
+
};
|
|
232
|
+
export default AddressSelection;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Response {
|
|
2
|
+
status: number;
|
|
3
|
+
data: any;
|
|
4
|
+
statusText: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AxiosRequestConfig {
|
|
7
|
+
baseURL?: string;
|
|
8
|
+
timeout: number;
|
|
9
|
+
headers?: any;
|
|
10
|
+
url?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const httpClient: import("axios").AxiosInstance;
|
|
13
|
+
export default httpClient;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import "antd/es/notification/style";
|
|
2
|
+
import _notification from "antd/es/notification";
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import Cookies from 'js-cookie';
|
|
5
|
+
var axiosConfig = {
|
|
6
|
+
baseURL: 'https://gateway.fxqifu.net/pangu',
|
|
7
|
+
timeout: 60000
|
|
8
|
+
};
|
|
9
|
+
var httpClient = axios.create(axiosConfig);
|
|
10
|
+
// 登陆页面接口列表,不需要带token
|
|
11
|
+
var loginMap = [''];
|
|
12
|
+
httpClient.interceptors.request.use(function (config) {
|
|
13
|
+
config.headers['Content-Type'] = 'application/json;charset=UTF-8';
|
|
14
|
+
if (loginMap.find(function (item) {
|
|
15
|
+
return config.url.endsWith(item);
|
|
16
|
+
})) {
|
|
17
|
+
delete config.headers['authority_token'];
|
|
18
|
+
} else {
|
|
19
|
+
var tokenFrom = config['tokenFrom'];
|
|
20
|
+
var token = '';
|
|
21
|
+
switch (tokenFrom) {
|
|
22
|
+
case 'cookie':
|
|
23
|
+
token = Cookies.get('token');
|
|
24
|
+
break;
|
|
25
|
+
case 'localstorage':
|
|
26
|
+
token = localStorage.getItem('token');
|
|
27
|
+
break;
|
|
28
|
+
default:
|
|
29
|
+
token = Cookies.get('token') || localStorage.getItem('token');
|
|
30
|
+
}
|
|
31
|
+
config.headers['authority_token'] = token;
|
|
32
|
+
}
|
|
33
|
+
return config;
|
|
34
|
+
}, function (err) {
|
|
35
|
+
_notification.error({
|
|
36
|
+
message: '发送请求失败',
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
description: err
|
|
39
|
+
});
|
|
40
|
+
return false;
|
|
41
|
+
});
|
|
42
|
+
httpClient.interceptors.response.use(function (res) {
|
|
43
|
+
var status = res.status,
|
|
44
|
+
data = res.data,
|
|
45
|
+
statusText = res.statusText;
|
|
46
|
+
return new Promise(function (resolve, reject) {
|
|
47
|
+
if (status < 200 || status > 300) {
|
|
48
|
+
_notification.error({
|
|
49
|
+
message: "\u8BF7\u6C42\u9519\u8BEF: ".concat(status),
|
|
50
|
+
description: statusText
|
|
51
|
+
});
|
|
52
|
+
} else if (!data.success) {
|
|
53
|
+
if (data.code === '915003') {
|
|
54
|
+
return reject(data);
|
|
55
|
+
}
|
|
56
|
+
if (data.code === '100003') {
|
|
57
|
+
return reject(data);
|
|
58
|
+
}
|
|
59
|
+
_notification.error({
|
|
60
|
+
message: '提示',
|
|
61
|
+
description: data.message
|
|
62
|
+
});
|
|
63
|
+
return reject(data);
|
|
64
|
+
} else {
|
|
65
|
+
return resolve(data || true);
|
|
66
|
+
}
|
|
67
|
+
return reject();
|
|
68
|
+
});
|
|
69
|
+
}, function () {
|
|
70
|
+
_notification.error({
|
|
71
|
+
message: '提示',
|
|
72
|
+
description: '系统错误'
|
|
73
|
+
});
|
|
74
|
+
return false;
|
|
75
|
+
});
|
|
76
|
+
export default httpClient;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CascaderProps } from 'antd';
|
|
3
|
+
export declare type CascaderValueType = string | (string | number)[];
|
|
4
|
+
export interface CascaderOptionType {
|
|
5
|
+
value?: string | number;
|
|
6
|
+
label?: React.ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
isLeaf?: boolean;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
children?: Array<CascaderOptionType>;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export interface addressItem {
|
|
14
|
+
value?: string | number;
|
|
15
|
+
code?: string | number;
|
|
16
|
+
name?: string | number;
|
|
17
|
+
label?: string;
|
|
18
|
+
tree?: string;
|
|
19
|
+
level?: string;
|
|
20
|
+
isLeaf?: boolean;
|
|
21
|
+
children?: addressItem[];
|
|
22
|
+
}
|
|
23
|
+
export interface SiteSelectProps extends Omit<CascaderProps<any>, 'options' | 'value'> {
|
|
24
|
+
/**
|
|
25
|
+
* @description 格式化value
|
|
26
|
+
* @default
|
|
27
|
+
*/
|
|
28
|
+
valueDivision?: string;
|
|
29
|
+
/**
|
|
30
|
+
* @description 接口地址 全地址哦
|
|
31
|
+
* @default
|
|
32
|
+
*/
|
|
33
|
+
apiUrl?: string;
|
|
34
|
+
/**
|
|
35
|
+
* @description 地址层级 默认四级
|
|
36
|
+
* @default 4
|
|
37
|
+
*/
|
|
38
|
+
level?: number;
|
|
39
|
+
/**
|
|
40
|
+
* @description 指定选中项
|
|
41
|
+
* @default []
|
|
42
|
+
*/
|
|
43
|
+
value?: CascaderValueType;
|
|
44
|
+
/**
|
|
45
|
+
* @description 可选项数据源
|
|
46
|
+
* @default []
|
|
47
|
+
*/
|
|
48
|
+
options?: CascaderOptionType[];
|
|
49
|
+
}
|
|
50
|
+
declare const AddressSelection: React.FC<SiteSelectProps>;
|
|
51
|
+
export default AddressSelection;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _antd = require("antd");
|
|
10
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
11
|
+
var _utils = require("./utils");
|
|
12
|
+
var _excluded = ["level", "value", "onChange", "valueDivision", "apiUrl", "defaultValue"];
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
18
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
20
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
21
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
22
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
23
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
24
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
26
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
28
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
29
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
30
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
31
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
32
|
+
var AddressSelection = function AddressSelection(props) {
|
|
33
|
+
var level = props.level,
|
|
34
|
+
value = props.value,
|
|
35
|
+
onChange = props.onChange,
|
|
36
|
+
valueDivision = props.valueDivision,
|
|
37
|
+
apiUrl = props.apiUrl,
|
|
38
|
+
defaultValue = props.defaultValue,
|
|
39
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
40
|
+
var _useState = (0, _react.useState)([]),
|
|
41
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
42
|
+
addressList = _useState2[0],
|
|
43
|
+
setAddressList = _useState2[1];
|
|
44
|
+
var _useState3 = (0, _react.useState)(false),
|
|
45
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
46
|
+
isLoad = _useState4[0],
|
|
47
|
+
setIsLoad = _useState4[1];
|
|
48
|
+
var _useState5 = (0, _react.useState)([]),
|
|
49
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
50
|
+
stateValue = _useState6[0],
|
|
51
|
+
setStateValue = _useState6[1];
|
|
52
|
+
(0, _react.useEffect)(function () {
|
|
53
|
+
var __value = (value === null || value === void 0 ? void 0 : value.length) ? value : defaultValue || '';
|
|
54
|
+
if (!isLoad && level) {
|
|
55
|
+
initAddress(formatValue(__value), 0);
|
|
56
|
+
setStateValue(formatValue(__value));
|
|
57
|
+
} else {
|
|
58
|
+
setStateValue([]);
|
|
59
|
+
}
|
|
60
|
+
}, [value, defaultValue, level]);
|
|
61
|
+
var formatValue = function formatValue(value) {
|
|
62
|
+
var localvalue = [];
|
|
63
|
+
if (!!value) {
|
|
64
|
+
if (!!valueDivision && !_lodash.default.isArray(value)) {
|
|
65
|
+
localvalue = value.split(valueDivision);
|
|
66
|
+
} else {
|
|
67
|
+
localvalue = value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (_lodash.default.isArray(localvalue)) {
|
|
71
|
+
var _localvalue;
|
|
72
|
+
localvalue = (_localvalue = localvalue) === null || _localvalue === void 0 ? void 0 : _localvalue.map(function (item) {
|
|
73
|
+
return Number(item);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return localvalue;
|
|
77
|
+
};
|
|
78
|
+
var formatArea = function formatArea(list, isLeaf) {
|
|
79
|
+
return list === null || list === void 0 ? void 0 : list.map(function (item) {
|
|
80
|
+
return {
|
|
81
|
+
value: item.code,
|
|
82
|
+
label: item.name,
|
|
83
|
+
tree: item.tree,
|
|
84
|
+
level: item.level,
|
|
85
|
+
isLeaf: isLeaf
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
var getAddressAPI = /*#__PURE__*/function () {
|
|
90
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
91
|
+
var params,
|
|
92
|
+
_yield$httpClient$pos,
|
|
93
|
+
data,
|
|
94
|
+
_args = arguments;
|
|
95
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
96
|
+
while (1) switch (_context.prev = _context.next) {
|
|
97
|
+
case 0:
|
|
98
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
99
|
+
_context.next = 3;
|
|
100
|
+
return _utils.httpClient.post(apiUrl || '/basic/area/areas', params);
|
|
101
|
+
case 3:
|
|
102
|
+
_yield$httpClient$pos = _context.sent;
|
|
103
|
+
data = _yield$httpClient$pos.data;
|
|
104
|
+
return _context.abrupt("return", data);
|
|
105
|
+
case 6:
|
|
106
|
+
case "end":
|
|
107
|
+
return _context.stop();
|
|
108
|
+
}
|
|
109
|
+
}, _callee);
|
|
110
|
+
}));
|
|
111
|
+
return function getAddressAPI() {
|
|
112
|
+
return _ref.apply(this, arguments);
|
|
113
|
+
};
|
|
114
|
+
}();
|
|
115
|
+
var initAddress = /*#__PURE__*/function () {
|
|
116
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(defaultValue, parentCode) {
|
|
117
|
+
var data, provinceList, len, thisAddress, _loop, i;
|
|
118
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context3) {
|
|
119
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
120
|
+
case 0:
|
|
121
|
+
_context3.next = 2;
|
|
122
|
+
return getAddressAPI({
|
|
123
|
+
parentCode: parentCode
|
|
124
|
+
});
|
|
125
|
+
case 2:
|
|
126
|
+
data = _context3.sent;
|
|
127
|
+
provinceList = formatArea(data, level === 1);
|
|
128
|
+
if (!defaultValue) {
|
|
129
|
+
_context3.next = 14;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
len = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length;
|
|
133
|
+
thisAddress = provinceList;
|
|
134
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop(i) {
|
|
135
|
+
var _thisAddress;
|
|
136
|
+
var levelData, thisIndex;
|
|
137
|
+
return _regeneratorRuntime().wrap(function _loop$(_context2) {
|
|
138
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
139
|
+
case 0:
|
|
140
|
+
_context2.next = 2;
|
|
141
|
+
return getAddressAPI({
|
|
142
|
+
parentCode: defaultValue[i]
|
|
143
|
+
});
|
|
144
|
+
case 2:
|
|
145
|
+
levelData = _context2.sent;
|
|
146
|
+
thisIndex = -1;
|
|
147
|
+
(_thisAddress = thisAddress) === null || _thisAddress === void 0 ? void 0 : _thisAddress.forEach(function (item, index) {
|
|
148
|
+
if (item.value === defaultValue[i]) {
|
|
149
|
+
thisIndex = index;
|
|
150
|
+
thisAddress[index].children = formatArea(levelData, level === i + 2);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
if (thisIndex !== -1 && thisAddress[thisIndex].children) {
|
|
154
|
+
thisAddress = thisAddress[thisIndex].children;
|
|
155
|
+
}
|
|
156
|
+
case 6:
|
|
157
|
+
case "end":
|
|
158
|
+
return _context2.stop();
|
|
159
|
+
}
|
|
160
|
+
}, _loop);
|
|
161
|
+
});
|
|
162
|
+
i = 0;
|
|
163
|
+
case 9:
|
|
164
|
+
if (!(i < len - 1)) {
|
|
165
|
+
_context3.next = 14;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
return _context3.delegateYield(_loop(i), "t0", 11);
|
|
169
|
+
case 11:
|
|
170
|
+
i++;
|
|
171
|
+
_context3.next = 9;
|
|
172
|
+
break;
|
|
173
|
+
case 14:
|
|
174
|
+
setAddressList(provinceList);
|
|
175
|
+
case 15:
|
|
176
|
+
case "end":
|
|
177
|
+
return _context3.stop();
|
|
178
|
+
}
|
|
179
|
+
}, _callee2);
|
|
180
|
+
}));
|
|
181
|
+
return function initAddress(_x2, _x3) {
|
|
182
|
+
return _ref2.apply(this, arguments);
|
|
183
|
+
};
|
|
184
|
+
}();
|
|
185
|
+
var loadData = /*#__PURE__*/function () {
|
|
186
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(selectedOptions) {
|
|
187
|
+
var targetOption, data;
|
|
188
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context4) {
|
|
189
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
190
|
+
case 0:
|
|
191
|
+
targetOption = selectedOptions[selectedOptions.length - 1];
|
|
192
|
+
targetOption.loading = true;
|
|
193
|
+
_context4.next = 4;
|
|
194
|
+
return getAddressAPI({
|
|
195
|
+
parentCode: targetOption.value
|
|
196
|
+
});
|
|
197
|
+
case 4:
|
|
198
|
+
data = _context4.sent;
|
|
199
|
+
targetOption.loading = false;
|
|
200
|
+
if (!!data.length) {
|
|
201
|
+
targetOption.children = formatArea(data, targetOption.level + 1 === level);
|
|
202
|
+
} else {
|
|
203
|
+
targetOption.isLeaf = true;
|
|
204
|
+
}
|
|
205
|
+
setIsLoad(true);
|
|
206
|
+
setAddressList(_toConsumableArray(addressList));
|
|
207
|
+
case 9:
|
|
208
|
+
case "end":
|
|
209
|
+
return _context4.stop();
|
|
210
|
+
}
|
|
211
|
+
}, _callee3);
|
|
212
|
+
}));
|
|
213
|
+
return function loadData(_x4) {
|
|
214
|
+
return _ref3.apply(this, arguments);
|
|
215
|
+
};
|
|
216
|
+
}();
|
|
217
|
+
var handleChange = function handleChange(info, selectedOptions) {
|
|
218
|
+
var cascaderValue = info;
|
|
219
|
+
if (!!valueDivision) {
|
|
220
|
+
cascaderValue = cascaderValue.join(valueDivision);
|
|
221
|
+
}
|
|
222
|
+
setStateValue(info);
|
|
223
|
+
onChange && onChange(cascaderValue, selectedOptions);
|
|
224
|
+
};
|
|
225
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Cascader, _extends({}, otherProps, {
|
|
226
|
+
defaultValue: defaultValue,
|
|
227
|
+
loadData: loadData,
|
|
228
|
+
options: addressList,
|
|
229
|
+
onChange: handleChange,
|
|
230
|
+
value: formatValue(value).length === 0 ? stateValue : formatValue(value)
|
|
231
|
+
}));
|
|
232
|
+
};
|
|
233
|
+
AddressSelection.defaultProps = {
|
|
234
|
+
level: 4,
|
|
235
|
+
valueDivision: '',
|
|
236
|
+
value: [],
|
|
237
|
+
onChange: function onChange() {},
|
|
238
|
+
apiUrl: ''
|
|
239
|
+
};
|
|
240
|
+
var _default = AddressSelection;
|
|
241
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Response {
|
|
2
|
+
status: number;
|
|
3
|
+
data: any;
|
|
4
|
+
statusText: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AxiosRequestConfig {
|
|
7
|
+
baseURL?: string;
|
|
8
|
+
timeout: number;
|
|
9
|
+
headers?: any;
|
|
10
|
+
url?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const httpClient: import("axios").AxiosInstance;
|
|
13
|
+
export default httpClient;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
8
|
+
var _antd = require("antd");
|
|
9
|
+
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
var axiosConfig = {
|
|
12
|
+
baseURL: 'https://gateway.fxqifu.net/pangu',
|
|
13
|
+
timeout: 60000
|
|
14
|
+
};
|
|
15
|
+
var httpClient = _axios.default.create(axiosConfig);
|
|
16
|
+
// 登陆页面接口列表,不需要带token
|
|
17
|
+
var loginMap = [''];
|
|
18
|
+
httpClient.interceptors.request.use(function (config) {
|
|
19
|
+
config.headers['Content-Type'] = 'application/json;charset=UTF-8';
|
|
20
|
+
if (loginMap.find(function (item) {
|
|
21
|
+
return config.url.endsWith(item);
|
|
22
|
+
})) {
|
|
23
|
+
delete config.headers['authority_token'];
|
|
24
|
+
} else {
|
|
25
|
+
var tokenFrom = config['tokenFrom'];
|
|
26
|
+
var token = '';
|
|
27
|
+
switch (tokenFrom) {
|
|
28
|
+
case 'cookie':
|
|
29
|
+
token = _jsCookie.default.get('token');
|
|
30
|
+
break;
|
|
31
|
+
case 'localstorage':
|
|
32
|
+
token = localStorage.getItem('token');
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
token = _jsCookie.default.get('token') || localStorage.getItem('token');
|
|
36
|
+
}
|
|
37
|
+
config.headers['authority_token'] = token;
|
|
38
|
+
}
|
|
39
|
+
return config;
|
|
40
|
+
}, function (err) {
|
|
41
|
+
_antd.notification.error({
|
|
42
|
+
message: '发送请求失败',
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
description: err
|
|
45
|
+
});
|
|
46
|
+
return false;
|
|
47
|
+
});
|
|
48
|
+
httpClient.interceptors.response.use(function (res) {
|
|
49
|
+
var status = res.status,
|
|
50
|
+
data = res.data,
|
|
51
|
+
statusText = res.statusText;
|
|
52
|
+
return new Promise(function (resolve, reject) {
|
|
53
|
+
if (status < 200 || status > 300) {
|
|
54
|
+
_antd.notification.error({
|
|
55
|
+
message: "\u8BF7\u6C42\u9519\u8BEF: ".concat(status),
|
|
56
|
+
description: statusText
|
|
57
|
+
});
|
|
58
|
+
} else if (!data.success) {
|
|
59
|
+
if (data.code === '915003') {
|
|
60
|
+
return reject(data);
|
|
61
|
+
}
|
|
62
|
+
if (data.code === '100003') {
|
|
63
|
+
return reject(data);
|
|
64
|
+
}
|
|
65
|
+
_antd.notification.error({
|
|
66
|
+
message: '提示',
|
|
67
|
+
description: data.message
|
|
68
|
+
});
|
|
69
|
+
return reject(data);
|
|
70
|
+
} else {
|
|
71
|
+
return resolve(data || true);
|
|
72
|
+
}
|
|
73
|
+
return reject();
|
|
74
|
+
});
|
|
75
|
+
}, function () {
|
|
76
|
+
_antd.notification.error({
|
|
77
|
+
message: '提示',
|
|
78
|
+
description: '系统错误'
|
|
79
|
+
});
|
|
80
|
+
return false;
|
|
81
|
+
});
|
|
82
|
+
var _default = httpClient;
|
|
83
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "httpClient", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _httpClient.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _httpClient = _interopRequireDefault(require("./httpClient"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fle-ui/plus-address-selection",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "@fle-ui/plus-address-selection",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"module": "es/index.js",
|
|
8
|
+
"types": "lib/index.d.ts",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"fle-ui",
|
|
11
|
+
"admin",
|
|
12
|
+
"fle-ui-pro"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"*.less"
|
|
17
|
+
],
|
|
18
|
+
"files": [
|
|
19
|
+
"lib",
|
|
20
|
+
"es",
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"browserslist": [
|
|
24
|
+
"last 2 versions",
|
|
25
|
+
"Firefox ESR",
|
|
26
|
+
"> 1%",
|
|
27
|
+
"ie >= 11"
|
|
28
|
+
],
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"react": ">=16.9.0",
|
|
31
|
+
"react-router-dom": "^5.2.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"axios": "^0.23.0",
|
|
38
|
+
"js-cookie": "^3.0.1",
|
|
39
|
+
"lodash": "^4.17.21"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/js-cookie": "^3.0.0"
|
|
43
|
+
},
|
|
44
|
+
"gitHead": "16b76ce3fefa08deb73473078b5d9b71b1ddea4b"
|
|
45
|
+
}
|