@lambo-design-mobile/lambo-js-bridge 1.0.0-beta.37 → 1.0.0-beta.39
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/.versionrc +23 -23
- package/CHANGELOG.md +395 -386
- package/README.md +523 -523
- package/demo/index.vue +517 -454
- package/index.js +3 -3
- package/package.json +1 -1
- package/src/sdk/BrowserAdapter.js +63 -63
- package/src/sdk/CcworkAdapter.js +81 -0
- package/src/sdk/CordovaAdapter.js +20 -20
- package/src/sdk/DingTalkAdapter.js +20 -20
- package/src/sdk/LPAPI.js +1119 -1119
- package/src/sdk/LamboJsBridge.js +117 -102
- package/src/sdk/MobileIMAdapter.js +127 -127
- package/src/sdk/WeComAdapter.js +648 -461
- package/src/sdk/WechatAdapter.js +430 -342
- package/src/sdk/YunTuAdapter.js +316 -316
- package/src/sdk/yuntu.js +55 -55
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import LamboJsBridge from './src/sdk/LamboJsBridge'
|
|
2
|
-
|
|
3
|
-
export default LamboJsBridge
|
|
1
|
+
import LamboJsBridge from './src/sdk/LamboJsBridge'
|
|
2
|
+
|
|
3
|
+
export default LamboJsBridge
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
/* eslint-disable no-undef */
|
|
3
|
-
|
|
4
|
-
class BrowserAdapter {
|
|
5
|
-
constructor(_options) {
|
|
6
|
-
// this.appId = _options.appId; // 保存 appId 以便在 getInitInfo 中使用
|
|
7
|
-
// 由于是假数据,不需要加载任何实际的脚本
|
|
8
|
-
this.init(_options);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async init(options) {
|
|
12
|
-
console.log("Initializing with options:", options);
|
|
13
|
-
// 模拟初始化操作
|
|
14
|
-
return Promise.resolve({
|
|
15
|
-
success: true,
|
|
16
|
-
message: "Initialized successfully"
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
async getLocation(options) {
|
|
21
|
-
console.log(options);
|
|
22
|
-
// 返回假位置数据
|
|
23
|
-
return Promise.resolve({
|
|
24
|
-
latitude: 37.7749, // 假数据
|
|
25
|
-
longitude: -122.4194, // 假数据
|
|
26
|
-
accuracy: 30 // 假数据
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async openLocation(options) {
|
|
31
|
-
console.log(options);
|
|
32
|
-
// 模拟打开位置操作
|
|
33
|
-
return Promise.resolve({
|
|
34
|
-
success: true,
|
|
35
|
-
message: "Location opened successfully"
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async scanCode(options) {
|
|
40
|
-
console.log(options);
|
|
41
|
-
// 返回假扫码数据
|
|
42
|
-
return Promise.resolve({resultStr:"SCAN_CODE_RESULT"});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async takePhoto(options) {
|
|
46
|
-
console.log(options);
|
|
47
|
-
// 返回假照片数据
|
|
48
|
-
return Promise.resolve({
|
|
49
|
-
imageInfo: "FAKE_IMAGE_INFO",
|
|
50
|
-
imageData: "FAKE_IMAGE_DATA"
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async getPlatform(options = {}) {
|
|
55
|
-
// 获取初始化信息
|
|
56
|
-
return {
|
|
57
|
-
appId: 'Example_appId',
|
|
58
|
-
platform: 'Browser'
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default BrowserAdapter;
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* eslint-disable no-undef */
|
|
3
|
+
|
|
4
|
+
class BrowserAdapter {
|
|
5
|
+
constructor(_options) {
|
|
6
|
+
// this.appId = _options.appId; // 保存 appId 以便在 getInitInfo 中使用
|
|
7
|
+
// 由于是假数据,不需要加载任何实际的脚本
|
|
8
|
+
this.init(_options);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async init(options) {
|
|
12
|
+
console.log("Initializing with options:", options);
|
|
13
|
+
// 模拟初始化操作
|
|
14
|
+
return Promise.resolve({
|
|
15
|
+
success: true,
|
|
16
|
+
message: "Initialized successfully"
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async getLocation(options) {
|
|
21
|
+
console.log(options);
|
|
22
|
+
// 返回假位置数据
|
|
23
|
+
return Promise.resolve({
|
|
24
|
+
latitude: 37.7749, // 假数据
|
|
25
|
+
longitude: -122.4194, // 假数据
|
|
26
|
+
accuracy: 30 // 假数据
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async openLocation(options) {
|
|
31
|
+
console.log(options);
|
|
32
|
+
// 模拟打开位置操作
|
|
33
|
+
return Promise.resolve({
|
|
34
|
+
success: true,
|
|
35
|
+
message: "Location opened successfully"
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async scanCode(options) {
|
|
40
|
+
console.log(options);
|
|
41
|
+
// 返回假扫码数据
|
|
42
|
+
return Promise.resolve({resultStr:"SCAN_CODE_RESULT"});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async takePhoto(options) {
|
|
46
|
+
console.log(options);
|
|
47
|
+
// 返回假照片数据
|
|
48
|
+
return Promise.resolve({
|
|
49
|
+
imageInfo: "FAKE_IMAGE_INFO",
|
|
50
|
+
imageData: "FAKE_IMAGE_DATA"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async getPlatform(options = {}) {
|
|
55
|
+
// 获取初始化信息
|
|
56
|
+
return {
|
|
57
|
+
appId: 'Example_appId',
|
|
58
|
+
platform: 'Browser'
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default BrowserAdapter;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import config from '@lambo-design-mobile/shared/config/config';
|
|
2
|
+
|
|
3
|
+
class CcworkAdapter {
|
|
4
|
+
constructor(_options) {
|
|
5
|
+
this.uploadUrl = config.upmsServerContext + '/oss/file/put';
|
|
6
|
+
this.isInitialized = false;
|
|
7
|
+
|
|
8
|
+
this._initPromise = this._initialize();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
_initialize() {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
if (window.ccworkBridge) {
|
|
14
|
+
console.log('ccworkBridge 已存在,直接初始化...');
|
|
15
|
+
this._initBridge(resolve, reject);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
console.log('正在加载 ccworkJsbridge.js...');
|
|
20
|
+
const script = document.createElement('script');
|
|
21
|
+
script.src = "https://cc.ccwork.com/file/download/h5/ccworkJsbridge.js";
|
|
22
|
+
script.onload = () => {
|
|
23
|
+
console.log('ccworkJsbridge.js 加载成功,开始初始化...');
|
|
24
|
+
if (window.ccworkBridge) {
|
|
25
|
+
this._initBridge(resolve, reject);
|
|
26
|
+
} else {
|
|
27
|
+
console.error('脚本加载后,window.ccworkBridge 仍然不存在。');
|
|
28
|
+
reject(new Error('ccworkJsbridge 脚本加载失败。'));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
script.onerror = () => {
|
|
32
|
+
console.error('ccworkJsbridge.js 脚本网络加载失败。');
|
|
33
|
+
reject(new Error('ccworkJsbridge 脚本网络加载失败。'));
|
|
34
|
+
};
|
|
35
|
+
document.head.appendChild(script);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_initBridge(resolve, reject) {
|
|
40
|
+
try {
|
|
41
|
+
ccworkBridge.init((hasLogin) => {
|
|
42
|
+
console.log(`ccworkBridge 初始化完成,登录状态: ${hasLogin}`);
|
|
43
|
+
this.isInitialized = true;
|
|
44
|
+
resolve(hasLogin);
|
|
45
|
+
});
|
|
46
|
+
} catch (err) {
|
|
47
|
+
console.error('调用 ccworkBridge.init 时出错:', err);
|
|
48
|
+
reject(err);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async startCcworkRecording(options = {}) {
|
|
53
|
+
await this._initPromise;
|
|
54
|
+
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
console.log('正在调用 ccworkRecordingAudio...');
|
|
57
|
+
const params = {
|
|
58
|
+
local: false,
|
|
59
|
+
id: this.uploadUrl
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
ccworkBridge.ccworkRecordingAudio(params, (res) => {
|
|
63
|
+
console.log('录音上传完成,收到回调:', res);
|
|
64
|
+
if (res && res.data && res.data.code === 1) {
|
|
65
|
+
resolve(res.data.data[0]);
|
|
66
|
+
} else {
|
|
67
|
+
reject(new Error(res ? res.message : '录音或上传失败,未知错误。'));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
async getPlatform(options = {}) {
|
|
75
|
+
return Promise.resolve({
|
|
76
|
+
platform: 'Ccwork'
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default CcworkAdapter;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
class CordovaAdapter {
|
|
2
|
-
async getLocation(options) {
|
|
3
|
-
// 实现Cordova获取位置逻辑,可能涉及到cordova-plugin-geolocation插件的使用
|
|
4
|
-
console.log('Cordova: Getting location with options', options);
|
|
5
|
-
// 这里应替换为Cordova API的实际调用
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
async scanCode(options) {
|
|
9
|
-
// 实现Cordova扫码逻辑,可能需要集成第三方插件
|
|
10
|
-
console.log('Cordova: Scanning code with options', options);
|
|
11
|
-
// 这里应替换为Cordova插件调用或自定义实现
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async takePhoto(options) {
|
|
15
|
-
// 实现Cordova拍照或选择图片逻辑,可能使用cordova-plugin-camera插件
|
|
16
|
-
console.log('Cordova: Taking photo with options', options);
|
|
17
|
-
// 这里应替换为Cordova插件调用
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
1
|
+
class CordovaAdapter {
|
|
2
|
+
async getLocation(options) {
|
|
3
|
+
// 实现Cordova获取位置逻辑,可能涉及到cordova-plugin-geolocation插件的使用
|
|
4
|
+
console.log('Cordova: Getting location with options', options);
|
|
5
|
+
// 这里应替换为Cordova API的实际调用
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
async scanCode(options) {
|
|
9
|
+
// 实现Cordova扫码逻辑,可能需要集成第三方插件
|
|
10
|
+
console.log('Cordova: Scanning code with options', options);
|
|
11
|
+
// 这里应替换为Cordova插件调用或自定义实现
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async takePhoto(options) {
|
|
15
|
+
// 实现Cordova拍照或选择图片逻辑,可能使用cordova-plugin-camera插件
|
|
16
|
+
console.log('Cordova: Taking photo with options', options);
|
|
17
|
+
// 这里应替换为Cordova插件调用
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
21
|
export default CordovaAdapter;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
class DingTalkAdapter {
|
|
2
|
-
async getLocation(options) {
|
|
3
|
-
// 实现钉钉获取位置逻辑
|
|
4
|
-
console.log('DingTalk: Getting location with options', options);
|
|
5
|
-
// 这里应替换为钉钉API的实际调用
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
async scanCode(options) {
|
|
9
|
-
// 实现钉钉扫码逻辑
|
|
10
|
-
console.log('DingTalk: Scanning code with options', options);
|
|
11
|
-
// 这里应替换为钉钉API的实际调用
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async takePhoto(options) {
|
|
15
|
-
// 实现钉钉拍照或选择图片逻辑
|
|
16
|
-
console.log('DingTalk: Taking photo with options', options);
|
|
17
|
-
// 这里应替换为钉钉API的实际调用
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
1
|
+
class DingTalkAdapter {
|
|
2
|
+
async getLocation(options) {
|
|
3
|
+
// 实现钉钉获取位置逻辑
|
|
4
|
+
console.log('DingTalk: Getting location with options', options);
|
|
5
|
+
// 这里应替换为钉钉API的实际调用
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
async scanCode(options) {
|
|
9
|
+
// 实现钉钉扫码逻辑
|
|
10
|
+
console.log('DingTalk: Scanning code with options', options);
|
|
11
|
+
// 这里应替换为钉钉API的实际调用
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async takePhoto(options) {
|
|
15
|
+
// 实现钉钉拍照或选择图片逻辑
|
|
16
|
+
console.log('DingTalk: Taking photo with options', options);
|
|
17
|
+
// 这里应替换为钉钉API的实际调用
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
21
|
export default DingTalkAdapter;
|