crh-jssdk 1.0.47 → 1.0.50
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.
|
@@ -71,7 +71,8 @@ exports.default = {
|
|
|
71
71
|
return {
|
|
72
72
|
isDYQHZQ: ua.includes("qsid/591"), // 东亚前海
|
|
73
73
|
isIOS: utils_1.ios,
|
|
74
|
-
isAndroid: /Android/i.test(ua),
|
|
74
|
+
isAndroid: /Android/i.test(ua) && !/OpenHarmony/i.test(ua),
|
|
75
|
+
isHarmony: /OpenHarmony/i.test(ua),
|
|
75
76
|
ua: ua,
|
|
76
77
|
};
|
|
77
78
|
},
|
|
@@ -140,26 +141,29 @@ exports.default = {
|
|
|
140
141
|
url = params.url, _a = params.needTitle, needTitle = _a === void 0 ? true : _a, _b = params.isWt, isWt = _b === void 0 ? false : _b;
|
|
141
142
|
_c.label = 1;
|
|
142
143
|
case 1:
|
|
143
|
-
_c.trys.push([1,
|
|
144
|
-
|
|
145
|
-
if (!
|
|
146
|
-
|
|
147
|
-
return [
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
case
|
|
144
|
+
_c.trys.push([1, 4, , 5]);
|
|
145
|
+
console.log("---dyqhzq", this.webviewType().isHarmony);
|
|
146
|
+
if (!this.webviewType().isHarmony) return [3 /*break*/, 3];
|
|
147
|
+
console.log("---harmonygotoSdkPage", url);
|
|
148
|
+
return [4 /*yield*/, utils_1.dyqhzqBridge.bridgeCallHandler("Promise", "gotoSdkPage", {
|
|
149
|
+
h5Url: url,
|
|
150
|
+
isNeedWtLogin: '1'
|
|
151
|
+
})];
|
|
152
|
+
case 2:
|
|
152
153
|
_c.sent();
|
|
153
|
-
|
|
154
|
-
case
|
|
155
|
-
|
|
154
|
+
return [2 /*return*/];
|
|
155
|
+
case 3:
|
|
156
|
+
if (utils_1.ios) {
|
|
157
|
+
window.location.href = "client.html?action=buildInSdk^isSdkNeedWTLogin=1^isNeedLogin=1^h5Url=".concat(url);
|
|
158
|
+
return [2 /*return*/];
|
|
159
|
+
}
|
|
156
160
|
window.location.href = "client.html?action=buildInSdk^h5Url=".concat(url, "^isHiddenNavigationBar=").concat(needTitle ? 1 : 0, "^isHiddenBottomBar=1^isNeedWtLogin=1");
|
|
157
|
-
return [3 /*break*/,
|
|
158
|
-
case
|
|
161
|
+
return [3 /*break*/, 5];
|
|
162
|
+
case 4:
|
|
159
163
|
error_3 = _c.sent();
|
|
160
164
|
console.error("东亚前海跳转客户端页面失败:", error_3);
|
|
161
165
|
return [2 /*return*/, { success: false }];
|
|
162
|
-
case
|
|
166
|
+
case 5: return [2 /*return*/];
|
|
163
167
|
}
|
|
164
168
|
});
|
|
165
169
|
});
|
|
@@ -265,7 +265,7 @@ exports.default = {
|
|
|
265
265
|
case 0:
|
|
266
266
|
_a.trys.push([0, 2, , 3]);
|
|
267
267
|
params = { imageData: imageData };
|
|
268
|
-
console.log("
|
|
268
|
+
console.log("保存图片", params);
|
|
269
269
|
return [4 /*yield*/, utils_1.globalBridge.bridgeCallHandler("Promise", "saveImageToAlbum", params)];
|
|
270
270
|
case 1:
|
|
271
271
|
result = _a.sent();
|
|
@@ -387,6 +387,11 @@ exports.default = {
|
|
|
387
387
|
});
|
|
388
388
|
});
|
|
389
389
|
},
|
|
390
|
+
/**
|
|
391
|
+
* 下载文件
|
|
392
|
+
* @param url 文件url
|
|
393
|
+
* @param title 文件标题
|
|
394
|
+
*/
|
|
390
395
|
/**
|
|
391
396
|
* 在app内打开pdf文件
|
|
392
397
|
*/
|
|
@@ -37,6 +37,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
var utils_1 = require("../utils");
|
|
40
|
+
/**
|
|
41
|
+
* 规范化 hex 颜色值:转小写、补 # 前缀、3 位补 6 位
|
|
42
|
+
* 非 hex 格式仅转小写后原样返回
|
|
43
|
+
* @param color 颜色值,如 #FF0000、FFF、fff
|
|
44
|
+
* @returns 规范化后的颜色值,如 #ff0000
|
|
45
|
+
*/
|
|
46
|
+
var normalizeColor = function (color) {
|
|
47
|
+
var c = color.trim().toLowerCase();
|
|
48
|
+
// 匹配 #RGB / #RRGGBB 及不带 # 的形式
|
|
49
|
+
if (/^#?[0-9a-f]{3}$/.test(c) || /^#?[0-9a-f]{6}$/.test(c)) {
|
|
50
|
+
var hex = c.startsWith("#") ? c.slice(1) : c;
|
|
51
|
+
if (hex.length === 3) {
|
|
52
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
53
|
+
}
|
|
54
|
+
return "#" + hex;
|
|
55
|
+
}
|
|
56
|
+
return c;
|
|
57
|
+
};
|
|
40
58
|
// webview类型
|
|
41
59
|
var webviewType = (function () {
|
|
42
60
|
var ua = navigator.userAgent;
|
|
@@ -93,23 +111,20 @@ exports.default = {
|
|
|
93
111
|
/**
|
|
94
112
|
* 通过pageId打开新的webview打开外部链接
|
|
95
113
|
*/
|
|
96
|
-
goWebview: function (
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
indexUrl:
|
|
100
|
-
uploadPicUrl: "",
|
|
101
|
-
cookieDomain: "",
|
|
102
|
-
closeBusiness: "closeCallBack",
|
|
103
|
-
module: "",
|
|
104
|
-
identifier: "zt",
|
|
114
|
+
goWebview: function (p) {
|
|
115
|
+
var params = {
|
|
116
|
+
statusBarColor: '#FFFFFF',
|
|
117
|
+
indexUrl: p.url
|
|
105
118
|
};
|
|
106
|
-
|
|
107
|
-
if (utils_1.ios) {
|
|
108
|
-
|
|
109
|
-
|
|
119
|
+
console.log('2222+___==============', params, utils_1.ios);
|
|
120
|
+
if (utils_1.ios) { // iphone
|
|
121
|
+
actionMap.loadIOSNative("objc://openOwnPage/$?".concat(JSON.stringify(params)));
|
|
122
|
+
}
|
|
123
|
+
else if ((0, utils_1.checkIsHarmonyOS)()) {
|
|
124
|
+
window.HarmonyBridge.callJsHandler('openOwnPage', JSON.stringify(params));
|
|
110
125
|
}
|
|
111
126
|
else {
|
|
112
|
-
window.jtoJHandle.
|
|
127
|
+
window.jtoJHandle.openOwnPage(JSON.stringify(params));
|
|
113
128
|
}
|
|
114
129
|
},
|
|
115
130
|
/**
|
|
@@ -138,12 +153,23 @@ exports.default = {
|
|
|
138
153
|
*/
|
|
139
154
|
setStatusBar: function (params) {
|
|
140
155
|
return __awaiter(this, void 0, void 0, function () {
|
|
156
|
+
var json;
|
|
141
157
|
return __generator(this, function (_a) {
|
|
158
|
+
// 规范化颜色:大写转小写并补齐(# 前缀、3 位补 6 位)
|
|
159
|
+
if ((params === null || params === void 0 ? void 0 : params.color) && typeof params.color === "string") {
|
|
160
|
+
params.color = normalizeColor(params.color);
|
|
161
|
+
}
|
|
162
|
+
json = JSON.stringify(params);
|
|
163
|
+
console.log("window.jtoJHandle.setStatusBarColor(".concat(json, ")"));
|
|
142
164
|
if (utils_1.ios) {
|
|
143
|
-
actionMap.loadIOSNative("objc://
|
|
165
|
+
actionMap.loadIOSNative("objc://setStatusBarColor/$?".concat(json));
|
|
144
166
|
}
|
|
145
|
-
else if (
|
|
146
|
-
window.
|
|
167
|
+
else if ((0, utils_1.checkIsHarmonyOS)()) {
|
|
168
|
+
window.HarmonyBridge.callJsHandler('setStatusBarColor', json);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
console.log("window.jtoJHandle.setStatusBarColor(".concat(json, ")"));
|
|
172
|
+
window.jtoJHandle.setStatusBarColor(json);
|
|
147
173
|
}
|
|
148
174
|
return [2 /*return*/];
|
|
149
175
|
});
|
|
@@ -160,7 +186,10 @@ exports.default = {
|
|
|
160
186
|
window.location.href = "objc://updateApp/$?" + url;
|
|
161
187
|
}
|
|
162
188
|
else if (window.jtoJHandle) {
|
|
163
|
-
window.jtoJHandle.updateApp('
|
|
189
|
+
window.jtoJHandle.updateApp('1', url);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
window.HarmonyBridge.callJsHandler('updateApp', url);
|
|
164
193
|
}
|
|
165
194
|
return [2 /*return*/];
|
|
166
195
|
});
|
package/dist/business/index.js
CHANGED
|
@@ -468,6 +468,13 @@ var BUSINESS = /** @class */ (function () {
|
|
|
468
468
|
}
|
|
469
469
|
return this.sdkObj.onPageHide(cb);
|
|
470
470
|
};
|
|
471
|
+
// 保存图片到相册(仅限联储证券iOS使用)
|
|
472
|
+
BUSINESS.prototype.saveImageToAlbum = function (params) {
|
|
473
|
+
if (!this.sdkObj.saveImageToAlbum) {
|
|
474
|
+
return (0, utils_1.empty)("saveImageToAlbum");
|
|
475
|
+
}
|
|
476
|
+
return this.sdkObj.saveImageToAlbum(params);
|
|
477
|
+
};
|
|
471
478
|
return BUSINESS;
|
|
472
479
|
}());
|
|
473
480
|
exports.default = BUSINESS;
|
|
@@ -156,6 +156,24 @@ var actionMap = {
|
|
|
156
156
|
iFrame = null;
|
|
157
157
|
},
|
|
158
158
|
};
|
|
159
|
+
/**
|
|
160
|
+
* 规范化 hex 颜色值:转小写、补 # 前缀、3 位补 6 位
|
|
161
|
+
* 非 hex 格式仅转小写后原样返回
|
|
162
|
+
* @param color 颜色值,如 #FF0000、FFF、fff
|
|
163
|
+
* @returns 规范化后的颜色值,如 #ff0000
|
|
164
|
+
*/
|
|
165
|
+
var normalizeColor = function (color) {
|
|
166
|
+
var c = color.trim().toLowerCase();
|
|
167
|
+
// 匹配 #RGB / #RRGGBB 及不带 # 的形式
|
|
168
|
+
if (/^#?[0-9a-f]{3}$/.test(c) || /^#?[0-9a-f]{6}$/.test(c)) {
|
|
169
|
+
var hex = c.startsWith("#") ? c.slice(1) : c;
|
|
170
|
+
if (hex.length === 3) {
|
|
171
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
172
|
+
}
|
|
173
|
+
return "#" + hex;
|
|
174
|
+
}
|
|
175
|
+
return c;
|
|
176
|
+
};
|
|
159
177
|
exports.default = {
|
|
160
178
|
// 获取客户端用户和设备信息
|
|
161
179
|
getDeviceInfo: function () {
|
|
@@ -203,19 +221,29 @@ exports.default = {
|
|
|
203
221
|
}
|
|
204
222
|
},
|
|
205
223
|
/**
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
*/
|
|
224
|
+
* @param {object} params
|
|
225
|
+
* @param {string} params.color 状态栏背景颜色,如#ff0000
|
|
226
|
+
* @param {string} params.wordColorStyle 状态栏文字颜色,0 白色,1 黑色
|
|
227
|
+
*/
|
|
211
228
|
setStatusBar: function (params) {
|
|
212
229
|
return __awaiter(this, void 0, void 0, function () {
|
|
230
|
+
var json;
|
|
213
231
|
return __generator(this, function (_a) {
|
|
232
|
+
// 规范化颜色:大写转小写并补齐(# 前缀、3 位补 6 位)
|
|
233
|
+
if ((params === null || params === void 0 ? void 0 : params.color) && typeof params.color === "string") {
|
|
234
|
+
params.color = normalizeColor(params.color);
|
|
235
|
+
}
|
|
236
|
+
json = JSON.stringify(params);
|
|
237
|
+
console.log("window.jtoJHandle.setStatusBarColor(".concat(json, ")"));
|
|
214
238
|
if (utils_1.ios) {
|
|
215
|
-
actionMap.loadIOSNative("objc://
|
|
239
|
+
actionMap.loadIOSNative("objc://setStatusBarColor/$?".concat(json));
|
|
216
240
|
}
|
|
217
|
-
else if (
|
|
218
|
-
window.
|
|
241
|
+
else if ((0, utils_1.checkIsHarmonyOS)()) {
|
|
242
|
+
window.HarmonyBridge.callJsHandler('setStatusBarColor', json);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
console.log("window.jtoJHandle.setStatusBarColor(".concat(json, ")"));
|
|
246
|
+
window.jtoJHandle.setStatusBarColor(json);
|
|
219
247
|
}
|
|
220
248
|
return [2 /*return*/];
|
|
221
249
|
});
|