qsh-webview-sdk 2.4.6 → 2.4.8
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 +32 -73
- package/dist/index.d.ts +4 -0
- package/dist/qsh-webview-sdk.es.js +690 -671
- 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,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var nr = Object.defineProperty, ar = Object.defineProperties;
|
|
2
|
+
var sr = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Ze = Object.getOwnPropertySymbols;
|
|
4
|
+
var or = Object.prototype.hasOwnProperty, cr = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var De = (t, e, r) => e in t ? nr(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
|
+
or.call(e, r) && De(t, r, e[r]);
|
|
8
|
+
if (Ze)
|
|
9
|
+
for (var r of Ze(e))
|
|
10
|
+
cr.call(e, r) && De(t, r, e[r]);
|
|
11
11
|
return t;
|
|
12
|
-
}, p = (t, e) =>
|
|
13
|
-
var K = (t, e, r) =>
|
|
12
|
+
}, p = (t, e) => ar(t, sr(e));
|
|
13
|
+
var K = (t, e, r) => De(t, typeof e != "symbol" ? e + "" : e, r);
|
|
14
14
|
var A = (t, e, r) => new Promise((i, n) => {
|
|
15
15
|
var a = (u) => {
|
|
16
16
|
try {
|
|
@@ -27,45 +27,45 @@ var A = (t, e, r) => new Promise((i, n) => {
|
|
|
27
27
|
}, c = (u) => u.done ? i(u.value) : Promise.resolve(u.value).then(a, o);
|
|
28
28
|
c((r = r.apply(t, e)).next());
|
|
29
29
|
});
|
|
30
|
-
function
|
|
30
|
+
function we() {
|
|
31
31
|
return typeof window != "undefined" ? window : void 0;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function Fe() {
|
|
34
34
|
return typeof navigator == "undefined" ? "" : navigator.userAgent || "";
|
|
35
35
|
}
|
|
36
36
|
function M() {
|
|
37
|
-
const t =
|
|
37
|
+
const t = we();
|
|
38
38
|
if (!t) return !1;
|
|
39
39
|
if (t.__wxjs_environment === "miniprogram" || t.wx && t.wx.miniProgram)
|
|
40
40
|
return !0;
|
|
41
|
-
const e =
|
|
41
|
+
const e = Fe();
|
|
42
42
|
return !!(e && /micromessenger/i.test(e) && /miniProgram/i.test(e));
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
const t =
|
|
44
|
+
function Ne() {
|
|
45
|
+
const t = we();
|
|
46
46
|
return !!(t && t.plus);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const t =
|
|
48
|
+
function Te() {
|
|
49
|
+
const t = we();
|
|
50
50
|
return !!(t && (t.__dcloud_weex_postMessage || t.__dcloud_weex_));
|
|
51
51
|
}
|
|
52
52
|
function be() {
|
|
53
|
-
const t =
|
|
53
|
+
const t = we();
|
|
54
54
|
return !!(t && (t.__uniapp_x_postMessage || t.__uniapp_x_));
|
|
55
55
|
}
|
|
56
56
|
function ve() {
|
|
57
|
-
const t =
|
|
57
|
+
const t = Fe();
|
|
58
58
|
return /uni-app/i.test(t);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
const t =
|
|
60
|
+
function ke() {
|
|
61
|
+
const t = Fe();
|
|
62
62
|
return /Html5Plus/i.test(t);
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
return ve() ||
|
|
64
|
+
function ot() {
|
|
65
|
+
return ve() || ke();
|
|
66
66
|
}
|
|
67
67
|
function ee() {
|
|
68
|
-
const t =
|
|
68
|
+
const t = we();
|
|
69
69
|
if (!t) return !1;
|
|
70
70
|
if (t.__offline_bridge_postMessage) return !0;
|
|
71
71
|
try {
|
|
@@ -75,24 +75,24 @@ function ee() {
|
|
|
75
75
|
}
|
|
76
76
|
return !1;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
78
|
+
function ur() {
|
|
79
|
+
return M() ? "weixin" : ee() ? "offline" : be() ? "uvue" : Te() ? "nvue" : Ne() ? "plus" : ot() ? "webview" : ve() ? "UniApp" : "h5";
|
|
80
80
|
}
|
|
81
|
-
let
|
|
81
|
+
let Ae = null;
|
|
82
82
|
function J(t = !1) {
|
|
83
|
-
return
|
|
83
|
+
return Ae && !t || (Ae = {
|
|
84
84
|
isWeixinMiniProgram: M(),
|
|
85
|
-
isAppPlus:
|
|
86
|
-
isNvue:
|
|
85
|
+
isAppPlus: Ne(),
|
|
86
|
+
isNvue: Te(),
|
|
87
87
|
isUvue: be(),
|
|
88
88
|
isUniApp: ve(),
|
|
89
|
-
isHtml5Plus:
|
|
90
|
-
isUniAppWebView:
|
|
89
|
+
isHtml5Plus: ke(),
|
|
90
|
+
isUniAppWebView: ot(),
|
|
91
91
|
isOfflineWebview: ee(),
|
|
92
|
-
type:
|
|
93
|
-
}),
|
|
92
|
+
type: ur()
|
|
93
|
+
}), Ae;
|
|
94
94
|
}
|
|
95
|
-
const d = J(),
|
|
95
|
+
const d = J(), v = {
|
|
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 N extends Error {
|
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
const
|
|
128
|
+
const S = class S {
|
|
129
129
|
/**
|
|
130
130
|
* 设置调试模式
|
|
131
131
|
* @param {boolean} enabled - 是否启用调试模式
|
|
132
132
|
*/
|
|
133
133
|
static setDebugMode(e) {
|
|
134
|
-
|
|
134
|
+
S.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" && S.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 = S.errorCallbacks.indexOf(e);
|
|
149
|
+
r > -1 && S.errorCallbacks.splice(r, 1);
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
152
152
|
* 处理 API 调用错误
|
|
@@ -157,15 +157,15 @@ const O = class O {
|
|
|
157
157
|
static handleApiError(e, r = {}) {
|
|
158
158
|
let i;
|
|
159
159
|
return e instanceof N ? i = e : e instanceof Error ? i = new N(
|
|
160
|
-
|
|
160
|
+
v.API_CALL_FAILED,
|
|
161
161
|
e.message,
|
|
162
162
|
r,
|
|
163
163
|
e
|
|
164
164
|
) : i = new N(
|
|
165
|
-
|
|
165
|
+
v.API_CALL_FAILED,
|
|
166
166
|
String(e),
|
|
167
167
|
r
|
|
168
|
-
),
|
|
168
|
+
), S.logError(i), S.notifyCallbacks(i), i;
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
171
|
* 处理平台不支持错误
|
|
@@ -175,11 +175,11 @@ const O = class O {
|
|
|
175
175
|
*/
|
|
176
176
|
static handlePlatformNotSupported(e, r) {
|
|
177
177
|
const i = new N(
|
|
178
|
-
|
|
178
|
+
v.PLATFORM_NOT_SUPPORTED,
|
|
179
179
|
`API "${r}" is not supported on platform "${e}"`,
|
|
180
180
|
{ platformType: e, apiName: r }
|
|
181
181
|
);
|
|
182
|
-
return
|
|
182
|
+
return S.logError(i), S.notifyCallbacks(i), i;
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* 处理桥接未就绪错误
|
|
@@ -188,11 +188,11 @@ const O = class O {
|
|
|
188
188
|
*/
|
|
189
189
|
static handleBridgeNotReady(e) {
|
|
190
190
|
const r = new N(
|
|
191
|
-
|
|
191
|
+
v.BRIDGE_NOT_READY,
|
|
192
192
|
`Bridge is not ready when calling "${e}"`,
|
|
193
193
|
{ apiName: e }
|
|
194
194
|
);
|
|
195
|
-
return
|
|
195
|
+
return S.logError(r), S.notifyCallbacks(r), r;
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
198
|
* 处理参数验证错误
|
|
@@ -204,11 +204,11 @@ const O = class O {
|
|
|
204
204
|
*/
|
|
205
205
|
static handleInvalidParameters(e, r, i, n) {
|
|
206
206
|
const a = new N(
|
|
207
|
-
|
|
207
|
+
v.INVALID_PARAMETERS,
|
|
208
208
|
`Invalid parameter "${r}" in "${e}": expected ${i}, got ${typeof n}`,
|
|
209
209
|
{ apiName: e, paramName: r, expectedType: i, actualValue: n }
|
|
210
210
|
);
|
|
211
|
-
return
|
|
211
|
+
return S.logError(a), S.notifyCallbacks(a), a;
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
214
|
* 安全地包装函数执行,捕获并处理错误
|
|
@@ -220,7 +220,7 @@ const O = class O {
|
|
|
220
220
|
try {
|
|
221
221
|
return e();
|
|
222
222
|
} catch (i) {
|
|
223
|
-
return
|
|
223
|
+
return S.handleApiError(i, r);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
@@ -234,7 +234,7 @@ const O = class O {
|
|
|
234
234
|
try {
|
|
235
235
|
return yield e();
|
|
236
236
|
} catch (n) {
|
|
237
|
-
return
|
|
237
|
+
return S.handleApiError(n, r);
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
240
|
}
|
|
@@ -246,7 +246,7 @@ const O = class O {
|
|
|
246
246
|
static logError(e) {
|
|
247
247
|
if (typeof console != "undefined") {
|
|
248
248
|
const r = `[QSH-SDK Error] ${e.type}: ${e.message}`;
|
|
249
|
-
|
|
249
|
+
S.isDebugMode ? console.error(r, {
|
|
250
250
|
context: e.context,
|
|
251
251
|
originalError: e.originalError,
|
|
252
252
|
stack: e.stack,
|
|
@@ -260,7 +260,7 @@ const O = class O {
|
|
|
260
260
|
* @private
|
|
261
261
|
*/
|
|
262
262
|
static notifyCallbacks(e) {
|
|
263
|
-
|
|
263
|
+
S.errorCallbacks.forEach((r) => {
|
|
264
264
|
try {
|
|
265
265
|
r(e);
|
|
266
266
|
} catch (i) {
|
|
@@ -277,20 +277,20 @@ const O = class O {
|
|
|
277
277
|
return function(r, i, n) {
|
|
278
278
|
const a = n.value;
|
|
279
279
|
return n.value = function(...o) {
|
|
280
|
-
return
|
|
280
|
+
return S.safeExecute(() => a.apply(this, o), p(g({}, e), { method: i, target: r.constructor.name }));
|
|
281
281
|
}, n;
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
|
-
K(
|
|
286
|
-
let f =
|
|
285
|
+
K(S, "isDebugMode", !1), K(S, "errorCallbacks", []);
|
|
286
|
+
let f = S;
|
|
287
287
|
const U = {
|
|
288
288
|
UNINITIALIZED: "uninitialized",
|
|
289
289
|
INITIALIZING: "initializing",
|
|
290
290
|
READY: "ready",
|
|
291
291
|
ERROR: "error"
|
|
292
292
|
};
|
|
293
|
-
class
|
|
293
|
+
class lr {
|
|
294
294
|
constructor() {
|
|
295
295
|
this.state = U.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
|
}
|
|
@@ -423,7 +423,7 @@ class cr {
|
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
const Z = new
|
|
426
|
+
const Z = new lr(), ct = () => Z.waitForReady(), fr = () => Z.isReady(), dr = () => Z.getState(), P = {
|
|
427
427
|
ERROR: 0,
|
|
428
428
|
WARN: 1,
|
|
429
429
|
INFO: 2,
|
|
@@ -667,38 +667,39 @@ if (typeof window != "undefined") {
|
|
|
667
667
|
}
|
|
668
668
|
(t || e || r) && D.enableDevMode();
|
|
669
669
|
}
|
|
670
|
-
const I = D.createModuleLogger("Bridge"), E = D.createModuleLogger("Platform"), s = D.createModuleLogger("API"), W = D.createModuleLogger("State"),
|
|
671
|
-
function
|
|
670
|
+
const I = D.createModuleLogger("Bridge"), E = D.createModuleLogger("Platform"), s = D.createModuleLogger("API"), W = D.createModuleLogger("State"), he = /complete|loaded|interactive/, gr = 500;
|
|
671
|
+
function Me(t, e = gr) {
|
|
672
|
+
if (he.test(document.readyState)) {
|
|
673
|
+
setTimeout(t, 0);
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
let r = !1, i = null;
|
|
677
|
+
const n = () => {
|
|
678
|
+
r || (r = !0, document.removeEventListener("DOMContentLoaded", n), i && clearTimeout(i), t());
|
|
679
|
+
};
|
|
680
|
+
document.addEventListener("DOMContentLoaded", n, { once: !0 }), i = setTimeout(n, e);
|
|
681
|
+
}
|
|
682
|
+
function hr(t) {
|
|
672
683
|
if (!ee()) return !1;
|
|
673
684
|
I.debug("检测到离线包环境,开始初始化");
|
|
674
685
|
const e = () => {
|
|
675
686
|
t();
|
|
676
687
|
};
|
|
677
|
-
|
|
678
|
-
I.debug("离线包环境 DOM 已就绪,立即初始化"), setTimeout(e, 0);
|
|
679
|
-
else {
|
|
680
|
-
I.debug("离线包环境,等待 DOMContentLoaded");
|
|
681
|
-
let r = !1;
|
|
682
|
-
const i = () => {
|
|
683
|
-
r || (r = !0, e());
|
|
684
|
-
};
|
|
685
|
-
document.addEventListener("DOMContentLoaded", i), setTimeout(i, 500);
|
|
686
|
-
}
|
|
687
|
-
return !0;
|
|
688
|
+
return he.test(document.readyState) ? (I.debug("离线包环境 DOM 已就绪,立即初始化"), setTimeout(e, 0)) : (I.debug("离线包环境,等待 DOMContentLoaded"), Me(e)), !0;
|
|
688
689
|
}
|
|
689
|
-
function
|
|
690
|
-
return ve() ||
|
|
690
|
+
function mr(t) {
|
|
691
|
+
return ve() || ke() ? (I.debug("检测到 APP 环境,开始初始化"), window.__uniapp_x_postMessage || window.__uniapp_x_ || window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? (I.debug("NVUE/UVUE 环境,等待 DOMContentLoaded"), Me(t)) : window.plus && he.test(document.readyState) ? (I.debug("Plus 环境已就绪,立即初始化"), setTimeout(t, 0)) : window.plus ? (I.debug("Plus 环境,等待 plusready 事件"), document.addEventListener("plusready", t)) : he.test(document.readyState) ? setTimeout(t, 0) : Me(t), !0) : !1;
|
|
691
692
|
}
|
|
692
|
-
function
|
|
693
|
+
function pr(t) {
|
|
693
694
|
return window.wx && window.wx.miniProgram ? (I.debug("检测到微信小程序环境,开始初始化"), window.WeixinJSBridge && window.WeixinJSBridge.invoke ? (I.debug("微信 JSBridge 已就绪,立即初始化"), setTimeout(t, 0)) : (I.debug("微信 JSBridge 未就绪,等待 WeixinJSBridgeReady 事件"), document.addEventListener("WeixinJSBridgeReady", t)), !0) : !1;
|
|
694
695
|
}
|
|
695
|
-
function
|
|
696
|
-
return I.info("开始初始化 JSBridge"),
|
|
696
|
+
function wr(t) {
|
|
697
|
+
return I.info("开始初始化 JSBridge"), hr(t) ? (I.info("使用离线包环境初始化"), !0) : mr(t) ? (I.info("使用 APP 环境初始化"), !0) : pr(t) ? (I.info("使用微信小程序环境初始化"), !0) : (I.debug("使用默认 H5 环境初始化"), he.test(document.readyState) ? (I.debug("DOM 已就绪,立即初始化"), setTimeout(t, 0)) : (I.debug("DOM 未就绪,等待 DOMContentLoaded"), Me(t)), !0);
|
|
697
698
|
}
|
|
698
|
-
function
|
|
699
|
+
function Er() {
|
|
699
700
|
return Z.waitForReady();
|
|
700
701
|
}
|
|
701
|
-
function
|
|
702
|
+
function ut() {
|
|
702
703
|
return Z.startInitialization(() => A(null, null, function* () {
|
|
703
704
|
return new Promise((t, e) => {
|
|
704
705
|
const r = () => {
|
|
@@ -710,7 +711,7 @@ function ot() {
|
|
|
710
711
|
e(a);
|
|
711
712
|
};
|
|
712
713
|
try {
|
|
713
|
-
|
|
714
|
+
wr(() => {
|
|
714
715
|
r();
|
|
715
716
|
});
|
|
716
717
|
} catch (n) {
|
|
@@ -719,7 +720,7 @@ function ot() {
|
|
|
719
720
|
});
|
|
720
721
|
}));
|
|
721
722
|
}
|
|
722
|
-
const
|
|
723
|
+
const b = {
|
|
723
724
|
UNINITIALIZED: "uninitialized",
|
|
724
725
|
CONFIGURING: "configuring",
|
|
725
726
|
CONFIGURED: "configured",
|
|
@@ -728,9 +729,9 @@ const v = {
|
|
|
728
729
|
function q() {
|
|
729
730
|
return typeof window == "undefined" || !window.wx ? !1 : typeof window.wx.config == "function" && typeof window.wx.ready == "function" && typeof window.wx.error == "function";
|
|
730
731
|
}
|
|
731
|
-
class
|
|
732
|
+
class yr {
|
|
732
733
|
constructor() {
|
|
733
|
-
this.state =
|
|
734
|
+
this.state = b.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, this.configVersion = 0, this.configuredConfigKey = null, this.runtimeConfig = {
|
|
734
735
|
clientId: null,
|
|
735
736
|
isProd: !1,
|
|
736
737
|
debug: !1,
|
|
@@ -740,7 +741,7 @@ class pr {
|
|
|
740
741
|
configure(e = {}) {
|
|
741
742
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
742
743
|
throw new N(
|
|
743
|
-
|
|
744
|
+
v.INVALID_PARAMETERS,
|
|
744
745
|
"config参数异常",
|
|
745
746
|
{ config: e }
|
|
746
747
|
);
|
|
@@ -748,25 +749,25 @@ class pr {
|
|
|
748
749
|
throw this.createMissingClientIdError();
|
|
749
750
|
if (typeof e.clientId != "string" || !e.clientId.trim())
|
|
750
751
|
throw new N(
|
|
751
|
-
|
|
752
|
+
v.INVALID_PARAMETERS,
|
|
752
753
|
"clientId参数异常",
|
|
753
754
|
{ clientId: e.clientId }
|
|
754
755
|
);
|
|
755
756
|
if (Object.prototype.hasOwnProperty.call(e, "isProd") && typeof e.isProd != "boolean")
|
|
756
757
|
throw new N(
|
|
757
|
-
|
|
758
|
+
v.INVALID_PARAMETERS,
|
|
758
759
|
"isProd参数异常",
|
|
759
760
|
{ isProd: e.isProd }
|
|
760
761
|
);
|
|
761
762
|
if (Object.prototype.hasOwnProperty.call(e, "debug") && typeof e.debug != "boolean")
|
|
762
763
|
throw new N(
|
|
763
|
-
|
|
764
|
+
v.INVALID_PARAMETERS,
|
|
764
765
|
"debug参数异常",
|
|
765
766
|
{ debug: e.debug }
|
|
766
767
|
);
|
|
767
768
|
if (Object.prototype.hasOwnProperty.call(e, "url") && typeof e.url != "string")
|
|
768
769
|
throw new N(
|
|
769
|
-
|
|
770
|
+
v.INVALID_PARAMETERS,
|
|
770
771
|
"url参数异常",
|
|
771
772
|
{ url: e.url }
|
|
772
773
|
);
|
|
@@ -776,7 +777,7 @@ class pr {
|
|
|
776
777
|
isProd: i,
|
|
777
778
|
debug: n,
|
|
778
779
|
url: a
|
|
779
|
-
}), this.CONFIG_API_URL = this.getConfigApiUrl(i), (this.state ===
|
|
780
|
+
}), this.CONFIG_API_URL = this.getConfigApiUrl(i), (this.state === b.ERROR || o && (this.state === b.CONFIGURING || this.state === b.CONFIGURED)) && this.reset({ preserveCallbacks: !0 }), E.info("Updated Weixin runtime config", {
|
|
780
781
|
clientId: this.runtimeConfig.clientId,
|
|
781
782
|
isProd: this.runtimeConfig.isProd,
|
|
782
783
|
debug: this.runtimeConfig.debug,
|
|
@@ -810,7 +811,7 @@ class pr {
|
|
|
810
811
|
}
|
|
811
812
|
createMissingClientIdError() {
|
|
812
813
|
return new N(
|
|
813
|
-
|
|
814
|
+
v.INVALID_PARAMETERS,
|
|
814
815
|
"clientId错误",
|
|
815
816
|
{ field: "clientId" }
|
|
816
817
|
);
|
|
@@ -865,7 +866,7 @@ class pr {
|
|
|
865
866
|
if (E.error("获取微信配置失败", n), this.shouldUseTestMode(n))
|
|
866
867
|
return E.warn("网络请求失败,降级到测试模式"), this.getMockConfig();
|
|
867
868
|
throw new N(
|
|
868
|
-
|
|
869
|
+
v.NETWORK_ERROR,
|
|
869
870
|
`获取微信配置失败: ${n.message}`,
|
|
870
871
|
{ url: i, originalError: n }
|
|
871
872
|
);
|
|
@@ -943,7 +944,7 @@ class pr {
|
|
|
943
944
|
E.debug("忽略过期的微信配置成功回调");
|
|
944
945
|
return;
|
|
945
946
|
}
|
|
946
|
-
E.info("微信配置成功"), this.state =
|
|
947
|
+
E.info("微信配置成功"), this.state = b.CONFIGURED, this.configuredConfigKey = r, this.lastError = null, this.configPromise = null;
|
|
947
948
|
const i = [...this.readyCallbacks];
|
|
948
949
|
this.readyCallbacks = [], this.errorCallbacks = [], i.forEach((n) => {
|
|
949
950
|
try {
|
|
@@ -966,11 +967,11 @@ class pr {
|
|
|
966
967
|
const n = `微信配置验证失败: ${JSON.stringify(e)}`;
|
|
967
968
|
E.error(n, e);
|
|
968
969
|
const a = new N(
|
|
969
|
-
|
|
970
|
+
v.API_CALL_FAILED,
|
|
970
971
|
n,
|
|
971
972
|
{ weixinErrorResponse: e }
|
|
972
973
|
);
|
|
973
|
-
this.state =
|
|
974
|
+
this.state = b.ERROR, this.lastError = a, this.configPromise = null;
|
|
974
975
|
const o = [...this.errorCallbacks];
|
|
975
976
|
this.readyCallbacks = [], this.errorCallbacks = [], o.forEach((c) => {
|
|
976
977
|
try {
|
|
@@ -990,11 +991,11 @@ class pr {
|
|
|
990
991
|
return E.warn("clientId为空,等待qsh.config({ clientId })"), Promise.resolve();
|
|
991
992
|
if (this.isReady())
|
|
992
993
|
return Promise.resolve();
|
|
993
|
-
if (this.state ===
|
|
994
|
+
if (this.state === b.CONFIGURED && this.reset({ preserveCallbacks: !0 }), this.state === b.ERROR)
|
|
994
995
|
return Promise.reject(this.lastError);
|
|
995
996
|
if (this.configPromise)
|
|
996
997
|
return this.configPromise;
|
|
997
|
-
this.state =
|
|
998
|
+
this.state = b.CONFIGURING;
|
|
998
999
|
const e = this.configVersion, r = this.getRuntimeConfigKey();
|
|
999
1000
|
return this.configPromise = this.performAutoConfig(e, r), this.configPromise;
|
|
1000
1001
|
});
|
|
@@ -1021,7 +1022,7 @@ class pr {
|
|
|
1021
1022
|
n();
|
|
1022
1023
|
return;
|
|
1023
1024
|
}
|
|
1024
|
-
if (this.state ===
|
|
1025
|
+
if (this.state === b.ERROR) {
|
|
1025
1026
|
a(this.lastError);
|
|
1026
1027
|
return;
|
|
1027
1028
|
}
|
|
@@ -1033,7 +1034,7 @@ class pr {
|
|
|
1033
1034
|
return;
|
|
1034
1035
|
}
|
|
1035
1036
|
const n = i instanceof N ? i : f.handleApiError(i, { context: "WeixinConfigManager.performAutoConfig" });
|
|
1036
|
-
this.state =
|
|
1037
|
+
this.state = b.ERROR, this.lastError = n, this.configPromise = null;
|
|
1037
1038
|
const a = [...this.errorCallbacks];
|
|
1038
1039
|
throw this.readyCallbacks = [], this.errorCallbacks = [], a.forEach((o) => {
|
|
1039
1040
|
try {
|
|
@@ -1050,7 +1051,7 @@ class pr {
|
|
|
1050
1051
|
* @returns {Promise<void>} 配置完成的Promise
|
|
1051
1052
|
*/
|
|
1052
1053
|
waitForReady() {
|
|
1053
|
-
return this.isReady() ? Promise.resolve() : (this.state ===
|
|
1054
|
+
return this.isReady() ? Promise.resolve() : (this.state === b.CONFIGURED && this.reset({ preserveCallbacks: !0 }), this.state === b.ERROR ? Promise.reject(this.lastError) : this.hasRequiredConfig() ? this.state === b.UNINITIALIZED ? this.autoConfig() : new Promise((e, r) => {
|
|
1054
1055
|
this.readyCallbacks.push(e), this.errorCallbacks.push(r);
|
|
1055
1056
|
}) : Promise.reject(this.createMissingClientIdError()));
|
|
1056
1057
|
}
|
|
@@ -1059,7 +1060,7 @@ class pr {
|
|
|
1059
1060
|
* @returns {boolean} 是否已配置
|
|
1060
1061
|
*/
|
|
1061
1062
|
isReady() {
|
|
1062
|
-
return this.state ===
|
|
1063
|
+
return this.state === b.CONFIGURED && this.configuredConfigKey === this.getRuntimeConfigKey();
|
|
1063
1064
|
}
|
|
1064
1065
|
/**
|
|
1065
1066
|
* 获取当前状态
|
|
@@ -1080,7 +1081,7 @@ class pr {
|
|
|
1080
1081
|
*/
|
|
1081
1082
|
reset(e = {}) {
|
|
1082
1083
|
const { preserveCallbacks: r = !1 } = e;
|
|
1083
|
-
this.configVersion += 1, this.state =
|
|
1084
|
+
this.configVersion += 1, this.state = b.UNINITIALIZED, this.configPromise = null, r || (this.readyCallbacks = [], this.errorCallbacks = []), this.lastError = null, this.configuredConfigKey = null, E.debug("微信配置管理器已重置");
|
|
1084
1085
|
}
|
|
1085
1086
|
/**
|
|
1086
1087
|
* 获取配置统计信息
|
|
@@ -1105,16 +1106,16 @@ class pr {
|
|
|
1105
1106
|
};
|
|
1106
1107
|
}
|
|
1107
1108
|
}
|
|
1108
|
-
const x = new
|
|
1109
|
-
let ne = !1,
|
|
1110
|
-
function
|
|
1109
|
+
const x = new yr();
|
|
1110
|
+
let ne = !1, me = !1, $ = null, Ce = !1;
|
|
1111
|
+
function Ar(t) {
|
|
1111
1112
|
return new Promise((e) => {
|
|
1112
1113
|
let r = !1, i = null;
|
|
1113
1114
|
const n = (c) => A(null, null, function* () {
|
|
1114
1115
|
if (!r) {
|
|
1115
|
-
if (r = !0, i && clearTimeout(i), ne = !1,
|
|
1116
|
+
if (r = !0, i && clearTimeout(i), ne = !1, me = c, c)
|
|
1116
1117
|
try {
|
|
1117
|
-
yield
|
|
1118
|
+
yield lt();
|
|
1118
1119
|
} catch (u) {
|
|
1119
1120
|
E.error("微信配置失败,将使用消息桥作为后备", u);
|
|
1120
1121
|
}
|
|
@@ -1130,31 +1131,31 @@ function wr(t) {
|
|
|
1130
1131
|
}, 3e3);
|
|
1131
1132
|
});
|
|
1132
1133
|
}
|
|
1133
|
-
function
|
|
1134
|
+
function Be() {
|
|
1134
1135
|
return A(this, arguments, function* (t = {}) {
|
|
1135
1136
|
const { force: e = !1, recoverFromError: r = !1 } = t;
|
|
1136
|
-
if (yield
|
|
1137
|
+
if (yield ft({ force: e }), !q())
|
|
1137
1138
|
throw new Error("微信 JS-SDK 未正确加载,无法执行配置");
|
|
1138
|
-
r &&
|
|
1139
|
+
r && Pr();
|
|
1139
1140
|
});
|
|
1140
1141
|
}
|
|
1141
|
-
function
|
|
1142
|
+
function Ir(t = !1) {
|
|
1142
1143
|
if (typeof window == "undefined") return !1;
|
|
1143
1144
|
if (q())
|
|
1144
|
-
return
|
|
1145
|
-
if (
|
|
1145
|
+
return me = !0, !1;
|
|
1146
|
+
if (me || ee()) return !1;
|
|
1146
1147
|
if (t) return !0;
|
|
1147
1148
|
const e = navigator.userAgent || "", r = /micromessenger/i.test(e), i = /miniProgram/i.test(e), n = typeof window.__wxjs_environment != "undefined" && window.__wxjs_environment === "miniprogram", a = !!(window.wx && window.wx.miniProgram);
|
|
1148
1149
|
return r && (i || n || a);
|
|
1149
1150
|
}
|
|
1150
|
-
function
|
|
1151
|
-
x.getState() === "error" && (x.reset(),
|
|
1151
|
+
function Pr() {
|
|
1152
|
+
x.getState() === "error" && (x.reset(), Ce = !1);
|
|
1152
1153
|
}
|
|
1153
|
-
function
|
|
1154
|
+
function lt() {
|
|
1154
1155
|
return A(this, null, function* () {
|
|
1155
|
-
if (
|
|
1156
|
+
if (Ce)
|
|
1156
1157
|
return x.waitForReady();
|
|
1157
|
-
|
|
1158
|
+
Ce = !0, E.info("开始自动配置微信JS-SDK");
|
|
1158
1159
|
try {
|
|
1159
1160
|
yield x.autoConfig(), E.info("微信JS-SDK自动配置完成");
|
|
1160
1161
|
} catch (t) {
|
|
@@ -1162,24 +1163,24 @@ function ct() {
|
|
|
1162
1163
|
}
|
|
1163
1164
|
});
|
|
1164
1165
|
}
|
|
1165
|
-
function
|
|
1166
|
+
function ft(t = {}) {
|
|
1166
1167
|
const { force: e = !1 } = t;
|
|
1167
1168
|
if (typeof window == "undefined")
|
|
1168
1169
|
return Promise.resolve();
|
|
1169
1170
|
if (q())
|
|
1170
|
-
return
|
|
1171
|
+
return me = !0, Promise.resolve();
|
|
1171
1172
|
const r = document.getElementById("weixin-jssdk");
|
|
1172
|
-
return r ? $ || (ne = !0, $ =
|
|
1173
|
+
return r ? $ || (ne = !0, $ = Ar(r).finally(() => {
|
|
1173
1174
|
$ = null;
|
|
1174
|
-
}), $) :
|
|
1175
|
+
}), $) : Ir(e) ? $ || ($ = new Promise((i) => {
|
|
1175
1176
|
ne = !0;
|
|
1176
1177
|
try {
|
|
1177
1178
|
const n = document.createElement("script");
|
|
1178
1179
|
n.id = "weixin-jssdk", n.type = "text/javascript", n.async = !0, n.src = "https://res.wx.qq.com/open/js/jweixin-1.6.2.js", n.onload = function() {
|
|
1179
1180
|
return A(this, null, function* () {
|
|
1180
|
-
|
|
1181
|
+
me = !0, ne = !1, E.info("微信 JS-SDK 已自动加载");
|
|
1181
1182
|
try {
|
|
1182
|
-
yield
|
|
1183
|
+
yield lt();
|
|
1183
1184
|
} catch (o) {
|
|
1184
1185
|
E.error("微信配置失败,将使用消息桥作为后备", o);
|
|
1185
1186
|
}
|
|
@@ -1196,11 +1197,11 @@ function ut(t = {}) {
|
|
|
1196
1197
|
}), $) : Promise.resolve();
|
|
1197
1198
|
}
|
|
1198
1199
|
function te() {
|
|
1199
|
-
return
|
|
1200
|
+
return Be({ force: !0, recoverFromError: !0 }).then(() => x.waitForReady());
|
|
1200
1201
|
}
|
|
1201
|
-
function
|
|
1202
|
+
function Qe(t = {}) {
|
|
1202
1203
|
const e = x.configure(t);
|
|
1203
|
-
return typeof window == "undefined" ||
|
|
1204
|
+
return typeof window == "undefined" || Be({
|
|
1204
1205
|
force: !0,
|
|
1205
1206
|
recoverFromError: x.getState() === "error"
|
|
1206
1207
|
}).then(() => {
|
|
@@ -1216,18 +1217,18 @@ function Ze(t = {}) {
|
|
|
1216
1217
|
function ce() {
|
|
1217
1218
|
return x.isReady();
|
|
1218
1219
|
}
|
|
1219
|
-
function
|
|
1220
|
+
function Mr() {
|
|
1220
1221
|
return x.getState();
|
|
1221
1222
|
}
|
|
1222
|
-
function
|
|
1223
|
+
function Ue() {
|
|
1223
1224
|
return x;
|
|
1224
1225
|
}
|
|
1225
|
-
function
|
|
1226
|
+
function Cr() {
|
|
1226
1227
|
return A(this, null, function* () {
|
|
1227
|
-
return E.info("手动重试微信配置"), x.reset(),
|
|
1228
|
+
return E.info("手动重试微信配置"), x.reset(), Ce = !1, yield Be({ force: !0 }), x.waitForReady();
|
|
1228
1229
|
});
|
|
1229
1230
|
}
|
|
1230
|
-
class
|
|
1231
|
+
class _r {
|
|
1231
1232
|
constructor() {
|
|
1232
1233
|
this.plugins = /* @__PURE__ */ new Map(), this.installed = /* @__PURE__ */ new Set(), this.installOrder = [], s.debug("插件管理器已初始化");
|
|
1233
1234
|
}
|
|
@@ -1420,8 +1421,8 @@ class Pr {
|
|
|
1420
1421
|
this.plugins.clear(), this.installed.clear(), this.installOrder = [];
|
|
1421
1422
|
}
|
|
1422
1423
|
}
|
|
1423
|
-
const de = new
|
|
1424
|
-
class
|
|
1424
|
+
const de = new _r();
|
|
1425
|
+
class Rr {
|
|
1425
1426
|
constructor() {
|
|
1426
1427
|
this.requestInterceptors = [], this.responseInterceptors = [], s.debug("拦截器链已初始化");
|
|
1427
1428
|
}
|
|
@@ -1535,7 +1536,7 @@ class Mr {
|
|
|
1535
1536
|
};
|
|
1536
1537
|
}
|
|
1537
1538
|
}
|
|
1538
|
-
const X = new
|
|
1539
|
+
const X = new Rr(), Sr = {
|
|
1539
1540
|
/**
|
|
1540
1541
|
* 请求日志
|
|
1541
1542
|
*/
|
|
@@ -1590,7 +1591,7 @@ const X = new Mr(), Cr = {
|
|
|
1590
1591
|
H.metrics.clear();
|
|
1591
1592
|
}
|
|
1592
1593
|
};
|
|
1593
|
-
function
|
|
1594
|
+
function Or(t = {}) {
|
|
1594
1595
|
const {
|
|
1595
1596
|
maxRetries: e = 3,
|
|
1596
1597
|
retryDelay: r = 1e3,
|
|
@@ -1602,7 +1603,7 @@ function _r(t = {}) {
|
|
|
1602
1603
|
})
|
|
1603
1604
|
};
|
|
1604
1605
|
}
|
|
1605
|
-
function
|
|
1606
|
+
function Nr(t = {}) {
|
|
1606
1607
|
return {
|
|
1607
1608
|
request: (e) => {
|
|
1608
1609
|
const r = t[e.apiName];
|
|
@@ -1614,7 +1615,7 @@ function Rr(t = {}) {
|
|
|
1614
1615
|
}
|
|
1615
1616
|
};
|
|
1616
1617
|
}
|
|
1617
|
-
class
|
|
1618
|
+
class Tr {
|
|
1618
1619
|
constructor() {
|
|
1619
1620
|
this.state = {
|
|
1620
1621
|
// SDK 状态
|
|
@@ -1859,7 +1860,7 @@ class Or {
|
|
|
1859
1860
|
};
|
|
1860
1861
|
}
|
|
1861
1862
|
}
|
|
1862
|
-
const V = new
|
|
1863
|
+
const V = new Tr(), l = {
|
|
1863
1864
|
// SDK 核心错误 (E_SDK_xxx)
|
|
1864
1865
|
SDK_NOT_READY: "E_SDK_001",
|
|
1865
1866
|
SDK_INIT_FAILED: "E_SDK_002",
|
|
@@ -1910,7 +1911,7 @@ const V = new Or(), l = {
|
|
|
1910
1911
|
API_TIMEOUT: "E_TIMEOUT_001",
|
|
1911
1912
|
// 通用错误
|
|
1912
1913
|
UNKNOWN_ERROR: "E_UNKNOWN_999"
|
|
1913
|
-
},
|
|
1914
|
+
}, We = {
|
|
1914
1915
|
// SDK 核心
|
|
1915
1916
|
[l.SDK_NOT_READY]: "SDK 未就绪",
|
|
1916
1917
|
[l.SDK_INIT_FAILED]: "SDK 初始化失败",
|
|
@@ -1966,7 +1967,7 @@ const V = new Or(), l = {
|
|
|
1966
1967
|
// 配置问题
|
|
1967
1968
|
UNKNOWN: "unknown"
|
|
1968
1969
|
// 未知问题
|
|
1969
|
-
},
|
|
1970
|
+
}, br = {
|
|
1970
1971
|
// 图片相关
|
|
1971
1972
|
"IMAGE/USER_CANCEL": l.IMAGE_CANCELLED,
|
|
1972
1973
|
"IMAGE/PERMISSION_DENIED": l.IMAGE_NO_PERMISSION,
|
|
@@ -1974,7 +1975,7 @@ const V = new Or(), l = {
|
|
|
1974
1975
|
"COMMON/UNKNOWN": l.UNKNOWN_ERROR,
|
|
1975
1976
|
"COMMON/CONFIG_NOT_READY": l.IMAGE_CONFIG_NOT_READY,
|
|
1976
1977
|
"COMMON/PLATFORM_NOT_SUPPORTED": l.PLATFORM_NOT_SUPPORTED
|
|
1977
|
-
},
|
|
1978
|
+
}, et = {
|
|
1978
1979
|
// 微信平台错误模式
|
|
1979
1980
|
weixin: {
|
|
1980
1981
|
patterns: [
|
|
@@ -2008,7 +2009,7 @@ const V = new Or(), l = {
|
|
|
2008
2009
|
],
|
|
2009
2010
|
default: l.UNKNOWN_ERROR
|
|
2010
2011
|
}
|
|
2011
|
-
},
|
|
2012
|
+
}, tt = {
|
|
2012
2013
|
chooseImage: {
|
|
2013
2014
|
"fail cancel": l.IMAGE_CANCELLED,
|
|
2014
2015
|
"fail auth deny": l.IMAGE_NO_PERMISSION,
|
|
@@ -2022,17 +2023,17 @@ const V = new Or(), l = {
|
|
|
2022
2023
|
NOT_IN_CONTAINER: l.PLATFORM_NOT_SUPPORTED
|
|
2023
2024
|
}
|
|
2024
2025
|
};
|
|
2025
|
-
function
|
|
2026
|
+
function dt(t) {
|
|
2026
2027
|
return t ? t.includes("CANCEL") ? F.USER_CANCEL : t.includes("PERM") || t.includes("PERMISSION") ? F.PERMISSION : t.includes("NET") || t.includes("NETWORK") ? F.NETWORK : t.includes("PARAM") ? F.PARAM : t.includes("CONFIG") ? F.CONFIG : t.includes("SDK") || t.includes("PLATFORM") ? F.SYSTEM : F.UNKNOWN : F.UNKNOWN;
|
|
2027
2028
|
}
|
|
2028
|
-
function
|
|
2029
|
+
function vr(t) {
|
|
2029
2030
|
return t.includes("NET_") || t.includes("TIMEOUT") || t === l.NETWORK_ERROR || t === l.NETWORK_TIMEOUT || t === l.API_TIMEOUT;
|
|
2030
2031
|
}
|
|
2031
|
-
function
|
|
2032
|
-
return t.includes("CANCEL") ||
|
|
2032
|
+
function xr(t) {
|
|
2033
|
+
return t.includes("CANCEL") || dt(t) === F.USER_CANCEL;
|
|
2033
2034
|
}
|
|
2034
2035
|
function ae(t) {
|
|
2035
|
-
return
|
|
2036
|
+
return We[t] || We[l.UNKNOWN_ERROR];
|
|
2036
2037
|
}
|
|
2037
2038
|
class j extends Error {
|
|
2038
2039
|
/**
|
|
@@ -2042,7 +2043,7 @@ class j extends Error {
|
|
|
2042
2043
|
* @param {Object} options - 选项
|
|
2043
2044
|
*/
|
|
2044
2045
|
constructor(e, r, i = {}) {
|
|
2045
|
-
super(r), this.name = "StandardError", this.code = e, this.message = r || ae(e), this.platform = i.platform || d.type, this.apiName = i.apiName, this.category = i.category ||
|
|
2046
|
+
super(r), this.name = "StandardError", this.code = e, this.message = r || ae(e), this.platform = i.platform || d.type, this.apiName = i.apiName, this.category = i.category || dt(e), this.retriable = i.retriable !== void 0 ? i.retriable : vr(e), this.originalError = i.originalError, this.details = i.details || {}, this.timestamp = Date.now();
|
|
2046
2047
|
}
|
|
2047
2048
|
/**
|
|
2048
2049
|
* 是否可重试
|
|
@@ -2056,7 +2057,7 @@ class j extends Error {
|
|
|
2056
2057
|
* @returns {boolean}
|
|
2057
2058
|
*/
|
|
2058
2059
|
isUserAction() {
|
|
2059
|
-
return
|
|
2060
|
+
return xr(this.code);
|
|
2060
2061
|
}
|
|
2061
2062
|
/**
|
|
2062
2063
|
* 转为普通对象
|
|
@@ -2077,11 +2078,11 @@ class j extends Error {
|
|
|
2077
2078
|
} : {});
|
|
2078
2079
|
}
|
|
2079
2080
|
}
|
|
2080
|
-
function
|
|
2081
|
+
function gt(t, e = {}) {
|
|
2081
2082
|
if (t instanceof j)
|
|
2082
2083
|
return t;
|
|
2083
2084
|
const { apiName: r, platform: i = d.type } = e;
|
|
2084
|
-
return t && typeof t.code == "string" && t.code.includes("/") ?
|
|
2085
|
+
return t && typeof t.code == "string" && t.code.includes("/") ? Lr(t, { apiName: r, platform: i }) : t && (t.errMsg || t.message) ? Dr(t, { apiName: r, platform: i }) : typeof t == "string" ? new j(
|
|
2085
2086
|
l.UNKNOWN_ERROR,
|
|
2086
2087
|
t,
|
|
2087
2088
|
{ apiName: r, platform: i, originalError: t }
|
|
@@ -2096,8 +2097,8 @@ function ft(t, e = {}) {
|
|
|
2096
2097
|
}
|
|
2097
2098
|
);
|
|
2098
2099
|
}
|
|
2099
|
-
function
|
|
2100
|
-
const { apiName: r, platform: i } = e, n = t.code, a =
|
|
2100
|
+
function Lr(t, e) {
|
|
2101
|
+
const { apiName: r, platform: i } = e, n = t.code, a = br[n] || l.UNKNOWN_ERROR;
|
|
2101
2102
|
return s.debug("转换旧版错误码", {
|
|
2102
2103
|
legacy: n,
|
|
2103
2104
|
new: a
|
|
@@ -2115,10 +2116,10 @@ function vr(t, e) {
|
|
|
2115
2116
|
}
|
|
2116
2117
|
);
|
|
2117
2118
|
}
|
|
2118
|
-
function
|
|
2119
|
+
function Dr(t, e) {
|
|
2119
2120
|
const { apiName: r, platform: i } = e, n = (t.errMsg || t.message || "").toLowerCase();
|
|
2120
|
-
if (r &&
|
|
2121
|
-
const c =
|
|
2121
|
+
if (r && tt[r]) {
|
|
2122
|
+
const c = tt[r];
|
|
2122
2123
|
for (const [u, m] of Object.entries(c))
|
|
2123
2124
|
if (n.includes(u.toLowerCase()))
|
|
2124
2125
|
return new j(m, ae(m), {
|
|
@@ -2127,7 +2128,7 @@ function Tr(t, e) {
|
|
|
2127
2128
|
originalError: t
|
|
2128
2129
|
});
|
|
2129
2130
|
}
|
|
2130
|
-
const a =
|
|
2131
|
+
const a = et[i] || et.uniapp;
|
|
2131
2132
|
for (const { pattern: c, code: u } of a.patterns)
|
|
2132
2133
|
if (c.test(n))
|
|
2133
2134
|
return new j(u, ae(u), {
|
|
@@ -2146,7 +2147,7 @@ function Tr(t, e) {
|
|
|
2146
2147
|
}
|
|
2147
2148
|
);
|
|
2148
2149
|
}
|
|
2149
|
-
const
|
|
2150
|
+
const ht = {
|
|
2150
2151
|
/**
|
|
2151
2152
|
* 响应拦截器
|
|
2152
2153
|
* @param {Object} result - API 响应结果
|
|
@@ -2155,7 +2156,7 @@ const dt = {
|
|
|
2155
2156
|
*/
|
|
2156
2157
|
response: (t, e) => {
|
|
2157
2158
|
if (!t.success && t.error) {
|
|
2158
|
-
const r =
|
|
2159
|
+
const r = gt(t.error, {
|
|
2159
2160
|
apiName: e.apiName,
|
|
2160
2161
|
platform: d.type
|
|
2161
2162
|
});
|
|
@@ -2168,25 +2169,25 @@ const dt = {
|
|
|
2168
2169
|
return t;
|
|
2169
2170
|
}
|
|
2170
2171
|
};
|
|
2171
|
-
function
|
|
2172
|
+
function Ur(t, e = {}) {
|
|
2172
2173
|
return new j(t, ae(t), e);
|
|
2173
2174
|
}
|
|
2174
|
-
function
|
|
2175
|
+
function Wr(t) {
|
|
2175
2176
|
return t instanceof j;
|
|
2176
2177
|
}
|
|
2177
|
-
function
|
|
2178
|
+
function $r(t, e, r) {
|
|
2178
2179
|
return e ? Promise.race([
|
|
2179
2180
|
t(),
|
|
2180
2181
|
new Promise((i, n) => setTimeout(() => n(new Error(`Init task timeout: ${r}`)), e))
|
|
2181
2182
|
]) : t();
|
|
2182
2183
|
}
|
|
2183
|
-
function
|
|
2184
|
+
function Fr() {
|
|
2184
2185
|
return A(this, arguments, function* (t = [], e = {}) {
|
|
2185
2186
|
for (const r of t) {
|
|
2186
2187
|
const i = (r == null ? void 0 : r.name) || "anonymous-task", n = (r == null ? void 0 : r.run) || r;
|
|
2187
2188
|
if (typeof n == "function")
|
|
2188
2189
|
try {
|
|
2189
|
-
yield
|
|
2190
|
+
yield $r(() => Promise.resolve().then(() => n()), r.timeoutMs, i), typeof r.onSuccess == "function" && r.onSuccess();
|
|
2190
2191
|
} catch (a) {
|
|
2191
2192
|
if (typeof r.onError == "function" && r.onError(a), typeof e.onError == "function")
|
|
2192
2193
|
e.onError(a, r);
|
|
@@ -2196,7 +2197,7 @@ function Ur() {
|
|
|
2196
2197
|
}
|
|
2197
2198
|
});
|
|
2198
2199
|
}
|
|
2199
|
-
class
|
|
2200
|
+
class mt {
|
|
2200
2201
|
/**
|
|
2201
2202
|
* 构造函数
|
|
2202
2203
|
* @param {string} name - 平台名称
|
|
@@ -2323,7 +2324,7 @@ class gt {
|
|
|
2323
2324
|
}
|
|
2324
2325
|
}
|
|
2325
2326
|
let ge = [];
|
|
2326
|
-
function
|
|
2327
|
+
function kr() {
|
|
2327
2328
|
if (ge.length === 0 && window.plus) {
|
|
2328
2329
|
const t = plus.webview.currentWebview();
|
|
2329
2330
|
if (!t)
|
|
@@ -2333,7 +2334,7 @@ function Wr() {
|
|
|
2333
2334
|
}
|
|
2334
2335
|
return ge;
|
|
2335
2336
|
}
|
|
2336
|
-
function
|
|
2337
|
+
function Br(t, e) {
|
|
2337
2338
|
const r = {
|
|
2338
2339
|
options: {
|
|
2339
2340
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2354,7 +2355,7 @@ function $r(t, e) {
|
|
|
2354
2355
|
};
|
|
2355
2356
|
window.__uniapp_x_postMessage ? window.__uniapp_x_postMessageToService(i) : window.__uniapp_x_.postMessageToService(JSON.stringify(i));
|
|
2356
2357
|
}
|
|
2357
|
-
function
|
|
2358
|
+
function Gr(t, e) {
|
|
2358
2359
|
const r = {
|
|
2359
2360
|
options: {
|
|
2360
2361
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2375,14 +2376,14 @@ function Fr(t, e) {
|
|
|
2375
2376
|
};
|
|
2376
2377
|
window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(i) : window.__dcloud_weex_.postMessageToService(JSON.stringify(i));
|
|
2377
2378
|
}
|
|
2378
|
-
function
|
|
2379
|
+
function Kr(t, e) {
|
|
2379
2380
|
const r = {
|
|
2380
2381
|
options: {
|
|
2381
2382
|
timestamp: +/* @__PURE__ */ new Date()
|
|
2382
2383
|
},
|
|
2383
2384
|
name: t,
|
|
2384
2385
|
arg: e
|
|
2385
|
-
}, i =
|
|
2386
|
+
}, i = kr();
|
|
2386
2387
|
if (plus.webview.getWebviewById("__uniapp__service"))
|
|
2387
2388
|
plus.webview.postMessageToUniNView({
|
|
2388
2389
|
type: "WEB_INVOKE_APPSERVICE",
|
|
@@ -2398,7 +2399,7 @@ function kr(t, e) {
|
|
|
2398
2399
|
);
|
|
2399
2400
|
}
|
|
2400
2401
|
}
|
|
2401
|
-
function
|
|
2402
|
+
function Vr(t, e) {
|
|
2402
2403
|
const r = {
|
|
2403
2404
|
options: {
|
|
2404
2405
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2412,10 +2413,10 @@ function Br(t, e) {
|
|
|
2412
2413
|
pageId: ""
|
|
2413
2414
|
}, "*");
|
|
2414
2415
|
}
|
|
2415
|
-
function
|
|
2416
|
+
function qr(t) {
|
|
2416
2417
|
return !!(t && typeof t == "object" && t.type === "qsh_api_call" && typeof t.api == "string" && typeof t.callbackId == "string");
|
|
2417
2418
|
}
|
|
2418
|
-
function
|
|
2419
|
+
function jr(t, e) {
|
|
2419
2420
|
const r = {
|
|
2420
2421
|
options: {
|
|
2421
2422
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2423,7 +2424,7 @@ function Kr(t, e) {
|
|
|
2423
2424
|
name: t,
|
|
2424
2425
|
arg: e
|
|
2425
2426
|
};
|
|
2426
|
-
if (t === "postMessage" &&
|
|
2427
|
+
if (t === "postMessage" && qr(e))
|
|
2427
2428
|
return window.__offline_bridge_postMessage(e);
|
|
2428
2429
|
window.__offline_bridge_postMessage({
|
|
2429
2430
|
type: "WEB_INVOKE_APPSERVICE",
|
|
@@ -2431,10 +2432,10 @@ function Kr(t, e) {
|
|
|
2431
2432
|
pageId: ""
|
|
2432
2433
|
});
|
|
2433
2434
|
}
|
|
2434
|
-
function
|
|
2435
|
-
be() ?
|
|
2435
|
+
function pe(t, e) {
|
|
2436
|
+
be() ? Br(t, e) : Te() ? Gr(t, e) : ee() ? jr(t, e) : Ne() ? Kr(t, e) : Vr(t, e);
|
|
2436
2437
|
}
|
|
2437
|
-
class
|
|
2438
|
+
class pt extends mt {
|
|
2438
2439
|
constructor() {
|
|
2439
2440
|
super("weixin");
|
|
2440
2441
|
}
|
|
@@ -2463,7 +2464,7 @@ class ht extends gt {
|
|
|
2463
2464
|
return o.call(window.wx.miniProgram, c);
|
|
2464
2465
|
}
|
|
2465
2466
|
}
|
|
2466
|
-
E.debug(`使用消息桥接执行: ${e}`),
|
|
2467
|
+
E.debug(`使用消息桥接执行: ${e}`), pe(e, e === "navigateBack" ? { delta: n } : { url: i });
|
|
2467
2468
|
}, {
|
|
2468
2469
|
platform: this.name,
|
|
2469
2470
|
method: "performNavigation",
|
|
@@ -2481,7 +2482,7 @@ class ht extends gt {
|
|
|
2481
2482
|
const { data: r } = e;
|
|
2482
2483
|
if (this.isWeixinApiAvailable())
|
|
2483
2484
|
return window.wx.miniProgram.postMessage({ data: r });
|
|
2484
|
-
|
|
2485
|
+
pe("postMessage", r);
|
|
2485
2486
|
}, {
|
|
2486
2487
|
platform: this.name,
|
|
2487
2488
|
method: "performPostMessage",
|
|
@@ -2509,19 +2510,19 @@ class ht extends gt {
|
|
|
2509
2510
|
});
|
|
2510
2511
|
}
|
|
2511
2512
|
}
|
|
2512
|
-
const re = new
|
|
2513
|
-
var
|
|
2513
|
+
const re = new pt(), Jr = (t) => re.navigateTo(t), Hr = (t) => re.navigateBack(t), zr = (t) => re.switchTab(t), Yr = (t) => re.reLaunch(t), Xr = (t) => re.redirectTo(t), Zr = (t) => re.postMessage(t), Qr = (t) => re.getEnv(t);
|
|
2514
|
+
var wt = /* @__PURE__ */ Object.freeze({
|
|
2514
2515
|
__proto__: null,
|
|
2515
|
-
WeixinPlatform:
|
|
2516
|
-
getEnv:
|
|
2517
|
-
navigateBack:
|
|
2518
|
-
navigateTo:
|
|
2519
|
-
postMessage:
|
|
2520
|
-
reLaunch:
|
|
2521
|
-
redirectTo:
|
|
2522
|
-
switchTab:
|
|
2516
|
+
WeixinPlatform: pt,
|
|
2517
|
+
getEnv: Qr,
|
|
2518
|
+
navigateBack: Hr,
|
|
2519
|
+
navigateTo: Jr,
|
|
2520
|
+
postMessage: Zr,
|
|
2521
|
+
reLaunch: Yr,
|
|
2522
|
+
redirectTo: Xr,
|
|
2523
|
+
switchTab: zr
|
|
2523
2524
|
});
|
|
2524
|
-
class
|
|
2525
|
+
class Et extends mt {
|
|
2525
2526
|
constructor() {
|
|
2526
2527
|
super("app");
|
|
2527
2528
|
}
|
|
@@ -2534,7 +2535,7 @@ class pt extends gt {
|
|
|
2534
2535
|
performNavigation(e, r) {
|
|
2535
2536
|
return f.safeExecute(() => {
|
|
2536
2537
|
const { url: i, delta: n } = r;
|
|
2537
|
-
|
|
2538
|
+
pe(e, e === "navigateBack" ? { delta: n } : { url: i });
|
|
2538
2539
|
}, {
|
|
2539
2540
|
platform: this.name,
|
|
2540
2541
|
method: "performNavigation",
|
|
@@ -2550,7 +2551,7 @@ class pt extends gt {
|
|
|
2550
2551
|
performPostMessage(e) {
|
|
2551
2552
|
return f.safeExecute(() => {
|
|
2552
2553
|
const { data: r } = e;
|
|
2553
|
-
|
|
2554
|
+
pe("postMessage", r);
|
|
2554
2555
|
}, {
|
|
2555
2556
|
platform: this.name,
|
|
2556
2557
|
method: "performPostMessage",
|
|
@@ -2568,61 +2569,61 @@ class pt extends gt {
|
|
|
2568
2569
|
throw new Error("Callback function is required for getEnv");
|
|
2569
2570
|
const r = {};
|
|
2570
2571
|
let i = !1;
|
|
2571
|
-
|
|
2572
|
+
ee() ? (r.offline = !0, i = !0) : be() ? (r.uvue = !0, i = !0) : Te() ? (r.nvue = !0, i = !0) : Ne() && (r.plus = !0, i = !0), i ? r.app = !0 : r.h5 = !0, e(r);
|
|
2572
2573
|
}, {
|
|
2573
2574
|
platform: this.name,
|
|
2574
2575
|
method: "performGetEnv"
|
|
2575
2576
|
});
|
|
2576
2577
|
}
|
|
2577
2578
|
}
|
|
2578
|
-
const ie = new
|
|
2579
|
-
var
|
|
2579
|
+
const ie = new Et(), ei = (t) => ie.navigateTo(t), ti = (t) => ie.navigateBack(t), ri = (t) => ie.switchTab(t), ii = (t) => ie.reLaunch(t), ni = (t) => ie.redirectTo(t), ai = (t) => ie.postMessage(t), si = (t) => ie.getEnv(t);
|
|
2580
|
+
var yt = /* @__PURE__ */ Object.freeze({
|
|
2580
2581
|
__proto__: null,
|
|
2581
|
-
AppPlatform:
|
|
2582
|
-
getEnv:
|
|
2583
|
-
navigateBack:
|
|
2584
|
-
navigateTo:
|
|
2585
|
-
postMessage:
|
|
2586
|
-
reLaunch:
|
|
2587
|
-
redirectTo:
|
|
2588
|
-
switchTab:
|
|
2582
|
+
AppPlatform: Et,
|
|
2583
|
+
getEnv: si,
|
|
2584
|
+
navigateBack: ti,
|
|
2585
|
+
navigateTo: ei,
|
|
2586
|
+
postMessage: ai,
|
|
2587
|
+
reLaunch: ii,
|
|
2588
|
+
redirectTo: ni,
|
|
2589
|
+
switchTab: ri
|
|
2589
2590
|
});
|
|
2590
|
-
function
|
|
2591
|
-
return M() ?
|
|
2592
|
-
}
|
|
2593
|
-
function ni(t) {
|
|
2594
|
-
return we().navigateTo(t);
|
|
2595
|
-
}
|
|
2596
|
-
function ai(t) {
|
|
2597
|
-
return we().navigateBack(t);
|
|
2598
|
-
}
|
|
2599
|
-
function si(t) {
|
|
2600
|
-
return we().switchTab(t);
|
|
2591
|
+
function Ee() {
|
|
2592
|
+
return M() ? wt : yt;
|
|
2601
2593
|
}
|
|
2602
2594
|
function oi(t) {
|
|
2603
|
-
return
|
|
2595
|
+
return Ee().navigateTo(t);
|
|
2604
2596
|
}
|
|
2605
2597
|
function ci(t) {
|
|
2606
|
-
return
|
|
2607
|
-
}
|
|
2608
|
-
function Et() {
|
|
2609
|
-
return M() ? mt : wt;
|
|
2598
|
+
return Ee().navigateBack(t);
|
|
2610
2599
|
}
|
|
2611
|
-
function ui(t
|
|
2612
|
-
return
|
|
2600
|
+
function ui(t) {
|
|
2601
|
+
return Ee().switchTab(t);
|
|
2613
2602
|
}
|
|
2614
2603
|
function li(t) {
|
|
2615
|
-
return
|
|
2604
|
+
return Ee().reLaunch(t);
|
|
2616
2605
|
}
|
|
2617
2606
|
function fi(t) {
|
|
2607
|
+
return Ee().redirectTo(t);
|
|
2608
|
+
}
|
|
2609
|
+
function At() {
|
|
2610
|
+
return M() ? wt : yt;
|
|
2611
|
+
}
|
|
2612
|
+
function di(t = {}) {
|
|
2613
|
+
return At().postMessage(t);
|
|
2614
|
+
}
|
|
2615
|
+
function gi(t) {
|
|
2616
|
+
return At().getEnv(t);
|
|
2617
|
+
}
|
|
2618
|
+
function hi(t) {
|
|
2618
2619
|
return t && typeof t == "object" && t.__v_raw ? t.__v_raw : t;
|
|
2619
2620
|
}
|
|
2620
|
-
function
|
|
2621
|
+
function mi() {
|
|
2621
2622
|
return "qsh_callback_" + Date.now() + "_" + Math.random().toString(36).substring(2, 9);
|
|
2622
2623
|
}
|
|
2623
|
-
class
|
|
2624
|
+
class pi {
|
|
2624
2625
|
constructor() {
|
|
2625
|
-
this.callbacks = /* @__PURE__ */ new Map(), this.timeouts = /* @__PURE__ */ new Map(), this.persistentCallbacksByApi = /* @__PURE__ */ new Map(), this.defaultTimeout =
|
|
2626
|
+
this.callbacks = /* @__PURE__ */ new Map(), this.timeouts = /* @__PURE__ */ new Map(), this.persistentCallbacksByApi = /* @__PURE__ */ new Map(), this.defaultTimeout = 15e3, typeof window != "undefined" && (window.qshWebviewCallbacks || (window.qshWebviewCallbacks = {})), I.debug("WebView 桥接器已初始化");
|
|
2626
2627
|
}
|
|
2627
2628
|
/**
|
|
2628
2629
|
* 向主应用发送 API 调用消息
|
|
@@ -2637,7 +2638,7 @@ class gi {
|
|
|
2637
2638
|
var m;
|
|
2638
2639
|
if (typeof window != "undefined" && window === window.parent && !window.plus && !window.__uniapp_x_postMessage && !window.__uniapp_x_ && !window.__dcloud_weex_postMessage && !window.__dcloud_weex_ && !ee()) {
|
|
2639
2640
|
const _ = new N(
|
|
2640
|
-
|
|
2641
|
+
v.PLATFORM_NOT_SUPPORTED,
|
|
2641
2642
|
"当前不在宿主 WebView 容器中,无法发送消息"
|
|
2642
2643
|
);
|
|
2643
2644
|
i && typeof i.fail == "function" && i.fail({ errMsg: _.message, code: "NOT_IN_CONTAINER" }), i && typeof i.complete == "function" && i.complete({ success: !1, error: { errMsg: _.message } });
|
|
@@ -2660,7 +2661,7 @@ class gi {
|
|
|
2660
2661
|
}), i.complete && i.complete({ success: !1 });
|
|
2661
2662
|
return;
|
|
2662
2663
|
}
|
|
2663
|
-
const u =
|
|
2664
|
+
const u = mi();
|
|
2664
2665
|
if (i.success || i.fail || i.complete) {
|
|
2665
2666
|
if (this.callbacks.set(u, p(g({}, i), {
|
|
2666
2667
|
context: c
|
|
@@ -2694,7 +2695,7 @@ class gi {
|
|
|
2694
2695
|
callbackId: u,
|
|
2695
2696
|
hasSuccess: !!i.success,
|
|
2696
2697
|
hasFail: !!i.fail
|
|
2697
|
-
}), console.log("message:", JSON.stringify(
|
|
2698
|
+
}), console.log("message:", JSON.stringify(hi(C), null, 2)), pe("postMessage", C);
|
|
2698
2699
|
}
|
|
2699
2700
|
}), {
|
|
2700
2701
|
context: "WebViewBridge.callApi",
|
|
@@ -2773,18 +2774,18 @@ class gi {
|
|
|
2773
2774
|
};
|
|
2774
2775
|
}
|
|
2775
2776
|
}
|
|
2776
|
-
const
|
|
2777
|
-
function
|
|
2777
|
+
const It = new pi(), O = (t, e, r) => It.callApi(t, e, r), se = (t) => It.cleanupPersistentCallbacksByApi(t);
|
|
2778
|
+
function Pt() {
|
|
2778
2779
|
return J(!0);
|
|
2779
2780
|
}
|
|
2780
|
-
function
|
|
2781
|
+
function wi(t) {
|
|
2781
2782
|
return t === "offline";
|
|
2782
2783
|
}
|
|
2783
|
-
function
|
|
2784
|
+
function Ei(t = {}) {
|
|
2784
2785
|
return f.safeExecute(() => {
|
|
2785
2786
|
s.debug("Call getCode through offline webview bridge", {
|
|
2786
2787
|
clientId: t.clientId
|
|
2787
|
-
}),
|
|
2788
|
+
}), O(
|
|
2788
2789
|
"getCode",
|
|
2789
2790
|
{
|
|
2790
2791
|
clientId: t.clientId
|
|
@@ -2803,13 +2804,13 @@ function mi(t = {}) {
|
|
|
2803
2804
|
);
|
|
2804
2805
|
}, {
|
|
2805
2806
|
context: "getCodeInHost",
|
|
2806
|
-
platform:
|
|
2807
|
+
platform: Pt().type
|
|
2807
2808
|
});
|
|
2808
2809
|
}
|
|
2809
|
-
function
|
|
2810
|
+
function yi(t = {}) {
|
|
2810
2811
|
return f.safeExecute(() => {
|
|
2811
2812
|
var i, n;
|
|
2812
|
-
const e =
|
|
2813
|
+
const e = Pt(), r = String((t == null ? void 0 : t.clientId) || "").trim();
|
|
2813
2814
|
if (!r) {
|
|
2814
2815
|
const a = {
|
|
2815
2816
|
errMsg: "clientId is required",
|
|
@@ -2818,7 +2819,7 @@ function pi(t = {}) {
|
|
|
2818
2819
|
s.error("Get code missing clientId"), (i = t.fail) == null || i.call(t, a);
|
|
2819
2820
|
return;
|
|
2820
2821
|
}
|
|
2821
|
-
if (!
|
|
2822
|
+
if (!wi(e.type)) {
|
|
2822
2823
|
const a = {
|
|
2823
2824
|
errMsg: `Current environment (${e.type}) does not support getCode`,
|
|
2824
2825
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -2828,7 +2829,7 @@ function pi(t = {}) {
|
|
|
2828
2829
|
}), (n = t.fail) == null || n.call(t, a);
|
|
2829
2830
|
return;
|
|
2830
2831
|
}
|
|
2831
|
-
|
|
2832
|
+
Ei(p(g({}, t), {
|
|
2832
2833
|
clientId: r
|
|
2833
2834
|
}));
|
|
2834
2835
|
}, {
|
|
@@ -2836,11 +2837,11 @@ function pi(t = {}) {
|
|
|
2836
2837
|
options: t
|
|
2837
2838
|
});
|
|
2838
2839
|
}
|
|
2839
|
-
function
|
|
2840
|
+
function Mt() {
|
|
2840
2841
|
return J(!0);
|
|
2841
2842
|
}
|
|
2842
|
-
const
|
|
2843
|
-
function
|
|
2843
|
+
const rt = ["release", "trial", "develop"];
|
|
2844
|
+
function Ai(t = {}) {
|
|
2844
2845
|
const e = String((t == null ? void 0 : t.appid) || "").trim(), r = (t == null ? void 0 : t.path) == null ? "" : t.path, i = t == null ? void 0 : t.env, n = i == null || i === "" ? void 0 : String(i).trim();
|
|
2845
2846
|
if (!e)
|
|
2846
2847
|
throw {
|
|
@@ -2852,9 +2853,9 @@ function wi(t = {}) {
|
|
|
2852
2853
|
errMsg: "path must be a string",
|
|
2853
2854
|
code: "PARAM_TYPE_ERROR"
|
|
2854
2855
|
};
|
|
2855
|
-
if (n !== void 0 && !
|
|
2856
|
+
if (n !== void 0 && !rt.includes(n))
|
|
2856
2857
|
throw {
|
|
2857
|
-
errMsg: `env must be one of ${
|
|
2858
|
+
errMsg: `env must be one of ${rt.join("/")}`,
|
|
2858
2859
|
code: "PARAM_INVALID"
|
|
2859
2860
|
};
|
|
2860
2861
|
return p(g({}, t), {
|
|
@@ -2863,13 +2864,13 @@ function wi(t = {}) {
|
|
|
2863
2864
|
env: n
|
|
2864
2865
|
});
|
|
2865
2866
|
}
|
|
2866
|
-
function
|
|
2867
|
+
function Ii() {
|
|
2867
2868
|
return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.postMessage == "function" && typeof window.wx.miniProgram.navigateBack == "function";
|
|
2868
2869
|
}
|
|
2869
|
-
function
|
|
2870
|
+
function Pi(t = {}) {
|
|
2870
2871
|
return f.safeExecute(() => {
|
|
2871
2872
|
var r;
|
|
2872
|
-
if (!
|
|
2873
|
+
if (!Ii()) {
|
|
2873
2874
|
const i = {
|
|
2874
2875
|
errMsg: "wx.miniProgram.postMessage or wx.miniProgram.navigateBack is not available",
|
|
2875
2876
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -2924,13 +2925,13 @@ function yi(t = {}) {
|
|
|
2924
2925
|
platform: "weixin"
|
|
2925
2926
|
});
|
|
2926
2927
|
}
|
|
2927
|
-
function
|
|
2928
|
+
function Mi(t = {}) {
|
|
2928
2929
|
return f.safeExecute(() => (s.debug("Call navigateToMiniProgram through webview bridge", {
|
|
2929
2930
|
appid: t.appid,
|
|
2930
2931
|
path: t.path,
|
|
2931
2932
|
env: t.env
|
|
2932
2933
|
}), new Promise((e, r) => {
|
|
2933
|
-
|
|
2934
|
+
O(
|
|
2934
2935
|
"navigateToMiniProgram",
|
|
2935
2936
|
{
|
|
2936
2937
|
appid: t.appid,
|
|
@@ -2951,16 +2952,16 @@ function Ai(t = {}) {
|
|
|
2951
2952
|
);
|
|
2952
2953
|
})), {
|
|
2953
2954
|
context: "navigateToMiniProgramInHost",
|
|
2954
|
-
platform:
|
|
2955
|
+
platform: Mt().type
|
|
2955
2956
|
});
|
|
2956
2957
|
}
|
|
2957
|
-
function
|
|
2958
|
+
function Ci(t = {}) {
|
|
2958
2959
|
return f.safeExecute(() => {
|
|
2959
2960
|
var i;
|
|
2960
|
-
const e =
|
|
2961
|
+
const e = Mt();
|
|
2961
2962
|
let r;
|
|
2962
2963
|
try {
|
|
2963
|
-
r =
|
|
2964
|
+
r = Ai(t);
|
|
2964
2965
|
} catch (n) {
|
|
2965
2966
|
s.error("Navigate to mini program params validation failed", n), (i = t.fail) == null || i.call(t, n);
|
|
2966
2967
|
return;
|
|
@@ -2970,39 +2971,51 @@ function Ii(t = {}) {
|
|
|
2970
2971
|
appid: r.appid,
|
|
2971
2972
|
path: r.path,
|
|
2972
2973
|
env: r.env
|
|
2973
|
-
}), e.isWeixinMiniProgram ?
|
|
2974
|
+
}), e.isWeixinMiniProgram ? Pi(r) : Mi(r);
|
|
2974
2975
|
}, {
|
|
2975
2976
|
context: "navigateToMiniProgram",
|
|
2976
2977
|
options: t
|
|
2977
2978
|
});
|
|
2978
2979
|
}
|
|
2979
|
-
function
|
|
2980
|
+
function Ct() {
|
|
2980
2981
|
return J(!0);
|
|
2981
2982
|
}
|
|
2982
|
-
|
|
2983
|
-
|
|
2983
|
+
const it = ["doc", "xls", "ppt", "pdf", "docx", "xlsx", "pptx"];
|
|
2984
|
+
function _i(t = {}) {
|
|
2985
|
+
const e = String((t == null ? void 0 : t.url) || "").trim(), r = String((t == null ? void 0 : t.fileType) || "").trim().toLowerCase(), i = (t == null ? void 0 : t.showMenu) == null ? !1 : t.showMenu;
|
|
2984
2986
|
if (!e)
|
|
2985
2987
|
throw {
|
|
2986
2988
|
errMsg: "url is required",
|
|
2987
2989
|
code: "PARAM_MISSING"
|
|
2988
2990
|
};
|
|
2989
|
-
if (
|
|
2991
|
+
if (!r)
|
|
2992
|
+
throw {
|
|
2993
|
+
errMsg: "fileType is required",
|
|
2994
|
+
code: "PARAM_MISSING"
|
|
2995
|
+
};
|
|
2996
|
+
if (!it.includes(r))
|
|
2997
|
+
throw {
|
|
2998
|
+
errMsg: `fileType must be one of ${it.join("/")}`,
|
|
2999
|
+
code: "PARAM_INVALID"
|
|
3000
|
+
};
|
|
3001
|
+
if (typeof i != "boolean")
|
|
2990
3002
|
throw {
|
|
2991
3003
|
errMsg: "showMenu must be a boolean",
|
|
2992
3004
|
code: "PARAM_TYPE_ERROR"
|
|
2993
3005
|
};
|
|
2994
3006
|
return p(g({}, t), {
|
|
2995
3007
|
url: e,
|
|
2996
|
-
|
|
3008
|
+
fileType: r,
|
|
3009
|
+
showMenu: i
|
|
2997
3010
|
});
|
|
2998
3011
|
}
|
|
2999
|
-
function
|
|
3012
|
+
function Ri() {
|
|
3000
3013
|
return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.postMessage == "function" && typeof window.wx.miniProgram.navigateBack == "function";
|
|
3001
3014
|
}
|
|
3002
|
-
function
|
|
3015
|
+
function Si(t = {}) {
|
|
3003
3016
|
return f.safeExecute(() => {
|
|
3004
3017
|
var r;
|
|
3005
|
-
if (!
|
|
3018
|
+
if (!Ri()) {
|
|
3006
3019
|
const i = {
|
|
3007
3020
|
errMsg: "wx.miniProgram.postMessage or wx.miniProgram.navigateBack is not available",
|
|
3008
3021
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -3015,12 +3028,14 @@ function Ci(t = {}) {
|
|
|
3015
3028
|
api: "filePreview",
|
|
3016
3029
|
params: {
|
|
3017
3030
|
url: t.url,
|
|
3031
|
+
fileType: t.fileType,
|
|
3018
3032
|
showMenu: t.showMenu
|
|
3019
3033
|
},
|
|
3020
3034
|
timestamp: Date.now()
|
|
3021
3035
|
};
|
|
3022
3036
|
return s.debug("Relay filePreview through wx.miniProgram.postMessage", {
|
|
3023
3037
|
url: t.url,
|
|
3038
|
+
fileType: t.fileType,
|
|
3024
3039
|
showMenu: t.showMenu
|
|
3025
3040
|
}), new Promise((i, n) => {
|
|
3026
3041
|
var a;
|
|
@@ -3039,6 +3054,7 @@ function Ci(t = {}) {
|
|
|
3039
3054
|
});
|
|
3040
3055
|
s.info("File preview request queued in weixin web-view", {
|
|
3041
3056
|
url: t.url,
|
|
3057
|
+
fileType: t.fileType,
|
|
3042
3058
|
showMenu: t.showMenu
|
|
3043
3059
|
}), (u = t.success) == null || u.call(t, c), i(c);
|
|
3044
3060
|
},
|
|
@@ -3054,15 +3070,17 @@ function Ci(t = {}) {
|
|
|
3054
3070
|
platform: "weixin"
|
|
3055
3071
|
});
|
|
3056
3072
|
}
|
|
3057
|
-
function
|
|
3073
|
+
function Oi(t = {}) {
|
|
3058
3074
|
return f.safeExecute(() => (s.debug("Call filePreview through webview bridge", {
|
|
3059
3075
|
url: t.url,
|
|
3076
|
+
fileType: t.fileType,
|
|
3060
3077
|
showMenu: t.showMenu
|
|
3061
3078
|
}), new Promise((e, r) => {
|
|
3062
|
-
|
|
3079
|
+
O(
|
|
3063
3080
|
"filePreview",
|
|
3064
3081
|
{
|
|
3065
3082
|
url: t.url,
|
|
3083
|
+
fileType: t.fileType,
|
|
3066
3084
|
showMenu: t.showMenu
|
|
3067
3085
|
},
|
|
3068
3086
|
{
|
|
@@ -3079,16 +3097,16 @@ function _i(t = {}) {
|
|
|
3079
3097
|
);
|
|
3080
3098
|
})), {
|
|
3081
3099
|
context: "filePreviewInHost",
|
|
3082
|
-
platform:
|
|
3100
|
+
platform: Ct().type
|
|
3083
3101
|
});
|
|
3084
3102
|
}
|
|
3085
|
-
function
|
|
3103
|
+
function Ni(t = {}) {
|
|
3086
3104
|
return f.safeExecute(() => {
|
|
3087
3105
|
var i;
|
|
3088
|
-
const e =
|
|
3106
|
+
const e = Ct();
|
|
3089
3107
|
let r;
|
|
3090
3108
|
try {
|
|
3091
|
-
r =
|
|
3109
|
+
r = _i(t);
|
|
3092
3110
|
} catch (n) {
|
|
3093
3111
|
s.error("File preview params validation failed", n), (i = t.fail) == null || i.call(t, n);
|
|
3094
3112
|
return;
|
|
@@ -3096,32 +3114,33 @@ function Ri(t = {}) {
|
|
|
3096
3114
|
return s.info("Start filePreview", {
|
|
3097
3115
|
platform: e.type,
|
|
3098
3116
|
url: r.url,
|
|
3117
|
+
fileType: r.fileType,
|
|
3099
3118
|
showMenu: r.showMenu
|
|
3100
|
-
}), e.isWeixinMiniProgram ?
|
|
3119
|
+
}), e.isWeixinMiniProgram ? Si(r) : Oi(r);
|
|
3101
3120
|
}, {
|
|
3102
3121
|
context: "filePreview",
|
|
3103
3122
|
options: t
|
|
3104
3123
|
});
|
|
3105
3124
|
}
|
|
3106
|
-
function
|
|
3125
|
+
function Ti(t = "") {
|
|
3107
3126
|
return /^https?:\/\//i.test(String(t || "").trim());
|
|
3108
3127
|
}
|
|
3109
|
-
function
|
|
3128
|
+
function bi(t) {
|
|
3110
3129
|
if (t == null || t === "") return !1;
|
|
3111
3130
|
if (typeof t == "boolean") return t;
|
|
3112
3131
|
const e = String(t).trim().toLowerCase();
|
|
3113
3132
|
return e === "true" || e === "1";
|
|
3114
3133
|
}
|
|
3115
|
-
function
|
|
3134
|
+
function vi() {
|
|
3116
3135
|
return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.postMessage == "function" && typeof window.wx.miniProgram.navigateBack == "function";
|
|
3117
3136
|
}
|
|
3118
|
-
function
|
|
3137
|
+
function xi(t = {}) {
|
|
3119
3138
|
if (!t || typeof t != "object")
|
|
3120
3139
|
throw {
|
|
3121
3140
|
errMsg: "manualShare options must be an object",
|
|
3122
3141
|
code: "PARAM_TYPE_ERROR"
|
|
3123
3142
|
};
|
|
3124
|
-
const e = String(t.title || "").trim(), r = String(t.h5Url || "").trim(), i = String(t.clientId || "").trim(), n =
|
|
3143
|
+
const e = String(t.title || "").trim(), r = String(t.h5Url || "").trim(), i = String(t.clientId || "").trim(), n = bi(t.isPublic), a = String(t.imageUrl || "").trim(), o = String(t.description || t.desc || "").trim();
|
|
3125
3144
|
if (!e)
|
|
3126
3145
|
throw {
|
|
3127
3146
|
errMsg: "manualShare: title is required",
|
|
@@ -3137,7 +3156,7 @@ function bi(t = {}) {
|
|
|
3137
3156
|
errMsg: "manualShare: clientId is required",
|
|
3138
3157
|
code: "PARAM_MISSING"
|
|
3139
3158
|
};
|
|
3140
|
-
if (r && !
|
|
3159
|
+
if (r && !Ti(r))
|
|
3141
3160
|
throw {
|
|
3142
3161
|
errMsg: "manualShare: h5Url must be a valid http(s) url",
|
|
3143
3162
|
code: "PARAM_INVALID"
|
|
@@ -3154,7 +3173,7 @@ function bi(t = {}) {
|
|
|
3154
3173
|
complete: t.complete
|
|
3155
3174
|
};
|
|
3156
3175
|
}
|
|
3157
|
-
function
|
|
3176
|
+
function Li(t) {
|
|
3158
3177
|
return {
|
|
3159
3178
|
type: "qsh_api_call",
|
|
3160
3179
|
api: "manualShare",
|
|
@@ -3169,9 +3188,9 @@ function vi(t) {
|
|
|
3169
3188
|
timestamp: Date.now()
|
|
3170
3189
|
};
|
|
3171
3190
|
}
|
|
3172
|
-
function
|
|
3191
|
+
function Di(t) {
|
|
3173
3192
|
return new Promise((e, r) => {
|
|
3174
|
-
const i =
|
|
3193
|
+
const i = Li(t);
|
|
3175
3194
|
s.debug(
|
|
3176
3195
|
"Relay manualShare through wx.miniProgram.postMessage",
|
|
3177
3196
|
i
|
|
@@ -3204,14 +3223,14 @@ function Ti(t) {
|
|
|
3204
3223
|
});
|
|
3205
3224
|
});
|
|
3206
3225
|
}
|
|
3207
|
-
function
|
|
3226
|
+
function _t(t = {}) {
|
|
3208
3227
|
return f.safeExecute(
|
|
3209
3228
|
() => {
|
|
3210
3229
|
var i, n, a, o, c, u;
|
|
3211
3230
|
const e = J(!0);
|
|
3212
3231
|
let r;
|
|
3213
3232
|
try {
|
|
3214
|
-
r =
|
|
3233
|
+
r = xi(t);
|
|
3215
3234
|
} catch (m) {
|
|
3216
3235
|
return (i = t.fail) == null || i.call(t, m), (n = t.complete) == null || n.call(t, m), Promise.reject(m);
|
|
3217
3236
|
}
|
|
@@ -3222,14 +3241,14 @@ function Mt(t = {}) {
|
|
|
3222
3241
|
};
|
|
3223
3242
|
return (a = r.fail) == null || a.call(r, m), (o = r.complete) == null || o.call(r, m), Promise.reject(m);
|
|
3224
3243
|
}
|
|
3225
|
-
if (!
|
|
3244
|
+
if (!vi()) {
|
|
3226
3245
|
const m = {
|
|
3227
3246
|
errMsg: "wx.miniProgram.postMessage or wx.miniProgram.navigateBack is not available",
|
|
3228
3247
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3229
3248
|
};
|
|
3230
3249
|
return (c = r.fail) == null || c.call(r, m), (u = r.complete) == null || u.call(r, m), Promise.reject(m);
|
|
3231
3250
|
}
|
|
3232
|
-
return
|
|
3251
|
+
return Di(r).then((m) => {
|
|
3233
3252
|
var _, C;
|
|
3234
3253
|
return (_ = r.success) == null || _.call(r, m), (C = r.complete) == null || C.call(r, m), m;
|
|
3235
3254
|
}).catch((m) => {
|
|
@@ -3243,37 +3262,37 @@ function Mt(t = {}) {
|
|
|
3243
3262
|
}
|
|
3244
3263
|
);
|
|
3245
3264
|
}
|
|
3246
|
-
function
|
|
3265
|
+
function Ui(t = {}) {
|
|
3247
3266
|
return new Promise((e, r) => {
|
|
3248
|
-
|
|
3267
|
+
_t(p(g({}, t), {
|
|
3249
3268
|
success: e,
|
|
3250
3269
|
fail: r
|
|
3251
3270
|
}));
|
|
3252
3271
|
});
|
|
3253
3272
|
}
|
|
3254
|
-
const
|
|
3273
|
+
const _e = {
|
|
3255
3274
|
ALBUM: "album",
|
|
3256
3275
|
// 相册
|
|
3257
3276
|
CAMERA: "camera"
|
|
3258
3277
|
// 相机
|
|
3259
|
-
},
|
|
3278
|
+
}, Re = {
|
|
3260
3279
|
ORIGINAL: "original",
|
|
3261
3280
|
// 原图
|
|
3262
3281
|
COMPRESSED: "compressed"
|
|
3263
3282
|
// 压缩图
|
|
3264
|
-
},
|
|
3283
|
+
}, Wi = {
|
|
3265
3284
|
count: 9,
|
|
3266
|
-
sizeType: [
|
|
3267
|
-
sourceType: [
|
|
3285
|
+
sizeType: [Re.ORIGINAL, Re.COMPRESSED],
|
|
3286
|
+
sourceType: [_e.ALBUM, _e.CAMERA]
|
|
3268
3287
|
};
|
|
3269
|
-
function
|
|
3270
|
-
const e = g(g({},
|
|
3271
|
-
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 = [
|
|
3288
|
+
function $i(t = {}) {
|
|
3289
|
+
const e = g(g({}, Wi), t);
|
|
3290
|
+
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 = [Re.COMPRESSED]), e.sourceType.length === 0 && (e.sourceType = [_e.ALBUM]), e;
|
|
3272
3291
|
}
|
|
3273
|
-
function
|
|
3292
|
+
function Rt() {
|
|
3274
3293
|
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(d.type);
|
|
3275
3294
|
}
|
|
3276
|
-
function
|
|
3295
|
+
function St(t) {
|
|
3277
3296
|
return f.safeExecute(() => {
|
|
3278
3297
|
var e;
|
|
3279
3298
|
if (!window.wx) {
|
|
@@ -3285,7 +3304,7 @@ function _t(t) {
|
|
|
3285
3304
|
return;
|
|
3286
3305
|
}
|
|
3287
3306
|
if (!ce()) {
|
|
3288
|
-
s.info("等待微信配置完成"), te().then(() =>
|
|
3307
|
+
s.info("等待微信配置完成"), te().then(() => St(t)).catch((r) => {
|
|
3289
3308
|
var i;
|
|
3290
3309
|
s.error("微信配置失败", r), (i = t.fail) == null || i.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
3291
3310
|
});
|
|
@@ -3310,9 +3329,9 @@ function _t(t) {
|
|
|
3310
3329
|
platform: "weixin"
|
|
3311
3330
|
});
|
|
3312
3331
|
}
|
|
3313
|
-
function
|
|
3332
|
+
function Fi(t) {
|
|
3314
3333
|
return f.safeExecute(() => {
|
|
3315
|
-
s.debug("通过 WebView 桥接调用图片选择", t),
|
|
3334
|
+
s.debug("通过 WebView 桥接调用图片选择", t), O("chooseImage", p(g({}, t), { disableTimeout: !0 }), {
|
|
3316
3335
|
success: (e) => {
|
|
3317
3336
|
var r, i;
|
|
3318
3337
|
s.info("UniApp 图片选择成功", {
|
|
@@ -3330,10 +3349,10 @@ function Ui(t) {
|
|
|
3330
3349
|
platform: "uniapp"
|
|
3331
3350
|
});
|
|
3332
3351
|
}
|
|
3333
|
-
function
|
|
3352
|
+
function ki(t = {}) {
|
|
3334
3353
|
return f.safeExecute(() => {
|
|
3335
3354
|
var r;
|
|
3336
|
-
if (!
|
|
3355
|
+
if (!Rt()) {
|
|
3337
3356
|
const i = {
|
|
3338
3357
|
errMsg: `当前环境 (${d.type}) 不支持图片选择功能`,
|
|
3339
3358
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -3341,21 +3360,21 @@ function Wi(t = {}) {
|
|
|
3341
3360
|
s.error("平台不支持图片选择", { platform: d.type }), (r = t.fail) == null || r.call(t, i);
|
|
3342
3361
|
return;
|
|
3343
3362
|
}
|
|
3344
|
-
const e =
|
|
3363
|
+
const e = $i(t);
|
|
3345
3364
|
s.info("开始选择图片", {
|
|
3346
3365
|
platform: d.type,
|
|
3347
3366
|
count: e.count,
|
|
3348
3367
|
sizeType: e.sizeType,
|
|
3349
3368
|
sourceType: e.sourceType
|
|
3350
|
-
}), M() ?
|
|
3369
|
+
}), M() ? St(e) : Fi(e);
|
|
3351
3370
|
}, {
|
|
3352
3371
|
context: "chooseImage",
|
|
3353
3372
|
options: t
|
|
3354
3373
|
});
|
|
3355
3374
|
}
|
|
3356
|
-
function
|
|
3375
|
+
function Bi() {
|
|
3357
3376
|
return {
|
|
3358
|
-
supported:
|
|
3377
|
+
supported: Rt(),
|
|
3359
3378
|
environment: d.type,
|
|
3360
3379
|
implementation: M() ? "weixin" : "webview",
|
|
3361
3380
|
features: {
|
|
@@ -3379,20 +3398,20 @@ const Q = {
|
|
|
3379
3398
|
// Data Matrix 码
|
|
3380
3399
|
PDF417: "pdf417"
|
|
3381
3400
|
// PDF417 条码
|
|
3382
|
-
},
|
|
3401
|
+
}, Gi = {
|
|
3383
3402
|
onlyFromCamera: !0,
|
|
3384
3403
|
// 只从相机扫码
|
|
3385
3404
|
scanType: [Q.QR_CODE, Q.BAR_CODE]
|
|
3386
3405
|
// 支持二维码和一维码
|
|
3387
3406
|
};
|
|
3388
|
-
function
|
|
3389
|
-
const e = g(g({},
|
|
3407
|
+
function Ki(t = {}) {
|
|
3408
|
+
const e = g(g({}, Gi), t);
|
|
3390
3409
|
return Array.isArray(e.scanType) || (e.scanType = [e.scanType].filter(Boolean)), e.scanType.length === 0 && (e.scanType = [Q.QR_CODE, Q.BAR_CODE]), e.onlyFromCamera = !!e.onlyFromCamera, e;
|
|
3391
3410
|
}
|
|
3392
|
-
function
|
|
3411
|
+
function Ot() {
|
|
3393
3412
|
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(d.type);
|
|
3394
3413
|
}
|
|
3395
|
-
function
|
|
3414
|
+
function Nt(t) {
|
|
3396
3415
|
return f.safeExecute(() => {
|
|
3397
3416
|
var e;
|
|
3398
3417
|
if (!window.wx) {
|
|
@@ -3404,7 +3423,7 @@ function Ot(t) {
|
|
|
3404
3423
|
return;
|
|
3405
3424
|
}
|
|
3406
3425
|
if (!ce()) {
|
|
3407
|
-
s.info("等待微信配置完成"), te().then(() =>
|
|
3426
|
+
s.info("等待微信配置完成"), te().then(() => Nt(t)).catch((r) => {
|
|
3408
3427
|
var i;
|
|
3409
3428
|
s.error("微信配置失败", r), (i = t.fail) == null || i.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
3410
3429
|
});
|
|
@@ -3420,7 +3439,7 @@ function Ot(t) {
|
|
|
3420
3439
|
const i = {
|
|
3421
3440
|
result: r.resultStr,
|
|
3422
3441
|
// 扫码内容
|
|
3423
|
-
scanType:
|
|
3442
|
+
scanType: Vi(r.resultStr),
|
|
3424
3443
|
// 推测扫码类型
|
|
3425
3444
|
charSet: "utf-8",
|
|
3426
3445
|
// 微信默认 UTF-8
|
|
@@ -3439,12 +3458,12 @@ function Ot(t) {
|
|
|
3439
3458
|
platform: "weixin"
|
|
3440
3459
|
});
|
|
3441
3460
|
}
|
|
3442
|
-
function
|
|
3461
|
+
function Vi(t) {
|
|
3443
3462
|
return t ? t.length > 50 || /[^\d]/.test(t) ? Q.QR_CODE : Q.BAR_CODE : "unknown";
|
|
3444
3463
|
}
|
|
3445
|
-
function
|
|
3464
|
+
function qi(t) {
|
|
3446
3465
|
return f.safeExecute(() => {
|
|
3447
|
-
s.debug("通过 WebView 桥接调用扫码", t),
|
|
3466
|
+
s.debug("通过 WebView 桥接调用扫码", t), O("scanCode", p(g({}, t), { disableTimeout: !0 }), {
|
|
3448
3467
|
success: (e) => {
|
|
3449
3468
|
var r;
|
|
3450
3469
|
s.info("UniApp 扫码成功", {
|
|
@@ -3463,10 +3482,10 @@ function Gi(t) {
|
|
|
3463
3482
|
platform: "uniapp"
|
|
3464
3483
|
});
|
|
3465
3484
|
}
|
|
3466
|
-
function
|
|
3485
|
+
function ji(t = {}) {
|
|
3467
3486
|
return f.safeExecute(() => {
|
|
3468
3487
|
var r;
|
|
3469
|
-
if (!
|
|
3488
|
+
if (!Ot()) {
|
|
3470
3489
|
const i = {
|
|
3471
3490
|
errMsg: `当前环境 (${d.type}) 不支持扫码功能`,
|
|
3472
3491
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -3474,20 +3493,20 @@ function Ki(t = {}) {
|
|
|
3474
3493
|
s.error("平台不支持扫码", { platform: d.type }), (r = t.fail) == null || r.call(t, i);
|
|
3475
3494
|
return;
|
|
3476
3495
|
}
|
|
3477
|
-
const e =
|
|
3496
|
+
const e = Ki(t);
|
|
3478
3497
|
s.info("开始扫码", {
|
|
3479
3498
|
platform: d.type,
|
|
3480
3499
|
onlyFromCamera: e.onlyFromCamera,
|
|
3481
3500
|
scanType: e.scanType
|
|
3482
|
-
}), M() ?
|
|
3501
|
+
}), M() ? Nt(e) : qi(e);
|
|
3483
3502
|
}, {
|
|
3484
3503
|
context: "scanCode",
|
|
3485
3504
|
options: t
|
|
3486
3505
|
});
|
|
3487
3506
|
}
|
|
3488
|
-
function
|
|
3507
|
+
function Ji() {
|
|
3489
3508
|
return {
|
|
3490
|
-
supported:
|
|
3509
|
+
supported: Ot(),
|
|
3491
3510
|
environment: d.type,
|
|
3492
3511
|
implementation: M() ? "weixin" : "webview",
|
|
3493
3512
|
features: {
|
|
@@ -3502,41 +3521,41 @@ function Vi() {
|
|
|
3502
3521
|
}
|
|
3503
3522
|
};
|
|
3504
3523
|
}
|
|
3505
|
-
const
|
|
3506
|
-
function
|
|
3524
|
+
const T = 3.141592653589793, Se = 6378245, Oe = 0.006693421622965943;
|
|
3525
|
+
function Tt(t, e) {
|
|
3507
3526
|
t = +t, e = +e;
|
|
3508
3527
|
let r = -100 + 2 * t + 3 * e + 0.2 * e * e + 0.1 * t * e + 0.2 * Math.sqrt(Math.abs(t));
|
|
3509
|
-
return r += (20 * Math.sin(6 * t *
|
|
3528
|
+
return r += (20 * Math.sin(6 * t * T) + 20 * Math.sin(2 * t * T)) * 2 / 3, r += (20 * Math.sin(e * T) + 40 * Math.sin(e / 3 * T)) * 2 / 3, r += (160 * Math.sin(e / 12 * T) + 320 * Math.sin(e * T / 30)) * 2 / 3, r;
|
|
3510
3529
|
}
|
|
3511
|
-
function
|
|
3530
|
+
function bt(t, e) {
|
|
3512
3531
|
t = +t, e = +e;
|
|
3513
3532
|
let r = 300 + t + 2 * e + 0.1 * t * t + 0.1 * t * e + 0.1 * Math.sqrt(Math.abs(t));
|
|
3514
|
-
return r += (20 * Math.sin(6 * t *
|
|
3533
|
+
return r += (20 * Math.sin(6 * t * T) + 20 * Math.sin(2 * t * T)) * 2 / 3, r += (20 * Math.sin(t * T) + 40 * Math.sin(t / 3 * T)) * 2 / 3, r += (150 * Math.sin(t / 12 * T) + 300 * Math.sin(t / 30 * T)) * 2 / 3, r;
|
|
3515
3534
|
}
|
|
3516
|
-
function
|
|
3535
|
+
function vt(t, e) {
|
|
3517
3536
|
return t = +t, e = +e, !(t > 73.66 && t < 135.05 && e > 3.86 && e < 53.55);
|
|
3518
3537
|
}
|
|
3519
|
-
function
|
|
3520
|
-
if (t = +t, e = +e,
|
|
3538
|
+
function Hi(t, e) {
|
|
3539
|
+
if (t = +t, e = +e, vt(t, e))
|
|
3521
3540
|
return [t, e];
|
|
3522
|
-
let r =
|
|
3523
|
-
const n = e / 180 *
|
|
3541
|
+
let r = Tt(t - 105, e - 35), i = bt(t - 105, e - 35);
|
|
3542
|
+
const n = e / 180 * T;
|
|
3524
3543
|
let a = Math.sin(n);
|
|
3525
3544
|
a = 1 - Oe * a * a;
|
|
3526
3545
|
const o = Math.sqrt(a);
|
|
3527
|
-
r = r * 180 / (
|
|
3546
|
+
r = r * 180 / (Se * (1 - Oe) / (a * o) * T), i = i * 180 / (Se / o * Math.cos(n) * T);
|
|
3528
3547
|
const c = e + r;
|
|
3529
3548
|
return [t + i, c];
|
|
3530
3549
|
}
|
|
3531
|
-
function
|
|
3532
|
-
if (t = +t, e = +e,
|
|
3550
|
+
function zi(t, e) {
|
|
3551
|
+
if (t = +t, e = +e, vt(t, e))
|
|
3533
3552
|
return [t, e];
|
|
3534
|
-
let r =
|
|
3535
|
-
const n = e / 180 *
|
|
3553
|
+
let r = Tt(t - 105, e - 35), i = bt(t - 105, e - 35);
|
|
3554
|
+
const n = e / 180 * T;
|
|
3536
3555
|
let a = Math.sin(n);
|
|
3537
3556
|
a = 1 - Oe * a * a;
|
|
3538
3557
|
const o = Math.sqrt(a);
|
|
3539
|
-
r = r * 180 / (
|
|
3558
|
+
r = r * 180 / (Se * (1 - Oe) / (a * o) * T), i = i * 180 / (Se / o * Math.cos(n) * T);
|
|
3540
3559
|
const c = e + r, u = t + i;
|
|
3541
3560
|
return [t * 2 - u, e * 2 - c];
|
|
3542
3561
|
}
|
|
@@ -3547,28 +3566,28 @@ const L = {
|
|
|
3547
3566
|
// 国测局坐标(火星坐标)
|
|
3548
3567
|
BD09: "bd09"
|
|
3549
3568
|
// 百度坐标
|
|
3550
|
-
},
|
|
3569
|
+
}, Yi = {
|
|
3551
3570
|
type: L.WGS84,
|
|
3552
3571
|
altitude: !1
|
|
3553
|
-
},
|
|
3572
|
+
}, Xi = {
|
|
3554
3573
|
type: L.WGS84,
|
|
3555
3574
|
scale: 12
|
|
3556
3575
|
// 地图缩放级别 1-28
|
|
3557
|
-
},
|
|
3576
|
+
}, Zi = [
|
|
3558
3577
|
L.WGS84,
|
|
3559
3578
|
L.GCJ02
|
|
3560
3579
|
];
|
|
3561
|
-
function
|
|
3562
|
-
const e = g(g({},
|
|
3580
|
+
function Qi(t = {}) {
|
|
3581
|
+
const e = g(g({}, Yi), t);
|
|
3563
3582
|
return Object.values(L).includes(e.type) || (e.type = L.WGS84), e.altitude = !!e.altitude, e;
|
|
3564
3583
|
}
|
|
3565
|
-
function
|
|
3584
|
+
function en(t = {}) {
|
|
3566
3585
|
const e = g({}, t);
|
|
3567
3586
|
return Object.values(L).includes(e.type) || (e.type = L.WGS84), e.needFullAccuracy = !!e.needFullAccuracy, e;
|
|
3568
3587
|
}
|
|
3569
|
-
function
|
|
3570
|
-
const e = g(g({},
|
|
3571
|
-
if (
|
|
3588
|
+
function tn(t = {}) {
|
|
3589
|
+
const e = g(g({}, Xi), t);
|
|
3590
|
+
if (Zi.includes(e.type) || (e.type = L.WGS84), e.latitude === void 0 || e.latitude === null)
|
|
3572
3591
|
throw {
|
|
3573
3592
|
errMsg: "缺少必需参数:latitude(纬度)",
|
|
3574
3593
|
code: "PARAM_MISSING"
|
|
@@ -3626,30 +3645,30 @@ function Zi(t = {}) {
|
|
|
3626
3645
|
}
|
|
3627
3646
|
return e;
|
|
3628
3647
|
}
|
|
3629
|
-
function
|
|
3648
|
+
function rn(t) {
|
|
3630
3649
|
if (t.type !== L.WGS84)
|
|
3631
3650
|
return t;
|
|
3632
|
-
const [e, r] =
|
|
3651
|
+
const [e, r] = Hi(t.longitude, t.latitude);
|
|
3633
3652
|
return p(g({}, t), {
|
|
3634
3653
|
latitude: r,
|
|
3635
3654
|
longitude: e,
|
|
3636
3655
|
type: L.GCJ02
|
|
3637
3656
|
});
|
|
3638
3657
|
}
|
|
3639
|
-
function
|
|
3658
|
+
function nn(t) {
|
|
3640
3659
|
if (t.type !== L.GCJ02)
|
|
3641
3660
|
return t;
|
|
3642
|
-
const [e, r] =
|
|
3661
|
+
const [e, r] = zi(t.longitude, t.latitude);
|
|
3643
3662
|
return p(g({}, t), {
|
|
3644
3663
|
latitude: r,
|
|
3645
3664
|
longitude: e,
|
|
3646
3665
|
type: L.WGS84
|
|
3647
3666
|
});
|
|
3648
3667
|
}
|
|
3649
|
-
function
|
|
3668
|
+
function Ge() {
|
|
3650
3669
|
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(d.type);
|
|
3651
3670
|
}
|
|
3652
|
-
function
|
|
3671
|
+
function xt(t) {
|
|
3653
3672
|
return f.safeExecute(() => {
|
|
3654
3673
|
var e;
|
|
3655
3674
|
if (!window.wx) {
|
|
@@ -3661,7 +3680,7 @@ function vt(t) {
|
|
|
3661
3680
|
return;
|
|
3662
3681
|
}
|
|
3663
3682
|
if (!ce()) {
|
|
3664
|
-
s.info("等待微信配置完成"), te().then(() =>
|
|
3683
|
+
s.info("等待微信配置完成"), te().then(() => xt(t)).catch((r) => {
|
|
3665
3684
|
var i;
|
|
3666
3685
|
s.error("微信配置失败", r), (i = t.fail) == null || i.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
3667
3686
|
});
|
|
@@ -3687,7 +3706,7 @@ function vt(t) {
|
|
|
3687
3706
|
platform: "weixin"
|
|
3688
3707
|
});
|
|
3689
3708
|
}
|
|
3690
|
-
function
|
|
3709
|
+
function Lt(t) {
|
|
3691
3710
|
return f.safeExecute(() => {
|
|
3692
3711
|
var r;
|
|
3693
3712
|
if (!window.wx) {
|
|
@@ -3699,13 +3718,13 @@ function Tt(t) {
|
|
|
3699
3718
|
return;
|
|
3700
3719
|
}
|
|
3701
3720
|
if (!ce()) {
|
|
3702
|
-
s.info("等待微信配置完成"), te().then(() =>
|
|
3721
|
+
s.info("等待微信配置完成"), te().then(() => Lt(t)).catch((i) => {
|
|
3703
3722
|
var n;
|
|
3704
3723
|
s.error("微信配置失败", i), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${i.message}` });
|
|
3705
3724
|
});
|
|
3706
3725
|
return;
|
|
3707
3726
|
}
|
|
3708
|
-
const e =
|
|
3727
|
+
const e = rn(t);
|
|
3709
3728
|
s.debug("调用微信查看位置", e), window.wx.openLocation({
|
|
3710
3729
|
latitude: e.latitude,
|
|
3711
3730
|
longitude: e.longitude,
|
|
@@ -3728,9 +3747,9 @@ function Tt(t) {
|
|
|
3728
3747
|
platform: "weixin"
|
|
3729
3748
|
});
|
|
3730
3749
|
}
|
|
3731
|
-
function
|
|
3750
|
+
function an(t) {
|
|
3732
3751
|
return f.safeExecute(() => {
|
|
3733
|
-
s.debug("通过 WebView 桥接调用获取位置", t),
|
|
3752
|
+
s.debug("通过 WebView 桥接调用获取位置", t), O("getLocation", t, {
|
|
3734
3753
|
success: (e) => {
|
|
3735
3754
|
var r;
|
|
3736
3755
|
s.info("UniApp 获取位置成功", {
|
|
@@ -3749,10 +3768,10 @@ function tn(t) {
|
|
|
3749
3768
|
platform: "uniapp"
|
|
3750
3769
|
});
|
|
3751
3770
|
}
|
|
3752
|
-
function
|
|
3771
|
+
function sn(t) {
|
|
3753
3772
|
return f.safeExecute(() => {
|
|
3754
|
-
const e =
|
|
3755
|
-
s.debug("通过 WebView 桥接调用查看位置", e),
|
|
3773
|
+
const e = nn(t);
|
|
3774
|
+
s.debug("通过 WebView 桥接调用查看位置", e), O("openLocation", e, {
|
|
3756
3775
|
success: (r) => {
|
|
3757
3776
|
var i;
|
|
3758
3777
|
s.info("UniApp 查看位置成功"), (i = t.success) == null || i.call(t, r);
|
|
@@ -3768,10 +3787,10 @@ function rn(t) {
|
|
|
3768
3787
|
platform: "uniapp"
|
|
3769
3788
|
});
|
|
3770
3789
|
}
|
|
3771
|
-
function
|
|
3790
|
+
function on(t = {}) {
|
|
3772
3791
|
return f.safeExecute(() => {
|
|
3773
3792
|
var r;
|
|
3774
|
-
if (!
|
|
3793
|
+
if (!Ge()) {
|
|
3775
3794
|
const i = {
|
|
3776
3795
|
errMsg: `当前环境 (${d.type}) 不支持定位功能`,
|
|
3777
3796
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -3779,21 +3798,21 @@ function nn(t = {}) {
|
|
|
3779
3798
|
s.error("平台不支持定位", { platform: d.type }), (r = t.fail) == null || r.call(t, i);
|
|
3780
3799
|
return;
|
|
3781
3800
|
}
|
|
3782
|
-
const e =
|
|
3801
|
+
const e = Qi(t);
|
|
3783
3802
|
s.info("开始获取位置", {
|
|
3784
3803
|
platform: d.type,
|
|
3785
3804
|
type: e.type,
|
|
3786
3805
|
altitude: e.altitude
|
|
3787
|
-
}), M() ?
|
|
3806
|
+
}), M() ? xt(e) : an(e);
|
|
3788
3807
|
}, {
|
|
3789
3808
|
context: "getLocation",
|
|
3790
3809
|
options: t
|
|
3791
3810
|
});
|
|
3792
3811
|
}
|
|
3793
|
-
function
|
|
3812
|
+
function cn(t = {}) {
|
|
3794
3813
|
return f.safeExecute(() => {
|
|
3795
3814
|
var r, i, n;
|
|
3796
|
-
if (!
|
|
3815
|
+
if (!Ge()) {
|
|
3797
3816
|
const a = {
|
|
3798
3817
|
errMsg: `当前环境 (${d.type}) 不支持查看位置功能`,
|
|
3799
3818
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -3803,7 +3822,7 @@ function an(t = {}) {
|
|
|
3803
3822
|
}
|
|
3804
3823
|
let e;
|
|
3805
3824
|
try {
|
|
3806
|
-
e =
|
|
3825
|
+
e = tn(t);
|
|
3807
3826
|
} catch (a) {
|
|
3808
3827
|
s.error("参数验证失败", a), (i = t.fail) == null || i.call(t, a), (n = t.complete) == null || n.call(t);
|
|
3809
3828
|
return;
|
|
@@ -3814,16 +3833,16 @@ function an(t = {}) {
|
|
|
3814
3833
|
latitude: e.latitude,
|
|
3815
3834
|
longitude: e.longitude,
|
|
3816
3835
|
name: e.name
|
|
3817
|
-
}), M() ?
|
|
3836
|
+
}), M() ? Lt(e) : sn(e);
|
|
3818
3837
|
}, {
|
|
3819
3838
|
context: "openLocation",
|
|
3820
3839
|
options: t
|
|
3821
3840
|
});
|
|
3822
3841
|
}
|
|
3823
|
-
function
|
|
3842
|
+
function un() {
|
|
3824
3843
|
const t = M();
|
|
3825
3844
|
return {
|
|
3826
|
-
supported:
|
|
3845
|
+
supported: Ge(),
|
|
3827
3846
|
environment: d.type,
|
|
3828
3847
|
implementation: t ? "weixin" : "webview",
|
|
3829
3848
|
features: {
|
|
@@ -3843,7 +3862,7 @@ function sn() {
|
|
|
3843
3862
|
};
|
|
3844
3863
|
}
|
|
3845
3864
|
const z = /* @__PURE__ */ new Set(), Y = /* @__PURE__ */ new Set();
|
|
3846
|
-
function
|
|
3865
|
+
function Dt(t, e, r) {
|
|
3847
3866
|
t.forEach((i) => {
|
|
3848
3867
|
if (typeof i == "function") {
|
|
3849
3868
|
f.safeExecute(() => i(e), { context: r });
|
|
@@ -3852,7 +3871,7 @@ function xt(t, e, r) {
|
|
|
3852
3871
|
s.warn("监听回调不是函数,已跳过", { type: typeof i });
|
|
3853
3872
|
});
|
|
3854
3873
|
}
|
|
3855
|
-
function
|
|
3874
|
+
function ln(t = {}) {
|
|
3856
3875
|
return f.safeExecute(() => {
|
|
3857
3876
|
var r, i;
|
|
3858
3877
|
if (M()) {
|
|
@@ -3863,8 +3882,8 @@ function on(t = {}) {
|
|
|
3863
3882
|
s.error("当前环境不支持此接口", { platform: d.type }), (r = t.fail) == null || r.call(t, n), (i = t.complete) == null || i.call(t, n);
|
|
3864
3883
|
return;
|
|
3865
3884
|
}
|
|
3866
|
-
const e =
|
|
3867
|
-
s.info("正在开启定位监听"),
|
|
3885
|
+
const e = en(t);
|
|
3886
|
+
s.info("正在开启定位监听"), O("startLocationUpdate", {
|
|
3868
3887
|
type: e.type,
|
|
3869
3888
|
needFullAccuracy: e.needFullAccuracy
|
|
3870
3889
|
}, {
|
|
@@ -3880,7 +3899,7 @@ function on(t = {}) {
|
|
|
3880
3899
|
});
|
|
3881
3900
|
}, { context: "startLocationUpdate" });
|
|
3882
3901
|
}
|
|
3883
|
-
function
|
|
3902
|
+
function fn(t = {}) {
|
|
3884
3903
|
return f.safeExecute(() => {
|
|
3885
3904
|
var e, r;
|
|
3886
3905
|
if (M()) {
|
|
@@ -3891,7 +3910,7 @@ function cn(t = {}) {
|
|
|
3891
3910
|
s.error("当前环境不支持此接口", { platform: d.type }), (e = t.fail) == null || e.call(t, i), (r = t.complete) == null || r.call(t, i);
|
|
3892
3911
|
return;
|
|
3893
3912
|
}
|
|
3894
|
-
s.info("正在停止定位监听"),
|
|
3913
|
+
s.info("正在停止定位监听"), O("stopLocationUpdate", t, {
|
|
3895
3914
|
success: (i) => {
|
|
3896
3915
|
var n;
|
|
3897
3916
|
s.info("定位监听已停止"), (n = t.success) == null || n.call(t, i);
|
|
@@ -3904,7 +3923,7 @@ function cn(t = {}) {
|
|
|
3904
3923
|
});
|
|
3905
3924
|
}, { context: "stopLocationUpdate" });
|
|
3906
3925
|
}
|
|
3907
|
-
function
|
|
3926
|
+
function dn(t) {
|
|
3908
3927
|
return f.safeExecute(() => {
|
|
3909
3928
|
if (M()) {
|
|
3910
3929
|
s.warn("当前环境不支持此接口", { platform: d.type });
|
|
@@ -3916,9 +3935,9 @@ function un(t) {
|
|
|
3916
3935
|
code: "INVALID_CALLBACK"
|
|
3917
3936
|
};
|
|
3918
3937
|
const e = z.size > 0;
|
|
3919
|
-
z.add(t), e || (s.debug("注册实时位置变化监听器"),
|
|
3938
|
+
z.add(t), e || (s.debug("注册实时位置变化监听器"), O("onLocationChange", { isPersistent: !0 }, {
|
|
3920
3939
|
success: (r) => {
|
|
3921
|
-
s.debug("收到实时位置推送", r),
|
|
3940
|
+
s.debug("收到实时位置推送", r), Dt(z, r, "onLocationChange");
|
|
3922
3941
|
},
|
|
3923
3942
|
fail: (r) => {
|
|
3924
3943
|
s.warn("位置变化监听出错,请通过 onLocationChangeError 监听错误", r), z.delete(t), z.size === 0 && se("onLocationChange");
|
|
@@ -3926,7 +3945,7 @@ function un(t) {
|
|
|
3926
3945
|
}));
|
|
3927
3946
|
}, { context: "onLocationChange" });
|
|
3928
3947
|
}
|
|
3929
|
-
function
|
|
3948
|
+
function gn(t) {
|
|
3930
3949
|
return f.safeExecute(() => {
|
|
3931
3950
|
if (M()) {
|
|
3932
3951
|
s.warn("当前环境不支持此接口", { platform: d.type });
|
|
@@ -3937,7 +3956,7 @@ function ln(t) {
|
|
|
3937
3956
|
errMsg: "offLocationChange 回调必须是函数",
|
|
3938
3957
|
code: "INVALID_CALLBACK"
|
|
3939
3958
|
};
|
|
3940
|
-
t ? z.delete(t) : z.clear(), !(z.size > 0) && (s.info("移除位置变化监听器"),
|
|
3959
|
+
t ? z.delete(t) : z.clear(), !(z.size > 0) && (s.info("移除位置变化监听器"), O("offLocationChange", {}, {
|
|
3941
3960
|
success: () => {
|
|
3942
3961
|
s.info("位置变化监听已移除"), se("onLocationChange");
|
|
3943
3962
|
},
|
|
@@ -3947,7 +3966,7 @@ function ln(t) {
|
|
|
3947
3966
|
}));
|
|
3948
3967
|
}, { context: "offLocationChange" });
|
|
3949
3968
|
}
|
|
3950
|
-
function
|
|
3969
|
+
function hn(t) {
|
|
3951
3970
|
return f.safeExecute(() => {
|
|
3952
3971
|
if (M()) {
|
|
3953
3972
|
s.warn("当前环境不支持此接口", { platform: d.type });
|
|
@@ -3959,9 +3978,9 @@ function fn(t) {
|
|
|
3959
3978
|
code: "INVALID_CALLBACK"
|
|
3960
3979
|
};
|
|
3961
3980
|
const e = Y.size > 0;
|
|
3962
|
-
Y.add(t), e || (s.debug("注册位置更新错误监听器"),
|
|
3981
|
+
Y.add(t), e || (s.debug("注册位置更新错误监听器"), O("onLocationChangeError", { isPersistent: !0 }, {
|
|
3963
3982
|
success: (r) => {
|
|
3964
|
-
s.warn("持续定位发生异常", r),
|
|
3983
|
+
s.warn("持续定位发生异常", r), Dt(Y, r, "onLocationChangeError");
|
|
3965
3984
|
},
|
|
3966
3985
|
fail: (r) => {
|
|
3967
3986
|
s.warn("位置更新错误监听注册失败", r), Y.delete(t), Y.size === 0 && se("onLocationChangeError");
|
|
@@ -3969,7 +3988,7 @@ function fn(t) {
|
|
|
3969
3988
|
}));
|
|
3970
3989
|
}, { context: "onLocationChangeError" });
|
|
3971
3990
|
}
|
|
3972
|
-
function
|
|
3991
|
+
function mn(t) {
|
|
3973
3992
|
return f.safeExecute(() => {
|
|
3974
3993
|
if (M()) {
|
|
3975
3994
|
s.warn("当前环境不支持此接口", { platform: d.type });
|
|
@@ -3980,7 +3999,7 @@ function dn(t) {
|
|
|
3980
3999
|
errMsg: "offLocationChangeError 回调必须是函数",
|
|
3981
4000
|
code: "INVALID_CALLBACK"
|
|
3982
4001
|
};
|
|
3983
|
-
t ? Y.delete(t) : Y.clear(), !(Y.size > 0) && (s.info("移除定位错误监听器"),
|
|
4002
|
+
t ? Y.delete(t) : Y.clear(), !(Y.size > 0) && (s.info("移除定位错误监听器"), O("offLocationChangeError", {}, {
|
|
3984
4003
|
success: () => {
|
|
3985
4004
|
s.info("定位错误监听已移除"), se("onLocationChangeError");
|
|
3986
4005
|
},
|
|
@@ -3990,14 +4009,14 @@ function dn(t) {
|
|
|
3990
4009
|
}));
|
|
3991
4010
|
}, { context: "offLocationChangeError" });
|
|
3992
4011
|
}
|
|
3993
|
-
const
|
|
4012
|
+
const pn = {
|
|
3994
4013
|
latitude: null,
|
|
3995
4014
|
// 目标地纬度
|
|
3996
4015
|
longitude: null
|
|
3997
4016
|
// 目标地经度
|
|
3998
4017
|
};
|
|
3999
|
-
function
|
|
4000
|
-
const e = g(g({},
|
|
4018
|
+
function wn(t = {}) {
|
|
4019
|
+
const e = g(g({}, pn), t);
|
|
4001
4020
|
return e.latitude !== null && e.latitude !== void 0 && (typeof e.latitude != "number" ? (s.warn("latitude 参数类型错误,已忽略", {
|
|
4002
4021
|
latitude: e.latitude
|
|
4003
4022
|
}), e.latitude = null) : (e.latitude < -90 || e.latitude > 90) && (s.warn("latitude 超出范围,已忽略", {
|
|
@@ -4008,10 +4027,10 @@ function hn(t = {}) {
|
|
|
4008
4027
|
longitude: e.longitude
|
|
4009
4028
|
}), e.longitude = null)), e;
|
|
4010
4029
|
}
|
|
4011
|
-
function
|
|
4030
|
+
function Ut() {
|
|
4012
4031
|
return ["webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(d.type);
|
|
4013
4032
|
}
|
|
4014
|
-
function
|
|
4033
|
+
function En(t) {
|
|
4015
4034
|
return f.safeExecute(() => {
|
|
4016
4035
|
s.debug("通过 WebView 桥接调用位置选择", t);
|
|
4017
4036
|
const e = {
|
|
@@ -4032,7 +4051,7 @@ function mn(t) {
|
|
|
4032
4051
|
},
|
|
4033
4052
|
complete: t.complete
|
|
4034
4053
|
};
|
|
4035
|
-
t.latitude !== null && t.latitude !== void 0 && (e.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (e.longitude = t.longitude),
|
|
4054
|
+
t.latitude !== null && t.latitude !== void 0 && (e.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (e.longitude = t.longitude), O("chooseLocation", e, {
|
|
4036
4055
|
success: (r) => {
|
|
4037
4056
|
e.success(r);
|
|
4038
4057
|
},
|
|
@@ -4046,10 +4065,10 @@ function mn(t) {
|
|
|
4046
4065
|
platform: "uniapp"
|
|
4047
4066
|
});
|
|
4048
4067
|
}
|
|
4049
|
-
function
|
|
4068
|
+
function yn(t = {}) {
|
|
4050
4069
|
return f.safeExecute(() => {
|
|
4051
4070
|
var r;
|
|
4052
|
-
if (!
|
|
4071
|
+
if (!Ut()) {
|
|
4053
4072
|
const i = {
|
|
4054
4073
|
errMsg: `当前环境 (${d.type}) 不支持位置选择功能`,
|
|
4055
4074
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -4057,20 +4076,20 @@ function pn(t = {}) {
|
|
|
4057
4076
|
s.error("平台不支持位置选择", { platform: d.type }), (r = t.fail) == null || r.call(t, i);
|
|
4058
4077
|
return;
|
|
4059
4078
|
}
|
|
4060
|
-
const e =
|
|
4079
|
+
const e = wn(t);
|
|
4061
4080
|
s.info("开始选择位置", {
|
|
4062
4081
|
platform: d.type,
|
|
4063
4082
|
latitude: e.latitude,
|
|
4064
4083
|
longitude: e.longitude
|
|
4065
|
-
}), M() ||
|
|
4084
|
+
}), M() || En(e);
|
|
4066
4085
|
}, {
|
|
4067
4086
|
context: "chooseLocation",
|
|
4068
4087
|
options: t
|
|
4069
4088
|
});
|
|
4070
4089
|
}
|
|
4071
|
-
function
|
|
4090
|
+
function An() {
|
|
4072
4091
|
return {
|
|
4073
|
-
supported:
|
|
4092
|
+
supported: Ut(),
|
|
4074
4093
|
environment: d.type,
|
|
4075
4094
|
implementation: M() ? "weixin" : "webview",
|
|
4076
4095
|
features: {
|
|
@@ -4083,17 +4102,17 @@ function wn() {
|
|
|
4083
4102
|
}
|
|
4084
4103
|
};
|
|
4085
4104
|
}
|
|
4086
|
-
const
|
|
4087
|
-
function
|
|
4105
|
+
const Wt = "https://iafs.xjy2.cn/img/bg.143351f0.jpg";
|
|
4106
|
+
function In(t) {
|
|
4088
4107
|
return t === "timeline" || Number(t) === 1 ? 1 : 0;
|
|
4089
4108
|
}
|
|
4090
|
-
function
|
|
4109
|
+
function xe(t = "", e = "targetPath") {
|
|
4091
4110
|
if (!t || typeof t != "string")
|
|
4092
4111
|
throw { errMsg: `share: ${e} 必须是最终小程序页面路径`, code: "PARAM_INVALID" };
|
|
4093
4112
|
const r = t.trim(), [, i = ""] = r.split("?");
|
|
4094
4113
|
return { path: r, query: i };
|
|
4095
4114
|
}
|
|
4096
|
-
function
|
|
4115
|
+
function $t(t = "", e = "webTarget") {
|
|
4097
4116
|
if (!t || typeof t != "string")
|
|
4098
4117
|
throw { errMsg: `share: ${e} 必须是公网链接,例如 https://example.com/path?a=1`, code: "PARAM_INVALID" };
|
|
4099
4118
|
const r = t.trim();
|
|
@@ -4101,7 +4120,7 @@ function Ut(t = "", e = "webTarget") {
|
|
|
4101
4120
|
throw { errMsg: `share: ${e} 必须是公网链接,例如 https://example.com/path?a=1`, code: "PARAM_INVALID" };
|
|
4102
4121
|
return r;
|
|
4103
4122
|
}
|
|
4104
|
-
function
|
|
4123
|
+
function Pn() {
|
|
4105
4124
|
return new Promise((t, e) => {
|
|
4106
4125
|
var a, o;
|
|
4107
4126
|
const r = typeof window != "undefined" ? window : null;
|
|
@@ -4117,7 +4136,7 @@ function yn() {
|
|
|
4117
4136
|
(o = (a = r.document) == null ? void 0 : a.addEventListener) == null || o.call(a, "plusready", n, { once: !0 });
|
|
4118
4137
|
});
|
|
4119
4138
|
}
|
|
4120
|
-
function
|
|
4139
|
+
function Mn() {
|
|
4121
4140
|
return new Promise((t, e) => {
|
|
4122
4141
|
const r = typeof window != "undefined" ? window.plus : null;
|
|
4123
4142
|
if (!r || !r.share || typeof r.share.getServices != "function")
|
|
@@ -4132,13 +4151,13 @@ function An() {
|
|
|
4132
4151
|
);
|
|
4133
4152
|
});
|
|
4134
4153
|
}
|
|
4135
|
-
function
|
|
4154
|
+
function Cn(t) {
|
|
4136
4155
|
return t.isWeixinMiniProgram ? "已同步分享内容,请点击右上角“···”选择发送给朋友或分享到朋友圈。" : "正在拉起微信分享面板,请选择聊天框或朋友圈。";
|
|
4137
4156
|
}
|
|
4138
|
-
function
|
|
4157
|
+
function _n(t = {}) {
|
|
4139
4158
|
if (!t || typeof t != "object")
|
|
4140
4159
|
throw { errMsg: "shareDirected 参数必须是对象", code: "PARAM_TYPE_ERROR" };
|
|
4141
|
-
const e = String(t.kind || "").trim(), r = t.payload || {}, i =
|
|
4160
|
+
const e = String(t.kind || "").trim(), r = t.payload || {}, i = In(t.scene);
|
|
4142
4161
|
if (!["web", "image", "text"].includes(e))
|
|
4143
4162
|
throw { errMsg: 'shareDirected: kind 仅支持 "web"|"image"|"text"', code: "PARAM_INVALID" };
|
|
4144
4163
|
if (![0, 1].includes(i))
|
|
@@ -4160,11 +4179,11 @@ function Pn(t = {}) {
|
|
|
4160
4179
|
complete: t.complete
|
|
4161
4180
|
};
|
|
4162
4181
|
}
|
|
4163
|
-
function
|
|
4182
|
+
function Rn(t, e) {
|
|
4164
4183
|
const { payload: r } = t;
|
|
4165
4184
|
if (e.isWeixinMiniProgram)
|
|
4166
4185
|
try {
|
|
4167
|
-
const i =
|
|
4186
|
+
const i = xe(r.target, "target");
|
|
4168
4187
|
return t.resolvedTargetPath = i.path, t;
|
|
4169
4188
|
} catch (i) {
|
|
4170
4189
|
throw { errMsg: (i == null ? void 0 : i.errMsg) || "shareDirected: 小程序环境下 payload.target 不合法", code: (i == null ? void 0 : i.code) || "PARAM_INVALID" };
|
|
@@ -4172,7 +4191,7 @@ function Mn(t, e) {
|
|
|
4172
4191
|
if (e.isAppPlus) {
|
|
4173
4192
|
const i = (o, c) => {
|
|
4174
4193
|
try {
|
|
4175
|
-
return
|
|
4194
|
+
return $t(o, c);
|
|
4176
4195
|
} catch (u) {
|
|
4177
4196
|
return "";
|
|
4178
4197
|
}
|
|
@@ -4189,8 +4208,8 @@ function Mn(t, e) {
|
|
|
4189
4208
|
}
|
|
4190
4209
|
return t;
|
|
4191
4210
|
}
|
|
4192
|
-
function
|
|
4193
|
-
const { kind: e, payload: r, resolvedTargetPath: i } = t, n =
|
|
4211
|
+
function Sn(t) {
|
|
4212
|
+
const { kind: e, payload: r, resolvedTargetPath: i } = t, n = xe(i || r.target, "target"), a = r.imageUrl || Wt;
|
|
4194
4213
|
return {
|
|
4195
4214
|
title: r.title || "分享",
|
|
4196
4215
|
path: n.path,
|
|
@@ -4199,17 +4218,17 @@ function Cn(t) {
|
|
|
4199
4218
|
custom: { kind: e, target: n.path, webTarget: r.webTarget || "", description: r.description || "" }
|
|
4200
4219
|
};
|
|
4201
4220
|
}
|
|
4202
|
-
function
|
|
4203
|
-
const { kind: e, scene: r, payload: i, resolvedWebTarget: n } = t, a = r === 1 ? "WXSceneTimeline" : "WXSceneSession", o = i.imageUrl ||
|
|
4221
|
+
function On(t) {
|
|
4222
|
+
const { kind: e, scene: r, payload: i, resolvedWebTarget: n } = t, a = r === 1 ? "WXSceneTimeline" : "WXSceneSession", o = i.imageUrl || Wt;
|
|
4204
4223
|
return e === "image" ? { message: { type: "image", pictures: [i.imageUrl], extra: { scene: a } }, degradedFromText: !1 } : {
|
|
4205
4224
|
message: { type: "web", title: i.title || "分享", content: i.description || "", href: n, thumbs: [o], extra: { scene: a } },
|
|
4206
4225
|
degradedFromText: e === "text"
|
|
4207
4226
|
};
|
|
4208
4227
|
}
|
|
4209
|
-
function
|
|
4228
|
+
function Nn(t) {
|
|
4210
4229
|
return A(this, null, function* () {
|
|
4211
|
-
yield
|
|
4212
|
-
const e = yield
|
|
4230
|
+
yield Pn();
|
|
4231
|
+
const e = yield Mn(), { message: r, degradedFromText: i } = On(t);
|
|
4213
4232
|
return new Promise((n, a) => {
|
|
4214
4233
|
e.send(
|
|
4215
4234
|
r,
|
|
@@ -4219,25 +4238,25 @@ function Rn(t) {
|
|
|
4219
4238
|
});
|
|
4220
4239
|
});
|
|
4221
4240
|
}
|
|
4222
|
-
function
|
|
4241
|
+
function Ft(t, e = "share") {
|
|
4223
4242
|
const r = typeof window != "undefined" && window.wx && window.wx.miniProgram;
|
|
4224
4243
|
if (!r || typeof r.postMessage != "function")
|
|
4225
4244
|
throw { errMsg: `当前微信小程序容器未注入 postMessage 能力,无法发起 ${e}`, code: "MINIPROGRAM_BRIDGE_UNAVAILABLE" };
|
|
4226
4245
|
r.postMessage({ data: t });
|
|
4227
4246
|
}
|
|
4228
|
-
function
|
|
4229
|
-
return { type: "qsh_api_call", api: "shareDirected", params: { miniProgramShare:
|
|
4247
|
+
function Tn(t, e) {
|
|
4248
|
+
return { type: "qsh_api_call", api: "shareDirected", params: { miniProgramShare: Sn(t), rowCustom: e }, timestamp: Date.now() };
|
|
4230
4249
|
}
|
|
4231
|
-
function
|
|
4250
|
+
function bn(t = {}) {
|
|
4232
4251
|
if (!t || typeof t != "object")
|
|
4233
4252
|
throw { errMsg: "shareMiniProgramCard 参数必须是对象", code: "PARAM_TYPE_ERROR" };
|
|
4234
4253
|
const e = t.payload || {};
|
|
4235
4254
|
if (!e.title) throw { errMsg: "shareMiniProgramCard: payload.title 必填", code: "PARAM_MISSING" };
|
|
4236
4255
|
if (!e.imageUrl) throw { errMsg: "shareMiniProgramCard: payload.imageUrl 必填", code: "PARAM_MISSING" };
|
|
4237
4256
|
if (!e.targetPath) throw { errMsg: "shareMiniProgramCard: payload.targetPath 必填", code: "PARAM_MISSING" };
|
|
4238
|
-
return
|
|
4257
|
+
return xe(e.targetPath, "targetPath"), { payload: e, success: t.success, fail: t.fail, complete: t.complete };
|
|
4239
4258
|
}
|
|
4240
|
-
function
|
|
4259
|
+
function vn(t) {
|
|
4241
4260
|
switch (String(t || "release").trim().toLowerCase()) {
|
|
4242
4261
|
case "develop":
|
|
4243
4262
|
case "development":
|
|
@@ -4255,7 +4274,7 @@ function Nn(t) {
|
|
|
4255
4274
|
throw { errMsg: 'shareMiniProgramCard: payload.envVersion 仅支持 "develop"|"trial"|"release"', code: "PARAM_INVALID" };
|
|
4256
4275
|
}
|
|
4257
4276
|
}
|
|
4258
|
-
function
|
|
4277
|
+
function xn(t) {
|
|
4259
4278
|
switch (String(t || "release").trim().toLowerCase()) {
|
|
4260
4279
|
case "develop":
|
|
4261
4280
|
case "development":
|
|
@@ -4273,19 +4292,19 @@ function bn(t) {
|
|
|
4273
4292
|
throw { errMsg: 'shareMiniProgramCard: payload.envVersion 仅支持 "develop"|"trial"|"release"', code: "PARAM_INVALID" };
|
|
4274
4293
|
}
|
|
4275
4294
|
}
|
|
4276
|
-
function
|
|
4295
|
+
function Ln(t) {
|
|
4277
4296
|
const { payload: e } = t;
|
|
4278
4297
|
if (!e.appid)
|
|
4279
4298
|
throw { errMsg: "shareMiniProgramCard: App 环境下 payload.appid 必填", code: "PARAM_MISSING" };
|
|
4280
4299
|
try {
|
|
4281
|
-
|
|
4300
|
+
$t(e.webUrl, "webUrl");
|
|
4282
4301
|
} catch (r) {
|
|
4283
4302
|
throw { errMsg: "shareMiniProgramCard: App 环境下 payload.webUrl 必填,且必须是公网链接", code: (r == null ? void 0 : r.code) || "PARAM_INVALID" };
|
|
4284
4303
|
}
|
|
4285
|
-
return
|
|
4304
|
+
return vn(e.envVersion), t;
|
|
4286
4305
|
}
|
|
4287
|
-
function
|
|
4288
|
-
const { payload: e } = t, r =
|
|
4306
|
+
function Dn(t) {
|
|
4307
|
+
const { payload: e } = t, r = xe(e.targetPath, "targetPath");
|
|
4289
4308
|
return {
|
|
4290
4309
|
title: e.title,
|
|
4291
4310
|
path: r.path,
|
|
@@ -4293,7 +4312,7 @@ function Tn(t) {
|
|
|
4293
4312
|
imageUrl: e.imageUrl
|
|
4294
4313
|
};
|
|
4295
4314
|
}
|
|
4296
|
-
function
|
|
4315
|
+
function Un(t) {
|
|
4297
4316
|
const { payload: e } = t;
|
|
4298
4317
|
return {
|
|
4299
4318
|
provider: "weixin",
|
|
@@ -4304,50 +4323,50 @@ function xn(t) {
|
|
|
4304
4323
|
miniProgram: {
|
|
4305
4324
|
id: e.appid,
|
|
4306
4325
|
path: e.targetPath,
|
|
4307
|
-
type:
|
|
4326
|
+
type: xn(e.envVersion),
|
|
4308
4327
|
webUrl: e.webUrl
|
|
4309
4328
|
}
|
|
4310
4329
|
};
|
|
4311
4330
|
}
|
|
4312
|
-
function
|
|
4313
|
-
return { type: "qsh_api_call", api: "shareMiniProgramCard", params: { miniProgramShare:
|
|
4331
|
+
function Wn(t, e) {
|
|
4332
|
+
return { type: "qsh_api_call", api: "shareMiniProgramCard", params: { miniProgramShare: Dn(t), rowCustom: e }, timestamp: Date.now() };
|
|
4314
4333
|
}
|
|
4315
|
-
function
|
|
4334
|
+
function $n(t) {
|
|
4316
4335
|
return A(this, null, function* () {
|
|
4317
4336
|
return new Promise((e, r) => {
|
|
4318
|
-
|
|
4337
|
+
O("shareMiniProgramCard", { appShare: Un(t) }, { success: (i) => e(i || {}), fail: (i) => r(i) });
|
|
4319
4338
|
});
|
|
4320
4339
|
});
|
|
4321
4340
|
}
|
|
4322
|
-
function
|
|
4341
|
+
function kt(t = {}) {
|
|
4323
4342
|
return f.safeExecute(
|
|
4324
4343
|
() => {
|
|
4325
4344
|
var a, o, c, u, m, _, C, k, ue, R, B;
|
|
4326
4345
|
let e;
|
|
4327
4346
|
try {
|
|
4328
|
-
e =
|
|
4347
|
+
e = _n(t);
|
|
4329
4348
|
} catch (w) {
|
|
4330
4349
|
return (a = t.fail) == null || a.call(t, w), Promise.reject(w);
|
|
4331
4350
|
}
|
|
4332
4351
|
const r = J(!0);
|
|
4333
4352
|
try {
|
|
4334
|
-
e =
|
|
4353
|
+
e = Rn(e, r);
|
|
4335
4354
|
} catch (w) {
|
|
4336
4355
|
return (o = e.fail) == null || o.call(e, w), (c = e.complete) == null || c.call(e, w), Promise.reject(w);
|
|
4337
4356
|
}
|
|
4338
|
-
const i =
|
|
4357
|
+
const i = Cn(r);
|
|
4339
4358
|
if (r.isAppPlus)
|
|
4340
|
-
return
|
|
4341
|
-
var le,
|
|
4359
|
+
return Nn(e).then((w) => {
|
|
4360
|
+
var le, Xe;
|
|
4342
4361
|
const G = p(g({}, (w == null ? void 0 : w.data) || {}), { hint: i });
|
|
4343
|
-
return (le = e.success) == null || le.call(e, G), (
|
|
4362
|
+
return (le = e.success) == null || le.call(e, G), (Xe = e.complete) == null || Xe.call(e, G), G;
|
|
4344
4363
|
}).catch((w) => {
|
|
4345
4364
|
var G, le;
|
|
4346
4365
|
return (G = e.fail) == null || G.call(e, w), (le = e.complete) == null || le.call(e, w), Promise.reject(w);
|
|
4347
4366
|
});
|
|
4348
4367
|
if (r.isWeixinMiniProgram)
|
|
4349
4368
|
try {
|
|
4350
|
-
|
|
4369
|
+
Ft(Tn(e, t.rowCustom), "shareDirected");
|
|
4351
4370
|
const w = { success: !0, hint: i };
|
|
4352
4371
|
return (u = e.success) == null || u.call(e, w), (m = e.complete) == null || m.call(e, w), Promise.resolve(w);
|
|
4353
4372
|
} catch (w) {
|
|
@@ -4363,31 +4382,31 @@ function $t(t = {}) {
|
|
|
4363
4382
|
{ context: "shareDirected", options: t }
|
|
4364
4383
|
);
|
|
4365
4384
|
}
|
|
4366
|
-
function
|
|
4385
|
+
function Fn(t = {}) {
|
|
4367
4386
|
return new Promise((e, r) => {
|
|
4368
|
-
|
|
4387
|
+
kt(p(g({}, t), { success: e, fail: r }));
|
|
4369
4388
|
});
|
|
4370
4389
|
}
|
|
4371
|
-
function
|
|
4390
|
+
function Bt(t = {}) {
|
|
4372
4391
|
return f.safeExecute(
|
|
4373
4392
|
() => {
|
|
4374
4393
|
var a, o, c, u, m, _, C, k, ue;
|
|
4375
4394
|
let e;
|
|
4376
4395
|
try {
|
|
4377
|
-
e =
|
|
4396
|
+
e = bn(t);
|
|
4378
4397
|
} catch (R) {
|
|
4379
4398
|
return (a = t.fail) == null || a.call(t, R), Promise.reject(R);
|
|
4380
4399
|
}
|
|
4381
4400
|
const r = J(!0);
|
|
4382
4401
|
if (r.isAppPlus)
|
|
4383
4402
|
try {
|
|
4384
|
-
e =
|
|
4403
|
+
e = Ln(e);
|
|
4385
4404
|
} catch (R) {
|
|
4386
4405
|
return (o = e.fail) == null || o.call(e, R), (c = e.complete) == null || c.call(e, R), Promise.reject(R);
|
|
4387
4406
|
}
|
|
4388
4407
|
const i = r.isWeixinMiniProgram ? "已同步小程序卡片内容,请点击右上角“···”后发送给朋友。" : "正在拉起微信发送给朋友面板,请继续完成小程序卡片分享。";
|
|
4389
4408
|
if (r.isAppPlus)
|
|
4390
|
-
return
|
|
4409
|
+
return $n(e).then((R) => {
|
|
4391
4410
|
var w, G;
|
|
4392
4411
|
const B = p(g({}, R || {}), { hint: i });
|
|
4393
4412
|
return (w = e.success) == null || w.call(e, B), (G = e.complete) == null || G.call(e, B), B;
|
|
@@ -4397,7 +4416,7 @@ function Ft(t = {}) {
|
|
|
4397
4416
|
});
|
|
4398
4417
|
if (r.isWeixinMiniProgram)
|
|
4399
4418
|
try {
|
|
4400
|
-
|
|
4419
|
+
Ft(Wn(e, t.rowCustom), "shareMiniProgramCard");
|
|
4401
4420
|
const R = { success: !0, hint: i };
|
|
4402
4421
|
return (u = e.success) == null || u.call(e, R), (m = e.complete) == null || m.call(e, R), Promise.resolve(R);
|
|
4403
4422
|
} catch (R) {
|
|
@@ -4409,12 +4428,12 @@ function Ft(t = {}) {
|
|
|
4409
4428
|
{ context: "shareMiniProgramCard", options: t }
|
|
4410
4429
|
);
|
|
4411
4430
|
}
|
|
4412
|
-
function
|
|
4431
|
+
function kn(t = {}) {
|
|
4413
4432
|
return new Promise((e, r) => {
|
|
4414
|
-
|
|
4433
|
+
Bt(p(g({}, t), { success: e, fail: r }));
|
|
4415
4434
|
});
|
|
4416
4435
|
}
|
|
4417
|
-
const
|
|
4436
|
+
const Bn = {
|
|
4418
4437
|
OFF: "off",
|
|
4419
4438
|
// 蓝牙关闭
|
|
4420
4439
|
ON: "on",
|
|
@@ -4423,19 +4442,19 @@ const $n = {
|
|
|
4423
4442
|
// 不支持蓝牙
|
|
4424
4443
|
UNAUTHORIZED: "unauthorized"
|
|
4425
4444
|
// 未授权
|
|
4426
|
-
},
|
|
4445
|
+
}, Gn = {
|
|
4427
4446
|
allowDuplicatesKey: !1,
|
|
4428
4447
|
// 是否允许重复上报同一设备
|
|
4429
4448
|
services: []
|
|
4430
4449
|
// 指定服务 UUID 列表
|
|
4431
4450
|
};
|
|
4432
|
-
function
|
|
4433
|
-
return g(g({},
|
|
4451
|
+
function Le(t = {}) {
|
|
4452
|
+
return g(g({}, Gn), t);
|
|
4434
4453
|
}
|
|
4435
|
-
function
|
|
4454
|
+
function ye() {
|
|
4436
4455
|
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(d.type);
|
|
4437
4456
|
}
|
|
4438
|
-
function
|
|
4457
|
+
function Kn(t) {
|
|
4439
4458
|
return f.safeExecute(() => A(null, null, function* () {
|
|
4440
4459
|
var e;
|
|
4441
4460
|
if (!window.wx) {
|
|
@@ -4445,7 +4464,7 @@ function kn(t) {
|
|
|
4445
4464
|
}
|
|
4446
4465
|
ce() || (s.info("等待微信配置完成"), yield te()), wx.openBluetoothAdapter({
|
|
4447
4466
|
success: () => {
|
|
4448
|
-
s.info("微信蓝牙适配器已打开"),
|
|
4467
|
+
s.info("微信蓝牙适配器已打开"), Gt(t);
|
|
4449
4468
|
},
|
|
4450
4469
|
fail: (r) => {
|
|
4451
4470
|
var i;
|
|
@@ -4454,9 +4473,9 @@ function kn(t) {
|
|
|
4454
4473
|
});
|
|
4455
4474
|
}), { context: "openBluetoothAdapterInWeixin" });
|
|
4456
4475
|
}
|
|
4457
|
-
function
|
|
4476
|
+
function Vn(t) {
|
|
4458
4477
|
return f.safeExecute(() => {
|
|
4459
|
-
s.debug("通过 WebView 桥接调用蓝牙功能", t),
|
|
4478
|
+
s.debug("通过 WebView 桥接调用蓝牙功能", t), O("bluetooth", t, {
|
|
4460
4479
|
success: (e) => {
|
|
4461
4480
|
var r;
|
|
4462
4481
|
s.info("UniApp 蓝牙调用成功", e), (r = t.success) == null || r.call(t, e);
|
|
@@ -4469,10 +4488,10 @@ function Bn(t) {
|
|
|
4469
4488
|
});
|
|
4470
4489
|
}, { context: "bluetoothInUniApp" });
|
|
4471
4490
|
}
|
|
4472
|
-
function
|
|
4491
|
+
function qn(t) {
|
|
4473
4492
|
return f.safeExecute(() => {
|
|
4474
4493
|
var e;
|
|
4475
|
-
s.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t),
|
|
4494
|
+
s.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t), O("bluetoothDevicesDiscovery", {
|
|
4476
4495
|
action: "startBluetoothDevicesDiscovery",
|
|
4477
4496
|
params: {
|
|
4478
4497
|
services: t.services || [],
|
|
@@ -4491,11 +4510,11 @@ function Gn(t) {
|
|
|
4491
4510
|
});
|
|
4492
4511
|
}, { context: "startBluetoothDevicesDiscoveryInUniApp" });
|
|
4493
4512
|
}
|
|
4494
|
-
const
|
|
4495
|
-
function
|
|
4513
|
+
const Ie = /* @__PURE__ */ new Set();
|
|
4514
|
+
function jn(t, e = {}) {
|
|
4496
4515
|
return f.safeExecute(() => {
|
|
4497
4516
|
var r;
|
|
4498
|
-
return
|
|
4517
|
+
return Ie.add(t), Ie.size === 1 && O("onBluetoothDeviceFound", {
|
|
4499
4518
|
action: "onBluetoothDeviceFound",
|
|
4500
4519
|
isPersistent: !0,
|
|
4501
4520
|
params: {
|
|
@@ -4504,7 +4523,7 @@ function Kn(t, e = {}) {
|
|
|
4504
4523
|
}
|
|
4505
4524
|
}, {
|
|
4506
4525
|
success: (i) => {
|
|
4507
|
-
|
|
4526
|
+
Ie.forEach((n) => {
|
|
4508
4527
|
typeof n == "function" ? f.safeExecute(() => n(i), { context: "BluetoothDeviceCallback" }) : console.warn("[BluetoothDeviceCallback] 不是函数:", n);
|
|
4509
4528
|
});
|
|
4510
4529
|
},
|
|
@@ -4513,13 +4532,13 @@ function Kn(t, e = {}) {
|
|
|
4513
4532
|
console.error("[Bluetooth] 搜索失败:", i), (n = e.fail) == null || n.call(e, i);
|
|
4514
4533
|
},
|
|
4515
4534
|
complete: e.complete
|
|
4516
|
-
}), () =>
|
|
4535
|
+
}), () => Ie.delete(t);
|
|
4517
4536
|
}, { context: "qsh_onBluetoothDeviceFound" });
|
|
4518
4537
|
}
|
|
4519
|
-
function
|
|
4538
|
+
function Jn(t) {
|
|
4520
4539
|
return f.safeExecute(() => {
|
|
4521
4540
|
var e;
|
|
4522
|
-
s.debug("通过 WebView 桥接调用蓝牙连接功能", t),
|
|
4541
|
+
s.debug("通过 WebView 桥接调用蓝牙连接功能", t), O("bluetoothConnection", {
|
|
4523
4542
|
action: "createBLEConnection",
|
|
4524
4543
|
params: {
|
|
4525
4544
|
deviceId: t.deviceId,
|
|
@@ -4539,10 +4558,10 @@ function Vn(t) {
|
|
|
4539
4558
|
});
|
|
4540
4559
|
}, { context: "createBLEConnectionInUniApp" });
|
|
4541
4560
|
}
|
|
4542
|
-
function
|
|
4561
|
+
function Hn(t = {}) {
|
|
4543
4562
|
return f.safeExecute(() => {
|
|
4544
4563
|
var r;
|
|
4545
|
-
if (!
|
|
4564
|
+
if (!ye()) {
|
|
4546
4565
|
const i = {
|
|
4547
4566
|
errMsg: `当前环境 (${d.type}) 不支持蓝牙功能`,
|
|
4548
4567
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -4550,18 +4569,18 @@ function qn(t = {}) {
|
|
|
4550
4569
|
s.error("平台不支持蓝牙", { platform: d.type }), (r = t.fail) == null || r.call(t, i);
|
|
4551
4570
|
return;
|
|
4552
4571
|
}
|
|
4553
|
-
const e =
|
|
4572
|
+
const e = Le(t);
|
|
4554
4573
|
s.info("开始蓝牙操作", {
|
|
4555
4574
|
platform: d.type,
|
|
4556
4575
|
services: e.services,
|
|
4557
4576
|
allowDuplicatesKey: e.allowDuplicatesKey
|
|
4558
|
-
}), M() ?
|
|
4577
|
+
}), M() ? Kn(e) : Vn(e);
|
|
4559
4578
|
}, { context: "openBluetoothAdapter", options: t });
|
|
4560
4579
|
}
|
|
4561
|
-
function
|
|
4580
|
+
function zn(t = {}) {
|
|
4562
4581
|
return f.safeExecute(() => {
|
|
4563
4582
|
var r, i;
|
|
4564
|
-
if (!
|
|
4583
|
+
if (!ye()) {
|
|
4565
4584
|
const n = {
|
|
4566
4585
|
errMsg: `当前环境 (${d.type}) 不支持蓝牙功能`,
|
|
4567
4586
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -4569,18 +4588,18 @@ function jn(t = {}) {
|
|
|
4569
4588
|
s.error("平台不支持蓝牙", { platform: d.type }), (r = t.fail) == null || r.call(t, n), (i = t.complete) == null || i.call(t, n);
|
|
4570
4589
|
return;
|
|
4571
4590
|
}
|
|
4572
|
-
const e =
|
|
4591
|
+
const e = Le(t);
|
|
4573
4592
|
s.info("开始搜索蓝牙设备", {
|
|
4574
4593
|
platform: d.type,
|
|
4575
4594
|
services: e.services,
|
|
4576
4595
|
allowDuplicatesKey: e.allowDuplicatesKey
|
|
4577
|
-
}), M() ? startBluetoothDevicesDiscoveryInWeixin(e) :
|
|
4596
|
+
}), M() ? startBluetoothDevicesDiscoveryInWeixin(e) : qn(e);
|
|
4578
4597
|
}, { context: "startBluetoothDevicesDiscovery", options: t });
|
|
4579
4598
|
}
|
|
4580
|
-
function
|
|
4599
|
+
function Gt(t, e = {}) {
|
|
4581
4600
|
return f.safeExecute(() => {
|
|
4582
4601
|
var i, n;
|
|
4583
|
-
if (!
|
|
4602
|
+
if (!ye()) {
|
|
4584
4603
|
const a = {
|
|
4585
4604
|
errMsg: `当前环境 (${d.type}) 不支持蓝牙功能`,
|
|
4586
4605
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -4588,14 +4607,14 @@ function kt(t, e = {}) {
|
|
|
4588
4607
|
s.error("平台不支持蓝牙", { platform: d.type }), (i = e.fail) == null || i.call(e, a), (n = e.complete) == null || n.call(e, a);
|
|
4589
4608
|
return;
|
|
4590
4609
|
}
|
|
4591
|
-
const r =
|
|
4592
|
-
s.info("注册蓝牙设备发现监听", { platform: d.type }), M() ? onBluetoothDeviceFoundInWeixin(r) :
|
|
4610
|
+
const r = Le(e);
|
|
4611
|
+
s.info("注册蓝牙设备发现监听", { platform: d.type }), M() ? onBluetoothDeviceFoundInWeixin(r) : jn(t, r);
|
|
4593
4612
|
}, { context: "onBluetoothDeviceFound", options: e });
|
|
4594
4613
|
}
|
|
4595
|
-
function
|
|
4614
|
+
function Yn(t = {}) {
|
|
4596
4615
|
return f.safeExecute(() => {
|
|
4597
4616
|
var a, o, c, u;
|
|
4598
|
-
if (!
|
|
4617
|
+
if (!ye()) {
|
|
4599
4618
|
const m = {
|
|
4600
4619
|
errMsg: `当前环境 (${d.type}) 不支持蓝牙功能`,
|
|
4601
4620
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -4603,7 +4622,7 @@ function Jn(t = {}) {
|
|
|
4603
4622
|
s.error("平台不支持蓝牙连接", { platform: d.type }), (a = t.fail) == null || a.call(t, m), (o = t.complete) == null || o.call(t, m);
|
|
4604
4623
|
return;
|
|
4605
4624
|
}
|
|
4606
|
-
const e =
|
|
4625
|
+
const e = Le(t), { name: r, deviceId: i, autoConnect: n = !1 } = e;
|
|
4607
4626
|
if (!i) {
|
|
4608
4627
|
const m = { errMsg: "缺少 deviceId 参数", code: "INVALID_PARAMS" };
|
|
4609
4628
|
(c = t.fail) == null || c.call(t, m), (u = t.complete) == null || u.call(t, m);
|
|
@@ -4615,12 +4634,12 @@ function Jn(t = {}) {
|
|
|
4615
4634
|
success: t.success,
|
|
4616
4635
|
fail: t.fail,
|
|
4617
4636
|
complete: t.complete
|
|
4618
|
-
}) :
|
|
4637
|
+
}) : Jn(e);
|
|
4619
4638
|
}, { context: "createBLEConnection", options: t });
|
|
4620
4639
|
}
|
|
4621
|
-
function
|
|
4640
|
+
function Xn() {
|
|
4622
4641
|
return {
|
|
4623
|
-
supported:
|
|
4642
|
+
supported: ye(),
|
|
4624
4643
|
environment: d.type,
|
|
4625
4644
|
implementation: M() ? "weixin" : "webview",
|
|
4626
4645
|
features: {
|
|
@@ -4632,18 +4651,18 @@ function Hn() {
|
|
|
4632
4651
|
}
|
|
4633
4652
|
};
|
|
4634
4653
|
}
|
|
4635
|
-
const
|
|
4654
|
+
const Zn = {
|
|
4636
4655
|
// TODO: 添加更多默认配置
|
|
4637
4656
|
};
|
|
4638
|
-
function
|
|
4639
|
-
return g(g({},
|
|
4657
|
+
function Qn(t = {}) {
|
|
4658
|
+
return g(g({}, Zn), t);
|
|
4640
4659
|
}
|
|
4641
|
-
function
|
|
4660
|
+
function Kt() {
|
|
4642
4661
|
return ["webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(d.type);
|
|
4643
4662
|
}
|
|
4644
|
-
function
|
|
4663
|
+
function ea(t) {
|
|
4645
4664
|
return f.safeExecute(() => {
|
|
4646
|
-
s.debug("通过 WebView 桥接调用打印PDF", t),
|
|
4665
|
+
s.debug("通过 WebView 桥接调用打印PDF", t), O("printPdf", p(g({}, t), {
|
|
4647
4666
|
isPersistent: !0
|
|
4648
4667
|
// 强制禁用超时自动清理
|
|
4649
4668
|
}), {
|
|
@@ -4662,10 +4681,10 @@ function Xn(t) {
|
|
|
4662
4681
|
platform: "uniapp"
|
|
4663
4682
|
});
|
|
4664
4683
|
}
|
|
4665
|
-
function
|
|
4684
|
+
function ta(t = {}) {
|
|
4666
4685
|
return f.safeExecute(() => {
|
|
4667
4686
|
var r;
|
|
4668
|
-
if (!
|
|
4687
|
+
if (!Kt()) {
|
|
4669
4688
|
const i = {
|
|
4670
4689
|
errMsg: `当前环境 (${d.type}) 不支持打印PDF功能`,
|
|
4671
4690
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
@@ -4673,16 +4692,16 @@ function Zn(t = {}) {
|
|
|
4673
4692
|
s.error("平台不支持打印PDF", { platform: d.type }), (r = t.fail) == null || r.call(t, i);
|
|
4674
4693
|
return;
|
|
4675
4694
|
}
|
|
4676
|
-
const e =
|
|
4677
|
-
s.info("开始打印PDF", { platform: d.type }),
|
|
4695
|
+
const e = Qn(t);
|
|
4696
|
+
s.info("开始打印PDF", { platform: d.type }), ea(e);
|
|
4678
4697
|
}, {
|
|
4679
4698
|
context: "printPdf",
|
|
4680
4699
|
options: t
|
|
4681
4700
|
});
|
|
4682
4701
|
}
|
|
4683
|
-
function
|
|
4702
|
+
function ra() {
|
|
4684
4703
|
return {
|
|
4685
|
-
supported:
|
|
4704
|
+
supported: Kt(),
|
|
4686
4705
|
environment: d.type,
|
|
4687
4706
|
implementation: "uniapp",
|
|
4688
4707
|
features: {
|
|
@@ -4690,8 +4709,8 @@ function Qn() {
|
|
|
4690
4709
|
}
|
|
4691
4710
|
};
|
|
4692
4711
|
}
|
|
4693
|
-
const
|
|
4694
|
-
function
|
|
4712
|
+
const $e = "/pages/face/index";
|
|
4713
|
+
function ia(t = {}) {
|
|
4695
4714
|
const e = g({}, t);
|
|
4696
4715
|
if (!e.name || typeof e.name != "string" || !e.name.trim())
|
|
4697
4716
|
throw {
|
|
@@ -4705,26 +4724,26 @@ function ea(t = {}) {
|
|
|
4705
4724
|
};
|
|
4706
4725
|
return e.idCardNumber = e.idCardNumber.trim(), e;
|
|
4707
4726
|
}
|
|
4708
|
-
function
|
|
4727
|
+
function Vt() {
|
|
4709
4728
|
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(d.type);
|
|
4710
4729
|
}
|
|
4711
|
-
function
|
|
4730
|
+
function na() {
|
|
4712
4731
|
return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.navigateTo == "function";
|
|
4713
4732
|
}
|
|
4714
|
-
function
|
|
4733
|
+
function aa(t) {
|
|
4715
4734
|
const e = p(g({}, t), {
|
|
4716
4735
|
title: document.title || "",
|
|
4717
4736
|
url: window.location.href || ""
|
|
4718
4737
|
}), r = Object.entries(e).filter(([, i]) => i != null && i !== "").map(([i, n]) => `${encodeURIComponent(i)}=${encodeURIComponent(String(n))}`).join("&");
|
|
4719
|
-
return r ? `${
|
|
4738
|
+
return r ? `${$e}?${r}` : $e;
|
|
4720
4739
|
}
|
|
4721
|
-
function
|
|
4740
|
+
function sa(t) {
|
|
4722
4741
|
return f.safeExecute(() => {
|
|
4723
|
-
if (!
|
|
4742
|
+
if (!na()) {
|
|
4724
4743
|
s.error("微信小程序导航API不可用");
|
|
4725
4744
|
return;
|
|
4726
4745
|
}
|
|
4727
|
-
const e =
|
|
4746
|
+
const e = aa(t);
|
|
4728
4747
|
s.debug("跳转宿主人脸识别页面", {
|
|
4729
4748
|
name: t.name,
|
|
4730
4749
|
targetUrl: e
|
|
@@ -4742,12 +4761,12 @@ function ia(t) {
|
|
|
4742
4761
|
platform: "weixin"
|
|
4743
4762
|
});
|
|
4744
4763
|
}
|
|
4745
|
-
function
|
|
4764
|
+
function oa(t) {
|
|
4746
4765
|
return f.safeExecute(() => {
|
|
4747
4766
|
s.debug("通过 WebView 桥接调用人脸识别", {
|
|
4748
4767
|
platform: d.type,
|
|
4749
4768
|
name: t.name
|
|
4750
|
-
}),
|
|
4769
|
+
}), O("faceVerify", g({}, t), {
|
|
4751
4770
|
success: (e) => {
|
|
4752
4771
|
s.info("UniApp 人脸识别调用成功", e);
|
|
4753
4772
|
},
|
|
@@ -4760,15 +4779,15 @@ function na(t) {
|
|
|
4760
4779
|
platform: "uniapp"
|
|
4761
4780
|
});
|
|
4762
4781
|
}
|
|
4763
|
-
function
|
|
4782
|
+
function ca(t = {}) {
|
|
4764
4783
|
return f.safeExecute(() => {
|
|
4765
|
-
if (!
|
|
4784
|
+
if (!Vt()) {
|
|
4766
4785
|
s.error("平台不支持人脸识别", { platform: d.type });
|
|
4767
4786
|
return;
|
|
4768
4787
|
}
|
|
4769
4788
|
let e;
|
|
4770
4789
|
try {
|
|
4771
|
-
e =
|
|
4790
|
+
e = ia(t);
|
|
4772
4791
|
} catch (r) {
|
|
4773
4792
|
s.error("人脸识别参数校验失败", r);
|
|
4774
4793
|
return;
|
|
@@ -4776,21 +4795,21 @@ function aa(t = {}) {
|
|
|
4776
4795
|
if (s.info("开始人脸识别", {
|
|
4777
4796
|
platform: d.type,
|
|
4778
4797
|
name: e.name,
|
|
4779
|
-
pagePath:
|
|
4798
|
+
pagePath: $e
|
|
4780
4799
|
}), M()) {
|
|
4781
|
-
|
|
4800
|
+
sa(e);
|
|
4782
4801
|
return;
|
|
4783
4802
|
}
|
|
4784
|
-
|
|
4803
|
+
oa(e);
|
|
4785
4804
|
}, {
|
|
4786
4805
|
context: "faceVerify",
|
|
4787
4806
|
options: t
|
|
4788
4807
|
});
|
|
4789
4808
|
}
|
|
4790
|
-
function
|
|
4809
|
+
function ua() {
|
|
4791
4810
|
let t = "weixin";
|
|
4792
4811
|
return d.type === "UniApp" && (t = "uniapp"), {
|
|
4793
|
-
supported:
|
|
4812
|
+
supported: Vt(),
|
|
4794
4813
|
environment: d.type,
|
|
4795
4814
|
implementation: t,
|
|
4796
4815
|
features: {
|
|
@@ -4800,32 +4819,32 @@ function sa() {
|
|
|
4800
4819
|
}
|
|
4801
4820
|
};
|
|
4802
4821
|
}
|
|
4803
|
-
const
|
|
4804
|
-
function
|
|
4822
|
+
const qt = J();
|
|
4823
|
+
function la() {
|
|
4805
4824
|
if (typeof window == "undefined" || !J(!0).isWeixinMiniProgram)
|
|
4806
4825
|
return !1;
|
|
4807
|
-
const e =
|
|
4826
|
+
const e = Ue().getRuntimeConfig();
|
|
4808
4827
|
return typeof e.clientId == "string" && e.clientId.length > 0;
|
|
4809
4828
|
}
|
|
4810
|
-
function
|
|
4829
|
+
function fa() {
|
|
4811
4830
|
return A(this, null, function* () {
|
|
4812
|
-
yield
|
|
4831
|
+
yield Er(), la() && (yield te());
|
|
4813
4832
|
});
|
|
4814
4833
|
}
|
|
4815
|
-
X.useResponse(
|
|
4816
|
-
let
|
|
4817
|
-
function
|
|
4818
|
-
if (
|
|
4819
|
-
|
|
4820
|
-
{ name: "load-weixin-sdk", run:
|
|
4821
|
-
{ name: "init-bridge", run:
|
|
4834
|
+
X.useResponse(ht.response, { priority: 1e3 });
|
|
4835
|
+
let nt = !1;
|
|
4836
|
+
function at() {
|
|
4837
|
+
if (nt) return;
|
|
4838
|
+
nt = !0, Fr([
|
|
4839
|
+
{ name: "load-weixin-sdk", run: ft, timeoutMs: 8e3 },
|
|
4840
|
+
{ name: "init-bridge", run: ut, timeoutMs: 8e3 }
|
|
4822
4841
|
], {
|
|
4823
4842
|
onError: (e, r) => {
|
|
4824
4843
|
console.error(`[QSH-SDK] 初始化失败(${(r == null ? void 0 : r.name) || "unknown"}):`, e);
|
|
4825
4844
|
}
|
|
4826
4845
|
});
|
|
4827
4846
|
}
|
|
4828
|
-
typeof window != "undefined" && (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(
|
|
4847
|
+
typeof window != "undefined" && (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(at, 0) : document.addEventListener("DOMContentLoaded", at));
|
|
4829
4848
|
function y(t, { apiName: e } = {}) {
|
|
4830
4849
|
return function(r = {}, ...i) {
|
|
4831
4850
|
const n = r && typeof r == "object" && (typeof r.success == "function" || typeof r.fail == "function" || typeof r.complete == "function"), a = r && typeof r == "object" ? r : {}, o = () => n ? t(a, ...i) : new Promise((u, m) => {
|
|
@@ -4840,178 +4859,178 @@ function y(t, { apiName: e } = {}) {
|
|
|
4840
4859
|
});
|
|
4841
4860
|
t(_, ...i);
|
|
4842
4861
|
});
|
|
4843
|
-
return (typeof window == "undefined" ? Promise.resolve() :
|
|
4862
|
+
return (typeof window == "undefined" ? Promise.resolve() : ct()).then(() => o()).catch((u) => {
|
|
4844
4863
|
throw console.error(`[QSH-SDK] ${e || "API"} call failed:`, u), u;
|
|
4845
4864
|
});
|
|
4846
4865
|
};
|
|
4847
4866
|
}
|
|
4848
|
-
function
|
|
4867
|
+
function Pe(t) {
|
|
4849
4868
|
return typeof t == "function" ? { success: t } : t && typeof t == "object" ? t : {};
|
|
4850
4869
|
}
|
|
4851
|
-
const
|
|
4852
|
-
function
|
|
4853
|
-
const e = () =>
|
|
4854
|
-
return (typeof window == "undefined" ? Promise.resolve() :
|
|
4870
|
+
const jt = y(oi), Jt = y(ci), Ht = y(ui), zt = y(li), Yt = y(fi), Xt = y(di);
|
|
4871
|
+
function Zt(t) {
|
|
4872
|
+
const e = () => gi(t);
|
|
4873
|
+
return (typeof window == "undefined" ? Promise.resolve() : ct()).then(() => e());
|
|
4855
4874
|
}
|
|
4856
|
-
const
|
|
4857
|
-
function
|
|
4875
|
+
const Ke = y(yi, { apiName: "getCode" });
|
|
4876
|
+
function da(t = {}) {
|
|
4858
4877
|
return new Promise((e, r) => {
|
|
4859
|
-
|
|
4878
|
+
Ke(p(g({}, t), {
|
|
4860
4879
|
success: e,
|
|
4861
4880
|
fail: r
|
|
4862
4881
|
}));
|
|
4863
4882
|
});
|
|
4864
4883
|
}
|
|
4865
|
-
const
|
|
4884
|
+
const Ve = y(Ci, {
|
|
4866
4885
|
apiName: "navigateToMiniProgram"
|
|
4867
4886
|
});
|
|
4868
|
-
function
|
|
4887
|
+
function ga(t = {}) {
|
|
4869
4888
|
return new Promise((e, r) => {
|
|
4870
|
-
|
|
4889
|
+
Ve(p(g({}, t), {
|
|
4871
4890
|
success: e,
|
|
4872
4891
|
fail: r
|
|
4873
4892
|
}));
|
|
4874
4893
|
});
|
|
4875
4894
|
}
|
|
4876
|
-
const
|
|
4895
|
+
const qe = y(Ni, {
|
|
4877
4896
|
apiName: "filePreview"
|
|
4878
4897
|
});
|
|
4879
|
-
function
|
|
4898
|
+
function ha(t = {}) {
|
|
4880
4899
|
return new Promise((e, r) => {
|
|
4881
|
-
|
|
4900
|
+
qe(p(g({}, t), {
|
|
4882
4901
|
success: e,
|
|
4883
4902
|
fail: r
|
|
4884
4903
|
}));
|
|
4885
4904
|
});
|
|
4886
4905
|
}
|
|
4887
|
-
const
|
|
4888
|
-
function
|
|
4906
|
+
const je = y(ki);
|
|
4907
|
+
function ma(t = {}) {
|
|
4889
4908
|
return new Promise((e, r) => {
|
|
4890
|
-
|
|
4909
|
+
je(p(g({}, t), {
|
|
4891
4910
|
success: e,
|
|
4892
4911
|
fail: r
|
|
4893
4912
|
}));
|
|
4894
4913
|
});
|
|
4895
4914
|
}
|
|
4896
|
-
const
|
|
4897
|
-
function
|
|
4915
|
+
const Qt = y(ta);
|
|
4916
|
+
function pa(t = {}) {
|
|
4898
4917
|
return new Promise((e, r) => {
|
|
4899
|
-
|
|
4918
|
+
Qt(p(g({}, t), {
|
|
4900
4919
|
success: e,
|
|
4901
4920
|
fail: r
|
|
4902
4921
|
}));
|
|
4903
4922
|
});
|
|
4904
4923
|
}
|
|
4905
|
-
const
|
|
4906
|
-
function
|
|
4924
|
+
const Je = y(ji), wa = y(ca);
|
|
4925
|
+
function Ea(t = {}) {
|
|
4907
4926
|
return new Promise((e, r) => {
|
|
4908
|
-
|
|
4927
|
+
Je(p(g({}, t), {
|
|
4909
4928
|
success: e,
|
|
4910
4929
|
fail: r
|
|
4911
4930
|
}));
|
|
4912
4931
|
});
|
|
4913
4932
|
}
|
|
4914
|
-
const
|
|
4915
|
-
function
|
|
4933
|
+
const ya = y(kt, { apiName: "shareDirected" }), Aa = y(Fn, { apiName: "shareDirectedAsync" }), Ia = y(_t, { apiName: "manualShare" }), Pa = y(Ui, { apiName: "manualShareAsync" }), He = y(on);
|
|
4934
|
+
function Ma(t = {}) {
|
|
4916
4935
|
return new Promise((e, r) => {
|
|
4917
|
-
|
|
4936
|
+
He(p(g({}, t), {
|
|
4918
4937
|
success: e,
|
|
4919
4938
|
fail: r
|
|
4920
4939
|
}));
|
|
4921
4940
|
});
|
|
4922
4941
|
}
|
|
4923
|
-
const
|
|
4924
|
-
function
|
|
4942
|
+
const ze = y(cn);
|
|
4943
|
+
function Ca(t = {}) {
|
|
4925
4944
|
return new Promise((e, r) => {
|
|
4926
|
-
|
|
4945
|
+
ze(p(g({}, t), {
|
|
4927
4946
|
success: e,
|
|
4928
4947
|
fail: r
|
|
4929
4948
|
}));
|
|
4930
4949
|
});
|
|
4931
4950
|
}
|
|
4932
|
-
const
|
|
4933
|
-
function
|
|
4951
|
+
const Ye = y(yn);
|
|
4952
|
+
function _a(t = {}) {
|
|
4934
4953
|
return new Promise((e, r) => {
|
|
4935
|
-
|
|
4954
|
+
Ye(p(g({}, t), {
|
|
4936
4955
|
success: e,
|
|
4937
4956
|
fail: r
|
|
4938
4957
|
}));
|
|
4939
4958
|
});
|
|
4940
4959
|
}
|
|
4941
|
-
const
|
|
4942
|
-
function
|
|
4960
|
+
const er = y(Hn);
|
|
4961
|
+
function Ra(t = {}) {
|
|
4943
4962
|
return new Promise((e, r) => {
|
|
4944
|
-
|
|
4963
|
+
er(p(g({}, t), {
|
|
4945
4964
|
success: e,
|
|
4946
4965
|
fail: r
|
|
4947
4966
|
}));
|
|
4948
4967
|
});
|
|
4949
4968
|
}
|
|
4950
|
-
const
|
|
4951
|
-
function
|
|
4969
|
+
const tr = y(zn);
|
|
4970
|
+
function Sa(t = {}) {
|
|
4952
4971
|
return new Promise((e, r) => {
|
|
4953
|
-
|
|
4972
|
+
tr(p(g({}, t), {
|
|
4954
4973
|
success: e,
|
|
4955
4974
|
fail: r
|
|
4956
4975
|
}));
|
|
4957
4976
|
});
|
|
4958
4977
|
}
|
|
4959
|
-
const
|
|
4960
|
-
function
|
|
4978
|
+
const rr = y(Gt);
|
|
4979
|
+
function Oa(t = {}) {
|
|
4961
4980
|
return new Promise((e, r) => {
|
|
4962
|
-
|
|
4981
|
+
rr(p(g({}, t), {
|
|
4963
4982
|
success: e,
|
|
4964
4983
|
fail: r
|
|
4965
4984
|
}));
|
|
4966
4985
|
});
|
|
4967
4986
|
}
|
|
4968
|
-
const
|
|
4969
|
-
function
|
|
4987
|
+
const ir = y(Yn);
|
|
4988
|
+
function Na(t = {}) {
|
|
4970
4989
|
return new Promise((e, r) => {
|
|
4971
|
-
|
|
4990
|
+
ir(p(g({}, t), {
|
|
4972
4991
|
success: e,
|
|
4973
4992
|
fail: r
|
|
4974
4993
|
}));
|
|
4975
4994
|
});
|
|
4976
4995
|
}
|
|
4977
|
-
const
|
|
4996
|
+
const Ta = y(Bt, { apiName: "shareMiniProgramCard" }), ba = y(kn, { apiName: "shareMiniProgramCardAsync" }), oe = {
|
|
4978
4997
|
// 导航 API
|
|
4979
|
-
navigateTo:
|
|
4980
|
-
navigateBack:
|
|
4981
|
-
switchTab:
|
|
4982
|
-
reLaunch:
|
|
4983
|
-
redirectTo:
|
|
4998
|
+
navigateTo: jt,
|
|
4999
|
+
navigateBack: Jt,
|
|
5000
|
+
switchTab: Ht,
|
|
5001
|
+
reLaunch: zt,
|
|
5002
|
+
redirectTo: Yt,
|
|
4984
5003
|
// 消息 API
|
|
4985
|
-
postMessage:
|
|
4986
|
-
getEnv:
|
|
4987
|
-
getCode:
|
|
4988
|
-
getCodeAsync:
|
|
4989
|
-
navigateToMiniProgram:
|
|
4990
|
-
navigateToMiniProgramAsync:
|
|
4991
|
-
filePreview:
|
|
4992
|
-
filePreviewAsync:
|
|
5004
|
+
postMessage: Xt,
|
|
5005
|
+
getEnv: Zt,
|
|
5006
|
+
getCode: Ke,
|
|
5007
|
+
getCodeAsync: da,
|
|
5008
|
+
navigateToMiniProgram: Ve,
|
|
5009
|
+
navigateToMiniProgramAsync: ga,
|
|
5010
|
+
filePreview: qe,
|
|
5011
|
+
filePreviewAsync: ha,
|
|
4993
5012
|
// 图片 API
|
|
4994
|
-
chooseImage:
|
|
4995
|
-
chooseImageAsync:
|
|
5013
|
+
chooseImage: je,
|
|
5014
|
+
chooseImageAsync: ma,
|
|
4996
5015
|
// 扫码 API
|
|
4997
|
-
scanCode:
|
|
4998
|
-
scanCodeAsync:
|
|
5016
|
+
scanCode: Je,
|
|
5017
|
+
scanCodeAsync: Ea,
|
|
4999
5018
|
// 位置 API
|
|
5000
|
-
getLocation:
|
|
5001
|
-
getLocationAsync:
|
|
5002
|
-
openLocation:
|
|
5003
|
-
openLocationAsync:
|
|
5004
|
-
chooseLocation:
|
|
5005
|
-
chooseLocationAsync:
|
|
5019
|
+
getLocation: He,
|
|
5020
|
+
getLocationAsync: Ma,
|
|
5021
|
+
openLocation: ze,
|
|
5022
|
+
openLocationAsync: Ca,
|
|
5023
|
+
chooseLocation: Ye,
|
|
5024
|
+
chooseLocationAsync: _a,
|
|
5006
5025
|
// 位置监听 API(保留回调签名)
|
|
5007
|
-
onLocationChange: (t) => y((e = {}) =>
|
|
5008
|
-
offLocationChange: (t) => y((e = {}) =>
|
|
5009
|
-
onLocationChangeError: (t) => y((e = {}) =>
|
|
5010
|
-
offLocationChangeError: (t) => y((e = {}) =>
|
|
5011
|
-
startLocationUpdate: y(
|
|
5012
|
-
stopLocationUpdate: y(
|
|
5026
|
+
onLocationChange: (t) => y((e = {}) => dn(e.success), { apiName: "onLocationChange" })(Pe(t)),
|
|
5027
|
+
offLocationChange: (t) => y((e = {}) => gn(e.success), { apiName: "offLocationChange" })(Pe(t)),
|
|
5028
|
+
onLocationChangeError: (t) => y((e = {}) => hn(e.success), { apiName: "onLocationChangeError" })(Pe(t)),
|
|
5029
|
+
offLocationChangeError: (t) => y((e = {}) => mn(e.success), { apiName: "offLocationChangeError" })(Pe(t)),
|
|
5030
|
+
startLocationUpdate: y(ln, { apiName: "startLocationUpdate" }),
|
|
5031
|
+
stopLocationUpdate: y(fn, { apiName: "stopLocationUpdate" }),
|
|
5013
5032
|
// 环境信息
|
|
5014
|
-
environment:
|
|
5033
|
+
environment: qt,
|
|
5015
5034
|
/**
|
|
5016
5035
|
* Wait for SDK readiness.
|
|
5017
5036
|
* In Weixin mini-program web-view, if qsh.config({ clientId }) was called,
|
|
@@ -5021,7 +5040,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5021
5040
|
* await qsh.ready()
|
|
5022
5041
|
* @since 2.0.0
|
|
5023
5042
|
*/
|
|
5024
|
-
ready:
|
|
5043
|
+
ready: fa,
|
|
5025
5044
|
/**
|
|
5026
5045
|
* 手动初始化 JSBridge
|
|
5027
5046
|
* 默认会在 DOM 就绪时自动初始化;如需更早或手动控制,可调用本方法。
|
|
@@ -5030,7 +5049,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5030
5049
|
* await qsh.init()
|
|
5031
5050
|
* @since 2.0.0
|
|
5032
5051
|
*/
|
|
5033
|
-
init:
|
|
5052
|
+
init: ut,
|
|
5034
5053
|
/**
|
|
5035
5054
|
* 检查 JSBridge 是否就绪
|
|
5036
5055
|
* @returns {boolean}
|
|
@@ -5038,7 +5057,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5038
5057
|
* if (qsh.isReady()) { console.log('ready') }
|
|
5039
5058
|
* @since 2.0.0
|
|
5040
5059
|
*/
|
|
5041
|
-
isReady:
|
|
5060
|
+
isReady: fr,
|
|
5042
5061
|
/**
|
|
5043
5062
|
* 获取当前 SDK 状态
|
|
5044
5063
|
* @returns {string}
|
|
@@ -5046,8 +5065,8 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5046
5065
|
* console.log(qsh.getState()) // 'ready'
|
|
5047
5066
|
* @since 2.0.0
|
|
5048
5067
|
*/
|
|
5049
|
-
getState:
|
|
5050
|
-
config:
|
|
5068
|
+
getState: dr,
|
|
5069
|
+
config: Qe,
|
|
5051
5070
|
// 微信配置 API
|
|
5052
5071
|
weixin: {
|
|
5053
5072
|
/**
|
|
@@ -5057,7 +5076,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5057
5076
|
* await qsh.weixin.waitForConfig()
|
|
5058
5077
|
* @since 2.0.0
|
|
5059
5078
|
*/
|
|
5060
|
-
config:
|
|
5079
|
+
config: Qe,
|
|
5061
5080
|
waitForConfig: te,
|
|
5062
5081
|
/**
|
|
5063
5082
|
* 检查微信配置是否完成
|
|
@@ -5074,7 +5093,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5074
5093
|
* console.log(qsh.weixin.getConfigState()) // 'configured'
|
|
5075
5094
|
* @since 2.0.0
|
|
5076
5095
|
*/
|
|
5077
|
-
getConfigState:
|
|
5096
|
+
getConfigState: Mr,
|
|
5078
5097
|
/**
|
|
5079
5098
|
* 手动重试微信配置
|
|
5080
5099
|
* @returns {Promise<void>}
|
|
@@ -5082,13 +5101,13 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5082
5101
|
* await qsh.weixin.retryConfig()
|
|
5083
5102
|
* @since 2.0.0
|
|
5084
5103
|
*/
|
|
5085
|
-
retryConfig:
|
|
5104
|
+
retryConfig: Cr
|
|
5086
5105
|
},
|
|
5087
5106
|
// WebView 对象(兼容旧版本)
|
|
5088
5107
|
webView: null,
|
|
5089
5108
|
// 图片相关常量
|
|
5090
|
-
ImageSourceTypes:
|
|
5091
|
-
ImageSizeTypes:
|
|
5109
|
+
ImageSourceTypes: _e,
|
|
5110
|
+
ImageSizeTypes: Re,
|
|
5092
5111
|
/**
|
|
5093
5112
|
* 获取图片功能能力信息
|
|
5094
5113
|
* @returns {Object} 能力信息对象
|
|
@@ -5097,7 +5116,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5097
5116
|
* console.log('是否支持:', capabilities.supported)
|
|
5098
5117
|
* @since 2.0.0
|
|
5099
5118
|
*/
|
|
5100
|
-
getImageCapabilities:
|
|
5119
|
+
getImageCapabilities: Bi,
|
|
5101
5120
|
// 扫码相关常量
|
|
5102
5121
|
ScanTypes: Q,
|
|
5103
5122
|
/**
|
|
@@ -5108,7 +5127,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5108
5127
|
* console.log('是否支持:', capabilities.supported)
|
|
5109
5128
|
* @since 2.1.0
|
|
5110
5129
|
*/
|
|
5111
|
-
getScanCapabilities:
|
|
5130
|
+
getScanCapabilities: Ji,
|
|
5112
5131
|
// 位置相关常量
|
|
5113
5132
|
CoordinateTypes: L,
|
|
5114
5133
|
/**
|
|
@@ -5119,7 +5138,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5119
5138
|
* console.log('是否支持:', capabilities.supported)
|
|
5120
5139
|
* @since 2.1.0
|
|
5121
5140
|
*/
|
|
5122
|
-
getLocationCapabilities:
|
|
5141
|
+
getLocationCapabilities: un,
|
|
5123
5142
|
/**
|
|
5124
5143
|
* 获取位置选择功能能力信息
|
|
5125
5144
|
* @returns {Object} 能力信息对象
|
|
@@ -5128,28 +5147,28 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5128
5147
|
* console.log('是否支持:', capabilities.supported)
|
|
5129
5148
|
* @since 2.1.0
|
|
5130
5149
|
*/
|
|
5131
|
-
getChooseLocationCapabilities:
|
|
5150
|
+
getChooseLocationCapabilities: An,
|
|
5132
5151
|
// 蓝牙 API
|
|
5133
|
-
openBluetoothAdapter:
|
|
5134
|
-
openBluetoothAdapterAsync:
|
|
5135
|
-
startBluetoothDevicesDiscovery:
|
|
5136
|
-
startBluetoothDevicesDiscoveryAsync:
|
|
5137
|
-
onBluetoothDeviceFound:
|
|
5138
|
-
onBluetoothDeviceFoundAsync:
|
|
5139
|
-
createBLEConnection:
|
|
5140
|
-
createBLEConnectionAsync:
|
|
5152
|
+
openBluetoothAdapter: er,
|
|
5153
|
+
openBluetoothAdapterAsync: Ra,
|
|
5154
|
+
startBluetoothDevicesDiscovery: tr,
|
|
5155
|
+
startBluetoothDevicesDiscoveryAsync: Sa,
|
|
5156
|
+
onBluetoothDeviceFound: rr,
|
|
5157
|
+
onBluetoothDeviceFoundAsync: Oa,
|
|
5158
|
+
createBLEConnection: ir,
|
|
5159
|
+
createBLEConnectionAsync: Na,
|
|
5141
5160
|
// 蓝牙相关常量
|
|
5142
|
-
BluetoothStates:
|
|
5161
|
+
BluetoothStates: Bn,
|
|
5143
5162
|
//微信分享(定向模块)
|
|
5144
5163
|
/** 定向分享模块:仅 H5->宿主 WebView,图文/文字/图片到微信会话/朋友圈 */
|
|
5145
|
-
shareDirected:
|
|
5146
|
-
shareDirectedAsync:
|
|
5164
|
+
shareDirected: ya,
|
|
5165
|
+
shareDirectedAsync: Aa,
|
|
5147
5166
|
/** 手动分享预览:仅微信小程序 web-view,通过 postMessage + navigateBack 触发宿主弹窗 */
|
|
5148
|
-
manualShare:
|
|
5149
|
-
manualShareAsync:
|
|
5167
|
+
manualShare: Ia,
|
|
5168
|
+
manualShareAsync: Pa,
|
|
5150
5169
|
/** 微信小程序卡片:仅发送给朋友,不改现有 shareDirected */
|
|
5151
|
-
shareMiniProgramCard:
|
|
5152
|
-
shareMiniProgramCardAsync:
|
|
5170
|
+
shareMiniProgramCard: Ta,
|
|
5171
|
+
shareMiniProgramCardAsync: ba,
|
|
5153
5172
|
/**
|
|
5154
5173
|
* 获取蓝牙功能能力信息
|
|
5155
5174
|
* @returns {Object} 能力信息对象
|
|
@@ -5157,10 +5176,10 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5157
5176
|
* const capabilities = qsh.getBluetoothCapabilities()
|
|
5158
5177
|
* console.log('是否支持:', capabilities.supported)
|
|
5159
5178
|
*/
|
|
5160
|
-
getBluetoothCapabilities:
|
|
5179
|
+
getBluetoothCapabilities: Xn,
|
|
5161
5180
|
// 打印PDF API
|
|
5162
|
-
printPdf:
|
|
5163
|
-
printPdfAsync:
|
|
5181
|
+
printPdf: Qt,
|
|
5182
|
+
printPdfAsync: pa,
|
|
5164
5183
|
/**
|
|
5165
5184
|
* 获取打印PDF功能能力信息
|
|
5166
5185
|
* @returns {Object} 能力信息对象
|
|
@@ -5168,10 +5187,10 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5168
5187
|
* const capabilities = qsh.getPrintCapabilities()
|
|
5169
5188
|
* console.log('是否支持:', capabilities.supported)
|
|
5170
5189
|
*/
|
|
5171
|
-
getPrintCapabilities:
|
|
5190
|
+
getPrintCapabilities: ra,
|
|
5172
5191
|
// 人脸识别 API(仅支持微信小程序环境)
|
|
5173
|
-
faceVerify:
|
|
5174
|
-
getFaceCapabilities:
|
|
5192
|
+
faceVerify: wa,
|
|
5193
|
+
getFaceCapabilities: ua,
|
|
5175
5194
|
// 插件系统
|
|
5176
5195
|
plugins: {
|
|
5177
5196
|
/**
|
|
@@ -5236,11 +5255,11 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5236
5255
|
* 内置拦截器
|
|
5237
5256
|
*/
|
|
5238
5257
|
builtin: {
|
|
5239
|
-
logging:
|
|
5258
|
+
logging: Sr,
|
|
5240
5259
|
performance: H,
|
|
5241
|
-
createRetry:
|
|
5242
|
-
createValidation:
|
|
5243
|
-
errorNormalizer:
|
|
5260
|
+
createRetry: Or,
|
|
5261
|
+
createValidation: Nr,
|
|
5262
|
+
errorNormalizer: ht
|
|
5244
5263
|
}
|
|
5245
5264
|
},
|
|
5246
5265
|
// 观测指标
|
|
@@ -5263,7 +5282,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5263
5282
|
/**
|
|
5264
5283
|
* 错误消息
|
|
5265
5284
|
*/
|
|
5266
|
-
messages:
|
|
5285
|
+
messages: We,
|
|
5267
5286
|
/**
|
|
5268
5287
|
* 错误分类
|
|
5269
5288
|
*/
|
|
@@ -5276,7 +5295,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5276
5295
|
* @example
|
|
5277
5296
|
* const standardError = qsh.errors.normalize(error, { apiName: 'chooseImage' })
|
|
5278
5297
|
*/
|
|
5279
|
-
normalize:
|
|
5298
|
+
normalize: gt,
|
|
5280
5299
|
/**
|
|
5281
5300
|
* 创建标准错误
|
|
5282
5301
|
* @param {string} code - 错误码
|
|
@@ -5285,7 +5304,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5285
5304
|
* @example
|
|
5286
5305
|
* const error = qsh.errors.create('E_IMG_001', { apiName: 'chooseImage' })
|
|
5287
5306
|
*/
|
|
5288
|
-
create:
|
|
5307
|
+
create: Ur,
|
|
5289
5308
|
/**
|
|
5290
5309
|
* 判断是否为标准错误
|
|
5291
5310
|
* @param {any} error - 错误对象
|
|
@@ -5293,7 +5312,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5293
5312
|
* @example
|
|
5294
5313
|
* if (qsh.errors.isStandard(error)) { ... }
|
|
5295
5314
|
*/
|
|
5296
|
-
isStandard:
|
|
5315
|
+
isStandard: Wr
|
|
5297
5316
|
},
|
|
5298
5317
|
// 状态管理
|
|
5299
5318
|
store: {
|
|
@@ -5377,7 +5396,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5377
5396
|
getStats: () => ({
|
|
5378
5397
|
logger: D.getStats(),
|
|
5379
5398
|
state: Z.getStats(),
|
|
5380
|
-
weixinConfig:
|
|
5399
|
+
weixinConfig: Ue().getStats(),
|
|
5381
5400
|
plugins: de.getStats(),
|
|
5382
5401
|
interceptors: X.getStats(),
|
|
5383
5402
|
store: V.getStats()
|
|
@@ -5388,7 +5407,7 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5388
5407
|
* @example
|
|
5389
5408
|
* console.log(qsh.debug.getWeixinConfigManager().getStats())
|
|
5390
5409
|
*/
|
|
5391
|
-
getWeixinConfigManager:
|
|
5410
|
+
getWeixinConfigManager: Ue,
|
|
5392
5411
|
/**
|
|
5393
5412
|
* 导出调试信息
|
|
5394
5413
|
* @returns {string} JSON 格式的调试信息
|
|
@@ -5398,26 +5417,26 @@ const Oa = y(Ft, { apiName: "shareMiniProgramCard" }), Sa = y(Wn, { apiName: "sh
|
|
|
5398
5417
|
exportDebugInfo: () => D.exportToJSON()
|
|
5399
5418
|
}
|
|
5400
5419
|
};
|
|
5401
|
-
|
|
5402
|
-
navigateTo:
|
|
5403
|
-
navigateBack:
|
|
5404
|
-
switchTab:
|
|
5405
|
-
reLaunch:
|
|
5406
|
-
redirectTo:
|
|
5407
|
-
postMessage:
|
|
5408
|
-
getEnv:
|
|
5409
|
-
getCode:
|
|
5410
|
-
navigateToMiniProgram:
|
|
5411
|
-
filePreview:
|
|
5412
|
-
chooseImage:
|
|
5413
|
-
scanCode:
|
|
5414
|
-
getLocation:
|
|
5415
|
-
openLocation:
|
|
5416
|
-
chooseLocation:
|
|
5420
|
+
qt.isWeixinMiniProgram ? oe.webView = window.wx && window.wx.miniProgram : oe.webView = {
|
|
5421
|
+
navigateTo: jt,
|
|
5422
|
+
navigateBack: Jt,
|
|
5423
|
+
switchTab: Ht,
|
|
5424
|
+
reLaunch: zt,
|
|
5425
|
+
redirectTo: Yt,
|
|
5426
|
+
postMessage: Xt,
|
|
5427
|
+
getEnv: Zt,
|
|
5428
|
+
getCode: Ke,
|
|
5429
|
+
navigateToMiniProgram: Ve,
|
|
5430
|
+
filePreview: qe,
|
|
5431
|
+
chooseImage: je,
|
|
5432
|
+
scanCode: Je,
|
|
5433
|
+
getLocation: He,
|
|
5434
|
+
openLocation: ze,
|
|
5435
|
+
chooseLocation: Ye
|
|
5417
5436
|
};
|
|
5418
|
-
const
|
|
5419
|
-
Object.keys(
|
|
5420
|
-
oe.hasOwnProperty(t) || (oe[t] =
|
|
5437
|
+
const st = typeof window.uni != "undefined" ? window.uni : {};
|
|
5438
|
+
Object.keys(st).forEach((t) => {
|
|
5439
|
+
oe.hasOwnProperty(t) || (oe[t] = st[t]);
|
|
5421
5440
|
});
|
|
5422
5441
|
typeof window != "undefined" && (window.qsh = oe);
|
|
5423
5442
|
export {
|