@lambo-design-mobile/lambo-js-bridge 1.0.0-beta.12 → 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/CHANGELOG.md +12 -3
- package/demo/index.vue +2 -0
- package/package.json +1 -1
- package/src/sdk/WeComAdapter.js +14 -9
- package/src/sdk/YunTuAdapter.js +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
-
## [1.0.0-beta.
|
|
3
|
-
|
|
4
|
-
## [1.0.0-beta.11](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.10...@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.11) (2024-10-14)
|
|
2
|
+
## [1.0.0-beta.14](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.13...@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.14) (2024-10-29)
|
|
5
3
|
|
|
4
|
+
## [1.0.0-beta.13](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.12...@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.13) (2024-10-28)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### ✨ Features | 新功能
|
|
8
|
+
|
|
9
|
+
* **@lambo-design-mobile/js-bridge:** 优化企业微信参数 ([2c333ef](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/2c333ef1f546769611ae302a221848704b95b1a4))
|
|
10
|
+
|
|
11
|
+
## [1.0.0-beta.12](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.11...@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.12) (2024-10-17)
|
|
12
|
+
|
|
13
|
+
## [1.0.0-beta.11](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.10...@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.11) (2024-10-14)
|
|
14
|
+
|
|
6
15
|
## 1.0.0-beta.10 (2024-09-12)
|
|
7
16
|
|
|
8
17
|
|
package/demo/index.vue
CHANGED
|
@@ -56,6 +56,7 @@ export default {
|
|
|
56
56
|
address:'这里是详细位置address',
|
|
57
57
|
wechatId: 'wx92fab9d3885b0298',
|
|
58
58
|
weComId: 'wx0eb3ba9d89eca3cb',
|
|
59
|
+
agentId:'1000065',
|
|
59
60
|
dingTalkId: '',
|
|
60
61
|
photoPreviews: []
|
|
61
62
|
};
|
|
@@ -82,6 +83,7 @@ export default {
|
|
|
82
83
|
// 初始化参数,根据需要填写
|
|
83
84
|
wechatId:this.wechatId,
|
|
84
85
|
weComId:this.weComId,
|
|
86
|
+
agentId:this.agentId,
|
|
85
87
|
dingTalkId:this.dingTalkId,
|
|
86
88
|
};
|
|
87
89
|
this.$lamboJsBridge = new LamboJsBridge(options);
|
package/package.json
CHANGED
package/src/sdk/WeComAdapter.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable no-undef */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1
3
|
// import * as ww from '@wecom/jssdk'
|
|
2
4
|
import ajax from "@lambo-design-mobile/shared/utils/ajax";
|
|
3
5
|
import config from "@lambo-design-mobile/shared/config/config";
|
|
@@ -39,7 +41,7 @@ class WeComAdapter {
|
|
|
39
41
|
async init(options) {
|
|
40
42
|
const currentUrl = encodeURIComponent(window.location.href.split('#')[0]);
|
|
41
43
|
ajax.request({
|
|
42
|
-
url: config.upmsServerContext + '/manage/ibpWxCpBaseinfo/gtJsTicket?corpId='+options.weComId+"&url="+currentUrl,
|
|
44
|
+
url: config.upmsServerContext + '/manage/ibpWxCpBaseinfo/gtJsTicket?corpId='+options.weComId+"&agentId="+options.agentId+"&url="+currentUrl,
|
|
43
45
|
method: 'get'
|
|
44
46
|
}).then((resp) => {
|
|
45
47
|
if(resp.data.code===1){
|
|
@@ -52,11 +54,11 @@ class WeComAdapter {
|
|
|
52
54
|
timestamp: data.timestamp, // 必填,生成签名的时间戳
|
|
53
55
|
nonceStr: data.noncestr, // 必填,生成签名的随机串
|
|
54
56
|
signature: data.signature,// 必填,签名,见附录-JS-SDK使用权限签名算法
|
|
55
|
-
jsApiList: ['getLocation','scanQRCode','chooseImage','openLocation','getLocalImgData'],
|
|
56
|
-
success
|
|
57
|
+
jsApiList: ['getLocation','scanQRCode','chooseImage','openLocation','getLocalImgData'], // 必填,传入需要使用的接口名称
|
|
58
|
+
success(res) {
|
|
57
59
|
console.log("ready...")
|
|
58
60
|
},
|
|
59
|
-
fail
|
|
61
|
+
fail(res) {
|
|
60
62
|
if(res.errMsg.indexOf('function not exist') > -1){
|
|
61
63
|
alert('版本过低请升级')
|
|
62
64
|
}
|
|
@@ -72,7 +74,7 @@ class WeComAdapter {
|
|
|
72
74
|
});
|
|
73
75
|
wx.checkJsApi({
|
|
74
76
|
jsApiList: ['getLocation','scanQRCode','chooseImage','openLocation'], // 需要检测的JS接口列表
|
|
75
|
-
success
|
|
77
|
+
success(res) {
|
|
76
78
|
// 以键值对的形式返回,可用的api值true,不可用为false
|
|
77
79
|
// 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
|
|
78
80
|
}
|
|
@@ -99,7 +101,7 @@ class WeComAdapter {
|
|
|
99
101
|
return new Promise((resolve, reject) => {
|
|
100
102
|
wx.getLocation({
|
|
101
103
|
...options,
|
|
102
|
-
type
|
|
104
|
+
type,
|
|
103
105
|
success: location => {
|
|
104
106
|
const unifiedLocation = {
|
|
105
107
|
latitude: location.latitude || location.lat || null, // 统一纬度属性
|
|
@@ -260,8 +262,11 @@ class WeComAdapter {
|
|
|
260
262
|
}
|
|
261
263
|
|
|
262
264
|
dataURLtoFile(dataurl, filename) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
+
const arr = dataurl.split(',');
|
|
266
|
+
const mime = arr[0].match(/:(.*?);/)[1];
|
|
267
|
+
const bstr = atob(arr[1]);
|
|
268
|
+
let n = bstr.length;
|
|
269
|
+
const u8arr = new Uint8Array(n);
|
|
265
270
|
while (n--) {
|
|
266
271
|
u8arr[n] = bstr.charCodeAt(n);
|
|
267
272
|
}
|
|
@@ -270,7 +275,7 @@ class WeComAdapter {
|
|
|
270
275
|
|
|
271
276
|
uploadToOSS(file, options) {
|
|
272
277
|
return new Promise((resolve, reject) => {
|
|
273
|
-
|
|
278
|
+
const formData = new FormData();
|
|
274
279
|
formData.append('file', file);
|
|
275
280
|
ajax.post(options.ossServerContext + options.ossImgPutUrl, formData, { payload : true }).then(response => {
|
|
276
281
|
if (response.data.code === 1) {
|
package/src/sdk/YunTuAdapter.js
CHANGED
|
@@ -38,8 +38,8 @@ class YunTuAdapter {
|
|
|
38
38
|
|
|
39
39
|
return new Promise((resolve, reject) => {
|
|
40
40
|
|
|
41
|
-
if (window.geolocation && typeof window.geolocation.getCurrentPosition === 'function') {
|
|
42
|
-
window.geolocation.getCurrentPosition(
|
|
41
|
+
if (window.top.geolocation && typeof window.top.geolocation.getCurrentPosition === 'function') {
|
|
42
|
+
window.top.geolocation.getCurrentPosition(
|
|
43
43
|
(res) => {
|
|
44
44
|
console.log('YunTu: Location obtained', JSON.stringify(res));
|
|
45
45
|
resolve(res); // 成功获取位置
|
|
@@ -64,9 +64,9 @@ class YunTuAdapter {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
return new Promise((resolve, reject) => {
|
|
67
|
-
if (window.geolocation && typeof window.geolocation.openLocation === 'function') {
|
|
67
|
+
if (window.top.geolocation && typeof window.top.geolocation.openLocation === 'function') {
|
|
68
68
|
console.log("1")
|
|
69
|
-
window.geolocation.openLocation(
|
|
69
|
+
window.top.geolocation.openLocation(
|
|
70
70
|
(res) => {
|
|
71
71
|
console.log('YunTu: Open location success', res);
|
|
72
72
|
resolve(res); // 成功打开地图
|
|
@@ -95,8 +95,8 @@ class YunTuAdapter {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
return new Promise((resolve, reject) => {
|
|
98
|
-
if (window.scanCode && typeof window.scanCode.startScan === 'function') {
|
|
99
|
-
window.scanCode.startScan(
|
|
98
|
+
if (window.top.scanCode && typeof window.top.scanCode.startScan === 'function') {
|
|
99
|
+
window.top.scanCode.startScan(
|
|
100
100
|
(res) => {
|
|
101
101
|
console.log('YunTu: Scan code success', res);
|
|
102
102
|
resolve(res); // 成功获取扫码结果
|
|
@@ -121,8 +121,8 @@ class YunTuAdapter {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
return new Promise((resolve, reject) => {
|
|
124
|
-
if (window.localAuthPlugin && typeof window.localAuthPlugin.auth === 'function') {
|
|
125
|
-
window.localAuthPlugin.auth(
|
|
124
|
+
if (window.top.localAuthPlugin && typeof window.top.localAuthPlugin.auth === 'function') {
|
|
125
|
+
window.top.localAuthPlugin.auth(
|
|
126
126
|
(res) => {
|
|
127
127
|
console.log('YunTu: local auth success', res);
|
|
128
128
|
resolve(res); // 成功获取认证结果
|
|
@@ -147,8 +147,8 @@ class YunTuAdapter {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
return new Promise((resolve, reject) => {
|
|
150
|
-
if (window.localAuthPlugin && typeof window.localAuthPlugin.getAvailableBiometrics === 'function') {
|
|
151
|
-
window.localAuthPlugin.getAvailableBiometrics(
|
|
150
|
+
if (window.top.localAuthPlugin && typeof window.top.localAuthPlugin.getAvailableBiometrics === 'function') {
|
|
151
|
+
window.top.localAuthPlugin.getAvailableBiometrics(
|
|
152
152
|
(res) => {
|
|
153
153
|
console.log('YunTu: Get Available Biometrics', res);
|
|
154
154
|
resolve(res); // 成功获取生物认证列表
|
|
@@ -176,9 +176,9 @@ class YunTuAdapter {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
return new Promise((resolve, reject) => {
|
|
179
|
-
if (window.imagePicker) {
|
|
179
|
+
if (window.top.imagePicker) {
|
|
180
180
|
const sourceType = options && options.sourceType === 'gallery' ? 'gallery' : 'camera';
|
|
181
|
-
const pickerFunction = window.imagePicker[sourceType];
|
|
181
|
+
const pickerFunction = window.top.imagePicker[sourceType];
|
|
182
182
|
|
|
183
183
|
if (typeof pickerFunction === 'function') {
|
|
184
184
|
pickerFunction(
|
|
@@ -213,8 +213,8 @@ class YunTuAdapter {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
return new Promise((resolve, reject) => {
|
|
216
|
-
if (window.filePreview && typeof window.filePreview.openFile === 'function') {
|
|
217
|
-
window.filePreview.openFile(
|
|
216
|
+
if (window.top.filePreview && typeof window.top.filePreview.openFile === 'function') {
|
|
217
|
+
window.top.filePreview.openFile(
|
|
218
218
|
(res) => {
|
|
219
219
|
console.log('YunTu: File preview success', res);
|
|
220
220
|
resolve(res); // Successfully previewed the file
|