qsh-webview-sdk 2.3.8 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -35
- package/dist/index.d.ts +26 -0
- package/dist/qsh-webview-sdk.es.js +914 -757
- package/dist/qsh-webview-sdk.es.js.map +1 -1
- package/dist/qsh-webview-sdk.umd.js +1 -1
- package/dist/qsh-webview-sdk.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var be = (t, e, r) => e in t ?
|
|
1
|
+
var zt = Object.defineProperty, Yt = Object.defineProperties;
|
|
2
|
+
var Xt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Je = Object.getOwnPropertySymbols;
|
|
4
|
+
var Zt = Object.prototype.hasOwnProperty, Qt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var be = (t, e, r) => e in t ? zt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, g = (t, e) => {
|
|
6
6
|
for (var r in e || (e = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var r of
|
|
10
|
-
|
|
7
|
+
Zt.call(e, r) && be(t, r, e[r]);
|
|
8
|
+
if (Je)
|
|
9
|
+
for (var r of Je(e))
|
|
10
|
+
Qt.call(e, r) && be(t, r, e[r]);
|
|
11
11
|
return t;
|
|
12
|
-
},
|
|
12
|
+
}, p = (t, e) => Yt(t, Xt(e));
|
|
13
13
|
var k = (t, e, r) => be(t, typeof e != "symbol" ? e + "" : e, r);
|
|
14
|
-
var
|
|
15
|
-
var s = (
|
|
14
|
+
var y = (t, e, r) => new Promise((n, i) => {
|
|
15
|
+
var s = (u) => {
|
|
16
16
|
try {
|
|
17
|
-
d(r.next(
|
|
18
|
-
} catch (
|
|
19
|
-
i(
|
|
17
|
+
d(r.next(u));
|
|
18
|
+
} catch (m) {
|
|
19
|
+
i(m);
|
|
20
20
|
}
|
|
21
|
-
}, o = (
|
|
21
|
+
}, o = (u) => {
|
|
22
22
|
try {
|
|
23
|
-
d(r.throw(
|
|
24
|
-
} catch (
|
|
25
|
-
i(
|
|
23
|
+
d(r.throw(u));
|
|
24
|
+
} catch (m) {
|
|
25
|
+
i(m);
|
|
26
26
|
}
|
|
27
|
-
}, d = (
|
|
27
|
+
}, d = (u) => u.done ? n(u.value) : Promise.resolve(u.value).then(s, o);
|
|
28
28
|
d((r = r.apply(t, e)).next());
|
|
29
29
|
});
|
|
30
|
-
function
|
|
30
|
+
function me() {
|
|
31
31
|
return typeof window != "undefined" ? window : void 0;
|
|
32
32
|
}
|
|
33
33
|
function De() {
|
|
34
34
|
return typeof navigator == "undefined" ? "" : navigator.userAgent || "";
|
|
35
35
|
}
|
|
36
36
|
function _() {
|
|
37
|
-
const t =
|
|
37
|
+
const t = me();
|
|
38
38
|
if (!t) return !1;
|
|
39
39
|
if (t.__wxjs_environment === "miniprogram" || t.wx && t.wx.miniProgram)
|
|
40
40
|
return !0;
|
|
41
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 Ce() {
|
|
45
|
+
const t = me();
|
|
46
46
|
return !!(t && t.plus);
|
|
47
47
|
}
|
|
48
48
|
function Re() {
|
|
49
|
-
const t =
|
|
49
|
+
const t = me();
|
|
50
50
|
return !!(t && (t.__dcloud_weex_postMessage || t.__dcloud_weex_));
|
|
51
51
|
}
|
|
52
52
|
function Oe() {
|
|
53
|
-
const t =
|
|
53
|
+
const t = me();
|
|
54
54
|
return !!(t && (t.__uniapp_x_postMessage || t.__uniapp_x_));
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function Se() {
|
|
57
57
|
const t = De();
|
|
58
58
|
return /uni-app/i.test(t);
|
|
59
59
|
}
|
|
@@ -62,10 +62,10 @@ function Ue() {
|
|
|
62
62
|
return /Html5Plus/i.test(t);
|
|
63
63
|
}
|
|
64
64
|
function tt() {
|
|
65
|
-
return
|
|
65
|
+
return Se() || Ue();
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
const t =
|
|
67
|
+
function Q() {
|
|
68
|
+
const t = me();
|
|
69
69
|
if (!t) return !1;
|
|
70
70
|
if (t.__offline_bridge_postMessage) return !0;
|
|
71
71
|
try {
|
|
@@ -75,24 +75,24 @@ function Z() {
|
|
|
75
75
|
}
|
|
76
76
|
return !1;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return Oe() ? "uvue" : Re() ? "nvue" : _() ? "weixin" :
|
|
78
|
+
function er() {
|
|
79
|
+
return Oe() ? "uvue" : Re() ? "nvue" : _() ? "weixin" : Q() ? "offline" : Ce() ? "plus" : tt() ? "webview" : Se() ? "UniApp" : "h5";
|
|
80
80
|
}
|
|
81
81
|
let Ee = null;
|
|
82
|
-
function
|
|
82
|
+
function H(t = !1) {
|
|
83
83
|
return Ee && !t || (Ee = {
|
|
84
84
|
isWeixinMiniProgram: _(),
|
|
85
|
-
isAppPlus:
|
|
85
|
+
isAppPlus: Ce(),
|
|
86
86
|
isNvue: Re(),
|
|
87
87
|
isUvue: Oe(),
|
|
88
|
-
isUniApp:
|
|
88
|
+
isUniApp: Se(),
|
|
89
89
|
isHtml5Plus: Ue(),
|
|
90
90
|
isUniAppWebView: tt(),
|
|
91
|
-
isOfflineWebview:
|
|
92
|
-
type:
|
|
91
|
+
isOfflineWebview: Q(),
|
|
92
|
+
type: er()
|
|
93
93
|
}), Ee;
|
|
94
94
|
}
|
|
95
|
-
const
|
|
95
|
+
const l = H(), 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",
|
|
@@ -125,28 +125,28 @@ class T extends Error {
|
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
const
|
|
128
|
+
const O = class O {
|
|
129
129
|
/**
|
|
130
130
|
* 设置调试模式
|
|
131
131
|
* @param {boolean} enabled - 是否启用调试模式
|
|
132
132
|
*/
|
|
133
133
|
static setDebugMode(e) {
|
|
134
|
-
|
|
134
|
+
O.isDebugMode = e;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
137
|
* 添加错误回调
|
|
138
138
|
* @param {Function} callback - 错误处理回调函数
|
|
139
139
|
*/
|
|
140
140
|
static addErrorCallback(e) {
|
|
141
|
-
typeof e == "function" &&
|
|
141
|
+
typeof e == "function" && O.errorCallbacks.push(e);
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* 移除错误回调
|
|
145
145
|
* @param {Function} callback - 要移除的回调函数
|
|
146
146
|
*/
|
|
147
147
|
static removeErrorCallback(e) {
|
|
148
|
-
const r =
|
|
149
|
-
r > -1 &&
|
|
148
|
+
const r = O.errorCallbacks.indexOf(e);
|
|
149
|
+
r > -1 && O.errorCallbacks.splice(r, 1);
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
152
152
|
* 处理 API 调用错误
|
|
@@ -165,7 +165,7 @@ const M = class M {
|
|
|
165
165
|
x.API_CALL_FAILED,
|
|
166
166
|
String(e),
|
|
167
167
|
r
|
|
168
|
-
),
|
|
168
|
+
), O.logError(n), O.notifyCallbacks(n), n;
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
171
|
* 处理平台不支持错误
|
|
@@ -179,7 +179,7 @@ const M = class M {
|
|
|
179
179
|
`API "${r}" is not supported on platform "${e}"`,
|
|
180
180
|
{ platformType: e, apiName: r }
|
|
181
181
|
);
|
|
182
|
-
return
|
|
182
|
+
return O.logError(n), O.notifyCallbacks(n), n;
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* 处理桥接未就绪错误
|
|
@@ -192,7 +192,7 @@ const M = class M {
|
|
|
192
192
|
`Bridge is not ready when calling "${e}"`,
|
|
193
193
|
{ apiName: e }
|
|
194
194
|
);
|
|
195
|
-
return
|
|
195
|
+
return O.logError(r), O.notifyCallbacks(r), r;
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
198
|
* 处理参数验证错误
|
|
@@ -208,7 +208,7 @@ const M = class M {
|
|
|
208
208
|
`Invalid parameter "${r}" in "${e}": expected ${n}, got ${typeof i}`,
|
|
209
209
|
{ apiName: e, paramName: r, expectedType: n, actualValue: i }
|
|
210
210
|
);
|
|
211
|
-
return
|
|
211
|
+
return O.logError(s), O.notifyCallbacks(s), s;
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
214
|
* 安全地包装函数执行,捕获并处理错误
|
|
@@ -220,7 +220,7 @@ const M = class M {
|
|
|
220
220
|
try {
|
|
221
221
|
return e();
|
|
222
222
|
} catch (n) {
|
|
223
|
-
return
|
|
223
|
+
return O.handleApiError(n, r);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
@@ -230,11 +230,11 @@ const M = class M {
|
|
|
230
230
|
* @returns {Promise} Promise 对象
|
|
231
231
|
*/
|
|
232
232
|
static safeExecuteAsync(n) {
|
|
233
|
-
return
|
|
233
|
+
return y(this, arguments, function* (e, r = {}) {
|
|
234
234
|
try {
|
|
235
235
|
return yield e();
|
|
236
236
|
} catch (i) {
|
|
237
|
-
return
|
|
237
|
+
return O.handleApiError(i, r);
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
240
|
}
|
|
@@ -246,7 +246,7 @@ const M = class M {
|
|
|
246
246
|
static logError(e) {
|
|
247
247
|
if (typeof console != "undefined") {
|
|
248
248
|
const r = `[QSH-SDK Error] ${e.type}: ${e.message}`;
|
|
249
|
-
|
|
249
|
+
O.isDebugMode ? console.error(r, {
|
|
250
250
|
context: e.context,
|
|
251
251
|
originalError: e.originalError,
|
|
252
252
|
stack: e.stack,
|
|
@@ -260,7 +260,7 @@ const M = class M {
|
|
|
260
260
|
* @private
|
|
261
261
|
*/
|
|
262
262
|
static notifyCallbacks(e) {
|
|
263
|
-
|
|
263
|
+
O.errorCallbacks.forEach((r) => {
|
|
264
264
|
try {
|
|
265
265
|
r(e);
|
|
266
266
|
} catch (n) {
|
|
@@ -277,20 +277,20 @@ const M = class M {
|
|
|
277
277
|
return function(r, n, i) {
|
|
278
278
|
const s = i.value;
|
|
279
279
|
return i.value = function(...o) {
|
|
280
|
-
return
|
|
280
|
+
return O.safeExecute(() => s.apply(this, o), p(g({}, e), { method: n, target: r.constructor.name }));
|
|
281
281
|
}, i;
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
|
-
k(
|
|
286
|
-
let
|
|
285
|
+
k(O, "isDebugMode", !1), k(O, "errorCallbacks", []);
|
|
286
|
+
let f = O;
|
|
287
287
|
const L = {
|
|
288
288
|
UNINITIALIZED: "uninitialized",
|
|
289
289
|
INITIALIZING: "initializing",
|
|
290
290
|
READY: "ready",
|
|
291
291
|
ERROR: "error"
|
|
292
292
|
};
|
|
293
|
-
class
|
|
293
|
+
class tr {
|
|
294
294
|
constructor() {
|
|
295
295
|
this.state = L.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 er {
|
|
|
344
344
|
* @returns {Promise<void>} 初始化 Promise
|
|
345
345
|
*/
|
|
346
346
|
startInitialization(e) {
|
|
347
|
-
return
|
|
347
|
+
return y(this, null, function* () {
|
|
348
348
|
if (this.state !== L.UNINITIALIZED)
|
|
349
349
|
return this.waitForReady();
|
|
350
350
|
this.state = L.INITIALIZING;
|
|
@@ -365,7 +365,7 @@ class er {
|
|
|
365
365
|
try {
|
|
366
366
|
e();
|
|
367
367
|
} catch (r) {
|
|
368
|
-
|
|
368
|
+
f.handleApiError(r, { context: "StateManager.handleBridgeReady" });
|
|
369
369
|
}
|
|
370
370
|
}), this.readyCallbacks = [], this.errorCallbacks = []);
|
|
371
371
|
}
|
|
@@ -379,7 +379,7 @@ class er {
|
|
|
379
379
|
try {
|
|
380
380
|
r(e);
|
|
381
381
|
} catch (n) {
|
|
382
|
-
|
|
382
|
+
f.handleApiError(n, { context: "StateManager.handleInitializationError" });
|
|
383
383
|
}
|
|
384
384
|
}), this.readyCallbacks = [], this.errorCallbacks = [];
|
|
385
385
|
}
|
|
@@ -423,7 +423,7 @@ class er {
|
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
const
|
|
426
|
+
const X = new tr(), rt = () => X.waitForReady(), rr = () => X.isReady(), nr = () => X.getState(), P = {
|
|
427
427
|
ERROR: 0,
|
|
428
428
|
WARN: 1,
|
|
429
429
|
INFO: 2,
|
|
@@ -491,7 +491,7 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
491
491
|
static log(e, r, n, ...i) {
|
|
492
492
|
if (!h.shouldLog(e, r))
|
|
493
493
|
return;
|
|
494
|
-
const s = (/* @__PURE__ */ new Date()).toISOString(), o = le[e], d = r ? `[${r}]` : "",
|
|
494
|
+
const s = (/* @__PURE__ */ new Date()).toISOString(), o = le[e], d = r ? `[${r}]` : "", u = `${h.prefix} ${d} ${n}`, m = {
|
|
495
495
|
timestamp: s,
|
|
496
496
|
level: e,
|
|
497
497
|
levelName: o,
|
|
@@ -499,12 +499,12 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
499
499
|
message: n,
|
|
500
500
|
args: i
|
|
501
501
|
};
|
|
502
|
-
if (h.addToHistory(
|
|
502
|
+
if (h.addToHistory(m), typeof h.reporter == "function")
|
|
503
503
|
try {
|
|
504
|
-
h.reporter(
|
|
505
|
-
} catch (
|
|
504
|
+
h.reporter(m);
|
|
505
|
+
} catch (C) {
|
|
506
506
|
}
|
|
507
|
-
h.outputToConsole(e,
|
|
507
|
+
h.outputToConsole(e, u, ...i);
|
|
508
508
|
}
|
|
509
509
|
/**
|
|
510
510
|
* 添加日志到历史记录
|
|
@@ -668,8 +668,8 @@ if (typeof window != "undefined") {
|
|
|
668
668
|
(t || e || r) && v.enableDevMode();
|
|
669
669
|
}
|
|
670
670
|
const A = v.createModuleLogger("Bridge"), I = v.createModuleLogger("Platform"), a = v.createModuleLogger("API"), D = v.createModuleLogger("State"), Ae = /complete|loaded|interactive/;
|
|
671
|
-
function
|
|
672
|
-
if (!
|
|
671
|
+
function ir(t) {
|
|
672
|
+
if (!Q()) return !1;
|
|
673
673
|
A.debug("检测到离线包环境,开始初始化");
|
|
674
674
|
const e = () => {
|
|
675
675
|
t();
|
|
@@ -686,31 +686,31 @@ function nr(t) {
|
|
|
686
686
|
}
|
|
687
687
|
return !0;
|
|
688
688
|
}
|
|
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
|
-
}
|
|
692
689
|
function ar(t) {
|
|
693
|
-
return window.
|
|
690
|
+
return Se() || 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;
|
|
694
691
|
}
|
|
695
692
|
function sr(t) {
|
|
696
|
-
return
|
|
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
|
+
}
|
|
695
|
+
function or(t) {
|
|
696
|
+
return A.info("开始初始化 JSBridge"), ir(t) ? (A.info("使用离线包环境初始化"), !0) : ar(t) ? (A.info("使用 APP 环境初始化"), !0) : sr(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 cr() {
|
|
699
|
+
return X.waitForReady();
|
|
700
700
|
}
|
|
701
701
|
function nt() {
|
|
702
|
-
return
|
|
702
|
+
return X.startInitialization(() => y(null, null, function* () {
|
|
703
703
|
return new Promise((t, e) => {
|
|
704
704
|
const r = () => {
|
|
705
705
|
t();
|
|
706
706
|
}, n = (i) => {
|
|
707
|
-
const s =
|
|
707
|
+
const s = f.handleApiError(i, {
|
|
708
708
|
context: "bridge initialization"
|
|
709
709
|
});
|
|
710
710
|
e(s);
|
|
711
711
|
};
|
|
712
712
|
try {
|
|
713
|
-
|
|
713
|
+
or(() => {
|
|
714
714
|
r();
|
|
715
715
|
});
|
|
716
716
|
} catch (i) {
|
|
@@ -719,7 +719,7 @@ function nt() {
|
|
|
719
719
|
});
|
|
720
720
|
}));
|
|
721
721
|
}
|
|
722
|
-
const
|
|
722
|
+
const N = {
|
|
723
723
|
UNINITIALIZED: "uninitialized",
|
|
724
724
|
CONFIGURING: "configuring",
|
|
725
725
|
CONFIGURED: "configured",
|
|
@@ -728,9 +728,9 @@ const S = {
|
|
|
728
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 ur {
|
|
732
732
|
constructor() {
|
|
733
|
-
this.state =
|
|
733
|
+
this.state = N.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, this.runtimeConfig = {
|
|
734
734
|
clientId: null,
|
|
735
735
|
isProd: !1
|
|
736
736
|
}, this.CONFIG_API_URL = this.getConfigApiUrl(this.runtimeConfig.isProd), this.DEFAULT_JS_API_LIST = ["chooseImage", "uploadImage", "previewImage", "downloadImage", "getLocalImgData", "scanQRCode", "getLocation", "openLocation", "updateAppMessageShareData", "updateTimelineShareData"], this.handleConfigSuccess = this.handleConfigSuccess.bind(this), this.handleConfigError = this.handleConfigError.bind(this);
|
|
@@ -757,10 +757,10 @@ class cr {
|
|
|
757
757
|
{ isProd: e.isProd }
|
|
758
758
|
);
|
|
759
759
|
const r = e.clientId.trim(), n = e.isProd === !0, i = r !== this.runtimeConfig.clientId || n !== this.runtimeConfig.isProd;
|
|
760
|
-
return this.runtimeConfig =
|
|
760
|
+
return this.runtimeConfig = p(g({}, this.runtimeConfig), {
|
|
761
761
|
clientId: r,
|
|
762
762
|
isProd: n
|
|
763
|
-
}), this.CONFIG_API_URL = this.getConfigApiUrl(n), (this.state ===
|
|
763
|
+
}), this.CONFIG_API_URL = this.getConfigApiUrl(n), (this.state === N.ERROR || i && (this.state === N.CONFIGURING || this.state === N.CONFIGURED)) && this.reset(), I.info("Updated Weixin runtime config", {
|
|
764
764
|
clientId: this.runtimeConfig.clientId,
|
|
765
765
|
isProd: this.runtimeConfig.isProd,
|
|
766
766
|
configApiUrl: this.CONFIG_API_URL
|
|
@@ -807,7 +807,7 @@ class cr {
|
|
|
807
807
|
* @private
|
|
808
808
|
*/
|
|
809
809
|
fetchWeixinConfig() {
|
|
810
|
-
return
|
|
810
|
+
return y(this, null, function* () {
|
|
811
811
|
const e = this.getCurrentPageUrl();
|
|
812
812
|
if (this.isTestMode())
|
|
813
813
|
return I.info("使用测试模式,返回模拟配置"), this.getMockConfig();
|
|
@@ -907,13 +907,13 @@ class cr {
|
|
|
907
907
|
* @private
|
|
908
908
|
*/
|
|
909
909
|
handleConfigSuccess() {
|
|
910
|
-
I.info("微信配置成功"), this.state =
|
|
910
|
+
I.info("微信配置成功"), this.state = N.CONFIGURED, this.lastError = null, this.configPromise = null;
|
|
911
911
|
const e = [...this.readyCallbacks];
|
|
912
912
|
this.readyCallbacks = [], this.errorCallbacks = [], e.forEach((r) => {
|
|
913
913
|
try {
|
|
914
914
|
r();
|
|
915
915
|
} catch (n) {
|
|
916
|
-
|
|
916
|
+
f.handleApiError(n, { context: "WeixinConfigManager.handleConfigSuccess" });
|
|
917
917
|
}
|
|
918
918
|
});
|
|
919
919
|
}
|
|
@@ -930,13 +930,13 @@ class cr {
|
|
|
930
930
|
r,
|
|
931
931
|
{ weixinErrorResponse: e }
|
|
932
932
|
);
|
|
933
|
-
this.state =
|
|
933
|
+
this.state = N.ERROR, this.lastError = n, this.configPromise = null;
|
|
934
934
|
const i = [...this.errorCallbacks];
|
|
935
935
|
this.readyCallbacks = [], this.errorCallbacks = [], i.forEach((s) => {
|
|
936
936
|
try {
|
|
937
937
|
s(n);
|
|
938
938
|
} catch (o) {
|
|
939
|
-
|
|
939
|
+
f.handleApiError(o, { context: "WeixinConfigManager.handleConfigError" });
|
|
940
940
|
}
|
|
941
941
|
});
|
|
942
942
|
}
|
|
@@ -945,8 +945,8 @@ class cr {
|
|
|
945
945
|
* @returns {Promise<void>} 配置完成的Promise
|
|
946
946
|
*/
|
|
947
947
|
autoConfig() {
|
|
948
|
-
return
|
|
949
|
-
return this.hasRequiredConfig() ? this.state ===
|
|
948
|
+
return y(this, null, function* () {
|
|
949
|
+
return this.hasRequiredConfig() ? this.state === N.CONFIGURED ? Promise.resolve() : this.state === N.ERROR ? Promise.reject(this.lastError) : this.configPromise ? this.configPromise : (this.state = N.CONFIGURING, this.configPromise = this.performAutoConfig(), this.configPromise) : (I.warn("clientId为空,等待qsh.config({ clientId })"), Promise.resolve());
|
|
950
950
|
});
|
|
951
951
|
}
|
|
952
952
|
/**
|
|
@@ -955,7 +955,7 @@ class cr {
|
|
|
955
955
|
* @private
|
|
956
956
|
*/
|
|
957
957
|
performAutoConfig() {
|
|
958
|
-
return
|
|
958
|
+
return y(this, null, function* () {
|
|
959
959
|
try {
|
|
960
960
|
if (typeof window == "undefined")
|
|
961
961
|
throw new Error("非浏览器环境无法执行微信配置");
|
|
@@ -963,25 +963,25 @@ class cr {
|
|
|
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) => {
|
|
966
|
-
if (this.state ===
|
|
966
|
+
if (this.state === N.CONFIGURED) {
|
|
967
967
|
r();
|
|
968
968
|
return;
|
|
969
969
|
}
|
|
970
|
-
if (this.state ===
|
|
970
|
+
if (this.state === N.ERROR) {
|
|
971
971
|
n(this.lastError);
|
|
972
972
|
return;
|
|
973
973
|
}
|
|
974
974
|
this.readyCallbacks.push(r), this.errorCallbacks.push(n);
|
|
975
975
|
});
|
|
976
976
|
} catch (e) {
|
|
977
|
-
const r = e instanceof T ? e :
|
|
978
|
-
this.state =
|
|
977
|
+
const r = e instanceof T ? e : f.handleApiError(e, { context: "WeixinConfigManager.performAutoConfig" });
|
|
978
|
+
this.state = N.ERROR, this.lastError = r, this.configPromise = null;
|
|
979
979
|
const n = [...this.errorCallbacks];
|
|
980
980
|
throw this.readyCallbacks = [], this.errorCallbacks = [], n.forEach((i) => {
|
|
981
981
|
try {
|
|
982
982
|
i(r);
|
|
983
983
|
} catch (s) {
|
|
984
|
-
|
|
984
|
+
f.handleApiError(s, { context: "WeixinConfigManager.performAutoConfig.errorCallback" });
|
|
985
985
|
}
|
|
986
986
|
}), r;
|
|
987
987
|
}
|
|
@@ -992,7 +992,7 @@ class cr {
|
|
|
992
992
|
* @returns {Promise<void>} 配置完成的Promise
|
|
993
993
|
*/
|
|
994
994
|
waitForReady() {
|
|
995
|
-
return this.state ===
|
|
995
|
+
return this.state === N.CONFIGURED ? Promise.resolve() : this.state === N.ERROR ? Promise.reject(this.lastError) : this.hasRequiredConfig() ? this.state === N.UNINITIALIZED ? this.autoConfig() : new Promise((e, r) => {
|
|
996
996
|
this.readyCallbacks.push(e), this.errorCallbacks.push(r);
|
|
997
997
|
}) : Promise.reject(this.createMissingClientIdError());
|
|
998
998
|
}
|
|
@@ -1001,7 +1001,7 @@ class cr {
|
|
|
1001
1001
|
* @returns {boolean} 是否已配置
|
|
1002
1002
|
*/
|
|
1003
1003
|
isReady() {
|
|
1004
|
-
return this.state ===
|
|
1004
|
+
return this.state === N.CONFIGURED;
|
|
1005
1005
|
}
|
|
1006
1006
|
/**
|
|
1007
1007
|
* 获取当前状态
|
|
@@ -1021,7 +1021,7 @@ class cr {
|
|
|
1021
1021
|
* 重置配置管理器(用于重试或测试)
|
|
1022
1022
|
*/
|
|
1023
1023
|
reset() {
|
|
1024
|
-
this.state =
|
|
1024
|
+
this.state = N.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, I.debug("微信配置管理器已重置");
|
|
1025
1025
|
}
|
|
1026
1026
|
/**
|
|
1027
1027
|
* 获取配置统计信息
|
|
@@ -1041,18 +1041,18 @@ class cr {
|
|
|
1041
1041
|
};
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
|
-
const b = new
|
|
1044
|
+
const b = new ur();
|
|
1045
1045
|
let ne = !1, ge = !1, U = null, Pe = !1;
|
|
1046
|
-
function
|
|
1046
|
+
function lr(t) {
|
|
1047
1047
|
return new Promise((e) => {
|
|
1048
1048
|
let r = !1, n = null;
|
|
1049
|
-
const i = (d) =>
|
|
1049
|
+
const i = (d) => y(null, null, function* () {
|
|
1050
1050
|
if (!r) {
|
|
1051
1051
|
if (r = !0, n && clearTimeout(n), ne = !1, ge = d, d)
|
|
1052
1052
|
try {
|
|
1053
1053
|
yield it();
|
|
1054
|
-
} catch (
|
|
1055
|
-
I.error("微信配置失败,将使用消息桥作为后备",
|
|
1054
|
+
} catch (u) {
|
|
1055
|
+
I.error("微信配置失败,将使用消息桥作为后备", u);
|
|
1056
1056
|
}
|
|
1057
1057
|
e();
|
|
1058
1058
|
}
|
|
@@ -1067,27 +1067,27 @@ function ur(t) {
|
|
|
1067
1067
|
});
|
|
1068
1068
|
}
|
|
1069
1069
|
function We() {
|
|
1070
|
-
return
|
|
1070
|
+
return y(this, arguments, function* (t = {}) {
|
|
1071
1071
|
const { force: e = !1, recoverFromError: r = !1 } = t;
|
|
1072
1072
|
if (yield at({ force: e }), !K())
|
|
1073
1073
|
throw new Error("微信 JS-SDK 未正确加载,无法执行配置");
|
|
1074
|
-
r &&
|
|
1074
|
+
r && dr();
|
|
1075
1075
|
});
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function fr(t = !1) {
|
|
1078
1078
|
if (typeof window == "undefined") return !1;
|
|
1079
1079
|
if (K())
|
|
1080
1080
|
return ge = !0, !1;
|
|
1081
|
-
if (ge ||
|
|
1081
|
+
if (ge || Q()) 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
|
|
1086
|
+
function dr() {
|
|
1087
1087
|
b.getState() === "error" && (b.reset(), Pe = !1);
|
|
1088
1088
|
}
|
|
1089
1089
|
function it() {
|
|
1090
|
-
return
|
|
1090
|
+
return y(this, null, function* () {
|
|
1091
1091
|
if (Pe)
|
|
1092
1092
|
return b.waitForReady();
|
|
1093
1093
|
Pe = !0, I.info("开始自动配置微信JS-SDK");
|
|
@@ -1105,14 +1105,14 @@ function at(t = {}) {
|
|
|
1105
1105
|
if (K())
|
|
1106
1106
|
return ge = !0, Promise.resolve();
|
|
1107
1107
|
const r = document.getElementById("weixin-jssdk");
|
|
1108
|
-
return r ? U || (ne = !0, U =
|
|
1108
|
+
return r ? U || (ne = !0, U = lr(r).finally(() => {
|
|
1109
1109
|
U = null;
|
|
1110
|
-
}), U) :
|
|
1110
|
+
}), U) : fr(e) ? U || (U = new Promise((n) => {
|
|
1111
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
|
|
1115
|
+
return y(this, null, function* () {
|
|
1116
1116
|
ge = !0, ne = !1, I.info("微信 JS-SDK 已自动加载");
|
|
1117
1117
|
try {
|
|
1118
1118
|
yield it();
|
|
@@ -1131,10 +1131,10 @@ function at(t = {}) {
|
|
|
1131
1131
|
U = null;
|
|
1132
1132
|
}), U) : Promise.resolve();
|
|
1133
1133
|
}
|
|
1134
|
-
function
|
|
1134
|
+
function z() {
|
|
1135
1135
|
return We({ force: !0, recoverFromError: !0 }).then(() => b.waitForReady());
|
|
1136
1136
|
}
|
|
1137
|
-
function
|
|
1137
|
+
function He(t = {}) {
|
|
1138
1138
|
const e = b.configure(t);
|
|
1139
1139
|
return typeof window == "undefined" || We({
|
|
1140
1140
|
force: !0,
|
|
@@ -1152,18 +1152,18 @@ function Je(t = {}) {
|
|
|
1152
1152
|
function ee() {
|
|
1153
1153
|
return b.isReady();
|
|
1154
1154
|
}
|
|
1155
|
-
function
|
|
1155
|
+
function gr() {
|
|
1156
1156
|
return b.getState();
|
|
1157
1157
|
}
|
|
1158
1158
|
function ve() {
|
|
1159
1159
|
return b;
|
|
1160
1160
|
}
|
|
1161
|
-
function
|
|
1162
|
-
return
|
|
1161
|
+
function hr() {
|
|
1162
|
+
return y(this, null, function* () {
|
|
1163
1163
|
return I.info("手动重试微信配置"), b.reset(), Pe = !1, yield We({ force: !0 }), b.waitForReady();
|
|
1164
1164
|
});
|
|
1165
1165
|
}
|
|
1166
|
-
class
|
|
1166
|
+
class mr {
|
|
1167
1167
|
constructor() {
|
|
1168
1168
|
this.plugins = /* @__PURE__ */ new Map(), this.installed = /* @__PURE__ */ new Set(), this.installOrder = [], a.debug("插件管理器已初始化");
|
|
1169
1169
|
}
|
|
@@ -1175,7 +1175,7 @@ class hr {
|
|
|
1175
1175
|
* pluginManager.register(imagePlugin)
|
|
1176
1176
|
*/
|
|
1177
1177
|
register(e) {
|
|
1178
|
-
return
|
|
1178
|
+
return f.safeExecute(() => {
|
|
1179
1179
|
this.validatePlugin(e);
|
|
1180
1180
|
const { name: r, version: n } = e;
|
|
1181
1181
|
if (this.plugins.has(r)) {
|
|
@@ -1215,8 +1215,8 @@ class hr {
|
|
|
1215
1215
|
* await pluginManager.install('image', qsh)
|
|
1216
1216
|
*/
|
|
1217
1217
|
install(e, r) {
|
|
1218
|
-
return
|
|
1219
|
-
return
|
|
1218
|
+
return y(this, null, function* () {
|
|
1219
|
+
return f.safeExecute(() => y(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 hr {
|
|
|
1245
1245
|
* await pluginManager.uninstall('image', qsh)
|
|
1246
1246
|
*/
|
|
1247
1247
|
uninstall(e, r) {
|
|
1248
|
-
return
|
|
1249
|
-
return
|
|
1248
|
+
return y(this, null, function* () {
|
|
1249
|
+
return f.safeExecute(() => y(this, null, function* () {
|
|
1250
1250
|
if (!this.installed.has(e)) {
|
|
1251
1251
|
a.debug(`插件 ${e} 未安装,跳过卸载`);
|
|
1252
1252
|
return;
|
|
@@ -1267,7 +1267,7 @@ class hr {
|
|
|
1267
1267
|
* @returns {Promise<void>}
|
|
1268
1268
|
*/
|
|
1269
1269
|
uninstallAll(e) {
|
|
1270
|
-
return
|
|
1270
|
+
return y(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 hr {
|
|
|
1294
1294
|
* await pluginManager.installAll(['image', 'location'], qsh)
|
|
1295
1295
|
*/
|
|
1296
1296
|
installAll(e, r) {
|
|
1297
|
-
return
|
|
1297
|
+
return y(this, null, function* () {
|
|
1298
1298
|
if (!Array.isArray(e))
|
|
1299
1299
|
throw new Error("names 必须是数组");
|
|
1300
1300
|
for (const n of e)
|
|
@@ -1356,7 +1356,7 @@ class hr {
|
|
|
1356
1356
|
this.plugins.clear(), this.installed.clear(), this.installOrder = [];
|
|
1357
1357
|
}
|
|
1358
1358
|
}
|
|
1359
|
-
const fe = new
|
|
1359
|
+
const fe = new mr();
|
|
1360
1360
|
class pr {
|
|
1361
1361
|
constructor() {
|
|
1362
1362
|
this.requestInterceptors = [], this.responseInterceptors = [], a.debug("拦截器链已初始化");
|
|
@@ -1416,7 +1416,7 @@ class pr {
|
|
|
1416
1416
|
* @private
|
|
1417
1417
|
*/
|
|
1418
1418
|
runRequest(e) {
|
|
1419
|
-
return
|
|
1419
|
+
return y(this, null, function* () {
|
|
1420
1420
|
let r = g({}, e);
|
|
1421
1421
|
for (const { fn: n } of this.requestInterceptors) {
|
|
1422
1422
|
if (r.abort) {
|
|
@@ -1442,7 +1442,7 @@ class pr {
|
|
|
1442
1442
|
* @private
|
|
1443
1443
|
*/
|
|
1444
1444
|
runResponse(e, r) {
|
|
1445
|
-
return
|
|
1445
|
+
return y(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 pr {
|
|
|
1471
1471
|
};
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
|
-
const
|
|
1474
|
+
const Y = new pr(), wr = {
|
|
1475
1475
|
/**
|
|
1476
1476
|
* 请求日志
|
|
1477
1477
|
*/
|
|
@@ -1526,19 +1526,19 @@ const H = new pr(), mr = {
|
|
|
1526
1526
|
q.metrics.clear();
|
|
1527
1527
|
}
|
|
1528
1528
|
};
|
|
1529
|
-
function
|
|
1529
|
+
function Er(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) => y(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 yr(t = {}) {
|
|
1542
1542
|
return {
|
|
1543
1543
|
request: (e) => {
|
|
1544
1544
|
const r = t[e.apiName];
|
|
@@ -1550,7 +1550,7 @@ function Er(t = {}) {
|
|
|
1550
1550
|
}
|
|
1551
1551
|
};
|
|
1552
1552
|
}
|
|
1553
|
-
class
|
|
1553
|
+
class Ir {
|
|
1554
1554
|
constructor() {
|
|
1555
1555
|
this.state = {
|
|
1556
1556
|
// SDK 状态
|
|
@@ -1562,12 +1562,12 @@ class yr {
|
|
|
1562
1562
|
},
|
|
1563
1563
|
// 平台信息
|
|
1564
1564
|
platform: {
|
|
1565
|
-
type:
|
|
1566
|
-
isWeixinMiniProgram:
|
|
1567
|
-
isAppPlus:
|
|
1568
|
-
isNvue:
|
|
1569
|
-
isUvue:
|
|
1570
|
-
isOfflineWebview:
|
|
1565
|
+
type: l.type,
|
|
1566
|
+
isWeixinMiniProgram: l.isWeixinMiniProgram,
|
|
1567
|
+
isAppPlus: l.isAppPlus,
|
|
1568
|
+
isNvue: l.isNvue,
|
|
1569
|
+
isUvue: l.isUvue,
|
|
1570
|
+
isOfflineWebview: l.isOfflineWebview,
|
|
1571
1571
|
features: {}
|
|
1572
1572
|
// 平台支持的特性
|
|
1573
1573
|
},
|
|
@@ -1617,7 +1617,7 @@ class yr {
|
|
|
1617
1617
|
* store.set('network.online', false)
|
|
1618
1618
|
*/
|
|
1619
1619
|
set(e, r) {
|
|
1620
|
-
const n = e.split("."), i = n.pop(), s = n.reduce((d,
|
|
1620
|
+
const n = e.split("."), i = n.pop(), s = n.reduce((d, u) => ((!d[u] || typeof d[u] != "object") && (d[u] = {}), d[u]), this.state), o = s[i];
|
|
1621
1621
|
o !== r && (s[i] = r, D.debug(`状态已更新: ${e}`, { oldValue: o, newValue: r }), this.notify(e, r, o));
|
|
1622
1622
|
}
|
|
1623
1623
|
/**
|
|
@@ -1686,14 +1686,14 @@ class yr {
|
|
|
1686
1686
|
});
|
|
1687
1687
|
const s = e.split(".");
|
|
1688
1688
|
for (let o = 1; o < s.length; o++) {
|
|
1689
|
-
const d = s.slice(0, o).join("."),
|
|
1690
|
-
if (
|
|
1691
|
-
const
|
|
1692
|
-
|
|
1689
|
+
const d = s.slice(0, o).join("."), u = this.listeners.get(d);
|
|
1690
|
+
if (u) {
|
|
1691
|
+
const m = this.get(d);
|
|
1692
|
+
u.forEach((C) => {
|
|
1693
1693
|
try {
|
|
1694
|
-
|
|
1695
|
-
} catch (
|
|
1696
|
-
D.error("父路径订阅者执行失败",
|
|
1694
|
+
C(m, void 0, d);
|
|
1695
|
+
} catch (M) {
|
|
1696
|
+
D.error("父路径订阅者执行失败", M);
|
|
1697
1697
|
}
|
|
1698
1698
|
});
|
|
1699
1699
|
}
|
|
@@ -1728,7 +1728,7 @@ class yr {
|
|
|
1728
1728
|
*/
|
|
1729
1729
|
setApiLoading(e, r = !0) {
|
|
1730
1730
|
const n = `api.${e}`, i = this.get(n) || {};
|
|
1731
|
-
this.set(n,
|
|
1731
|
+
this.set(n, p(g({}, i), {
|
|
1732
1732
|
loading: r,
|
|
1733
1733
|
lastCall: r ? Date.now() : i.lastCall
|
|
1734
1734
|
}));
|
|
@@ -1740,7 +1740,7 @@ class yr {
|
|
|
1740
1740
|
*/
|
|
1741
1741
|
setApiResult(e, r) {
|
|
1742
1742
|
const n = `api.${e}`, i = this.get(n) || {};
|
|
1743
|
-
this.set(n,
|
|
1743
|
+
this.set(n, p(g({}, i), {
|
|
1744
1744
|
loading: !1,
|
|
1745
1745
|
lastResult: r,
|
|
1746
1746
|
lastCallEnd: Date.now()
|
|
@@ -1795,7 +1795,7 @@ class yr {
|
|
|
1795
1795
|
};
|
|
1796
1796
|
}
|
|
1797
1797
|
}
|
|
1798
|
-
const G = new
|
|
1798
|
+
const G = new Ir(), c = {
|
|
1799
1799
|
// SDK 核心错误 (E_SDK_xxx)
|
|
1800
1800
|
SDK_NOT_READY: "E_SDK_001",
|
|
1801
1801
|
SDK_INIT_FAILED: "E_SDK_002",
|
|
@@ -1902,7 +1902,7 @@ const G = new yr(), c = {
|
|
|
1902
1902
|
// 配置问题
|
|
1903
1903
|
UNKNOWN: "unknown"
|
|
1904
1904
|
// 未知问题
|
|
1905
|
-
},
|
|
1905
|
+
}, Ar = {
|
|
1906
1906
|
// 图片相关
|
|
1907
1907
|
"IMAGE/USER_CANCEL": c.IMAGE_CANCELLED,
|
|
1908
1908
|
"IMAGE/PERMISSION_DENIED": c.IMAGE_NO_PERMISSION,
|
|
@@ -1910,7 +1910,7 @@ const G = new yr(), 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
|
+
}, ze = {
|
|
1914
1914
|
// 微信平台错误模式
|
|
1915
1915
|
weixin: {
|
|
1916
1916
|
patterns: [
|
|
@@ -1961,10 +1961,10 @@ const G = new yr(), c = {
|
|
|
1961
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 Pr(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
|
|
1967
|
+
function _r(t) {
|
|
1968
1968
|
return t.includes("CANCEL") || st(t) === W.USER_CANCEL;
|
|
1969
1969
|
}
|
|
1970
1970
|
function ie(t) {
|
|
@@ -1978,7 +1978,7 @@ class V 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 || ie(e), this.platform = n.platform ||
|
|
1981
|
+
super(r), this.name = "StandardError", this.code = e, this.message = r || ie(e), this.platform = n.platform || l.type, this.apiName = n.apiName, this.category = n.category || st(e), this.retriable = n.retriable !== void 0 ? n.retriable : Pr(e), this.originalError = n.originalError, this.details = n.details || {}, this.timestamp = Date.now();
|
|
1982
1982
|
}
|
|
1983
1983
|
/**
|
|
1984
1984
|
* 是否可重试
|
|
@@ -1992,7 +1992,7 @@ class V extends Error {
|
|
|
1992
1992
|
* @returns {boolean}
|
|
1993
1993
|
*/
|
|
1994
1994
|
isUserAction() {
|
|
1995
|
-
return
|
|
1995
|
+
return _r(this.code);
|
|
1996
1996
|
}
|
|
1997
1997
|
/**
|
|
1998
1998
|
* 转为普通对象
|
|
@@ -2016,8 +2016,8 @@ class V extends Error {
|
|
|
2016
2016
|
function ot(t, e = {}) {
|
|
2017
2017
|
if (t instanceof V)
|
|
2018
2018
|
return t;
|
|
2019
|
-
const { apiName: r, platform: n =
|
|
2020
|
-
return t && typeof t.code == "string" && t.code.includes("/") ?
|
|
2019
|
+
const { apiName: r, platform: n = l.type } = e;
|
|
2020
|
+
return t && typeof t.code == "string" && t.code.includes("/") ? Mr(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 }
|
|
@@ -2032,8 +2032,8 @@ function ot(t, e = {}) {
|
|
|
2032
2032
|
}
|
|
2033
2033
|
);
|
|
2034
2034
|
}
|
|
2035
|
-
function
|
|
2036
|
-
const { apiName: r, platform: n } = e, i = t.code, s =
|
|
2035
|
+
function Mr(t, e) {
|
|
2036
|
+
const { apiName: r, platform: n } = e, i = t.code, s = Ar[i] || c.UNKNOWN_ERROR;
|
|
2037
2037
|
return a.debug("转换旧版错误码", {
|
|
2038
2038
|
legacy: i,
|
|
2039
2039
|
new: s
|
|
@@ -2055,18 +2055,18 @@ function Cr(t, e) {
|
|
|
2055
2055
|
const { apiName: r, platform: n } = e, i = (t.errMsg || t.message || "").toLowerCase();
|
|
2056
2056
|
if (r && Ye[r]) {
|
|
2057
2057
|
const d = Ye[r];
|
|
2058
|
-
for (const [
|
|
2059
|
-
if (i.includes(
|
|
2060
|
-
return new V(
|
|
2058
|
+
for (const [u, m] of Object.entries(d))
|
|
2059
|
+
if (i.includes(u.toLowerCase()))
|
|
2060
|
+
return new V(m, ie(m), {
|
|
2061
2061
|
apiName: r,
|
|
2062
2062
|
platform: n,
|
|
2063
2063
|
originalError: t
|
|
2064
2064
|
});
|
|
2065
2065
|
}
|
|
2066
|
-
const s =
|
|
2067
|
-
for (const { pattern: d, code:
|
|
2066
|
+
const s = ze[n] || ze.uniapp;
|
|
2067
|
+
for (const { pattern: d, code: u } of s.patterns)
|
|
2068
2068
|
if (d.test(i))
|
|
2069
|
-
return new V(
|
|
2069
|
+
return new V(u, ie(u), {
|
|
2070
2070
|
apiName: r,
|
|
2071
2071
|
platform: n,
|
|
2072
2072
|
originalError: t
|
|
@@ -2093,7 +2093,7 @@ const ct = {
|
|
|
2093
2093
|
if (!t.success && t.error) {
|
|
2094
2094
|
const r = ot(t.error, {
|
|
2095
2095
|
apiName: e.apiName,
|
|
2096
|
-
platform:
|
|
2096
|
+
platform: l.type
|
|
2097
2097
|
});
|
|
2098
2098
|
t.error = r.toJSON(), t.errorCode = r.code, t.errorCategory = r.category, t.retriable = r.isRetriable(), a.debug("错误已标准化", {
|
|
2099
2099
|
api: e.apiName,
|
|
@@ -2104,25 +2104,25 @@ const ct = {
|
|
|
2104
2104
|
return t;
|
|
2105
2105
|
}
|
|
2106
2106
|
};
|
|
2107
|
-
function
|
|
2107
|
+
function Rr(t, e = {}) {
|
|
2108
2108
|
return new V(t, ie(t), e);
|
|
2109
2109
|
}
|
|
2110
|
-
function
|
|
2110
|
+
function Or(t) {
|
|
2111
2111
|
return t instanceof V;
|
|
2112
2112
|
}
|
|
2113
|
-
function
|
|
2113
|
+
function Sr(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
2119
|
function Nr() {
|
|
2120
|
-
return
|
|
2120
|
+
return y(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 Sr(() => 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);
|
|
@@ -2147,7 +2147,7 @@ class ut {
|
|
|
2147
2147
|
*/
|
|
2148
2148
|
processNavigationOptions(e = {}) {
|
|
2149
2149
|
const { url: r, delta: n = 1 } = e, i = r && encodeURI(r), s = parseInt(n) || 1;
|
|
2150
|
-
return
|
|
2150
|
+
return p(g({}, e), {
|
|
2151
2151
|
url: i,
|
|
2152
2152
|
delta: s
|
|
2153
2153
|
});
|
|
@@ -2259,7 +2259,7 @@ class ut {
|
|
|
2259
2259
|
}
|
|
2260
2260
|
}
|
|
2261
2261
|
let de = [];
|
|
2262
|
-
function
|
|
2262
|
+
function Tr() {
|
|
2263
2263
|
if (de.length === 0 && window.plus) {
|
|
2264
2264
|
const t = plus.webview.currentWebview();
|
|
2265
2265
|
if (!t)
|
|
@@ -2269,7 +2269,7 @@ function Sr() {
|
|
|
2269
2269
|
}
|
|
2270
2270
|
return de;
|
|
2271
2271
|
}
|
|
2272
|
-
function
|
|
2272
|
+
function br(t, e) {
|
|
2273
2273
|
const r = {
|
|
2274
2274
|
options: {
|
|
2275
2275
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2290,7 +2290,7 @@ function Tr(t, e) {
|
|
|
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 vr(t, e) {
|
|
2294
2294
|
const r = {
|
|
2295
2295
|
options: {
|
|
2296
2296
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2311,14 +2311,14 @@ function br(t, e) {
|
|
|
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 = Tr();
|
|
2322
2322
|
if (plus.webview.getWebviewById("__uniapp__service"))
|
|
2323
2323
|
plus.webview.postMessageToUniNView({
|
|
2324
2324
|
type: "WEB_INVOKE_APPSERVICE",
|
|
@@ -2334,7 +2334,7 @@ function vr(t, e) {
|
|
|
2334
2334
|
);
|
|
2335
2335
|
}
|
|
2336
2336
|
}
|
|
2337
|
-
function
|
|
2337
|
+
function xr(t, e) {
|
|
2338
2338
|
const r = {
|
|
2339
2339
|
options: {
|
|
2340
2340
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2348,10 +2348,10 @@ function Lr(t, e) {
|
|
|
2348
2348
|
pageId: ""
|
|
2349
2349
|
}, "*");
|
|
2350
2350
|
}
|
|
2351
|
-
function
|
|
2351
|
+
function Dr(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 Ur(t, e) {
|
|
2355
2355
|
const r = {
|
|
2356
2356
|
options: {
|
|
2357
2357
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2359,7 +2359,7 @@ function Dr(t, e) {
|
|
|
2359
2359
|
name: t,
|
|
2360
2360
|
arg: e
|
|
2361
2361
|
};
|
|
2362
|
-
if (t === "postMessage" &&
|
|
2362
|
+
if (t === "postMessage" && Dr(e))
|
|
2363
2363
|
return window.__offline_bridge_postMessage(e);
|
|
2364
2364
|
window.__offline_bridge_postMessage({
|
|
2365
2365
|
type: "WEB_INVOKE_APPSERVICE",
|
|
@@ -2368,7 +2368,7 @@ function Dr(t, e) {
|
|
|
2368
2368
|
});
|
|
2369
2369
|
}
|
|
2370
2370
|
function he(t, e) {
|
|
2371
|
-
Oe() ?
|
|
2371
|
+
Oe() ? br(t, e) : Re() ? vr(t, e) : Q() ? Ur(t, e) : Ce() ? Lr(t, e) : xr(t, e);
|
|
2372
2372
|
}
|
|
2373
2373
|
class lt extends ut {
|
|
2374
2374
|
constructor() {
|
|
@@ -2389,7 +2389,7 @@ class lt extends ut {
|
|
|
2389
2389
|
* @returns {void}
|
|
2390
2390
|
*/
|
|
2391
2391
|
performNavigation(e, r) {
|
|
2392
|
-
return
|
|
2392
|
+
return f.safeExecute(() => {
|
|
2393
2393
|
const { url: n, delta: i } = r;
|
|
2394
2394
|
if (I.debug(`微信平台执行导航操作: ${e}`, r), this.isWeixinApiAvailable()) {
|
|
2395
2395
|
const o = window.wx.miniProgram[e];
|
|
@@ -2413,7 +2413,7 @@ class lt extends ut {
|
|
|
2413
2413
|
* @returns {void}
|
|
2414
2414
|
*/
|
|
2415
2415
|
performPostMessage(e) {
|
|
2416
|
-
return
|
|
2416
|
+
return f.safeExecute(() => {
|
|
2417
2417
|
const { data: r } = e;
|
|
2418
2418
|
if (this.isWeixinApiAvailable())
|
|
2419
2419
|
return window.wx.miniProgram.postMessage({ data: r });
|
|
@@ -2430,7 +2430,7 @@ class lt extends ut {
|
|
|
2430
2430
|
* @returns {void}
|
|
2431
2431
|
*/
|
|
2432
2432
|
performGetEnv(e) {
|
|
2433
|
-
return
|
|
2433
|
+
return f.safeExecute(() => {
|
|
2434
2434
|
if (!e || typeof e != "function")
|
|
2435
2435
|
throw new Error("Callback function is required for getEnv");
|
|
2436
2436
|
if (this.isWeixinApiAvailable() && window.wx.miniProgram.getEnv)
|
|
@@ -2445,17 +2445,17 @@ class lt extends ut {
|
|
|
2445
2445
|
});
|
|
2446
2446
|
}
|
|
2447
2447
|
}
|
|
2448
|
-
const te = new lt(),
|
|
2448
|
+
const te = new lt(), Wr = (t) => te.navigateTo(t), $r = (t) => te.navigateBack(t), Fr = (t) => te.switchTab(t), Br = (t) => te.reLaunch(t), kr = (t) => te.redirectTo(t), Gr = (t) => te.postMessage(t), Kr = (t) => te.getEnv(t);
|
|
2449
2449
|
var ft = /* @__PURE__ */ Object.freeze({
|
|
2450
2450
|
__proto__: null,
|
|
2451
2451
|
WeixinPlatform: lt,
|
|
2452
|
-
getEnv:
|
|
2453
|
-
navigateBack:
|
|
2454
|
-
navigateTo:
|
|
2455
|
-
postMessage:
|
|
2456
|
-
reLaunch:
|
|
2457
|
-
redirectTo:
|
|
2458
|
-
switchTab:
|
|
2452
|
+
getEnv: Kr,
|
|
2453
|
+
navigateBack: $r,
|
|
2454
|
+
navigateTo: Wr,
|
|
2455
|
+
postMessage: Gr,
|
|
2456
|
+
reLaunch: Br,
|
|
2457
|
+
redirectTo: kr,
|
|
2458
|
+
switchTab: Fr
|
|
2459
2459
|
});
|
|
2460
2460
|
class dt extends ut {
|
|
2461
2461
|
constructor() {
|
|
@@ -2468,7 +2468,7 @@ class dt extends ut {
|
|
|
2468
2468
|
* @returns {void}
|
|
2469
2469
|
*/
|
|
2470
2470
|
performNavigation(e, r) {
|
|
2471
|
-
return
|
|
2471
|
+
return f.safeExecute(() => {
|
|
2472
2472
|
const { url: n, delta: i } = r;
|
|
2473
2473
|
he(e, e === "navigateBack" ? { delta: i } : { url: n });
|
|
2474
2474
|
}, {
|
|
@@ -2484,7 +2484,7 @@ class dt extends ut {
|
|
|
2484
2484
|
* @returns {void}
|
|
2485
2485
|
*/
|
|
2486
2486
|
performPostMessage(e) {
|
|
2487
|
-
return
|
|
2487
|
+
return f.safeExecute(() => {
|
|
2488
2488
|
const { data: r } = e;
|
|
2489
2489
|
he("postMessage", r);
|
|
2490
2490
|
}, {
|
|
@@ -2499,64 +2499,64 @@ class dt extends ut {
|
|
|
2499
2499
|
* @returns {void}
|
|
2500
2500
|
*/
|
|
2501
2501
|
performGetEnv(e) {
|
|
2502
|
-
return
|
|
2502
|
+
return f.safeExecute(() => {
|
|
2503
2503
|
if (!e || typeof e != "function")
|
|
2504
2504
|
throw new Error("Callback function is required for getEnv");
|
|
2505
2505
|
const r = {};
|
|
2506
2506
|
let n = !1;
|
|
2507
|
-
Oe() ? (r.uvue = !0, n = !0) : Re() ? (r.nvue = !0, n = !0) :
|
|
2507
|
+
Oe() ? (r.uvue = !0, n = !0) : Re() ? (r.nvue = !0, n = !0) : Ce() ? (r.plus = !0, n = !0) : Q() && (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 re = new dt(),
|
|
2514
|
+
const re = new dt(), Vr = (t) => re.navigateTo(t), qr = (t) => re.navigateBack(t), jr = (t) => re.switchTab(t), Jr = (t) => re.reLaunch(t), Hr = (t) => re.redirectTo(t), zr = (t) => re.postMessage(t), Yr = (t) => re.getEnv(t);
|
|
2515
2515
|
var gt = /* @__PURE__ */ Object.freeze({
|
|
2516
2516
|
__proto__: null,
|
|
2517
2517
|
AppPlatform: dt,
|
|
2518
|
-
getEnv:
|
|
2519
|
-
navigateBack:
|
|
2520
|
-
navigateTo:
|
|
2521
|
-
postMessage:
|
|
2522
|
-
reLaunch:
|
|
2523
|
-
redirectTo:
|
|
2524
|
-
switchTab:
|
|
2518
|
+
getEnv: Yr,
|
|
2519
|
+
navigateBack: qr,
|
|
2520
|
+
navigateTo: Vr,
|
|
2521
|
+
postMessage: zr,
|
|
2522
|
+
reLaunch: Jr,
|
|
2523
|
+
redirectTo: Hr,
|
|
2524
|
+
switchTab: jr
|
|
2525
2525
|
});
|
|
2526
|
-
function
|
|
2526
|
+
function pe() {
|
|
2527
2527
|
return _() ? ft : gt;
|
|
2528
2528
|
}
|
|
2529
|
-
function Yr(t) {
|
|
2530
|
-
return me().navigateTo(t);
|
|
2531
|
-
}
|
|
2532
2529
|
function Xr(t) {
|
|
2533
|
-
return
|
|
2530
|
+
return pe().navigateTo(t);
|
|
2534
2531
|
}
|
|
2535
2532
|
function Zr(t) {
|
|
2536
|
-
return
|
|
2533
|
+
return pe().navigateBack(t);
|
|
2537
2534
|
}
|
|
2538
2535
|
function Qr(t) {
|
|
2539
|
-
return
|
|
2536
|
+
return pe().switchTab(t);
|
|
2540
2537
|
}
|
|
2541
2538
|
function en(t) {
|
|
2542
|
-
return
|
|
2539
|
+
return pe().reLaunch(t);
|
|
2540
|
+
}
|
|
2541
|
+
function tn(t) {
|
|
2542
|
+
return pe().redirectTo(t);
|
|
2543
2543
|
}
|
|
2544
2544
|
function ht() {
|
|
2545
2545
|
return _() ? ft : gt;
|
|
2546
2546
|
}
|
|
2547
|
-
function
|
|
2547
|
+
function rn(t = {}) {
|
|
2548
2548
|
return ht().postMessage(t);
|
|
2549
2549
|
}
|
|
2550
|
-
function
|
|
2550
|
+
function nn(t) {
|
|
2551
2551
|
return ht().getEnv(t);
|
|
2552
2552
|
}
|
|
2553
|
-
function
|
|
2553
|
+
function an(t) {
|
|
2554
2554
|
return t && typeof t == "object" && t.__v_raw ? t.__v_raw : t;
|
|
2555
2555
|
}
|
|
2556
|
-
function
|
|
2556
|
+
function sn() {
|
|
2557
2557
|
return "qsh_callback_" + Date.now() + "_" + Math.random().toString(36).substring(2, 9);
|
|
2558
2558
|
}
|
|
2559
|
-
class
|
|
2559
|
+
class on {
|
|
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,15 +2568,15 @@ class sn {
|
|
|
2568
2568
|
* @returns {void}
|
|
2569
2569
|
*/
|
|
2570
2570
|
callApi(i) {
|
|
2571
|
-
return
|
|
2572
|
-
return
|
|
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_ && !
|
|
2575
|
-
const
|
|
2571
|
+
return y(this, arguments, function* (e, r = {}, n = {}) {
|
|
2572
|
+
return f.safeExecute(() => y(this, null, function* () {
|
|
2573
|
+
var m;
|
|
2574
|
+
if (typeof window != "undefined" && window === window.parent && !window.plus && !window.__uniapp_x_postMessage && !window.__uniapp_x_ && !window.__dcloud_weex_postMessage && !window.__dcloud_weex_ && !Q()) {
|
|
2575
|
+
const C = new T(
|
|
2576
2576
|
x.PLATFORM_NOT_SUPPORTED,
|
|
2577
2577
|
"当前不在宿主 WebView 容器中,无法发送消息"
|
|
2578
2578
|
);
|
|
2579
|
-
n && typeof n.fail == "function" && n.fail({ errMsg:
|
|
2579
|
+
n && typeof n.fail == "function" && n.fail({ errMsg: C.message, code: "NOT_IN_CONTAINER" }), n && typeof n.complete == "function" && n.complete({ success: !1, error: { errMsg: C.message } });
|
|
2580
2580
|
return;
|
|
2581
2581
|
}
|
|
2582
2582
|
const o = {
|
|
@@ -2588,49 +2588,49 @@ class sn {
|
|
|
2588
2588
|
metadata: {}
|
|
2589
2589
|
};
|
|
2590
2590
|
G.setApiLoading(e, !0);
|
|
2591
|
-
const d = yield
|
|
2591
|
+
const d = yield Y.runRequest(o);
|
|
2592
2592
|
if (d.abort) {
|
|
2593
2593
|
A.warn("API 调用被拦截器中止", { api: e }), G.setApiLoading(e, !1), n.fail && n.fail({
|
|
2594
|
-
errMsg: ((
|
|
2594
|
+
errMsg: ((m = d.error) == null ? void 0 : m.message) || "API 调用被中止",
|
|
2595
2595
|
code: "INTERCEPTED"
|
|
2596
2596
|
}), n.complete && n.complete({ success: !1 });
|
|
2597
2597
|
return;
|
|
2598
2598
|
}
|
|
2599
|
-
const
|
|
2599
|
+
const u = sn();
|
|
2600
2600
|
if (n.success || n.fail || n.complete) {
|
|
2601
|
-
if (this.callbacks.set(
|
|
2601
|
+
if (this.callbacks.set(u, p(g({}, n), {
|
|
2602
2602
|
context: d
|
|
2603
2603
|
// 保存上下文用于响应拦截
|
|
2604
|
-
})), window.qshWebviewCallbacks[
|
|
2605
|
-
this.handleCallback(
|
|
2606
|
-
}, r.isPersistent && (this.persistentCallbacksByApi.has(e) || this.persistentCallbacksByApi.set(e, /* @__PURE__ */ new Set()), this.persistentCallbacksByApi.get(e).add(
|
|
2604
|
+
})), window.qshWebviewCallbacks[u] = ($) => {
|
|
2605
|
+
this.handleCallback(u, $);
|
|
2606
|
+
}, r.isPersistent && (this.persistentCallbacksByApi.has(e) || this.persistentCallbacksByApi.set(e, /* @__PURE__ */ new Set()), this.persistentCallbacksByApi.get(e).add(u)), r.isPersistent || r.disableTimeout)
|
|
2607
2607
|
A.info(`API ${e} 禁用超时清理,将等待回调返回后清理`, {
|
|
2608
|
-
callbackId:
|
|
2608
|
+
callbackId: u,
|
|
2609
2609
|
isPersistent: r.isPersistent,
|
|
2610
2610
|
disableTimeout: r.disableTimeout
|
|
2611
2611
|
});
|
|
2612
2612
|
else {
|
|
2613
2613
|
const $ = setTimeout(() => {
|
|
2614
|
-
A.warn("API 调用超时,自动清理回调", { api: e, callbackId:
|
|
2614
|
+
A.warn("API 调用超时,自动清理回调", { api: e, callbackId: u }), n.fail && n.fail({
|
|
2615
2615
|
errMsg: `API ${e} 调用超时`,
|
|
2616
2616
|
code: "TIMEOUT"
|
|
2617
|
-
}), this.cleanupCallback(
|
|
2617
|
+
}), this.cleanupCallback(u);
|
|
2618
2618
|
}, r.timeout || this.defaultTimeout);
|
|
2619
|
-
this.timeouts.set(
|
|
2619
|
+
this.timeouts.set(u, $);
|
|
2620
2620
|
}
|
|
2621
|
-
const
|
|
2621
|
+
const M = {
|
|
2622
2622
|
type: "qsh_api_call",
|
|
2623
2623
|
api: e,
|
|
2624
2624
|
params: d.params,
|
|
2625
|
-
callbackId:
|
|
2625
|
+
callbackId: u,
|
|
2626
2626
|
timestamp: Date.now()
|
|
2627
2627
|
};
|
|
2628
2628
|
A.info("发送 API 调用消息", {
|
|
2629
2629
|
api: e,
|
|
2630
|
-
callbackId:
|
|
2630
|
+
callbackId: u,
|
|
2631
2631
|
hasSuccess: !!n.success,
|
|
2632
2632
|
hasFail: !!n.fail
|
|
2633
|
-
}), console.log("message:", JSON.stringify(
|
|
2633
|
+
}), console.log("message:", JSON.stringify(an(M), null, 2)), he("postMessage", M);
|
|
2634
2634
|
}
|
|
2635
2635
|
}), {
|
|
2636
2636
|
context: "WebViewBridge.callApi",
|
|
@@ -2645,9 +2645,9 @@ class sn {
|
|
|
2645
2645
|
* @private
|
|
2646
2646
|
*/
|
|
2647
2647
|
handleCallback(e, r) {
|
|
2648
|
-
return
|
|
2649
|
-
return
|
|
2650
|
-
var
|
|
2648
|
+
return y(this, null, function* () {
|
|
2649
|
+
return f.safeExecute(() => y(this, null, function* () {
|
|
2650
|
+
var C, M;
|
|
2651
2651
|
const n = this.callbacks.get(e);
|
|
2652
2652
|
if (!n) {
|
|
2653
2653
|
A.warn("未找到回调函数", { callbackId: e });
|
|
@@ -2655,8 +2655,8 @@ class sn {
|
|
|
2655
2655
|
}
|
|
2656
2656
|
const { success: i, fail: s, complete: o, context: d } = n;
|
|
2657
2657
|
A.debug("处理回调", { callbackId: e, result: r });
|
|
2658
|
-
const
|
|
2659
|
-
d && G.setApiResult(d.apiName,
|
|
2658
|
+
const u = yield Y.runResponse(r, d);
|
|
2659
|
+
d && G.setApiResult(d.apiName, u), u.success && i ? i(u.data) : !u.success && s && s(u.error || { errMsg: "操作失败" }), o && o(u), ((M = (C = n.context) == null ? void 0 : C.params) == null ? void 0 : M.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 sn {
|
|
|
2709
2709
|
};
|
|
2710
2710
|
}
|
|
2711
2711
|
}
|
|
2712
|
-
const
|
|
2713
|
-
function
|
|
2714
|
-
return
|
|
2712
|
+
const mt = new on(), S = (t, e, r) => mt.callApi(t, e, r), ae = (t) => mt.cleanupPersistentCallbacksByApi(t);
|
|
2713
|
+
function pt() {
|
|
2714
|
+
return H(!0);
|
|
2715
2715
|
}
|
|
2716
|
-
function
|
|
2716
|
+
function cn(t) {
|
|
2717
2717
|
return t === "offline";
|
|
2718
2718
|
}
|
|
2719
|
-
function
|
|
2720
|
-
return
|
|
2719
|
+
function un(t = {}) {
|
|
2720
|
+
return f.safeExecute(() => {
|
|
2721
2721
|
a.debug("Call getCode through offline webview bridge", {
|
|
2722
2722
|
clientId: t.clientId
|
|
2723
|
-
}),
|
|
2723
|
+
}), S(
|
|
2724
2724
|
"getCode",
|
|
2725
2725
|
{
|
|
2726
2726
|
clientId: t.clientId
|
|
@@ -2739,13 +2739,13 @@ function cn(t = {}) {
|
|
|
2739
2739
|
);
|
|
2740
2740
|
}, {
|
|
2741
2741
|
context: "getCodeInHost",
|
|
2742
|
-
platform:
|
|
2742
|
+
platform: pt().type
|
|
2743
2743
|
});
|
|
2744
2744
|
}
|
|
2745
|
-
function
|
|
2746
|
-
return
|
|
2745
|
+
function ln(t = {}) {
|
|
2746
|
+
return f.safeExecute(() => {
|
|
2747
2747
|
var n, i;
|
|
2748
|
-
const e =
|
|
2748
|
+
const e = pt(), 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 un(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 (!cn(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 un(t = {}) {
|
|
|
2764
2764
|
}), (i = t.fail) == null || i.call(t, s);
|
|
2765
2765
|
return;
|
|
2766
2766
|
}
|
|
2767
|
-
|
|
2767
|
+
un(p(g({}, t), {
|
|
2768
2768
|
clientId: r
|
|
2769
2769
|
}));
|
|
2770
2770
|
}, {
|
|
@@ -2773,10 +2773,10 @@ function un(t = {}) {
|
|
|
2773
2773
|
});
|
|
2774
2774
|
}
|
|
2775
2775
|
function wt() {
|
|
2776
|
-
return
|
|
2776
|
+
return H(!0);
|
|
2777
2777
|
}
|
|
2778
2778
|
const Xe = ["release", "trial", "develop"];
|
|
2779
|
-
function
|
|
2779
|
+
function fn(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 {
|
|
@@ -2793,19 +2793,19 @@ function ln(t = {}) {
|
|
|
2793
2793
|
errMsg: `env must be one of ${Xe.join("/")}`,
|
|
2794
2794
|
code: "PARAM_INVALID"
|
|
2795
2795
|
};
|
|
2796
|
-
return
|
|
2796
|
+
return p(g({}, t), {
|
|
2797
2797
|
appid: e,
|
|
2798
2798
|
path: r.trim(),
|
|
2799
2799
|
env: i
|
|
2800
2800
|
});
|
|
2801
2801
|
}
|
|
2802
|
-
function
|
|
2802
|
+
function dn() {
|
|
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
|
|
2806
|
-
return
|
|
2805
|
+
function gn(t = {}) {
|
|
2806
|
+
return f.safeExecute(() => {
|
|
2807
2807
|
var r;
|
|
2808
|
-
if (!
|
|
2808
|
+
if (!dn()) {
|
|
2809
2809
|
const n = {
|
|
2810
2810
|
errMsg: "wx.miniProgram.postMessage or wx.miniProgram.navigateBack is not available",
|
|
2811
2811
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -2838,15 +2838,15 @@ function dn(t = {}) {
|
|
|
2838
2838
|
window.wx.miniProgram.navigateBack({
|
|
2839
2839
|
delta: 1,
|
|
2840
2840
|
success: (o) => {
|
|
2841
|
-
var
|
|
2842
|
-
const d =
|
|
2841
|
+
var u;
|
|
2842
|
+
const d = p(g({}, o), {
|
|
2843
2843
|
errMsg: (o == null ? void 0 : o.errMsg) || "navigateToMiniProgram:queued"
|
|
2844
2844
|
});
|
|
2845
2845
|
a.info("Navigate to mini program request queued in weixin web-view", {
|
|
2846
2846
|
appid: t.appid,
|
|
2847
2847
|
path: t.path,
|
|
2848
2848
|
env: t.env
|
|
2849
|
-
}), (
|
|
2849
|
+
}), (u = t.success) == null || u.call(t, d), n(d);
|
|
2850
2850
|
},
|
|
2851
2851
|
fail: (o) => {
|
|
2852
2852
|
var d;
|
|
@@ -2860,13 +2860,13 @@ function dn(t = {}) {
|
|
|
2860
2860
|
platform: "weixin"
|
|
2861
2861
|
});
|
|
2862
2862
|
}
|
|
2863
|
-
function
|
|
2864
|
-
return
|
|
2863
|
+
function hn(t = {}) {
|
|
2864
|
+
return f.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
|
+
S(
|
|
2870
2870
|
"navigateToMiniProgram",
|
|
2871
2871
|
{
|
|
2872
2872
|
appid: t.appid,
|
|
@@ -2890,13 +2890,13 @@ function gn(t = {}) {
|
|
|
2890
2890
|
platform: wt().type
|
|
2891
2891
|
});
|
|
2892
2892
|
}
|
|
2893
|
-
function
|
|
2894
|
-
return
|
|
2893
|
+
function mn(t = {}) {
|
|
2894
|
+
return f.safeExecute(() => {
|
|
2895
2895
|
var n;
|
|
2896
2896
|
const e = wt();
|
|
2897
2897
|
let r;
|
|
2898
2898
|
try {
|
|
2899
|
-
r =
|
|
2899
|
+
r = fn(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,36 +2906,184 @@ function hn(t = {}) {
|
|
|
2906
2906
|
appid: r.appid,
|
|
2907
2907
|
path: r.path,
|
|
2908
2908
|
env: r.env
|
|
2909
|
-
}), e.isWeixinMiniProgram ?
|
|
2909
|
+
}), e.isWeixinMiniProgram ? gn(r) : hn(r);
|
|
2910
2910
|
}, {
|
|
2911
2911
|
context: "navigateToMiniProgram",
|
|
2912
2912
|
options: t
|
|
2913
2913
|
});
|
|
2914
2914
|
}
|
|
2915
|
+
function pn(t = "") {
|
|
2916
|
+
return /^https?:\/\//i.test(String(t || "").trim());
|
|
2917
|
+
}
|
|
2918
|
+
function wn(t) {
|
|
2919
|
+
if (t == null || t === "") return !1;
|
|
2920
|
+
if (typeof t == "boolean") return t;
|
|
2921
|
+
const e = String(t).trim().toLowerCase();
|
|
2922
|
+
return e === "true" || e === "1";
|
|
2923
|
+
}
|
|
2924
|
+
function En() {
|
|
2925
|
+
return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.postMessage == "function" && typeof window.wx.miniProgram.navigateBack == "function";
|
|
2926
|
+
}
|
|
2927
|
+
function yn(t = {}) {
|
|
2928
|
+
if (!t || typeof t != "object")
|
|
2929
|
+
throw {
|
|
2930
|
+
errMsg: "manualShare options must be an object",
|
|
2931
|
+
code: "PARAM_TYPE_ERROR"
|
|
2932
|
+
};
|
|
2933
|
+
const e = String(t.title || "").trim(), r = String(t.h5Url || "").trim(), n = String(t.clientId || "").trim(), i = wn(t.isPublic), s = String(t.imageUrl || "").trim(), o = String(t.description || t.desc || "").trim();
|
|
2934
|
+
if (!e)
|
|
2935
|
+
throw {
|
|
2936
|
+
errMsg: "manualShare: title is required",
|
|
2937
|
+
code: "PARAM_MISSING"
|
|
2938
|
+
};
|
|
2939
|
+
if (!r)
|
|
2940
|
+
throw {
|
|
2941
|
+
errMsg: "manualShare: h5Url is required",
|
|
2942
|
+
code: "PARAM_MISSING"
|
|
2943
|
+
};
|
|
2944
|
+
if (!n)
|
|
2945
|
+
throw {
|
|
2946
|
+
errMsg: "manualShare: clientId is required",
|
|
2947
|
+
code: "PARAM_MISSING"
|
|
2948
|
+
};
|
|
2949
|
+
if (r && !pn(r))
|
|
2950
|
+
throw {
|
|
2951
|
+
errMsg: "manualShare: h5Url must be a valid http(s) url",
|
|
2952
|
+
code: "PARAM_INVALID"
|
|
2953
|
+
};
|
|
2954
|
+
return {
|
|
2955
|
+
title: e,
|
|
2956
|
+
h5Url: r,
|
|
2957
|
+
clientId: n,
|
|
2958
|
+
isPublic: i,
|
|
2959
|
+
imageUrl: s,
|
|
2960
|
+
description: o,
|
|
2961
|
+
success: t.success,
|
|
2962
|
+
fail: t.fail,
|
|
2963
|
+
complete: t.complete
|
|
2964
|
+
};
|
|
2965
|
+
}
|
|
2966
|
+
function In(t) {
|
|
2967
|
+
return {
|
|
2968
|
+
type: "qsh_api_call",
|
|
2969
|
+
api: "manualShare",
|
|
2970
|
+
params: {
|
|
2971
|
+
title: t.title,
|
|
2972
|
+
h5Url: t.h5Url,
|
|
2973
|
+
clientId: t.clientId,
|
|
2974
|
+
isPublic: t.isPublic,
|
|
2975
|
+
imageUrl: t.imageUrl,
|
|
2976
|
+
description: t.description
|
|
2977
|
+
},
|
|
2978
|
+
timestamp: Date.now()
|
|
2979
|
+
};
|
|
2980
|
+
}
|
|
2981
|
+
function An(t) {
|
|
2982
|
+
return new Promise((e, r) => {
|
|
2983
|
+
const n = In(t);
|
|
2984
|
+
a.debug(
|
|
2985
|
+
"Relay manualShare through wx.miniProgram.postMessage",
|
|
2986
|
+
n
|
|
2987
|
+
);
|
|
2988
|
+
try {
|
|
2989
|
+
window.wx.miniProgram.postMessage({ data: n });
|
|
2990
|
+
} catch (i) {
|
|
2991
|
+
a.error("Post manualShare message failed", i), r(i);
|
|
2992
|
+
return;
|
|
2993
|
+
}
|
|
2994
|
+
window.wx.miniProgram.navigateBack({
|
|
2995
|
+
delta: 1,
|
|
2996
|
+
success: (i) => {
|
|
2997
|
+
const s = p(g({}, i || {}), {
|
|
2998
|
+
success: !0,
|
|
2999
|
+
errMsg: (i == null ? void 0 : i.errMsg) || "manualShare:queued"
|
|
3000
|
+
});
|
|
3001
|
+
a.info("manualShare request queued in weixin web-view", {
|
|
3002
|
+
h5Url: t.h5Url,
|
|
3003
|
+
clientId: t.clientId,
|
|
3004
|
+
isPublic: t.isPublic
|
|
3005
|
+
}), e(s);
|
|
3006
|
+
},
|
|
3007
|
+
fail: (i) => {
|
|
3008
|
+
a.error(
|
|
3009
|
+
"Navigate back after posting manualShare message failed",
|
|
3010
|
+
i
|
|
3011
|
+
), r(i);
|
|
3012
|
+
}
|
|
3013
|
+
});
|
|
3014
|
+
});
|
|
3015
|
+
}
|
|
3016
|
+
function Et(t = {}) {
|
|
3017
|
+
return f.safeExecute(
|
|
3018
|
+
() => {
|
|
3019
|
+
var n, i, s, o, d, u;
|
|
3020
|
+
const e = H(!0);
|
|
3021
|
+
let r;
|
|
3022
|
+
try {
|
|
3023
|
+
r = yn(t);
|
|
3024
|
+
} catch (m) {
|
|
3025
|
+
return (n = t.fail) == null || n.call(t, m), (i = t.complete) == null || i.call(t, m), Promise.reject(m);
|
|
3026
|
+
}
|
|
3027
|
+
if (!e.isWeixinMiniProgram) {
|
|
3028
|
+
const m = {
|
|
3029
|
+
errMsg: "manualShare only supports Weixin mini-program web-view environment",
|
|
3030
|
+
code: "ENV_NOT_SUPPORTED"
|
|
3031
|
+
};
|
|
3032
|
+
return (s = r.fail) == null || s.call(r, m), (o = r.complete) == null || o.call(r, m), Promise.reject(m);
|
|
3033
|
+
}
|
|
3034
|
+
if (!En()) {
|
|
3035
|
+
const m = {
|
|
3036
|
+
errMsg: "wx.miniProgram.postMessage or wx.miniProgram.navigateBack is not available",
|
|
3037
|
+
code: "PLATFORM_NOT_SUPPORTED"
|
|
3038
|
+
};
|
|
3039
|
+
return (d = r.fail) == null || d.call(r, m), (u = r.complete) == null || u.call(r, m), Promise.reject(m);
|
|
3040
|
+
}
|
|
3041
|
+
return An(r).then((m) => {
|
|
3042
|
+
var C, M;
|
|
3043
|
+
return (C = r.success) == null || C.call(r, m), (M = r.complete) == null || M.call(r, m), m;
|
|
3044
|
+
}).catch((m) => {
|
|
3045
|
+
var C, M;
|
|
3046
|
+
return (C = r.fail) == null || C.call(r, m), (M = r.complete) == null || M.call(r, m), Promise.reject(m);
|
|
3047
|
+
});
|
|
3048
|
+
},
|
|
3049
|
+
{
|
|
3050
|
+
context: "manualShare",
|
|
3051
|
+
options: t
|
|
3052
|
+
}
|
|
3053
|
+
);
|
|
3054
|
+
}
|
|
3055
|
+
function Pn(t = {}) {
|
|
3056
|
+
return new Promise((e, r) => {
|
|
3057
|
+
Et(p(g({}, t), {
|
|
3058
|
+
success: e,
|
|
3059
|
+
fail: r
|
|
3060
|
+
}));
|
|
3061
|
+
});
|
|
3062
|
+
}
|
|
2915
3063
|
const _e = {
|
|
2916
3064
|
ALBUM: "album",
|
|
2917
3065
|
// 相册
|
|
2918
3066
|
CAMERA: "camera"
|
|
2919
3067
|
// 相机
|
|
2920
|
-
},
|
|
3068
|
+
}, Me = {
|
|
2921
3069
|
ORIGINAL: "original",
|
|
2922
3070
|
// 原图
|
|
2923
3071
|
COMPRESSED: "compressed"
|
|
2924
3072
|
// 压缩图
|
|
2925
|
-
},
|
|
3073
|
+
}, _n = {
|
|
2926
3074
|
count: 9,
|
|
2927
|
-
sizeType: [
|
|
3075
|
+
sizeType: [Me.ORIGINAL, Me.COMPRESSED],
|
|
2928
3076
|
sourceType: [_e.ALBUM, _e.CAMERA]
|
|
2929
3077
|
};
|
|
2930
|
-
function
|
|
2931
|
-
const e = g(g({},
|
|
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 = [
|
|
3078
|
+
function Mn(t = {}) {
|
|
3079
|
+
const e = g(g({}, _n), t);
|
|
3080
|
+
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 = [Me.COMPRESSED]), e.sourceType.length === 0 && (e.sourceType = [_e.ALBUM]), e;
|
|
2933
3081
|
}
|
|
2934
|
-
function
|
|
2935
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(
|
|
3082
|
+
function yt() {
|
|
3083
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(l.type);
|
|
2936
3084
|
}
|
|
2937
|
-
function
|
|
2938
|
-
return
|
|
3085
|
+
function It(t) {
|
|
3086
|
+
return f.safeExecute(() => {
|
|
2939
3087
|
var e;
|
|
2940
3088
|
if (!window.wx) {
|
|
2941
3089
|
const r = {
|
|
@@ -2946,7 +3094,7 @@ function yt(t) {
|
|
|
2946
3094
|
return;
|
|
2947
3095
|
}
|
|
2948
3096
|
if (!ee()) {
|
|
2949
|
-
a.info("等待微信配置完成"),
|
|
3097
|
+
a.info("等待微信配置完成"), z().then(() => It(t)).catch((r) => {
|
|
2950
3098
|
var n;
|
|
2951
3099
|
a.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
2952
3100
|
});
|
|
@@ -2971,9 +3119,9 @@ function yt(t) {
|
|
|
2971
3119
|
platform: "weixin"
|
|
2972
3120
|
});
|
|
2973
3121
|
}
|
|
2974
|
-
function
|
|
2975
|
-
return
|
|
2976
|
-
a.debug("通过 WebView 桥接调用图片选择", t),
|
|
3122
|
+
function Cn(t) {
|
|
3123
|
+
return f.safeExecute(() => {
|
|
3124
|
+
a.debug("通过 WebView 桥接调用图片选择", t), S("chooseImage", p(g({}, t), { disableTimeout: !0 }), {
|
|
2977
3125
|
success: (e) => {
|
|
2978
3126
|
var r, n;
|
|
2979
3127
|
a.info("UniApp 图片选择成功", {
|
|
@@ -2991,33 +3139,33 @@ function wn(t) {
|
|
|
2991
3139
|
platform: "uniapp"
|
|
2992
3140
|
});
|
|
2993
3141
|
}
|
|
2994
|
-
function
|
|
2995
|
-
return
|
|
3142
|
+
function Rn(t = {}) {
|
|
3143
|
+
return f.safeExecute(() => {
|
|
2996
3144
|
var r;
|
|
2997
|
-
if (!
|
|
3145
|
+
if (!yt()) {
|
|
2998
3146
|
const n = {
|
|
2999
|
-
errMsg: `当前环境 (${
|
|
3147
|
+
errMsg: `当前环境 (${l.type}) 不支持图片选择功能`,
|
|
3000
3148
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3001
3149
|
};
|
|
3002
|
-
a.error("平台不支持图片选择", { platform:
|
|
3150
|
+
a.error("平台不支持图片选择", { platform: l.type }), (r = t.fail) == null || r.call(t, n);
|
|
3003
3151
|
return;
|
|
3004
3152
|
}
|
|
3005
|
-
const e =
|
|
3153
|
+
const e = Mn(t);
|
|
3006
3154
|
a.info("开始选择图片", {
|
|
3007
|
-
platform:
|
|
3155
|
+
platform: l.type,
|
|
3008
3156
|
count: e.count,
|
|
3009
3157
|
sizeType: e.sizeType,
|
|
3010
3158
|
sourceType: e.sourceType
|
|
3011
|
-
}), _() ?
|
|
3159
|
+
}), _() ? It(e) : Cn(e);
|
|
3012
3160
|
}, {
|
|
3013
3161
|
context: "chooseImage",
|
|
3014
3162
|
options: t
|
|
3015
3163
|
});
|
|
3016
3164
|
}
|
|
3017
|
-
function
|
|
3165
|
+
function On() {
|
|
3018
3166
|
return {
|
|
3019
|
-
supported:
|
|
3020
|
-
environment:
|
|
3167
|
+
supported: yt(),
|
|
3168
|
+
environment: l.type,
|
|
3021
3169
|
implementation: _() ? "weixin" : "webview",
|
|
3022
3170
|
features: {
|
|
3023
3171
|
multipleSelection: !0,
|
|
@@ -3031,7 +3179,7 @@ function yn() {
|
|
|
3031
3179
|
}
|
|
3032
3180
|
};
|
|
3033
3181
|
}
|
|
3034
|
-
const
|
|
3182
|
+
const Z = {
|
|
3035
3183
|
QR_CODE: "qrCode",
|
|
3036
3184
|
// 二维码
|
|
3037
3185
|
BAR_CODE: "barCode",
|
|
@@ -3040,21 +3188,21 @@ const X = {
|
|
|
3040
3188
|
// Data Matrix 码
|
|
3041
3189
|
PDF417: "pdf417"
|
|
3042
3190
|
// PDF417 条码
|
|
3043
|
-
},
|
|
3191
|
+
}, Sn = {
|
|
3044
3192
|
onlyFromCamera: !0,
|
|
3045
3193
|
// 只从相机扫码
|
|
3046
|
-
scanType: [
|
|
3194
|
+
scanType: [Z.QR_CODE, Z.BAR_CODE]
|
|
3047
3195
|
// 支持二维码和一维码
|
|
3048
3196
|
};
|
|
3049
|
-
function
|
|
3050
|
-
const e = g(g({},
|
|
3051
|
-
return Array.isArray(e.scanType) || (e.scanType = [e.scanType].filter(Boolean)), e.scanType.length === 0 && (e.scanType = [
|
|
3197
|
+
function Nn(t = {}) {
|
|
3198
|
+
const e = g(g({}, Sn), t);
|
|
3199
|
+
return Array.isArray(e.scanType) || (e.scanType = [e.scanType].filter(Boolean)), e.scanType.length === 0 && (e.scanType = [Z.QR_CODE, Z.BAR_CODE]), e.onlyFromCamera = !!e.onlyFromCamera, e;
|
|
3052
3200
|
}
|
|
3053
|
-
function
|
|
3054
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(
|
|
3201
|
+
function At() {
|
|
3202
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(l.type);
|
|
3055
3203
|
}
|
|
3056
|
-
function
|
|
3057
|
-
return
|
|
3204
|
+
function Pt(t) {
|
|
3205
|
+
return f.safeExecute(() => {
|
|
3058
3206
|
var e;
|
|
3059
3207
|
if (!window.wx) {
|
|
3060
3208
|
const r = {
|
|
@@ -3065,7 +3213,7 @@ function At(t) {
|
|
|
3065
3213
|
return;
|
|
3066
3214
|
}
|
|
3067
3215
|
if (!ee()) {
|
|
3068
|
-
a.info("等待微信配置完成"),
|
|
3216
|
+
a.info("等待微信配置完成"), z().then(() => Pt(t)).catch((r) => {
|
|
3069
3217
|
var n;
|
|
3070
3218
|
a.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
3071
3219
|
});
|
|
@@ -3081,7 +3229,7 @@ function At(t) {
|
|
|
3081
3229
|
const n = {
|
|
3082
3230
|
result: r.resultStr,
|
|
3083
3231
|
// 扫码内容
|
|
3084
|
-
scanType:
|
|
3232
|
+
scanType: Tn(r.resultStr),
|
|
3085
3233
|
// 推测扫码类型
|
|
3086
3234
|
charSet: "utf-8",
|
|
3087
3235
|
// 微信默认 UTF-8
|
|
@@ -3100,12 +3248,12 @@ function At(t) {
|
|
|
3100
3248
|
platform: "weixin"
|
|
3101
3249
|
});
|
|
3102
3250
|
}
|
|
3103
|
-
function
|
|
3104
|
-
return t ? t.length > 50 || /[^\d]/.test(t) ?
|
|
3251
|
+
function Tn(t) {
|
|
3252
|
+
return t ? t.length > 50 || /[^\d]/.test(t) ? Z.QR_CODE : Z.BAR_CODE : "unknown";
|
|
3105
3253
|
}
|
|
3106
|
-
function
|
|
3107
|
-
return
|
|
3108
|
-
a.debug("通过 WebView 桥接调用扫码", t),
|
|
3254
|
+
function bn(t) {
|
|
3255
|
+
return f.safeExecute(() => {
|
|
3256
|
+
a.debug("通过 WebView 桥接调用扫码", t), S("scanCode", p(g({}, t), { disableTimeout: !0 }), {
|
|
3109
3257
|
success: (e) => {
|
|
3110
3258
|
var r;
|
|
3111
3259
|
a.info("UniApp 扫码成功", {
|
|
@@ -3124,32 +3272,32 @@ function _n(t) {
|
|
|
3124
3272
|
platform: "uniapp"
|
|
3125
3273
|
});
|
|
3126
3274
|
}
|
|
3127
|
-
function
|
|
3128
|
-
return
|
|
3275
|
+
function vn(t = {}) {
|
|
3276
|
+
return f.safeExecute(() => {
|
|
3129
3277
|
var r;
|
|
3130
|
-
if (!
|
|
3278
|
+
if (!At()) {
|
|
3131
3279
|
const n = {
|
|
3132
|
-
errMsg: `当前环境 (${
|
|
3280
|
+
errMsg: `当前环境 (${l.type}) 不支持扫码功能`,
|
|
3133
3281
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3134
3282
|
};
|
|
3135
|
-
a.error("平台不支持扫码", { platform:
|
|
3283
|
+
a.error("平台不支持扫码", { platform: l.type }), (r = t.fail) == null || r.call(t, n);
|
|
3136
3284
|
return;
|
|
3137
3285
|
}
|
|
3138
|
-
const e =
|
|
3286
|
+
const e = Nn(t);
|
|
3139
3287
|
a.info("开始扫码", {
|
|
3140
|
-
platform:
|
|
3288
|
+
platform: l.type,
|
|
3141
3289
|
onlyFromCamera: e.onlyFromCamera,
|
|
3142
3290
|
scanType: e.scanType
|
|
3143
|
-
}), _() ?
|
|
3291
|
+
}), _() ? Pt(e) : bn(e);
|
|
3144
3292
|
}, {
|
|
3145
3293
|
context: "scanCode",
|
|
3146
3294
|
options: t
|
|
3147
3295
|
});
|
|
3148
3296
|
}
|
|
3149
|
-
function
|
|
3297
|
+
function Ln() {
|
|
3150
3298
|
return {
|
|
3151
|
-
supported:
|
|
3152
|
-
environment:
|
|
3299
|
+
supported: At(),
|
|
3300
|
+
environment: l.type,
|
|
3153
3301
|
implementation: _() ? "weixin" : "webview",
|
|
3154
3302
|
features: {
|
|
3155
3303
|
onlyFromCamera: !0,
|
|
@@ -3170,23 +3318,23 @@ const se = {
|
|
|
3170
3318
|
// 国测局坐标(火星坐标)
|
|
3171
3319
|
BD09: "bd09"
|
|
3172
3320
|
// 百度坐标
|
|
3173
|
-
},
|
|
3321
|
+
}, xn = {
|
|
3174
3322
|
type: se.WGS84,
|
|
3175
3323
|
altitude: !1
|
|
3176
|
-
},
|
|
3324
|
+
}, Dn = {
|
|
3177
3325
|
scale: 18
|
|
3178
3326
|
// 地图缩放级别 1-28
|
|
3179
3327
|
};
|
|
3180
|
-
function
|
|
3181
|
-
const e = g(g({},
|
|
3328
|
+
function Un(t = {}) {
|
|
3329
|
+
const e = g(g({}, xn), t);
|
|
3182
3330
|
return Object.values(se).includes(e.type) || (e.type = se.WGS84), e.altitude = !!e.altitude, e;
|
|
3183
3331
|
}
|
|
3184
|
-
function
|
|
3332
|
+
function Wn(t = {}) {
|
|
3185
3333
|
const e = g({}, t);
|
|
3186
3334
|
return Object.values(se).includes(e.type) || (e.type = se.WGS84), e.needFullAccuracy = !!e.needFullAccuracy, e;
|
|
3187
3335
|
}
|
|
3188
|
-
function
|
|
3189
|
-
const e = g(g({},
|
|
3336
|
+
function $n(t = {}) {
|
|
3337
|
+
const e = g(g({}, Dn), t);
|
|
3190
3338
|
if (e.latitude === void 0 || e.latitude === null)
|
|
3191
3339
|
throw {
|
|
3192
3340
|
errMsg: "缺少必需参数:latitude(纬度)",
|
|
@@ -3246,10 +3394,10 @@ function Tn(t = {}) {
|
|
|
3246
3394
|
return e;
|
|
3247
3395
|
}
|
|
3248
3396
|
function $e() {
|
|
3249
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(
|
|
3397
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(l.type);
|
|
3250
3398
|
}
|
|
3251
|
-
function
|
|
3252
|
-
return
|
|
3399
|
+
function _t(t) {
|
|
3400
|
+
return f.safeExecute(() => {
|
|
3253
3401
|
var e;
|
|
3254
3402
|
if (!window.wx) {
|
|
3255
3403
|
const r = {
|
|
@@ -3260,7 +3408,7 @@ function Pt(t) {
|
|
|
3260
3408
|
return;
|
|
3261
3409
|
}
|
|
3262
3410
|
if (!ee()) {
|
|
3263
|
-
a.info("等待微信配置完成"),
|
|
3411
|
+
a.info("等待微信配置完成"), z().then(() => _t(t)).catch((r) => {
|
|
3264
3412
|
var n;
|
|
3265
3413
|
a.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
3266
3414
|
});
|
|
@@ -3286,8 +3434,8 @@ function Pt(t) {
|
|
|
3286
3434
|
platform: "weixin"
|
|
3287
3435
|
});
|
|
3288
3436
|
}
|
|
3289
|
-
function
|
|
3290
|
-
return
|
|
3437
|
+
function Mt(t) {
|
|
3438
|
+
return f.safeExecute(() => {
|
|
3291
3439
|
var e;
|
|
3292
3440
|
if (!window.wx) {
|
|
3293
3441
|
const r = {
|
|
@@ -3298,7 +3446,7 @@ function _t(t) {
|
|
|
3298
3446
|
return;
|
|
3299
3447
|
}
|
|
3300
3448
|
if (!ee()) {
|
|
3301
|
-
a.info("等待微信配置完成"),
|
|
3449
|
+
a.info("等待微信配置完成"), z().then(() => Mt(t)).catch((r) => {
|
|
3302
3450
|
var n;
|
|
3303
3451
|
a.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
3304
3452
|
});
|
|
@@ -3326,9 +3474,9 @@ function _t(t) {
|
|
|
3326
3474
|
platform: "weixin"
|
|
3327
3475
|
});
|
|
3328
3476
|
}
|
|
3329
|
-
function
|
|
3330
|
-
return
|
|
3331
|
-
a.debug("通过 WebView 桥接调用获取位置", t),
|
|
3477
|
+
function Fn(t) {
|
|
3478
|
+
return f.safeExecute(() => {
|
|
3479
|
+
a.debug("通过 WebView 桥接调用获取位置", t), S("getLocation", t, {
|
|
3332
3480
|
success: (e) => {
|
|
3333
3481
|
var r;
|
|
3334
3482
|
a.info("UniApp 获取位置成功", {
|
|
@@ -3347,9 +3495,9 @@ function bn(t) {
|
|
|
3347
3495
|
platform: "uniapp"
|
|
3348
3496
|
});
|
|
3349
3497
|
}
|
|
3350
|
-
function
|
|
3351
|
-
return
|
|
3352
|
-
a.debug("通过 WebView 桥接调用查看位置", t),
|
|
3498
|
+
function Bn(t) {
|
|
3499
|
+
return f.safeExecute(() => {
|
|
3500
|
+
a.debug("通过 WebView 桥接调用查看位置", t), S("openLocation", t, {
|
|
3353
3501
|
success: (e) => {
|
|
3354
3502
|
var r;
|
|
3355
3503
|
a.info("UniApp 查看位置成功"), (r = t.success) == null || r.call(t, e);
|
|
@@ -3365,62 +3513,62 @@ function vn(t) {
|
|
|
3365
3513
|
platform: "uniapp"
|
|
3366
3514
|
});
|
|
3367
3515
|
}
|
|
3368
|
-
function
|
|
3369
|
-
return
|
|
3516
|
+
function kn(t = {}) {
|
|
3517
|
+
return f.safeExecute(() => {
|
|
3370
3518
|
var r;
|
|
3371
3519
|
if (!$e()) {
|
|
3372
3520
|
const n = {
|
|
3373
|
-
errMsg: `当前环境 (${
|
|
3521
|
+
errMsg: `当前环境 (${l.type}) 不支持定位功能`,
|
|
3374
3522
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3375
3523
|
};
|
|
3376
|
-
a.error("平台不支持定位", { platform:
|
|
3524
|
+
a.error("平台不支持定位", { platform: l.type }), (r = t.fail) == null || r.call(t, n);
|
|
3377
3525
|
return;
|
|
3378
3526
|
}
|
|
3379
|
-
const e =
|
|
3527
|
+
const e = Un(t);
|
|
3380
3528
|
a.info("开始获取位置", {
|
|
3381
|
-
platform:
|
|
3529
|
+
platform: l.type,
|
|
3382
3530
|
type: e.type,
|
|
3383
3531
|
altitude: e.altitude
|
|
3384
|
-
}), _() ?
|
|
3532
|
+
}), _() ? _t(e) : Fn(e);
|
|
3385
3533
|
}, {
|
|
3386
3534
|
context: "getLocation",
|
|
3387
3535
|
options: t
|
|
3388
3536
|
});
|
|
3389
3537
|
}
|
|
3390
|
-
function
|
|
3391
|
-
return
|
|
3538
|
+
function Gn(t = {}) {
|
|
3539
|
+
return f.safeExecute(() => {
|
|
3392
3540
|
var r, n, i;
|
|
3393
3541
|
if (!$e()) {
|
|
3394
3542
|
const s = {
|
|
3395
|
-
errMsg: `当前环境 (${
|
|
3543
|
+
errMsg: `当前环境 (${l.type}) 不支持查看位置功能`,
|
|
3396
3544
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3397
3545
|
};
|
|
3398
|
-
a.error("平台不支持查看位置", { platform:
|
|
3546
|
+
a.error("平台不支持查看位置", { platform: l.type }), (r = t.fail) == null || r.call(t, s);
|
|
3399
3547
|
return;
|
|
3400
3548
|
}
|
|
3401
3549
|
let e;
|
|
3402
3550
|
try {
|
|
3403
|
-
e =
|
|
3551
|
+
e = $n(t);
|
|
3404
3552
|
} catch (s) {
|
|
3405
3553
|
a.error("参数验证失败", s), (n = t.fail) == null || n.call(t, s), (i = t.complete) == null || i.call(t);
|
|
3406
3554
|
return;
|
|
3407
3555
|
}
|
|
3408
3556
|
a.info("开始查看位置", {
|
|
3409
|
-
platform:
|
|
3557
|
+
platform: l.type,
|
|
3410
3558
|
latitude: e.latitude,
|
|
3411
3559
|
longitude: e.longitude,
|
|
3412
3560
|
name: e.name
|
|
3413
|
-
}), _() ?
|
|
3561
|
+
}), _() ? Mt(e) : Bn(e);
|
|
3414
3562
|
}, {
|
|
3415
3563
|
context: "openLocation",
|
|
3416
3564
|
options: t
|
|
3417
3565
|
});
|
|
3418
3566
|
}
|
|
3419
|
-
function
|
|
3567
|
+
function Kn() {
|
|
3420
3568
|
const t = _();
|
|
3421
3569
|
return {
|
|
3422
3570
|
supported: $e(),
|
|
3423
|
-
environment:
|
|
3571
|
+
environment: l.type,
|
|
3424
3572
|
implementation: t ? "weixin" : "webview",
|
|
3425
3573
|
features: {
|
|
3426
3574
|
getLocation: !0,
|
|
@@ -3438,29 +3586,29 @@ function Dn() {
|
|
|
3438
3586
|
}
|
|
3439
3587
|
};
|
|
3440
3588
|
}
|
|
3441
|
-
const j = /* @__PURE__ */ new Set(),
|
|
3589
|
+
const j = /* @__PURE__ */ new Set(), J = /* @__PURE__ */ new Set();
|
|
3442
3590
|
function Ct(t, e, r) {
|
|
3443
3591
|
t.forEach((n) => {
|
|
3444
3592
|
if (typeof n == "function") {
|
|
3445
|
-
|
|
3593
|
+
f.safeExecute(() => n(e), { context: r });
|
|
3446
3594
|
return;
|
|
3447
3595
|
}
|
|
3448
3596
|
a.warn("监听回调不是函数,已跳过", { type: typeof n });
|
|
3449
3597
|
});
|
|
3450
3598
|
}
|
|
3451
|
-
function
|
|
3452
|
-
return
|
|
3599
|
+
function Vn(t = {}) {
|
|
3600
|
+
return f.safeExecute(() => {
|
|
3453
3601
|
var r, n;
|
|
3454
3602
|
if (_()) {
|
|
3455
3603
|
const i = {
|
|
3456
|
-
errMsg: `当前环境 (${
|
|
3604
|
+
errMsg: `当前环境 (${l.type}) 不支持该接口`,
|
|
3457
3605
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3458
3606
|
};
|
|
3459
|
-
a.error("当前环境不支持此接口", { platform:
|
|
3607
|
+
a.error("当前环境不支持此接口", { platform: l.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
|
|
3460
3608
|
return;
|
|
3461
3609
|
}
|
|
3462
|
-
const e =
|
|
3463
|
-
a.info("正在开启定位监听"),
|
|
3610
|
+
const e = Wn(t);
|
|
3611
|
+
a.info("正在开启定位监听"), S("startLocationUpdate", {
|
|
3464
3612
|
type: e.type,
|
|
3465
3613
|
needFullAccuracy: e.needFullAccuracy
|
|
3466
3614
|
}, {
|
|
@@ -3476,18 +3624,18 @@ function Un(t = {}) {
|
|
|
3476
3624
|
});
|
|
3477
3625
|
}, { context: "startLocationUpdate" });
|
|
3478
3626
|
}
|
|
3479
|
-
function
|
|
3480
|
-
return
|
|
3627
|
+
function qn(t = {}) {
|
|
3628
|
+
return f.safeExecute(() => {
|
|
3481
3629
|
var e, r;
|
|
3482
3630
|
if (_()) {
|
|
3483
3631
|
const n = {
|
|
3484
|
-
errMsg: `当前环境 (${
|
|
3632
|
+
errMsg: `当前环境 (${l.type}) 不支持该接口`,
|
|
3485
3633
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3486
3634
|
};
|
|
3487
|
-
a.error("当前环境不支持此接口", { platform:
|
|
3635
|
+
a.error("当前环境不支持此接口", { platform: l.type }), (e = t.fail) == null || e.call(t, n), (r = t.complete) == null || r.call(t, n);
|
|
3488
3636
|
return;
|
|
3489
3637
|
}
|
|
3490
|
-
a.info("正在停止定位监听"),
|
|
3638
|
+
a.info("正在停止定位监听"), S("stopLocationUpdate", t, {
|
|
3491
3639
|
success: (n) => {
|
|
3492
3640
|
var i;
|
|
3493
3641
|
a.info("定位监听已停止"), (i = t.success) == null || i.call(t, n);
|
|
@@ -3500,10 +3648,10 @@ function Wn(t = {}) {
|
|
|
3500
3648
|
});
|
|
3501
3649
|
}, { context: "stopLocationUpdate" });
|
|
3502
3650
|
}
|
|
3503
|
-
function
|
|
3504
|
-
return
|
|
3651
|
+
function jn(t) {
|
|
3652
|
+
return f.safeExecute(() => {
|
|
3505
3653
|
if (_()) {
|
|
3506
|
-
a.warn("当前环境不支持此接口", { platform:
|
|
3654
|
+
a.warn("当前环境不支持此接口", { platform: l.type });
|
|
3507
3655
|
return;
|
|
3508
3656
|
}
|
|
3509
3657
|
if (typeof t != "function")
|
|
@@ -3512,7 +3660,7 @@ function $n(t) {
|
|
|
3512
3660
|
code: "INVALID_CALLBACK"
|
|
3513
3661
|
};
|
|
3514
3662
|
const e = j.size > 0;
|
|
3515
|
-
j.add(t), e || (a.debug("注册实时位置变化监听器"),
|
|
3663
|
+
j.add(t), e || (a.debug("注册实时位置变化监听器"), S("onLocationChange", { isPersistent: !0 }, {
|
|
3516
3664
|
success: (r) => {
|
|
3517
3665
|
a.debug("收到实时位置推送", r), Ct(j, r, "onLocationChange");
|
|
3518
3666
|
},
|
|
@@ -3522,10 +3670,10 @@ function $n(t) {
|
|
|
3522
3670
|
}));
|
|
3523
3671
|
}, { context: "onLocationChange" });
|
|
3524
3672
|
}
|
|
3525
|
-
function
|
|
3526
|
-
return
|
|
3673
|
+
function Jn(t) {
|
|
3674
|
+
return f.safeExecute(() => {
|
|
3527
3675
|
if (_()) {
|
|
3528
|
-
a.warn("当前环境不支持此接口", { platform:
|
|
3676
|
+
a.warn("当前环境不支持此接口", { platform: l.type });
|
|
3529
3677
|
return;
|
|
3530
3678
|
}
|
|
3531
3679
|
if (t && typeof t != "function")
|
|
@@ -3533,7 +3681,7 @@ function Fn(t) {
|
|
|
3533
3681
|
errMsg: "offLocationChange 回调必须是函数",
|
|
3534
3682
|
code: "INVALID_CALLBACK"
|
|
3535
3683
|
};
|
|
3536
|
-
t ? j.delete(t) : j.clear(), !(j.size > 0) && (a.info("移除位置变化监听器"),
|
|
3684
|
+
t ? j.delete(t) : j.clear(), !(j.size > 0) && (a.info("移除位置变化监听器"), S("offLocationChange", {}, {
|
|
3537
3685
|
success: () => {
|
|
3538
3686
|
a.info("位置变化监听已移除"), ae("onLocationChange");
|
|
3539
3687
|
},
|
|
@@ -3543,10 +3691,10 @@ function Fn(t) {
|
|
|
3543
3691
|
}));
|
|
3544
3692
|
}, { context: "offLocationChange" });
|
|
3545
3693
|
}
|
|
3546
|
-
function
|
|
3547
|
-
return
|
|
3694
|
+
function Hn(t) {
|
|
3695
|
+
return f.safeExecute(() => {
|
|
3548
3696
|
if (_()) {
|
|
3549
|
-
a.warn("当前环境不支持此接口", { platform:
|
|
3697
|
+
a.warn("当前环境不支持此接口", { platform: l.type });
|
|
3550
3698
|
return;
|
|
3551
3699
|
}
|
|
3552
3700
|
if (typeof t != "function")
|
|
@@ -3554,21 +3702,21 @@ function Bn(t) {
|
|
|
3554
3702
|
errMsg: "onLocationChangeError 回调必须是函数",
|
|
3555
3703
|
code: "INVALID_CALLBACK"
|
|
3556
3704
|
};
|
|
3557
|
-
const e =
|
|
3558
|
-
|
|
3705
|
+
const e = J.size > 0;
|
|
3706
|
+
J.add(t), e || (a.debug("注册位置更新错误监听器"), S("onLocationChangeError", { isPersistent: !0 }, {
|
|
3559
3707
|
success: (r) => {
|
|
3560
|
-
a.warn("持续定位发生异常", r), Ct(
|
|
3708
|
+
a.warn("持续定位发生异常", r), Ct(J, r, "onLocationChangeError");
|
|
3561
3709
|
},
|
|
3562
3710
|
fail: (r) => {
|
|
3563
|
-
a.warn("位置更新错误监听注册失败", r),
|
|
3711
|
+
a.warn("位置更新错误监听注册失败", r), J.delete(t), J.size === 0 && ae("onLocationChangeError");
|
|
3564
3712
|
}
|
|
3565
3713
|
}));
|
|
3566
3714
|
}, { context: "onLocationChangeError" });
|
|
3567
3715
|
}
|
|
3568
|
-
function
|
|
3569
|
-
return
|
|
3716
|
+
function zn(t) {
|
|
3717
|
+
return f.safeExecute(() => {
|
|
3570
3718
|
if (_()) {
|
|
3571
|
-
a.warn("当前环境不支持此接口", { platform:
|
|
3719
|
+
a.warn("当前环境不支持此接口", { platform: l.type });
|
|
3572
3720
|
return;
|
|
3573
3721
|
}
|
|
3574
3722
|
if (t && typeof t != "function")
|
|
@@ -3576,7 +3724,7 @@ function kn(t) {
|
|
|
3576
3724
|
errMsg: "offLocationChangeError 回调必须是函数",
|
|
3577
3725
|
code: "INVALID_CALLBACK"
|
|
3578
3726
|
};
|
|
3579
|
-
t ?
|
|
3727
|
+
t ? J.delete(t) : J.clear(), !(J.size > 0) && (a.info("移除定位错误监听器"), S("offLocationChangeError", {}, {
|
|
3580
3728
|
success: () => {
|
|
3581
3729
|
a.info("定位错误监听已移除"), ae("onLocationChangeError");
|
|
3582
3730
|
},
|
|
@@ -3586,14 +3734,14 @@ function kn(t) {
|
|
|
3586
3734
|
}));
|
|
3587
3735
|
}, { context: "offLocationChangeError" });
|
|
3588
3736
|
}
|
|
3589
|
-
const
|
|
3737
|
+
const Yn = {
|
|
3590
3738
|
latitude: null,
|
|
3591
3739
|
// 目标地纬度
|
|
3592
3740
|
longitude: null
|
|
3593
3741
|
// 目标地经度
|
|
3594
3742
|
};
|
|
3595
|
-
function
|
|
3596
|
-
const e = g(g({},
|
|
3743
|
+
function Xn(t = {}) {
|
|
3744
|
+
const e = g(g({}, Yn), t);
|
|
3597
3745
|
return e.latitude !== null && e.latitude !== void 0 && (typeof e.latitude != "number" ? (a.warn("latitude 参数类型错误,已忽略", {
|
|
3598
3746
|
latitude: e.latitude
|
|
3599
3747
|
}), e.latitude = null) : (e.latitude < -90 || e.latitude > 90) && (a.warn("latitude 超出范围,已忽略", {
|
|
@@ -3604,11 +3752,11 @@ function Kn(t = {}) {
|
|
|
3604
3752
|
longitude: e.longitude
|
|
3605
3753
|
}), e.longitude = null)), e;
|
|
3606
3754
|
}
|
|
3607
|
-
function
|
|
3608
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(
|
|
3755
|
+
function Rt() {
|
|
3756
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(l.type);
|
|
3609
3757
|
}
|
|
3610
|
-
function
|
|
3611
|
-
return
|
|
3758
|
+
function Ot(t) {
|
|
3759
|
+
return f.safeExecute(() => {
|
|
3612
3760
|
var n;
|
|
3613
3761
|
if (!window.wx) {
|
|
3614
3762
|
const i = {
|
|
@@ -3619,7 +3767,7 @@ function Rt(t) {
|
|
|
3619
3767
|
return;
|
|
3620
3768
|
}
|
|
3621
3769
|
if (!ee()) {
|
|
3622
|
-
a.info("等待微信配置完成"),
|
|
3770
|
+
a.info("等待微信配置完成"), z().then(() => Ot(t)).catch((i) => {
|
|
3623
3771
|
var s;
|
|
3624
3772
|
a.error("微信配置失败", i), (s = t.fail) == null || s.call(t, { errMsg: `微信配置失败: ${i.message}` });
|
|
3625
3773
|
});
|
|
@@ -3654,7 +3802,7 @@ function Rt(t) {
|
|
|
3654
3802
|
},
|
|
3655
3803
|
complete: t.complete
|
|
3656
3804
|
}, r = {};
|
|
3657
|
-
t.latitude !== null && t.latitude !== void 0 && (r.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (r.longitude = t.longitude), window.wx.chooseLocation(
|
|
3805
|
+
t.latitude !== null && t.latitude !== void 0 && (r.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (r.longitude = t.longitude), window.wx.chooseLocation(p(g({}, r), {
|
|
3658
3806
|
success: e.success,
|
|
3659
3807
|
fail: e.fail,
|
|
3660
3808
|
complete: e.complete
|
|
@@ -3664,8 +3812,8 @@ function Rt(t) {
|
|
|
3664
3812
|
platform: "weixin"
|
|
3665
3813
|
});
|
|
3666
3814
|
}
|
|
3667
|
-
function
|
|
3668
|
-
return
|
|
3815
|
+
function Zn(t) {
|
|
3816
|
+
return f.safeExecute(() => {
|
|
3669
3817
|
a.debug("通过 WebView 桥接调用位置选择", t);
|
|
3670
3818
|
const e = {
|
|
3671
3819
|
// 禁用超时清理,等待用户操作完成后才清理
|
|
@@ -3685,7 +3833,7 @@ function Vn(t) {
|
|
|
3685
3833
|
},
|
|
3686
3834
|
complete: t.complete
|
|
3687
3835
|
};
|
|
3688
|
-
t.latitude !== null && t.latitude !== void 0 && (e.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (e.longitude = t.longitude),
|
|
3836
|
+
t.latitude !== null && t.latitude !== void 0 && (e.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (e.longitude = t.longitude), S("chooseLocation", e, {
|
|
3689
3837
|
success: (r) => {
|
|
3690
3838
|
e.success(r);
|
|
3691
3839
|
},
|
|
@@ -3699,32 +3847,32 @@ function Vn(t) {
|
|
|
3699
3847
|
platform: "uniapp"
|
|
3700
3848
|
});
|
|
3701
3849
|
}
|
|
3702
|
-
function
|
|
3703
|
-
return
|
|
3850
|
+
function Qn(t = {}) {
|
|
3851
|
+
return f.safeExecute(() => {
|
|
3704
3852
|
var r;
|
|
3705
|
-
if (!
|
|
3853
|
+
if (!Rt()) {
|
|
3706
3854
|
const n = {
|
|
3707
|
-
errMsg: `当前环境 (${
|
|
3855
|
+
errMsg: `当前环境 (${l.type}) 不支持位置选择功能`,
|
|
3708
3856
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3709
3857
|
};
|
|
3710
|
-
a.error("平台不支持位置选择", { platform:
|
|
3858
|
+
a.error("平台不支持位置选择", { platform: l.type }), (r = t.fail) == null || r.call(t, n);
|
|
3711
3859
|
return;
|
|
3712
3860
|
}
|
|
3713
|
-
const e =
|
|
3861
|
+
const e = Xn(t);
|
|
3714
3862
|
a.info("开始选择位置", {
|
|
3715
|
-
platform:
|
|
3863
|
+
platform: l.type,
|
|
3716
3864
|
latitude: e.latitude,
|
|
3717
3865
|
longitude: e.longitude
|
|
3718
|
-
}), _() ?
|
|
3866
|
+
}), _() ? Ot(e) : Zn(e);
|
|
3719
3867
|
}, {
|
|
3720
3868
|
context: "chooseLocation",
|
|
3721
3869
|
options: t
|
|
3722
3870
|
});
|
|
3723
3871
|
}
|
|
3724
|
-
function
|
|
3872
|
+
function ei() {
|
|
3725
3873
|
return {
|
|
3726
|
-
supported:
|
|
3727
|
-
environment:
|
|
3874
|
+
supported: Rt(),
|
|
3875
|
+
environment: l.type,
|
|
3728
3876
|
implementation: _() ? "weixin" : "webview",
|
|
3729
3877
|
features: {
|
|
3730
3878
|
chooseLocation: !0,
|
|
@@ -3736,11 +3884,11 @@ function jn() {
|
|
|
3736
3884
|
}
|
|
3737
3885
|
};
|
|
3738
3886
|
}
|
|
3739
|
-
const
|
|
3740
|
-
function
|
|
3887
|
+
const St = "https://iafs.xjy2.cn/img/bg.143351f0.jpg";
|
|
3888
|
+
function ti(t) {
|
|
3741
3889
|
return t === "timeline" || Number(t) === 1 ? 1 : 0;
|
|
3742
3890
|
}
|
|
3743
|
-
function
|
|
3891
|
+
function Ne(t = "", e = "targetPath") {
|
|
3744
3892
|
if (!t || typeof t != "string")
|
|
3745
3893
|
throw { errMsg: `share: ${e} 必须是最终小程序页面路径,例如 /pages/xxx/index?foo=1`, code: "PARAM_INVALID" };
|
|
3746
3894
|
const r = t.trim();
|
|
@@ -3757,15 +3905,15 @@ function Nt(t = "", e = "webTarget") {
|
|
|
3757
3905
|
throw { errMsg: `share: ${e} 必须是公网链接,例如 https://example.com/path?a=1`, code: "PARAM_INVALID" };
|
|
3758
3906
|
return r;
|
|
3759
3907
|
}
|
|
3760
|
-
function
|
|
3908
|
+
function ri() {
|
|
3761
3909
|
return new Promise((t, e) => {
|
|
3762
3910
|
var s, o;
|
|
3763
3911
|
const r = typeof window != "undefined" ? window : null;
|
|
3764
3912
|
if (!r) return e({ errMsg: "当前环境不支持 plus", code: "PLUS_UNAVAILABLE" });
|
|
3765
3913
|
if (r.plus) return t(r.plus);
|
|
3766
3914
|
const n = setTimeout(() => {
|
|
3767
|
-
var d,
|
|
3768
|
-
(
|
|
3915
|
+
var d, u;
|
|
3916
|
+
(u = (d = r.document) == null ? void 0 : d.removeEventListener) == null || u.call(d, "plusready", i), e({ errMsg: "等待 plusready 超时", code: "PLUS_READY_TIMEOUT" });
|
|
3769
3917
|
}, 8e3);
|
|
3770
3918
|
function i() {
|
|
3771
3919
|
clearTimeout(n), t(r.plus);
|
|
@@ -3773,7 +3921,7 @@ function Jn() {
|
|
|
3773
3921
|
(o = (s = r.document) == null ? void 0 : s.addEventListener) == null || o.call(s, "plusready", i, { once: !0 });
|
|
3774
3922
|
});
|
|
3775
3923
|
}
|
|
3776
|
-
function
|
|
3924
|
+
function ni() {
|
|
3777
3925
|
return new Promise((t, e) => {
|
|
3778
3926
|
const r = typeof window != "undefined" ? window.plus : null;
|
|
3779
3927
|
if (!r || !r.share || typeof r.share.getServices != "function")
|
|
@@ -3788,13 +3936,13 @@ function Hn() {
|
|
|
3788
3936
|
);
|
|
3789
3937
|
});
|
|
3790
3938
|
}
|
|
3791
|
-
function
|
|
3939
|
+
function ii(t) {
|
|
3792
3940
|
return t.isWeixinMiniProgram ? "已同步分享内容,请点击右上角“···”选择发送给朋友或分享到朋友圈。" : "正在拉起微信分享面板,请选择聊天框或朋友圈。";
|
|
3793
3941
|
}
|
|
3794
|
-
function
|
|
3942
|
+
function ai(t = {}) {
|
|
3795
3943
|
if (!t || typeof t != "object")
|
|
3796
3944
|
throw { errMsg: "shareDirected 参数必须是对象", code: "PARAM_TYPE_ERROR" };
|
|
3797
|
-
const e = String(t.kind || "").trim(), r = t.payload || {}, n =
|
|
3945
|
+
const e = String(t.kind || "").trim(), r = t.payload || {}, n = ti(t.scene);
|
|
3798
3946
|
if (!["web", "image", "text"].includes(e))
|
|
3799
3947
|
throw { errMsg: 'shareDirected: kind 仅支持 "web"|"image"|"text"', code: "PARAM_INVALID" };
|
|
3800
3948
|
if (![0, 1].includes(n))
|
|
@@ -3816,11 +3964,11 @@ function Xn(t = {}) {
|
|
|
3816
3964
|
complete: t.complete
|
|
3817
3965
|
};
|
|
3818
3966
|
}
|
|
3819
|
-
function
|
|
3967
|
+
function si(t, e) {
|
|
3820
3968
|
const { payload: r } = t;
|
|
3821
3969
|
if (e.isWeixinMiniProgram)
|
|
3822
3970
|
try {
|
|
3823
|
-
const n =
|
|
3971
|
+
const n = Ne(r.target, "target");
|
|
3824
3972
|
return t.resolvedTargetPath = n.path, t;
|
|
3825
3973
|
} catch (n) {
|
|
3826
3974
|
throw { errMsg: (n == null ? void 0 : n.errMsg) || "shareDirected: 小程序环境下 payload.target 不合法", code: (n == null ? void 0 : n.code) || "PARAM_INVALID" };
|
|
@@ -3829,7 +3977,7 @@ function Zn(t, e) {
|
|
|
3829
3977
|
const n = (o, d) => {
|
|
3830
3978
|
try {
|
|
3831
3979
|
return Nt(o, d);
|
|
3832
|
-
} catch (
|
|
3980
|
+
} catch (u) {
|
|
3833
3981
|
return "";
|
|
3834
3982
|
}
|
|
3835
3983
|
}, i = n(r.target, "target");
|
|
@@ -3845,8 +3993,8 @@ function Zn(t, e) {
|
|
|
3845
3993
|
}
|
|
3846
3994
|
return t;
|
|
3847
3995
|
}
|
|
3848
|
-
function
|
|
3849
|
-
const { kind: e, payload: r, resolvedTargetPath: n } = t, i =
|
|
3996
|
+
function oi(t) {
|
|
3997
|
+
const { kind: e, payload: r, resolvedTargetPath: n } = t, i = Ne(n || r.target, "target"), s = r.imageUrl || St;
|
|
3850
3998
|
return {
|
|
3851
3999
|
title: r.title || "分享",
|
|
3852
4000
|
path: i.path,
|
|
@@ -3855,17 +4003,17 @@ function Qn(t) {
|
|
|
3855
4003
|
custom: { kind: e, target: i.path, webTarget: r.webTarget || "", description: r.description || "" }
|
|
3856
4004
|
};
|
|
3857
4005
|
}
|
|
3858
|
-
function
|
|
3859
|
-
const { kind: e, scene: r, payload: n, resolvedWebTarget: i } = t, s = r === 1 ? "WXSceneTimeline" : "WXSceneSession", o = n.imageUrl ||
|
|
4006
|
+
function ci(t) {
|
|
4007
|
+
const { kind: e, scene: r, payload: n, resolvedWebTarget: i } = t, s = r === 1 ? "WXSceneTimeline" : "WXSceneSession", o = n.imageUrl || St;
|
|
3860
4008
|
return e === "image" ? { message: { type: "image", pictures: [n.imageUrl], extra: { scene: s } }, degradedFromText: !1 } : {
|
|
3861
4009
|
message: { type: "web", title: n.title || "分享", content: n.description || "", href: i, thumbs: [o], extra: { scene: s } },
|
|
3862
4010
|
degradedFromText: e === "text"
|
|
3863
4011
|
};
|
|
3864
4012
|
}
|
|
3865
|
-
function
|
|
3866
|
-
return
|
|
3867
|
-
yield
|
|
3868
|
-
const e = yield
|
|
4013
|
+
function ui(t) {
|
|
4014
|
+
return y(this, null, function* () {
|
|
4015
|
+
yield ri();
|
|
4016
|
+
const e = yield ni(), { message: r, degradedFromText: n } = ci(t);
|
|
3869
4017
|
return new Promise((i, s) => {
|
|
3870
4018
|
e.send(
|
|
3871
4019
|
r,
|
|
@@ -3875,16 +4023,16 @@ function ti(t) {
|
|
|
3875
4023
|
});
|
|
3876
4024
|
});
|
|
3877
4025
|
}
|
|
3878
|
-
function
|
|
4026
|
+
function Tt(t, e = "share") {
|
|
3879
4027
|
const r = typeof window != "undefined" && window.wx && window.wx.miniProgram;
|
|
3880
4028
|
if (!r || typeof r.postMessage != "function")
|
|
3881
4029
|
throw { errMsg: `当前微信小程序容器未注入 postMessage 能力,无法发起 ${e}`, code: "MINIPROGRAM_BRIDGE_UNAVAILABLE" };
|
|
3882
4030
|
r.postMessage({ data: t });
|
|
3883
4031
|
}
|
|
3884
|
-
function
|
|
3885
|
-
return { type: "qsh_api_call", api: "shareDirected", params: { miniProgramShare:
|
|
4032
|
+
function li(t, e) {
|
|
4033
|
+
return { type: "qsh_api_call", api: "shareDirected", params: { miniProgramShare: oi(t), rowCustom: e }, timestamp: Date.now() };
|
|
3886
4034
|
}
|
|
3887
|
-
function
|
|
4035
|
+
function fi(t = {}) {
|
|
3888
4036
|
if (!t || typeof t != "object")
|
|
3889
4037
|
throw { errMsg: "shareMiniProgramCard 参数必须是对象", code: "PARAM_TYPE_ERROR" };
|
|
3890
4038
|
const e = t.payload || {};
|
|
@@ -3892,14 +4040,14 @@ function ni(t = {}) {
|
|
|
3892
4040
|
if (!e.imageUrl) throw { errMsg: "shareMiniProgramCard: payload.imageUrl 必填", code: "PARAM_MISSING" };
|
|
3893
4041
|
if (!e.targetPath) throw { errMsg: "shareMiniProgramCard: payload.targetPath 必填", code: "PARAM_MISSING" };
|
|
3894
4042
|
if (!e.appid) throw { errMsg: "shareMiniProgramCard: payload.appid 必填", code: "PARAM_MISSING" };
|
|
3895
|
-
return
|
|
4043
|
+
return Ne(e.targetPath, "targetPath"), { payload: e, success: t.success, fail: t.fail, complete: t.complete };
|
|
3896
4044
|
}
|
|
3897
|
-
function
|
|
4045
|
+
function di(t) {
|
|
3898
4046
|
const { payload: e } = t;
|
|
3899
4047
|
return Nt(e.webUrl, "webUrl"), t;
|
|
3900
4048
|
}
|
|
3901
|
-
function
|
|
3902
|
-
const { payload: e } = t, r =
|
|
4049
|
+
function gi(t) {
|
|
4050
|
+
const { payload: e } = t, r = Ne(e.targetPath, "targetPath");
|
|
3903
4051
|
return {
|
|
3904
4052
|
title: e.title,
|
|
3905
4053
|
path: r.path,
|
|
@@ -3907,7 +4055,7 @@ function ai(t) {
|
|
|
3907
4055
|
imageUrl: e.imageUrl
|
|
3908
4056
|
};
|
|
3909
4057
|
}
|
|
3910
|
-
function
|
|
4058
|
+
function hi(t) {
|
|
3911
4059
|
const { payload: e } = t;
|
|
3912
4060
|
return {
|
|
3913
4061
|
provider: "weixin",
|
|
@@ -3923,106 +4071,112 @@ function si(t) {
|
|
|
3923
4071
|
}
|
|
3924
4072
|
};
|
|
3925
4073
|
}
|
|
3926
|
-
function
|
|
3927
|
-
return { type: "qsh_api_call", api: "shareMiniProgramCard", params: { miniProgramShare:
|
|
4074
|
+
function mi(t, e) {
|
|
4075
|
+
return { type: "qsh_api_call", api: "shareMiniProgramCard", params: { miniProgramShare: gi(t), rowCustom: e }, timestamp: Date.now() };
|
|
3928
4076
|
}
|
|
3929
|
-
function
|
|
3930
|
-
return
|
|
4077
|
+
function pi(t) {
|
|
4078
|
+
return y(this, null, function* () {
|
|
3931
4079
|
return new Promise((e, r) => {
|
|
3932
|
-
|
|
4080
|
+
S("shareMiniProgramCard", { appShare: hi(t) }, { success: (n) => e(n || {}), fail: (n) => r(n) });
|
|
3933
4081
|
});
|
|
3934
4082
|
});
|
|
3935
4083
|
}
|
|
3936
|
-
function
|
|
3937
|
-
return
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
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);
|
|
3950
|
-
}
|
|
3951
|
-
const n = Yn(r);
|
|
3952
|
-
if (r.isAppPlus)
|
|
3953
|
-
return ti(e).then((p) => {
|
|
3954
|
-
var ue, je;
|
|
3955
|
-
const B = m(g({}, (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);
|
|
3960
|
-
});
|
|
3961
|
-
if (r.isWeixinMiniProgram)
|
|
4084
|
+
function bt(t = {}) {
|
|
4085
|
+
return f.safeExecute(
|
|
4086
|
+
() => {
|
|
4087
|
+
var s, o, d, u, m, C, M, $, ce, R, F;
|
|
4088
|
+
let e;
|
|
3962
4089
|
try {
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
return (
|
|
3966
|
-
} catch (p) {
|
|
3967
|
-
return (N = e.fail) == null || N.call(e, p), (O = e.complete) == null || O.call(e, p), Promise.reject(p);
|
|
4090
|
+
e = ai(t);
|
|
4091
|
+
} catch (w) {
|
|
4092
|
+
return (s = t.fail) == null || s.call(t, w), Promise.reject(w);
|
|
3968
4093
|
}
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
4094
|
+
const r = H(!0);
|
|
4095
|
+
try {
|
|
4096
|
+
e = si(e, r);
|
|
4097
|
+
} catch (w) {
|
|
4098
|
+
return (o = e.fail) == null || o.call(e, w), (d = e.complete) == null || d.call(e, w), Promise.reject(w);
|
|
4099
|
+
}
|
|
4100
|
+
const n = ii(r);
|
|
4101
|
+
if (r.isAppPlus)
|
|
4102
|
+
return ui(e).then((w) => {
|
|
4103
|
+
var ue, je;
|
|
4104
|
+
const B = p(g({}, (w == null ? void 0 : w.data) || {}), { hint: n });
|
|
4105
|
+
return (ue = e.success) == null || ue.call(e, B), (je = e.complete) == null || je.call(e, B), B;
|
|
4106
|
+
}).catch((w) => {
|
|
4107
|
+
var B, ue;
|
|
4108
|
+
return (B = e.fail) == null || B.call(e, w), (ue = e.complete) == null || ue.call(e, w), Promise.reject(w);
|
|
4109
|
+
});
|
|
4110
|
+
if (r.isWeixinMiniProgram)
|
|
4111
|
+
try {
|
|
4112
|
+
Tt(li(e, t.rowCustom), "shareDirected");
|
|
4113
|
+
const w = { success: !0, hint: n };
|
|
4114
|
+
return (u = e.success) == null || u.call(e, w), (m = e.complete) == null || m.call(e, w), Promise.resolve(w);
|
|
4115
|
+
} catch (w) {
|
|
4116
|
+
return (C = e.fail) == null || C.call(e, w), (M = e.complete) == null || M.call(e, w), Promise.reject(w);
|
|
4117
|
+
}
|
|
4118
|
+
if (r.type === "h5" && !r.isUniAppWebView && !r.isOfflineWebview) {
|
|
4119
|
+
const w = { errMsg: "当前页面不在宿主 WebView 中,无法分享。请在 unified-platform-app 内打开该 H5 再重试。", code: "NOT_IN_CONTAINER" };
|
|
4120
|
+
return ($ = e.fail) == null || $.call(e, w), (ce = e.complete) == null || ce.call(e, w), Promise.reject(w);
|
|
4121
|
+
}
|
|
4122
|
+
const i = { errMsg: "当前环境暂不支持 shareDirected,请在 App 或微信小程序容器内使用。", code: "ENV_NOT_SUPPORTED" };
|
|
4123
|
+
return (R = e.fail) == null || R.call(e, i), (F = e.complete) == null || F.call(e, i), Promise.reject(i);
|
|
4124
|
+
},
|
|
4125
|
+
{ context: "shareDirected", options: t }
|
|
4126
|
+
);
|
|
3976
4127
|
}
|
|
3977
|
-
function
|
|
4128
|
+
function wi(t = {}) {
|
|
3978
4129
|
return new Promise((e, r) => {
|
|
3979
|
-
|
|
4130
|
+
bt(p(g({}, t), { success: e, fail: r }));
|
|
3980
4131
|
});
|
|
3981
4132
|
}
|
|
3982
|
-
function
|
|
3983
|
-
return
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
e = ni(t);
|
|
3988
|
-
} catch (C) {
|
|
3989
|
-
return (s = t.fail) == null || s.call(t, C), Promise.reject(C);
|
|
3990
|
-
}
|
|
3991
|
-
const r = Q(!0);
|
|
3992
|
-
if (r.isAppPlus)
|
|
4133
|
+
function vt(t = {}) {
|
|
4134
|
+
return f.safeExecute(
|
|
4135
|
+
() => {
|
|
4136
|
+
var s, o, d, u, m, C, M, $, ce;
|
|
4137
|
+
let e;
|
|
3993
4138
|
try {
|
|
3994
|
-
e =
|
|
3995
|
-
} catch (
|
|
3996
|
-
return (
|
|
4139
|
+
e = fi(t);
|
|
4140
|
+
} catch (R) {
|
|
4141
|
+
return (s = t.fail) == null || s.call(t, R), Promise.reject(R);
|
|
3997
4142
|
}
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4143
|
+
const r = H(!0);
|
|
4144
|
+
if (r.isAppPlus)
|
|
4145
|
+
try {
|
|
4146
|
+
e = di(e);
|
|
4147
|
+
} catch (R) {
|
|
4148
|
+
return (o = e.fail) == null || o.call(e, R), (d = e.complete) == null || d.call(e, R), Promise.reject(R);
|
|
4149
|
+
}
|
|
4150
|
+
const n = r.isWeixinMiniProgram ? "已同步小程序卡片内容,请点击右上角“···”后发送给朋友。" : "正在拉起微信发送给朋友面板,请继续完成小程序卡片分享。";
|
|
4151
|
+
if (r.isAppPlus)
|
|
4152
|
+
return pi(e).then((R) => {
|
|
4153
|
+
var w, B;
|
|
4154
|
+
const F = p(g({}, R || {}), { hint: n });
|
|
4155
|
+
return (w = e.success) == null || w.call(e, F), (B = e.complete) == null || B.call(e, F), F;
|
|
4156
|
+
}).catch((R) => {
|
|
4157
|
+
var F, w;
|
|
4158
|
+
return (F = e.fail) == null || F.call(e, R), (w = e.complete) == null || w.call(e, R), Promise.reject(R);
|
|
4159
|
+
});
|
|
4160
|
+
if (r.isWeixinMiniProgram)
|
|
4161
|
+
try {
|
|
4162
|
+
Tt(mi(e, t.rowCustom), "shareMiniProgramCard");
|
|
4163
|
+
const R = { success: !0, hint: n };
|
|
4164
|
+
return (u = e.success) == null || u.call(e, R), (m = e.complete) == null || m.call(e, R), Promise.resolve(R);
|
|
4165
|
+
} catch (R) {
|
|
4166
|
+
return (C = e.fail) == null || C.call(e, R), (M = e.complete) == null || M.call(e, R), Promise.reject(R);
|
|
4167
|
+
}
|
|
4168
|
+
const i = { errMsg: "当前环境暂不支持 shareMiniProgramCard,请在 App 或微信小程序容器内使用。", code: "ENV_NOT_SUPPORTED" };
|
|
4169
|
+
return ($ = e.fail) == null || $.call(e, i), (ce = e.complete) == null || ce.call(e, i), Promise.reject(i);
|
|
4170
|
+
},
|
|
4171
|
+
{ context: "shareMiniProgramCard", options: t }
|
|
4172
|
+
);
|
|
4019
4173
|
}
|
|
4020
|
-
function
|
|
4174
|
+
function Ei(t = {}) {
|
|
4021
4175
|
return new Promise((e, r) => {
|
|
4022
|
-
|
|
4176
|
+
vt(p(g({}, t), { success: e, fail: r }));
|
|
4023
4177
|
});
|
|
4024
4178
|
}
|
|
4025
|
-
const
|
|
4179
|
+
const yi = {
|
|
4026
4180
|
OFF: "off",
|
|
4027
4181
|
// 蓝牙关闭
|
|
4028
4182
|
ON: "on",
|
|
@@ -4031,29 +4185,29 @@ const fi = {
|
|
|
4031
4185
|
// 不支持蓝牙
|
|
4032
4186
|
UNAUTHORIZED: "unauthorized"
|
|
4033
4187
|
// 未授权
|
|
4034
|
-
},
|
|
4188
|
+
}, Ii = {
|
|
4035
4189
|
allowDuplicatesKey: !1,
|
|
4036
4190
|
// 是否允许重复上报同一设备
|
|
4037
4191
|
services: []
|
|
4038
4192
|
// 指定服务 UUID 列表
|
|
4039
4193
|
};
|
|
4040
4194
|
function Te(t = {}) {
|
|
4041
|
-
return g(g({},
|
|
4195
|
+
return g(g({}, Ii), t);
|
|
4042
4196
|
}
|
|
4043
4197
|
function we() {
|
|
4044
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(
|
|
4198
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(l.type);
|
|
4045
4199
|
}
|
|
4046
|
-
function
|
|
4047
|
-
return
|
|
4200
|
+
function Ai(t) {
|
|
4201
|
+
return f.safeExecute(() => y(null, null, function* () {
|
|
4048
4202
|
var e;
|
|
4049
4203
|
if (!window.wx) {
|
|
4050
4204
|
const r = { errMsg: "微信JS-SDK未加载", code: "WEIXIN_SDK_NOT_LOADED" };
|
|
4051
4205
|
(e = t.fail) == null || e.call(t, r);
|
|
4052
4206
|
return;
|
|
4053
4207
|
}
|
|
4054
|
-
ee() || (a.info("等待微信配置完成"), yield
|
|
4208
|
+
ee() || (a.info("等待微信配置完成"), yield z()), wx.openBluetoothAdapter({
|
|
4055
4209
|
success: () => {
|
|
4056
|
-
a.info("微信蓝牙适配器已打开"),
|
|
4210
|
+
a.info("微信蓝牙适配器已打开"), Lt(t);
|
|
4057
4211
|
},
|
|
4058
4212
|
fail: (r) => {
|
|
4059
4213
|
var n;
|
|
@@ -4062,9 +4216,9 @@ function gi(t) {
|
|
|
4062
4216
|
});
|
|
4063
4217
|
}), { context: "openBluetoothAdapterInWeixin" });
|
|
4064
4218
|
}
|
|
4065
|
-
function
|
|
4066
|
-
return
|
|
4067
|
-
a.debug("通过 WebView 桥接调用蓝牙功能", t),
|
|
4219
|
+
function Pi(t) {
|
|
4220
|
+
return f.safeExecute(() => {
|
|
4221
|
+
a.debug("通过 WebView 桥接调用蓝牙功能", t), S("bluetooth", t, {
|
|
4068
4222
|
success: (e) => {
|
|
4069
4223
|
var r;
|
|
4070
4224
|
a.info("UniApp 蓝牙调用成功", e), (r = t.success) == null || r.call(t, e);
|
|
@@ -4077,10 +4231,10 @@ function hi(t) {
|
|
|
4077
4231
|
});
|
|
4078
4232
|
}, { context: "bluetoothInUniApp" });
|
|
4079
4233
|
}
|
|
4080
|
-
function
|
|
4081
|
-
return
|
|
4234
|
+
function _i(t) {
|
|
4235
|
+
return f.safeExecute(() => {
|
|
4082
4236
|
var e;
|
|
4083
|
-
a.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t),
|
|
4237
|
+
a.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t), S("bluetoothDevicesDiscovery", {
|
|
4084
4238
|
action: "startBluetoothDevicesDiscovery",
|
|
4085
4239
|
params: {
|
|
4086
4240
|
services: t.services || [],
|
|
@@ -4100,10 +4254,10 @@ function pi(t) {
|
|
|
4100
4254
|
}, { context: "startBluetoothDevicesDiscoveryInUniApp" });
|
|
4101
4255
|
}
|
|
4102
4256
|
const ye = /* @__PURE__ */ new Set();
|
|
4103
|
-
function
|
|
4104
|
-
return
|
|
4257
|
+
function Mi(t, e = {}) {
|
|
4258
|
+
return f.safeExecute(() => {
|
|
4105
4259
|
var r;
|
|
4106
|
-
return ye.add(t), ye.size === 1 &&
|
|
4260
|
+
return ye.add(t), ye.size === 1 && S("onBluetoothDeviceFound", {
|
|
4107
4261
|
action: "onBluetoothDeviceFound",
|
|
4108
4262
|
isPersistent: !0,
|
|
4109
4263
|
params: {
|
|
@@ -4113,7 +4267,7 @@ function mi(t, e = {}) {
|
|
|
4113
4267
|
}, {
|
|
4114
4268
|
success: (n) => {
|
|
4115
4269
|
ye.forEach((i) => {
|
|
4116
|
-
typeof i == "function" ?
|
|
4270
|
+
typeof i == "function" ? f.safeExecute(() => i(n), { context: "BluetoothDeviceCallback" }) : console.warn("[BluetoothDeviceCallback] 不是函数:", i);
|
|
4117
4271
|
});
|
|
4118
4272
|
},
|
|
4119
4273
|
fail: (n) => {
|
|
@@ -4124,10 +4278,10 @@ function mi(t, e = {}) {
|
|
|
4124
4278
|
}), () => ye.delete(t);
|
|
4125
4279
|
}, { context: "qsh_onBluetoothDeviceFound" });
|
|
4126
4280
|
}
|
|
4127
|
-
function
|
|
4128
|
-
return
|
|
4281
|
+
function Ci(t) {
|
|
4282
|
+
return f.safeExecute(() => {
|
|
4129
4283
|
var e;
|
|
4130
|
-
a.debug("通过 WebView 桥接调用蓝牙连接功能", t),
|
|
4284
|
+
a.debug("通过 WebView 桥接调用蓝牙连接功能", t), S("bluetoothConnection", {
|
|
4131
4285
|
action: "createBLEConnection",
|
|
4132
4286
|
params: {
|
|
4133
4287
|
deviceId: t.deviceId,
|
|
@@ -4147,89 +4301,89 @@ function wi(t) {
|
|
|
4147
4301
|
});
|
|
4148
4302
|
}, { context: "createBLEConnectionInUniApp" });
|
|
4149
4303
|
}
|
|
4150
|
-
function
|
|
4151
|
-
return
|
|
4304
|
+
function Ri(t = {}) {
|
|
4305
|
+
return f.safeExecute(() => {
|
|
4152
4306
|
var r;
|
|
4153
4307
|
if (!we()) {
|
|
4154
4308
|
const n = {
|
|
4155
|
-
errMsg: `当前环境 (${
|
|
4309
|
+
errMsg: `当前环境 (${l.type}) 不支持蓝牙功能`,
|
|
4156
4310
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
4157
4311
|
};
|
|
4158
|
-
a.error("平台不支持蓝牙", { platform:
|
|
4312
|
+
a.error("平台不支持蓝牙", { platform: l.type }), (r = t.fail) == null || r.call(t, n);
|
|
4159
4313
|
return;
|
|
4160
4314
|
}
|
|
4161
4315
|
const e = Te(t);
|
|
4162
4316
|
a.info("开始蓝牙操作", {
|
|
4163
|
-
platform:
|
|
4317
|
+
platform: l.type,
|
|
4164
4318
|
services: e.services,
|
|
4165
4319
|
allowDuplicatesKey: e.allowDuplicatesKey
|
|
4166
|
-
}), _() ?
|
|
4320
|
+
}), _() ? Ai(e) : Pi(e);
|
|
4167
4321
|
}, { context: "openBluetoothAdapter", options: t });
|
|
4168
4322
|
}
|
|
4169
|
-
function
|
|
4170
|
-
return
|
|
4323
|
+
function Oi(t = {}) {
|
|
4324
|
+
return f.safeExecute(() => {
|
|
4171
4325
|
var r, n;
|
|
4172
4326
|
if (!we()) {
|
|
4173
4327
|
const i = {
|
|
4174
|
-
errMsg: `当前环境 (${
|
|
4328
|
+
errMsg: `当前环境 (${l.type}) 不支持蓝牙功能`,
|
|
4175
4329
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
4176
4330
|
};
|
|
4177
|
-
a.error("平台不支持蓝牙", { platform:
|
|
4331
|
+
a.error("平台不支持蓝牙", { platform: l.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
|
|
4178
4332
|
return;
|
|
4179
4333
|
}
|
|
4180
4334
|
const e = Te(t);
|
|
4181
4335
|
a.info("开始搜索蓝牙设备", {
|
|
4182
|
-
platform:
|
|
4336
|
+
platform: l.type,
|
|
4183
4337
|
services: e.services,
|
|
4184
4338
|
allowDuplicatesKey: e.allowDuplicatesKey
|
|
4185
|
-
}), _() ? startBluetoothDevicesDiscoveryInWeixin(e) :
|
|
4339
|
+
}), _() ? startBluetoothDevicesDiscoveryInWeixin(e) : _i(e);
|
|
4186
4340
|
}, { context: "startBluetoothDevicesDiscovery", options: t });
|
|
4187
4341
|
}
|
|
4188
|
-
function
|
|
4189
|
-
return
|
|
4342
|
+
function Lt(t, e = {}) {
|
|
4343
|
+
return f.safeExecute(() => {
|
|
4190
4344
|
var n, i;
|
|
4191
4345
|
if (!we()) {
|
|
4192
4346
|
const s = {
|
|
4193
|
-
errMsg: `当前环境 (${
|
|
4347
|
+
errMsg: `当前环境 (${l.type}) 不支持蓝牙功能`,
|
|
4194
4348
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
4195
4349
|
};
|
|
4196
|
-
a.error("平台不支持蓝牙", { platform:
|
|
4350
|
+
a.error("平台不支持蓝牙", { platform: l.type }), (n = e.fail) == null || n.call(e, s), (i = e.complete) == null || i.call(e, s);
|
|
4197
4351
|
return;
|
|
4198
4352
|
}
|
|
4199
4353
|
const r = Te(e);
|
|
4200
|
-
a.info("注册蓝牙设备发现监听", { platform:
|
|
4354
|
+
a.info("注册蓝牙设备发现监听", { platform: l.type }), _() ? onBluetoothDeviceFoundInWeixin(r) : Mi(t, r);
|
|
4201
4355
|
}, { context: "onBluetoothDeviceFound", options: e });
|
|
4202
4356
|
}
|
|
4203
|
-
function
|
|
4204
|
-
return
|
|
4205
|
-
var s, o, d,
|
|
4357
|
+
function Si(t = {}) {
|
|
4358
|
+
return f.safeExecute(() => {
|
|
4359
|
+
var s, o, d, u;
|
|
4206
4360
|
if (!we()) {
|
|
4207
|
-
const
|
|
4208
|
-
errMsg: `当前环境 (${
|
|
4361
|
+
const m = {
|
|
4362
|
+
errMsg: `当前环境 (${l.type}) 不支持蓝牙功能`,
|
|
4209
4363
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
4210
4364
|
};
|
|
4211
|
-
a.error("平台不支持蓝牙连接", { platform:
|
|
4365
|
+
a.error("平台不支持蓝牙连接", { platform: l.type }), (s = t.fail) == null || s.call(t, m), (o = t.complete) == null || o.call(t, m);
|
|
4212
4366
|
return;
|
|
4213
4367
|
}
|
|
4214
4368
|
const e = Te(t), { name: r, deviceId: n, autoConnect: i = !1 } = e;
|
|
4215
4369
|
if (!n) {
|
|
4216
|
-
const
|
|
4217
|
-
(d = t.fail) == null || d.call(t,
|
|
4370
|
+
const m = { errMsg: "缺少 deviceId 参数", code: "INVALID_PARAMS" };
|
|
4371
|
+
(d = t.fail) == null || d.call(t, m), (u = t.complete) == null || u.call(t, m);
|
|
4218
4372
|
return;
|
|
4219
4373
|
}
|
|
4220
|
-
a.info("创建蓝牙连接", { deviceId: n, autoConnect: i, platform:
|
|
4374
|
+
a.info("创建蓝牙连接", { deviceId: n, autoConnect: i, platform: l.type }), _() ? uni.createBLEConnection({
|
|
4221
4375
|
deviceId: n,
|
|
4222
4376
|
autoConnect: i,
|
|
4223
4377
|
success: t.success,
|
|
4224
4378
|
fail: t.fail,
|
|
4225
4379
|
complete: t.complete
|
|
4226
|
-
}) :
|
|
4380
|
+
}) : Ci(e);
|
|
4227
4381
|
}, { context: "createBLEConnection", options: t });
|
|
4228
4382
|
}
|
|
4229
|
-
function
|
|
4383
|
+
function Ni() {
|
|
4230
4384
|
return {
|
|
4231
4385
|
supported: we(),
|
|
4232
|
-
environment:
|
|
4386
|
+
environment: l.type,
|
|
4233
4387
|
implementation: _() ? "weixin" : "webview",
|
|
4234
4388
|
features: {
|
|
4235
4389
|
discovery: !0,
|
|
@@ -4240,18 +4394,18 @@ function Ai() {
|
|
|
4240
4394
|
}
|
|
4241
4395
|
};
|
|
4242
4396
|
}
|
|
4243
|
-
const
|
|
4397
|
+
const Ti = {
|
|
4244
4398
|
// TODO: 添加更多默认配置
|
|
4245
4399
|
};
|
|
4246
|
-
function
|
|
4247
|
-
return g(g({},
|
|
4400
|
+
function bi(t = {}) {
|
|
4401
|
+
return g(g({}, Ti), t);
|
|
4248
4402
|
}
|
|
4249
|
-
function
|
|
4250
|
-
return ["webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(
|
|
4403
|
+
function xt() {
|
|
4404
|
+
return ["webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(l.type);
|
|
4251
4405
|
}
|
|
4252
|
-
function
|
|
4253
|
-
return
|
|
4254
|
-
a.debug("通过 WebView 桥接调用打印PDF", t),
|
|
4406
|
+
function vi(t) {
|
|
4407
|
+
return f.safeExecute(() => {
|
|
4408
|
+
a.debug("通过 WebView 桥接调用打印PDF", t), S("printPdf", p(g({}, t), {
|
|
4255
4409
|
isPersistent: !0
|
|
4256
4410
|
// 强制禁用超时自动清理
|
|
4257
4411
|
}), {
|
|
@@ -4270,28 +4424,28 @@ function Ci(t) {
|
|
|
4270
4424
|
platform: "uniapp"
|
|
4271
4425
|
});
|
|
4272
4426
|
}
|
|
4273
|
-
function
|
|
4274
|
-
return
|
|
4427
|
+
function Li(t = {}) {
|
|
4428
|
+
return f.safeExecute(() => {
|
|
4275
4429
|
var r;
|
|
4276
|
-
if (!
|
|
4430
|
+
if (!xt()) {
|
|
4277
4431
|
const n = {
|
|
4278
|
-
errMsg: `当前环境 (${
|
|
4432
|
+
errMsg: `当前环境 (${l.type}) 不支持打印PDF功能`,
|
|
4279
4433
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
4280
4434
|
};
|
|
4281
|
-
a.error("平台不支持打印PDF", { platform:
|
|
4435
|
+
a.error("平台不支持打印PDF", { platform: l.type }), (r = t.fail) == null || r.call(t, n);
|
|
4282
4436
|
return;
|
|
4283
4437
|
}
|
|
4284
|
-
const e =
|
|
4285
|
-
a.info("开始打印PDF", { platform:
|
|
4438
|
+
const e = bi(t);
|
|
4439
|
+
a.info("开始打印PDF", { platform: l.type }), vi(e);
|
|
4286
4440
|
}, {
|
|
4287
4441
|
context: "printPdf",
|
|
4288
4442
|
options: t
|
|
4289
4443
|
});
|
|
4290
4444
|
}
|
|
4291
|
-
function
|
|
4445
|
+
function xi() {
|
|
4292
4446
|
return {
|
|
4293
|
-
supported:
|
|
4294
|
-
environment:
|
|
4447
|
+
supported: xt(),
|
|
4448
|
+
environment: l.type,
|
|
4295
4449
|
implementation: "uniapp",
|
|
4296
4450
|
features: {
|
|
4297
4451
|
asyncSupport: !0
|
|
@@ -4299,7 +4453,7 @@ function Ri() {
|
|
|
4299
4453
|
};
|
|
4300
4454
|
}
|
|
4301
4455
|
const xe = "/pages/face/index";
|
|
4302
|
-
function
|
|
4456
|
+
function Di(t = {}) {
|
|
4303
4457
|
const e = g({}, t);
|
|
4304
4458
|
if (!e.name || typeof e.name != "string" || !e.name.trim())
|
|
4305
4459
|
throw {
|
|
@@ -4313,26 +4467,26 @@ function Oi(t = {}) {
|
|
|
4313
4467
|
};
|
|
4314
4468
|
return e.idCardNumber = e.idCardNumber.trim(), e;
|
|
4315
4469
|
}
|
|
4316
|
-
function
|
|
4317
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(
|
|
4470
|
+
function Dt() {
|
|
4471
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(l.type);
|
|
4318
4472
|
}
|
|
4319
|
-
function
|
|
4473
|
+
function Ui() {
|
|
4320
4474
|
return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.navigateTo == "function";
|
|
4321
4475
|
}
|
|
4322
|
-
function
|
|
4323
|
-
const e =
|
|
4476
|
+
function Wi(t) {
|
|
4477
|
+
const e = p(g({}, t), {
|
|
4324
4478
|
title: document.title || "",
|
|
4325
4479
|
url: window.location.href || ""
|
|
4326
4480
|
}), r = Object.entries(e).filter(([, n]) => n != null && n !== "").map(([n, i]) => `${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`).join("&");
|
|
4327
4481
|
return r ? `${xe}?${r}` : xe;
|
|
4328
4482
|
}
|
|
4329
|
-
function
|
|
4330
|
-
return
|
|
4331
|
-
if (!
|
|
4483
|
+
function $i(t) {
|
|
4484
|
+
return f.safeExecute(() => {
|
|
4485
|
+
if (!Ui()) {
|
|
4332
4486
|
a.error("微信小程序导航API不可用");
|
|
4333
4487
|
return;
|
|
4334
4488
|
}
|
|
4335
|
-
const e =
|
|
4489
|
+
const e = Wi(t);
|
|
4336
4490
|
a.debug("跳转宿主人脸识别页面", {
|
|
4337
4491
|
name: t.name,
|
|
4338
4492
|
targetUrl: e
|
|
@@ -4350,12 +4504,12 @@ function Ti(t) {
|
|
|
4350
4504
|
platform: "weixin"
|
|
4351
4505
|
});
|
|
4352
4506
|
}
|
|
4353
|
-
function
|
|
4354
|
-
return
|
|
4507
|
+
function Fi(t) {
|
|
4508
|
+
return f.safeExecute(() => {
|
|
4355
4509
|
a.debug("通过 WebView 桥接调用人脸识别", {
|
|
4356
|
-
platform:
|
|
4510
|
+
platform: l.type,
|
|
4357
4511
|
name: t.name
|
|
4358
|
-
}),
|
|
4512
|
+
}), S("faceVerify", g({}, t), {
|
|
4359
4513
|
success: (e) => {
|
|
4360
4514
|
a.info("UniApp 人脸识别调用成功", e);
|
|
4361
4515
|
},
|
|
@@ -4368,59 +4522,59 @@ function bi(t) {
|
|
|
4368
4522
|
platform: "uniapp"
|
|
4369
4523
|
});
|
|
4370
4524
|
}
|
|
4371
|
-
function
|
|
4372
|
-
return
|
|
4373
|
-
if (!
|
|
4374
|
-
a.error("平台不支持人脸识别", { platform:
|
|
4525
|
+
function Bi(t = {}) {
|
|
4526
|
+
return f.safeExecute(() => {
|
|
4527
|
+
if (!Dt()) {
|
|
4528
|
+
a.error("平台不支持人脸识别", { platform: l.type });
|
|
4375
4529
|
return;
|
|
4376
4530
|
}
|
|
4377
4531
|
let e;
|
|
4378
4532
|
try {
|
|
4379
|
-
e =
|
|
4533
|
+
e = Di(t);
|
|
4380
4534
|
} catch (r) {
|
|
4381
4535
|
a.error("人脸识别参数校验失败", r);
|
|
4382
4536
|
return;
|
|
4383
4537
|
}
|
|
4384
4538
|
if (a.info("开始人脸识别", {
|
|
4385
|
-
platform:
|
|
4539
|
+
platform: l.type,
|
|
4386
4540
|
name: e.name,
|
|
4387
4541
|
pagePath: xe
|
|
4388
4542
|
}), _()) {
|
|
4389
|
-
|
|
4543
|
+
$i(e);
|
|
4390
4544
|
return;
|
|
4391
4545
|
}
|
|
4392
|
-
|
|
4546
|
+
Fi(e);
|
|
4393
4547
|
}, {
|
|
4394
4548
|
context: "faceVerify",
|
|
4395
4549
|
options: t
|
|
4396
4550
|
});
|
|
4397
4551
|
}
|
|
4398
|
-
function
|
|
4552
|
+
function ki() {
|
|
4399
4553
|
let t = "weixin";
|
|
4400
|
-
return
|
|
4401
|
-
supported:
|
|
4402
|
-
environment:
|
|
4554
|
+
return l.type === "UniApp" && (t = "uniapp"), {
|
|
4555
|
+
supported: Dt(),
|
|
4556
|
+
environment: l.type,
|
|
4403
4557
|
implementation: t,
|
|
4404
4558
|
features: {
|
|
4405
4559
|
asyncSupport: !0,
|
|
4406
4560
|
hostPageNavigation: _(),
|
|
4407
|
-
hostBridge:
|
|
4561
|
+
hostBridge: l.type === "UniApp"
|
|
4408
4562
|
}
|
|
4409
4563
|
};
|
|
4410
4564
|
}
|
|
4411
|
-
const
|
|
4412
|
-
function
|
|
4413
|
-
if (typeof window == "undefined" || !
|
|
4565
|
+
const Ut = H();
|
|
4566
|
+
function Gi() {
|
|
4567
|
+
if (typeof window == "undefined" || !H(!0).isWeixinMiniProgram)
|
|
4414
4568
|
return !1;
|
|
4415
4569
|
const e = ve().getRuntimeConfig();
|
|
4416
4570
|
return typeof e.clientId == "string" && e.clientId.length > 0;
|
|
4417
4571
|
}
|
|
4418
|
-
function
|
|
4419
|
-
return
|
|
4420
|
-
yield
|
|
4572
|
+
function Ki() {
|
|
4573
|
+
return y(this, null, function* () {
|
|
4574
|
+
yield cr(), Gi() && (yield z());
|
|
4421
4575
|
});
|
|
4422
4576
|
}
|
|
4423
|
-
|
|
4577
|
+
Y.useResponse(ct.response, { priority: 1e3 });
|
|
4424
4578
|
let Ze = !1;
|
|
4425
4579
|
function Qe() {
|
|
4426
4580
|
if (Ze) return;
|
|
@@ -4434,179 +4588,179 @@ function Qe() {
|
|
|
4434
4588
|
});
|
|
4435
4589
|
}
|
|
4436
4590
|
typeof window != "undefined" && (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(Qe, 0) : document.addEventListener("DOMContentLoaded", Qe));
|
|
4437
|
-
function
|
|
4591
|
+
function E(t, { apiName: e } = {}) {
|
|
4438
4592
|
return function(r = {}, ...n) {
|
|
4439
|
-
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((
|
|
4440
|
-
const
|
|
4441
|
-
success: (
|
|
4442
|
-
typeof s.success == "function" && s.success(
|
|
4593
|
+
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((u, m) => {
|
|
4594
|
+
const C = p(g({}, s), {
|
|
4595
|
+
success: (M) => {
|
|
4596
|
+
typeof s.success == "function" && s.success(M), u(M);
|
|
4443
4597
|
},
|
|
4444
|
-
fail: (
|
|
4445
|
-
typeof s.fail == "function" && s.fail(
|
|
4598
|
+
fail: (M) => {
|
|
4599
|
+
typeof s.fail == "function" && s.fail(M), m(M);
|
|
4446
4600
|
},
|
|
4447
4601
|
complete: s.complete
|
|
4448
4602
|
});
|
|
4449
|
-
t(
|
|
4603
|
+
t(C, ...n);
|
|
4450
4604
|
});
|
|
4451
|
-
return (typeof window == "undefined" ? Promise.resolve() : rt()).then(() => o()).catch((
|
|
4452
|
-
throw console.error(`[QSH-SDK] ${e || "API"} call failed:`,
|
|
4605
|
+
return (typeof window == "undefined" ? Promise.resolve() : rt()).then(() => o()).catch((u) => {
|
|
4606
|
+
throw console.error(`[QSH-SDK] ${e || "API"} call failed:`, u), u;
|
|
4453
4607
|
});
|
|
4454
4608
|
};
|
|
4455
4609
|
}
|
|
4456
4610
|
function Ie(t) {
|
|
4457
4611
|
return typeof t == "function" ? { success: t } : t && typeof t == "object" ? t : {};
|
|
4458
4612
|
}
|
|
4459
|
-
const
|
|
4460
|
-
function
|
|
4461
|
-
const e = () =>
|
|
4613
|
+
const Wt = E(Xr), $t = E(Zr), Ft = E(Qr), Bt = E(en), kt = E(tn), Gt = E(rn);
|
|
4614
|
+
function Kt(t) {
|
|
4615
|
+
const e = () => nn(t);
|
|
4462
4616
|
return (typeof window == "undefined" ? Promise.resolve() : rt()).then(() => e());
|
|
4463
4617
|
}
|
|
4464
|
-
const Fe =
|
|
4465
|
-
function
|
|
4618
|
+
const Fe = E(ln, { apiName: "getCode" });
|
|
4619
|
+
function Vi(t = {}) {
|
|
4466
4620
|
return new Promise((e, r) => {
|
|
4467
|
-
Fe(
|
|
4621
|
+
Fe(p(g({}, t), {
|
|
4468
4622
|
success: e,
|
|
4469
4623
|
fail: r
|
|
4470
4624
|
}));
|
|
4471
4625
|
});
|
|
4472
4626
|
}
|
|
4473
|
-
const Be =
|
|
4627
|
+
const Be = E(mn, {
|
|
4474
4628
|
apiName: "navigateToMiniProgram"
|
|
4475
4629
|
});
|
|
4476
|
-
function
|
|
4630
|
+
function qi(t = {}) {
|
|
4477
4631
|
return new Promise((e, r) => {
|
|
4478
|
-
Be(
|
|
4632
|
+
Be(p(g({}, t), {
|
|
4479
4633
|
success: e,
|
|
4480
4634
|
fail: r
|
|
4481
4635
|
}));
|
|
4482
4636
|
});
|
|
4483
4637
|
}
|
|
4484
|
-
const ke =
|
|
4485
|
-
function
|
|
4638
|
+
const ke = E(Rn);
|
|
4639
|
+
function ji(t = {}) {
|
|
4486
4640
|
return new Promise((e, r) => {
|
|
4487
|
-
ke(
|
|
4641
|
+
ke(p(g({}, t), {
|
|
4488
4642
|
success: e,
|
|
4489
4643
|
fail: r
|
|
4490
4644
|
}));
|
|
4491
4645
|
});
|
|
4492
4646
|
}
|
|
4493
|
-
const
|
|
4494
|
-
function
|
|
4647
|
+
const Vt = E(Li);
|
|
4648
|
+
function Ji(t = {}) {
|
|
4495
4649
|
return new Promise((e, r) => {
|
|
4496
|
-
|
|
4650
|
+
Vt(p(g({}, t), {
|
|
4497
4651
|
success: e,
|
|
4498
4652
|
fail: r
|
|
4499
4653
|
}));
|
|
4500
4654
|
});
|
|
4501
4655
|
}
|
|
4502
|
-
const Ge =
|
|
4503
|
-
function
|
|
4656
|
+
const Ge = E(vn), Hi = E(Bi);
|
|
4657
|
+
function zi(t = {}) {
|
|
4504
4658
|
return new Promise((e, r) => {
|
|
4505
|
-
Ge(
|
|
4659
|
+
Ge(p(g({}, t), {
|
|
4506
4660
|
success: e,
|
|
4507
4661
|
fail: r
|
|
4508
4662
|
}));
|
|
4509
4663
|
});
|
|
4510
4664
|
}
|
|
4511
|
-
const
|
|
4512
|
-
function
|
|
4665
|
+
const Yi = E(bt, { apiName: "shareDirected" }), Xi = E(wi, { apiName: "shareDirectedAsync" }), Zi = E(Et, { apiName: "manualShare" }), Qi = E(Pn, { apiName: "manualShareAsync" }), Ke = E(kn);
|
|
4666
|
+
function ea(t = {}) {
|
|
4513
4667
|
return new Promise((e, r) => {
|
|
4514
|
-
Ke(
|
|
4668
|
+
Ke(p(g({}, t), {
|
|
4515
4669
|
success: e,
|
|
4516
4670
|
fail: r
|
|
4517
4671
|
}));
|
|
4518
4672
|
});
|
|
4519
4673
|
}
|
|
4520
|
-
const Ve =
|
|
4521
|
-
function
|
|
4674
|
+
const Ve = E(Gn);
|
|
4675
|
+
function ta(t = {}) {
|
|
4522
4676
|
return new Promise((e, r) => {
|
|
4523
|
-
Ve(
|
|
4677
|
+
Ve(p(g({}, t), {
|
|
4524
4678
|
success: e,
|
|
4525
4679
|
fail: r
|
|
4526
4680
|
}));
|
|
4527
4681
|
});
|
|
4528
4682
|
}
|
|
4529
|
-
const qe =
|
|
4530
|
-
function
|
|
4683
|
+
const qe = E(Qn);
|
|
4684
|
+
function ra(t = {}) {
|
|
4531
4685
|
return new Promise((e, r) => {
|
|
4532
|
-
qe(
|
|
4686
|
+
qe(p(g({}, t), {
|
|
4533
4687
|
success: e,
|
|
4534
4688
|
fail: r
|
|
4535
4689
|
}));
|
|
4536
4690
|
});
|
|
4537
4691
|
}
|
|
4538
|
-
const
|
|
4539
|
-
function
|
|
4692
|
+
const qt = E(Ri);
|
|
4693
|
+
function na(t = {}) {
|
|
4540
4694
|
return new Promise((e, r) => {
|
|
4541
|
-
|
|
4695
|
+
qt(p(g({}, t), {
|
|
4542
4696
|
success: e,
|
|
4543
4697
|
fail: r
|
|
4544
4698
|
}));
|
|
4545
4699
|
});
|
|
4546
4700
|
}
|
|
4547
|
-
const
|
|
4548
|
-
function
|
|
4701
|
+
const jt = E(Oi);
|
|
4702
|
+
function ia(t = {}) {
|
|
4549
4703
|
return new Promise((e, r) => {
|
|
4550
|
-
|
|
4704
|
+
jt(p(g({}, t), {
|
|
4551
4705
|
success: e,
|
|
4552
4706
|
fail: r
|
|
4553
4707
|
}));
|
|
4554
4708
|
});
|
|
4555
4709
|
}
|
|
4556
|
-
const
|
|
4557
|
-
function
|
|
4710
|
+
const Jt = E(Lt);
|
|
4711
|
+
function aa(t = {}) {
|
|
4558
4712
|
return new Promise((e, r) => {
|
|
4559
|
-
|
|
4713
|
+
Jt(p(g({}, t), {
|
|
4560
4714
|
success: e,
|
|
4561
4715
|
fail: r
|
|
4562
4716
|
}));
|
|
4563
4717
|
});
|
|
4564
4718
|
}
|
|
4565
|
-
const
|
|
4566
|
-
function
|
|
4719
|
+
const Ht = E(Si);
|
|
4720
|
+
function sa(t = {}) {
|
|
4567
4721
|
return new Promise((e, r) => {
|
|
4568
|
-
|
|
4722
|
+
Ht(p(g({}, t), {
|
|
4569
4723
|
success: e,
|
|
4570
4724
|
fail: r
|
|
4571
4725
|
}));
|
|
4572
4726
|
});
|
|
4573
4727
|
}
|
|
4574
|
-
const
|
|
4728
|
+
const oa = E(vt, { apiName: "shareMiniProgramCard" }), ca = E(Ei, { apiName: "shareMiniProgramCardAsync" }), oe = {
|
|
4575
4729
|
// 导航 API
|
|
4576
|
-
navigateTo:
|
|
4577
|
-
navigateBack:
|
|
4578
|
-
switchTab:
|
|
4579
|
-
reLaunch:
|
|
4580
|
-
redirectTo:
|
|
4730
|
+
navigateTo: Wt,
|
|
4731
|
+
navigateBack: $t,
|
|
4732
|
+
switchTab: Ft,
|
|
4733
|
+
reLaunch: Bt,
|
|
4734
|
+
redirectTo: kt,
|
|
4581
4735
|
// 消息 API
|
|
4582
|
-
postMessage:
|
|
4583
|
-
getEnv:
|
|
4736
|
+
postMessage: Gt,
|
|
4737
|
+
getEnv: Kt,
|
|
4584
4738
|
getCode: Fe,
|
|
4585
|
-
getCodeAsync:
|
|
4739
|
+
getCodeAsync: Vi,
|
|
4586
4740
|
navigateToMiniProgram: Be,
|
|
4587
|
-
navigateToMiniProgramAsync:
|
|
4741
|
+
navigateToMiniProgramAsync: qi,
|
|
4588
4742
|
// 图片 API
|
|
4589
4743
|
chooseImage: ke,
|
|
4590
|
-
chooseImageAsync:
|
|
4744
|
+
chooseImageAsync: ji,
|
|
4591
4745
|
// 扫码 API
|
|
4592
4746
|
scanCode: Ge,
|
|
4593
|
-
scanCodeAsync:
|
|
4747
|
+
scanCodeAsync: zi,
|
|
4594
4748
|
// 位置 API
|
|
4595
4749
|
getLocation: Ke,
|
|
4596
|
-
getLocationAsync:
|
|
4750
|
+
getLocationAsync: ea,
|
|
4597
4751
|
openLocation: Ve,
|
|
4598
|
-
openLocationAsync:
|
|
4752
|
+
openLocationAsync: ta,
|
|
4599
4753
|
chooseLocation: qe,
|
|
4600
|
-
chooseLocationAsync:
|
|
4754
|
+
chooseLocationAsync: ra,
|
|
4601
4755
|
// 位置监听 API(保留回调签名)
|
|
4602
|
-
onLocationChange: (t) =>
|
|
4603
|
-
offLocationChange: (t) =>
|
|
4604
|
-
onLocationChangeError: (t) =>
|
|
4605
|
-
offLocationChangeError: (t) =>
|
|
4606
|
-
startLocationUpdate:
|
|
4607
|
-
stopLocationUpdate:
|
|
4756
|
+
onLocationChange: (t) => E((e = {}) => jn(e.success), { apiName: "onLocationChange" })(Ie(t)),
|
|
4757
|
+
offLocationChange: (t) => E((e = {}) => Jn(e.success), { apiName: "offLocationChange" })(Ie(t)),
|
|
4758
|
+
onLocationChangeError: (t) => E((e = {}) => Hn(e.success), { apiName: "onLocationChangeError" })(Ie(t)),
|
|
4759
|
+
offLocationChangeError: (t) => E((e = {}) => zn(e.success), { apiName: "offLocationChangeError" })(Ie(t)),
|
|
4760
|
+
startLocationUpdate: E(Vn, { apiName: "startLocationUpdate" }),
|
|
4761
|
+
stopLocationUpdate: E(qn, { apiName: "stopLocationUpdate" }),
|
|
4608
4762
|
// 环境信息
|
|
4609
|
-
environment:
|
|
4763
|
+
environment: Ut,
|
|
4610
4764
|
/**
|
|
4611
4765
|
* Wait for SDK readiness.
|
|
4612
4766
|
* In Weixin mini-program web-view, if qsh.config({ clientId }) was called,
|
|
@@ -4616,7 +4770,7 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4616
4770
|
* await qsh.ready()
|
|
4617
4771
|
* @since 2.0.0
|
|
4618
4772
|
*/
|
|
4619
|
-
ready:
|
|
4773
|
+
ready: Ki,
|
|
4620
4774
|
/**
|
|
4621
4775
|
* 手动初始化 JSBridge
|
|
4622
4776
|
* 默认会在 DOM 就绪时自动初始化;如需更早或手动控制,可调用本方法。
|
|
@@ -4633,7 +4787,7 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4633
4787
|
* if (qsh.isReady()) { console.log('ready') }
|
|
4634
4788
|
* @since 2.0.0
|
|
4635
4789
|
*/
|
|
4636
|
-
isReady:
|
|
4790
|
+
isReady: rr,
|
|
4637
4791
|
/**
|
|
4638
4792
|
* 获取当前 SDK 状态
|
|
4639
4793
|
* @returns {string}
|
|
@@ -4641,8 +4795,8 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4641
4795
|
* console.log(qsh.getState()) // 'ready'
|
|
4642
4796
|
* @since 2.0.0
|
|
4643
4797
|
*/
|
|
4644
|
-
getState:
|
|
4645
|
-
config:
|
|
4798
|
+
getState: nr,
|
|
4799
|
+
config: He,
|
|
4646
4800
|
// 微信配置 API
|
|
4647
4801
|
weixin: {
|
|
4648
4802
|
/**
|
|
@@ -4652,8 +4806,8 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4652
4806
|
* await qsh.weixin.waitForConfig()
|
|
4653
4807
|
* @since 2.0.0
|
|
4654
4808
|
*/
|
|
4655
|
-
config:
|
|
4656
|
-
waitForConfig:
|
|
4809
|
+
config: He,
|
|
4810
|
+
waitForConfig: z,
|
|
4657
4811
|
/**
|
|
4658
4812
|
* 检查微信配置是否完成
|
|
4659
4813
|
* @returns {boolean}
|
|
@@ -4669,7 +4823,7 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4669
4823
|
* console.log(qsh.weixin.getConfigState()) // 'configured'
|
|
4670
4824
|
* @since 2.0.0
|
|
4671
4825
|
*/
|
|
4672
|
-
getConfigState:
|
|
4826
|
+
getConfigState: gr,
|
|
4673
4827
|
/**
|
|
4674
4828
|
* 手动重试微信配置
|
|
4675
4829
|
* @returns {Promise<void>}
|
|
@@ -4677,13 +4831,13 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4677
4831
|
* await qsh.weixin.retryConfig()
|
|
4678
4832
|
* @since 2.0.0
|
|
4679
4833
|
*/
|
|
4680
|
-
retryConfig:
|
|
4834
|
+
retryConfig: hr
|
|
4681
4835
|
},
|
|
4682
4836
|
// WebView 对象(兼容旧版本)
|
|
4683
4837
|
webView: null,
|
|
4684
4838
|
// 图片相关常量
|
|
4685
4839
|
ImageSourceTypes: _e,
|
|
4686
|
-
ImageSizeTypes:
|
|
4840
|
+
ImageSizeTypes: Me,
|
|
4687
4841
|
/**
|
|
4688
4842
|
* 获取图片功能能力信息
|
|
4689
4843
|
* @returns {Object} 能力信息对象
|
|
@@ -4692,9 +4846,9 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4692
4846
|
* console.log('是否支持:', capabilities.supported)
|
|
4693
4847
|
* @since 2.0.0
|
|
4694
4848
|
*/
|
|
4695
|
-
getImageCapabilities:
|
|
4849
|
+
getImageCapabilities: On,
|
|
4696
4850
|
// 扫码相关常量
|
|
4697
|
-
ScanTypes:
|
|
4851
|
+
ScanTypes: Z,
|
|
4698
4852
|
/**
|
|
4699
4853
|
* 获取扫码功能能力信息
|
|
4700
4854
|
* @returns {Object} 能力信息对象
|
|
@@ -4703,7 +4857,7 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4703
4857
|
* console.log('是否支持:', capabilities.supported)
|
|
4704
4858
|
* @since 2.1.0
|
|
4705
4859
|
*/
|
|
4706
|
-
getScanCapabilities:
|
|
4860
|
+
getScanCapabilities: Ln,
|
|
4707
4861
|
// 位置相关常量
|
|
4708
4862
|
CoordinateTypes: se,
|
|
4709
4863
|
/**
|
|
@@ -4714,7 +4868,7 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4714
4868
|
* console.log('是否支持:', capabilities.supported)
|
|
4715
4869
|
* @since 2.1.0
|
|
4716
4870
|
*/
|
|
4717
|
-
getLocationCapabilities:
|
|
4871
|
+
getLocationCapabilities: Kn,
|
|
4718
4872
|
/**
|
|
4719
4873
|
* 获取位置选择功能能力信息
|
|
4720
4874
|
* @returns {Object} 能力信息对象
|
|
@@ -4723,25 +4877,28 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4723
4877
|
* console.log('是否支持:', capabilities.supported)
|
|
4724
4878
|
* @since 2.1.0
|
|
4725
4879
|
*/
|
|
4726
|
-
getChooseLocationCapabilities:
|
|
4880
|
+
getChooseLocationCapabilities: ei,
|
|
4727
4881
|
// 蓝牙 API
|
|
4728
|
-
openBluetoothAdapter:
|
|
4729
|
-
openBluetoothAdapterAsync:
|
|
4730
|
-
startBluetoothDevicesDiscovery:
|
|
4731
|
-
startBluetoothDevicesDiscoveryAsync:
|
|
4732
|
-
onBluetoothDeviceFound:
|
|
4733
|
-
onBluetoothDeviceFoundAsync:
|
|
4734
|
-
createBLEConnection:
|
|
4735
|
-
createBLEConnectionAsync:
|
|
4882
|
+
openBluetoothAdapter: qt,
|
|
4883
|
+
openBluetoothAdapterAsync: na,
|
|
4884
|
+
startBluetoothDevicesDiscovery: jt,
|
|
4885
|
+
startBluetoothDevicesDiscoveryAsync: ia,
|
|
4886
|
+
onBluetoothDeviceFound: Jt,
|
|
4887
|
+
onBluetoothDeviceFoundAsync: aa,
|
|
4888
|
+
createBLEConnection: Ht,
|
|
4889
|
+
createBLEConnectionAsync: sa,
|
|
4736
4890
|
// 蓝牙相关常量
|
|
4737
|
-
BluetoothStates:
|
|
4891
|
+
BluetoothStates: yi,
|
|
4738
4892
|
//微信分享(定向模块)
|
|
4739
4893
|
/** 定向分享模块:仅 H5->宿主 WebView,图文/文字/图片到微信会话/朋友圈 */
|
|
4740
|
-
shareDirected:
|
|
4741
|
-
shareDirectedAsync:
|
|
4894
|
+
shareDirected: Yi,
|
|
4895
|
+
shareDirectedAsync: Xi,
|
|
4896
|
+
/** 手动分享预览:仅微信小程序 web-view,通过 postMessage + navigateBack 触发宿主弹窗 */
|
|
4897
|
+
manualShare: Zi,
|
|
4898
|
+
manualShareAsync: Qi,
|
|
4742
4899
|
/** 微信小程序卡片:仅发送给朋友,不改现有 shareDirected */
|
|
4743
|
-
shareMiniProgramCard:
|
|
4744
|
-
shareMiniProgramCardAsync:
|
|
4900
|
+
shareMiniProgramCard: oa,
|
|
4901
|
+
shareMiniProgramCardAsync: ca,
|
|
4745
4902
|
/**
|
|
4746
4903
|
* 获取蓝牙功能能力信息
|
|
4747
4904
|
* @returns {Object} 能力信息对象
|
|
@@ -4749,10 +4906,10 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4749
4906
|
* const capabilities = qsh.getBluetoothCapabilities()
|
|
4750
4907
|
* console.log('是否支持:', capabilities.supported)
|
|
4751
4908
|
*/
|
|
4752
|
-
getBluetoothCapabilities:
|
|
4909
|
+
getBluetoothCapabilities: Ni,
|
|
4753
4910
|
// 打印PDF API
|
|
4754
|
-
printPdf:
|
|
4755
|
-
printPdfAsync:
|
|
4911
|
+
printPdf: Vt,
|
|
4912
|
+
printPdfAsync: Ji,
|
|
4756
4913
|
/**
|
|
4757
4914
|
* 获取打印PDF功能能力信息
|
|
4758
4915
|
* @returns {Object} 能力信息对象
|
|
@@ -4760,10 +4917,10 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4760
4917
|
* const capabilities = qsh.getPrintCapabilities()
|
|
4761
4918
|
* console.log('是否支持:', capabilities.supported)
|
|
4762
4919
|
*/
|
|
4763
|
-
getPrintCapabilities:
|
|
4920
|
+
getPrintCapabilities: xi,
|
|
4764
4921
|
// 人脸识别 API(仅支持微信小程序环境)
|
|
4765
|
-
faceVerify:
|
|
4766
|
-
getFaceCapabilities:
|
|
4922
|
+
faceVerify: Hi,
|
|
4923
|
+
getFaceCapabilities: ki,
|
|
4767
4924
|
// 插件系统
|
|
4768
4925
|
plugins: {
|
|
4769
4926
|
/**
|
|
@@ -4799,7 +4956,7 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4799
4956
|
/**
|
|
4800
4957
|
* 拦截器链
|
|
4801
4958
|
*/
|
|
4802
|
-
chain:
|
|
4959
|
+
chain: Y,
|
|
4803
4960
|
/**
|
|
4804
4961
|
* 注册请求拦截器
|
|
4805
4962
|
* @param {Function} interceptor - 拦截器函数
|
|
@@ -4811,7 +4968,7 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4811
4968
|
* return ctx
|
|
4812
4969
|
* })
|
|
4813
4970
|
*/
|
|
4814
|
-
useRequest: (t, e) =>
|
|
4971
|
+
useRequest: (t, e) => Y.useRequest(t, e),
|
|
4815
4972
|
/**
|
|
4816
4973
|
* 注册响应拦截器
|
|
4817
4974
|
* @param {Function} interceptor - 拦截器函数
|
|
@@ -4823,15 +4980,15 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4823
4980
|
* return result
|
|
4824
4981
|
* })
|
|
4825
4982
|
*/
|
|
4826
|
-
useResponse: (t, e) =>
|
|
4983
|
+
useResponse: (t, e) => Y.useResponse(t, e),
|
|
4827
4984
|
/**
|
|
4828
4985
|
* 内置拦截器
|
|
4829
4986
|
*/
|
|
4830
4987
|
builtin: {
|
|
4831
|
-
logging:
|
|
4988
|
+
logging: wr,
|
|
4832
4989
|
performance: q,
|
|
4833
|
-
createRetry:
|
|
4834
|
-
createValidation:
|
|
4990
|
+
createRetry: Er,
|
|
4991
|
+
createValidation: yr,
|
|
4835
4992
|
errorNormalizer: ct
|
|
4836
4993
|
}
|
|
4837
4994
|
},
|
|
@@ -4877,7 +5034,7 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4877
5034
|
* @example
|
|
4878
5035
|
* const error = qsh.errors.create('E_IMG_001', { apiName: 'chooseImage' })
|
|
4879
5036
|
*/
|
|
4880
|
-
create:
|
|
5037
|
+
create: Rr,
|
|
4881
5038
|
/**
|
|
4882
5039
|
* 判断是否为标准错误
|
|
4883
5040
|
* @param {any} error - 错误对象
|
|
@@ -4885,7 +5042,7 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4885
5042
|
* @example
|
|
4886
5043
|
* if (qsh.errors.isStandard(error)) { ... }
|
|
4887
5044
|
*/
|
|
4888
|
-
isStandard:
|
|
5045
|
+
isStandard: Or
|
|
4889
5046
|
},
|
|
4890
5047
|
// 状态管理
|
|
4891
5048
|
store: {
|
|
@@ -4941,11 +5098,11 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4941
5098
|
/**
|
|
4942
5099
|
* 错误处理器
|
|
4943
5100
|
*/
|
|
4944
|
-
errorHandler:
|
|
5101
|
+
errorHandler: f,
|
|
4945
5102
|
/**
|
|
4946
5103
|
* 状态管理器
|
|
4947
5104
|
*/
|
|
4948
|
-
stateManager:
|
|
5105
|
+
stateManager: X,
|
|
4949
5106
|
/**
|
|
4950
5107
|
* 启用调试模式
|
|
4951
5108
|
* @example
|
|
@@ -4968,10 +5125,10 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4968
5125
|
*/
|
|
4969
5126
|
getStats: () => ({
|
|
4970
5127
|
logger: v.getStats(),
|
|
4971
|
-
state:
|
|
5128
|
+
state: X.getStats(),
|
|
4972
5129
|
weixinConfig: ve().getStats(),
|
|
4973
5130
|
plugins: fe.getStats(),
|
|
4974
|
-
interceptors:
|
|
5131
|
+
interceptors: Y.getStats(),
|
|
4975
5132
|
store: G.getStats()
|
|
4976
5133
|
}),
|
|
4977
5134
|
/**
|
|
@@ -4990,14 +5147,14 @@ const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "sh
|
|
|
4990
5147
|
exportDebugInfo: () => v.exportToJSON()
|
|
4991
5148
|
}
|
|
4992
5149
|
};
|
|
4993
|
-
|
|
4994
|
-
navigateTo:
|
|
4995
|
-
navigateBack:
|
|
4996
|
-
switchTab:
|
|
4997
|
-
reLaunch:
|
|
4998
|
-
redirectTo:
|
|
4999
|
-
postMessage:
|
|
5000
|
-
getEnv:
|
|
5150
|
+
Ut.isWeixinMiniProgram ? oe.webView = window.wx && window.wx.miniProgram : oe.webView = {
|
|
5151
|
+
navigateTo: Wt,
|
|
5152
|
+
navigateBack: $t,
|
|
5153
|
+
switchTab: Ft,
|
|
5154
|
+
reLaunch: Bt,
|
|
5155
|
+
redirectTo: kt,
|
|
5156
|
+
postMessage: Gt,
|
|
5157
|
+
getEnv: Kt,
|
|
5001
5158
|
getCode: Fe,
|
|
5002
5159
|
navigateToMiniProgram: Be,
|
|
5003
5160
|
chooseImage: ke,
|