fstarter 2.11.2 → 2.11.4

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,7 +1,7 @@
1
1
  {
2
2
  "name": "fstarter",
3
3
  "description": "A Vue.js project",
4
- "version": "2.11.2",
4
+ "version": "2.11.4",
5
5
  "author": "han.zhang <zhanghan810810@163.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -1,5 +1,6 @@
1
1
  import isp_phone from '../platform/isp_phone'
2
2
  import { EBType, SHELL } from './callNative'
3
+ import nativeUtils from '../plugins/nativeUtils'
3
4
  // import { FilePathPkg } from './filePath'
4
5
  // import { callService } from '../../../assets/libs/service/serviceImpl'
5
6
  // import SC from '../service/requestName'
@@ -15,6 +16,8 @@ import config from './config'
15
16
  export const FileServerPkg = {}
16
17
  export const EventGetFilename = 'getFileName'
17
18
  export const EventGetMessage = 'getMessage'
19
+ export const EventGetPic = 'getPic'
20
+ export const EventGetIdCard = 'getIDcard'
18
21
 
19
22
  // 文件服务器的地址
20
23
  FileServerPkg.baseHost = config.file.baseURL
@@ -71,6 +74,8 @@ function handleShellCall(fileName, actions) {
71
74
  } else {
72
75
  console.log('注意!壳上传没有配置调用【保存服务】的服务;上传类型' + callerType)
73
76
  // 直接发送事件,不调用服务
77
+ FileServerPkg.fnCaller.$emit(EventGetPic, {fileName,actions})
78
+ FileServerPkg.fnCaller.$emit(EventGetIdCard, {fileName,actions})
74
79
  if (fileName) FileServerPkg.fnCaller.$emit(EventGetFilename, fileName)
75
80
  if (actions) FileServerPkg.fnCaller.$emit(EventGetMessage, actions)
76
81
  if (FileServerPkg.callerStateSetFn) FileServerPkg.callerStateSetFn(fileName) // 设置状态值
@@ -295,7 +300,21 @@ FileServerPkg.pictureUploadSaveShow = function(uploadType, eventSender, callerPa
295
300
  const shellParam = setShellParam(shellType, callerParam.shell, callerParam.maxSizeKB)
296
301
  FileServerPkg.callerServiceParamFn = setServiceParamFn(uploadType, callerParam.service, isCallService)
297
302
  FileServerPkg.callerStateSetFn = getStateSetFn(uploadType, callerParam.state)
298
- isp_phone.callShell(TypeShellMapping[shellType], shellParam, null, eventSender)
303
+ nativeUtils.takePicture({
304
+ maxCount: 1, // 最多可选择的图片数量, 默认为9
305
+ maxSize: 500, // 图片大小限制,单位为KB
306
+ sourceType: ['album'], // 可选来源类型,'album' 为相册,'camera' 为相机 默认两者都有
307
+ sceneDesc: '选择图片上传', // 场景描述
308
+ actions: shellParam.actions,
309
+ domain: 'INDUCTION',
310
+ buz: 'PICTURE',
311
+ buzId: '111'
312
+ }).then(res => {
313
+ handleShellCall(res.fileId + '.' + res.ext, res.actions)
314
+ // FileServerPkg.fnCaller.$emit(EventGetFilename, res.fileId + '.' + res.ext)
315
+ // if (actions) FileServerPkg.fnCaller.$emit(EventGetMessage, actions)
316
+ })
317
+ // isp_phone.callShell(TypeShellMapping[shellType], shellParam, null, eventSender)
299
318
  }
300
319
 
301
320
  /* *************************************************************************
@@ -339,7 +358,7 @@ function setShellParam(uploadType, param, maxSizeKB, count) {
339
358
  function setServiceParamFn(uploadType, param, isCallService) {
340
359
  if (isCallService) {
341
360
  const shellType = UType2Shell[uploadType]
342
-
361
+
343
362
  if (param) {
344
363
  // 如果是影像件上传服务的入参(默认是电投)
345
364
  return function(fileName) {
@@ -379,7 +398,7 @@ function setServiceParamFn(uploadType, param, isCallService) {
379
398
 
380
399
  // state保存返回的是一个可执行的函数,传入filename即可
381
400
  function getStateSetFn(uploadType, param) {
382
-
401
+
383
402
  if (param) {
384
403
  const stateParams = param.personKey ? [param.personKey] : []
385
404
  if (UType2State[uploadType] && UType2State[uploadType].save) {
@@ -46,7 +46,7 @@ if(isProductionEnvironment()){
46
46
  faceResultUrl = 'https://bcs.ihasl.com/api/v1/bcs/face/faceResultQuery'
47
47
  appid = 'wx751d925fbededc73' // 回调安全域名 wx.ihasl
48
48
  tokenKey = '6297391dca6d4090ae60959acb73cda1'
49
- loginUrl = 'https://www.ihasl.com/pages/salessupport/app/#/login'
49
+ loginUrl = 'https://www.ihasl.com/pages/app2-hasl/#/login'
50
50
  } else {
51
51
  console.log('测试环境')
52
52
  auth = 0
@@ -55,9 +55,7 @@ if(isProductionEnvironment()){
55
55
  faceResultUrl = 'https://testbcs.ihasl.com/api/v1/bcs/face/faceResultQuery'
56
56
  appid = 'wx38c646900b5b7ec0' // 回调安全域名 teststatic.com
57
57
  tokenKey = '814a0b7eb0f82e02246da5e098b6e2b5'
58
- loginUrl = 'https://teststatic.ihasl.com/pages/salessupport/app/#/login'
59
- // 本地的
60
- // loginUrl = 'http://172.20.10.2:8080/#/login'
58
+ loginUrl = 'https://teststatic.ihasl.com/pages/app2-hasl/#/login'
61
59
  }
62
60
  console.log(appid, 'appid')
63
61
 
@@ -956,15 +954,6 @@ nFqBB1zM586NpO+4hua/1Ol5OiqoQJ4iQinyDiA=
956
954
  for (let i = 0; i < base64Files.length; i++) {
957
955
  const element = base64Files[i];
958
956
 
959
- // 需要上传时显示进度提示
960
- if (params.isUpload) {
961
- Toast.loading({
962
- forbidClick: true,
963
- message: `选择了${base64Files.length}张图片,正在上传第${i+1}张`,
964
- duration: 0, // 持续展示 toast
965
- });
966
- }
967
-
968
957
  try {
969
958
  console.log(isCropper, '--------------是否需要裁剪---------');
970
959
 
@@ -989,6 +978,23 @@ nFqBB1zM586NpO+4hua/1Ol5OiqoQJ4iQinyDiA=
989
978
  continue; // 继续处理下一张图片
990
979
  }
991
980
 
981
+ // 需要上传时显示进度提示
982
+ if (params.isUpload) {
983
+ if(base64Files.length>1){
984
+ Toast.loading({
985
+ forbidClick: true,
986
+ message: `选择了${base64Files.length}张图片,正在上传第${i+1}张`,
987
+ duration: 0,
988
+ });
989
+ } else {
990
+ Toast.loading({
991
+ forbidClick: true,
992
+ message: '上传中...',
993
+ duration: 0,
994
+ });
995
+ }
996
+ }
997
+
992
998
  // 3. 需要上传:转换为文件并上传
993
999
  const file = await nativeUtils.base64ToFile(element.imageBase64, 'image.png');
994
1000
  const result = await nativeUtils.uploadFile(
@@ -1167,19 +1173,26 @@ nFqBB1zM586NpO+4hua/1Ol5OiqoQJ4iQinyDiA=
1167
1173
  });
1168
1174
  document.getElementById('cancelBtn').addEventListener('click', () => {
1169
1175
  nativeUtils.closeDialog();
1170
- nativeUtils._takePictureReject(new Error('用户取消了操作'));
1176
+ if (nativeUtils._takePictureReject) {
1177
+ nativeUtils._takePictureReject(new Error('用户取消了操作'));
1178
+ }
1179
+ });
1180
+
1181
+ // 添加点击背景关闭弹窗的功能
1182
+ const cameraDialog = dialog.querySelector('.camera-dialog');
1183
+ cameraDialog.addEventListener('click', function (e) {
1184
+ if (e.target === cameraDialog) {
1185
+ // 点击背景时也视为取消操作
1186
+ nativeUtils.closeDialog();
1187
+ if (nativeUtils._takePictureReject) {
1188
+ nativeUtils._takePictureReject(new Error('用户取消了操作'));
1189
+ }
1190
+ }
1171
1191
  });
1172
1192
  }, 0);
1173
1193
 
1174
1194
  // 添加到文档
1175
1195
  document.body.appendChild(dialog);
1176
-
1177
- // 添加事件监听器,点击背景关闭弹窗
1178
- dialog.addEventListener('click', function (e) {
1179
- if (e.target.classList.contains('camera-dialog')) {
1180
- this.closeDialog();
1181
- }
1182
- });
1183
1196
  },
1184
1197
  // 关闭弹窗
1185
1198
  closeDialog() {
@@ -1201,6 +1214,13 @@ nFqBB1zM586NpO+4hua/1Ol5OiqoQJ4iQinyDiA=
1201
1214
  document.body.removeChild(dialog);
1202
1215
  }, 300);
1203
1216
  }
1217
+
1218
+ // 在关闭弹窗时也要触发reject,防止Promise悬挂
1219
+ if (nativeUtils._takePictureReject) {
1220
+ nativeUtils._takePictureReject(new Error('用户取消了操作'));
1221
+ }
1222
+
1223
+ // 清理全局引用
1204
1224
  delete nativeUtils._takePictureResolve;
1205
1225
  delete nativeUtils._takePictureReject;
1206
1226
  },