yxuse 3.0.55 → 3.0.57
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/lib/index.cjs12.js +1 -1
- package/lib/index.cjs12.js.gz +0 -0
- package/lib/index.cjs12.js.map +1 -1
- package/lib/index.cjs2.js +1 -1
- package/lib/index.cjs2.js.map +1 -1
- package/lib/index.cjs3.js +1 -1
- package/lib/index.cjs3.js.map +1 -1
- package/lib/index.cjs4.js +1 -1
- package/lib/index.cjs4.js.map +1 -1
- package/lib/index.cjs5.js +5 -5
- package/lib/index.cjs5.js.gz +0 -0
- package/lib/index.cjs5.js.map +1 -1
- package/lib/index.cjs6.js +3 -3
- package/lib/index.cjs6.js.gz +0 -0
- package/lib/index.cjs6.js.map +1 -1
- package/lib/index.cjs7.js +4 -4
- package/lib/index.cjs7.js.gz +0 -0
- package/lib/index.cjs7.js.map +1 -1
- package/lib/index.es12.js +99 -209
- package/lib/index.es12.js.gz +0 -0
- package/lib/index.es12.js.map +1 -1
- package/lib/index.es2.js +54 -90
- package/lib/index.es2.js.map +1 -1
- package/lib/index.es3.js +6 -26
- package/lib/index.es3.js.map +1 -1
- package/lib/index.es4.js +12 -32
- package/lib/index.es4.js.map +1 -1
- package/lib/index.es5.js +125 -169
- package/lib/index.es5.js.gz +0 -0
- package/lib/index.es5.js.map +1 -1
- package/lib/index.es6.js +162 -181
- package/lib/index.es6.js.gz +0 -0
- package/lib/index.es6.js.map +1 -1
- package/lib/index.es7.js +118 -162
- package/lib/index.es7.js.gz +0 -0
- package/lib/index.es7.js.map +1 -1
- package/lib/mqtt.min.cjs.js +1 -1
- package/lib/mqtt.min.cjs.js.gz +0 -0
- package/lib/mqtt.min.cjs.js.map +1 -1
- package/lib/mqtt.min.es.js +21 -37
- package/lib/mqtt.min.es.js.gz +0 -0
- package/lib/mqtt.min.es.js.map +1 -1
- package/lib/style.css +1 -1
- package/lib/style.css.gz +0 -0
- package/package.json +1 -1
- package/types/components/YxForm/type.d.ts +11 -1
- package/types/components/YxUpload/index.vue.d.ts +2 -1
package/lib/index.es12.js
CHANGED
|
@@ -1,91 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
8
|
-
var __typeError = (msg) => {
|
|
9
|
-
throw TypeError(msg);
|
|
10
|
-
};
|
|
11
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
25
|
-
var __async = (__this, __arguments, generator) => {
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
var fulfilled = (value) => {
|
|
28
|
-
try {
|
|
29
|
-
step(generator.next(value));
|
|
30
|
-
} catch (e) {
|
|
31
|
-
reject(e);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
var rejected = (value) => {
|
|
35
|
-
try {
|
|
36
|
-
step(generator.throw(value));
|
|
37
|
-
} catch (e) {
|
|
38
|
-
reject(e);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
42
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
var __await = function(promise, isYieldStar) {
|
|
46
|
-
this[0] = promise;
|
|
47
|
-
this[1] = isYieldStar;
|
|
48
|
-
};
|
|
49
|
-
var __asyncGenerator = (__this, __arguments, generator) => {
|
|
50
|
-
var resume = (k, v, yes, no) => {
|
|
51
|
-
try {
|
|
52
|
-
var x = generator[k](v), isAwait = (v = x.value) instanceof __await, done = x.done;
|
|
53
|
-
Promise.resolve(isAwait ? v[0] : v).then((y) => isAwait ? resume(k === "return" ? k : "next", v[1] ? { done: y.done, value: y.value } : y, yes, no) : yes({ value: y, done })).catch((e) => resume("throw", e, yes, no));
|
|
54
|
-
} catch (e) {
|
|
55
|
-
no(e);
|
|
56
|
-
}
|
|
57
|
-
}, method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no)), it = {};
|
|
58
|
-
return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
|
|
59
|
-
};
|
|
60
|
-
var __yieldStar = (value) => {
|
|
61
|
-
var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
|
|
62
|
-
if (obj == null) {
|
|
63
|
-
obj = value[__knownSymbol("iterator")]();
|
|
64
|
-
method = (k) => it[k] = (x) => obj[k](x);
|
|
65
|
-
} else {
|
|
66
|
-
obj = obj.call(value);
|
|
67
|
-
method = (k) => it[k] = (v) => {
|
|
68
|
-
if (isAwait) {
|
|
69
|
-
isAwait = false;
|
|
70
|
-
if (k === "throw") throw v;
|
|
71
|
-
return v;
|
|
72
|
-
}
|
|
73
|
-
isAwait = true;
|
|
74
|
-
return {
|
|
75
|
-
done: false,
|
|
76
|
-
value: new __await(new Promise((resolve) => {
|
|
77
|
-
var x = obj[k](v);
|
|
78
|
-
if (!(x instanceof Object)) __typeError("Object expected");
|
|
79
|
-
resolve(x);
|
|
80
|
-
}), 1)
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
|
|
85
|
-
throw x;
|
|
86
|
-
}, "return" in obj && method("return"), it;
|
|
87
|
-
};
|
|
88
|
-
var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
|
|
89
4
|
import { ElMessage, ElLoading, ElNotification } from "element-plus";
|
|
90
5
|
function bind(fn, thisArg) {
|
|
91
6
|
return function wrap() {
|
|
@@ -790,7 +705,10 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
790
705
|
navigator: _navigator,
|
|
791
706
|
origin
|
|
792
707
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
793
|
-
const platform =
|
|
708
|
+
const platform = {
|
|
709
|
+
...utils,
|
|
710
|
+
...platform$1
|
|
711
|
+
};
|
|
794
712
|
function toURLEncodedForm(data, options) {
|
|
795
713
|
return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
796
714
|
visitor: function(value, key, path, helpers) {
|
|
@@ -1415,7 +1333,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
|
1415
1333
|
}
|
|
1416
1334
|
return requestedURL;
|
|
1417
1335
|
}
|
|
1418
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ?
|
|
1336
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
1419
1337
|
function mergeConfig$1(config1, config2) {
|
|
1420
1338
|
config2 = config2 || {};
|
|
1421
1339
|
const config3 = {};
|
|
@@ -1696,44 +1614,28 @@ const streamChunk = function* (chunk, chunkSize) {
|
|
|
1696
1614
|
pos = end;
|
|
1697
1615
|
}
|
|
1698
1616
|
};
|
|
1699
|
-
const readBytes = function(iterable, chunkSize) {
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
const chunk = temp.value;
|
|
1704
|
-
yield* __yieldStar(streamChunk(chunk, chunkSize));
|
|
1705
|
-
}
|
|
1706
|
-
} catch (temp) {
|
|
1707
|
-
error = [temp];
|
|
1708
|
-
} finally {
|
|
1709
|
-
try {
|
|
1710
|
-
more && (temp = iter.return) && (yield new __await(temp.call(iter)));
|
|
1711
|
-
} finally {
|
|
1712
|
-
if (error)
|
|
1713
|
-
throw error[0];
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
});
|
|
1617
|
+
const readBytes = async function* (iterable, chunkSize) {
|
|
1618
|
+
for await (const chunk of readStream(iterable)) {
|
|
1619
|
+
yield* streamChunk(chunk, chunkSize);
|
|
1620
|
+
}
|
|
1717
1621
|
};
|
|
1718
|
-
const readStream = function(stream) {
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
break;
|
|
1730
|
-
}
|
|
1731
|
-
yield value;
|
|
1622
|
+
const readStream = async function* (stream) {
|
|
1623
|
+
if (stream[Symbol.asyncIterator]) {
|
|
1624
|
+
yield* stream;
|
|
1625
|
+
return;
|
|
1626
|
+
}
|
|
1627
|
+
const reader = stream.getReader();
|
|
1628
|
+
try {
|
|
1629
|
+
for (; ; ) {
|
|
1630
|
+
const { done, value } = await reader.read();
|
|
1631
|
+
if (done) {
|
|
1632
|
+
break;
|
|
1732
1633
|
}
|
|
1733
|
-
|
|
1734
|
-
yield new __await(reader.cancel());
|
|
1634
|
+
yield value;
|
|
1735
1635
|
}
|
|
1736
|
-
}
|
|
1636
|
+
} finally {
|
|
1637
|
+
await reader.cancel();
|
|
1638
|
+
}
|
|
1737
1639
|
};
|
|
1738
1640
|
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
1739
1641
|
const iterator2 = readBytes(stream, chunkSize);
|
|
@@ -1746,26 +1648,24 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
1746
1648
|
}
|
|
1747
1649
|
};
|
|
1748
1650
|
return new ReadableStream({
|
|
1749
|
-
pull(controller) {
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
return;
|
|
1757
|
-
}
|
|
1758
|
-
let len = value.byteLength;
|
|
1759
|
-
if (onProgress) {
|
|
1760
|
-
let loadedBytes = bytes += len;
|
|
1761
|
-
onProgress(loadedBytes);
|
|
1762
|
-
}
|
|
1763
|
-
controller.enqueue(new Uint8Array(value));
|
|
1764
|
-
} catch (err) {
|
|
1765
|
-
_onFinish(err);
|
|
1766
|
-
throw err;
|
|
1651
|
+
async pull(controller) {
|
|
1652
|
+
try {
|
|
1653
|
+
const { done: done2, value } = await iterator2.next();
|
|
1654
|
+
if (done2) {
|
|
1655
|
+
_onFinish();
|
|
1656
|
+
controller.close();
|
|
1657
|
+
return;
|
|
1767
1658
|
}
|
|
1768
|
-
|
|
1659
|
+
let len = value.byteLength;
|
|
1660
|
+
if (onProgress) {
|
|
1661
|
+
let loadedBytes = bytes += len;
|
|
1662
|
+
onProgress(loadedBytes);
|
|
1663
|
+
}
|
|
1664
|
+
controller.enqueue(new Uint8Array(value));
|
|
1665
|
+
} catch (err) {
|
|
1666
|
+
_onFinish(err);
|
|
1667
|
+
throw err;
|
|
1668
|
+
}
|
|
1769
1669
|
},
|
|
1770
1670
|
cancel(reason) {
|
|
1771
1671
|
_onFinish(reason);
|
|
@@ -1777,9 +1677,7 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
1777
1677
|
};
|
|
1778
1678
|
const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
|
|
1779
1679
|
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
|
|
1780
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : (str) =>
|
|
1781
|
-
return new Uint8Array(yield new Response(str).arrayBuffer());
|
|
1782
|
-
}));
|
|
1680
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
|
|
1783
1681
|
const test = (fn, ...args) => {
|
|
1784
1682
|
try {
|
|
1785
1683
|
return !!fn(...args);
|
|
@@ -1811,7 +1709,7 @@ isFetchSupported && ((res) => {
|
|
|
1811
1709
|
});
|
|
1812
1710
|
});
|
|
1813
1711
|
})(new Response());
|
|
1814
|
-
const getBodyLength = (body) =>
|
|
1712
|
+
const getBodyLength = async (body) => {
|
|
1815
1713
|
if (body == null) {
|
|
1816
1714
|
return 0;
|
|
1817
1715
|
}
|
|
@@ -1823,7 +1721,7 @@ const getBodyLength = (body) => __async(void 0, null, function* () {
|
|
|
1823
1721
|
method: "POST",
|
|
1824
1722
|
body
|
|
1825
1723
|
});
|
|
1826
|
-
return (
|
|
1724
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
1827
1725
|
}
|
|
1828
1726
|
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
1829
1727
|
return body.byteLength;
|
|
@@ -1832,14 +1730,14 @@ const getBodyLength = (body) => __async(void 0, null, function* () {
|
|
|
1832
1730
|
body = body + "";
|
|
1833
1731
|
}
|
|
1834
1732
|
if (utils$1.isString(body)) {
|
|
1835
|
-
return (
|
|
1733
|
+
return (await encodeText(body)).byteLength;
|
|
1836
1734
|
}
|
|
1837
|
-
}
|
|
1838
|
-
const resolveBodyLength = (headers, body) =>
|
|
1735
|
+
};
|
|
1736
|
+
const resolveBodyLength = async (headers, body) => {
|
|
1839
1737
|
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
1840
1738
|
return length == null ? getBodyLength(body) : length;
|
|
1841
|
-
}
|
|
1842
|
-
const fetchAdapter = isFetchSupported && ((config2) =>
|
|
1739
|
+
};
|
|
1740
|
+
const fetchAdapter = isFetchSupported && (async (config2) => {
|
|
1843
1741
|
let {
|
|
1844
1742
|
url,
|
|
1845
1743
|
method,
|
|
@@ -1862,7 +1760,7 @@ const fetchAdapter = isFetchSupported && ((config2) => __async(void 0, null, fun
|
|
|
1862
1760
|
});
|
|
1863
1761
|
let requestContentLength;
|
|
1864
1762
|
try {
|
|
1865
|
-
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength =
|
|
1763
|
+
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
1866
1764
|
let _request = new Request(url, {
|
|
1867
1765
|
method: "POST",
|
|
1868
1766
|
body: data,
|
|
@@ -1884,15 +1782,16 @@ const fetchAdapter = isFetchSupported && ((config2) => __async(void 0, null, fun
|
|
|
1884
1782
|
withCredentials = withCredentials ? "include" : "omit";
|
|
1885
1783
|
}
|
|
1886
1784
|
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
1887
|
-
request = new Request(url,
|
|
1785
|
+
request = new Request(url, {
|
|
1786
|
+
...fetchOptions,
|
|
1888
1787
|
signal: composedSignal,
|
|
1889
1788
|
method: method.toUpperCase(),
|
|
1890
1789
|
headers: headers.normalize().toJSON(),
|
|
1891
1790
|
body: data,
|
|
1892
1791
|
duplex: "half",
|
|
1893
1792
|
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
1894
|
-
})
|
|
1895
|
-
let response =
|
|
1793
|
+
});
|
|
1794
|
+
let response = await fetch(request);
|
|
1896
1795
|
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
1897
1796
|
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
1898
1797
|
const options = {};
|
|
@@ -1913,9 +1812,9 @@ const fetchAdapter = isFetchSupported && ((config2) => __async(void 0, null, fun
|
|
|
1913
1812
|
);
|
|
1914
1813
|
}
|
|
1915
1814
|
responseType = responseType || "text";
|
|
1916
|
-
let responseData =
|
|
1815
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config2);
|
|
1917
1816
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
1918
|
-
return
|
|
1817
|
+
return await new Promise((resolve, reject) => {
|
|
1919
1818
|
settle(resolve, reject, {
|
|
1920
1819
|
data: responseData,
|
|
1921
1820
|
headers: AxiosHeaders$1.from(response.headers),
|
|
@@ -1937,7 +1836,7 @@ const fetchAdapter = isFetchSupported && ((config2) => __async(void 0, null, fun
|
|
|
1937
1836
|
}
|
|
1938
1837
|
throw AxiosError$1.from(err, err && err.code, config2, request);
|
|
1939
1838
|
}
|
|
1940
|
-
})
|
|
1839
|
+
});
|
|
1941
1840
|
const knownAdapters = {
|
|
1942
1841
|
http: httpAdapter,
|
|
1943
1842
|
xhr: xhrAdapter,
|
|
@@ -2106,27 +2005,25 @@ let Axios$1 = class Axios {
|
|
|
2106
2005
|
*
|
|
2107
2006
|
* @returns {Promise} The Promise to be fulfilled
|
|
2108
2007
|
*/
|
|
2109
|
-
request(configOrUrl, config2) {
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
err.stack += "\n" + stack;
|
|
2123
|
-
}
|
|
2124
|
-
} catch (e) {
|
|
2008
|
+
async request(configOrUrl, config2) {
|
|
2009
|
+
try {
|
|
2010
|
+
return await this._request(configOrUrl, config2);
|
|
2011
|
+
} catch (err) {
|
|
2012
|
+
if (err instanceof Error) {
|
|
2013
|
+
let dummy = {};
|
|
2014
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
2015
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
|
|
2016
|
+
try {
|
|
2017
|
+
if (!err.stack) {
|
|
2018
|
+
err.stack = stack;
|
|
2019
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
|
|
2020
|
+
err.stack += "\n" + stack;
|
|
2125
2021
|
}
|
|
2022
|
+
} catch (e) {
|
|
2126
2023
|
}
|
|
2127
|
-
throw err;
|
|
2128
2024
|
}
|
|
2129
|
-
|
|
2025
|
+
throw err;
|
|
2026
|
+
}
|
|
2130
2027
|
}
|
|
2131
2028
|
_request(configOrUrl, config2) {
|
|
2132
2029
|
if (typeof configOrUrl === "string") {
|
|
@@ -2500,32 +2397,30 @@ const removeToken = (systemName = "ttc") => {
|
|
|
2500
2397
|
setSystemConfig({ token: "" });
|
|
2501
2398
|
};
|
|
2502
2399
|
const getToken = (systemName = "ttc") => {
|
|
2503
|
-
var _a;
|
|
2504
2400
|
const GlobalStateKey = `${systemName}GlobalState`;
|
|
2505
|
-
const GlobalState =
|
|
2401
|
+
const GlobalState = localStorage.getItem(GlobalStateKey) ?? "{}";
|
|
2506
2402
|
const token = JSON.parse(GlobalState) ? JSON.parse(GlobalState).token : null;
|
|
2507
2403
|
return token;
|
|
2508
2404
|
};
|
|
2509
|
-
const autoLogin =
|
|
2405
|
+
const autoLogin = async ({ userName, password }, systemName = "ttc") => {
|
|
2510
2406
|
const loginApiUrl = getSystemConfig("loginApiUrl");
|
|
2511
|
-
const { data } =
|
|
2407
|
+
const { data } = await http.post(loginApiUrl, { userName, password });
|
|
2512
2408
|
if (data.tokenValue) {
|
|
2513
2409
|
ElMessage.success("登录成功");
|
|
2514
2410
|
}
|
|
2515
2411
|
setSystemConfig({ token: data.tokenValue, userInfo: data });
|
|
2516
|
-
}
|
|
2412
|
+
};
|
|
2517
2413
|
const getUserInfo = (systemName = "ttc") => {
|
|
2518
|
-
var _a;
|
|
2519
2414
|
const GlobalStateKey = `${systemName}GlobalState`;
|
|
2520
|
-
const GlobalState =
|
|
2415
|
+
const GlobalState = localStorage.getItem(GlobalStateKey) ?? "{}";
|
|
2521
2416
|
const userInfo = JSON.parse(GlobalState) ? JSON.parse(GlobalState).userInfo : null;
|
|
2522
2417
|
return userInfo;
|
|
2523
2418
|
};
|
|
2524
|
-
const getUserRouteList = () =>
|
|
2419
|
+
const getUserRouteList = async () => {
|
|
2525
2420
|
if (!getToken()) return [];
|
|
2526
|
-
const data =
|
|
2421
|
+
const data = await getHomeMenuList();
|
|
2527
2422
|
return data;
|
|
2528
|
-
}
|
|
2423
|
+
};
|
|
2529
2424
|
const jumpToLogin = () => {
|
|
2530
2425
|
if (isProduction()) {
|
|
2531
2426
|
removeToken();
|
|
@@ -2554,29 +2449,26 @@ const getHomeUrl = () => {
|
|
|
2554
2449
|
return getSystemConfig("homeUrl");
|
|
2555
2450
|
};
|
|
2556
2451
|
const setSystemConfig = (config2) => {
|
|
2557
|
-
|
|
2558
|
-
const
|
|
2559
|
-
const newGlobalState = __spreadValues(__spreadValues({}, JSON.parse(GlobalState)), config2);
|
|
2452
|
+
const GlobalState = localStorage.getItem("ttcGlobalState") ?? "{}";
|
|
2453
|
+
const newGlobalState = { ...JSON.parse(GlobalState), ...config2 };
|
|
2560
2454
|
localStorage.setItem("ttcGlobalState", JSON.stringify(newGlobalState));
|
|
2561
2455
|
};
|
|
2562
2456
|
const changeSystemConfig = (key, value) => {
|
|
2563
|
-
|
|
2564
|
-
const
|
|
2565
|
-
const newGlobalState = __spreadProps(__spreadValues({}, JSON.parse(GlobalState)), { [key]: value });
|
|
2457
|
+
const GlobalState = localStorage.getItem("ttcGlobalState") ?? "{}";
|
|
2458
|
+
const newGlobalState = { ...JSON.parse(GlobalState), [key]: value };
|
|
2566
2459
|
localStorage.setItem("ttcGlobalState", JSON.stringify(newGlobalState));
|
|
2567
2460
|
};
|
|
2568
2461
|
const getSystemConfig = (key) => {
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
return (_b = GlobalState[key]) != null ? _b : "";
|
|
2462
|
+
const GlobalState = JSON.parse(localStorage.getItem("ttcGlobalState") ?? "{}");
|
|
2463
|
+
return GlobalState[key] ?? "";
|
|
2572
2464
|
};
|
|
2573
2465
|
const isProduction = () => {
|
|
2574
2466
|
return getSystemConfig("environment") === "production";
|
|
2575
2467
|
};
|
|
2576
|
-
const getUserPermissions = (systemName, isJumpLogin = true, serverName) =>
|
|
2468
|
+
const getUserPermissions = async (systemName, isJumpLogin = true, serverName) => {
|
|
2577
2469
|
if (!getToken() && isJumpLogin) return jumpToLogin();
|
|
2578
2470
|
try {
|
|
2579
|
-
const { data } =
|
|
2471
|
+
const { data } = await getAuthRouteList(serverName);
|
|
2580
2472
|
const systemPermissionList = data.filter((route) => route.routeTag.includes(systemName));
|
|
2581
2473
|
const userMenuList = systemPermissionList.filter((item) => item.routeType === "VIEW");
|
|
2582
2474
|
const userBtnList = systemPermissionList.filter((item) => item.routeType === "BTN");
|
|
@@ -2587,14 +2479,13 @@ const getUserPermissions = (systemName, isJumpLogin = true, serverName) => __asy
|
|
|
2587
2479
|
};
|
|
2588
2480
|
} catch (err) {
|
|
2589
2481
|
}
|
|
2590
|
-
}
|
|
2482
|
+
};
|
|
2591
2483
|
const getUserRouter = (userMenuList, viewModules) => {
|
|
2592
2484
|
let menuList = [];
|
|
2593
2485
|
userMenuList.forEach((item) => {
|
|
2594
|
-
var _a;
|
|
2595
2486
|
const viewKey = `/src/views${item.routeView}/index.vue`;
|
|
2596
2487
|
if (viewModules[viewKey]) {
|
|
2597
|
-
const pageConfig = (item == null ? void 0 : item.reservedRouteInfo) && JSON.parse((
|
|
2488
|
+
const pageConfig = (item == null ? void 0 : item.reservedRouteInfo) && JSON.parse((item == null ? void 0 : item.reservedRouteInfo) ?? "{}");
|
|
2598
2489
|
const routerObject = {
|
|
2599
2490
|
path: item.routeView,
|
|
2600
2491
|
name: item.routeView.split("/")[1],
|
|
@@ -2610,18 +2501,17 @@ const getUserRouter = (userMenuList, viewModules) => {
|
|
|
2610
2501
|
return menuList;
|
|
2611
2502
|
};
|
|
2612
2503
|
const getUserIsHaveBtnPower = (routeTag) => {
|
|
2613
|
-
var _a;
|
|
2614
2504
|
if (!routeTag) return false;
|
|
2615
|
-
const authButtonListGet =
|
|
2505
|
+
const authButtonListGet = sessionStorage.getItem("ttcUserBtnList") ?? "[]";
|
|
2616
2506
|
return JSON.parse(authButtonListGet).includes(routeTag);
|
|
2617
2507
|
};
|
|
2618
2508
|
let userConfig = null;
|
|
2619
|
-
const getUserConfig = () =>
|
|
2509
|
+
const getUserConfig = async () => {
|
|
2620
2510
|
if (userConfig) return userConfig;
|
|
2621
|
-
const { data } =
|
|
2511
|
+
const { data } = await http.get(getSystemConfig("userConfigApiUrl"), {}, { headers: { noLoading: true } });
|
|
2622
2512
|
userConfig = data;
|
|
2623
2513
|
return data;
|
|
2624
|
-
}
|
|
2514
|
+
};
|
|
2625
2515
|
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2626
2516
|
__proto__: null,
|
|
2627
2517
|
autoLogin,
|
|
@@ -2750,7 +2640,7 @@ class YxHttp {
|
|
|
2750
2640
|
}
|
|
2751
2641
|
);
|
|
2752
2642
|
this.service.interceptors.response.use(
|
|
2753
|
-
(response) =>
|
|
2643
|
+
async (response) => {
|
|
2754
2644
|
const { config: config2 } = response;
|
|
2755
2645
|
let data = response.data;
|
|
2756
2646
|
const code = response.status;
|
|
@@ -2764,7 +2654,7 @@ class YxHttp {
|
|
|
2764
2654
|
this.handleErrorResponse(data);
|
|
2765
2655
|
}
|
|
2766
2656
|
return data;
|
|
2767
|
-
}
|
|
2657
|
+
},
|
|
2768
2658
|
(error) => {
|
|
2769
2659
|
var _a;
|
|
2770
2660
|
hideFullScreenLoading();
|
|
@@ -2819,7 +2709,7 @@ class YxHttp {
|
|
|
2819
2709
|
* @description get 请求
|
|
2820
2710
|
*/
|
|
2821
2711
|
get(url, params, options = {}) {
|
|
2822
|
-
return this.service.get(url,
|
|
2712
|
+
return this.service.get(url, { params, ...options });
|
|
2823
2713
|
}
|
|
2824
2714
|
/**
|
|
2825
2715
|
*
|
|
@@ -2847,7 +2737,7 @@ class YxHttp {
|
|
|
2847
2737
|
* @param options : AxiosRequestConfig
|
|
2848
2738
|
*/
|
|
2849
2739
|
delete(url, params, options = {}) {
|
|
2850
|
-
return this.service.delete(url,
|
|
2740
|
+
return this.service.delete(url, { params, ...options });
|
|
2851
2741
|
}
|
|
2852
2742
|
}
|
|
2853
2743
|
const http = new YxHttp(config);
|
package/lib/index.es12.js.gz
CHANGED
|
Binary file
|