wl-design-mobile 0.4.5 → 0.4.6
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/package.json +1 -1
- package/util/jssdk.js +26 -18
package/package.json
CHANGED
package/util/jssdk.js
CHANGED
|
@@ -222,7 +222,7 @@ let JsSDK = (function () {
|
|
|
222
222
|
}else{
|
|
223
223
|
configWx().then(()=>{
|
|
224
224
|
wx.chooseImage({
|
|
225
|
-
count: 1, // 默认
|
|
225
|
+
count: 1, // 默认1
|
|
226
226
|
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
227
227
|
sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|
228
228
|
success: function (res) {
|
|
@@ -231,19 +231,20 @@ let JsSDK = (function () {
|
|
|
231
231
|
setTimeout(() => {
|
|
232
232
|
wx.uploadImage({
|
|
233
233
|
localId: localId, // 需要上传的图片的本地ID,由chooseImage接口获得
|
|
234
|
-
isShowProgressTips:
|
|
234
|
+
isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
235
235
|
success: function (res) {
|
|
236
236
|
let serverId = res.serverId; // 返回图片的服务器端ID
|
|
237
237
|
resolve({
|
|
238
238
|
appId:sessionStorage.getItem('JsSdk_appId'),
|
|
239
239
|
agentId:sessionStorage.getItem('JsSdk_agentId'),
|
|
240
|
-
serverId:serverId
|
|
240
|
+
serverId:serverId
|
|
241
|
+
})
|
|
241
242
|
}
|
|
242
243
|
})
|
|
243
244
|
}, 200);
|
|
244
245
|
},
|
|
245
246
|
cancel:function (){
|
|
246
|
-
reject('
|
|
247
|
+
reject('取消拍照')
|
|
247
248
|
}
|
|
248
249
|
})
|
|
249
250
|
}).catch((error)=>{
|
|
@@ -252,30 +253,37 @@ let JsSDK = (function () {
|
|
|
252
253
|
}
|
|
253
254
|
})
|
|
254
255
|
}
|
|
255
|
-
function choosePhoto(){
|
|
256
|
+
function choosePhoto({count = 1} = {}){
|
|
256
257
|
return new Promise((resolve, reject) =>{
|
|
257
258
|
if(getAppType() === '30'){
|
|
258
259
|
reject('钉钉不支持此方式选择照片')
|
|
259
260
|
}else{
|
|
260
261
|
configWx().then(()=>{
|
|
261
262
|
wx.chooseImage({
|
|
262
|
-
count:
|
|
263
|
+
count: count, // 默认1
|
|
263
264
|
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
264
|
-
sourceType: ['album'
|
|
265
|
+
sourceType: ['album'], // 可以指定来源是相册还是相机,默认二者都有
|
|
265
266
|
success: function (res) {
|
|
266
267
|
let localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
|
|
267
|
-
let localId = localIds[0];
|
|
268
|
+
// let localId = localIds[0];
|
|
268
269
|
setTimeout(() => {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
270
|
+
let serverIds = []
|
|
271
|
+
localIds.forEach((localId) =>{
|
|
272
|
+
wx.uploadImage({
|
|
273
|
+
localId: localId, // 需要上传的图片的本地ID,由chooseImage接口获得
|
|
274
|
+
isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
275
|
+
success: function (res) {
|
|
276
|
+
let serverId = res.serverId; // 返回图片的服务器端ID
|
|
277
|
+
serverIds.push(serverId)
|
|
278
|
+
}
|
|
279
|
+
})
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
resolve({
|
|
283
|
+
appId:sessionStorage.getItem('JsSdk_appId'),
|
|
284
|
+
agentId:sessionStorage.getItem('JsSdk_agentId'),
|
|
285
|
+
serverId:serverIds[0],
|
|
286
|
+
serverIds:serverIds
|
|
279
287
|
})
|
|
280
288
|
}, 200);
|
|
281
289
|
},
|