fhrons-mobile-next 2.0.0 → 2.0.2

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.
Files changed (90) hide show
  1. package/.env.poc +8 -0
  2. package/assets/css/colors.js +6 -0
  3. package/assets/css/customVant.less +60 -0
  4. package/assets/css/extra.css +32 -0
  5. package/assets/css/global.css +1 -0
  6. package/assets/css/global.less +1637 -0
  7. package/assets/css/index.js +63 -0
  8. package/assets/css/static.less +607 -0
  9. package/assets/js/func.js +361 -0
  10. package/assets/js/globalData.js +18 -0
  11. package/assets/js/qywxapi.js +484 -0
  12. package/{packages → assets/js}/storage.js +1 -20
  13. package/assets/js/upload.js +269 -0
  14. package/assets/js/validate.js +48 -0
  15. package/assets/js/vant.js +39 -0
  16. package/assets/js/wxapi.js +297 -0
  17. package/assets/vantLang/index.js +172 -0
  18. package/assets/vantLang/lib/en-US.js +95 -0
  19. package/assets/vantLang/lib/es-ES.js +95 -0
  20. package/assets/vantLang/lib/pt-PT.js +96 -0
  21. package/assets/vantLang/lib/zh-CN.js +96 -0
  22. package/assets/vantLang/lib/zh-HK.js +96 -0
  23. package/assets/vantLang/locales/en_US.js +102 -0
  24. package/assets/vantLang/locales/es_ES.js +102 -0
  25. package/assets/vantLang/locales/index.js +12 -0
  26. package/assets/vantLang/locales/pt_PT.js +102 -0
  27. package/assets/vantLang/locales/zh_CN.js +102 -0
  28. package/assets/vantLang/locales/zh_T.js +102 -0
  29. package/babel.config.js +15 -0
  30. package/index.js +68 -33
  31. package/inject-env-plugin.js +29 -0
  32. package/package.json +46 -32
  33. package/packages/areaMobile/index.js +5 -0
  34. package/packages/areaMobile/index.vue +260 -0
  35. package/packages/autoGraph/VueEsign.vue +309 -0
  36. package/packages/autoGraph/index.js +5 -0
  37. package/packages/autoGraph/index.vue +472 -0
  38. package/packages/commonForm/CommonAsyncAreaPicker.vue +223 -0
  39. package/packages/commonForm/CommonDatePicker.vue +152 -0
  40. package/packages/commonForm/CommonForm.vue +786 -0
  41. package/packages/commonForm/CommonFullTimePicker.vue +137 -0
  42. package/packages/commonForm/CommonSinglePicker.vue +121 -0
  43. package/packages/commonForm/CommonYearMonthPicker.vue +127 -0
  44. package/packages/commonForm/index.js +33 -0
  45. package/packages/dialog/index.js +32 -0
  46. package/packages/dialog/index.vue +379 -0
  47. package/packages/index.js +7 -3
  48. package/packages/introduce/index.js +5 -0
  49. package/packages/introduce/index.vue +31 -0
  50. package/packages/loading/Loading.vue +70 -0
  51. package/packages/loading/index.js +43 -0
  52. package/packages/mindMap/index.js +5 -0
  53. package/packages/mindMap/index.vue +437 -0
  54. package/packages/pdfViewer/index.js +12 -0
  55. package/packages/pdfViewer/index.vue +131 -0
  56. package/packages/sharePanel/SheetPanel.vue +316 -0
  57. package/packages/sharePanel/index.js +5 -0
  58. package/packages/sharePanel/index.vue +476 -0
  59. package/packages/sharePanel/props.js +58 -0
  60. package/packages/sharePanel/utils/QyWxShareMixin.js +93 -0
  61. package/packages/sharePanel/utils/shareWay.js +81 -0
  62. package/packages/theme/index copy.js +89 -0
  63. package/packages/theme/index.js +38 -0
  64. package/packages/theme/theme.css +910 -0
  65. package/packages/theme/theme.less +26 -0
  66. package/packages/uploadFile/VanUploadFile.vue +80 -0
  67. package/packages/uploadFile/index.js +5 -0
  68. package/packages/uploadFile/index.vue +725 -0
  69. package/packages/uploadFile/vanUpload.js +5 -0
  70. package/packages/verify/Verify/VerifyPoints.vue +247 -0
  71. package/packages/verify/Verify/VerifySlide.vue +364 -0
  72. package/packages/verify/index.js +5 -0
  73. package/packages/verify/index.vue +416 -0
  74. package/packages/verify/utils/verify.js +53 -0
  75. package/packages/videoPage/index.js +5 -0
  76. package/packages/videoPage/index.vue +440 -0
  77. package/plugins/sensors/fhsensors.js +84 -0
  78. package/plugins/sensors/sensors.js +175 -0
  79. package/plugins/sensors/sensorsFun.js +1387 -0
  80. package/fhrons-mobile-next-2.0.0.tgz +0 -0
  81. package/packages/fhImage/index.js +0 -5
  82. package/packages/fhImage/index.vue +0 -57
  83. package/packages/fhPresetImage/index.js +0 -5
  84. package/packages/fhPresetImage/index.vue +0 -39
  85. package/packages/html2canvas/index.js +0 -29
  86. package/upload copy.js +0 -468
  87. package/utils/tools.js +0 -22
  88. /package/{dist → fhcommon/dist}/fhcommon.min.js +0 -0
  89. /package/{dist → fhcommon/dist}/fhcommon.min.js.LICENSE.txt +0 -0
  90. /package/{upload.js → fhcommon/upload.js} +0 -0
@@ -0,0 +1,361 @@
1
+
2
+ /**
3
+ * 不为空
4
+ * @param val
5
+ * @returns {boolean}
6
+ */
7
+ export function notEmpty (val) {
8
+ return !isEmpty(val);
9
+ }
10
+
11
+ /**
12
+ * 为空
13
+ * @param val
14
+ * @returns {boolean}
15
+ */
16
+ export function isEmpty (val) {
17
+ if (val === null || val === undefined || (typeof val === 'string' && (val === '' || val === 'undefined' || val === 'null')) || (Array.isArray(val) && val.length === 0) || (Object.prototype.toString.call(val) === '[object Object]' && Object.keys(val).length === 0)) {
18
+ return true;
19
+ }
20
+ return false;
21
+ }
22
+
23
+ /**
24
+ * 加载远程js
25
+ * @param {*} url
26
+ * @returns
27
+ */
28
+ export function loadJavaScript (url) {
29
+ return new Promise((resolve, reject) => {
30
+ const script = document.createElement('script');
31
+ script.src = `${url}?timeStamp=${new Date().valueOf()}`;
32
+ script.async = true;
33
+
34
+ script.onload = () => {
35
+ resolve('加载成功', script);
36
+ };
37
+
38
+ script.onerror = () => {
39
+ reject(new Error(`Failed to load script: ${url}`));
40
+ };
41
+ if (url) {
42
+ // 如果src不存在,不加入到项目里面去,否则会报加载资源失败
43
+ document.head.appendChild(script);
44
+ }
45
+ });
46
+ }
47
+
48
+ /**
49
+ * 加载远程css
50
+ * @param {String} src 加载的链接
51
+ * @param {Function} callback 加载后的回调函数
52
+ */
53
+ export function loadStyleLink (url) {
54
+ return new Promise((resolve, reject) => {
55
+ const link = document.createElement('link');
56
+ link.rel = 'stylesheet';
57
+ link.type = 'text/css';
58
+ link.href = url;
59
+
60
+ link.onload = () => {
61
+ resolve('加载成功', link);
62
+ };
63
+
64
+ link.onerror = () => {
65
+ reject(new Error(`Failed to load CSS: ${url}`));
66
+ };
67
+ if (url) {
68
+ // 如果src不存在,不加入到项目里面去,否则会报加载资源失败
69
+ document.head.appendChild(link);
70
+ }
71
+ });
72
+ }
73
+
74
+ /**
75
+ * 判断是否为空
76
+ */
77
+ export function validateNull (val) {
78
+ if (typeof val === 'boolean') {
79
+ return false;
80
+ }
81
+ if (typeof val === 'number') {
82
+ return false;
83
+ }
84
+ if (val instanceof Array) {
85
+ if (val.length === 0) return true;
86
+ } else if (val instanceof Object) {
87
+ if (JSON.stringify(val) === '{}') return true;
88
+ } else {
89
+ if (val === 'null' || val === null || val === 'undefined' || val === undefined || val === '') return true;
90
+ return false;
91
+ }
92
+ return false;
93
+ }
94
+
95
+ /**
96
+ * @param {Object} target 需要深拷贝的对象
97
+ * @returns 深拷贝后的对象
98
+ */
99
+ // 定义一个深拷贝函数 接收目标target参数
100
+ export function deepClone (target) {
101
+ // 定义一个变量
102
+ let result;
103
+ // 如果当前需要深拷贝的是一个对象的话
104
+ if (typeof target === 'object') {
105
+ // 如果是一个数组的话
106
+ if (Array.isArray(target)) {
107
+ result = []; // 将result赋值为一个数组,并且执行遍历
108
+ for (const i in target) {
109
+ // 递归克隆数组中的每一项
110
+ result.push(deepClone(target[i]));
111
+ }
112
+ // 判断如果当前的值是null的话;直接赋值为null
113
+ } else if (target === null) {
114
+ result = null;
115
+ // 判断如果当前的值是一个RegExp对象的话,直接赋值
116
+ } else if (target.constructor === RegExp) {
117
+ result = target;
118
+ } else {
119
+ // 否则是普通对象,直接for in循环,递归赋值对象的所有值
120
+ result = {};
121
+ for (const i in target) {
122
+ result[i] = deepClone(target[i]);
123
+ }
124
+ }
125
+ // 如果不是对象的话,就是基本数据类型,那么直接赋值
126
+ } else {
127
+ result = target;
128
+ }
129
+ // 返回最终结果
130
+ return result;
131
+ }
132
+
133
+ /**
134
+ * 将base64转换为文件
135
+ * @param {String} dataurl base64 数据
136
+ * @param {String} fileName 文件名
137
+ * @returns
138
+ */
139
+ export function dataURLtoFile (dataurl, fileName) {
140
+ var arr = dataurl.split(',');
141
+ var mime = arr[0].match(/:(.*?);/)[1];
142
+ var bstr = atob(arr[1]);
143
+ var n = bstr.length;
144
+ var u8arr = new Uint8Array(n);
145
+ while (n--) {
146
+ u8arr[n] = bstr.charCodeAt(n);
147
+ }
148
+ const blob = new Blob([u8arr], { type: mime });
149
+ return blobToFile(blob, fileName);
150
+ }
151
+ // 2,再将blob转换为file
152
+ export function blobToFile (theBlob, fileName) {
153
+ theBlob.lastModifiedDate = new Date(); // 文件最后的修改日期
154
+ theBlob.name = fileName; // 文件名
155
+ return new File([theBlob], fileName, { type: theBlob.type, lastModified: Date.now() });
156
+ }
157
+
158
+ // 获取当前分辨率下的根字体大小
159
+ export const getRootFontSize = () => {
160
+ return window.getComputedStyle(document.documentElement)['font-size'].replace('px', '');
161
+ };
162
+
163
+ /**
164
+ * 获取字符串的像素宽度
165
+ * @text 要计算的文本
166
+ * @font 文本的字体样式
167
+ */
168
+ export function getStringPixelLength (text, font) {
169
+ let canvas = document.createElement('canvas');
170
+ const context = canvas.getContext('2d');
171
+ context.font = font;
172
+ const metrics = context.measureText(text);
173
+ canvas = null;
174
+ return metrics.width;
175
+ }
176
+
177
+ // blob 对象转base64
178
+ export function blobToDataURL (blob) {
179
+ return new Promise(resolve => {
180
+ const reader = new FileReader();
181
+ reader.onload = function (evt) {
182
+ const base64 = evt.target.result;
183
+ resolve(base64);
184
+ };
185
+ reader.readAsDataURL(blob);
186
+ });
187
+ }
188
+
189
+ /**
190
+ * 十六进制颜色值转为带透明度的颜色
191
+ * @param _color 十六进制颜色
192
+ * @param _opacity 透明度
193
+ * @returns {string} rgba
194
+ */
195
+ export function hexToRGBA (_color, _opacity) {
196
+ if (isEmpty(_color)) return;
197
+ var sColor = _color.toLowerCase();
198
+ // 十六进制颜色值的正则表达式
199
+ var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
200
+ // 如果是16进制颜色
201
+ if (sColor && reg.test(sColor)) {
202
+ if (sColor.length === 4) {
203
+ var sColorNew = '#';
204
+ for (var i = 1; i < 4; i += 1) {
205
+ sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
206
+ }
207
+ sColor = sColorNew;
208
+ }
209
+ // 处理六位的颜色值
210
+ var sColorChange = [];
211
+ for (var j = 1; j < 7; j += 2) {
212
+ sColorChange.push(parseInt('0x' + sColor.slice(j, j + 2)));
213
+ }
214
+ return 'rgba(' + sColorChange.join(',') + ',' + _opacity + ')';
215
+ }
216
+ return sColor;
217
+ }
218
+
219
+ /**
220
+ * 判断对象是不是完美对象
221
+ * 即对象中所有属性都有值
222
+ */
223
+ export function isPerfectObj (obj) {
224
+ let result = true;
225
+ for (const i in obj) {
226
+ if (obj[i] === '' || obj[i] === null || obj[i] === undefined || obj[i].length === 0) {
227
+ result = false;
228
+ break;
229
+ }
230
+ }
231
+ return result;
232
+ }
233
+
234
+ // 规则
235
+ export function verifyRule (type) {
236
+ if (type === 'phone') { // 手机号(mobile phone)中国(严谨), 根据工信部2019年最新公布的手机号段
237
+ return /^(13|14|15|16|17|18|19)\d{9}$/; // 简单校验
238
+ } else if (type === 'name') { // 姓名支持中文姓名英文姓名
239
+ return /^(?:[\u4e00-\u9fa5·]{2,16})$/ || /(^[a-zA-Z][a-zA-Z\s]{0,20}[a-zA-Z]$)/ || '' || null;
240
+ } else if (type === 'emname') {
241
+ return /^[a-zA-Z\u4E00-\u9FA5\uF900-\uFA2D\u00B7\u2022\u0095\u0387]+$/;
242
+ } else if (type === 'zhEnName') { // 持大小写英文字母、空格、英文状态和点(.)的组成和中文姓名
243
+ return /^(?:[\u4e00-\u9fa5·]{2,15})$|(^[a-zA-Z][a-zA-Z\s]{0,20}[a-zA-Z\.]*[a-zA-Z]$)/;
244
+ } else if (type === 'identityCard') { // 身份证号支持1/2代(15位/18位数字)
245
+ // return /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/ || '' || null;
246
+ // return '(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|' + '(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)' || '' || null;
247
+ return /(^\d{8}(0\d|10|11|12)([0-2]\d|30|31)\d{3}$)|(^\d{6}(18|19|20)\d{2}(0\d|10|11|12)([0-2]\d|30|31)\d{3}(\d|X|x)$)/ || '' || null;
248
+ } else if (type === 'height' || type === 'weight') {
249
+ return /^([1-9]\d{0,2}|999.9)(\.\d{1})?$/;
250
+ } else if (type === 'cardNo') { // 银行卡号(10到30位, 覆盖对公/私账户, 参考[微信支付]
251
+ return /^[1-9]\d{9,29}$/;
252
+ } else if (type === 'passport') { // 护照
253
+ return /(^[EeKkGgDdSsPpHh]\d{8}$)|(^(([Ee][a-fA-F])|([DdSsPp][Ee])|([Kk][Jj])|([Mm][Aa])|(1[45]))\d{7}$)/;
254
+ } else if (type === 'telNumber') { // 公司电话,包括短号、座机、手机号 4到15位数字
255
+ return /^[0-9]\d{3,14}$/;
256
+ } else if (type === 'email') {
257
+ return /^[\w.-]+@\w+(\.\w+)+$/;
258
+ } else if (type === 'noSpecial') {
259
+ return /^[\u4E00-\u9FA5A-Za-z0-9-]+$/;
260
+ } else if (type === 'verificationCode') {
261
+ return /^\d{6}$/;
262
+ } else if (type === 'sumInsured' || type === 'premium') {
263
+ return /((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/;
264
+ }
265
+ }
266
+
267
+
268
+ /**
269
+ * 校验是否为base64
270
+ * @param {*} str base64 数据
271
+ * @returns
272
+ */
273
+ export function isBase64 (str = '') {
274
+ const test = /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*?)\s*$/i; // eslint-disable-line
275
+
276
+ return test.test(str);
277
+ }
278
+
279
+ // 根据当前地址获取所处系统的名称
280
+ export function getSystemName() {
281
+ let systemName = window.location.pathname.split('/').length > 0 ? window.location.pathname.split('/')[1] : '';
282
+ systemName.toLowerCase() === 'fhronsappxp' && (systemName = 'fhronsapp');
283
+ return `Fun-${systemName}-${process.env.VUE_APP_ENV_CONFIG}-`;
284
+ }
285
+
286
+ /**
287
+ * @param {*} text
288
+ * @param {*} maxLineLength
289
+ * @returns
290
+ */
291
+ export function wrapTextAndCountNewlines(text, maxChineseLineLength, maxEnglishLineLength) {
292
+ let lines = [];
293
+ let currentLine = '';
294
+ let currentLineLength = 0;
295
+ let newlineCount = 0;
296
+
297
+ for (let char of text) {
298
+ const isChinese = /[\u4e00-\u9fa5]/.test(char);
299
+ const charLength = isChinese ? 1 : 0.5; // 中文字符算1个长度,英文字符算0.5个长度
300
+ const maxLineLength = isChinese ? maxChineseLineLength : maxEnglishLineLength;
301
+
302
+ if (currentLineLength + charLength > maxLineLength) {
303
+ lines.push(currentLine);
304
+ currentLine = '';
305
+ currentLineLength = 0;
306
+ newlineCount++; // 每次换行时计数加1
307
+ }
308
+
309
+ currentLine += char;
310
+ currentLineLength += charLength;
311
+ }
312
+
313
+ if (currentLine) {
314
+ lines.push(currentLine);
315
+ }
316
+
317
+ return {
318
+ wrappedText: lines.join('\n'),
319
+ newlineCount: newlineCount
320
+ };
321
+ }
322
+ // export function wrapText (text, maxLineLength) {
323
+ // let lines = [];
324
+ // let currentLine = '';
325
+
326
+ // for (let i = 0; i < text.length; i++) {
327
+ // currentLine += text[i];
328
+ // if (currentLine.length >= maxLineLength) {
329
+ // lines.push(currentLine);
330
+ // currentLine = '';
331
+ // }
332
+ // }
333
+
334
+ // if (currentLine) {
335
+ // lines.push(currentLine);
336
+ // }
337
+
338
+ // return lines.join('\n');
339
+ // }
340
+ // export function wrapText(text, maxLineLength) {
341
+ // let lines = [];
342
+ // let currentLine = '';
343
+ // let currentLineLength = 0;
344
+
345
+ // for (let char of text) {
346
+ // const charLength = /[\u4e00-\u9fa5]/.test(char) ? 2 : 1;
347
+ // if (currentLineLength + charLength > maxLineLength) {
348
+ // lines.push(currentLine);
349
+ // currentLine = '';
350
+ // currentLineLength = 0;
351
+ // }
352
+ // currentLine += char;
353
+ // currentLineLength += charLength;
354
+ // }
355
+
356
+ // if (currentLine) {
357
+ // lines.push(currentLine);
358
+ // }
359
+
360
+ // return lines.join('\n');
361
+ // }
@@ -0,0 +1,18 @@
1
+ import { isAndroid, isApp, isIOS, isQYWeiXin, isWeiXin } from './validate';
2
+ // console.log(window, process)
3
+ export default function loadGlobalData (Vue) {
4
+ Vue.prototype.$globalData = {
5
+ isWeiXin: isWeiXin(),
6
+ isApp: !isWeiXin() && isApp(),
7
+ isAndroid: !isWeiXin() && isAndroid(),
8
+ isWxAndroid: isWeiXin() && isAndroid(),
9
+ isIOS: !isWeiXin() && isIOS(),
10
+ isWxIOS: isWeiXin() && isIOS(),
11
+ isQYWeiXin: isQYWeiXin(),
12
+ isQYWeiXinIOS: isQYWeiXin() && isIOS(),
13
+ isQYWeiXinAndroid: isQYWeiXin() && isAndroid(),
14
+ isWeb: function () { return !this.isApp && !this.isQYWeiXin && !this.isWeiXin; },
15
+ isHkp: process.env.VUE_APP_ENV_CONFIG && process.env.VUE_APP_ENV_CONFIG.includes('hk') || window.location.origin.includes('openuat.fhrons.net'),
16
+ isNotHk: (process.env.VUE_APP_ENV_CONFIG && !process.env.VUE_APP_ENV_CONFIG.includes('hk')) && !window.location.origin.includes('openuat.fhrons.net'),
17
+ }
18
+ }