qsh-webview-sdk 2.3.5 → 2.3.7
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.
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var Jt = Object.defineProperty, Ht = Object.defineProperties;
|
|
2
|
+
var Yt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var ze = Object.getOwnPropertySymbols;
|
|
4
|
+
var Xt = Object.prototype.hasOwnProperty, Zt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var be = (t, e, r) => e in t ? Jt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, h = (t, e) => {
|
|
6
6
|
for (var r in e || (e = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var r of
|
|
10
|
-
|
|
7
|
+
Xt.call(e, r) && be(t, r, e[r]);
|
|
8
|
+
if (ze)
|
|
9
|
+
for (var r of ze(e))
|
|
10
|
+
Zt.call(e, r) && be(t, r, e[r]);
|
|
11
11
|
return t;
|
|
12
|
-
}, m = (t, e) =>
|
|
13
|
-
var k = (t, e, r) =>
|
|
14
|
-
var
|
|
12
|
+
}, m = (t, e) => Ht(t, Yt(e));
|
|
13
|
+
var k = (t, e, r) => be(t, typeof e != "symbol" ? e + "" : e, r);
|
|
14
|
+
var w = (t, e, r) => new Promise((n, i) => {
|
|
15
15
|
var s = (l) => {
|
|
16
16
|
try {
|
|
17
17
|
d(r.next(l));
|
|
18
|
-
} catch (
|
|
19
|
-
i(
|
|
18
|
+
} catch (E) {
|
|
19
|
+
i(E);
|
|
20
20
|
}
|
|
21
21
|
}, o = (l) => {
|
|
22
22
|
try {
|
|
23
23
|
d(r.throw(l));
|
|
24
|
-
} catch (
|
|
25
|
-
i(
|
|
24
|
+
} catch (E) {
|
|
25
|
+
i(E);
|
|
26
26
|
}
|
|
27
27
|
}, d = (l) => l.done ? n(l.value) : Promise.resolve(l.value).then(s, o);
|
|
28
28
|
d((r = r.apply(t, e)).next());
|
|
29
29
|
});
|
|
30
|
-
function
|
|
30
|
+
function pe() {
|
|
31
31
|
return typeof window != "undefined" ? window : void 0;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function De() {
|
|
34
34
|
return typeof navigator == "undefined" ? "" : navigator.userAgent || "";
|
|
35
35
|
}
|
|
36
36
|
function _() {
|
|
37
|
-
const t =
|
|
37
|
+
const t = pe();
|
|
38
38
|
if (!t) return !1;
|
|
39
39
|
if (t.__wxjs_environment === "miniprogram" || t.wx && t.wx.miniProgram)
|
|
40
40
|
return !0;
|
|
41
|
-
const e =
|
|
41
|
+
const e = De();
|
|
42
42
|
return !!(e && /micromessenger/i.test(e) && /miniProgram/i.test(e));
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
const t =
|
|
44
|
+
function Me() {
|
|
45
|
+
const t = pe();
|
|
46
46
|
return !!(t && t.plus);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const t =
|
|
48
|
+
function Re() {
|
|
49
|
+
const t = pe();
|
|
50
50
|
return !!(t && (t.__dcloud_weex_postMessage || t.__dcloud_weex_));
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
const t =
|
|
52
|
+
function Oe() {
|
|
53
|
+
const t = pe();
|
|
54
54
|
return !!(t && (t.__uniapp_x_postMessage || t.__uniapp_x_));
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
const t =
|
|
56
|
+
function Ne() {
|
|
57
|
+
const t = De();
|
|
58
58
|
return /uni-app/i.test(t);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
const t =
|
|
60
|
+
function Ue() {
|
|
61
|
+
const t = De();
|
|
62
62
|
return /Html5Plus/i.test(t);
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
return
|
|
64
|
+
function tt() {
|
|
65
|
+
return Ne() || Ue();
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
const t =
|
|
67
|
+
function Z() {
|
|
68
|
+
const t = pe();
|
|
69
69
|
if (!t) return !1;
|
|
70
70
|
if (t.__offline_bridge_postMessage) return !0;
|
|
71
71
|
try {
|
|
@@ -75,24 +75,24 @@ function X() {
|
|
|
75
75
|
}
|
|
76
76
|
return !1;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
78
|
+
function Qt() {
|
|
79
|
+
return Oe() ? "uvue" : Re() ? "nvue" : _() ? "weixin" : Z() ? "offline" : Me() ? "plus" : tt() ? "webview" : Ne() ? "UniApp" : "h5";
|
|
80
80
|
}
|
|
81
|
-
let
|
|
82
|
-
function
|
|
83
|
-
return
|
|
81
|
+
let Ee = null;
|
|
82
|
+
function Q(t = !1) {
|
|
83
|
+
return Ee && !t || (Ee = {
|
|
84
84
|
isWeixinMiniProgram: _(),
|
|
85
|
-
isAppPlus:
|
|
86
|
-
isNvue:
|
|
87
|
-
isUvue:
|
|
88
|
-
isUniApp:
|
|
89
|
-
isHtml5Plus:
|
|
90
|
-
isUniAppWebView:
|
|
91
|
-
isOfflineWebview:
|
|
92
|
-
type:
|
|
93
|
-
}),
|
|
94
|
-
}
|
|
95
|
-
const f =
|
|
85
|
+
isAppPlus: Me(),
|
|
86
|
+
isNvue: Re(),
|
|
87
|
+
isUvue: Oe(),
|
|
88
|
+
isUniApp: Ne(),
|
|
89
|
+
isHtml5Plus: Ue(),
|
|
90
|
+
isUniAppWebView: tt(),
|
|
91
|
+
isOfflineWebview: Z(),
|
|
92
|
+
type: Qt()
|
|
93
|
+
}), Ee;
|
|
94
|
+
}
|
|
95
|
+
const f = Q(), x = {
|
|
96
96
|
PLATFORM_NOT_SUPPORTED: "PLATFORM_NOT_SUPPORTED",
|
|
97
97
|
API_CALL_FAILED: "API_CALL_FAILED",
|
|
98
98
|
BRIDGE_NOT_READY: "BRIDGE_NOT_READY",
|
|
@@ -230,7 +230,7 @@ const M = class M {
|
|
|
230
230
|
* @returns {Promise} Promise 对象
|
|
231
231
|
*/
|
|
232
232
|
static safeExecuteAsync(n) {
|
|
233
|
-
return
|
|
233
|
+
return w(this, arguments, function* (e, r = {}) {
|
|
234
234
|
try {
|
|
235
235
|
return yield e();
|
|
236
236
|
} catch (i) {
|
|
@@ -290,7 +290,7 @@ const v = {
|
|
|
290
290
|
READY: "ready",
|
|
291
291
|
ERROR: "error"
|
|
292
292
|
};
|
|
293
|
-
class
|
|
293
|
+
class er {
|
|
294
294
|
constructor() {
|
|
295
295
|
this.state = v.UNINITIALIZED, this.readyPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.initializationError = null, this.handleBridgeReady = this.handleBridgeReady.bind(this), this.handleInitializationError = this.handleInitializationError.bind(this);
|
|
296
296
|
}
|
|
@@ -344,7 +344,7 @@ class Xt {
|
|
|
344
344
|
* @returns {Promise<void>} 初始化 Promise
|
|
345
345
|
*/
|
|
346
346
|
startInitialization(e) {
|
|
347
|
-
return
|
|
347
|
+
return w(this, null, function* () {
|
|
348
348
|
if (this.state !== v.UNINITIALIZED)
|
|
349
349
|
return this.waitForReady();
|
|
350
350
|
this.state = v.INITIALIZING;
|
|
@@ -423,13 +423,13 @@ class Xt {
|
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
const
|
|
426
|
+
const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = () => Y.getState(), P = {
|
|
427
427
|
ERROR: 0,
|
|
428
428
|
WARN: 1,
|
|
429
429
|
INFO: 2,
|
|
430
430
|
DEBUG: 3,
|
|
431
431
|
TRACE: 4
|
|
432
|
-
},
|
|
432
|
+
}, le = {
|
|
433
433
|
[P.ERROR]: "ERROR",
|
|
434
434
|
[P.WARN]: "WARN",
|
|
435
435
|
[P.INFO]: "INFO",
|
|
@@ -442,7 +442,7 @@ const H = new Xt(), et = () => H.waitForReady(), Zt = () => H.isReady(), Qt = ()
|
|
|
442
442
|
* @param {number} level - 日志级别
|
|
443
443
|
*/
|
|
444
444
|
static setLevel(e) {
|
|
445
|
-
e >= P.ERROR && e <= P.TRACE && (g.currentLevel = e, g.log(P.INFO, "Logger", `日志级别设置为: ${
|
|
445
|
+
e >= P.ERROR && e <= P.TRACE && (g.currentLevel = e, g.log(P.INFO, "Logger", `日志级别设置为: ${le[e]}`));
|
|
446
446
|
}
|
|
447
447
|
/**
|
|
448
448
|
* 启用开发模式(显示所有日志)
|
|
@@ -491,7 +491,7 @@ const H = new Xt(), et = () => H.waitForReady(), Zt = () => H.isReady(), Qt = ()
|
|
|
491
491
|
static log(e, r, n, ...i) {
|
|
492
492
|
if (!g.shouldLog(e, r))
|
|
493
493
|
return;
|
|
494
|
-
const s = (/* @__PURE__ */ new Date()).toISOString(), o =
|
|
494
|
+
const s = (/* @__PURE__ */ new Date()).toISOString(), o = le[e], d = r ? `[${r}]` : "", l = `${g.prefix} ${d} ${n}`, E = {
|
|
495
495
|
timestamp: s,
|
|
496
496
|
level: e,
|
|
497
497
|
levelName: o,
|
|
@@ -499,9 +499,9 @@ const H = new Xt(), et = () => H.waitForReady(), Zt = () => H.isReady(), Qt = ()
|
|
|
499
499
|
message: n,
|
|
500
500
|
args: i
|
|
501
501
|
};
|
|
502
|
-
if (g.addToHistory(
|
|
502
|
+
if (g.addToHistory(E), typeof g.reporter == "function")
|
|
503
503
|
try {
|
|
504
|
-
g.reporter(
|
|
504
|
+
g.reporter(E);
|
|
505
505
|
} catch (N) {
|
|
506
506
|
}
|
|
507
507
|
g.outputToConsole(e, l, ...i);
|
|
@@ -607,13 +607,13 @@ const H = new Xt(), et = () => H.waitForReady(), Zt = () => H.isReady(), Qt = ()
|
|
|
607
607
|
static getStats() {
|
|
608
608
|
const e = {
|
|
609
609
|
currentLevel: g.currentLevel,
|
|
610
|
-
currentLevelName:
|
|
610
|
+
currentLevelName: le[g.currentLevel],
|
|
611
611
|
enabledModules: Array.from(g.enabledModules),
|
|
612
612
|
historySize: g.logHistory.length,
|
|
613
613
|
maxHistorySize: g.maxHistorySize
|
|
614
614
|
}, r = {};
|
|
615
|
-
for (const n of Object.keys(
|
|
616
|
-
r[
|
|
615
|
+
for (const n of Object.keys(le))
|
|
616
|
+
r[le[n]] = 0;
|
|
617
617
|
return g.logHistory.forEach((n) => {
|
|
618
618
|
r[n.levelName]++;
|
|
619
619
|
}), e.levelCounts = r, e;
|
|
@@ -657,7 +657,7 @@ k(g, "currentLevel", P.ERROR), // 生产环境默认只显示错误
|
|
|
657
657
|
k(g, "enabledModules", /* @__PURE__ */ new Set()), // 启用日志的模块
|
|
658
658
|
k(g, "logHistory", []), // 日志历史(最多保留1000条)
|
|
659
659
|
k(g, "maxHistorySize", 1e3), k(g, "prefix", "[QSH-SDK]"), k(g, "reporter", null);
|
|
660
|
-
let
|
|
660
|
+
let L = g;
|
|
661
661
|
if (typeof window != "undefined") {
|
|
662
662
|
const t = window.location && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes("192.168.")), e = window.location && (window.location.search.includes("debug=true") || window.location.search.includes("qsh_debug=1"));
|
|
663
663
|
let r = !1;
|
|
@@ -665,16 +665,16 @@ if (typeof window != "undefined") {
|
|
|
665
665
|
r = localStorage && localStorage.getItem("qsh_debug") === "true";
|
|
666
666
|
} catch (n) {
|
|
667
667
|
}
|
|
668
|
-
(t || e || r) &&
|
|
668
|
+
(t || e || r) && L.enableDevMode();
|
|
669
669
|
}
|
|
670
|
-
const A =
|
|
671
|
-
function
|
|
672
|
-
if (!
|
|
670
|
+
const A = L.createModuleLogger("Bridge"), I = L.createModuleLogger("Platform"), a = L.createModuleLogger("API"), D = L.createModuleLogger("State"), Ae = /complete|loaded|interactive/;
|
|
671
|
+
function nr(t) {
|
|
672
|
+
if (!Z()) return !1;
|
|
673
673
|
A.debug("检测到离线包环境,开始初始化");
|
|
674
674
|
const e = () => {
|
|
675
675
|
t();
|
|
676
676
|
};
|
|
677
|
-
if (
|
|
677
|
+
if (Ae.test(document.readyState))
|
|
678
678
|
A.debug("离线包环境 DOM 已就绪,立即初始化"), setTimeout(e, 0);
|
|
679
679
|
else {
|
|
680
680
|
A.debug("离线包环境,等待 DOMContentLoaded");
|
|
@@ -686,20 +686,20 @@ function er(t) {
|
|
|
686
686
|
}
|
|
687
687
|
return !0;
|
|
688
688
|
}
|
|
689
|
-
function
|
|
690
|
-
return
|
|
689
|
+
function ir(t) {
|
|
690
|
+
return Ne() || Ue() ? (A.debug("检测到 APP 环境,开始初始化"), window.__uniapp_x_postMessage || window.__uniapp_x_ || window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? (A.debug("NVUE/UVUE 环境,等待 DOMContentLoaded"), document.addEventListener("DOMContentLoaded", t)) : window.plus && Ae.test(document.readyState) ? (A.debug("Plus 环境已就绪,立即初始化"), setTimeout(t, 0)) : window.plus ? (A.debug("Plus 环境,等待 plusready 事件"), document.addEventListener("plusready", t)) : Ae.test(document.readyState) ? setTimeout(t, 0) : document.addEventListener("DOMContentLoaded", t, { once: !0 }), !0) : !1;
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function ar(t) {
|
|
693
693
|
return window.wx && window.wx.miniProgram ? (A.debug("检测到微信小程序环境,开始初始化"), window.WeixinJSBridge && window.WeixinJSBridge.invoke ? (A.debug("微信 JSBridge 已就绪,立即初始化"), setTimeout(t, 0)) : (A.debug("微信 JSBridge 未就绪,等待 WeixinJSBridgeReady 事件"), document.addEventListener("WeixinJSBridgeReady", t)), !0) : !1;
|
|
694
694
|
}
|
|
695
|
-
function
|
|
696
|
-
return A.info("开始初始化 JSBridge"),
|
|
695
|
+
function sr(t) {
|
|
696
|
+
return A.info("开始初始化 JSBridge"), nr(t) ? (A.info("使用离线包环境初始化"), !0) : ir(t) ? (A.info("使用 APP 环境初始化"), !0) : ar(t) ? (A.info("使用微信小程序环境初始化"), !0) : (A.debug("使用默认 H5 环境初始化"), Ae.test(document.readyState) ? (A.debug("DOM 已就绪,立即初始化"), setTimeout(t, 0)) : (A.debug("DOM 未就绪,等待 DOMContentLoaded"), document.addEventListener("DOMContentLoaded", t)), !0);
|
|
697
697
|
}
|
|
698
|
-
function
|
|
699
|
-
return
|
|
698
|
+
function or() {
|
|
699
|
+
return Y.waitForReady();
|
|
700
700
|
}
|
|
701
|
-
function
|
|
702
|
-
return
|
|
701
|
+
function nt() {
|
|
702
|
+
return Y.startInitialization(() => w(null, null, function* () {
|
|
703
703
|
return new Promise((t, e) => {
|
|
704
704
|
const r = () => {
|
|
705
705
|
t();
|
|
@@ -710,7 +710,7 @@ function tt() {
|
|
|
710
710
|
e(s);
|
|
711
711
|
};
|
|
712
712
|
try {
|
|
713
|
-
|
|
713
|
+
sr(() => {
|
|
714
714
|
r();
|
|
715
715
|
});
|
|
716
716
|
} catch (i) {
|
|
@@ -725,10 +725,10 @@ const S = {
|
|
|
725
725
|
CONFIGURED: "configured",
|
|
726
726
|
ERROR: "error"
|
|
727
727
|
};
|
|
728
|
-
function
|
|
728
|
+
function K() {
|
|
729
729
|
return typeof window == "undefined" || !window.wx ? !1 : typeof window.wx.config == "function" && typeof window.wx.ready == "function" && typeof window.wx.error == "function";
|
|
730
730
|
}
|
|
731
|
-
class
|
|
731
|
+
class cr {
|
|
732
732
|
constructor() {
|
|
733
733
|
this.state = S.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, this.runtimeConfig = {
|
|
734
734
|
clientId: null,
|
|
@@ -807,7 +807,7 @@ class ar {
|
|
|
807
807
|
* @private
|
|
808
808
|
*/
|
|
809
809
|
fetchWeixinConfig() {
|
|
810
|
-
return
|
|
810
|
+
return w(this, null, function* () {
|
|
811
811
|
const e = this.getCurrentPageUrl();
|
|
812
812
|
if (this.isTestMode())
|
|
813
813
|
return I.info("使用测试模式,返回模拟配置"), this.getMockConfig();
|
|
@@ -889,7 +889,7 @@ class ar {
|
|
|
889
889
|
}, 100);
|
|
890
890
|
return;
|
|
891
891
|
}
|
|
892
|
-
if (!
|
|
892
|
+
if (!K())
|
|
893
893
|
throw new Error("微信JS-SDK未加载");
|
|
894
894
|
const r = {
|
|
895
895
|
debug: !1,
|
|
@@ -945,7 +945,7 @@ class ar {
|
|
|
945
945
|
* @returns {Promise<void>} 配置完成的Promise
|
|
946
946
|
*/
|
|
947
947
|
autoConfig() {
|
|
948
|
-
return
|
|
948
|
+
return w(this, null, function* () {
|
|
949
949
|
return this.hasRequiredConfig() ? this.state === S.CONFIGURED ? Promise.resolve() : this.state === S.ERROR ? Promise.reject(this.lastError) : this.configPromise ? this.configPromise : (this.state = S.CONFIGURING, this.configPromise = this.performAutoConfig(), this.configPromise) : (I.warn("clientId为空,等待qsh.config({ clientId })"), Promise.resolve());
|
|
950
950
|
});
|
|
951
951
|
}
|
|
@@ -955,11 +955,11 @@ class ar {
|
|
|
955
955
|
* @private
|
|
956
956
|
*/
|
|
957
957
|
performAutoConfig() {
|
|
958
|
-
return
|
|
958
|
+
return w(this, null, function* () {
|
|
959
959
|
try {
|
|
960
960
|
if (typeof window == "undefined")
|
|
961
961
|
throw new Error("非浏览器环境无法执行微信配置");
|
|
962
|
-
if (!
|
|
962
|
+
if (!K())
|
|
963
963
|
throw new Error("微信JS-SDK未加载,无法执行配置");
|
|
964
964
|
const e = yield this.fetchWeixinConfig();
|
|
965
965
|
return this.executeWeixinConfig(e), yield new Promise((r, n) => {
|
|
@@ -1041,129 +1041,129 @@ class ar {
|
|
|
1041
1041
|
};
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
|
-
const
|
|
1045
|
-
let
|
|
1046
|
-
function
|
|
1044
|
+
const b = new cr();
|
|
1045
|
+
let ne = !1, ge = !1, U = null, Pe = !1;
|
|
1046
|
+
function ur(t) {
|
|
1047
1047
|
return new Promise((e) => {
|
|
1048
1048
|
let r = !1, n = null;
|
|
1049
|
-
const i = (d) =>
|
|
1049
|
+
const i = (d) => w(null, null, function* () {
|
|
1050
1050
|
if (!r) {
|
|
1051
|
-
if (r = !0, n && clearTimeout(n),
|
|
1051
|
+
if (r = !0, n && clearTimeout(n), ne = !1, ge = d, d)
|
|
1052
1052
|
try {
|
|
1053
|
-
yield
|
|
1053
|
+
yield it();
|
|
1054
1054
|
} catch (l) {
|
|
1055
1055
|
I.error("微信配置失败,将使用消息桥作为后备", l);
|
|
1056
1056
|
}
|
|
1057
1057
|
e();
|
|
1058
1058
|
}
|
|
1059
|
-
}), s = () => i(
|
|
1059
|
+
}), s = () => i(K()), o = () => {
|
|
1060
1060
|
I.warn("已存在的微信 JS-SDK 脚本加载失败,SDK 将使用消息桥作为后备"), i(!1);
|
|
1061
1061
|
};
|
|
1062
1062
|
t.addEventListener("load", s, { once: !0 }), t.addEventListener("error", o, { once: !0 }), setTimeout(() => {
|
|
1063
|
-
|
|
1063
|
+
K() && s();
|
|
1064
1064
|
}, 0), n = setTimeout(() => {
|
|
1065
|
-
i(
|
|
1065
|
+
i(K());
|
|
1066
1066
|
}, 3e3);
|
|
1067
1067
|
});
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1070
|
-
return
|
|
1069
|
+
function We() {
|
|
1070
|
+
return w(this, arguments, function* (t = {}) {
|
|
1071
1071
|
const { force: e = !1, recoverFromError: r = !1 } = t;
|
|
1072
|
-
if (yield
|
|
1072
|
+
if (yield at({ force: e }), !K())
|
|
1073
1073
|
throw new Error("微信 JS-SDK 未正确加载,无法执行配置");
|
|
1074
|
-
r &&
|
|
1074
|
+
r && fr();
|
|
1075
1075
|
});
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function lr(t = !1) {
|
|
1078
1078
|
if (typeof window == "undefined") return !1;
|
|
1079
|
-
if (
|
|
1080
|
-
return
|
|
1081
|
-
if (
|
|
1079
|
+
if (K())
|
|
1080
|
+
return ge = !0, !1;
|
|
1081
|
+
if (ge || Z()) return !1;
|
|
1082
1082
|
if (t) return !0;
|
|
1083
1083
|
const e = navigator.userAgent || "", r = /micromessenger/i.test(e), n = /miniProgram/i.test(e), i = typeof window.__wxjs_environment != "undefined" && window.__wxjs_environment === "miniprogram", s = !!(window.wx && window.wx.miniProgram);
|
|
1084
1084
|
return r && (n || i || s);
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1087
|
-
|
|
1086
|
+
function fr() {
|
|
1087
|
+
b.getState() === "error" && (b.reset(), Pe = !1);
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1090
|
-
return
|
|
1091
|
-
if (
|
|
1092
|
-
return
|
|
1093
|
-
|
|
1089
|
+
function it() {
|
|
1090
|
+
return w(this, null, function* () {
|
|
1091
|
+
if (Pe)
|
|
1092
|
+
return b.waitForReady();
|
|
1093
|
+
Pe = !0, I.info("开始自动配置微信JS-SDK");
|
|
1094
1094
|
try {
|
|
1095
|
-
yield
|
|
1095
|
+
yield b.autoConfig(), I.info("微信JS-SDK自动配置完成");
|
|
1096
1096
|
} catch (t) {
|
|
1097
1097
|
I.error("微信JS-SDK自动配置失败", t);
|
|
1098
1098
|
}
|
|
1099
1099
|
});
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1101
|
+
function at(t = {}) {
|
|
1102
1102
|
const { force: e = !1 } = t;
|
|
1103
1103
|
if (typeof window == "undefined")
|
|
1104
1104
|
return Promise.resolve();
|
|
1105
|
-
if (
|
|
1106
|
-
return
|
|
1105
|
+
if (K())
|
|
1106
|
+
return ge = !0, Promise.resolve();
|
|
1107
1107
|
const r = document.getElementById("weixin-jssdk");
|
|
1108
|
-
return r ? U || (
|
|
1108
|
+
return r ? U || (ne = !0, U = ur(r).finally(() => {
|
|
1109
1109
|
U = null;
|
|
1110
|
-
}), U) :
|
|
1111
|
-
|
|
1110
|
+
}), U) : lr(e) ? U || (U = new Promise((n) => {
|
|
1111
|
+
ne = !0;
|
|
1112
1112
|
try {
|
|
1113
1113
|
const i = document.createElement("script");
|
|
1114
1114
|
i.id = "weixin-jssdk", i.type = "text/javascript", i.async = !0, i.src = "https://res.wx.qq.com/open/js/jweixin-1.6.2.js", i.onload = function() {
|
|
1115
|
-
return
|
|
1116
|
-
|
|
1115
|
+
return w(this, null, function* () {
|
|
1116
|
+
ge = !0, ne = !1, I.info("微信 JS-SDK 已自动加载");
|
|
1117
1117
|
try {
|
|
1118
|
-
yield
|
|
1118
|
+
yield it();
|
|
1119
1119
|
} catch (o) {
|
|
1120
1120
|
I.error("微信配置失败,将使用消息桥作为后备", o);
|
|
1121
1121
|
}
|
|
1122
1122
|
n();
|
|
1123
1123
|
});
|
|
1124
1124
|
}, i.onerror = function() {
|
|
1125
|
-
|
|
1125
|
+
ne = !1, I.warn("微信 JS-SDK 加载失败,SDK 将使用消息桥作为后备"), n();
|
|
1126
1126
|
}, (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(i);
|
|
1127
1127
|
} catch (i) {
|
|
1128
|
-
|
|
1128
|
+
ne = !1, I.error("注入微信 JS-SDK 失败", i), n();
|
|
1129
1129
|
}
|
|
1130
1130
|
}).finally(() => {
|
|
1131
1131
|
U = null;
|
|
1132
1132
|
}), U) : Promise.resolve();
|
|
1133
1133
|
}
|
|
1134
|
-
function
|
|
1135
|
-
return
|
|
1134
|
+
function J() {
|
|
1135
|
+
return We({ force: !0, recoverFromError: !0 }).then(() => b.waitForReady());
|
|
1136
1136
|
}
|
|
1137
|
-
function
|
|
1138
|
-
const e =
|
|
1139
|
-
return typeof window == "undefined" ||
|
|
1137
|
+
function Je(t = {}) {
|
|
1138
|
+
const e = b.configure(t);
|
|
1139
|
+
return typeof window == "undefined" || We({
|
|
1140
1140
|
force: !0,
|
|
1141
|
-
recoverFromError:
|
|
1141
|
+
recoverFromError: b.getState() === "error"
|
|
1142
1142
|
}).then(() => {
|
|
1143
|
-
if (!
|
|
1144
|
-
return
|
|
1143
|
+
if (!b.isReady())
|
|
1144
|
+
return b.waitForReady().catch((r) => {
|
|
1145
1145
|
I.error("Failed to auto-configure Weixin after qsh.config()", r);
|
|
1146
1146
|
});
|
|
1147
|
-
window.wx && !
|
|
1147
|
+
window.wx && !K() && I.warn("window.wx 已存在,但微信 JS-SDK 尚未就绪,跳过自动配置");
|
|
1148
1148
|
}).catch((r) => {
|
|
1149
1149
|
I.error("Failed to preload Weixin JS-SDK", r);
|
|
1150
1150
|
}), e;
|
|
1151
1151
|
}
|
|
1152
|
-
function
|
|
1153
|
-
return
|
|
1152
|
+
function ee() {
|
|
1153
|
+
return b.isReady();
|
|
1154
1154
|
}
|
|
1155
|
-
function
|
|
1156
|
-
return
|
|
1155
|
+
function dr() {
|
|
1156
|
+
return b.getState();
|
|
1157
1157
|
}
|
|
1158
|
-
function
|
|
1159
|
-
return
|
|
1158
|
+
function Le() {
|
|
1159
|
+
return b;
|
|
1160
1160
|
}
|
|
1161
|
-
function
|
|
1162
|
-
return
|
|
1163
|
-
return I.info("手动重试微信配置"),
|
|
1161
|
+
function gr() {
|
|
1162
|
+
return w(this, null, function* () {
|
|
1163
|
+
return I.info("手动重试微信配置"), b.reset(), Pe = !1, yield We({ force: !0 }), b.waitForReady();
|
|
1164
1164
|
});
|
|
1165
1165
|
}
|
|
1166
|
-
class
|
|
1166
|
+
class hr {
|
|
1167
1167
|
constructor() {
|
|
1168
1168
|
this.plugins = /* @__PURE__ */ new Map(), this.installed = /* @__PURE__ */ new Set(), this.installOrder = [], a.debug("插件管理器已初始化");
|
|
1169
1169
|
}
|
|
@@ -1215,8 +1215,8 @@ class fr {
|
|
|
1215
1215
|
* await pluginManager.install('image', qsh)
|
|
1216
1216
|
*/
|
|
1217
1217
|
install(e, r) {
|
|
1218
|
-
return
|
|
1219
|
-
return u.safeExecute(() =>
|
|
1218
|
+
return w(this, null, function* () {
|
|
1219
|
+
return u.safeExecute(() => w(this, null, function* () {
|
|
1220
1220
|
if (!this.plugins.has(e))
|
|
1221
1221
|
throw new Error(`插件 ${e} 未注册`);
|
|
1222
1222
|
if (this.installed.has(e)) {
|
|
@@ -1245,8 +1245,8 @@ class fr {
|
|
|
1245
1245
|
* await pluginManager.uninstall('image', qsh)
|
|
1246
1246
|
*/
|
|
1247
1247
|
uninstall(e, r) {
|
|
1248
|
-
return
|
|
1249
|
-
return u.safeExecute(() =>
|
|
1248
|
+
return w(this, null, function* () {
|
|
1249
|
+
return u.safeExecute(() => w(this, null, function* () {
|
|
1250
1250
|
if (!this.installed.has(e)) {
|
|
1251
1251
|
a.debug(`插件 ${e} 未安装,跳过卸载`);
|
|
1252
1252
|
return;
|
|
@@ -1267,7 +1267,7 @@ class fr {
|
|
|
1267
1267
|
* @returns {Promise<void>}
|
|
1268
1268
|
*/
|
|
1269
1269
|
uninstallAll(e) {
|
|
1270
|
-
return
|
|
1270
|
+
return w(this, null, function* () {
|
|
1271
1271
|
const r = [...this.installOrder].reverse();
|
|
1272
1272
|
for (const n of r)
|
|
1273
1273
|
yield this.uninstall(n, e);
|
|
@@ -1294,7 +1294,7 @@ class fr {
|
|
|
1294
1294
|
* await pluginManager.installAll(['image', 'location'], qsh)
|
|
1295
1295
|
*/
|
|
1296
1296
|
installAll(e, r) {
|
|
1297
|
-
return
|
|
1297
|
+
return w(this, null, function* () {
|
|
1298
1298
|
if (!Array.isArray(e))
|
|
1299
1299
|
throw new Error("names 必须是数组");
|
|
1300
1300
|
for (const n of e)
|
|
@@ -1356,8 +1356,8 @@ class fr {
|
|
|
1356
1356
|
this.plugins.clear(), this.installed.clear(), this.installOrder = [];
|
|
1357
1357
|
}
|
|
1358
1358
|
}
|
|
1359
|
-
const
|
|
1360
|
-
class
|
|
1359
|
+
const fe = new hr();
|
|
1360
|
+
class pr {
|
|
1361
1361
|
constructor() {
|
|
1362
1362
|
this.requestInterceptors = [], this.responseInterceptors = [], a.debug("拦截器链已初始化");
|
|
1363
1363
|
}
|
|
@@ -1416,7 +1416,7 @@ class dr {
|
|
|
1416
1416
|
* @private
|
|
1417
1417
|
*/
|
|
1418
1418
|
runRequest(e) {
|
|
1419
|
-
return
|
|
1419
|
+
return w(this, null, function* () {
|
|
1420
1420
|
let r = h({}, e);
|
|
1421
1421
|
for (const { fn: n } of this.requestInterceptors) {
|
|
1422
1422
|
if (r.abort) {
|
|
@@ -1442,7 +1442,7 @@ class dr {
|
|
|
1442
1442
|
* @private
|
|
1443
1443
|
*/
|
|
1444
1444
|
runResponse(e, r) {
|
|
1445
|
-
return
|
|
1445
|
+
return w(this, null, function* () {
|
|
1446
1446
|
let n = e;
|
|
1447
1447
|
for (const { fn: i } of this.responseInterceptors)
|
|
1448
1448
|
try {
|
|
@@ -1471,7 +1471,7 @@ class dr {
|
|
|
1471
1471
|
};
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
|
-
const
|
|
1474
|
+
const H = new pr(), mr = {
|
|
1475
1475
|
/**
|
|
1476
1476
|
* 请求日志
|
|
1477
1477
|
*/
|
|
@@ -1488,7 +1488,7 @@ const J = new dr(), gr = {
|
|
|
1488
1488
|
success: t == null ? void 0 : t.success
|
|
1489
1489
|
}), t;
|
|
1490
1490
|
}
|
|
1491
|
-
},
|
|
1491
|
+
}, q = {
|
|
1492
1492
|
// 性能数据存储
|
|
1493
1493
|
metrics: /* @__PURE__ */ new Map(),
|
|
1494
1494
|
/**
|
|
@@ -1500,14 +1500,14 @@ const J = new dr(), gr = {
|
|
|
1500
1500
|
*/
|
|
1501
1501
|
response: (t, e) => {
|
|
1502
1502
|
const r = performance.now() - e.perfStartTime;
|
|
1503
|
-
|
|
1503
|
+
q.metrics.has(e.apiName) || q.metrics.set(e.apiName, {
|
|
1504
1504
|
count: 0,
|
|
1505
1505
|
totalTime: 0,
|
|
1506
1506
|
minTime: 1 / 0,
|
|
1507
1507
|
maxTime: 0,
|
|
1508
1508
|
avgTime: 0
|
|
1509
1509
|
});
|
|
1510
|
-
const n =
|
|
1510
|
+
const n = q.metrics.get(e.apiName);
|
|
1511
1511
|
return n.count++, n.totalTime += r, n.minTime = Math.min(n.minTime, r), n.maxTime = Math.max(n.maxTime, r), n.avgTime = n.totalTime / n.count, t;
|
|
1512
1512
|
},
|
|
1513
1513
|
/**
|
|
@@ -1515,7 +1515,7 @@ const J = new dr(), gr = {
|
|
|
1515
1515
|
*/
|
|
1516
1516
|
getReport: () => {
|
|
1517
1517
|
const t = {};
|
|
1518
|
-
return
|
|
1518
|
+
return q.metrics.forEach((e, r) => {
|
|
1519
1519
|
t[r] = h({}, e);
|
|
1520
1520
|
}), t;
|
|
1521
1521
|
},
|
|
@@ -1523,22 +1523,22 @@ const J = new dr(), gr = {
|
|
|
1523
1523
|
* 清空性能数据
|
|
1524
1524
|
*/
|
|
1525
1525
|
clearMetrics: () => {
|
|
1526
|
-
|
|
1526
|
+
q.metrics.clear();
|
|
1527
1527
|
}
|
|
1528
1528
|
};
|
|
1529
|
-
function
|
|
1529
|
+
function wr(t = {}) {
|
|
1530
1530
|
const {
|
|
1531
1531
|
maxRetries: e = 3,
|
|
1532
1532
|
retryDelay: r = 1e3,
|
|
1533
1533
|
shouldRetry: n = (i) => !i.success
|
|
1534
1534
|
} = t;
|
|
1535
1535
|
return {
|
|
1536
|
-
response: (i, s) =>
|
|
1536
|
+
response: (i, s) => w(null, null, function* () {
|
|
1537
1537
|
return s.retryCount || (s.retryCount = 0), n(i) && s.retryCount < e && (s.retryCount++, a.warn(`API 调用失败,第 ${s.retryCount} 次重试: ${s.apiName}`), yield new Promise((o) => setTimeout(o, r)), i.shouldRetry = !0, i.retryContext = s), i;
|
|
1538
1538
|
})
|
|
1539
1539
|
};
|
|
1540
1540
|
}
|
|
1541
|
-
function
|
|
1541
|
+
function Er(t = {}) {
|
|
1542
1542
|
return {
|
|
1543
1543
|
request: (e) => {
|
|
1544
1544
|
const r = t[e.apiName];
|
|
@@ -1550,7 +1550,7 @@ function mr(t = {}) {
|
|
|
1550
1550
|
}
|
|
1551
1551
|
};
|
|
1552
1552
|
}
|
|
1553
|
-
class
|
|
1553
|
+
class yr {
|
|
1554
1554
|
constructor() {
|
|
1555
1555
|
this.state = {
|
|
1556
1556
|
// SDK 状态
|
|
@@ -1688,12 +1688,12 @@ class pr {
|
|
|
1688
1688
|
for (let o = 1; o < s.length; o++) {
|
|
1689
1689
|
const d = s.slice(0, o).join("."), l = this.listeners.get(d);
|
|
1690
1690
|
if (l) {
|
|
1691
|
-
const
|
|
1691
|
+
const E = this.get(d);
|
|
1692
1692
|
l.forEach((N) => {
|
|
1693
1693
|
try {
|
|
1694
|
-
N(
|
|
1695
|
-
} catch (
|
|
1696
|
-
D.error("父路径订阅者执行失败",
|
|
1694
|
+
N(E, void 0, d);
|
|
1695
|
+
} catch (R) {
|
|
1696
|
+
D.error("父路径订阅者执行失败", R);
|
|
1697
1697
|
}
|
|
1698
1698
|
});
|
|
1699
1699
|
}
|
|
@@ -1795,7 +1795,7 @@ class pr {
|
|
|
1795
1795
|
};
|
|
1796
1796
|
}
|
|
1797
1797
|
}
|
|
1798
|
-
const
|
|
1798
|
+
const G = new yr(), c = {
|
|
1799
1799
|
// SDK 核心错误 (E_SDK_xxx)
|
|
1800
1800
|
SDK_NOT_READY: "E_SDK_001",
|
|
1801
1801
|
SDK_INIT_FAILED: "E_SDK_002",
|
|
@@ -1846,7 +1846,7 @@ const B = new pr(), c = {
|
|
|
1846
1846
|
API_TIMEOUT: "E_TIMEOUT_001",
|
|
1847
1847
|
// 通用错误
|
|
1848
1848
|
UNKNOWN_ERROR: "E_UNKNOWN_999"
|
|
1849
|
-
},
|
|
1849
|
+
}, ve = {
|
|
1850
1850
|
// SDK 核心
|
|
1851
1851
|
[c.SDK_NOT_READY]: "SDK 未就绪",
|
|
1852
1852
|
[c.SDK_INIT_FAILED]: "SDK 初始化失败",
|
|
@@ -1902,7 +1902,7 @@ const B = new pr(), c = {
|
|
|
1902
1902
|
// 配置问题
|
|
1903
1903
|
UNKNOWN: "unknown"
|
|
1904
1904
|
// 未知问题
|
|
1905
|
-
},
|
|
1905
|
+
}, Ir = {
|
|
1906
1906
|
// 图片相关
|
|
1907
1907
|
"IMAGE/USER_CANCEL": c.IMAGE_CANCELLED,
|
|
1908
1908
|
"IMAGE/PERMISSION_DENIED": c.IMAGE_NO_PERMISSION,
|
|
@@ -1910,7 +1910,7 @@ const B = new pr(), c = {
|
|
|
1910
1910
|
"COMMON/UNKNOWN": c.UNKNOWN_ERROR,
|
|
1911
1911
|
"COMMON/CONFIG_NOT_READY": c.IMAGE_CONFIG_NOT_READY,
|
|
1912
1912
|
"COMMON/PLATFORM_NOT_SUPPORTED": c.PLATFORM_NOT_SUPPORTED
|
|
1913
|
-
},
|
|
1913
|
+
}, He = {
|
|
1914
1914
|
// 微信平台错误模式
|
|
1915
1915
|
weixin: {
|
|
1916
1916
|
patterns: [
|
|
@@ -1944,7 +1944,7 @@ const B = new pr(), c = {
|
|
|
1944
1944
|
],
|
|
1945
1945
|
default: c.UNKNOWN_ERROR
|
|
1946
1946
|
}
|
|
1947
|
-
},
|
|
1947
|
+
}, Ye = {
|
|
1948
1948
|
chooseImage: {
|
|
1949
1949
|
"fail cancel": c.IMAGE_CANCELLED,
|
|
1950
1950
|
"fail auth deny": c.IMAGE_NO_PERMISSION,
|
|
@@ -1958,19 +1958,19 @@ const B = new pr(), c = {
|
|
|
1958
1958
|
NOT_IN_CONTAINER: c.PLATFORM_NOT_SUPPORTED
|
|
1959
1959
|
}
|
|
1960
1960
|
};
|
|
1961
|
-
function
|
|
1961
|
+
function st(t) {
|
|
1962
1962
|
return t ? t.includes("CANCEL") ? W.USER_CANCEL : t.includes("PERM") || t.includes("PERMISSION") ? W.PERMISSION : t.includes("NET") || t.includes("NETWORK") ? W.NETWORK : t.includes("PARAM") ? W.PARAM : t.includes("CONFIG") ? W.CONFIG : t.includes("SDK") || t.includes("PLATFORM") ? W.SYSTEM : W.UNKNOWN : W.UNKNOWN;
|
|
1963
1963
|
}
|
|
1964
|
-
function
|
|
1964
|
+
function Ar(t) {
|
|
1965
1965
|
return t.includes("NET_") || t.includes("TIMEOUT") || t === c.NETWORK_ERROR || t === c.NETWORK_TIMEOUT || t === c.API_TIMEOUT;
|
|
1966
1966
|
}
|
|
1967
|
-
function
|
|
1968
|
-
return t.includes("CANCEL") ||
|
|
1967
|
+
function Pr(t) {
|
|
1968
|
+
return t.includes("CANCEL") || st(t) === W.USER_CANCEL;
|
|
1969
1969
|
}
|
|
1970
|
-
function
|
|
1971
|
-
return
|
|
1970
|
+
function ie(t) {
|
|
1971
|
+
return ve[t] || ve[c.UNKNOWN_ERROR];
|
|
1972
1972
|
}
|
|
1973
|
-
class
|
|
1973
|
+
class V extends Error {
|
|
1974
1974
|
/**
|
|
1975
1975
|
* 构造函数
|
|
1976
1976
|
* @param {string} code - 错误码
|
|
@@ -1978,7 +1978,7 @@ class K extends Error {
|
|
|
1978
1978
|
* @param {Object} options - 选项
|
|
1979
1979
|
*/
|
|
1980
1980
|
constructor(e, r, n = {}) {
|
|
1981
|
-
super(r), this.name = "StandardError", this.code = e, this.message = r ||
|
|
1981
|
+
super(r), this.name = "StandardError", this.code = e, this.message = r || ie(e), this.platform = n.platform || f.type, this.apiName = n.apiName, this.category = n.category || st(e), this.retriable = n.retriable !== void 0 ? n.retriable : Ar(e), this.originalError = n.originalError, this.details = n.details || {}, this.timestamp = Date.now();
|
|
1982
1982
|
}
|
|
1983
1983
|
/**
|
|
1984
1984
|
* 是否可重试
|
|
@@ -1992,7 +1992,7 @@ class K extends Error {
|
|
|
1992
1992
|
* @returns {boolean}
|
|
1993
1993
|
*/
|
|
1994
1994
|
isUserAction() {
|
|
1995
|
-
return
|
|
1995
|
+
return Pr(this.code);
|
|
1996
1996
|
}
|
|
1997
1997
|
/**
|
|
1998
1998
|
* 转为普通对象
|
|
@@ -2013,15 +2013,15 @@ class K extends Error {
|
|
|
2013
2013
|
} : {});
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
2016
|
-
function
|
|
2017
|
-
if (t instanceof
|
|
2016
|
+
function ot(t, e = {}) {
|
|
2017
|
+
if (t instanceof V)
|
|
2018
2018
|
return t;
|
|
2019
2019
|
const { apiName: r, platform: n = f.type } = e;
|
|
2020
|
-
return t && typeof t.code == "string" && t.code.includes("/") ?
|
|
2020
|
+
return t && typeof t.code == "string" && t.code.includes("/") ? _r(t, { apiName: r, platform: n }) : t && (t.errMsg || t.message) ? Cr(t, { apiName: r, platform: n }) : typeof t == "string" ? new V(
|
|
2021
2021
|
c.UNKNOWN_ERROR,
|
|
2022
2022
|
t,
|
|
2023
2023
|
{ apiName: r, platform: n, originalError: t }
|
|
2024
|
-
) : new
|
|
2024
|
+
) : new V(
|
|
2025
2025
|
c.UNKNOWN_ERROR,
|
|
2026
2026
|
"未知错误",
|
|
2027
2027
|
{
|
|
@@ -2032,14 +2032,14 @@ function at(t, e = {}) {
|
|
|
2032
2032
|
}
|
|
2033
2033
|
);
|
|
2034
2034
|
}
|
|
2035
|
-
function
|
|
2036
|
-
const { apiName: r, platform: n } = e, i = t.code, s =
|
|
2035
|
+
function _r(t, e) {
|
|
2036
|
+
const { apiName: r, platform: n } = e, i = t.code, s = Ir[i] || c.UNKNOWN_ERROR;
|
|
2037
2037
|
return a.debug("转换旧版错误码", {
|
|
2038
2038
|
legacy: i,
|
|
2039
2039
|
new: s
|
|
2040
|
-
}), new
|
|
2040
|
+
}), new V(
|
|
2041
2041
|
s,
|
|
2042
|
-
t.message ||
|
|
2042
|
+
t.message || ie(s),
|
|
2043
2043
|
{
|
|
2044
2044
|
apiName: r,
|
|
2045
2045
|
platform: t.platform || n,
|
|
@@ -2051,30 +2051,30 @@ function Ir(t, e) {
|
|
|
2051
2051
|
}
|
|
2052
2052
|
);
|
|
2053
2053
|
}
|
|
2054
|
-
function
|
|
2054
|
+
function Cr(t, e) {
|
|
2055
2055
|
const { apiName: r, platform: n } = e, i = (t.errMsg || t.message || "").toLowerCase();
|
|
2056
|
-
if (r &&
|
|
2057
|
-
const d =
|
|
2058
|
-
for (const [l,
|
|
2056
|
+
if (r && Ye[r]) {
|
|
2057
|
+
const d = Ye[r];
|
|
2058
|
+
for (const [l, E] of Object.entries(d))
|
|
2059
2059
|
if (i.includes(l.toLowerCase()))
|
|
2060
|
-
return new
|
|
2060
|
+
return new V(E, ie(E), {
|
|
2061
2061
|
apiName: r,
|
|
2062
2062
|
platform: n,
|
|
2063
2063
|
originalError: t
|
|
2064
2064
|
});
|
|
2065
2065
|
}
|
|
2066
|
-
const s =
|
|
2066
|
+
const s = He[n] || He.uniapp;
|
|
2067
2067
|
for (const { pattern: d, code: l } of s.patterns)
|
|
2068
2068
|
if (d.test(i))
|
|
2069
|
-
return new
|
|
2069
|
+
return new V(l, ie(l), {
|
|
2070
2070
|
apiName: r,
|
|
2071
2071
|
platform: n,
|
|
2072
2072
|
originalError: t
|
|
2073
2073
|
});
|
|
2074
2074
|
const o = s.default || c.UNKNOWN_ERROR;
|
|
2075
|
-
return new
|
|
2075
|
+
return new V(
|
|
2076
2076
|
o,
|
|
2077
|
-
t.errMsg || t.message ||
|
|
2077
|
+
t.errMsg || t.message || ie(o),
|
|
2078
2078
|
{
|
|
2079
2079
|
apiName: r,
|
|
2080
2080
|
platform: n,
|
|
@@ -2082,7 +2082,7 @@ function Ar(t, e) {
|
|
|
2082
2082
|
}
|
|
2083
2083
|
);
|
|
2084
2084
|
}
|
|
2085
|
-
const
|
|
2085
|
+
const ct = {
|
|
2086
2086
|
/**
|
|
2087
2087
|
* 响应拦截器
|
|
2088
2088
|
* @param {Object} result - API 响应结果
|
|
@@ -2091,7 +2091,7 @@ const st = {
|
|
|
2091
2091
|
*/
|
|
2092
2092
|
response: (t, e) => {
|
|
2093
2093
|
if (!t.success && t.error) {
|
|
2094
|
-
const r =
|
|
2094
|
+
const r = ot(t.error, {
|
|
2095
2095
|
apiName: e.apiName,
|
|
2096
2096
|
platform: f.type
|
|
2097
2097
|
});
|
|
@@ -2104,25 +2104,25 @@ const st = {
|
|
|
2104
2104
|
return t;
|
|
2105
2105
|
}
|
|
2106
2106
|
};
|
|
2107
|
-
function
|
|
2108
|
-
return new
|
|
2107
|
+
function Mr(t, e = {}) {
|
|
2108
|
+
return new V(t, ie(t), e);
|
|
2109
2109
|
}
|
|
2110
|
-
function
|
|
2111
|
-
return t instanceof
|
|
2110
|
+
function Rr(t) {
|
|
2111
|
+
return t instanceof V;
|
|
2112
2112
|
}
|
|
2113
|
-
function
|
|
2113
|
+
function Or(t, e, r) {
|
|
2114
2114
|
return e ? Promise.race([
|
|
2115
2115
|
t(),
|
|
2116
2116
|
new Promise((n, i) => setTimeout(() => i(new Error(`Init task timeout: ${r}`)), e))
|
|
2117
2117
|
]) : t();
|
|
2118
2118
|
}
|
|
2119
|
-
function
|
|
2120
|
-
return
|
|
2119
|
+
function Nr() {
|
|
2120
|
+
return w(this, arguments, function* (t = [], e = {}) {
|
|
2121
2121
|
for (const r of t) {
|
|
2122
2122
|
const n = (r == null ? void 0 : r.name) || "anonymous-task", i = (r == null ? void 0 : r.run) || r;
|
|
2123
2123
|
if (typeof i == "function")
|
|
2124
2124
|
try {
|
|
2125
|
-
yield
|
|
2125
|
+
yield Or(() => Promise.resolve().then(() => i()), r.timeoutMs, n), typeof r.onSuccess == "function" && r.onSuccess();
|
|
2126
2126
|
} catch (s) {
|
|
2127
2127
|
if (typeof r.onError == "function" && r.onError(s), typeof e.onError == "function")
|
|
2128
2128
|
e.onError(s, r);
|
|
@@ -2132,7 +2132,7 @@ function Mr() {
|
|
|
2132
2132
|
}
|
|
2133
2133
|
});
|
|
2134
2134
|
}
|
|
2135
|
-
class
|
|
2135
|
+
class ut {
|
|
2136
2136
|
/**
|
|
2137
2137
|
* 构造函数
|
|
2138
2138
|
* @param {string} name - 平台名称
|
|
@@ -2258,18 +2258,18 @@ class ot {
|
|
|
2258
2258
|
throw new Error(`${this.name} platform must implement performGetEnv method`);
|
|
2259
2259
|
}
|
|
2260
2260
|
}
|
|
2261
|
-
let
|
|
2262
|
-
function
|
|
2263
|
-
if (
|
|
2261
|
+
let de = [];
|
|
2262
|
+
function Sr() {
|
|
2263
|
+
if (de.length === 0 && window.plus) {
|
|
2264
2264
|
const t = plus.webview.currentWebview();
|
|
2265
2265
|
if (!t)
|
|
2266
2266
|
throw new Error("plus.webview.currentWebview() is undefined");
|
|
2267
2267
|
const e = t.parent(), r = e ? e.id : t.id;
|
|
2268
|
-
|
|
2268
|
+
de.push(r);
|
|
2269
2269
|
}
|
|
2270
|
-
return
|
|
2270
|
+
return de;
|
|
2271
2271
|
}
|
|
2272
|
-
function
|
|
2272
|
+
function Tr(t, e) {
|
|
2273
2273
|
const r = {
|
|
2274
2274
|
options: {
|
|
2275
2275
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2285,12 +2285,12 @@ function Rr(t, e) {
|
|
|
2285
2285
|
type: "WEB_INVOKE_APPSERVICE",
|
|
2286
2286
|
args: {
|
|
2287
2287
|
data: r,
|
|
2288
|
-
webviewIds:
|
|
2288
|
+
webviewIds: de
|
|
2289
2289
|
}
|
|
2290
2290
|
};
|
|
2291
2291
|
window.__uniapp_x_postMessage ? window.__uniapp_x_postMessageToService(n) : window.__uniapp_x_.postMessageToService(JSON.stringify(n));
|
|
2292
2292
|
}
|
|
2293
|
-
function
|
|
2293
|
+
function br(t, e) {
|
|
2294
2294
|
const r = {
|
|
2295
2295
|
options: {
|
|
2296
2296
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2306,19 +2306,19 @@ function Nr(t, e) {
|
|
|
2306
2306
|
type: "WEB_INVOKE_APPSERVICE",
|
|
2307
2307
|
args: {
|
|
2308
2308
|
data: r,
|
|
2309
|
-
webviewIds:
|
|
2309
|
+
webviewIds: de
|
|
2310
2310
|
}
|
|
2311
2311
|
};
|
|
2312
2312
|
window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(n) : window.__dcloud_weex_.postMessageToService(JSON.stringify(n));
|
|
2313
2313
|
}
|
|
2314
|
-
function
|
|
2314
|
+
function Lr(t, e) {
|
|
2315
2315
|
const r = {
|
|
2316
2316
|
options: {
|
|
2317
2317
|
timestamp: +/* @__PURE__ */ new Date()
|
|
2318
2318
|
},
|
|
2319
2319
|
name: t,
|
|
2320
2320
|
arg: e
|
|
2321
|
-
}, n =
|
|
2321
|
+
}, n = Sr();
|
|
2322
2322
|
if (plus.webview.getWebviewById("__uniapp__service"))
|
|
2323
2323
|
plus.webview.postMessageToUniNView({
|
|
2324
2324
|
type: "WEB_INVOKE_APPSERVICE",
|
|
@@ -2334,7 +2334,7 @@ function Sr(t, e) {
|
|
|
2334
2334
|
);
|
|
2335
2335
|
}
|
|
2336
2336
|
}
|
|
2337
|
-
function
|
|
2337
|
+
function vr(t, e) {
|
|
2338
2338
|
const r = {
|
|
2339
2339
|
options: {
|
|
2340
2340
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2348,10 +2348,10 @@ function Tr(t, e) {
|
|
|
2348
2348
|
pageId: ""
|
|
2349
2349
|
}, "*");
|
|
2350
2350
|
}
|
|
2351
|
-
function
|
|
2351
|
+
function xr(t) {
|
|
2352
2352
|
return !!(t && typeof t == "object" && t.type === "qsh_api_call" && typeof t.api == "string" && typeof t.callbackId == "string");
|
|
2353
2353
|
}
|
|
2354
|
-
function
|
|
2354
|
+
function Dr(t, e) {
|
|
2355
2355
|
const r = {
|
|
2356
2356
|
options: {
|
|
2357
2357
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2359,7 +2359,7 @@ function br(t, e) {
|
|
|
2359
2359
|
name: t,
|
|
2360
2360
|
arg: e
|
|
2361
2361
|
};
|
|
2362
|
-
if (t === "postMessage" &&
|
|
2362
|
+
if (t === "postMessage" && xr(e))
|
|
2363
2363
|
return window.__offline_bridge_postMessage(e);
|
|
2364
2364
|
window.__offline_bridge_postMessage({
|
|
2365
2365
|
type: "WEB_INVOKE_APPSERVICE",
|
|
@@ -2367,10 +2367,10 @@ function br(t, e) {
|
|
|
2367
2367
|
pageId: ""
|
|
2368
2368
|
});
|
|
2369
2369
|
}
|
|
2370
|
-
function
|
|
2371
|
-
|
|
2370
|
+
function he(t, e) {
|
|
2371
|
+
Oe() ? Tr(t, e) : Re() ? br(t, e) : Z() ? Dr(t, e) : Me() ? Lr(t, e) : vr(t, e);
|
|
2372
2372
|
}
|
|
2373
|
-
class
|
|
2373
|
+
class lt extends ut {
|
|
2374
2374
|
constructor() {
|
|
2375
2375
|
super("weixin");
|
|
2376
2376
|
}
|
|
@@ -2399,7 +2399,7 @@ class ct extends ot {
|
|
|
2399
2399
|
return o.call(window.wx.miniProgram, d);
|
|
2400
2400
|
}
|
|
2401
2401
|
}
|
|
2402
|
-
I.debug(`使用消息桥接执行: ${e}`),
|
|
2402
|
+
I.debug(`使用消息桥接执行: ${e}`), he(e, e === "navigateBack" ? { delta: i } : { url: n });
|
|
2403
2403
|
}, {
|
|
2404
2404
|
platform: this.name,
|
|
2405
2405
|
method: "performNavigation",
|
|
@@ -2417,7 +2417,7 @@ class ct extends ot {
|
|
|
2417
2417
|
const { data: r } = e;
|
|
2418
2418
|
if (this.isWeixinApiAvailable())
|
|
2419
2419
|
return window.wx.miniProgram.postMessage({ data: r });
|
|
2420
|
-
|
|
2420
|
+
he("postMessage", r);
|
|
2421
2421
|
}, {
|
|
2422
2422
|
platform: this.name,
|
|
2423
2423
|
method: "performPostMessage",
|
|
@@ -2445,19 +2445,19 @@ class ct extends ot {
|
|
|
2445
2445
|
});
|
|
2446
2446
|
}
|
|
2447
2447
|
}
|
|
2448
|
-
const
|
|
2449
|
-
var
|
|
2448
|
+
const te = new lt(), Ur = (t) => te.navigateTo(t), Wr = (t) => te.navigateBack(t), $r = (t) => te.switchTab(t), Fr = (t) => te.reLaunch(t), Br = (t) => te.redirectTo(t), kr = (t) => te.postMessage(t), Gr = (t) => te.getEnv(t);
|
|
2449
|
+
var ft = /* @__PURE__ */ Object.freeze({
|
|
2450
2450
|
__proto__: null,
|
|
2451
|
-
WeixinPlatform:
|
|
2452
|
-
getEnv:
|
|
2453
|
-
navigateBack:
|
|
2454
|
-
navigateTo:
|
|
2455
|
-
postMessage:
|
|
2456
|
-
reLaunch:
|
|
2457
|
-
redirectTo:
|
|
2458
|
-
switchTab:
|
|
2451
|
+
WeixinPlatform: lt,
|
|
2452
|
+
getEnv: Gr,
|
|
2453
|
+
navigateBack: Wr,
|
|
2454
|
+
navigateTo: Ur,
|
|
2455
|
+
postMessage: kr,
|
|
2456
|
+
reLaunch: Fr,
|
|
2457
|
+
redirectTo: Br,
|
|
2458
|
+
switchTab: $r
|
|
2459
2459
|
});
|
|
2460
|
-
class
|
|
2460
|
+
class dt extends ut {
|
|
2461
2461
|
constructor() {
|
|
2462
2462
|
super("app");
|
|
2463
2463
|
}
|
|
@@ -2470,7 +2470,7 @@ class lt extends ot {
|
|
|
2470
2470
|
performNavigation(e, r) {
|
|
2471
2471
|
return u.safeExecute(() => {
|
|
2472
2472
|
const { url: n, delta: i } = r;
|
|
2473
|
-
|
|
2473
|
+
he(e, e === "navigateBack" ? { delta: i } : { url: n });
|
|
2474
2474
|
}, {
|
|
2475
2475
|
platform: this.name,
|
|
2476
2476
|
method: "performNavigation",
|
|
@@ -2486,7 +2486,7 @@ class lt extends ot {
|
|
|
2486
2486
|
performPostMessage(e) {
|
|
2487
2487
|
return u.safeExecute(() => {
|
|
2488
2488
|
const { data: r } = e;
|
|
2489
|
-
|
|
2489
|
+
he("postMessage", r);
|
|
2490
2490
|
}, {
|
|
2491
2491
|
platform: this.name,
|
|
2492
2492
|
method: "performPostMessage",
|
|
@@ -2504,59 +2504,59 @@ class lt extends ot {
|
|
|
2504
2504
|
throw new Error("Callback function is required for getEnv");
|
|
2505
2505
|
const r = {};
|
|
2506
2506
|
let n = !1;
|
|
2507
|
-
|
|
2507
|
+
Oe() ? (r.uvue = !0, n = !0) : Re() ? (r.nvue = !0, n = !0) : Me() ? (r.plus = !0, n = !0) : Z() && (r.offline = !0, n = !0), n ? r.app = !0 : r.h5 = !0, e(r);
|
|
2508
2508
|
}, {
|
|
2509
2509
|
platform: this.name,
|
|
2510
2510
|
method: "performGetEnv"
|
|
2511
2511
|
});
|
|
2512
2512
|
}
|
|
2513
2513
|
}
|
|
2514
|
-
const
|
|
2515
|
-
var
|
|
2514
|
+
const re = new dt(), Kr = (t) => re.navigateTo(t), Vr = (t) => re.navigateBack(t), qr = (t) => re.switchTab(t), jr = (t) => re.reLaunch(t), zr = (t) => re.redirectTo(t), Jr = (t) => re.postMessage(t), Hr = (t) => re.getEnv(t);
|
|
2515
|
+
var gt = /* @__PURE__ */ Object.freeze({
|
|
2516
2516
|
__proto__: null,
|
|
2517
|
-
AppPlatform:
|
|
2518
|
-
getEnv:
|
|
2519
|
-
navigateBack:
|
|
2520
|
-
navigateTo:
|
|
2521
|
-
postMessage:
|
|
2522
|
-
reLaunch:
|
|
2523
|
-
redirectTo:
|
|
2524
|
-
switchTab:
|
|
2517
|
+
AppPlatform: dt,
|
|
2518
|
+
getEnv: Hr,
|
|
2519
|
+
navigateBack: Vr,
|
|
2520
|
+
navigateTo: Kr,
|
|
2521
|
+
postMessage: Jr,
|
|
2522
|
+
reLaunch: jr,
|
|
2523
|
+
redirectTo: zr,
|
|
2524
|
+
switchTab: qr
|
|
2525
2525
|
});
|
|
2526
|
-
function
|
|
2527
|
-
return _() ?
|
|
2528
|
-
}
|
|
2529
|
-
function jr(t) {
|
|
2530
|
-
return he().navigateTo(t);
|
|
2531
|
-
}
|
|
2532
|
-
function Jr(t) {
|
|
2533
|
-
return he().navigateBack(t);
|
|
2534
|
-
}
|
|
2535
|
-
function Hr(t) {
|
|
2536
|
-
return he().switchTab(t);
|
|
2526
|
+
function me() {
|
|
2527
|
+
return _() ? ft : gt;
|
|
2537
2528
|
}
|
|
2538
2529
|
function Yr(t) {
|
|
2539
|
-
return
|
|
2530
|
+
return me().navigateTo(t);
|
|
2540
2531
|
}
|
|
2541
2532
|
function Xr(t) {
|
|
2542
|
-
return
|
|
2533
|
+
return me().navigateBack(t);
|
|
2543
2534
|
}
|
|
2544
|
-
function
|
|
2545
|
-
return
|
|
2546
|
-
}
|
|
2547
|
-
function Zr(t = {}) {
|
|
2548
|
-
return dt().postMessage(t);
|
|
2535
|
+
function Zr(t) {
|
|
2536
|
+
return me().switchTab(t);
|
|
2549
2537
|
}
|
|
2550
2538
|
function Qr(t) {
|
|
2551
|
-
return
|
|
2539
|
+
return me().reLaunch(t);
|
|
2552
2540
|
}
|
|
2553
2541
|
function en(t) {
|
|
2542
|
+
return me().redirectTo(t);
|
|
2543
|
+
}
|
|
2544
|
+
function ht() {
|
|
2545
|
+
return _() ? ft : gt;
|
|
2546
|
+
}
|
|
2547
|
+
function tn(t = {}) {
|
|
2548
|
+
return ht().postMessage(t);
|
|
2549
|
+
}
|
|
2550
|
+
function rn(t) {
|
|
2551
|
+
return ht().getEnv(t);
|
|
2552
|
+
}
|
|
2553
|
+
function nn(t) {
|
|
2554
2554
|
return t && typeof t == "object" && t.__v_raw ? t.__v_raw : t;
|
|
2555
2555
|
}
|
|
2556
|
-
function
|
|
2556
|
+
function an() {
|
|
2557
2557
|
return "qsh_callback_" + Date.now() + "_" + Math.random().toString(36).substring(2, 9);
|
|
2558
2558
|
}
|
|
2559
|
-
class
|
|
2559
|
+
class sn {
|
|
2560
2560
|
constructor() {
|
|
2561
2561
|
this.callbacks = /* @__PURE__ */ new Map(), this.timeouts = /* @__PURE__ */ new Map(), this.persistentCallbacksByApi = /* @__PURE__ */ new Map(), this.defaultTimeout = 3e4, typeof window != "undefined" && (window.qshWebviewCallbacks || (window.qshWebviewCallbacks = {})), A.debug("WebView 桥接器已初始化");
|
|
2562
2562
|
}
|
|
@@ -2568,10 +2568,10 @@ class rn {
|
|
|
2568
2568
|
* @returns {void}
|
|
2569
2569
|
*/
|
|
2570
2570
|
callApi(i) {
|
|
2571
|
-
return
|
|
2572
|
-
return u.safeExecute(() =>
|
|
2573
|
-
var
|
|
2574
|
-
if (typeof window != "undefined" && window === window.parent && !window.plus && !window.__uniapp_x_postMessage && !window.__uniapp_x_ && !window.__dcloud_weex_postMessage && !window.__dcloud_weex_ && !
|
|
2571
|
+
return w(this, arguments, function* (e, r = {}, n = {}) {
|
|
2572
|
+
return u.safeExecute(() => w(this, null, function* () {
|
|
2573
|
+
var E;
|
|
2574
|
+
if (typeof window != "undefined" && window === window.parent && !window.plus && !window.__uniapp_x_postMessage && !window.__uniapp_x_ && !window.__dcloud_weex_postMessage && !window.__dcloud_weex_ && !Z()) {
|
|
2575
2575
|
const N = new T(
|
|
2576
2576
|
x.PLATFORM_NOT_SUPPORTED,
|
|
2577
2577
|
"当前不在宿主 WebView 容器中,无法发送消息"
|
|
@@ -2587,22 +2587,22 @@ class rn {
|
|
|
2587
2587
|
abort: !1,
|
|
2588
2588
|
metadata: {}
|
|
2589
2589
|
};
|
|
2590
|
-
|
|
2591
|
-
const d = yield
|
|
2590
|
+
G.setApiLoading(e, !0);
|
|
2591
|
+
const d = yield H.runRequest(o);
|
|
2592
2592
|
if (d.abort) {
|
|
2593
|
-
A.warn("API 调用被拦截器中止", { api: e }),
|
|
2594
|
-
errMsg: ((
|
|
2593
|
+
A.warn("API 调用被拦截器中止", { api: e }), G.setApiLoading(e, !1), n.fail && n.fail({
|
|
2594
|
+
errMsg: ((E = d.error) == null ? void 0 : E.message) || "API 调用被中止",
|
|
2595
2595
|
code: "INTERCEPTED"
|
|
2596
2596
|
}), n.complete && n.complete({ success: !1 });
|
|
2597
2597
|
return;
|
|
2598
2598
|
}
|
|
2599
|
-
const l =
|
|
2599
|
+
const l = an();
|
|
2600
2600
|
if (n.success || n.fail || n.complete) {
|
|
2601
2601
|
if (this.callbacks.set(l, m(h({}, n), {
|
|
2602
2602
|
context: d
|
|
2603
2603
|
// 保存上下文用于响应拦截
|
|
2604
|
-
})), window.qshWebviewCallbacks[l] = (
|
|
2605
|
-
this.handleCallback(l,
|
|
2604
|
+
})), window.qshWebviewCallbacks[l] = ($) => {
|
|
2605
|
+
this.handleCallback(l, $);
|
|
2606
2606
|
}, r.isPersistent && (this.persistentCallbacksByApi.has(e) || this.persistentCallbacksByApi.set(e, /* @__PURE__ */ new Set()), this.persistentCallbacksByApi.get(e).add(l)), r.isPersistent || r.disableTimeout)
|
|
2607
2607
|
A.info(`API ${e} 禁用超时清理,将等待回调返回后清理`, {
|
|
2608
2608
|
callbackId: l,
|
|
@@ -2610,15 +2610,15 @@ class rn {
|
|
|
2610
2610
|
disableTimeout: r.disableTimeout
|
|
2611
2611
|
});
|
|
2612
2612
|
else {
|
|
2613
|
-
const
|
|
2613
|
+
const $ = setTimeout(() => {
|
|
2614
2614
|
A.warn("API 调用超时,自动清理回调", { api: e, callbackId: l }), n.fail && n.fail({
|
|
2615
2615
|
errMsg: `API ${e} 调用超时`,
|
|
2616
2616
|
code: "TIMEOUT"
|
|
2617
2617
|
}), this.cleanupCallback(l);
|
|
2618
2618
|
}, r.timeout || this.defaultTimeout);
|
|
2619
|
-
this.timeouts.set(l,
|
|
2619
|
+
this.timeouts.set(l, $);
|
|
2620
2620
|
}
|
|
2621
|
-
const
|
|
2621
|
+
const R = {
|
|
2622
2622
|
type: "qsh_api_call",
|
|
2623
2623
|
api: e,
|
|
2624
2624
|
params: d.params,
|
|
@@ -2630,7 +2630,7 @@ class rn {
|
|
|
2630
2630
|
callbackId: l,
|
|
2631
2631
|
hasSuccess: !!n.success,
|
|
2632
2632
|
hasFail: !!n.fail
|
|
2633
|
-
}), console.log("message:", JSON.stringify(
|
|
2633
|
+
}), console.log("message:", JSON.stringify(nn(R), null, 2)), he("postMessage", R);
|
|
2634
2634
|
}
|
|
2635
2635
|
}), {
|
|
2636
2636
|
context: "WebViewBridge.callApi",
|
|
@@ -2645,9 +2645,9 @@ class rn {
|
|
|
2645
2645
|
* @private
|
|
2646
2646
|
*/
|
|
2647
2647
|
handleCallback(e, r) {
|
|
2648
|
-
return
|
|
2649
|
-
return u.safeExecute(() =>
|
|
2650
|
-
var N,
|
|
2648
|
+
return w(this, null, function* () {
|
|
2649
|
+
return u.safeExecute(() => w(this, null, function* () {
|
|
2650
|
+
var N, R;
|
|
2651
2651
|
const n = this.callbacks.get(e);
|
|
2652
2652
|
if (!n) {
|
|
2653
2653
|
A.warn("未找到回调函数", { callbackId: e });
|
|
@@ -2655,8 +2655,8 @@ class rn {
|
|
|
2655
2655
|
}
|
|
2656
2656
|
const { success: i, fail: s, complete: o, context: d } = n;
|
|
2657
2657
|
A.debug("处理回调", { callbackId: e, result: r });
|
|
2658
|
-
const l = yield
|
|
2659
|
-
d &&
|
|
2658
|
+
const l = yield H.runResponse(r, d);
|
|
2659
|
+
d && G.setApiResult(d.apiName, l), l.success && i ? i(l.data) : !l.success && s && s(l.error || { errMsg: "操作失败" }), o && o(l), ((R = (N = n.context) == null ? void 0 : N.params) == null ? void 0 : R.isPersistent) ? A.debug("持久监听API:保留回调", { callbackId: e }) : (this.cleanupCallback(e), A.debug("回调执行完成,已清理", { callbackId: e }));
|
|
2660
2660
|
}), {
|
|
2661
2661
|
context: "WebViewBridge.handleCallback",
|
|
2662
2662
|
callbackId: e
|
|
@@ -2709,18 +2709,18 @@ class rn {
|
|
|
2709
2709
|
};
|
|
2710
2710
|
}
|
|
2711
2711
|
}
|
|
2712
|
-
const
|
|
2713
|
-
function
|
|
2714
|
-
return
|
|
2712
|
+
const pt = new sn(), O = (t, e, r) => pt.callApi(t, e, r), ae = (t) => pt.cleanupPersistentCallbacksByApi(t);
|
|
2713
|
+
function mt() {
|
|
2714
|
+
return Q(!0);
|
|
2715
2715
|
}
|
|
2716
|
-
function
|
|
2716
|
+
function on(t) {
|
|
2717
2717
|
return t === "offline";
|
|
2718
2718
|
}
|
|
2719
|
-
function
|
|
2719
|
+
function cn(t = {}) {
|
|
2720
2720
|
return u.safeExecute(() => {
|
|
2721
2721
|
a.debug("Call getCode through offline webview bridge", {
|
|
2722
2722
|
clientId: t.clientId
|
|
2723
|
-
}),
|
|
2723
|
+
}), O(
|
|
2724
2724
|
"getCode",
|
|
2725
2725
|
{
|
|
2726
2726
|
clientId: t.clientId
|
|
@@ -2739,13 +2739,13 @@ function an(t = {}) {
|
|
|
2739
2739
|
);
|
|
2740
2740
|
}, {
|
|
2741
2741
|
context: "getCodeInHost",
|
|
2742
|
-
platform:
|
|
2742
|
+
platform: mt().type
|
|
2743
2743
|
});
|
|
2744
2744
|
}
|
|
2745
|
-
function
|
|
2745
|
+
function un(t = {}) {
|
|
2746
2746
|
return u.safeExecute(() => {
|
|
2747
2747
|
var n, i;
|
|
2748
|
-
const e =
|
|
2748
|
+
const e = mt(), r = String((t == null ? void 0 : t.clientId) || "").trim();
|
|
2749
2749
|
if (!r) {
|
|
2750
2750
|
const s = {
|
|
2751
2751
|
errMsg: "clientId is required",
|
|
@@ -2754,7 +2754,7 @@ function sn(t = {}) {
|
|
|
2754
2754
|
a.error("Get code missing clientId"), (n = t.fail) == null || n.call(t, s);
|
|
2755
2755
|
return;
|
|
2756
2756
|
}
|
|
2757
|
-
if (!
|
|
2757
|
+
if (!on(e.type)) {
|
|
2758
2758
|
const s = {
|
|
2759
2759
|
errMsg: `Current environment (${e.type}) does not support getCode`,
|
|
2760
2760
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -2764,7 +2764,7 @@ function sn(t = {}) {
|
|
|
2764
2764
|
}), (i = t.fail) == null || i.call(t, s);
|
|
2765
2765
|
return;
|
|
2766
2766
|
}
|
|
2767
|
-
|
|
2767
|
+
cn(m(h({}, t), {
|
|
2768
2768
|
clientId: r
|
|
2769
2769
|
}));
|
|
2770
2770
|
}, {
|
|
@@ -2772,11 +2772,11 @@ function sn(t = {}) {
|
|
|
2772
2772
|
options: t
|
|
2773
2773
|
});
|
|
2774
2774
|
}
|
|
2775
|
-
function
|
|
2776
|
-
return
|
|
2775
|
+
function wt() {
|
|
2776
|
+
return Q(!0);
|
|
2777
2777
|
}
|
|
2778
|
-
const
|
|
2779
|
-
function
|
|
2778
|
+
const Xe = ["release", "trial", "develop"];
|
|
2779
|
+
function ln(t = {}) {
|
|
2780
2780
|
const e = String((t == null ? void 0 : t.appid) || "").trim(), r = (t == null ? void 0 : t.path) == null ? "" : t.path, n = t == null ? void 0 : t.env, i = n == null || n === "" ? void 0 : String(n).trim();
|
|
2781
2781
|
if (!e)
|
|
2782
2782
|
throw {
|
|
@@ -2788,9 +2788,9 @@ function on(t = {}) {
|
|
|
2788
2788
|
errMsg: "path must be a string",
|
|
2789
2789
|
code: "PARAM_TYPE_ERROR"
|
|
2790
2790
|
};
|
|
2791
|
-
if (i !== void 0 && !
|
|
2791
|
+
if (i !== void 0 && !Xe.includes(i))
|
|
2792
2792
|
throw {
|
|
2793
|
-
errMsg: `env must be one of ${
|
|
2793
|
+
errMsg: `env must be one of ${Xe.join("/")}`,
|
|
2794
2794
|
code: "PARAM_INVALID"
|
|
2795
2795
|
};
|
|
2796
2796
|
return m(h({}, t), {
|
|
@@ -2799,13 +2799,13 @@ function on(t = {}) {
|
|
|
2799
2799
|
env: i
|
|
2800
2800
|
});
|
|
2801
2801
|
}
|
|
2802
|
-
function
|
|
2802
|
+
function fn() {
|
|
2803
2803
|
return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.postMessage == "function" && typeof window.wx.miniProgram.navigateBack == "function";
|
|
2804
2804
|
}
|
|
2805
|
-
function
|
|
2805
|
+
function dn(t = {}) {
|
|
2806
2806
|
return u.safeExecute(() => {
|
|
2807
2807
|
var r;
|
|
2808
|
-
if (!
|
|
2808
|
+
if (!fn()) {
|
|
2809
2809
|
const n = {
|
|
2810
2810
|
errMsg: "wx.miniProgram.postMessage or wx.miniProgram.navigateBack is not available",
|
|
2811
2811
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -2860,13 +2860,13 @@ function un(t = {}) {
|
|
|
2860
2860
|
platform: "weixin"
|
|
2861
2861
|
});
|
|
2862
2862
|
}
|
|
2863
|
-
function
|
|
2863
|
+
function gn(t = {}) {
|
|
2864
2864
|
return u.safeExecute(() => (a.debug("Call navigateToMiniProgram through webview bridge", {
|
|
2865
2865
|
appid: t.appid,
|
|
2866
2866
|
path: t.path,
|
|
2867
2867
|
env: t.env
|
|
2868
2868
|
}), new Promise((e, r) => {
|
|
2869
|
-
|
|
2869
|
+
O(
|
|
2870
2870
|
"navigateToMiniProgram",
|
|
2871
2871
|
{
|
|
2872
2872
|
appid: t.appid,
|
|
@@ -2887,16 +2887,16 @@ function ln(t = {}) {
|
|
|
2887
2887
|
);
|
|
2888
2888
|
})), {
|
|
2889
2889
|
context: "navigateToMiniProgramInHost",
|
|
2890
|
-
platform:
|
|
2890
|
+
platform: wt().type
|
|
2891
2891
|
});
|
|
2892
2892
|
}
|
|
2893
|
-
function
|
|
2893
|
+
function hn(t = {}) {
|
|
2894
2894
|
return u.safeExecute(() => {
|
|
2895
2895
|
var n;
|
|
2896
|
-
const e =
|
|
2896
|
+
const e = wt();
|
|
2897
2897
|
let r;
|
|
2898
2898
|
try {
|
|
2899
|
-
r =
|
|
2899
|
+
r = ln(t);
|
|
2900
2900
|
} catch (i) {
|
|
2901
2901
|
a.error("Navigate to mini program params validation failed", i), (n = t.fail) == null || n.call(t, i);
|
|
2902
2902
|
return;
|
|
@@ -2906,35 +2906,35 @@ function fn(t = {}) {
|
|
|
2906
2906
|
appid: r.appid,
|
|
2907
2907
|
path: r.path,
|
|
2908
2908
|
env: r.env
|
|
2909
|
-
}), e.isWeixinMiniProgram ?
|
|
2909
|
+
}), e.isWeixinMiniProgram ? dn(r) : gn(r);
|
|
2910
2910
|
}, {
|
|
2911
2911
|
context: "navigateToMiniProgram",
|
|
2912
2912
|
options: t
|
|
2913
2913
|
});
|
|
2914
2914
|
}
|
|
2915
|
-
const
|
|
2915
|
+
const _e = {
|
|
2916
2916
|
ALBUM: "album",
|
|
2917
2917
|
// 相册
|
|
2918
2918
|
CAMERA: "camera"
|
|
2919
2919
|
// 相机
|
|
2920
|
-
},
|
|
2920
|
+
}, Ce = {
|
|
2921
2921
|
ORIGINAL: "original",
|
|
2922
2922
|
// 原图
|
|
2923
2923
|
COMPRESSED: "compressed"
|
|
2924
2924
|
// 压缩图
|
|
2925
|
-
},
|
|
2925
|
+
}, pn = {
|
|
2926
2926
|
count: 9,
|
|
2927
|
-
sizeType: [
|
|
2928
|
-
sourceType: [
|
|
2927
|
+
sizeType: [Ce.ORIGINAL, Ce.COMPRESSED],
|
|
2928
|
+
sourceType: [_e.ALBUM, _e.CAMERA]
|
|
2929
2929
|
};
|
|
2930
|
-
function
|
|
2931
|
-
const e = h(h({},
|
|
2932
|
-
return Array.isArray(e.sizeType) || (e.sizeType = [e.sizeType].filter(Boolean)), Array.isArray(e.sourceType) || (e.sourceType = [e.sourceType].filter(Boolean)), e.count = Math.max(1, Math.min(9, parseInt(e.count) || 1)), e.sizeType.length === 0 && (e.sizeType = [
|
|
2930
|
+
function mn(t = {}) {
|
|
2931
|
+
const e = h(h({}, pn), t);
|
|
2932
|
+
return Array.isArray(e.sizeType) || (e.sizeType = [e.sizeType].filter(Boolean)), Array.isArray(e.sourceType) || (e.sourceType = [e.sourceType].filter(Boolean)), e.count = Math.max(1, Math.min(9, parseInt(e.count) || 1)), e.sizeType.length === 0 && (e.sizeType = [Ce.COMPRESSED]), e.sourceType.length === 0 && (e.sourceType = [_e.ALBUM]), e;
|
|
2933
2933
|
}
|
|
2934
|
-
function
|
|
2934
|
+
function Et() {
|
|
2935
2935
|
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(f.type);
|
|
2936
2936
|
}
|
|
2937
|
-
function
|
|
2937
|
+
function yt(t) {
|
|
2938
2938
|
return u.safeExecute(() => {
|
|
2939
2939
|
var e;
|
|
2940
2940
|
if (!window.wx) {
|
|
@@ -2945,8 +2945,8 @@ function wt(t) {
|
|
|
2945
2945
|
(e = t.fail) == null || e.call(t, r);
|
|
2946
2946
|
return;
|
|
2947
2947
|
}
|
|
2948
|
-
if (!
|
|
2949
|
-
a.info("等待微信配置完成"),
|
|
2948
|
+
if (!ee()) {
|
|
2949
|
+
a.info("等待微信配置完成"), J().then(() => yt(t)).catch((r) => {
|
|
2950
2950
|
var n;
|
|
2951
2951
|
a.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
2952
2952
|
});
|
|
@@ -2971,9 +2971,9 @@ function wt(t) {
|
|
|
2971
2971
|
platform: "weixin"
|
|
2972
2972
|
});
|
|
2973
2973
|
}
|
|
2974
|
-
function
|
|
2974
|
+
function wn(t) {
|
|
2975
2975
|
return u.safeExecute(() => {
|
|
2976
|
-
a.debug("通过 WebView 桥接调用图片选择", t),
|
|
2976
|
+
a.debug("通过 WebView 桥接调用图片选择", t), O("chooseImage", m(h({}, t), { disableTimeout: !0 }), {
|
|
2977
2977
|
success: (e) => {
|
|
2978
2978
|
var r, n;
|
|
2979
2979
|
a.info("UniApp 图片选择成功", {
|
|
@@ -2991,10 +2991,10 @@ function hn(t) {
|
|
|
2991
2991
|
platform: "uniapp"
|
|
2992
2992
|
});
|
|
2993
2993
|
}
|
|
2994
|
-
function
|
|
2994
|
+
function En(t = {}) {
|
|
2995
2995
|
return u.safeExecute(() => {
|
|
2996
2996
|
var r;
|
|
2997
|
-
if (!
|
|
2997
|
+
if (!Et()) {
|
|
2998
2998
|
const n = {
|
|
2999
2999
|
errMsg: `当前环境 (${f.type}) 不支持图片选择功能`,
|
|
3000
3000
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -3002,21 +3002,21 @@ function mn(t = {}) {
|
|
|
3002
3002
|
a.error("平台不支持图片选择", { platform: f.type }), (r = t.fail) == null || r.call(t, n);
|
|
3003
3003
|
return;
|
|
3004
3004
|
}
|
|
3005
|
-
const e =
|
|
3005
|
+
const e = mn(t);
|
|
3006
3006
|
a.info("开始选择图片", {
|
|
3007
3007
|
platform: f.type,
|
|
3008
3008
|
count: e.count,
|
|
3009
3009
|
sizeType: e.sizeType,
|
|
3010
3010
|
sourceType: e.sourceType
|
|
3011
|
-
}), _() ?
|
|
3011
|
+
}), _() ? yt(e) : wn(e);
|
|
3012
3012
|
}, {
|
|
3013
3013
|
context: "chooseImage",
|
|
3014
3014
|
options: t
|
|
3015
3015
|
});
|
|
3016
3016
|
}
|
|
3017
|
-
function
|
|
3017
|
+
function yn() {
|
|
3018
3018
|
return {
|
|
3019
|
-
supported:
|
|
3019
|
+
supported: Et(),
|
|
3020
3020
|
environment: f.type,
|
|
3021
3021
|
implementation: _() ? "weixin" : "webview",
|
|
3022
3022
|
features: {
|
|
@@ -3031,7 +3031,7 @@ function pn() {
|
|
|
3031
3031
|
}
|
|
3032
3032
|
};
|
|
3033
3033
|
}
|
|
3034
|
-
const
|
|
3034
|
+
const X = {
|
|
3035
3035
|
QR_CODE: "qrCode",
|
|
3036
3036
|
// 二维码
|
|
3037
3037
|
BAR_CODE: "barCode",
|
|
@@ -3040,20 +3040,20 @@ const Y = {
|
|
|
3040
3040
|
// Data Matrix 码
|
|
3041
3041
|
PDF417: "pdf417"
|
|
3042
3042
|
// PDF417 条码
|
|
3043
|
-
},
|
|
3043
|
+
}, In = {
|
|
3044
3044
|
onlyFromCamera: !0,
|
|
3045
3045
|
// 只从相机扫码
|
|
3046
|
-
scanType: [
|
|
3046
|
+
scanType: [X.QR_CODE, X.BAR_CODE]
|
|
3047
3047
|
// 支持二维码和一维码
|
|
3048
3048
|
};
|
|
3049
|
-
function
|
|
3050
|
-
const e = h(h({},
|
|
3051
|
-
return Array.isArray(e.scanType) || (e.scanType = [e.scanType].filter(Boolean)), e.scanType.length === 0 && (e.scanType = [
|
|
3049
|
+
function An(t = {}) {
|
|
3050
|
+
const e = h(h({}, In), t);
|
|
3051
|
+
return Array.isArray(e.scanType) || (e.scanType = [e.scanType].filter(Boolean)), e.scanType.length === 0 && (e.scanType = [X.QR_CODE, X.BAR_CODE]), e.onlyFromCamera = !!e.onlyFromCamera, e;
|
|
3052
3052
|
}
|
|
3053
|
-
function
|
|
3053
|
+
function It() {
|
|
3054
3054
|
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(f.type);
|
|
3055
3055
|
}
|
|
3056
|
-
function
|
|
3056
|
+
function At(t) {
|
|
3057
3057
|
return u.safeExecute(() => {
|
|
3058
3058
|
var e;
|
|
3059
3059
|
if (!window.wx) {
|
|
@@ -3064,8 +3064,8 @@ function yt(t) {
|
|
|
3064
3064
|
(e = t.fail) == null || e.call(t, r);
|
|
3065
3065
|
return;
|
|
3066
3066
|
}
|
|
3067
|
-
if (!
|
|
3068
|
-
a.info("等待微信配置完成"),
|
|
3067
|
+
if (!ee()) {
|
|
3068
|
+
a.info("等待微信配置完成"), J().then(() => At(t)).catch((r) => {
|
|
3069
3069
|
var n;
|
|
3070
3070
|
a.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
3071
3071
|
});
|
|
@@ -3081,7 +3081,7 @@ function yt(t) {
|
|
|
3081
3081
|
const n = {
|
|
3082
3082
|
result: r.resultStr,
|
|
3083
3083
|
// 扫码内容
|
|
3084
|
-
scanType:
|
|
3084
|
+
scanType: Pn(r.resultStr),
|
|
3085
3085
|
// 推测扫码类型
|
|
3086
3086
|
charSet: "utf-8",
|
|
3087
3087
|
// 微信默认 UTF-8
|
|
@@ -3100,12 +3100,12 @@ function yt(t) {
|
|
|
3100
3100
|
platform: "weixin"
|
|
3101
3101
|
});
|
|
3102
3102
|
}
|
|
3103
|
-
function
|
|
3104
|
-
return t ? t.length > 50 || /[^\d]/.test(t) ?
|
|
3103
|
+
function Pn(t) {
|
|
3104
|
+
return t ? t.length > 50 || /[^\d]/.test(t) ? X.QR_CODE : X.BAR_CODE : "unknown";
|
|
3105
3105
|
}
|
|
3106
|
-
function
|
|
3106
|
+
function _n(t) {
|
|
3107
3107
|
return u.safeExecute(() => {
|
|
3108
|
-
a.debug("通过 WebView 桥接调用扫码", t),
|
|
3108
|
+
a.debug("通过 WebView 桥接调用扫码", t), O("scanCode", m(h({}, t), { disableTimeout: !0 }), {
|
|
3109
3109
|
success: (e) => {
|
|
3110
3110
|
var r;
|
|
3111
3111
|
a.info("UniApp 扫码成功", {
|
|
@@ -3124,10 +3124,10 @@ function In(t) {
|
|
|
3124
3124
|
platform: "uniapp"
|
|
3125
3125
|
});
|
|
3126
3126
|
}
|
|
3127
|
-
function
|
|
3127
|
+
function Cn(t = {}) {
|
|
3128
3128
|
return u.safeExecute(() => {
|
|
3129
3129
|
var r;
|
|
3130
|
-
if (!
|
|
3130
|
+
if (!It()) {
|
|
3131
3131
|
const n = {
|
|
3132
3132
|
errMsg: `当前环境 (${f.type}) 不支持扫码功能`,
|
|
3133
3133
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -3135,20 +3135,20 @@ function An(t = {}) {
|
|
|
3135
3135
|
a.error("平台不支持扫码", { platform: f.type }), (r = t.fail) == null || r.call(t, n);
|
|
3136
3136
|
return;
|
|
3137
3137
|
}
|
|
3138
|
-
const e =
|
|
3138
|
+
const e = An(t);
|
|
3139
3139
|
a.info("开始扫码", {
|
|
3140
3140
|
platform: f.type,
|
|
3141
3141
|
onlyFromCamera: e.onlyFromCamera,
|
|
3142
3142
|
scanType: e.scanType
|
|
3143
|
-
}), _() ?
|
|
3143
|
+
}), _() ? At(e) : _n(e);
|
|
3144
3144
|
}, {
|
|
3145
3145
|
context: "scanCode",
|
|
3146
3146
|
options: t
|
|
3147
3147
|
});
|
|
3148
3148
|
}
|
|
3149
|
-
function
|
|
3149
|
+
function Mn() {
|
|
3150
3150
|
return {
|
|
3151
|
-
supported:
|
|
3151
|
+
supported: It(),
|
|
3152
3152
|
environment: f.type,
|
|
3153
3153
|
implementation: _() ? "weixin" : "webview",
|
|
3154
3154
|
features: {
|
|
@@ -3163,30 +3163,30 @@ function Pn() {
|
|
|
3163
3163
|
}
|
|
3164
3164
|
};
|
|
3165
3165
|
}
|
|
3166
|
-
const
|
|
3166
|
+
const se = {
|
|
3167
3167
|
WGS84: "wgs84",
|
|
3168
3168
|
// GPS 坐标
|
|
3169
3169
|
GCJ02: "gcj02",
|
|
3170
3170
|
// 国测局坐标(火星坐标)
|
|
3171
3171
|
BD09: "bd09"
|
|
3172
3172
|
// 百度坐标
|
|
3173
|
-
},
|
|
3174
|
-
type:
|
|
3173
|
+
}, Rn = {
|
|
3174
|
+
type: se.WGS84,
|
|
3175
3175
|
altitude: !1
|
|
3176
|
-
},
|
|
3176
|
+
}, On = {
|
|
3177
3177
|
scale: 18
|
|
3178
3178
|
// 地图缩放级别 1-28
|
|
3179
3179
|
};
|
|
3180
|
-
function
|
|
3181
|
-
const e = h(h({},
|
|
3182
|
-
return Object.values(
|
|
3180
|
+
function Nn(t = {}) {
|
|
3181
|
+
const e = h(h({}, Rn), t);
|
|
3182
|
+
return Object.values(se).includes(e.type) || (e.type = se.WGS84), e.altitude = !!e.altitude, e;
|
|
3183
3183
|
}
|
|
3184
|
-
function
|
|
3184
|
+
function Sn(t = {}) {
|
|
3185
3185
|
const e = h({}, t);
|
|
3186
|
-
return Object.values(
|
|
3186
|
+
return Object.values(se).includes(e.type) || (e.type = se.WGS84), e.needFullAccuracy = !!e.needFullAccuracy, e;
|
|
3187
3187
|
}
|
|
3188
|
-
function
|
|
3189
|
-
const e = h(h({},
|
|
3188
|
+
function Tn(t = {}) {
|
|
3189
|
+
const e = h(h({}, On), t);
|
|
3190
3190
|
if (e.latitude === void 0 || e.latitude === null)
|
|
3191
3191
|
throw {
|
|
3192
3192
|
errMsg: "缺少必需参数:latitude(纬度)",
|
|
@@ -3245,10 +3245,10 @@ function Rn(t = {}) {
|
|
|
3245
3245
|
}
|
|
3246
3246
|
return e;
|
|
3247
3247
|
}
|
|
3248
|
-
function
|
|
3248
|
+
function $e() {
|
|
3249
3249
|
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(f.type);
|
|
3250
3250
|
}
|
|
3251
|
-
function
|
|
3251
|
+
function Pt(t) {
|
|
3252
3252
|
return u.safeExecute(() => {
|
|
3253
3253
|
var e;
|
|
3254
3254
|
if (!window.wx) {
|
|
@@ -3259,8 +3259,8 @@ function It(t) {
|
|
|
3259
3259
|
(e = t.fail) == null || e.call(t, r);
|
|
3260
3260
|
return;
|
|
3261
3261
|
}
|
|
3262
|
-
if (!
|
|
3263
|
-
a.info("等待微信配置完成"),
|
|
3262
|
+
if (!ee()) {
|
|
3263
|
+
a.info("等待微信配置完成"), J().then(() => Pt(t)).catch((r) => {
|
|
3264
3264
|
var n;
|
|
3265
3265
|
a.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
3266
3266
|
});
|
|
@@ -3286,7 +3286,7 @@ function It(t) {
|
|
|
3286
3286
|
platform: "weixin"
|
|
3287
3287
|
});
|
|
3288
3288
|
}
|
|
3289
|
-
function
|
|
3289
|
+
function _t(t) {
|
|
3290
3290
|
return u.safeExecute(() => {
|
|
3291
3291
|
var e;
|
|
3292
3292
|
if (!window.wx) {
|
|
@@ -3297,8 +3297,8 @@ function At(t) {
|
|
|
3297
3297
|
(e = t.fail) == null || e.call(t, r);
|
|
3298
3298
|
return;
|
|
3299
3299
|
}
|
|
3300
|
-
if (!
|
|
3301
|
-
a.info("等待微信配置完成"),
|
|
3300
|
+
if (!ee()) {
|
|
3301
|
+
a.info("等待微信配置完成"), J().then(() => _t(t)).catch((r) => {
|
|
3302
3302
|
var n;
|
|
3303
3303
|
a.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
3304
3304
|
});
|
|
@@ -3326,9 +3326,9 @@ function At(t) {
|
|
|
3326
3326
|
platform: "weixin"
|
|
3327
3327
|
});
|
|
3328
3328
|
}
|
|
3329
|
-
function
|
|
3329
|
+
function bn(t) {
|
|
3330
3330
|
return u.safeExecute(() => {
|
|
3331
|
-
a.debug("通过 WebView 桥接调用获取位置", t),
|
|
3331
|
+
a.debug("通过 WebView 桥接调用获取位置", t), O("getLocation", t, {
|
|
3332
3332
|
success: (e) => {
|
|
3333
3333
|
var r;
|
|
3334
3334
|
a.info("UniApp 获取位置成功", {
|
|
@@ -3347,9 +3347,9 @@ function Nn(t) {
|
|
|
3347
3347
|
platform: "uniapp"
|
|
3348
3348
|
});
|
|
3349
3349
|
}
|
|
3350
|
-
function
|
|
3350
|
+
function Ln(t) {
|
|
3351
3351
|
return u.safeExecute(() => {
|
|
3352
|
-
a.debug("通过 WebView 桥接调用查看位置", t),
|
|
3352
|
+
a.debug("通过 WebView 桥接调用查看位置", t), O("openLocation", t, {
|
|
3353
3353
|
success: (e) => {
|
|
3354
3354
|
var r;
|
|
3355
3355
|
a.info("UniApp 查看位置成功"), (r = t.success) == null || r.call(t, e);
|
|
@@ -3365,10 +3365,10 @@ function Sn(t) {
|
|
|
3365
3365
|
platform: "uniapp"
|
|
3366
3366
|
});
|
|
3367
3367
|
}
|
|
3368
|
-
function
|
|
3368
|
+
function vn(t = {}) {
|
|
3369
3369
|
return u.safeExecute(() => {
|
|
3370
3370
|
var r;
|
|
3371
|
-
if (
|
|
3371
|
+
if (!$e()) {
|
|
3372
3372
|
const n = {
|
|
3373
3373
|
errMsg: `当前环境 (${f.type}) 不支持定位功能`,
|
|
3374
3374
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -3376,21 +3376,21 @@ function Tn(t = {}) {
|
|
|
3376
3376
|
a.error("平台不支持定位", { platform: f.type }), (r = t.fail) == null || r.call(t, n);
|
|
3377
3377
|
return;
|
|
3378
3378
|
}
|
|
3379
|
-
const e =
|
|
3379
|
+
const e = Nn(t);
|
|
3380
3380
|
a.info("开始获取位置", {
|
|
3381
3381
|
platform: f.type,
|
|
3382
3382
|
type: e.type,
|
|
3383
3383
|
altitude: e.altitude
|
|
3384
|
-
}), _() ?
|
|
3384
|
+
}), _() ? Pt(e) : bn(e);
|
|
3385
3385
|
}, {
|
|
3386
3386
|
context: "getLocation",
|
|
3387
3387
|
options: t
|
|
3388
3388
|
});
|
|
3389
3389
|
}
|
|
3390
|
-
function
|
|
3390
|
+
function xn(t = {}) {
|
|
3391
3391
|
return u.safeExecute(() => {
|
|
3392
3392
|
var r, n, i;
|
|
3393
|
-
if (
|
|
3393
|
+
if (!$e()) {
|
|
3394
3394
|
const s = {
|
|
3395
3395
|
errMsg: `当前环境 (${f.type}) 不支持查看位置功能`,
|
|
3396
3396
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -3400,7 +3400,7 @@ function Ln(t = {}) {
|
|
|
3400
3400
|
}
|
|
3401
3401
|
let e;
|
|
3402
3402
|
try {
|
|
3403
|
-
e =
|
|
3403
|
+
e = Tn(t);
|
|
3404
3404
|
} catch (s) {
|
|
3405
3405
|
a.error("参数验证失败", s), (n = t.fail) == null || n.call(t, s), (i = t.complete) == null || i.call(t);
|
|
3406
3406
|
return;
|
|
@@ -3410,16 +3410,16 @@ function Ln(t = {}) {
|
|
|
3410
3410
|
latitude: e.latitude,
|
|
3411
3411
|
longitude: e.longitude,
|
|
3412
3412
|
name: e.name
|
|
3413
|
-
}), _() ?
|
|
3413
|
+
}), _() ? _t(e) : Ln(e);
|
|
3414
3414
|
}, {
|
|
3415
3415
|
context: "openLocation",
|
|
3416
3416
|
options: t
|
|
3417
3417
|
});
|
|
3418
3418
|
}
|
|
3419
|
-
function
|
|
3419
|
+
function Dn() {
|
|
3420
3420
|
const t = _();
|
|
3421
3421
|
return {
|
|
3422
|
-
supported:
|
|
3422
|
+
supported: $e(),
|
|
3423
3423
|
environment: f.type,
|
|
3424
3424
|
implementation: t ? "weixin" : "webview",
|
|
3425
3425
|
features: {
|
|
@@ -3438,8 +3438,8 @@ function bn() {
|
|
|
3438
3438
|
}
|
|
3439
3439
|
};
|
|
3440
3440
|
}
|
|
3441
|
-
const
|
|
3442
|
-
function
|
|
3441
|
+
const j = /* @__PURE__ */ new Set(), z = /* @__PURE__ */ new Set();
|
|
3442
|
+
function Ct(t, e, r) {
|
|
3443
3443
|
t.forEach((n) => {
|
|
3444
3444
|
if (typeof n == "function") {
|
|
3445
3445
|
u.safeExecute(() => n(e), { context: r });
|
|
@@ -3448,7 +3448,7 @@ function Pt(t, e, r) {
|
|
|
3448
3448
|
a.warn("监听回调不是函数,已跳过", { type: typeof n });
|
|
3449
3449
|
});
|
|
3450
3450
|
}
|
|
3451
|
-
function
|
|
3451
|
+
function Un(t = {}) {
|
|
3452
3452
|
return u.safeExecute(() => {
|
|
3453
3453
|
var r, n;
|
|
3454
3454
|
if (_()) {
|
|
@@ -3459,8 +3459,8 @@ function vn(t = {}) {
|
|
|
3459
3459
|
a.error("当前环境不支持此接口", { platform: f.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
|
|
3460
3460
|
return;
|
|
3461
3461
|
}
|
|
3462
|
-
const e =
|
|
3463
|
-
a.info("正在开启定位监听"),
|
|
3462
|
+
const e = Sn(t);
|
|
3463
|
+
a.info("正在开启定位监听"), O("startLocationUpdate", {
|
|
3464
3464
|
type: e.type,
|
|
3465
3465
|
needFullAccuracy: e.needFullAccuracy
|
|
3466
3466
|
}, {
|
|
@@ -3476,7 +3476,7 @@ function vn(t = {}) {
|
|
|
3476
3476
|
});
|
|
3477
3477
|
}, { context: "startLocationUpdate" });
|
|
3478
3478
|
}
|
|
3479
|
-
function
|
|
3479
|
+
function Wn(t = {}) {
|
|
3480
3480
|
return u.safeExecute(() => {
|
|
3481
3481
|
var e, r;
|
|
3482
3482
|
if (_()) {
|
|
@@ -3487,7 +3487,7 @@ function xn(t = {}) {
|
|
|
3487
3487
|
a.error("当前环境不支持此接口", { platform: f.type }), (e = t.fail) == null || e.call(t, n), (r = t.complete) == null || r.call(t, n);
|
|
3488
3488
|
return;
|
|
3489
3489
|
}
|
|
3490
|
-
a.info("正在停止定位监听"),
|
|
3490
|
+
a.info("正在停止定位监听"), O("stopLocationUpdate", t, {
|
|
3491
3491
|
success: (n) => {
|
|
3492
3492
|
var i;
|
|
3493
3493
|
a.info("定位监听已停止"), (i = t.success) == null || i.call(t, n);
|
|
@@ -3500,7 +3500,7 @@ function xn(t = {}) {
|
|
|
3500
3500
|
});
|
|
3501
3501
|
}, { context: "stopLocationUpdate" });
|
|
3502
3502
|
}
|
|
3503
|
-
function
|
|
3503
|
+
function $n(t) {
|
|
3504
3504
|
return u.safeExecute(() => {
|
|
3505
3505
|
if (_()) {
|
|
3506
3506
|
a.warn("当前环境不支持此接口", { platform: f.type });
|
|
@@ -3511,18 +3511,18 @@ function Dn(t) {
|
|
|
3511
3511
|
errMsg: "onLocationChange 回调必须是函数",
|
|
3512
3512
|
code: "INVALID_CALLBACK"
|
|
3513
3513
|
};
|
|
3514
|
-
const e =
|
|
3515
|
-
|
|
3514
|
+
const e = j.size > 0;
|
|
3515
|
+
j.add(t), e || (a.debug("注册实时位置变化监听器"), O("onLocationChange", { isPersistent: !0 }, {
|
|
3516
3516
|
success: (r) => {
|
|
3517
|
-
a.debug("收到实时位置推送", r),
|
|
3517
|
+
a.debug("收到实时位置推送", r), Ct(j, r, "onLocationChange");
|
|
3518
3518
|
},
|
|
3519
3519
|
fail: (r) => {
|
|
3520
|
-
a.warn("位置变化监听出错,请通过 onLocationChangeError 监听错误", r),
|
|
3520
|
+
a.warn("位置变化监听出错,请通过 onLocationChangeError 监听错误", r), j.delete(t), j.size === 0 && ae("onLocationChange");
|
|
3521
3521
|
}
|
|
3522
3522
|
}));
|
|
3523
3523
|
}, { context: "onLocationChange" });
|
|
3524
3524
|
}
|
|
3525
|
-
function
|
|
3525
|
+
function Fn(t) {
|
|
3526
3526
|
return u.safeExecute(() => {
|
|
3527
3527
|
if (_()) {
|
|
3528
3528
|
a.warn("当前环境不支持此接口", { platform: f.type });
|
|
@@ -3533,17 +3533,17 @@ function Un(t) {
|
|
|
3533
3533
|
errMsg: "offLocationChange 回调必须是函数",
|
|
3534
3534
|
code: "INVALID_CALLBACK"
|
|
3535
3535
|
};
|
|
3536
|
-
t ?
|
|
3536
|
+
t ? j.delete(t) : j.clear(), !(j.size > 0) && (a.info("移除位置变化监听器"), O("offLocationChange", {}, {
|
|
3537
3537
|
success: () => {
|
|
3538
|
-
a.info("位置变化监听已移除"),
|
|
3538
|
+
a.info("位置变化监听已移除"), ae("onLocationChange");
|
|
3539
3539
|
},
|
|
3540
3540
|
fail: (e) => {
|
|
3541
|
-
a.error("移除位置变化监听失败", e),
|
|
3541
|
+
a.error("移除位置变化监听失败", e), ae("onLocationChange");
|
|
3542
3542
|
}
|
|
3543
3543
|
}));
|
|
3544
3544
|
}, { context: "offLocationChange" });
|
|
3545
3545
|
}
|
|
3546
|
-
function
|
|
3546
|
+
function Bn(t) {
|
|
3547
3547
|
return u.safeExecute(() => {
|
|
3548
3548
|
if (_()) {
|
|
3549
3549
|
a.warn("当前环境不支持此接口", { platform: f.type });
|
|
@@ -3555,17 +3555,17 @@ function Wn(t) {
|
|
|
3555
3555
|
code: "INVALID_CALLBACK"
|
|
3556
3556
|
};
|
|
3557
3557
|
const e = z.size > 0;
|
|
3558
|
-
z.add(t), e || (a.debug("注册位置更新错误监听器"),
|
|
3558
|
+
z.add(t), e || (a.debug("注册位置更新错误监听器"), O("onLocationChangeError", { isPersistent: !0 }, {
|
|
3559
3559
|
success: (r) => {
|
|
3560
|
-
a.warn("持续定位发生异常", r),
|
|
3560
|
+
a.warn("持续定位发生异常", r), Ct(z, r, "onLocationChangeError");
|
|
3561
3561
|
},
|
|
3562
3562
|
fail: (r) => {
|
|
3563
|
-
a.warn("位置更新错误监听注册失败", r), z.delete(t), z.size === 0 &&
|
|
3563
|
+
a.warn("位置更新错误监听注册失败", r), z.delete(t), z.size === 0 && ae("onLocationChangeError");
|
|
3564
3564
|
}
|
|
3565
3565
|
}));
|
|
3566
3566
|
}, { context: "onLocationChangeError" });
|
|
3567
3567
|
}
|
|
3568
|
-
function
|
|
3568
|
+
function kn(t) {
|
|
3569
3569
|
return u.safeExecute(() => {
|
|
3570
3570
|
if (_()) {
|
|
3571
3571
|
a.warn("当前环境不支持此接口", { platform: f.type });
|
|
@@ -3576,24 +3576,24 @@ function $n(t) {
|
|
|
3576
3576
|
errMsg: "offLocationChangeError 回调必须是函数",
|
|
3577
3577
|
code: "INVALID_CALLBACK"
|
|
3578
3578
|
};
|
|
3579
|
-
t ? z.delete(t) : z.clear(), !(z.size > 0) && (a.info("移除定位错误监听器"),
|
|
3579
|
+
t ? z.delete(t) : z.clear(), !(z.size > 0) && (a.info("移除定位错误监听器"), O("offLocationChangeError", {}, {
|
|
3580
3580
|
success: () => {
|
|
3581
|
-
a.info("定位错误监听已移除"),
|
|
3581
|
+
a.info("定位错误监听已移除"), ae("onLocationChangeError");
|
|
3582
3582
|
},
|
|
3583
3583
|
fail: (e) => {
|
|
3584
|
-
a.error("移除定位错误监听失败", e),
|
|
3584
|
+
a.error("移除定位错误监听失败", e), ae("onLocationChangeError");
|
|
3585
3585
|
}
|
|
3586
3586
|
}));
|
|
3587
3587
|
}, { context: "offLocationChangeError" });
|
|
3588
3588
|
}
|
|
3589
|
-
const
|
|
3589
|
+
const Gn = {
|
|
3590
3590
|
latitude: null,
|
|
3591
3591
|
// 目标地纬度
|
|
3592
3592
|
longitude: null
|
|
3593
3593
|
// 目标地经度
|
|
3594
3594
|
};
|
|
3595
|
-
function
|
|
3596
|
-
const e = h(h({},
|
|
3595
|
+
function Kn(t = {}) {
|
|
3596
|
+
const e = h(h({}, Gn), t);
|
|
3597
3597
|
return e.latitude !== null && e.latitude !== void 0 && (typeof e.latitude != "number" ? (a.warn("latitude 参数类型错误,已忽略", {
|
|
3598
3598
|
latitude: e.latitude
|
|
3599
3599
|
}), e.latitude = null) : (e.latitude < -90 || e.latitude > 90) && (a.warn("latitude 超出范围,已忽略", {
|
|
@@ -3604,10 +3604,10 @@ function kn(t = {}) {
|
|
|
3604
3604
|
longitude: e.longitude
|
|
3605
3605
|
}), e.longitude = null)), e;
|
|
3606
3606
|
}
|
|
3607
|
-
function
|
|
3607
|
+
function Mt() {
|
|
3608
3608
|
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(f.type);
|
|
3609
3609
|
}
|
|
3610
|
-
function
|
|
3610
|
+
function Rt(t) {
|
|
3611
3611
|
return u.safeExecute(() => {
|
|
3612
3612
|
var n;
|
|
3613
3613
|
if (!window.wx) {
|
|
@@ -3618,8 +3618,8 @@ function Ct(t) {
|
|
|
3618
3618
|
(n = t.fail) == null || n.call(t, i);
|
|
3619
3619
|
return;
|
|
3620
3620
|
}
|
|
3621
|
-
if (!
|
|
3622
|
-
a.info("等待微信配置完成"),
|
|
3621
|
+
if (!ee()) {
|
|
3622
|
+
a.info("等待微信配置完成"), J().then(() => Rt(t)).catch((i) => {
|
|
3623
3623
|
var s;
|
|
3624
3624
|
a.error("微信配置失败", i), (s = t.fail) == null || s.call(t, { errMsg: `微信配置失败: ${i.message}` });
|
|
3625
3625
|
});
|
|
@@ -3664,7 +3664,7 @@ function Ct(t) {
|
|
|
3664
3664
|
platform: "weixin"
|
|
3665
3665
|
});
|
|
3666
3666
|
}
|
|
3667
|
-
function
|
|
3667
|
+
function Vn(t) {
|
|
3668
3668
|
return u.safeExecute(() => {
|
|
3669
3669
|
a.debug("通过 WebView 桥接调用位置选择", t);
|
|
3670
3670
|
const e = {
|
|
@@ -3685,7 +3685,7 @@ function Bn(t) {
|
|
|
3685
3685
|
},
|
|
3686
3686
|
complete: t.complete
|
|
3687
3687
|
};
|
|
3688
|
-
t.latitude !== null && t.latitude !== void 0 && (e.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (e.longitude = t.longitude),
|
|
3688
|
+
t.latitude !== null && t.latitude !== void 0 && (e.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (e.longitude = t.longitude), O("chooseLocation", e, {
|
|
3689
3689
|
success: (r) => {
|
|
3690
3690
|
e.success(r);
|
|
3691
3691
|
},
|
|
@@ -3699,10 +3699,10 @@ function Bn(t) {
|
|
|
3699
3699
|
platform: "uniapp"
|
|
3700
3700
|
});
|
|
3701
3701
|
}
|
|
3702
|
-
function
|
|
3702
|
+
function qn(t = {}) {
|
|
3703
3703
|
return u.safeExecute(() => {
|
|
3704
3704
|
var r;
|
|
3705
|
-
if (!
|
|
3705
|
+
if (!Mt()) {
|
|
3706
3706
|
const n = {
|
|
3707
3707
|
errMsg: `当前环境 (${f.type}) 不支持位置选择功能`,
|
|
3708
3708
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -3710,20 +3710,20 @@ function Gn(t = {}) {
|
|
|
3710
3710
|
a.error("平台不支持位置选择", { platform: f.type }), (r = t.fail) == null || r.call(t, n);
|
|
3711
3711
|
return;
|
|
3712
3712
|
}
|
|
3713
|
-
const e =
|
|
3713
|
+
const e = Kn(t);
|
|
3714
3714
|
a.info("开始选择位置", {
|
|
3715
3715
|
platform: f.type,
|
|
3716
3716
|
latitude: e.latitude,
|
|
3717
3717
|
longitude: e.longitude
|
|
3718
|
-
}), _() ?
|
|
3718
|
+
}), _() ? Rt(e) : Vn(e);
|
|
3719
3719
|
}, {
|
|
3720
3720
|
context: "chooseLocation",
|
|
3721
3721
|
options: t
|
|
3722
3722
|
});
|
|
3723
3723
|
}
|
|
3724
|
-
function
|
|
3724
|
+
function jn() {
|
|
3725
3725
|
return {
|
|
3726
|
-
supported:
|
|
3726
|
+
supported: Mt(),
|
|
3727
3727
|
environment: f.type,
|
|
3728
3728
|
implementation: _() ? "weixin" : "webview",
|
|
3729
3729
|
features: {
|
|
@@ -3736,11 +3736,11 @@ function Kn() {
|
|
|
3736
3736
|
}
|
|
3737
3737
|
};
|
|
3738
3738
|
}
|
|
3739
|
-
const
|
|
3740
|
-
function
|
|
3739
|
+
const Ot = "https://iafs.xjy2.cn/img/bg.143351f0.jpg";
|
|
3740
|
+
function zn(t) {
|
|
3741
3741
|
return t === "timeline" || Number(t) === 1 ? 1 : 0;
|
|
3742
3742
|
}
|
|
3743
|
-
function
|
|
3743
|
+
function Se(t = "", e = "targetPath") {
|
|
3744
3744
|
if (!t || typeof t != "string")
|
|
3745
3745
|
throw { errMsg: `share: ${e} 必须是最终小程序页面路径,例如 /pages/xxx/index?foo=1`, code: "PARAM_INVALID" };
|
|
3746
3746
|
const r = t.trim();
|
|
@@ -3749,7 +3749,15 @@ function Ue(t = "", e = "targetPath") {
|
|
|
3749
3749
|
const [, n = ""] = r.split("?");
|
|
3750
3750
|
return { path: r, query: n };
|
|
3751
3751
|
}
|
|
3752
|
-
function
|
|
3752
|
+
function Nt(t = "", e = "webTarget") {
|
|
3753
|
+
if (!t || typeof t != "string")
|
|
3754
|
+
throw { errMsg: `share: ${e} 必须是公网链接,例如 https://example.com/path?a=1`, code: "PARAM_INVALID" };
|
|
3755
|
+
const r = t.trim();
|
|
3756
|
+
if (!/^https?:\/\//.test(r))
|
|
3757
|
+
throw { errMsg: `share: ${e} 必须是公网链接,例如 https://example.com/path?a=1`, code: "PARAM_INVALID" };
|
|
3758
|
+
return r;
|
|
3759
|
+
}
|
|
3760
|
+
function Jn() {
|
|
3753
3761
|
return new Promise((t, e) => {
|
|
3754
3762
|
var s, o;
|
|
3755
3763
|
const r = typeof window != "undefined" ? window : null;
|
|
@@ -3765,7 +3773,7 @@ function qn() {
|
|
|
3765
3773
|
(o = (s = r.document) == null ? void 0 : s.addEventListener) == null || o.call(s, "plusready", i, { once: !0 });
|
|
3766
3774
|
});
|
|
3767
3775
|
}
|
|
3768
|
-
function
|
|
3776
|
+
function Hn() {
|
|
3769
3777
|
return new Promise((t, e) => {
|
|
3770
3778
|
const r = typeof window != "undefined" ? window.plus : null;
|
|
3771
3779
|
if (!r || !r.share || typeof r.share.getServices != "function")
|
|
@@ -3780,48 +3788,84 @@ function zn() {
|
|
|
3780
3788
|
);
|
|
3781
3789
|
});
|
|
3782
3790
|
}
|
|
3783
|
-
function
|
|
3791
|
+
function Yn(t) {
|
|
3784
3792
|
return t.isWeixinMiniProgram ? "已同步分享内容,请点击右上角“···”选择发送给朋友或分享到朋友圈。" : "正在拉起微信分享面板,请选择聊天框或朋友圈。";
|
|
3785
3793
|
}
|
|
3786
|
-
function
|
|
3794
|
+
function Xn(t = {}) {
|
|
3787
3795
|
if (!t || typeof t != "object")
|
|
3788
3796
|
throw { errMsg: "shareDirected 参数必须是对象", code: "PARAM_TYPE_ERROR" };
|
|
3789
|
-
const e = String(t.kind || "").trim(), r = t.payload || {}, n =
|
|
3797
|
+
const e = String(t.kind || "").trim(), r = t.payload || {}, n = zn(t.scene);
|
|
3790
3798
|
if (!["web", "image", "text"].includes(e))
|
|
3791
3799
|
throw { errMsg: 'shareDirected: kind 仅支持 "web"|"image"|"text"', code: "PARAM_INVALID" };
|
|
3792
3800
|
if (![0, 1].includes(n))
|
|
3793
3801
|
throw { errMsg: "shareDirected: scene 仅支持 0|1", code: "PARAM_INVALID" };
|
|
3794
|
-
if (!r.targetPath) throw { errMsg: "shareDirected: payload.targetPath 必填", code: "PARAM_MISSING" };
|
|
3795
|
-
if (!r.shareLink) throw { errMsg: "shareDirected: payload.shareLink 必填", code: "PARAM_MISSING" };
|
|
3796
3802
|
if (e === "web" && (!r.title || !r.description || !r.imageUrl))
|
|
3797
3803
|
throw { errMsg: "shareDirected(web): title/description/imageUrl 必填", code: "PARAM_MISSING" };
|
|
3798
3804
|
if (e === "image" && !r.imageUrl)
|
|
3799
3805
|
throw { errMsg: "shareDirected(image): payload.imageUrl 必填", code: "PARAM_MISSING" };
|
|
3800
3806
|
if (e === "text" && !r.description)
|
|
3801
3807
|
throw { errMsg: "shareDirected(text): payload.description 必填", code: "PARAM_MISSING" };
|
|
3802
|
-
return {
|
|
3808
|
+
return {
|
|
3809
|
+
kind: e,
|
|
3810
|
+
scene: n,
|
|
3811
|
+
payload: r,
|
|
3812
|
+
resolvedTargetPath: "",
|
|
3813
|
+
resolvedWebTarget: "",
|
|
3814
|
+
success: t.success,
|
|
3815
|
+
fail: t.fail,
|
|
3816
|
+
complete: t.complete
|
|
3817
|
+
};
|
|
3803
3818
|
}
|
|
3804
|
-
function
|
|
3805
|
-
const {
|
|
3819
|
+
function Zn(t, e) {
|
|
3820
|
+
const { payload: r } = t;
|
|
3821
|
+
if (e.isWeixinMiniProgram)
|
|
3822
|
+
try {
|
|
3823
|
+
const n = Se(r.target, "target");
|
|
3824
|
+
return t.resolvedTargetPath = n.path, t;
|
|
3825
|
+
} catch (n) {
|
|
3826
|
+
throw { errMsg: (n == null ? void 0 : n.errMsg) || "shareDirected: 小程序环境下 payload.target 不合法", code: (n == null ? void 0 : n.code) || "PARAM_INVALID" };
|
|
3827
|
+
}
|
|
3828
|
+
if (e.isAppPlus) {
|
|
3829
|
+
const n = (o, d) => {
|
|
3830
|
+
try {
|
|
3831
|
+
return Nt(o, d);
|
|
3832
|
+
} catch (l) {
|
|
3833
|
+
return "";
|
|
3834
|
+
}
|
|
3835
|
+
}, i = n(r.target, "target");
|
|
3836
|
+
if (i)
|
|
3837
|
+
return t.resolvedWebTarget = i, t;
|
|
3838
|
+
const s = n(r.webTarget, "webTarget");
|
|
3839
|
+
if (s)
|
|
3840
|
+
return t.resolvedWebTarget = s, t;
|
|
3841
|
+
throw {
|
|
3842
|
+
errMsg: "shareDirected: App 环境下 payload.target 必须是公网链接;若 target 不存在或不合法,则 payload.webTarget 也必须是公网链接",
|
|
3843
|
+
code: "PARAM_INVALID"
|
|
3844
|
+
};
|
|
3845
|
+
}
|
|
3846
|
+
return t;
|
|
3847
|
+
}
|
|
3848
|
+
function Qn(t) {
|
|
3849
|
+
const { kind: e, payload: r, resolvedTargetPath: n } = t, i = Se(n || r.target, "target"), s = r.imageUrl || Ot;
|
|
3806
3850
|
return {
|
|
3807
3851
|
title: r.title || "分享",
|
|
3808
|
-
path:
|
|
3809
|
-
query:
|
|
3810
|
-
imageUrl:
|
|
3811
|
-
custom: { kind: e,
|
|
3852
|
+
path: i.path,
|
|
3853
|
+
query: i.query,
|
|
3854
|
+
imageUrl: s,
|
|
3855
|
+
custom: { kind: e, target: i.path, webTarget: r.webTarget || "", description: r.description || "" }
|
|
3812
3856
|
};
|
|
3813
3857
|
}
|
|
3814
|
-
function
|
|
3815
|
-
const { kind: e, scene: r, payload: n } = t,
|
|
3816
|
-
return e === "image" ? { message: { type: "image", pictures: [n.imageUrl], extra: { scene:
|
|
3817
|
-
message: { type: "web", title: n.title || "分享", content: n.description || "", href:
|
|
3858
|
+
function ei(t) {
|
|
3859
|
+
const { kind: e, scene: r, payload: n, resolvedWebTarget: i } = t, s = r === 1 ? "WXSceneTimeline" : "WXSceneSession", o = n.imageUrl || Ot;
|
|
3860
|
+
return e === "image" ? { message: { type: "image", pictures: [n.imageUrl], extra: { scene: s } }, degradedFromText: !1 } : {
|
|
3861
|
+
message: { type: "web", title: n.title || "分享", content: n.description || "", href: i, thumbs: [o], extra: { scene: s } },
|
|
3818
3862
|
degradedFromText: e === "text"
|
|
3819
3863
|
};
|
|
3820
3864
|
}
|
|
3821
|
-
function
|
|
3822
|
-
return
|
|
3823
|
-
yield
|
|
3824
|
-
const e = yield
|
|
3865
|
+
function ti(t) {
|
|
3866
|
+
return w(this, null, function* () {
|
|
3867
|
+
yield Jn();
|
|
3868
|
+
const e = yield Hn(), { message: r, degradedFromText: n } = ei(t);
|
|
3825
3869
|
return new Promise((i, s) => {
|
|
3826
3870
|
e.send(
|
|
3827
3871
|
r,
|
|
@@ -3831,16 +3875,16 @@ function Xn(t) {
|
|
|
3831
3875
|
});
|
|
3832
3876
|
});
|
|
3833
3877
|
}
|
|
3834
|
-
function
|
|
3878
|
+
function St(t, e = "share") {
|
|
3835
3879
|
const r = typeof window != "undefined" && window.wx && window.wx.miniProgram;
|
|
3836
3880
|
if (!r || typeof r.postMessage != "function")
|
|
3837
3881
|
throw { errMsg: `当前微信小程序容器未注入 postMessage 能力,无法发起 ${e}`, code: "MINIPROGRAM_BRIDGE_UNAVAILABLE" };
|
|
3838
|
-
r.postMessage({ data:
|
|
3882
|
+
r.postMessage({ data: t });
|
|
3839
3883
|
}
|
|
3840
|
-
function
|
|
3841
|
-
return { type: "qsh_api_call", api: "shareDirected", params: { miniProgramShare:
|
|
3884
|
+
function ri(t) {
|
|
3885
|
+
return { type: "qsh_api_call", api: "shareDirected", params: { miniProgramShare: Qn(t) }, timestamp: Date.now() };
|
|
3842
3886
|
}
|
|
3843
|
-
function
|
|
3887
|
+
function ni(t = {}) {
|
|
3844
3888
|
if (!t || typeof t != "object")
|
|
3845
3889
|
throw { errMsg: "shareMiniProgramCard 参数必须是对象", code: "PARAM_TYPE_ERROR" };
|
|
3846
3890
|
const e = t.payload || {};
|
|
@@ -3848,22 +3892,22 @@ function Qn(t = {}) {
|
|
|
3848
3892
|
if (!e.imageUrl) throw { errMsg: "shareMiniProgramCard: payload.imageUrl 必填", code: "PARAM_MISSING" };
|
|
3849
3893
|
if (!e.targetPath) throw { errMsg: "shareMiniProgramCard: payload.targetPath 必填", code: "PARAM_MISSING" };
|
|
3850
3894
|
if (!e.appid) throw { errMsg: "shareMiniProgramCard: payload.appid 必填", code: "PARAM_MISSING" };
|
|
3851
|
-
return
|
|
3895
|
+
return Se(e.targetPath, "targetPath"), { payload: e, success: t.success, fail: t.fail, complete: t.complete };
|
|
3852
3896
|
}
|
|
3853
|
-
function
|
|
3854
|
-
const { payload: e } = t
|
|
3897
|
+
function ii(t) {
|
|
3898
|
+
const { payload: e } = t;
|
|
3899
|
+
return Nt(e.webUrl, "webUrl"), t;
|
|
3900
|
+
}
|
|
3901
|
+
function ai(t) {
|
|
3902
|
+
const { payload: e } = t, r = Se(e.targetPath, "targetPath");
|
|
3855
3903
|
return {
|
|
3856
3904
|
title: e.title,
|
|
3857
3905
|
path: r.path,
|
|
3858
3906
|
query: r.query,
|
|
3859
|
-
imageUrl: e.imageUrl
|
|
3860
|
-
appid: e.appid,
|
|
3861
|
-
envVersion: e.envVersion || "release",
|
|
3862
|
-
description: e.description || "",
|
|
3863
|
-
fallbackWebUrl: e.fallbackWebUrl || ""
|
|
3907
|
+
imageUrl: e.imageUrl
|
|
3864
3908
|
};
|
|
3865
3909
|
}
|
|
3866
|
-
function
|
|
3910
|
+
function si(t) {
|
|
3867
3911
|
const { payload: e } = t;
|
|
3868
3912
|
return {
|
|
3869
3913
|
provider: "weixin",
|
|
@@ -3875,97 +3919,110 @@ function ti(t) {
|
|
|
3875
3919
|
id: e.appid,
|
|
3876
3920
|
path: e.targetPath,
|
|
3877
3921
|
type: e.envVersion || "release",
|
|
3878
|
-
webUrl: e.
|
|
3922
|
+
webUrl: e.webUrl
|
|
3879
3923
|
}
|
|
3880
3924
|
};
|
|
3881
3925
|
}
|
|
3882
|
-
function
|
|
3883
|
-
return { type: "qsh_api_call", api: "shareMiniProgramCard", params: { miniProgramShare:
|
|
3926
|
+
function oi(t) {
|
|
3927
|
+
return { type: "qsh_api_call", api: "shareMiniProgramCard", params: { miniProgramShare: ai(t) }, timestamp: Date.now() };
|
|
3884
3928
|
}
|
|
3885
|
-
function
|
|
3886
|
-
return
|
|
3929
|
+
function ci(t) {
|
|
3930
|
+
return w(this, null, function* () {
|
|
3887
3931
|
return new Promise((e, r) => {
|
|
3888
|
-
|
|
3932
|
+
O("shareMiniProgramCard", { appShare: si(t) }, { success: (n) => e(n || {}), fail: (n) => r(n) });
|
|
3889
3933
|
});
|
|
3890
3934
|
});
|
|
3891
3935
|
}
|
|
3892
|
-
function
|
|
3936
|
+
function Tt(t = {}) {
|
|
3893
3937
|
return u.safeExecute(() => {
|
|
3894
|
-
var s, o, d, l,
|
|
3938
|
+
var s, o, d, l, E, N, R, $, ce, C, F;
|
|
3895
3939
|
let e;
|
|
3896
3940
|
try {
|
|
3897
|
-
e =
|
|
3898
|
-
} catch (
|
|
3899
|
-
return (s = t.fail) == null || s.call(t,
|
|
3941
|
+
e = Xn(t);
|
|
3942
|
+
} catch (p) {
|
|
3943
|
+
return (s = t.fail) == null || s.call(t, p), Promise.reject(p);
|
|
3944
|
+
}
|
|
3945
|
+
const r = Q(!0);
|
|
3946
|
+
try {
|
|
3947
|
+
e = Zn(e, r);
|
|
3948
|
+
} catch (p) {
|
|
3949
|
+
return (o = e.fail) == null || o.call(e, p), (d = e.complete) == null || d.call(e, p), Promise.reject(p);
|
|
3900
3950
|
}
|
|
3901
|
-
const
|
|
3951
|
+
const n = Yn(r);
|
|
3902
3952
|
if (r.isAppPlus)
|
|
3903
|
-
return
|
|
3904
|
-
var
|
|
3905
|
-
const
|
|
3906
|
-
return (
|
|
3907
|
-
}).catch((
|
|
3908
|
-
var
|
|
3909
|
-
return (
|
|
3953
|
+
return ti(e).then((p) => {
|
|
3954
|
+
var ue, je;
|
|
3955
|
+
const B = m(h({}, (p == null ? void 0 : p.data) || {}), { hint: n });
|
|
3956
|
+
return (ue = e.success) == null || ue.call(e, B), (je = e.complete) == null || je.call(e, B), B;
|
|
3957
|
+
}).catch((p) => {
|
|
3958
|
+
var B, ue;
|
|
3959
|
+
return (B = e.fail) == null || B.call(e, p), (ue = e.complete) == null || ue.call(e, p), Promise.reject(p);
|
|
3910
3960
|
});
|
|
3911
3961
|
if (r.isWeixinMiniProgram)
|
|
3912
3962
|
try {
|
|
3913
|
-
|
|
3914
|
-
const
|
|
3915
|
-
return (
|
|
3916
|
-
} catch (
|
|
3917
|
-
return (
|
|
3963
|
+
St(ri(e), "shareDirected");
|
|
3964
|
+
const p = { success: !0, hint: n };
|
|
3965
|
+
return (l = e.success) == null || l.call(e, p), (E = e.complete) == null || E.call(e, p), Promise.resolve(p);
|
|
3966
|
+
} catch (p) {
|
|
3967
|
+
return (N = e.fail) == null || N.call(e, p), (R = e.complete) == null || R.call(e, p), Promise.reject(p);
|
|
3918
3968
|
}
|
|
3919
3969
|
if (r.type === "h5" && !r.isUniAppWebView && !r.isOfflineWebview) {
|
|
3920
|
-
const
|
|
3921
|
-
return (
|
|
3970
|
+
const p = { errMsg: "当前页面不在宿主 WebView 中,无法分享。请在 unified-platform-app 内打开该 H5 再重试。", code: "NOT_IN_CONTAINER" };
|
|
3971
|
+
return ($ = e.fail) == null || $.call(e, p), (ce = e.complete) == null || ce.call(e, p), Promise.reject(p);
|
|
3922
3972
|
}
|
|
3923
3973
|
const i = { errMsg: "当前环境暂不支持 shareDirected,请在 App 或微信小程序容器内使用。", code: "ENV_NOT_SUPPORTED" };
|
|
3924
|
-
return (C = e.fail) == null || C.call(e, i), (
|
|
3974
|
+
return (C = e.fail) == null || C.call(e, i), (F = e.complete) == null || F.call(e, i), Promise.reject(i);
|
|
3925
3975
|
}, { context: "shareDirected", options: t });
|
|
3926
3976
|
}
|
|
3927
|
-
function
|
|
3977
|
+
function ui(t = {}) {
|
|
3928
3978
|
return new Promise((e, r) => {
|
|
3929
|
-
|
|
3979
|
+
Tt(m(h({}, t), { success: e, fail: r }));
|
|
3930
3980
|
});
|
|
3931
3981
|
}
|
|
3932
|
-
function
|
|
3982
|
+
function bt(t = {}) {
|
|
3933
3983
|
return u.safeExecute(() => {
|
|
3934
|
-
var s, o, d, l,
|
|
3984
|
+
var s, o, d, l, E, N, R, $, ce;
|
|
3935
3985
|
let e;
|
|
3936
3986
|
try {
|
|
3937
|
-
e =
|
|
3987
|
+
e = ni(t);
|
|
3938
3988
|
} catch (C) {
|
|
3939
3989
|
return (s = t.fail) == null || s.call(t, C), Promise.reject(C);
|
|
3940
3990
|
}
|
|
3941
|
-
const r =
|
|
3991
|
+
const r = Q(!0);
|
|
3992
|
+
if (r.isAppPlus)
|
|
3993
|
+
try {
|
|
3994
|
+
e = ii(e);
|
|
3995
|
+
} catch (C) {
|
|
3996
|
+
return (o = e.fail) == null || o.call(e, C), (d = e.complete) == null || d.call(e, C), Promise.reject(C);
|
|
3997
|
+
}
|
|
3998
|
+
const n = r.isWeixinMiniProgram ? "已同步小程序卡片内容,请点击右上角“···”后发送给朋友。" : "正在拉起微信发送给朋友面板,请继续完成小程序卡片分享。";
|
|
3942
3999
|
if (r.isAppPlus)
|
|
3943
|
-
return
|
|
3944
|
-
var
|
|
3945
|
-
const
|
|
3946
|
-
return (
|
|
4000
|
+
return ci(e).then((C) => {
|
|
4001
|
+
var p, B;
|
|
4002
|
+
const F = m(h({}, C || {}), { hint: n });
|
|
4003
|
+
return (p = e.success) == null || p.call(e, F), (B = e.complete) == null || B.call(e, F), F;
|
|
3947
4004
|
}).catch((C) => {
|
|
3948
|
-
var
|
|
3949
|
-
return (
|
|
4005
|
+
var F, p;
|
|
4006
|
+
return (F = e.fail) == null || F.call(e, C), (p = e.complete) == null || p.call(e, C), Promise.reject(C);
|
|
3950
4007
|
});
|
|
3951
4008
|
if (r.isWeixinMiniProgram)
|
|
3952
4009
|
try {
|
|
3953
|
-
|
|
4010
|
+
St(oi(e), "shareMiniProgramCard");
|
|
3954
4011
|
const C = { success: !0, hint: n };
|
|
3955
|
-
return (
|
|
4012
|
+
return (l = e.success) == null || l.call(e, C), (E = e.complete) == null || E.call(e, C), Promise.resolve(C);
|
|
3956
4013
|
} catch (C) {
|
|
3957
|
-
return (
|
|
4014
|
+
return (N = e.fail) == null || N.call(e, C), (R = e.complete) == null || R.call(e, C), Promise.reject(C);
|
|
3958
4015
|
}
|
|
3959
4016
|
const i = { errMsg: "当前环境暂不支持 shareMiniProgramCard,请在 App 或微信小程序容器内使用。", code: "ENV_NOT_SUPPORTED" };
|
|
3960
|
-
return (
|
|
4017
|
+
return ($ = e.fail) == null || $.call(e, i), (ce = e.complete) == null || ce.call(e, i), Promise.reject(i);
|
|
3961
4018
|
}, { context: "shareMiniProgramCard", options: t });
|
|
3962
4019
|
}
|
|
3963
|
-
function
|
|
4020
|
+
function li(t = {}) {
|
|
3964
4021
|
return new Promise((e, r) => {
|
|
3965
|
-
|
|
4022
|
+
bt(m(h({}, t), { success: e, fail: r }));
|
|
3966
4023
|
});
|
|
3967
4024
|
}
|
|
3968
|
-
const
|
|
4025
|
+
const fi = {
|
|
3969
4026
|
OFF: "off",
|
|
3970
4027
|
// 蓝牙关闭
|
|
3971
4028
|
ON: "on",
|
|
@@ -3974,29 +4031,29 @@ const si = {
|
|
|
3974
4031
|
// 不支持蓝牙
|
|
3975
4032
|
UNAUTHORIZED: "unauthorized"
|
|
3976
4033
|
// 未授权
|
|
3977
|
-
},
|
|
4034
|
+
}, di = {
|
|
3978
4035
|
allowDuplicatesKey: !1,
|
|
3979
4036
|
// 是否允许重复上报同一设备
|
|
3980
4037
|
services: []
|
|
3981
4038
|
// 指定服务 UUID 列表
|
|
3982
4039
|
};
|
|
3983
|
-
function
|
|
3984
|
-
return h(h({},
|
|
4040
|
+
function Te(t = {}) {
|
|
4041
|
+
return h(h({}, di), t);
|
|
3985
4042
|
}
|
|
3986
|
-
function
|
|
4043
|
+
function we() {
|
|
3987
4044
|
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(f.type);
|
|
3988
4045
|
}
|
|
3989
|
-
function
|
|
3990
|
-
return u.safeExecute(() =>
|
|
4046
|
+
function gi(t) {
|
|
4047
|
+
return u.safeExecute(() => w(null, null, function* () {
|
|
3991
4048
|
var e;
|
|
3992
4049
|
if (!window.wx) {
|
|
3993
4050
|
const r = { errMsg: "微信JS-SDK未加载", code: "WEIXIN_SDK_NOT_LOADED" };
|
|
3994
4051
|
(e = t.fail) == null || e.call(t, r);
|
|
3995
4052
|
return;
|
|
3996
4053
|
}
|
|
3997
|
-
|
|
4054
|
+
ee() || (a.info("等待微信配置完成"), yield J()), wx.openBluetoothAdapter({
|
|
3998
4055
|
success: () => {
|
|
3999
|
-
a.info("微信蓝牙适配器已打开"),
|
|
4056
|
+
a.info("微信蓝牙适配器已打开"), Lt(t);
|
|
4000
4057
|
},
|
|
4001
4058
|
fail: (r) => {
|
|
4002
4059
|
var n;
|
|
@@ -4005,9 +4062,9 @@ function ci(t) {
|
|
|
4005
4062
|
});
|
|
4006
4063
|
}), { context: "openBluetoothAdapterInWeixin" });
|
|
4007
4064
|
}
|
|
4008
|
-
function
|
|
4065
|
+
function hi(t) {
|
|
4009
4066
|
return u.safeExecute(() => {
|
|
4010
|
-
a.debug("通过 WebView 桥接调用蓝牙功能", t),
|
|
4067
|
+
a.debug("通过 WebView 桥接调用蓝牙功能", t), O("bluetooth", t, {
|
|
4011
4068
|
success: (e) => {
|
|
4012
4069
|
var r;
|
|
4013
4070
|
a.info("UniApp 蓝牙调用成功", e), (r = t.success) == null || r.call(t, e);
|
|
@@ -4020,10 +4077,10 @@ function ui(t) {
|
|
|
4020
4077
|
});
|
|
4021
4078
|
}, { context: "bluetoothInUniApp" });
|
|
4022
4079
|
}
|
|
4023
|
-
function
|
|
4080
|
+
function pi(t) {
|
|
4024
4081
|
return u.safeExecute(() => {
|
|
4025
4082
|
var e;
|
|
4026
|
-
a.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t),
|
|
4083
|
+
a.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t), O("bluetoothDevicesDiscovery", {
|
|
4027
4084
|
action: "startBluetoothDevicesDiscovery",
|
|
4028
4085
|
params: {
|
|
4029
4086
|
services: t.services || [],
|
|
@@ -4042,11 +4099,11 @@ function li(t) {
|
|
|
4042
4099
|
});
|
|
4043
4100
|
}, { context: "startBluetoothDevicesDiscoveryInUniApp" });
|
|
4044
4101
|
}
|
|
4045
|
-
const
|
|
4046
|
-
function
|
|
4102
|
+
const ye = /* @__PURE__ */ new Set();
|
|
4103
|
+
function mi(t, e = {}) {
|
|
4047
4104
|
return u.safeExecute(() => {
|
|
4048
4105
|
var r;
|
|
4049
|
-
return
|
|
4106
|
+
return ye.add(t), ye.size === 1 && O("onBluetoothDeviceFound", {
|
|
4050
4107
|
action: "onBluetoothDeviceFound",
|
|
4051
4108
|
isPersistent: !0,
|
|
4052
4109
|
params: {
|
|
@@ -4055,7 +4112,7 @@ function fi(t, e = {}) {
|
|
|
4055
4112
|
}
|
|
4056
4113
|
}, {
|
|
4057
4114
|
success: (n) => {
|
|
4058
|
-
|
|
4115
|
+
ye.forEach((i) => {
|
|
4059
4116
|
typeof i == "function" ? u.safeExecute(() => i(n), { context: "BluetoothDeviceCallback" }) : console.warn("[BluetoothDeviceCallback] 不是函数:", i);
|
|
4060
4117
|
});
|
|
4061
4118
|
},
|
|
@@ -4064,13 +4121,13 @@ function fi(t, e = {}) {
|
|
|
4064
4121
|
console.error("[Bluetooth] 搜索失败:", n), (i = e.fail) == null || i.call(e, n);
|
|
4065
4122
|
},
|
|
4066
4123
|
complete: e.complete
|
|
4067
|
-
}), () =>
|
|
4124
|
+
}), () => ye.delete(t);
|
|
4068
4125
|
}, { context: "qsh_onBluetoothDeviceFound" });
|
|
4069
4126
|
}
|
|
4070
|
-
function
|
|
4127
|
+
function wi(t) {
|
|
4071
4128
|
return u.safeExecute(() => {
|
|
4072
4129
|
var e;
|
|
4073
|
-
a.debug("通过 WebView 桥接调用蓝牙连接功能", t),
|
|
4130
|
+
a.debug("通过 WebView 桥接调用蓝牙连接功能", t), O("bluetoothConnection", {
|
|
4074
4131
|
action: "createBLEConnection",
|
|
4075
4132
|
params: {
|
|
4076
4133
|
deviceId: t.deviceId,
|
|
@@ -4090,10 +4147,10 @@ function di(t) {
|
|
|
4090
4147
|
});
|
|
4091
4148
|
}, { context: "createBLEConnectionInUniApp" });
|
|
4092
4149
|
}
|
|
4093
|
-
function
|
|
4150
|
+
function Ei(t = {}) {
|
|
4094
4151
|
return u.safeExecute(() => {
|
|
4095
4152
|
var r;
|
|
4096
|
-
if (!
|
|
4153
|
+
if (!we()) {
|
|
4097
4154
|
const n = {
|
|
4098
4155
|
errMsg: `当前环境 (${f.type}) 不支持蓝牙功能`,
|
|
4099
4156
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -4101,18 +4158,18 @@ function gi(t = {}) {
|
|
|
4101
4158
|
a.error("平台不支持蓝牙", { platform: f.type }), (r = t.fail) == null || r.call(t, n);
|
|
4102
4159
|
return;
|
|
4103
4160
|
}
|
|
4104
|
-
const e =
|
|
4161
|
+
const e = Te(t);
|
|
4105
4162
|
a.info("开始蓝牙操作", {
|
|
4106
4163
|
platform: f.type,
|
|
4107
4164
|
services: e.services,
|
|
4108
4165
|
allowDuplicatesKey: e.allowDuplicatesKey
|
|
4109
|
-
}), _() ?
|
|
4166
|
+
}), _() ? gi(e) : hi(e);
|
|
4110
4167
|
}, { context: "openBluetoothAdapter", options: t });
|
|
4111
4168
|
}
|
|
4112
|
-
function
|
|
4169
|
+
function yi(t = {}) {
|
|
4113
4170
|
return u.safeExecute(() => {
|
|
4114
4171
|
var r, n;
|
|
4115
|
-
if (!
|
|
4172
|
+
if (!we()) {
|
|
4116
4173
|
const i = {
|
|
4117
4174
|
errMsg: `当前环境 (${f.type}) 不支持蓝牙功能`,
|
|
4118
4175
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -4120,18 +4177,18 @@ function hi(t = {}) {
|
|
|
4120
4177
|
a.error("平台不支持蓝牙", { platform: f.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
|
|
4121
4178
|
return;
|
|
4122
4179
|
}
|
|
4123
|
-
const e =
|
|
4180
|
+
const e = Te(t);
|
|
4124
4181
|
a.info("开始搜索蓝牙设备", {
|
|
4125
4182
|
platform: f.type,
|
|
4126
4183
|
services: e.services,
|
|
4127
4184
|
allowDuplicatesKey: e.allowDuplicatesKey
|
|
4128
|
-
}), _() ? startBluetoothDevicesDiscoveryInWeixin(e) :
|
|
4185
|
+
}), _() ? startBluetoothDevicesDiscoveryInWeixin(e) : pi(e);
|
|
4129
4186
|
}, { context: "startBluetoothDevicesDiscovery", options: t });
|
|
4130
4187
|
}
|
|
4131
|
-
function
|
|
4188
|
+
function Lt(t, e = {}) {
|
|
4132
4189
|
return u.safeExecute(() => {
|
|
4133
4190
|
var n, i;
|
|
4134
|
-
if (!
|
|
4191
|
+
if (!we()) {
|
|
4135
4192
|
const s = {
|
|
4136
4193
|
errMsg: `当前环境 (${f.type}) 不支持蓝牙功能`,
|
|
4137
4194
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -4139,25 +4196,25 @@ function St(t, e = {}) {
|
|
|
4139
4196
|
a.error("平台不支持蓝牙", { platform: f.type }), (n = e.fail) == null || n.call(e, s), (i = e.complete) == null || i.call(e, s);
|
|
4140
4197
|
return;
|
|
4141
4198
|
}
|
|
4142
|
-
const r =
|
|
4143
|
-
a.info("注册蓝牙设备发现监听", { platform: f.type }), _() ? onBluetoothDeviceFoundInWeixin(r) :
|
|
4199
|
+
const r = Te(e);
|
|
4200
|
+
a.info("注册蓝牙设备发现监听", { platform: f.type }), _() ? onBluetoothDeviceFoundInWeixin(r) : mi(t, r);
|
|
4144
4201
|
}, { context: "onBluetoothDeviceFound", options: e });
|
|
4145
4202
|
}
|
|
4146
|
-
function
|
|
4203
|
+
function Ii(t = {}) {
|
|
4147
4204
|
return u.safeExecute(() => {
|
|
4148
4205
|
var s, o, d, l;
|
|
4149
|
-
if (!
|
|
4150
|
-
const
|
|
4206
|
+
if (!we()) {
|
|
4207
|
+
const E = {
|
|
4151
4208
|
errMsg: `当前环境 (${f.type}) 不支持蓝牙功能`,
|
|
4152
4209
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
4153
4210
|
};
|
|
4154
|
-
a.error("平台不支持蓝牙连接", { platform: f.type }), (s = t.fail) == null || s.call(t,
|
|
4211
|
+
a.error("平台不支持蓝牙连接", { platform: f.type }), (s = t.fail) == null || s.call(t, E), (o = t.complete) == null || o.call(t, E);
|
|
4155
4212
|
return;
|
|
4156
4213
|
}
|
|
4157
|
-
const e =
|
|
4214
|
+
const e = Te(t), { name: r, deviceId: n, autoConnect: i = !1 } = e;
|
|
4158
4215
|
if (!n) {
|
|
4159
|
-
const
|
|
4160
|
-
(d = t.fail) == null || d.call(t,
|
|
4216
|
+
const E = { errMsg: "缺少 deviceId 参数", code: "INVALID_PARAMS" };
|
|
4217
|
+
(d = t.fail) == null || d.call(t, E), (l = t.complete) == null || l.call(t, E);
|
|
4161
4218
|
return;
|
|
4162
4219
|
}
|
|
4163
4220
|
a.info("创建蓝牙连接", { deviceId: n, autoConnect: i, platform: f.type }), _() ? uni.createBLEConnection({
|
|
@@ -4166,12 +4223,12 @@ function mi(t = {}) {
|
|
|
4166
4223
|
success: t.success,
|
|
4167
4224
|
fail: t.fail,
|
|
4168
4225
|
complete: t.complete
|
|
4169
|
-
}) :
|
|
4226
|
+
}) : wi(e);
|
|
4170
4227
|
}, { context: "createBLEConnection", options: t });
|
|
4171
4228
|
}
|
|
4172
|
-
function
|
|
4229
|
+
function Ai() {
|
|
4173
4230
|
return {
|
|
4174
|
-
supported:
|
|
4231
|
+
supported: we(),
|
|
4175
4232
|
environment: f.type,
|
|
4176
4233
|
implementation: _() ? "weixin" : "webview",
|
|
4177
4234
|
features: {
|
|
@@ -4183,18 +4240,18 @@ function pi() {
|
|
|
4183
4240
|
}
|
|
4184
4241
|
};
|
|
4185
4242
|
}
|
|
4186
|
-
const
|
|
4243
|
+
const Pi = {
|
|
4187
4244
|
// TODO: 添加更多默认配置
|
|
4188
4245
|
};
|
|
4189
|
-
function
|
|
4190
|
-
return h(h({},
|
|
4246
|
+
function _i(t = {}) {
|
|
4247
|
+
return h(h({}, Pi), t);
|
|
4191
4248
|
}
|
|
4192
|
-
function
|
|
4249
|
+
function vt() {
|
|
4193
4250
|
return ["webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(f.type);
|
|
4194
4251
|
}
|
|
4195
|
-
function
|
|
4252
|
+
function Ci(t) {
|
|
4196
4253
|
return u.safeExecute(() => {
|
|
4197
|
-
a.debug("通过 WebView 桥接调用打印PDF", t),
|
|
4254
|
+
a.debug("通过 WebView 桥接调用打印PDF", t), O("printPdf", m(h({}, t), {
|
|
4198
4255
|
isPersistent: !0
|
|
4199
4256
|
// 强制禁用超时自动清理
|
|
4200
4257
|
}), {
|
|
@@ -4213,10 +4270,10 @@ function yi(t) {
|
|
|
4213
4270
|
platform: "uniapp"
|
|
4214
4271
|
});
|
|
4215
4272
|
}
|
|
4216
|
-
function
|
|
4273
|
+
function Mi(t = {}) {
|
|
4217
4274
|
return u.safeExecute(() => {
|
|
4218
4275
|
var r;
|
|
4219
|
-
if (!
|
|
4276
|
+
if (!vt()) {
|
|
4220
4277
|
const n = {
|
|
4221
4278
|
errMsg: `当前环境 (${f.type}) 不支持打印PDF功能`,
|
|
4222
4279
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -4224,16 +4281,16 @@ function Ii(t = {}) {
|
|
|
4224
4281
|
a.error("平台不支持打印PDF", { platform: f.type }), (r = t.fail) == null || r.call(t, n);
|
|
4225
4282
|
return;
|
|
4226
4283
|
}
|
|
4227
|
-
const e =
|
|
4228
|
-
a.info("开始打印PDF", { platform: f.type }),
|
|
4284
|
+
const e = _i(t);
|
|
4285
|
+
a.info("开始打印PDF", { platform: f.type }), Ci(e);
|
|
4229
4286
|
}, {
|
|
4230
4287
|
context: "printPdf",
|
|
4231
4288
|
options: t
|
|
4232
4289
|
});
|
|
4233
4290
|
}
|
|
4234
|
-
function
|
|
4291
|
+
function Ri() {
|
|
4235
4292
|
return {
|
|
4236
|
-
supported:
|
|
4293
|
+
supported: vt(),
|
|
4237
4294
|
environment: f.type,
|
|
4238
4295
|
implementation: "uniapp",
|
|
4239
4296
|
features: {
|
|
@@ -4241,8 +4298,8 @@ function Ai() {
|
|
|
4241
4298
|
}
|
|
4242
4299
|
};
|
|
4243
4300
|
}
|
|
4244
|
-
const
|
|
4245
|
-
function
|
|
4301
|
+
const xe = "/pages/face/index";
|
|
4302
|
+
function Oi(t = {}) {
|
|
4246
4303
|
const e = h({}, t);
|
|
4247
4304
|
if (!e.name || typeof e.name != "string" || !e.name.trim())
|
|
4248
4305
|
throw {
|
|
@@ -4256,26 +4313,26 @@ function Pi(t = {}) {
|
|
|
4256
4313
|
};
|
|
4257
4314
|
return e.idCardNumber = e.idCardNumber.trim(), e;
|
|
4258
4315
|
}
|
|
4259
|
-
function
|
|
4316
|
+
function xt() {
|
|
4260
4317
|
return _();
|
|
4261
4318
|
}
|
|
4262
|
-
function
|
|
4319
|
+
function Ni() {
|
|
4263
4320
|
return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.navigateTo == "function";
|
|
4264
4321
|
}
|
|
4265
|
-
function
|
|
4322
|
+
function Si(t) {
|
|
4266
4323
|
const e = m(h({}, t), {
|
|
4267
4324
|
title: document.title || "",
|
|
4268
4325
|
url: window.location.href || ""
|
|
4269
4326
|
}), r = Object.entries(e).filter(([, n]) => n != null && n !== "").map(([n, i]) => `${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`).join("&");
|
|
4270
|
-
return r ? `${
|
|
4327
|
+
return r ? `${xe}?${r}` : xe;
|
|
4271
4328
|
}
|
|
4272
|
-
function
|
|
4329
|
+
function Ti(t) {
|
|
4273
4330
|
return u.safeExecute(() => {
|
|
4274
|
-
if (!
|
|
4331
|
+
if (!Ni()) {
|
|
4275
4332
|
a.error("微信小程序导航API不可用");
|
|
4276
4333
|
return;
|
|
4277
4334
|
}
|
|
4278
|
-
const e =
|
|
4335
|
+
const e = Si(t);
|
|
4279
4336
|
a.debug("跳转宿主人脸识别页面", {
|
|
4280
4337
|
name: t.name,
|
|
4281
4338
|
targetUrl: e
|
|
@@ -4293,15 +4350,15 @@ function Mi(t) {
|
|
|
4293
4350
|
platform: "weixin"
|
|
4294
4351
|
});
|
|
4295
4352
|
}
|
|
4296
|
-
function
|
|
4353
|
+
function bi(t = {}) {
|
|
4297
4354
|
return u.safeExecute(() => {
|
|
4298
|
-
if (!
|
|
4355
|
+
if (!xt()) {
|
|
4299
4356
|
a.error("平台不支持人脸识别", { platform: f.type });
|
|
4300
4357
|
return;
|
|
4301
4358
|
}
|
|
4302
4359
|
let e;
|
|
4303
4360
|
try {
|
|
4304
|
-
e =
|
|
4361
|
+
e = Oi(t);
|
|
4305
4362
|
} catch (r) {
|
|
4306
4363
|
a.error("人脸识别参数校验失败", r);
|
|
4307
4364
|
return;
|
|
@@ -4309,16 +4366,16 @@ function Oi(t = {}) {
|
|
|
4309
4366
|
a.info("开始人脸识别", {
|
|
4310
4367
|
platform: f.type,
|
|
4311
4368
|
name: e.name,
|
|
4312
|
-
pagePath:
|
|
4313
|
-
}),
|
|
4369
|
+
pagePath: xe
|
|
4370
|
+
}), Ti(e);
|
|
4314
4371
|
}, {
|
|
4315
4372
|
context: "faceVerify",
|
|
4316
4373
|
options: t
|
|
4317
4374
|
});
|
|
4318
4375
|
}
|
|
4319
|
-
function
|
|
4376
|
+
function Li() {
|
|
4320
4377
|
return {
|
|
4321
|
-
supported:
|
|
4378
|
+
supported: xt(),
|
|
4322
4379
|
environment: f.type,
|
|
4323
4380
|
implementation: "weixin",
|
|
4324
4381
|
features: {
|
|
@@ -4327,205 +4384,205 @@ function Ri() {
|
|
|
4327
4384
|
}
|
|
4328
4385
|
};
|
|
4329
4386
|
}
|
|
4330
|
-
const
|
|
4331
|
-
function
|
|
4332
|
-
if (typeof window == "undefined" || !
|
|
4387
|
+
const Dt = Q();
|
|
4388
|
+
function vi() {
|
|
4389
|
+
if (typeof window == "undefined" || !Q(!0).isWeixinMiniProgram)
|
|
4333
4390
|
return !1;
|
|
4334
|
-
const e =
|
|
4391
|
+
const e = Le().getRuntimeConfig();
|
|
4335
4392
|
return typeof e.clientId == "string" && e.clientId.length > 0;
|
|
4336
4393
|
}
|
|
4337
|
-
function
|
|
4338
|
-
return
|
|
4339
|
-
yield
|
|
4394
|
+
function xi() {
|
|
4395
|
+
return w(this, null, function* () {
|
|
4396
|
+
yield or(), vi() && (yield J());
|
|
4340
4397
|
});
|
|
4341
4398
|
}
|
|
4342
|
-
|
|
4343
|
-
let
|
|
4344
|
-
function
|
|
4345
|
-
if (
|
|
4346
|
-
|
|
4347
|
-
{ name: "load-weixin-sdk", run:
|
|
4348
|
-
{ name: "init-bridge", run:
|
|
4399
|
+
H.useResponse(ct.response, { priority: 1e3 });
|
|
4400
|
+
let Ze = !1;
|
|
4401
|
+
function Qe() {
|
|
4402
|
+
if (Ze) return;
|
|
4403
|
+
Ze = !0, Nr([
|
|
4404
|
+
{ name: "load-weixin-sdk", run: at, timeoutMs: 8e3 },
|
|
4405
|
+
{ name: "init-bridge", run: nt, timeoutMs: 8e3 }
|
|
4349
4406
|
], {
|
|
4350
4407
|
onError: (e, r) => {
|
|
4351
4408
|
console.error(`[QSH-SDK] 初始化失败(${(r == null ? void 0 : r.name) || "unknown"}):`, e);
|
|
4352
4409
|
}
|
|
4353
4410
|
});
|
|
4354
4411
|
}
|
|
4355
|
-
typeof window != "undefined" && (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(
|
|
4356
|
-
function
|
|
4412
|
+
typeof window != "undefined" && (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(Qe, 0) : document.addEventListener("DOMContentLoaded", Qe));
|
|
4413
|
+
function y(t, { apiName: e } = {}) {
|
|
4357
4414
|
return function(r = {}, ...n) {
|
|
4358
|
-
const i = r && typeof r == "object" && (typeof r.success == "function" || typeof r.fail == "function" || typeof r.complete == "function"), s = r && typeof r == "object" ? r : {}, o = () => i ? t(s, ...n) : new Promise((l,
|
|
4415
|
+
const i = r && typeof r == "object" && (typeof r.success == "function" || typeof r.fail == "function" || typeof r.complete == "function"), s = r && typeof r == "object" ? r : {}, o = () => i ? t(s, ...n) : new Promise((l, E) => {
|
|
4359
4416
|
const N = m(h({}, s), {
|
|
4360
|
-
success: (
|
|
4361
|
-
typeof s.success == "function" && s.success(
|
|
4417
|
+
success: (R) => {
|
|
4418
|
+
typeof s.success == "function" && s.success(R), l(R);
|
|
4362
4419
|
},
|
|
4363
|
-
fail: (
|
|
4364
|
-
typeof s.fail == "function" && s.fail(
|
|
4420
|
+
fail: (R) => {
|
|
4421
|
+
typeof s.fail == "function" && s.fail(R), E(R);
|
|
4365
4422
|
},
|
|
4366
4423
|
complete: s.complete
|
|
4367
4424
|
});
|
|
4368
4425
|
t(N, ...n);
|
|
4369
4426
|
});
|
|
4370
|
-
return (typeof window == "undefined" ? Promise.resolve() :
|
|
4427
|
+
return (typeof window == "undefined" ? Promise.resolve() : rt()).then(() => o()).catch((l) => {
|
|
4371
4428
|
throw console.error(`[QSH-SDK] ${e || "API"} call failed:`, l), l;
|
|
4372
4429
|
});
|
|
4373
4430
|
};
|
|
4374
4431
|
}
|
|
4375
|
-
function
|
|
4432
|
+
function Ie(t) {
|
|
4376
4433
|
return typeof t == "function" ? { success: t } : t && typeof t == "object" ? t : {};
|
|
4377
4434
|
}
|
|
4378
|
-
const
|
|
4379
|
-
function
|
|
4380
|
-
const e = () =>
|
|
4381
|
-
return (typeof window == "undefined" ? Promise.resolve() :
|
|
4435
|
+
const Ut = y(Yr), Wt = y(Xr), $t = y(Zr), Ft = y(Qr), Bt = y(en), kt = y(tn);
|
|
4436
|
+
function Gt(t) {
|
|
4437
|
+
const e = () => rn(t);
|
|
4438
|
+
return (typeof window == "undefined" ? Promise.resolve() : rt()).then(() => e());
|
|
4382
4439
|
}
|
|
4383
|
-
const
|
|
4384
|
-
function
|
|
4440
|
+
const Fe = y(un, { apiName: "getCode" });
|
|
4441
|
+
function Di(t = {}) {
|
|
4385
4442
|
return new Promise((e, r) => {
|
|
4386
|
-
|
|
4443
|
+
Fe(m(h({}, t), {
|
|
4387
4444
|
success: e,
|
|
4388
4445
|
fail: r
|
|
4389
4446
|
}));
|
|
4390
4447
|
});
|
|
4391
4448
|
}
|
|
4392
|
-
const
|
|
4449
|
+
const Be = y(hn, {
|
|
4393
4450
|
apiName: "navigateToMiniProgram"
|
|
4394
4451
|
});
|
|
4395
|
-
function
|
|
4452
|
+
function Ui(t = {}) {
|
|
4396
4453
|
return new Promise((e, r) => {
|
|
4397
|
-
|
|
4454
|
+
Be(m(h({}, t), {
|
|
4398
4455
|
success: e,
|
|
4399
4456
|
fail: r
|
|
4400
4457
|
}));
|
|
4401
4458
|
});
|
|
4402
4459
|
}
|
|
4403
|
-
const
|
|
4404
|
-
function
|
|
4460
|
+
const ke = y(En);
|
|
4461
|
+
function Wi(t = {}) {
|
|
4405
4462
|
return new Promise((e, r) => {
|
|
4406
|
-
|
|
4463
|
+
ke(m(h({}, t), {
|
|
4407
4464
|
success: e,
|
|
4408
4465
|
fail: r
|
|
4409
4466
|
}));
|
|
4410
4467
|
});
|
|
4411
4468
|
}
|
|
4412
|
-
const
|
|
4413
|
-
function
|
|
4469
|
+
const Kt = y(Mi);
|
|
4470
|
+
function $i(t = {}) {
|
|
4414
4471
|
return new Promise((e, r) => {
|
|
4415
|
-
|
|
4472
|
+
Kt(m(h({}, t), {
|
|
4416
4473
|
success: e,
|
|
4417
4474
|
fail: r
|
|
4418
4475
|
}));
|
|
4419
4476
|
});
|
|
4420
4477
|
}
|
|
4421
|
-
const
|
|
4422
|
-
function
|
|
4478
|
+
const Ge = y(Cn), Fi = y(bi);
|
|
4479
|
+
function Bi(t = {}) {
|
|
4423
4480
|
return new Promise((e, r) => {
|
|
4424
|
-
|
|
4481
|
+
Ge(m(h({}, t), {
|
|
4425
4482
|
success: e,
|
|
4426
4483
|
fail: r
|
|
4427
4484
|
}));
|
|
4428
4485
|
});
|
|
4429
4486
|
}
|
|
4430
|
-
const
|
|
4431
|
-
function
|
|
4487
|
+
const ki = y(Tt, { apiName: "shareDirected" }), Gi = y(ui, { apiName: "shareDirectedAsync" }), Ke = y(vn);
|
|
4488
|
+
function Ki(t = {}) {
|
|
4432
4489
|
return new Promise((e, r) => {
|
|
4433
|
-
|
|
4490
|
+
Ke(m(h({}, t), {
|
|
4434
4491
|
success: e,
|
|
4435
4492
|
fail: r
|
|
4436
4493
|
}));
|
|
4437
4494
|
});
|
|
4438
4495
|
}
|
|
4439
|
-
const
|
|
4440
|
-
function
|
|
4496
|
+
const Ve = y(xn);
|
|
4497
|
+
function Vi(t = {}) {
|
|
4441
4498
|
return new Promise((e, r) => {
|
|
4442
|
-
|
|
4499
|
+
Ve(m(h({}, t), {
|
|
4443
4500
|
success: e,
|
|
4444
4501
|
fail: r
|
|
4445
4502
|
}));
|
|
4446
4503
|
});
|
|
4447
4504
|
}
|
|
4448
|
-
const
|
|
4449
|
-
function
|
|
4505
|
+
const qe = y(qn);
|
|
4506
|
+
function qi(t = {}) {
|
|
4450
4507
|
return new Promise((e, r) => {
|
|
4451
|
-
|
|
4508
|
+
qe(m(h({}, t), {
|
|
4452
4509
|
success: e,
|
|
4453
4510
|
fail: r
|
|
4454
4511
|
}));
|
|
4455
4512
|
});
|
|
4456
4513
|
}
|
|
4457
|
-
const
|
|
4458
|
-
function
|
|
4514
|
+
const Vt = y(Ei);
|
|
4515
|
+
function ji(t = {}) {
|
|
4459
4516
|
return new Promise((e, r) => {
|
|
4460
|
-
|
|
4517
|
+
Vt(m(h({}, t), {
|
|
4461
4518
|
success: e,
|
|
4462
4519
|
fail: r
|
|
4463
4520
|
}));
|
|
4464
4521
|
});
|
|
4465
4522
|
}
|
|
4466
|
-
const
|
|
4467
|
-
function
|
|
4523
|
+
const qt = y(yi);
|
|
4524
|
+
function zi(t = {}) {
|
|
4468
4525
|
return new Promise((e, r) => {
|
|
4469
|
-
|
|
4526
|
+
qt(m(h({}, t), {
|
|
4470
4527
|
success: e,
|
|
4471
4528
|
fail: r
|
|
4472
4529
|
}));
|
|
4473
4530
|
});
|
|
4474
4531
|
}
|
|
4475
|
-
const
|
|
4476
|
-
function
|
|
4532
|
+
const jt = y(Lt);
|
|
4533
|
+
function Ji(t = {}) {
|
|
4477
4534
|
return new Promise((e, r) => {
|
|
4478
|
-
|
|
4535
|
+
jt(m(h({}, t), {
|
|
4479
4536
|
success: e,
|
|
4480
4537
|
fail: r
|
|
4481
4538
|
}));
|
|
4482
4539
|
});
|
|
4483
4540
|
}
|
|
4484
|
-
const
|
|
4485
|
-
function
|
|
4541
|
+
const zt = y(Ii);
|
|
4542
|
+
function Hi(t = {}) {
|
|
4486
4543
|
return new Promise((e, r) => {
|
|
4487
|
-
|
|
4544
|
+
zt(m(h({}, t), {
|
|
4488
4545
|
success: e,
|
|
4489
4546
|
fail: r
|
|
4490
4547
|
}));
|
|
4491
4548
|
});
|
|
4492
4549
|
}
|
|
4493
|
-
const
|
|
4550
|
+
const Yi = y(bt, { apiName: "shareMiniProgramCard" }), Xi = y(li, { apiName: "shareMiniProgramCardAsync" }), oe = {
|
|
4494
4551
|
// 导航 API
|
|
4495
|
-
navigateTo:
|
|
4496
|
-
navigateBack:
|
|
4497
|
-
switchTab:
|
|
4498
|
-
reLaunch:
|
|
4499
|
-
redirectTo:
|
|
4552
|
+
navigateTo: Ut,
|
|
4553
|
+
navigateBack: Wt,
|
|
4554
|
+
switchTab: $t,
|
|
4555
|
+
reLaunch: Ft,
|
|
4556
|
+
redirectTo: Bt,
|
|
4500
4557
|
// 消息 API
|
|
4501
|
-
postMessage:
|
|
4502
|
-
getEnv:
|
|
4503
|
-
getCode:
|
|
4504
|
-
getCodeAsync:
|
|
4505
|
-
navigateToMiniProgram:
|
|
4506
|
-
navigateToMiniProgramAsync:
|
|
4558
|
+
postMessage: kt,
|
|
4559
|
+
getEnv: Gt,
|
|
4560
|
+
getCode: Fe,
|
|
4561
|
+
getCodeAsync: Di,
|
|
4562
|
+
navigateToMiniProgram: Be,
|
|
4563
|
+
navigateToMiniProgramAsync: Ui,
|
|
4507
4564
|
// 图片 API
|
|
4508
|
-
chooseImage:
|
|
4509
|
-
chooseImageAsync:
|
|
4565
|
+
chooseImage: ke,
|
|
4566
|
+
chooseImageAsync: Wi,
|
|
4510
4567
|
// 扫码 API
|
|
4511
|
-
scanCode:
|
|
4512
|
-
scanCodeAsync:
|
|
4568
|
+
scanCode: Ge,
|
|
4569
|
+
scanCodeAsync: Bi,
|
|
4513
4570
|
// 位置 API
|
|
4514
|
-
getLocation:
|
|
4515
|
-
getLocationAsync:
|
|
4516
|
-
openLocation:
|
|
4517
|
-
openLocationAsync:
|
|
4518
|
-
chooseLocation:
|
|
4519
|
-
chooseLocationAsync:
|
|
4571
|
+
getLocation: Ke,
|
|
4572
|
+
getLocationAsync: Ki,
|
|
4573
|
+
openLocation: Ve,
|
|
4574
|
+
openLocationAsync: Vi,
|
|
4575
|
+
chooseLocation: qe,
|
|
4576
|
+
chooseLocationAsync: qi,
|
|
4520
4577
|
// 位置监听 API(保留回调签名)
|
|
4521
|
-
onLocationChange: (t) =>
|
|
4522
|
-
offLocationChange: (t) =>
|
|
4523
|
-
onLocationChangeError: (t) =>
|
|
4524
|
-
offLocationChangeError: (t) =>
|
|
4525
|
-
startLocationUpdate:
|
|
4526
|
-
stopLocationUpdate:
|
|
4578
|
+
onLocationChange: (t) => y((e = {}) => $n(e.success), { apiName: "onLocationChange" })(Ie(t)),
|
|
4579
|
+
offLocationChange: (t) => y((e = {}) => Fn(e.success), { apiName: "offLocationChange" })(Ie(t)),
|
|
4580
|
+
onLocationChangeError: (t) => y((e = {}) => Bn(e.success), { apiName: "onLocationChangeError" })(Ie(t)),
|
|
4581
|
+
offLocationChangeError: (t) => y((e = {}) => kn(e.success), { apiName: "offLocationChangeError" })(Ie(t)),
|
|
4582
|
+
startLocationUpdate: y(Un, { apiName: "startLocationUpdate" }),
|
|
4583
|
+
stopLocationUpdate: y(Wn, { apiName: "stopLocationUpdate" }),
|
|
4527
4584
|
// 环境信息
|
|
4528
|
-
environment:
|
|
4585
|
+
environment: Dt,
|
|
4529
4586
|
/**
|
|
4530
4587
|
* Wait for SDK readiness.
|
|
4531
4588
|
* In Weixin mini-program web-view, if qsh.config({ clientId }) was called,
|
|
@@ -4535,7 +4592,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4535
4592
|
* await qsh.ready()
|
|
4536
4593
|
* @since 2.0.0
|
|
4537
4594
|
*/
|
|
4538
|
-
ready:
|
|
4595
|
+
ready: xi,
|
|
4539
4596
|
/**
|
|
4540
4597
|
* 手动初始化 JSBridge
|
|
4541
4598
|
* 默认会在 DOM 就绪时自动初始化;如需更早或手动控制,可调用本方法。
|
|
@@ -4544,7 +4601,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4544
4601
|
* await qsh.init()
|
|
4545
4602
|
* @since 2.0.0
|
|
4546
4603
|
*/
|
|
4547
|
-
init:
|
|
4604
|
+
init: nt,
|
|
4548
4605
|
/**
|
|
4549
4606
|
* 检查 JSBridge 是否就绪
|
|
4550
4607
|
* @returns {boolean}
|
|
@@ -4552,7 +4609,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4552
4609
|
* if (qsh.isReady()) { console.log('ready') }
|
|
4553
4610
|
* @since 2.0.0
|
|
4554
4611
|
*/
|
|
4555
|
-
isReady:
|
|
4612
|
+
isReady: tr,
|
|
4556
4613
|
/**
|
|
4557
4614
|
* 获取当前 SDK 状态
|
|
4558
4615
|
* @returns {string}
|
|
@@ -4560,8 +4617,8 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4560
4617
|
* console.log(qsh.getState()) // 'ready'
|
|
4561
4618
|
* @since 2.0.0
|
|
4562
4619
|
*/
|
|
4563
|
-
getState:
|
|
4564
|
-
config:
|
|
4620
|
+
getState: rr,
|
|
4621
|
+
config: Je,
|
|
4565
4622
|
// 微信配置 API
|
|
4566
4623
|
weixin: {
|
|
4567
4624
|
/**
|
|
@@ -4571,8 +4628,8 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4571
4628
|
* await qsh.weixin.waitForConfig()
|
|
4572
4629
|
* @since 2.0.0
|
|
4573
4630
|
*/
|
|
4574
|
-
config:
|
|
4575
|
-
waitForConfig:
|
|
4631
|
+
config: Je,
|
|
4632
|
+
waitForConfig: J,
|
|
4576
4633
|
/**
|
|
4577
4634
|
* 检查微信配置是否完成
|
|
4578
4635
|
* @returns {boolean}
|
|
@@ -4580,7 +4637,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4580
4637
|
* if (qsh.weixin.isConfigReady()) { wx.chooseImage({}) }
|
|
4581
4638
|
* @since 2.0.0
|
|
4582
4639
|
*/
|
|
4583
|
-
isConfigReady:
|
|
4640
|
+
isConfigReady: ee,
|
|
4584
4641
|
/**
|
|
4585
4642
|
* 获取微信配置状态
|
|
4586
4643
|
* @returns {string}
|
|
@@ -4588,7 +4645,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4588
4645
|
* console.log(qsh.weixin.getConfigState()) // 'configured'
|
|
4589
4646
|
* @since 2.0.0
|
|
4590
4647
|
*/
|
|
4591
|
-
getConfigState:
|
|
4648
|
+
getConfigState: dr,
|
|
4592
4649
|
/**
|
|
4593
4650
|
* 手动重试微信配置
|
|
4594
4651
|
* @returns {Promise<void>}
|
|
@@ -4596,13 +4653,13 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4596
4653
|
* await qsh.weixin.retryConfig()
|
|
4597
4654
|
* @since 2.0.0
|
|
4598
4655
|
*/
|
|
4599
|
-
retryConfig:
|
|
4656
|
+
retryConfig: gr
|
|
4600
4657
|
},
|
|
4601
4658
|
// WebView 对象(兼容旧版本)
|
|
4602
4659
|
webView: null,
|
|
4603
4660
|
// 图片相关常量
|
|
4604
|
-
ImageSourceTypes:
|
|
4605
|
-
ImageSizeTypes:
|
|
4661
|
+
ImageSourceTypes: _e,
|
|
4662
|
+
ImageSizeTypes: Ce,
|
|
4606
4663
|
/**
|
|
4607
4664
|
* 获取图片功能能力信息
|
|
4608
4665
|
* @returns {Object} 能力信息对象
|
|
@@ -4611,9 +4668,9 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4611
4668
|
* console.log('是否支持:', capabilities.supported)
|
|
4612
4669
|
* @since 2.0.0
|
|
4613
4670
|
*/
|
|
4614
|
-
getImageCapabilities:
|
|
4671
|
+
getImageCapabilities: yn,
|
|
4615
4672
|
// 扫码相关常量
|
|
4616
|
-
ScanTypes:
|
|
4673
|
+
ScanTypes: X,
|
|
4617
4674
|
/**
|
|
4618
4675
|
* 获取扫码功能能力信息
|
|
4619
4676
|
* @returns {Object} 能力信息对象
|
|
@@ -4622,9 +4679,9 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4622
4679
|
* console.log('是否支持:', capabilities.supported)
|
|
4623
4680
|
* @since 2.1.0
|
|
4624
4681
|
*/
|
|
4625
|
-
getScanCapabilities:
|
|
4682
|
+
getScanCapabilities: Mn,
|
|
4626
4683
|
// 位置相关常量
|
|
4627
|
-
CoordinateTypes:
|
|
4684
|
+
CoordinateTypes: se,
|
|
4628
4685
|
/**
|
|
4629
4686
|
* 获取位置功能能力信息
|
|
4630
4687
|
* @returns {Object} 能力信息对象
|
|
@@ -4633,7 +4690,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4633
4690
|
* console.log('是否支持:', capabilities.supported)
|
|
4634
4691
|
* @since 2.1.0
|
|
4635
4692
|
*/
|
|
4636
|
-
getLocationCapabilities:
|
|
4693
|
+
getLocationCapabilities: Dn,
|
|
4637
4694
|
/**
|
|
4638
4695
|
* 获取位置选择功能能力信息
|
|
4639
4696
|
* @returns {Object} 能力信息对象
|
|
@@ -4642,25 +4699,25 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4642
4699
|
* console.log('是否支持:', capabilities.supported)
|
|
4643
4700
|
* @since 2.1.0
|
|
4644
4701
|
*/
|
|
4645
|
-
getChooseLocationCapabilities:
|
|
4702
|
+
getChooseLocationCapabilities: jn,
|
|
4646
4703
|
// 蓝牙 API
|
|
4647
|
-
openBluetoothAdapter:
|
|
4648
|
-
openBluetoothAdapterAsync:
|
|
4649
|
-
startBluetoothDevicesDiscovery:
|
|
4650
|
-
startBluetoothDevicesDiscoveryAsync:
|
|
4651
|
-
onBluetoothDeviceFound:
|
|
4652
|
-
onBluetoothDeviceFoundAsync:
|
|
4653
|
-
createBLEConnection:
|
|
4654
|
-
createBLEConnectionAsync:
|
|
4704
|
+
openBluetoothAdapter: Vt,
|
|
4705
|
+
openBluetoothAdapterAsync: ji,
|
|
4706
|
+
startBluetoothDevicesDiscovery: qt,
|
|
4707
|
+
startBluetoothDevicesDiscoveryAsync: zi,
|
|
4708
|
+
onBluetoothDeviceFound: jt,
|
|
4709
|
+
onBluetoothDeviceFoundAsync: Ji,
|
|
4710
|
+
createBLEConnection: zt,
|
|
4711
|
+
createBLEConnectionAsync: Hi,
|
|
4655
4712
|
// 蓝牙相关常量
|
|
4656
|
-
BluetoothStates:
|
|
4713
|
+
BluetoothStates: fi,
|
|
4657
4714
|
//微信分享(定向模块)
|
|
4658
4715
|
/** 定向分享模块:仅 H5->宿主 WebView,图文/文字/图片到微信会话/朋友圈 */
|
|
4659
|
-
shareDirected:
|
|
4660
|
-
shareDirectedAsync:
|
|
4716
|
+
shareDirected: ki,
|
|
4717
|
+
shareDirectedAsync: Gi,
|
|
4661
4718
|
/** 微信小程序卡片:仅发送给朋友,不改现有 shareDirected */
|
|
4662
|
-
shareMiniProgramCard:
|
|
4663
|
-
shareMiniProgramCardAsync:
|
|
4719
|
+
shareMiniProgramCard: Yi,
|
|
4720
|
+
shareMiniProgramCardAsync: Xi,
|
|
4664
4721
|
/**
|
|
4665
4722
|
* 获取蓝牙功能能力信息
|
|
4666
4723
|
* @returns {Object} 能力信息对象
|
|
@@ -4668,10 +4725,10 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4668
4725
|
* const capabilities = qsh.getBluetoothCapabilities()
|
|
4669
4726
|
* console.log('是否支持:', capabilities.supported)
|
|
4670
4727
|
*/
|
|
4671
|
-
getBluetoothCapabilities:
|
|
4728
|
+
getBluetoothCapabilities: Ai,
|
|
4672
4729
|
// 打印PDF API
|
|
4673
|
-
printPdf:
|
|
4674
|
-
printPdfAsync:
|
|
4730
|
+
printPdf: Kt,
|
|
4731
|
+
printPdfAsync: $i,
|
|
4675
4732
|
/**
|
|
4676
4733
|
* 获取打印PDF功能能力信息
|
|
4677
4734
|
* @returns {Object} 能力信息对象
|
|
@@ -4679,16 +4736,16 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4679
4736
|
* const capabilities = qsh.getPrintCapabilities()
|
|
4680
4737
|
* console.log('是否支持:', capabilities.supported)
|
|
4681
4738
|
*/
|
|
4682
|
-
getPrintCapabilities:
|
|
4739
|
+
getPrintCapabilities: Ri,
|
|
4683
4740
|
// 人脸识别 API(仅支持微信小程序环境)
|
|
4684
|
-
faceVerify:
|
|
4685
|
-
getFaceCapabilities:
|
|
4741
|
+
faceVerify: Fi,
|
|
4742
|
+
getFaceCapabilities: Li,
|
|
4686
4743
|
// 插件系统
|
|
4687
4744
|
plugins: {
|
|
4688
4745
|
/**
|
|
4689
4746
|
* 插件管理器
|
|
4690
4747
|
*/
|
|
4691
|
-
manager:
|
|
4748
|
+
manager: fe,
|
|
4692
4749
|
/**
|
|
4693
4750
|
* 注册插件
|
|
4694
4751
|
* @param {Object} plugin - 插件对象
|
|
@@ -4696,7 +4753,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4696
4753
|
* @example
|
|
4697
4754
|
* qsh.plugins.register(myPlugin)
|
|
4698
4755
|
*/
|
|
4699
|
-
register: (t) =>
|
|
4756
|
+
register: (t) => fe.register(t),
|
|
4700
4757
|
/**
|
|
4701
4758
|
* 安装插件
|
|
4702
4759
|
* @param {string} name - 插件名称
|
|
@@ -4704,21 +4761,21 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4704
4761
|
* @example
|
|
4705
4762
|
* await qsh.plugins.install('image')
|
|
4706
4763
|
*/
|
|
4707
|
-
install: (t) =>
|
|
4764
|
+
install: (t) => fe.install(t, oe),
|
|
4708
4765
|
/**
|
|
4709
4766
|
* 获取插件列表
|
|
4710
4767
|
* @returns {Array} 插件列表
|
|
4711
4768
|
* @example
|
|
4712
4769
|
* console.log(qsh.plugins.list())
|
|
4713
4770
|
*/
|
|
4714
|
-
list: () =>
|
|
4771
|
+
list: () => fe.getPluginList()
|
|
4715
4772
|
},
|
|
4716
4773
|
// 拦截器系统
|
|
4717
4774
|
interceptors: {
|
|
4718
4775
|
/**
|
|
4719
4776
|
* 拦截器链
|
|
4720
4777
|
*/
|
|
4721
|
-
chain:
|
|
4778
|
+
chain: H,
|
|
4722
4779
|
/**
|
|
4723
4780
|
* 注册请求拦截器
|
|
4724
4781
|
* @param {Function} interceptor - 拦截器函数
|
|
@@ -4730,7 +4787,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4730
4787
|
* return ctx
|
|
4731
4788
|
* })
|
|
4732
4789
|
*/
|
|
4733
|
-
useRequest: (t, e) =>
|
|
4790
|
+
useRequest: (t, e) => H.useRequest(t, e),
|
|
4734
4791
|
/**
|
|
4735
4792
|
* 注册响应拦截器
|
|
4736
4793
|
* @param {Function} interceptor - 拦截器函数
|
|
@@ -4742,16 +4799,16 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4742
4799
|
* return result
|
|
4743
4800
|
* })
|
|
4744
4801
|
*/
|
|
4745
|
-
useResponse: (t, e) =>
|
|
4802
|
+
useResponse: (t, e) => H.useResponse(t, e),
|
|
4746
4803
|
/**
|
|
4747
4804
|
* 内置拦截器
|
|
4748
4805
|
*/
|
|
4749
4806
|
builtin: {
|
|
4750
|
-
logging:
|
|
4751
|
-
performance:
|
|
4752
|
-
createRetry:
|
|
4753
|
-
createValidation:
|
|
4754
|
-
errorNormalizer:
|
|
4807
|
+
logging: mr,
|
|
4808
|
+
performance: q,
|
|
4809
|
+
createRetry: wr,
|
|
4810
|
+
createValidation: Er,
|
|
4811
|
+
errorNormalizer: ct
|
|
4755
4812
|
}
|
|
4756
4813
|
},
|
|
4757
4814
|
// 观测指标
|
|
@@ -4759,11 +4816,11 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4759
4816
|
/**
|
|
4760
4817
|
* 获取性能指标报告
|
|
4761
4818
|
*/
|
|
4762
|
-
getPerformanceReport: () =>
|
|
4819
|
+
getPerformanceReport: () => q.getReport(),
|
|
4763
4820
|
/**
|
|
4764
4821
|
* 清空性能指标
|
|
4765
4822
|
*/
|
|
4766
|
-
clearPerformanceMetrics: () =>
|
|
4823
|
+
clearPerformanceMetrics: () => q.clearMetrics()
|
|
4767
4824
|
},
|
|
4768
4825
|
// 错误处理工具
|
|
4769
4826
|
errors: {
|
|
@@ -4774,7 +4831,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4774
4831
|
/**
|
|
4775
4832
|
* 错误消息
|
|
4776
4833
|
*/
|
|
4777
|
-
messages:
|
|
4834
|
+
messages: ve,
|
|
4778
4835
|
/**
|
|
4779
4836
|
* 错误分类
|
|
4780
4837
|
*/
|
|
@@ -4787,7 +4844,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4787
4844
|
* @example
|
|
4788
4845
|
* const standardError = qsh.errors.normalize(error, { apiName: 'chooseImage' })
|
|
4789
4846
|
*/
|
|
4790
|
-
normalize:
|
|
4847
|
+
normalize: ot,
|
|
4791
4848
|
/**
|
|
4792
4849
|
* 创建标准错误
|
|
4793
4850
|
* @param {string} code - 错误码
|
|
@@ -4796,7 +4853,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4796
4853
|
* @example
|
|
4797
4854
|
* const error = qsh.errors.create('E_IMG_001', { apiName: 'chooseImage' })
|
|
4798
4855
|
*/
|
|
4799
|
-
create:
|
|
4856
|
+
create: Mr,
|
|
4800
4857
|
/**
|
|
4801
4858
|
* 判断是否为标准错误
|
|
4802
4859
|
* @param {any} error - 错误对象
|
|
@@ -4804,14 +4861,14 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4804
4861
|
* @example
|
|
4805
4862
|
* if (qsh.errors.isStandard(error)) { ... }
|
|
4806
4863
|
*/
|
|
4807
|
-
isStandard:
|
|
4864
|
+
isStandard: Rr
|
|
4808
4865
|
},
|
|
4809
4866
|
// 状态管理
|
|
4810
4867
|
store: {
|
|
4811
4868
|
/**
|
|
4812
4869
|
* 状态仓库实例
|
|
4813
4870
|
*/
|
|
4814
|
-
instance:
|
|
4871
|
+
instance: G,
|
|
4815
4872
|
/**
|
|
4816
4873
|
* 获取状态
|
|
4817
4874
|
* @param {string} path - 状态路径
|
|
@@ -4819,7 +4876,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4819
4876
|
* @example
|
|
4820
4877
|
* const status = qsh.store.get('sdk.status')
|
|
4821
4878
|
*/
|
|
4822
|
-
get: (t) =>
|
|
4879
|
+
get: (t) => G.get(t),
|
|
4823
4880
|
/**
|
|
4824
4881
|
* 设置状态
|
|
4825
4882
|
* @param {string} path - 状态路径
|
|
@@ -4827,7 +4884,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4827
4884
|
* @example
|
|
4828
4885
|
* qsh.store.set('sdk.status', 'ready')
|
|
4829
4886
|
*/
|
|
4830
|
-
set: (t, e) =>
|
|
4887
|
+
set: (t, e) => G.set(t, e),
|
|
4831
4888
|
/**
|
|
4832
4889
|
* 订阅状态变化
|
|
4833
4890
|
* @param {string} path - 状态路径
|
|
@@ -4838,25 +4895,25 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4838
4895
|
* console.log('网络状态:', online)
|
|
4839
4896
|
* })
|
|
4840
4897
|
*/
|
|
4841
|
-
subscribe: (t, e) =>
|
|
4898
|
+
subscribe: (t, e) => G.subscribe(t, e),
|
|
4842
4899
|
/**
|
|
4843
4900
|
* 获取状态快照
|
|
4844
4901
|
* @returns {Object} 状态快照
|
|
4845
4902
|
* @example
|
|
4846
4903
|
* console.log(qsh.store.getSnapshot())
|
|
4847
4904
|
*/
|
|
4848
|
-
getSnapshot: () =>
|
|
4905
|
+
getSnapshot: () => G.getSnapshot()
|
|
4849
4906
|
},
|
|
4850
4907
|
// 调试工具(生产环境可能被优化掉)
|
|
4851
4908
|
debug: {
|
|
4852
4909
|
/**
|
|
4853
4910
|
* 日志记录器
|
|
4854
4911
|
*/
|
|
4855
|
-
logger:
|
|
4912
|
+
logger: L,
|
|
4856
4913
|
/**
|
|
4857
4914
|
* 设置外部日志 reporter,便于对接埋点/观测
|
|
4858
4915
|
*/
|
|
4859
|
-
setLogReporter: (t) =>
|
|
4916
|
+
setLogReporter: (t) => L.setReporter(t),
|
|
4860
4917
|
/**
|
|
4861
4918
|
* 错误处理器
|
|
4862
4919
|
*/
|
|
@@ -4864,13 +4921,13 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4864
4921
|
/**
|
|
4865
4922
|
* 状态管理器
|
|
4866
4923
|
*/
|
|
4867
|
-
stateManager:
|
|
4924
|
+
stateManager: Y,
|
|
4868
4925
|
/**
|
|
4869
4926
|
* 启用调试模式
|
|
4870
4927
|
* @example
|
|
4871
4928
|
* qsh.debug.enableDevMode()
|
|
4872
4929
|
*/
|
|
4873
|
-
enableDevMode: () =>
|
|
4930
|
+
enableDevMode: () => L.enableDevMode(),
|
|
4874
4931
|
/**
|
|
4875
4932
|
* 获取日志历史
|
|
4876
4933
|
* @param {number} [count] - 获取条数
|
|
@@ -4878,7 +4935,7 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4878
4935
|
* @example
|
|
4879
4936
|
* console.log(qsh.debug.getLogs(10))
|
|
4880
4937
|
*/
|
|
4881
|
-
getLogs: (t) =>
|
|
4938
|
+
getLogs: (t) => L.getHistory(t),
|
|
4882
4939
|
/**
|
|
4883
4940
|
* 获取 SDK 统计信息
|
|
4884
4941
|
* @returns {Object} 统计信息
|
|
@@ -4886,12 +4943,12 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4886
4943
|
* console.log(qsh.debug.getStats())
|
|
4887
4944
|
*/
|
|
4888
4945
|
getStats: () => ({
|
|
4889
|
-
logger:
|
|
4890
|
-
state:
|
|
4891
|
-
weixinConfig:
|
|
4892
|
-
plugins:
|
|
4893
|
-
interceptors:
|
|
4894
|
-
store:
|
|
4946
|
+
logger: L.getStats(),
|
|
4947
|
+
state: Y.getStats(),
|
|
4948
|
+
weixinConfig: Le().getStats(),
|
|
4949
|
+
plugins: fe.getStats(),
|
|
4950
|
+
interceptors: H.getStats(),
|
|
4951
|
+
store: G.getStats()
|
|
4895
4952
|
}),
|
|
4896
4953
|
/**
|
|
4897
4954
|
* 获取微信配置管理器
|
|
@@ -4899,38 +4956,38 @@ const qi = E(Nt, { apiName: "shareMiniProgramCard" }), zi = E(ai, { apiName: "sh
|
|
|
4899
4956
|
* @example
|
|
4900
4957
|
* console.log(qsh.debug.getWeixinConfigManager().getStats())
|
|
4901
4958
|
*/
|
|
4902
|
-
getWeixinConfigManager:
|
|
4959
|
+
getWeixinConfigManager: Le,
|
|
4903
4960
|
/**
|
|
4904
4961
|
* 导出调试信息
|
|
4905
4962
|
* @returns {string} JSON 格式的调试信息
|
|
4906
4963
|
* @example
|
|
4907
4964
|
* console.log(qsh.debug.exportDebugInfo())
|
|
4908
4965
|
*/
|
|
4909
|
-
exportDebugInfo: () =>
|
|
4966
|
+
exportDebugInfo: () => L.exportToJSON()
|
|
4910
4967
|
}
|
|
4911
4968
|
};
|
|
4912
|
-
|
|
4913
|
-
navigateTo:
|
|
4914
|
-
navigateBack:
|
|
4915
|
-
switchTab:
|
|
4916
|
-
reLaunch:
|
|
4917
|
-
redirectTo:
|
|
4918
|
-
postMessage:
|
|
4919
|
-
getEnv:
|
|
4920
|
-
getCode:
|
|
4921
|
-
navigateToMiniProgram:
|
|
4922
|
-
chooseImage:
|
|
4923
|
-
scanCode:
|
|
4924
|
-
getLocation:
|
|
4925
|
-
openLocation:
|
|
4926
|
-
chooseLocation:
|
|
4969
|
+
Dt.isWeixinMiniProgram ? oe.webView = window.wx && window.wx.miniProgram : oe.webView = {
|
|
4970
|
+
navigateTo: Ut,
|
|
4971
|
+
navigateBack: Wt,
|
|
4972
|
+
switchTab: $t,
|
|
4973
|
+
reLaunch: Ft,
|
|
4974
|
+
redirectTo: Bt,
|
|
4975
|
+
postMessage: kt,
|
|
4976
|
+
getEnv: Gt,
|
|
4977
|
+
getCode: Fe,
|
|
4978
|
+
navigateToMiniProgram: Be,
|
|
4979
|
+
chooseImage: ke,
|
|
4980
|
+
scanCode: Ge,
|
|
4981
|
+
getLocation: Ke,
|
|
4982
|
+
openLocation: Ve,
|
|
4983
|
+
chooseLocation: qe
|
|
4927
4984
|
};
|
|
4928
|
-
const
|
|
4929
|
-
Object.keys(
|
|
4930
|
-
|
|
4985
|
+
const et = typeof window.uni != "undefined" ? window.uni : {};
|
|
4986
|
+
Object.keys(et).forEach((t) => {
|
|
4987
|
+
oe.hasOwnProperty(t) || (oe[t] = et[t]);
|
|
4931
4988
|
});
|
|
4932
|
-
typeof window != "undefined" && (window.qsh =
|
|
4989
|
+
typeof window != "undefined" && (window.qsh = oe);
|
|
4933
4990
|
export {
|
|
4934
|
-
|
|
4991
|
+
oe as default
|
|
4935
4992
|
};
|
|
4936
4993
|
//# sourceMappingURL=qsh-webview-sdk.es.js.map
|