@lambo-design-mobile/lambo-js-bridge 1.0.0-beta.13 → 1.0.0-beta.14
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 +217 -215
- package/README.md +279 -279
- package/demo/index.vue +243 -243
- package/index.js +3 -3
- package/package.json +1 -1
- package/src/sdk/BrowserAdapter.js +63 -63
- package/src/sdk/CordovaAdapter.js +20 -20
- package/src/sdk/DingTalkAdapter.js +20 -20
- package/src/sdk/LamboJsBridge.js +80 -80
- package/src/sdk/WeComAdapter.js +306 -306
- package/src/sdk/YunTuAdapter.js +239 -239
- package/src/sdk/yuntu.js +55 -55
|
@@ -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;
|
package/src/sdk/LamboJsBridge.js
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import WechatAdapter from './WechatAdapter';
|
|
2
|
-
import DingTalkAdapter from './DingTalkAdapter';
|
|
3
|
-
import CordovaAdapter from './CordovaAdapter';
|
|
4
|
-
import YunTuAdapter from './YunTuAdapter';
|
|
5
|
-
import WeComAdapter from './WeComAdapter';
|
|
6
|
-
import BrowserAdapter from './BrowserAdapter';
|
|
7
|
-
import MobileIMAdaoter from './MobileIMAdaoter';
|
|
8
|
-
|
|
9
|
-
class LamboJsBridge {
|
|
10
|
-
constructor(param) {
|
|
11
|
-
this._detectPlatform(param);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
_detectPlatform(param) {
|
|
15
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
16
|
-
if (/wxwork/.test(userAgent)) {
|
|
17
|
-
this.platform = new WeComAdapter(param);
|
|
18
|
-
} else if (/micromessenger/.test(userAgent)) {
|
|
19
|
-
this.platform = new WechatAdapter(param);
|
|
20
|
-
} else if (/dingtalk/.test(userAgent)) {
|
|
21
|
-
this.platform = new DingTalkAdapter(param);
|
|
22
|
-
} else if (/cordova/.test(userAgent)) {
|
|
23
|
-
this.platform = new CordovaAdapter(param);
|
|
24
|
-
} else if (/yuntu/.test(userAgent)) {
|
|
25
|
-
this.platform = new YunTuAdapter(param);
|
|
26
|
-
} else if (/mobileim/.test(userAgent)) {
|
|
27
|
-
this.platform = new MobileIMAdaoter(param);
|
|
28
|
-
} else {
|
|
29
|
-
this.platform = new BrowserAdapter();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async initializePlugin(pluginConfig = []) {
|
|
34
|
-
if (this.platform instanceof YunTuAdapter) {
|
|
35
|
-
return this.platform.initializePlugin(pluginConfig);
|
|
36
|
-
} else {
|
|
37
|
-
return Promise.resolve();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async getPlatform(options = {}) {
|
|
42
|
-
return this.platform.getPlatform(options);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async getLocation(options = {}) {
|
|
46
|
-
return this.platform.getLocation(options);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async scanCode(options = {}) {
|
|
50
|
-
return this.platform.scanCode(options);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async localAuthPlugin(options = {}) {
|
|
54
|
-
return this.platform.localAuthPlugin(options);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async getAvailableBiometrics(options = {}) {
|
|
58
|
-
return this.platform.getAvailableBiometrics(options);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async takePhoto(options = {}) {
|
|
62
|
-
return this.platform.takePhoto(options);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
async openLocation(options = {}) {
|
|
66
|
-
return this.platform.openLocation(options);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async filePreview(options = {}) {
|
|
70
|
-
return this.platform.filePreview(options);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// 创建一个 Vue 插件
|
|
74
|
-
static install(Vue) {
|
|
75
|
-
// 将 LamboJsBridge 实例挂载到 Vue 原型上,全局可用
|
|
76
|
-
Vue.prototype.$lamboJsBridge = new LamboJsBridge({});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export default LamboJsBridge;
|
|
1
|
+
import WechatAdapter from './WechatAdapter';
|
|
2
|
+
import DingTalkAdapter from './DingTalkAdapter';
|
|
3
|
+
import CordovaAdapter from './CordovaAdapter';
|
|
4
|
+
import YunTuAdapter from './YunTuAdapter';
|
|
5
|
+
import WeComAdapter from './WeComAdapter';
|
|
6
|
+
import BrowserAdapter from './BrowserAdapter';
|
|
7
|
+
import MobileIMAdaoter from './MobileIMAdaoter';
|
|
8
|
+
|
|
9
|
+
class LamboJsBridge {
|
|
10
|
+
constructor(param) {
|
|
11
|
+
this._detectPlatform(param);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
_detectPlatform(param) {
|
|
15
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
16
|
+
if (/wxwork/.test(userAgent)) {
|
|
17
|
+
this.platform = new WeComAdapter(param);
|
|
18
|
+
} else if (/micromessenger/.test(userAgent)) {
|
|
19
|
+
this.platform = new WechatAdapter(param);
|
|
20
|
+
} else if (/dingtalk/.test(userAgent)) {
|
|
21
|
+
this.platform = new DingTalkAdapter(param);
|
|
22
|
+
} else if (/cordova/.test(userAgent)) {
|
|
23
|
+
this.platform = new CordovaAdapter(param);
|
|
24
|
+
} else if (/yuntu/.test(userAgent)) {
|
|
25
|
+
this.platform = new YunTuAdapter(param);
|
|
26
|
+
} else if (/mobileim/.test(userAgent)) {
|
|
27
|
+
this.platform = new MobileIMAdaoter(param);
|
|
28
|
+
} else {
|
|
29
|
+
this.platform = new BrowserAdapter();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async initializePlugin(pluginConfig = []) {
|
|
34
|
+
if (this.platform instanceof YunTuAdapter) {
|
|
35
|
+
return this.platform.initializePlugin(pluginConfig);
|
|
36
|
+
} else {
|
|
37
|
+
return Promise.resolve();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async getPlatform(options = {}) {
|
|
42
|
+
return this.platform.getPlatform(options);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async getLocation(options = {}) {
|
|
46
|
+
return this.platform.getLocation(options);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async scanCode(options = {}) {
|
|
50
|
+
return this.platform.scanCode(options);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async localAuthPlugin(options = {}) {
|
|
54
|
+
return this.platform.localAuthPlugin(options);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async getAvailableBiometrics(options = {}) {
|
|
58
|
+
return this.platform.getAvailableBiometrics(options);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async takePhoto(options = {}) {
|
|
62
|
+
return this.platform.takePhoto(options);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async openLocation(options = {}) {
|
|
66
|
+
return this.platform.openLocation(options);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async filePreview(options = {}) {
|
|
70
|
+
return this.platform.filePreview(options);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// 创建一个 Vue 插件
|
|
74
|
+
static install(Vue) {
|
|
75
|
+
// 将 LamboJsBridge 实例挂载到 Vue 原型上,全局可用
|
|
76
|
+
Vue.prototype.$lamboJsBridge = new LamboJsBridge({});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default LamboJsBridge;
|