crh-jssdk 0.10.26 → 0.10.27
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/build.js +66 -0
- package/business/common/utils.js +117 -0
- package/business/index.js +308 -0
- package/business/mall/crh-app-sdk-cxzq.js +758 -0
- package/business/mall/crh-app-sdk.js +164 -0
- package/business/mall/index.js +208 -0
- package/business/profession/crh-app-sdk-cxzq.js +421 -0
- package/business/profession/crh-app-sdk-lczq.js +376 -0
- package/business/profession/index.js +51 -0
- package/business/user/crh-app-sdk-cxzq.js +276 -0
- package/business/user/crh-app-sdk-cy.js +39 -0
- package/business/user/crh-app-sdk-lczq.js +212 -0
- package/business/user/index.js +52 -0
- package/business/utils/bridge.js +138 -0
- package/business/utils/index.js +169 -0
- package/dist/business/base/crh-app-sdk-cxzq.js +501 -0
- package/dist/business/base/crh-app-sdk-lczq.js +290 -0
- package/dist/business/base/index.js +50 -0
- package/dist/business/index.js +308 -0
- package/dist/business/profession/crh-app-sdk-cxzq.js +421 -0
- package/dist/business/profession/crh-app-sdk-lczq.js +54 -0
- package/dist/business/profession/index.js +51 -0
- package/dist/business/user/crh-app-sdk-cxzq.js +276 -0
- package/dist/business/user/crh-app-sdk-cy.js +39 -0
- package/dist/business/user/crh-app-sdk-lczq.js +206 -0
- package/dist/business/user/index.js +52 -0
- package/dist/business/utils/bridge.js +138 -0
- package/dist/business/utils/index.js +169 -0
- package/dist/package.json +1 -1
- package/index.js +34 -0
- package/package.json +1 -1
package/build.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 构建脚本 - 编译 TypeScript 并复制资源文件
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const { execSync } = require('child_process');
|
|
10
|
+
|
|
11
|
+
console.log('🚀 开始构建...');
|
|
12
|
+
|
|
13
|
+
// 清理 dist 目录
|
|
14
|
+
console.log('🧹 清理 dist 目录...');
|
|
15
|
+
if (fs.existsSync('dist')) {
|
|
16
|
+
execSync('rm -rf dist', { stdio: 'inherit' });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// 编译 TypeScript
|
|
20
|
+
console.log('📦 编译 TypeScript...');
|
|
21
|
+
try {
|
|
22
|
+
execSync('tsc', { stdio: 'inherit' });
|
|
23
|
+
console.log('✅ TypeScript 编译完成');
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error('❌ TypeScript 编译失败:', error.message);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 复制资源文件
|
|
30
|
+
console.log('📁 复制资源文件...');
|
|
31
|
+
const assetsSource = 'business/assets';
|
|
32
|
+
const assetsTarget = 'dist/business/assets';
|
|
33
|
+
|
|
34
|
+
if (fs.existsSync(assetsSource)) {
|
|
35
|
+
// 确保目标目录存在
|
|
36
|
+
if (!fs.existsSync(path.dirname(assetsTarget))) {
|
|
37
|
+
fs.mkdirSync(path.dirname(assetsTarget), { recursive: true });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 复制整个 assets 目录
|
|
41
|
+
execSync(`cp -r ${assetsSource} ${path.dirname(assetsTarget)}/`, { stdio: 'inherit' });
|
|
42
|
+
console.log('✅ 资源文件复制完成');
|
|
43
|
+
} else {
|
|
44
|
+
console.log('⚠️ 未找到 assets 目录,跳过复制');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 复制其他可能需要复制的文件
|
|
48
|
+
const filesToCopy = [
|
|
49
|
+
'package.json',
|
|
50
|
+
'README.md'
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
filesToCopy.forEach(file => {
|
|
54
|
+
if (fs.existsSync(file)) {
|
|
55
|
+
// 确保目标目录存在
|
|
56
|
+
const targetDir = path.dirname(`dist/${file}`);
|
|
57
|
+
if (!fs.existsSync(targetDir)) {
|
|
58
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
59
|
+
}
|
|
60
|
+
fs.copyFileSync(file, `dist/${file}`);
|
|
61
|
+
console.log(`✅ 复制 ${file}`);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
console.log('🎉 构建完成!');
|
|
66
|
+
console.log('📂 输出目录: dist/');
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ios = exports.empty = exports.common = void 0;
|
|
40
|
+
exports.checkIsHarmonyOS = checkIsHarmonyOS;
|
|
41
|
+
exports.harmonyCallJsHandler = harmonyCallJsHandler;
|
|
42
|
+
//调用sdk通用方法
|
|
43
|
+
var common = function (promise, name) {
|
|
44
|
+
if (!promise) {
|
|
45
|
+
return function () {
|
|
46
|
+
return Promise.resolve([
|
|
47
|
+
{
|
|
48
|
+
code: "-1",
|
|
49
|
+
data: null,
|
|
50
|
+
msg: "jssdk\u6682\u4E0D\u652F\u6301".concat(name, "\u65B9\u6CD5, \u8BF7\u4E0E\u7BA1\u7406\u5458\u8054\u7CFB"),
|
|
51
|
+
},
|
|
52
|
+
]);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return function () {
|
|
56
|
+
var params = [];
|
|
57
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
58
|
+
params[_i] = arguments[_i];
|
|
59
|
+
}
|
|
60
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
61
|
+
var res;
|
|
62
|
+
return __generator(this, function (_a) {
|
|
63
|
+
switch (_a.label) {
|
|
64
|
+
case 0:
|
|
65
|
+
console.log("\u65B9\u6CD5:".concat(name, ";\u8BF7\u6C42\u53C2\u6570\u5982\u4E0B:").concat(JSON.stringify(params)));
|
|
66
|
+
return [4 /*yield*/, promise.apply(void 0, params)];
|
|
67
|
+
case 1:
|
|
68
|
+
res = _a.sent();
|
|
69
|
+
return [2 /*return*/, res];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
exports.common = common;
|
|
76
|
+
var empty = function (name) {
|
|
77
|
+
return Promise.resolve([
|
|
78
|
+
{ code: "-1", data: null, msg: "jssdk\u6682\u4E0D\u652F\u6301".concat(name, "\u65B9\u6CD5, \u8BF7\u4E0E\u7BA1\u7406\u5458\u8054\u7CFB") },
|
|
79
|
+
]);
|
|
80
|
+
};
|
|
81
|
+
exports.empty = empty;
|
|
82
|
+
var u = navigator.userAgent;
|
|
83
|
+
var ios = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
|
|
84
|
+
exports.ios = ios;
|
|
85
|
+
function checkIsHarmonyOS() {
|
|
86
|
+
try {
|
|
87
|
+
if (window.HarmonyBridge && window.HarmonyBridge.callJsHandler) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
console.log("获取鸿蒙标识出错");
|
|
93
|
+
console.log(e);
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @desc 调用鸿蒙方法
|
|
99
|
+
* @param key
|
|
100
|
+
* @param data
|
|
101
|
+
*/
|
|
102
|
+
function harmonyCallJsHandler(key, data) {
|
|
103
|
+
var params = {};
|
|
104
|
+
try {
|
|
105
|
+
if (typeof data === "string") {
|
|
106
|
+
params = JSON.parse(data);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
params = data;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (_) {
|
|
113
|
+
params = {};
|
|
114
|
+
}
|
|
115
|
+
console.log('调用 HarmonyBridge: ', key, JSON.stringify(params));
|
|
116
|
+
window.HarmonyBridge.callJsHandler(key, JSON.stringify(params));
|
|
117
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
+
function step(op) {
|
|
50
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
52
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
53
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
+
switch (op[0]) {
|
|
55
|
+
case 0: case 1: t = op; break;
|
|
56
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
+
default:
|
|
60
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
+
if (t[2]) _.ops.pop();
|
|
65
|
+
_.trys.pop(); continue;
|
|
66
|
+
}
|
|
67
|
+
op = body.call(thisArg, _);
|
|
68
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
73
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
74
|
+
};
|
|
75
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
76
|
+
/**
|
|
77
|
+
* @desc jssdk 总入口
|
|
78
|
+
* 1 财人汇app sdk
|
|
79
|
+
*/
|
|
80
|
+
var utils_1 = require("./utils");
|
|
81
|
+
var base_1 = __importDefault(require("./base")); // 基础
|
|
82
|
+
var profession_1 = __importDefault(require("./profession")); // 业务
|
|
83
|
+
var user_1 = __importDefault(require("./user")); // 用户
|
|
84
|
+
var BUSINESS = /** @class */ (function () {
|
|
85
|
+
function BUSINESS(sdkType) {
|
|
86
|
+
this.isApp = false; //是否是app
|
|
87
|
+
this.sdkType = sdkType; // 1 财人汇 2 财信 3 新意 4联储
|
|
88
|
+
this.bridge = utils_1.globalBridge; // 初始化Bridge实例
|
|
89
|
+
}
|
|
90
|
+
BUSINESS.prototype.initSdk = function () {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var Obj, _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
93
|
+
return __generator(this, function (_l) {
|
|
94
|
+
switch (_l.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
console.log("start initSdk");
|
|
97
|
+
Obj = __assign(__assign(__assign({}, base_1.default), profession_1.default), user_1.default);
|
|
98
|
+
if (!(+this.sdkType === 1)) return [3 /*break*/, 1];
|
|
99
|
+
this.sdkObj = Obj;
|
|
100
|
+
return [3 /*break*/, 11];
|
|
101
|
+
case 1:
|
|
102
|
+
if (!(+this.sdkType === 2)) return [3 /*break*/, 5];
|
|
103
|
+
_a = this;
|
|
104
|
+
_b = [__assign({}, Obj)];
|
|
105
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("./base/crh-app-sdk-cxzq")); })];
|
|
106
|
+
case 2:
|
|
107
|
+
_c = [__assign.apply(void 0, _b.concat([(_l.sent()).default]))];
|
|
108
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("./user/crh-app-sdk-cxzq")); })];
|
|
109
|
+
case 3:
|
|
110
|
+
_d = [__assign.apply(void 0, _c.concat([(_l.sent()).default]))];
|
|
111
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("./profession/crh-app-sdk-cxzq")); })];
|
|
112
|
+
case 4:
|
|
113
|
+
_a.sdkObj = __assign.apply(void 0, _d.concat([(_l.sent()).default]));
|
|
114
|
+
console.log(this.sdkObj, "sdkObj---jssdk");
|
|
115
|
+
this.isApp = this.sdkObj.isApp();
|
|
116
|
+
this.webviewType = this.sdkObj.webviewType();
|
|
117
|
+
return [3 /*break*/, 11];
|
|
118
|
+
case 5:
|
|
119
|
+
if (!(+this.sdkType === 3)) return [3 /*break*/, 7];
|
|
120
|
+
_e = this;
|
|
121
|
+
_f = [{}];
|
|
122
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("./user/crh-app-sdk-cy")); })];
|
|
123
|
+
case 6:
|
|
124
|
+
_e.sdkObj = __assign.apply(void 0, _f.concat([(_l.sent()).default]));
|
|
125
|
+
console.log(this.sdkObj, "sdkObj---jssdk");
|
|
126
|
+
this.isApp = this.sdkObj.isApp();
|
|
127
|
+
this.webviewType = this.sdkObj.webviewType();
|
|
128
|
+
return [3 /*break*/, 11];
|
|
129
|
+
case 7:
|
|
130
|
+
if (!(+this.sdkType === 4)) return [3 /*break*/, 11];
|
|
131
|
+
console.log("初始化联储证券SDK...");
|
|
132
|
+
// 联储证券使用Bridge版本
|
|
133
|
+
_g = this;
|
|
134
|
+
_h = [__assign({}, Obj)];
|
|
135
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("./base/crh-app-sdk-lczq")); })];
|
|
136
|
+
case 8:
|
|
137
|
+
_j = [__assign.apply(void 0, _h.concat([(_l.sent()).default]))];
|
|
138
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("./user/crh-app-sdk-lczq")); })];
|
|
139
|
+
case 9:
|
|
140
|
+
_k = [__assign.apply(void 0, _j.concat([(_l.sent()).default]))];
|
|
141
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("./profession/crh-app-sdk-lczq")); })];
|
|
142
|
+
case 10:
|
|
143
|
+
// 联储证券使用Bridge版本
|
|
144
|
+
_g.sdkObj = __assign.apply(void 0, _k.concat([(_l.sent()).default]));
|
|
145
|
+
console.log("sdkObj---jssdk(Bridge版本)", this.sdkObj);
|
|
146
|
+
this.isApp = this.sdkObj.isApp();
|
|
147
|
+
this.webviewType = this.sdkObj.webviewType();
|
|
148
|
+
// 异步等待Bridge准备就绪,但不阻塞初始化
|
|
149
|
+
this.bridge.waitForReady().then(function () {
|
|
150
|
+
console.log("Bridge通信已准备就绪");
|
|
151
|
+
}).catch(function (error) {
|
|
152
|
+
console.warn("Bridge初始化超时或失败:", error);
|
|
153
|
+
});
|
|
154
|
+
_l.label = 11;
|
|
155
|
+
case 11:
|
|
156
|
+
// 设置Bridge实例到sdkObj中,供各模块使用
|
|
157
|
+
if (this.sdkObj) {
|
|
158
|
+
this.sdkObj.bridge = this.bridge;
|
|
159
|
+
}
|
|
160
|
+
console.log("sdk初始化了", this.sdkType);
|
|
161
|
+
return [2 /*return*/];
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
//获取设备信息
|
|
167
|
+
BUSINESS.prototype.getDeviceInfo = function (fn) {
|
|
168
|
+
if (!this.sdkObj.getDeviceInfo) {
|
|
169
|
+
return (0, utils_1.empty)("getDeviceInfo");
|
|
170
|
+
}
|
|
171
|
+
return this.sdkObj.getDeviceInfo(fn);
|
|
172
|
+
};
|
|
173
|
+
//拦截Android物理返回键事件,并回调给前端 --- 仅安卓 鸿蒙
|
|
174
|
+
BUSINESS.prototype.interceptBack = function (fn) {
|
|
175
|
+
if (!this.sdkObj.interceptBack) {
|
|
176
|
+
return (0, utils_1.empty)("interceptBack");
|
|
177
|
+
}
|
|
178
|
+
return this.sdkObj.interceptBack(fn);
|
|
179
|
+
};
|
|
180
|
+
//关闭页面
|
|
181
|
+
BUSINESS.prototype.closeSJKH = function () {
|
|
182
|
+
if (!this.sdkObj.closeSJKH) {
|
|
183
|
+
return (0, utils_1.empty)("closeSJKH");
|
|
184
|
+
}
|
|
185
|
+
return this.sdkObj.closeSJKH();
|
|
186
|
+
};
|
|
187
|
+
//打开新页面
|
|
188
|
+
BUSINESS.prototype.openOwnPage = function (fn) {
|
|
189
|
+
if (!this.sdkObj.openOwnPage) {
|
|
190
|
+
return (0, utils_1.empty)("openOwnPage");
|
|
191
|
+
}
|
|
192
|
+
return this.sdkObj.openOwnPage(fn);
|
|
193
|
+
};
|
|
194
|
+
//获取用户信息
|
|
195
|
+
BUSINESS.prototype.getUserInfo = function (fn) {
|
|
196
|
+
if (!this.sdkObj.getUserInfo) {
|
|
197
|
+
return (0, utils_1.empty)("getUserInfo");
|
|
198
|
+
}
|
|
199
|
+
return this.sdkObj.getUserInfo(fn);
|
|
200
|
+
};
|
|
201
|
+
//调起客户端登录
|
|
202
|
+
BUSINESS.prototype.callOtherLogin = function (fn) {
|
|
203
|
+
if (!this.sdkObj.callOtherLogin) {
|
|
204
|
+
return (0, utils_1.empty)("callOtherLogin");
|
|
205
|
+
}
|
|
206
|
+
return this.sdkObj.callOtherLogin(fn);
|
|
207
|
+
};
|
|
208
|
+
//跳转个股详情页
|
|
209
|
+
BUSINESS.prototype.goStockDetail = function (params) {
|
|
210
|
+
if (!this.sdkObj.goStockDetail) {
|
|
211
|
+
return (0, utils_1.empty)("goStockDetail");
|
|
212
|
+
}
|
|
213
|
+
return this.sdkObj.goStockDetail(params);
|
|
214
|
+
};
|
|
215
|
+
//跳转webview
|
|
216
|
+
BUSINESS.prototype.goWebview = function (params) {
|
|
217
|
+
if (!this.sdkObj.goWebview) {
|
|
218
|
+
return (0, utils_1.empty)("goWebview");
|
|
219
|
+
}
|
|
220
|
+
return this.sdkObj.goWebview(params);
|
|
221
|
+
};
|
|
222
|
+
//跳转webview
|
|
223
|
+
BUSINESS.prototype.goWebview2 = function (params) {
|
|
224
|
+
if (!this.sdkObj.goWebview) {
|
|
225
|
+
return (0, utils_1.empty)("goWebview");
|
|
226
|
+
}
|
|
227
|
+
return this.sdkObj.goWebview2(params);
|
|
228
|
+
};
|
|
229
|
+
//获取用户信息
|
|
230
|
+
BUSINESS.prototype.getUser = function () {
|
|
231
|
+
if (!this.sdkObj.getUser) {
|
|
232
|
+
return (0, utils_1.empty)("getUser");
|
|
233
|
+
}
|
|
234
|
+
return this.sdkObj.getUser();
|
|
235
|
+
};
|
|
236
|
+
//获取交易登录的token(弹出登录框)
|
|
237
|
+
BUSINESS.prototype.getTradeLoginToken = function (appid) {
|
|
238
|
+
if (!this.sdkObj.getTradeLoginToken) {
|
|
239
|
+
return (0, utils_1.empty)("getTradeLoginToken");
|
|
240
|
+
}
|
|
241
|
+
return this.sdkObj.getTradeLoginToken(appid);
|
|
242
|
+
};
|
|
243
|
+
//获取手机号token
|
|
244
|
+
BUSINESS.prototype.getPhoneToken = function () {
|
|
245
|
+
if (!this.sdkObj.getPhoneToken) {
|
|
246
|
+
return (0, utils_1.empty)("getPhoneToken");
|
|
247
|
+
}
|
|
248
|
+
return this.sdkObj.getPhoneToken();
|
|
249
|
+
};
|
|
250
|
+
//获取app版本
|
|
251
|
+
BUSINESS.prototype.getVersion = function () {
|
|
252
|
+
if (!this.sdkObj.getVersion) {
|
|
253
|
+
return (0, utils_1.empty)("getVersion");
|
|
254
|
+
}
|
|
255
|
+
return this.sdkObj.getVersion();
|
|
256
|
+
};
|
|
257
|
+
//设置原生状态栏颜色(乐赚客户端)
|
|
258
|
+
BUSINESS.prototype.setStatusBar = function (params) {
|
|
259
|
+
if (!this.sdkObj.setStatusBar) {
|
|
260
|
+
return (0, utils_1.empty)("setStatusBar");
|
|
261
|
+
}
|
|
262
|
+
return this.sdkObj.setStatusBar(params);
|
|
263
|
+
};
|
|
264
|
+
//聚财安卓设置全局字体缩放
|
|
265
|
+
BUSINESS.prototype.setJCFontSize = function () {
|
|
266
|
+
if (!this.sdkObj.setJCFontSize) {
|
|
267
|
+
return (0, utils_1.empty)("setJCFontSize");
|
|
268
|
+
}
|
|
269
|
+
return this.sdkObj.setJCFontSize();
|
|
270
|
+
};
|
|
271
|
+
//产品自选
|
|
272
|
+
BUSINESS.prototype.setCollect = function (params) {
|
|
273
|
+
if (!this.sdkObj.setCollect) {
|
|
274
|
+
return (0, utils_1.empty)("setCollect");
|
|
275
|
+
}
|
|
276
|
+
return this.sdkObj.setCollect(params);
|
|
277
|
+
};
|
|
278
|
+
//查询产品自选
|
|
279
|
+
BUSINESS.prototype.queryCollect = function (params) {
|
|
280
|
+
if (!this.sdkObj.setCollect) {
|
|
281
|
+
return (0, utils_1.empty)("queryCollect");
|
|
282
|
+
}
|
|
283
|
+
return this.sdkObj.queryCollect(params);
|
|
284
|
+
};
|
|
285
|
+
//银证转账
|
|
286
|
+
BUSINESS.prototype.goBankTransfer = function (version, callbackName) {
|
|
287
|
+
if (version === void 0) { version = "7.2.0"; }
|
|
288
|
+
if (!this.sdkObj.goBankTransfer) {
|
|
289
|
+
return (0, utils_1.empty)("goBankTransfer");
|
|
290
|
+
}
|
|
291
|
+
return this.sdkObj.goBankTransfer(version, callbackName);
|
|
292
|
+
};
|
|
293
|
+
//分享
|
|
294
|
+
BUSINESS.prototype.share = function (params) {
|
|
295
|
+
if (!this.sdkObj.share) {
|
|
296
|
+
return (0, utils_1.empty)("share");
|
|
297
|
+
}
|
|
298
|
+
return this.sdkObj.share(params);
|
|
299
|
+
};
|
|
300
|
+
BUSINESS.prototype.goBack = function () {
|
|
301
|
+
if (!this.sdkObj.goBack) {
|
|
302
|
+
return (0, utils_1.empty)("goBack");
|
|
303
|
+
}
|
|
304
|
+
return this.sdkObj.goBack();
|
|
305
|
+
};
|
|
306
|
+
return BUSINESS;
|
|
307
|
+
}());
|
|
308
|
+
exports.default = BUSINESS;
|