wl-design-mobile 0.4.1 → 0.4.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wl-design-mobile",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "finch",
@@ -13,6 +13,7 @@
13
13
  :rowMultiSelectWithClick="isMultiSelect"
14
14
  :suppressCellSelection="isMultiSelect"
15
15
  class="ag-grid-tb"
16
+ :overlay-no-rows-template="overlayNoRowsTemplate"
16
17
  ></ag-grid-vue>
17
18
  </div>
18
19
  <van-pagination
@@ -89,7 +90,8 @@ export default {
89
90
  offset: 0,
90
91
  limit: 10,
91
92
  total: 0,
92
- gridApi: null
93
+ gridApi: null,
94
+ overlayNoRowsTemplate:'<span>没有可显示的数据</span>',
93
95
  }
94
96
  },
95
97
  methods: {
package/util/jssdk.js CHANGED
@@ -82,21 +82,26 @@ function configWx(){
82
82
  })
83
83
  }
84
84
 
85
- async function getConfigSignature(url) {
86
- const resp = await axios.post(config.platformServerContext + '/api/weixin/getJsConfig', {
87
- appType: getAppType(),
88
- appId: appId,
89
- agentId: agentId,
90
- corpId: corpId,
91
- appKey: appKey,
92
- url: url
85
+ function getConfigSignature(url) {
86
+ return new Promise((resolve,reject)=>{
87
+ axios.post(config.platformServerContext + '/api/weixin/getJsConfig', {
88
+ appType: getAppType(),
89
+ appId: appId,
90
+ agentId: agentId,
91
+ corpId: corpId,
92
+ appKey: appKey,
93
+ url: url.split('#')[0]
94
+ }).then(resp=>{
95
+ console.log('getConfigSignature',resp)
96
+ let timestamp = resp.data.timestamp
97
+ let nonceStr = resp.data.noncestr
98
+ let signature = resp.data.signature
99
+ resolve({ timestamp, nonceStr, signature })
100
+ }).catch((error)=>{
101
+ console.log(error)
102
+ reject(error)
103
+ })
93
104
  })
94
-
95
- let timestamp = resp.data.timestamp
96
- let nonceStr = resp.data.noncestr
97
- let signature = resp.data.signature
98
-
99
- return { timestamp, nonceStr, signature }
100
105
  }
101
106
 
102
107
  function configWw(){
@@ -107,7 +112,7 @@ function configWw(){
107
112
  getConfigSignature, // 必填,根据url生成企业签名的回调函数
108
113
  onConfigSuccess:(res) => {
109
114
  console.log('企业微信初始化js-sdk成功');
110
- console.log(res.checkResult)
115
+ console.log(res)
111
116
  resolve()
112
117
  },
113
118
  onConfigFail:(res) =>{
@@ -168,22 +173,6 @@ let JsSDK = (function () {
168
173
  },
169
174
  complete: () => {},
170
175
  });
171
- }else if(getAppType() === '20'){
172
- configWw().then(()=>{
173
- ww.scanQRCode({
174
- needResult: true,
175
- scanType: ['qrCode', 'barCode']
176
- }). then(resp =>{
177
- console.log("微信扫码结果:", resp)
178
- if(resp.resultStr){
179
- resolve(resp.resultStr)
180
- }else{
181
- reject("企业微信扫码失败!"+resp.errMsg)
182
- }
183
- })
184
- }).catch((error)=>{
185
- reject('企业微信扫码失败:'+error)
186
- })
187
176
  }else{
188
177
  configWx().then(()=>{
189
178
  wx.scanQRCode({
@@ -210,6 +199,74 @@ let JsSDK = (function () {
210
199
  }
211
200
  })
212
201
  }
202
+ function takePhoto(){
203
+ return new Promise((resolve, reject) =>{
204
+ if(getAppType() === '30'){
205
+ reject('钉钉不支持此方式拍照')
206
+ }else{
207
+ configWx().then(()=>{
208
+ wx.chooseImage({
209
+ count: 1, // 默认9
210
+ sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
211
+ sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
212
+ success: function (res) {
213
+ let localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
214
+ let localId = localIds[0];
215
+ setTimeout(() => {
216
+ wx.uploadImage({
217
+ localId: localId, // 需要上传的图片的本地ID,由chooseImage接口获得
218
+ isShowProgressTips: 0, // 默认为1,显示进度提示
219
+ success: function (res) {
220
+ let serverId = res.serverId; // 返回图片的服务器端ID
221
+ resolve(serverId)
222
+ }
223
+ })
224
+ }, 200);
225
+ },
226
+ cancel:function (){
227
+ reject('拍照取消')
228
+ }
229
+ })
230
+ }).catch((error)=>{
231
+ reject('微信拍照失败:'+error)
232
+ })
233
+ }
234
+ })
235
+ }
236
+ function choosePhoto(){
237
+ return new Promise((resolve, reject) =>{
238
+ if(getAppType() === '30'){
239
+ reject('钉钉不支持此方式选择照片')
240
+ }else{
241
+ configWx().then(()=>{
242
+ wx.chooseImage({
243
+ count: 1, // 默认9
244
+ sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
245
+ sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
246
+ success: function (res) {
247
+ let localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
248
+ let localId = localIds[0];
249
+ setTimeout(() => {
250
+ wx.uploadImage({
251
+ localId: localId, // 需要上传的图片的本地ID,由chooseImage接口获得
252
+ isShowProgressTips: 0, // 默认为1,显示进度提示
253
+ success: function (res) {
254
+ let serverId = res.serverId; // 返回图片的服务器端ID
255
+ resolve(serverId)
256
+ }
257
+ })
258
+ }, 200);
259
+ },
260
+ cancel:function (){
261
+ reject('取消选择照片')
262
+ }
263
+ })
264
+ }).catch((error)=>{
265
+ reject('微信选择照片失败:'+error)
266
+ })
267
+ }
268
+ })
269
+ }
213
270
  function getLocation(){
214
271
  return new Promise((resolve, reject)=>{
215
272
  if(getAppType() === '30'){
@@ -234,22 +291,6 @@ let JsSDK = (function () {
234
291
  }).catch((error)=>{
235
292
  reject('钉钉获取位置失败:'+error)
236
293
  })
237
- }else if(getAppType() === '20'){
238
- configWw().then(()=>{
239
- ww.getLocation({
240
- type: 'gcj02'
241
- }).then((resp) => {
242
- console.log(resp);
243
- if(resp.longitude){
244
- resolve(resp)
245
- }else{
246
- reject("企业微信获取位置失败" + JSON.stringify(resp))
247
- }
248
- })
249
- }).catch((error)=>{
250
- reject('企业微信获取位置失败:'+error)
251
- })
252
-
253
294
  }else{
254
295
  configWx().then(()=>{
255
296
  wx.getLocation({
@@ -293,21 +334,6 @@ let JsSDK = (function () {
293
334
  }).catch((error)=>{
294
335
  reject('钉钉启动内置地图位置失败:'+error)
295
336
  })
296
- }else if(getAppType() === '20'){
297
- configWw().then(()=>{
298
- ww.openLocation({
299
- latitude: latitude,//目的地latitude
300
- longitude: longitude,//目的地longitude
301
- name: name,
302
- address: address,
303
- scale: scale//地图缩放大小,可根据情况具体调整
304
- }).then((resp)=>{
305
- console.log(resp)
306
- resolve()
307
- })
308
- }).catch((error)=>{
309
- reject('企业微信启动内置地图失败:'+error)
310
- })
311
337
  }else{
312
338
  configWx().then(()=>{
313
339
  wx.openLocation({
@@ -355,7 +381,7 @@ let JsSDK = (function () {
355
381
  type: 'gcj02',
356
382
  success:()=>{
357
383
  ww.onLocationChange(function(event) {
358
- console.log(event)
384
+ console.log('onLocationChange',event)
359
385
  resolve({longitude:event.longitude,latitude:event.latitude})
360
386
  })
361
387
  },
@@ -363,7 +389,7 @@ let JsSDK = (function () {
363
389
  reject()
364
390
  }
365
391
  }).then(resp => {
366
- console.log(resp)
392
+ console.log('企业微信开启连续定位',resp)
367
393
  })
368
394
  }).catch((error)=>{
369
395
  reject('企业微信开启连续定位失败:'+error)
@@ -412,6 +438,8 @@ let JsSDK = (function () {
412
438
  // 公开API
413
439
  return {
414
440
  init:init,
441
+ takePhoto:takePhoto,
442
+ choosePhoto:choosePhoto,
415
443
  scanQRCode: scanQRCode,
416
444
  getLocation:getLocation,
417
445
  openLocation:openLocation,