@lambo-design-mobile/lambo-js-bridge 1.0.0-beta.2 → 1.0.0-beta.21
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 +221 -0
- package/README.md +318 -238
- package/demo/index.vue +261 -223
- package/index.js +3 -3
- package/package.json +4 -2
- package/src/sdk/BdMapUtils.js +74 -0
- 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 +90 -73
- package/src/sdk/MobileIMAdaoter.js +67 -0
- package/src/sdk/WeComAdapter.js +367 -301
- package/src/sdk/WechatAdapter.js +69 -34
- package/src/sdk/YunTuAdapter.js +224 -163
- package/src/sdk/yuntu.js +55 -0
- package/yuntu.js +0 -42
package/README.md
CHANGED
|
@@ -1,238 +1,318 @@
|
|
|
1
|
-
# LamboJsBridge 示例
|
|
2
|
-
|
|
3
|
-
### 介绍
|
|
4
|
-
|
|
5
|
-
LamboJsBridge 是一个js 适配sdk 用于处理H5应用和运行时环境的能力调用。支持微信、钉钉等环境。目前已适配微信(WechatAdapter)和企业微信(WeComAdapter)
|
|
6
|
-
|
|
7
|
-
###
|
|
8
|
-
|
|
9
|
-
``` javascript
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
console.
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
|
91
|
-
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
|
177
|
-
|
|
178
|
-
|
|
|
179
|
-
|
|
|
180
|
-
|
|
|
181
|
-
|
|
|
182
|
-
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
1
|
+
# LamboJsBridge 示例
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
LamboJsBridge 是一个js 适配sdk 用于处理H5应用和运行时环境的能力调用。支持微信、钉钉等环境。目前已适配微信(WechatAdapter)和企业微信(WeComAdapter)
|
|
6
|
+
|
|
7
|
+
### Vue 全局引入
|
|
8
|
+
|
|
9
|
+
``` javascript
|
|
10
|
+
/**
|
|
11
|
+
* Vue main.js 中加入如下代码
|
|
12
|
+
*/
|
|
13
|
+
console.log("------ 初始化 LamboJsBridge -------")
|
|
14
|
+
import LamboJsBridge from "@lambo-design-mobile/lambo-js-bridge";
|
|
15
|
+
Vue.use(LamboJsBridge);
|
|
16
|
+
```
|
|
17
|
+
### 调用
|
|
18
|
+
|
|
19
|
+
``` javascript
|
|
20
|
+
// 直接调用扫码功能
|
|
21
|
+
// Vue方法中
|
|
22
|
+
this.$lamboJsBridge.scanCode()
|
|
23
|
+
|
|
24
|
+
//其他Js界面
|
|
25
|
+
Vue.prototype.$lamboJsBridge.scanCode();
|
|
26
|
+
/**
|
|
27
|
+
* 也可以自己封装一层工具类
|
|
28
|
+
* 扫描二维码并返回结果。(需要在APP环境下测试)
|
|
29
|
+
* 此函数通过调用 Flutter scanCode.startScan 方法来启动二维码扫描。
|
|
30
|
+
* 扫描成功后返回扫描结果,若扫描失败则返回错误信息。
|
|
31
|
+
*
|
|
32
|
+
* @returns {Promise<String>} - 返回一个 Promise,当扫描成功时 resolve,返回扫描的结果字符串;如果失败,reject 返回错误信息。
|
|
33
|
+
* @example
|
|
34
|
+
* flutterUtil.scanCode()
|
|
35
|
+
* .then(result => {
|
|
36
|
+
* console.log('扫描结果:', result.msg);
|
|
37
|
+
* })
|
|
38
|
+
* .catch(error => {
|
|
39
|
+
* console.error('扫描失败:', error.msg);
|
|
40
|
+
* });
|
|
41
|
+
*/
|
|
42
|
+
flutterUtil.scanCode = function() {
|
|
43
|
+
return Vue.prototype.$lamboJsBridge.scanCode();
|
|
44
|
+
};
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### 引入
|
|
49
|
+
|
|
50
|
+
``` javascript
|
|
51
|
+
import Vue from 'vue';
|
|
52
|
+
import LamboJsBridge from '@lambo-design-mobile/lambo-js-bridge';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 代码演示
|
|
56
|
+
|
|
57
|
+
### 初始化
|
|
58
|
+
|
|
59
|
+
``` javascript
|
|
60
|
+
async created() {
|
|
61
|
+
const options = {
|
|
62
|
+
// 初始化参数,根据需要填写
|
|
63
|
+
wechatId:this.wechatId,
|
|
64
|
+
weComId:this.weComId,
|
|
65
|
+
dingTalkId:this.dingTalkId,
|
|
66
|
+
pluginConfig:["localAuthPlugin","amapPlugin","tabBarPlugin","scanCodePlugin","filePreviewPlugin"],
|
|
67
|
+
|
|
68
|
+
};
|
|
69
|
+
this.$lamboJsBridge = new LamboJsBridge(options);
|
|
70
|
+
await this.getPlatform();
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
methods: {
|
|
74
|
+
async getPlatform() {
|
|
75
|
+
try {
|
|
76
|
+
const info = await this.$lamboJsBridge.getPlatform(); // 获取初始化信息
|
|
77
|
+
this.initInfo = JSON.stringify(info, null, 2); // 美化输出
|
|
78
|
+
console.log('Init Info:', info);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error('Error getting init info:', error);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 参数说明
|
|
87
|
+
|
|
88
|
+
`params`: Object
|
|
89
|
+
|
|
90
|
+
| 属性 | 类型 | 默认值 | 必填 | 支持平台 | 说明 |
|
|
91
|
+
|------------|--------|--------|------|----------|------------|
|
|
92
|
+
| wechatId | string | | 是 | 微信 | 微信公众号appId |
|
|
93
|
+
| weComId | string | | 是 | 企业微信 | 企业微信corpId |
|
|
94
|
+
| dingTalkId | string | | 是 | 钉钉 | 钉钉id |
|
|
95
|
+
|
|
96
|
+
### 返回说明
|
|
97
|
+
|
|
98
|
+
`params`: Object
|
|
99
|
+
|
|
100
|
+
| 属性 | 类型 | 默认值 | 必填 | 支持平台 | 说明 |
|
|
101
|
+
|----------|--------|--------|------|----------|---------|
|
|
102
|
+
| appId | string | | 是 | 微信、企业微信、钉钉 | 对应平台的id |
|
|
103
|
+
| platform | string | | 是 | 微信、企业微信、钉钉 | 当前浏览器平台 |
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### 高德地图初始化key(initKey)
|
|
107
|
+
|
|
108
|
+
获取用户当前的地理位置信息。
|
|
109
|
+
``` javascript
|
|
110
|
+
async initKey() {
|
|
111
|
+
try {
|
|
112
|
+
const options ={
|
|
113
|
+
androidKey:"41c4c1f35d8d14f5bf1907c173924147",
|
|
114
|
+
iosKey:"465abf5da8c8d62e3caa63952a0957a5"
|
|
115
|
+
};
|
|
116
|
+
const reslut = await this.$lamboJsBridge.initKey(options);
|
|
117
|
+
this.initKeyMessage = `initKey result: ${result}`;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error('Error initKey:', error);
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
```
|
|
123
|
+
### 参数说明
|
|
124
|
+
|
|
125
|
+
`params`: Object
|
|
126
|
+
|
|
127
|
+
| 属性 | 类型 | 默认值 | 必填 | 支持平台 | 说明 |
|
|
128
|
+
|------------------|----------|--------|------|-------|-----------------------------------------------------------------------------------------------|
|
|
129
|
+
| androidKey | string | | 否 | yuntu | 前往高德开放平台创建key https://console.amap.com/dev/key/app |
|
|
130
|
+
| iosKey | string | | 否 | yuntu | 前往高德开放平台创建key https://console.amap.com/dev/key/app |
|
|
131
|
+
|
|
132
|
+
### 返回说明
|
|
133
|
+
|
|
134
|
+
``
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
### 获取地理位置接口(getLocation)
|
|
140
|
+
|
|
141
|
+
获取用户当前的地理位置信息。
|
|
142
|
+
``` javascript
|
|
143
|
+
async getLocation() {
|
|
144
|
+
try {
|
|
145
|
+
const options ={
|
|
146
|
+
// 初始化参数,根据需要填写
|
|
147
|
+
};
|
|
148
|
+
const location = await this.$lamboJsBridge.getLocation(options);
|
|
149
|
+
console.log("location",location)
|
|
150
|
+
this.location += `${JSON.stringify(location)}\n`; // 追加新数据
|
|
151
|
+
this.latitude = location.latitude; // 存储纬度
|
|
152
|
+
this.longitude = location.longitude; // 存储经度
|
|
153
|
+
console.log('Location:', location);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
console.error('Error getting location:', error);
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
```
|
|
159
|
+
### 参数说明
|
|
160
|
+
|
|
161
|
+
`params`: Object
|
|
162
|
+
|
|
163
|
+
| 属性 | 类型 | 默认值 | 必填 | 支持平台 | 说明 |
|
|
164
|
+
|------------------|----------|--------|------|-------|-----------------------------------------------------------------------------------------------|
|
|
165
|
+
| type | string | gcj02 | 否 | 微信、企业微信、钉钉 | 默认为gcj02的gps坐标,如果要使用标准坐标则传入wgs84 |
|
|
166
|
+
| targetAccuracy | string | | 否 | 钉钉 | 期望定位精度半径(单位米),定位结果尽量满足该参数要求,但是不一定能保证小于该误差,开发者需要读取返回结果的 accuracy 字段校验坐标精度。建议按照业务需求设置定位精度,推荐采用200m,可获得较好的精度和较短的响应时长。 |
|
|
167
|
+
| cacheTimeout | number | 30 | 否 | 钉钉 | 缓存过期时间,单位为秒。未过期的缓存数据会直接返回(速度快),缓存过期会重新定位(速度慢)。 |
|
|
168
|
+
| useCache | boolean | true | 否 | 钉钉 | 是否缓存地理位置信息。若为true,客户端会对定位的地理位置信息缓存,在缓存期内 (2分钟) 再次定位会返回旧的定位。 |
|
|
169
|
+
| withReGeocode | boolean | true | 否 | 钉钉 | 是否需要带有逆地理编码信息。该功能需要网络请求,请根据自己的业务场景使用。 |
|
|
170
|
+
| formattedAdress | number | 1 | 否 | 钉钉 | 获取经纬度和详细到区县级别的逆地理编码数据 |
|
|
171
|
+
|
|
172
|
+
### 返回说明
|
|
173
|
+
|
|
174
|
+
`Promise<Object>`
|
|
175
|
+
|
|
176
|
+
| 属性 | 类型 | 默认值 | 必填 | 支持平台 | 说明 |
|
|
177
|
+
|------------|--------|--------|------|----------|------------------------|
|
|
178
|
+
| latitude | number | | 是 | 微信、企业微信、钉钉 | 纬度,浮点数,范围为 90 ~ -90 |
|
|
179
|
+
| longitude | number | | 是 | 微信、企业微信、钉钉 | 经度,浮点数,范围为 180 ~ -180 |
|
|
180
|
+
| accuracy | number | | 是 | 微信、企业微信、钉钉 | 位置精度 |
|
|
181
|
+
| address | string | | 否 | 钉钉 | 格式化地址,type>0生效。 |
|
|
182
|
+
| province | string | | 否 | 钉钉 | 省份,type>0生效。 |
|
|
183
|
+
| city | string | | 否 | 钉钉 | 城市,type>0生效。 |
|
|
184
|
+
|
|
185
|
+
### 调起扫一扫接口(scanCode)
|
|
186
|
+
|
|
187
|
+
调用扫一扫功能。
|
|
188
|
+
|
|
189
|
+
``` javascript
|
|
190
|
+
async scanCode() {
|
|
191
|
+
try {
|
|
192
|
+
const options ={
|
|
193
|
+
// 初始化参数,根据需要填写
|
|
194
|
+
};
|
|
195
|
+
const result = await this.$lamboJsBridge.scanCode(options);
|
|
196
|
+
this.scanResult += `${JSON.stringify(result)}\n`; // 追加新数据
|
|
197
|
+
console.log('Scan result:', result);
|
|
198
|
+
} catch (error) {
|
|
199
|
+
console.error('Error scanning code:', error);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### 参数说明
|
|
205
|
+
|
|
206
|
+
`params`: Object
|
|
207
|
+
|
|
208
|
+
| 属性 | 类型 | 默认值 | 必填 | 支持平台 | 说明 |
|
|
209
|
+
|-----------|----------|--------|------|----------|----------------------------------------------------------------------------------------------|
|
|
210
|
+
| scanType | string[] | qr | 否 | 微信、企业微信、钉钉 | 扫码样式。qr:二维码扫码框,bar:条形码扫码框 |
|
|
211
|
+
| needResult| boolean | true | 否 | 微信、企业微信 | 扫描结果是否由微信或企业微信处理。为 false 时直接返回扫描结果 |
|
|
212
|
+
|
|
213
|
+
### 返回说明
|
|
214
|
+
|
|
215
|
+
`Promise<Object>`
|
|
216
|
+
|
|
217
|
+
| 属性 | 类型 | 默认值 | 必填 | 支持平台 | 说明 |
|
|
218
|
+
|------------|--------|--------|------|----------|-------------|
|
|
219
|
+
| resultStr | string | | 否 | 微信、企业微信、钉钉 | 扫码结果 |
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
### 拍照或从手机相册中选图接口(takePhoto)
|
|
223
|
+
|
|
224
|
+
拍照或从本地相册选择图片。
|
|
225
|
+
``` javascript
|
|
226
|
+
async takePhoto() {
|
|
227
|
+
try {
|
|
228
|
+
const options = {
|
|
229
|
+
//初始化参数,根据需要填写、修改
|
|
230
|
+
outputType: ['oss','info','data'], // 根据需要包含 'info', 'data', 'oss'
|
|
231
|
+
ossServerContext: this.ossServerContext,
|
|
232
|
+
ossImgPutUrl: this.ossImgPutUrl,
|
|
233
|
+
ossImgGetUrl: this.ossImgGetUrl
|
|
234
|
+
};
|
|
235
|
+
const photo = await this.$lamboJsBridge.takePhoto(options);
|
|
236
|
+
this.photoResult += `${JSON.stringify(photo)}\n`; // 追加新数据
|
|
237
|
+
console.log('Photo result:', photo);
|
|
238
|
+
} catch (error) {
|
|
239
|
+
console.error('Error taking photo:', error);
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
### 参数说明
|
|
246
|
+
|
|
247
|
+
`params`: Object
|
|
248
|
+
|
|
249
|
+
| 属性 | 类型 | 默认值 | 必填 | 支持平台 | 说明 |
|
|
250
|
+
|-------------------|---------|-------------------------|-----|----------|------------------------------------------------------------------|
|
|
251
|
+
| count | number | 1 | 否 | 微信、企业微信、钉钉 | 选择图片数量 |
|
|
252
|
+
| sizeType | string[] | ['camera', 'album'] | 否 | 微信、企业微信、钉钉 | 相册选取或者拍照。album:相册,camera:相机 |
|
|
253
|
+
| outputType | string[] | ['info', 'data', 'oss'] | 否 | 微信、企业微信、钉钉 | 图像输出格式。info 选定图像的本地信息,data 选定图像的base64数据,oss为上传oss-server |
|
|
254
|
+
| method | string | 'file'或'blob' | 否 | 微信、企业微信、钉钉 | 上传oss方法,默认为blob |
|
|
255
|
+
| defaultCameraMode | string | | 否 | 企业微信 | 进入拍照界面的默认模式。normal 单拍,batch 连拍,front 前置摄像头单拍,batch_front 前置摄像头连拍 |
|
|
256
|
+
| isSaveToAlbum | boolean | true | 否 | 企业微信 | 拍照时是否保存到系统相册 |
|
|
257
|
+
| position | string | back | 否 | 钉钉 | 相机拍照使用的摄像头:front:前置摄像头,back:后置摄像头 |
|
|
258
|
+
| ossServerContext | string | | 是 | 微信、企业微信、钉钉 | 上传oss-server服务器地址 |
|
|
259
|
+
| ossImgPutUrl | string | | 是 | 微信、企业微信、钉钉 | 上传oss-server图片接口地址 |
|
|
260
|
+
| ossImgGetUrl | string | | 是 | 微信、企业微信、钉钉 | 下载oss-server图片接口地址 |
|
|
261
|
+
|
|
262
|
+
### 返回说明
|
|
263
|
+
|
|
264
|
+
`Promise<Array>`
|
|
265
|
+
|
|
266
|
+
| 属性 | 类型 | 默认值 | 必填 | 支持平台 | 说明 |
|
|
267
|
+
|-----------|----------|--------|------|----------|---------------|
|
|
268
|
+
| imageInfo | string[] | | 否 | 微信、企业微信、钉钉 | 选定图像的本地信息 |
|
|
269
|
+
| imageData | string[] | | 否 | 微信、企业微信、钉钉 | 选定图像的base64数据 |
|
|
270
|
+
| imageOss | JSON | | 否 | 微信、企业微信、钉钉 | 选定图像的oss返回数据 |
|
|
271
|
+
|
|
272
|
+
### 使用内置地图查看位置(openLocation)
|
|
273
|
+
|
|
274
|
+
使用内置地图查看位置。
|
|
275
|
+
``` javascript
|
|
276
|
+
async openLocation() {
|
|
277
|
+
try {
|
|
278
|
+
if (this.latitude !== null && this.longitude !== null) {
|
|
279
|
+
const options = {
|
|
280
|
+
//初始化参数,根据需要修改
|
|
281
|
+
latitude: this.latitude,
|
|
282
|
+
longitude: this.longitude,
|
|
283
|
+
name: this.name,
|
|
284
|
+
address: this.address,
|
|
285
|
+
scale: this.scale,
|
|
286
|
+
type:"amap"
|
|
287
|
+
};
|
|
288
|
+
await this.$lamboJsBridge.openLocation(options);
|
|
289
|
+
this.openLocationResult = '位置已成功打开'; // 成功打开位置时存储信息
|
|
290
|
+
console.log('Location opened successfully');
|
|
291
|
+
} else {
|
|
292
|
+
this.openLocationResult = '没有可用的位置信息,请先获取定位。'; // 没有位置信息时存储错误信息
|
|
293
|
+
console.error('No location data available. Please get the location first.');
|
|
294
|
+
}
|
|
295
|
+
} catch (error) {
|
|
296
|
+
this.openLocationResult = `打开位置时出错: ${error.message}`; // 存储错误信息
|
|
297
|
+
console.error('Error opening location:', error);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
### 参数说明
|
|
304
|
+
|
|
305
|
+
`params`: Object
|
|
306
|
+
|
|
307
|
+
| 属性 | 类型 | 默认值 | 必填 | 支持平台 | 说明 |
|
|
308
|
+
|-----------|--|-----|-----|----------|------------------------------------------------------------------|
|
|
309
|
+
| latitude | number | | 是 | 微信、企业微信、钉钉、Yuntu | 纬度,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 |
|
|
310
|
+
| longitude | number | | 是 | 微信、企业微信、钉钉、Yuntu | 经度,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 |
|
|
311
|
+
| name | string | | 钉钉 | 微信、企业微信、钉钉 | 位置名称 |
|
|
312
|
+
| address | string | | 钉钉 | 微信、企业微信、钉钉 | 详细位置 |
|
|
313
|
+
| scale | number | | 否 | 微信、企业微信 | 缩放比例,范围5~18 |
|
|
314
|
+
| type | string | amap | 否 | Yuntu | 'baidu':百度地图,'amap':高德地图,'URLSchema':自定义协议 |
|
|
315
|
+
|
|
316
|
+
### 返回说明
|
|
317
|
+
|
|
318
|
+
无
|