crh-jssdk 0.10.22 → 0.10.23
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/package.json +1 -2
- package/.yalc/crh-jssdk/business/assets/cx_share.png +0 -0
- package/.yalc/crh-jssdk/business/base/crh-app-sdk-cxzq.ts +0 -468
- package/.yalc/crh-jssdk/business/base/index.ts +0 -47
- package/.yalc/crh-jssdk/business/index.ts +0 -210
- package/.yalc/crh-jssdk/business/profession/crh-app-sdk-cxzq.ts +0 -351
- package/.yalc/crh-jssdk/business/profession/index.ts +0 -53
- package/.yalc/crh-jssdk/business/user/crh-app-sdk-cxzq.ts +0 -192
- package/.yalc/crh-jssdk/business/user/crh-app-sdk-cy.ts +0 -46
- package/.yalc/crh-jssdk/business/user/index.ts +0 -45
- package/.yalc/crh-jssdk/business/utils/index.ts +0 -122
- package/.yalc/crh-jssdk/declare.d.ts +0 -46
- package/.yalc/crh-jssdk/images.d.ts +0 -7
- package/.yalc/crh-jssdk/index.js +0 -34
- package/.yalc/crh-jssdk/index.ts +0 -17
- package/.yalc/crh-jssdk/package.json +0 -21
- package/.yalc/crh-jssdk/tsconfig.json +0 -72
- package/.yalc/crh-jssdk/yalc.lock +0 -9
- package/.yalc/crh-jssdk/yalc.sig +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crh-jssdk",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.23",
|
|
4
4
|
"description": "crh-jssdk",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,6 +18,5 @@
|
|
|
18
18
|
"typescript": "^5.5.2"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"crh-jssdk": "file:.yalc/crh-jssdk"
|
|
22
21
|
}
|
|
23
22
|
}
|
|
Binary file
|
|
@@ -1,468 +0,0 @@
|
|
|
1
|
-
import { ios, checkIsHarmonyOS } from "../utils";
|
|
2
|
-
import ShareImg from "../assets/cx_share.png";
|
|
3
|
-
import ProfessionModel from "../profession/crh-app-sdk-cxzq";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @name 版本号比较
|
|
7
|
-
* @param {string} version1 版本号1
|
|
8
|
-
* @param {string} version2 版本号2
|
|
9
|
-
* @returns 1: 版本1大于版本2 | -1: 版本1小于版本2 | 0: 版本相等
|
|
10
|
-
*/
|
|
11
|
-
const compareVersion = (version1: any, version2: any) => {
|
|
12
|
-
version1 = version1.split(".");
|
|
13
|
-
version2 = version2.split(".");
|
|
14
|
-
const n = Math.max(version1.length, version2.length);
|
|
15
|
-
for (let i = 0; i < n; i++) {
|
|
16
|
-
const code1 = version1[i] === undefined ? 0 : parseInt(version1[i], 10);
|
|
17
|
-
const code2 = version2[i] === undefined ? 0 : parseInt(version2[i], 10);
|
|
18
|
-
if (code1 > code2) {
|
|
19
|
-
return 1;
|
|
20
|
-
}
|
|
21
|
-
if (code1 < code2) {
|
|
22
|
-
return -1;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return 0;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// webview类型
|
|
29
|
-
const webviewType = (() => {
|
|
30
|
-
const ua = navigator.userAgent;
|
|
31
|
-
const isWTSDK = ua.includes("cxzqwtsdk");
|
|
32
|
-
return {
|
|
33
|
-
isWTSDK,
|
|
34
|
-
// 新乐赚
|
|
35
|
-
isNewLeZhuan: !isWTSDK && ua.toLowerCase().includes("lezhuan"),
|
|
36
|
-
// 新聚财
|
|
37
|
-
isNewJuCai:
|
|
38
|
-
!isWTSDK &&
|
|
39
|
-
!ua.includes("crhsdk") &&
|
|
40
|
-
(ua.includes("Android_CFZQ_JUCAI") || ua.includes("iOS_CFZQ_JUCAI")),
|
|
41
|
-
// 老聚财
|
|
42
|
-
isOldJuCai: ua.includes("crhsdk") && !ua.includes("cfzqsdk"),
|
|
43
|
-
isLeZhuan:
|
|
44
|
-
(!isWTSDK && ua.toLowerCase().includes("lezhuan")) ||
|
|
45
|
-
ua.includes("cfzqsdk"),
|
|
46
|
-
isCRH: ua.includes("crhsdk") || ua.includes("crhapp"),
|
|
47
|
-
};
|
|
48
|
-
})();
|
|
49
|
-
|
|
50
|
-
const actionMap = {
|
|
51
|
-
// 财信处理action地址方法
|
|
52
|
-
onJsOverrideUrlLoading(str: string) {
|
|
53
|
-
if (ios && window.webkit?.messageHandlers?.lzforward) {
|
|
54
|
-
window.webkit.messageHandlers.lzforward?.postMessage(str);
|
|
55
|
-
} else if (window.MyWebView && window.MyWebView.onJsOverrideUrlLoading) {
|
|
56
|
-
window.MyWebView.onJsOverrideUrlLoading(str);
|
|
57
|
-
} else if (window.HarmonyOS && window.HarmonyOS.onJsOverrideUrlLoading) {
|
|
58
|
-
window.HarmonyOS.onJsOverrideUrlLoading(str);
|
|
59
|
-
} else {
|
|
60
|
-
window.location.href = str;
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
// 财信调用action路径
|
|
64
|
-
callAction(actionId: string | number, param?: any, cbFunName?: any) {
|
|
65
|
-
let url = `http://action:${actionId}/?target=2`;
|
|
66
|
-
if (param) {
|
|
67
|
-
const paramStr = JSON.stringify(param);
|
|
68
|
-
url += `¶m=${encodeURIComponent(paramStr)}`;
|
|
69
|
-
}
|
|
70
|
-
if (cbFunName) {
|
|
71
|
-
url += `&callback=${cbFunName}`;
|
|
72
|
-
}
|
|
73
|
-
console.log("callAction:", url);
|
|
74
|
-
this.onJsOverrideUrlLoading(url);
|
|
75
|
-
},
|
|
76
|
-
// 财信聚财通过js bridge调用app接口
|
|
77
|
-
setupWebViewJavascriptBridge(callback: any) {
|
|
78
|
-
if (window.WebViewJavascriptBridge) {
|
|
79
|
-
callback(window.WebViewJavascriptBridge);
|
|
80
|
-
} else {
|
|
81
|
-
document.addEventListener(
|
|
82
|
-
"WebViewJavascriptBridgeReady",
|
|
83
|
-
() => {
|
|
84
|
-
callback(window.WebViewJavascriptBridge);
|
|
85
|
-
},
|
|
86
|
-
false
|
|
87
|
-
);
|
|
88
|
-
if (!/android/gi.test(navigator.userAgent)) {
|
|
89
|
-
if (window.WebViewJavascriptBridge) {
|
|
90
|
-
callback(window.WebViewJavascriptBridge);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (window.WVJBCallbacks) {
|
|
94
|
-
window.WVJBCallbacks.push(callback);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
window.WVJBCallbacks = [callback];
|
|
98
|
-
const WVJBIframe = document.createElement("iframe");
|
|
99
|
-
WVJBIframe.style.display = "none";
|
|
100
|
-
WVJBIframe.src = "wvjbscheme://__BRIDGE_LOADED__";
|
|
101
|
-
document.documentElement.appendChild(WVJBIframe);
|
|
102
|
-
setTimeout(() => {
|
|
103
|
-
document.documentElement.removeChild(WVJBIframe);
|
|
104
|
-
}, 0);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
// 聚财Android调用app接口
|
|
109
|
-
callAndroidActionOfJvCai(param: any) {
|
|
110
|
-
const paramStr = JSON.stringify(param);
|
|
111
|
-
if (window.mobile) {
|
|
112
|
-
window.mobile.onActionEvent(paramStr);
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
// 财信调用聚财方法
|
|
116
|
-
callJuCaiAction(funName: any, data?: any, callback?: any) {
|
|
117
|
-
console.log("callJuCaiAction:", funName, data, callback);
|
|
118
|
-
if (ios) {
|
|
119
|
-
this.setupWebViewJavascriptBridge((bridge: any) => {
|
|
120
|
-
bridge.callHandler(funName, data, window[callback]);
|
|
121
|
-
});
|
|
122
|
-
} else {
|
|
123
|
-
const param: any = {
|
|
124
|
-
funName,
|
|
125
|
-
callbackFunName: callback,
|
|
126
|
-
};
|
|
127
|
-
if (data) {
|
|
128
|
-
param.data = data;
|
|
129
|
-
}
|
|
130
|
-
this.callAndroidActionOfJvCai(param);
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
/**
|
|
134
|
-
* iOS客户端方法加载函数(老乐赚老聚财)
|
|
135
|
-
* @param {string} url
|
|
136
|
-
*/
|
|
137
|
-
loadIOSNative(url: string) {
|
|
138
|
-
let iFrame: any = "";
|
|
139
|
-
iFrame = document.createElement("iframe");
|
|
140
|
-
iFrame.setAttribute("src", url);
|
|
141
|
-
iFrame.setAttribute("style", "display:none;");
|
|
142
|
-
iFrame.setAttribute("height", "0px");
|
|
143
|
-
iFrame.setAttribute("width", "0px");
|
|
144
|
-
iFrame.setAttribute("frameborder", "0");
|
|
145
|
-
document.body.appendChild(iFrame);
|
|
146
|
-
iFrame.parentNode.removeChild(iFrame);
|
|
147
|
-
iFrame = null;
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
try {
|
|
152
|
-
if (!ios && webviewType.isNewJuCai) {
|
|
153
|
-
actionMap.setupWebViewJavascriptBridge((bridge: any) => {
|
|
154
|
-
bridge.init();
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
} catch (e) {
|
|
158
|
-
console.log("初始化失败");
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export default {
|
|
162
|
-
compareVersion,
|
|
163
|
-
actionMap,
|
|
164
|
-
webviewType() {
|
|
165
|
-
return webviewType;
|
|
166
|
-
},
|
|
167
|
-
//是否在app内
|
|
168
|
-
isApp() {
|
|
169
|
-
const ua = navigator.userAgent;
|
|
170
|
-
const isAppFlags = [
|
|
171
|
-
"crhsdk",
|
|
172
|
-
"crhapp",
|
|
173
|
-
"cfzqsdk",
|
|
174
|
-
"LeZhuan",
|
|
175
|
-
"LEZHUAN",
|
|
176
|
-
"lezhuan",
|
|
177
|
-
"Android_CFZQ_JUCAI",
|
|
178
|
-
"iOS_CFZQ_JUCAI",
|
|
179
|
-
];
|
|
180
|
-
return isAppFlags.some((flag) => ua.includes(flag));
|
|
181
|
-
},
|
|
182
|
-
// 拦截Android物理返回键事件,并回调给前端 --- 仅安卓
|
|
183
|
-
interceptBack(callback: Function) {
|
|
184
|
-
window.jtoJHandle.interceptBack("interceptBackCallBack");
|
|
185
|
-
window.interceptBackCallBack = function (e: any) {
|
|
186
|
-
callback && callback(e);
|
|
187
|
-
};
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
// 关闭页面 closeSJKH
|
|
191
|
-
closeSJKH() {
|
|
192
|
-
if (webviewType.isNewLeZhuan) {
|
|
193
|
-
actionMap.callAction(3);
|
|
194
|
-
} else if (webviewType.isNewJuCai) {
|
|
195
|
-
// iphone
|
|
196
|
-
actionMap.callJuCaiAction("closePage", {});
|
|
197
|
-
} else if (ios) {
|
|
198
|
-
// iphone
|
|
199
|
-
window.location.href = "objc://callIOSQuit/";
|
|
200
|
-
} else {
|
|
201
|
-
window.jtoJHandle.closeSJKH();
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
/**
|
|
205
|
-
* 跳转个股详情页
|
|
206
|
-
*/
|
|
207
|
-
goStockDetail(params: {
|
|
208
|
-
code?: string,
|
|
209
|
-
market?:string
|
|
210
|
-
}) {
|
|
211
|
-
const { code, market } = params;
|
|
212
|
-
if (webviewType.isNewLeZhuan) {
|
|
213
|
-
actionMap.callAction(923, {
|
|
214
|
-
code,
|
|
215
|
-
market,
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
/**
|
|
220
|
-
* 通过pageId打开新的webview打开外部链接
|
|
221
|
-
*/
|
|
222
|
-
goWebview(params: {
|
|
223
|
-
sdk?: string;
|
|
224
|
-
h5?: string;
|
|
225
|
-
h5url?: string;
|
|
226
|
-
token_sn?: string;
|
|
227
|
-
thirdChannel?: string;
|
|
228
|
-
productCode?: string;
|
|
229
|
-
}) {
|
|
230
|
-
const { sdk, h5, h5url = "", productCode } = params;
|
|
231
|
-
const jsonObj = {
|
|
232
|
-
indexUrl: h5,
|
|
233
|
-
uploadPicUrl: "",
|
|
234
|
-
cookieDomain: "",
|
|
235
|
-
closeBusiness: "closeCallBack",
|
|
236
|
-
module: "",
|
|
237
|
-
identifier: "zt",
|
|
238
|
-
};
|
|
239
|
-
const jsonStr = JSON.stringify(jsonObj);
|
|
240
|
-
if (!this.isApp()) {
|
|
241
|
-
window.location.href = h5url;
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
if (webviewType.isNewLeZhuan) {
|
|
245
|
-
actionMap.callAction(207, {
|
|
246
|
-
pageId: sdk || "1",
|
|
247
|
-
needLogin: "0",
|
|
248
|
-
...(productCode ? { param: { productCode } } : {}),
|
|
249
|
-
});
|
|
250
|
-
} else if (webviewType.isNewJuCai) {
|
|
251
|
-
actionMap.callJuCaiAction("gotoClientPage", {
|
|
252
|
-
pageId: ios ? String(sdk) : sdk,
|
|
253
|
-
needLogin: "0",
|
|
254
|
-
...(productCode ? { param: { productCode } } : {}),
|
|
255
|
-
});
|
|
256
|
-
} else if (ios) {
|
|
257
|
-
// iphone
|
|
258
|
-
actionMap.loadIOSNative(`objc://openNewBusiness/$?${jsonStr}`);
|
|
259
|
-
} else {
|
|
260
|
-
window.jtoJHandle.openNewBusiness(jsonStr);
|
|
261
|
-
}
|
|
262
|
-
},
|
|
263
|
-
/**
|
|
264
|
-
* 通过打开新的webview打开外部链接
|
|
265
|
-
* @param {string} url 跳转地址
|
|
266
|
-
* @param {boolean} needTitle 打开新webview是否需要页头1需要0不需要
|
|
267
|
-
*/
|
|
268
|
-
goWebview2({ url = "", needTitle = false, noNewWebView = false }) {
|
|
269
|
-
let targetUrl = url?.trim();
|
|
270
|
-
if (!targetUrl) {
|
|
271
|
-
console.log("targetUrl不能为空");
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
const urlParams: {
|
|
275
|
-
[key: string]: string;
|
|
276
|
-
} = {};
|
|
277
|
-
let prefix = "";
|
|
278
|
-
if (targetUrl.includes("#")) {
|
|
279
|
-
prefix = targetUrl.split("#")[1].includes("?") ? "&" : "?";
|
|
280
|
-
} else {
|
|
281
|
-
prefix = targetUrl.includes("?") ? "&" : "?";
|
|
282
|
-
}
|
|
283
|
-
let from = "";
|
|
284
|
-
if (!targetUrl.includes("from=")) {
|
|
285
|
-
from = "from=newMall";
|
|
286
|
-
urlParams.from = "newMall";
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const currentPage: any = window.location.hash
|
|
290
|
-
? window.location.hash.match(/#([^?]*)/)?.[1]
|
|
291
|
-
: "/";
|
|
292
|
-
urlParams.fromPage = currentPage;
|
|
293
|
-
if (!noNewWebView) {
|
|
294
|
-
// 新开webview
|
|
295
|
-
urlParams.opentype = "newpage";
|
|
296
|
-
}
|
|
297
|
-
if (webviewType.isNewJuCai) {
|
|
298
|
-
delete urlParams.opentype;
|
|
299
|
-
}
|
|
300
|
-
if (!needTitle && !targetUrl.includes("needtitle=")) {
|
|
301
|
-
// 不显示原生标题栏
|
|
302
|
-
urlParams.needtitle = "0";
|
|
303
|
-
}
|
|
304
|
-
if (
|
|
305
|
-
targetUrl.includes("#") &&
|
|
306
|
-
(urlParams.opentype || urlParams.needtitle)
|
|
307
|
-
) {
|
|
308
|
-
// opentype和needtitle处理,需在#号前加
|
|
309
|
-
const tempUrl = targetUrl.split("#");
|
|
310
|
-
const preParams: {
|
|
311
|
-
[key: string]: string;
|
|
312
|
-
} = {};
|
|
313
|
-
if (urlParams.opentype && !tempUrl[0].includes("opentype=")) {
|
|
314
|
-
preParams.opentype = urlParams.opentype;
|
|
315
|
-
}
|
|
316
|
-
if (urlParams.needtitle && !tempUrl[0].includes("needtitle=")) {
|
|
317
|
-
preParams.needtitle = urlParams.needtitle;
|
|
318
|
-
}
|
|
319
|
-
const fromAppTab = sessionStorage.getItem("fromAppTab") || "";
|
|
320
|
-
if (+fromAppTab === 1 && !tempUrl[0].includes("fromAppTab=")) {
|
|
321
|
-
preParams.fromAppTab = "1";
|
|
322
|
-
}
|
|
323
|
-
const urlParamsStr = new URLSearchParams(preParams).toString();
|
|
324
|
-
targetUrl = `${tempUrl[0]}${
|
|
325
|
-
tempUrl[0].includes("?") ? "&" : "?"
|
|
326
|
-
}${urlParamsStr}#${tempUrl[1]}`;
|
|
327
|
-
}
|
|
328
|
-
if (urlParams.opentype) {
|
|
329
|
-
// 新开标识
|
|
330
|
-
urlParams.isInNewWebView = "1";
|
|
331
|
-
}
|
|
332
|
-
/* if (+getSessionStore('fromAppTab') === 1) {
|
|
333
|
-
urlParams.fromAppTab = '1';
|
|
334
|
-
} */
|
|
335
|
-
const urlParamsStr = new URLSearchParams(urlParams).toString();
|
|
336
|
-
const mregeUrl = `${targetUrl}${prefix}${urlParamsStr}`;
|
|
337
|
-
console.log("goWebView:", mregeUrl);
|
|
338
|
-
if (webviewType.isNewLeZhuan) {
|
|
339
|
-
window.location.href = mregeUrl;
|
|
340
|
-
} else if (webviewType.isNewJuCai) {
|
|
341
|
-
if (urlParams.opentype) {
|
|
342
|
-
if (ios) {
|
|
343
|
-
actionMap.setupWebViewJavascriptBridge((bridge: any) => {
|
|
344
|
-
bridge.callHandler(
|
|
345
|
-
"gotoNextPage",
|
|
346
|
-
{
|
|
347
|
-
needtitle: needTitle ? "1" : "0",
|
|
348
|
-
url,
|
|
349
|
-
},
|
|
350
|
-
(data: any) => {
|
|
351
|
-
console.log("goWebview:", data);
|
|
352
|
-
}
|
|
353
|
-
);
|
|
354
|
-
});
|
|
355
|
-
} else {
|
|
356
|
-
// {“pageId”: “2804”, “needLogin”: “true”, “title”: “网页标题”, “url”: “http://www.baidu.com”}
|
|
357
|
-
// pageId=2804表示跳转客户端默认webview,pageId=5002跳转客户端无标题webview;needLogin=1表示需要先登录委托,未登录委托情况下会先跳转客户端委托登录
|
|
358
|
-
actionMap.callJuCaiAction("goWebViewPage", {
|
|
359
|
-
pageId: needTitle ? "2804" : "5002",
|
|
360
|
-
url,
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
} else {
|
|
364
|
-
// 聚财新开webview体验有问题,因此统一走location.href
|
|
365
|
-
window.location.href = url;
|
|
366
|
-
}
|
|
367
|
-
} else {
|
|
368
|
-
let paramsObj: any = {
|
|
369
|
-
indexUrl: url,
|
|
370
|
-
};
|
|
371
|
-
paramsObj = JSON.stringify(paramsObj);
|
|
372
|
-
if (ios) {
|
|
373
|
-
actionMap.loadIOSNative(`objc://openNewBusiness/$?${paramsObj}`);
|
|
374
|
-
} else {
|
|
375
|
-
window.jtoJHandle?.openNewBusiness(paramsObj);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
},
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* 获取客户端版本号
|
|
382
|
-
*/
|
|
383
|
-
getVersion() {
|
|
384
|
-
const ua = navigator.userAgent.toLowerCase();
|
|
385
|
-
let regex: any = "";
|
|
386
|
-
if (webviewType.isNewLeZhuan) {
|
|
387
|
-
regex = ios || checkIsHarmonyOS() ? /cfzq_lezhuan_([\d.]+)/ : /cfzq_lezhuan([\d.]+)/;
|
|
388
|
-
} else if (webviewType.isNewJuCai) {
|
|
389
|
-
regex = /cfzq_jucai_([\d.]+)/;
|
|
390
|
-
}
|
|
391
|
-
const match = ua.match(regex);
|
|
392
|
-
console.log(match, "===match===");
|
|
393
|
-
if (match) {
|
|
394
|
-
const version = match[1];
|
|
395
|
-
return version;
|
|
396
|
-
} else {
|
|
397
|
-
console.warn("version没有找到匹配项");
|
|
398
|
-
return "0.0.0";
|
|
399
|
-
}
|
|
400
|
-
},
|
|
401
|
-
/**
|
|
402
|
-
* 设置原生状态栏颜色(乐赚客户端)
|
|
403
|
-
* @param {object} params
|
|
404
|
-
* @param {string} params.color 状态栏背景颜色,如#ff0000
|
|
405
|
-
* @param {string} params.wordColorStyle 状态栏文字颜色,0 白色,1 黑色
|
|
406
|
-
*/
|
|
407
|
-
async setStatusBar(params: any) {
|
|
408
|
-
if (webviewType.isNewLeZhuan) {
|
|
409
|
-
if (compareVersion("6.1.0", this.getVersion()) === 1) {
|
|
410
|
-
console.log("---版本号低,无法设置状态栏颜色---");
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
let data = {
|
|
414
|
-
statusColor: params.color,
|
|
415
|
-
isDark: params.wordColorStyle === "1",
|
|
416
|
-
};
|
|
417
|
-
actionMap.callAction(933, data);
|
|
418
|
-
} else if (webviewType.isCRH) {
|
|
419
|
-
if (ios) {
|
|
420
|
-
actionMap.loadIOSNative(
|
|
421
|
-
`objc://setAppBackgroundColor/$?${params.color}`
|
|
422
|
-
);
|
|
423
|
-
} else if (window.jtoJHandle) {
|
|
424
|
-
window.jtoJHandle.setAppBackgroundColor(params.color);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* 分享
|
|
431
|
-
* @param {object} params
|
|
432
|
-
* @param {string} params.img_url 分享展示的图片
|
|
433
|
-
* @param {string} params.url 分享链接
|
|
434
|
-
* @param {string} params.title 标题
|
|
435
|
-
* @param {string} params.message 内容
|
|
436
|
-
*/
|
|
437
|
-
share(params: {
|
|
438
|
-
img_url?: any;
|
|
439
|
-
url?: string;
|
|
440
|
-
title?: string;
|
|
441
|
-
message?: string;
|
|
442
|
-
}) {
|
|
443
|
-
if (webviewType.isLeZhuan) {
|
|
444
|
-
const shareParam = {
|
|
445
|
-
img_url: params.img_url || ShareImg,
|
|
446
|
-
url: params.url,
|
|
447
|
-
title: params.title,
|
|
448
|
-
message: params.message,
|
|
449
|
-
};
|
|
450
|
-
if (webviewType.isNewLeZhuan) {
|
|
451
|
-
actionMap.callAction(900, shareParam, "");
|
|
452
|
-
} else {
|
|
453
|
-
ProfessionModel.businessAlertView(
|
|
454
|
-
`http://action:900/?target=2¶m=${encodeURIComponent(
|
|
455
|
-
JSON.stringify(shareParam)
|
|
456
|
-
)}`
|
|
457
|
-
);
|
|
458
|
-
}
|
|
459
|
-
} else {
|
|
460
|
-
return new Promise(async (resolve) => {
|
|
461
|
-
resolve({
|
|
462
|
-
error_no: "-3",
|
|
463
|
-
error_info: "当前APP不支持分享",
|
|
464
|
-
});
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
},
|
|
468
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { ios, checkIsHarmonyOS, harmonyCallJsHandler } from "../utils";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
// 拦截Android物理返回键事件,并回调给前端 --- 仅安卓 鸿蒙
|
|
5
|
-
interceptBack(callback: Function) {
|
|
6
|
-
if (checkIsHarmonyOS()) {
|
|
7
|
-
harmonyCallJsHandler("interceptBack", {
|
|
8
|
-
callback: "interceptBackCallBack",
|
|
9
|
-
});
|
|
10
|
-
} else {
|
|
11
|
-
window.jtoJHandle.interceptBack('interceptBackCallBack')
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
window.interceptBackCallBack = function (e: any) {
|
|
15
|
-
callback && callback(e)
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
// 关闭页面 closeSJKH
|
|
20
|
-
callQuit() {
|
|
21
|
-
if (ios) {
|
|
22
|
-
window.location.href = "objc://callIOSQuit";
|
|
23
|
-
} else if (checkIsHarmonyOS()) {
|
|
24
|
-
harmonyCallJsHandler("closeSJKH", '');
|
|
25
|
-
} else {
|
|
26
|
-
window.jtoJHandle.interceptBack('closeSJKH')
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
goWebview(title: string, url: string, callback: Function) {
|
|
31
|
-
const params = {
|
|
32
|
-
title: title,
|
|
33
|
-
url: url,
|
|
34
|
-
callback: 'openOwnPageCallBack'
|
|
35
|
-
}
|
|
36
|
-
if (ios) {
|
|
37
|
-
window.location.href = `objc://openOwnPage/$?${JSON.stringify(params)}"`;
|
|
38
|
-
} else if (checkIsHarmonyOS()) {
|
|
39
|
-
harmonyCallJsHandler("openOwnPage", params);
|
|
40
|
-
} else {
|
|
41
|
-
window.jtoJHandle.openOwnPage(JSON.stringify(params))
|
|
42
|
-
}
|
|
43
|
-
window.openOwnPageCallBack = function (e: any) {
|
|
44
|
-
callback && callback(e)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|