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,309 @@
1
+ <template>
2
+ <div class="ps-r">
3
+ <canvas ref="canvas" @mousedown="mouseDown" @mousemove="mouseMove" @mouseup="mouseUp" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd"></canvas>
4
+ <!-- 全屏按钮插槽 -->
5
+ <slot name="fullscreen"></slot>
6
+ <!-- 遮罩层插槽 -->
7
+ <slot name="cover"></slot>
8
+ <!-- 背景图插槽 -->
9
+ <slot name="background"></slot>
10
+ <!-- 回显图插槽 -->
11
+ <slot name="backView"></slot>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ export default {
17
+ props: {
18
+ width: {
19
+ type: Number,
20
+ default: 800,
21
+ },
22
+ height: {
23
+ type: Number,
24
+ default: 300,
25
+ },
26
+ lineWidth: {
27
+ type: Number,
28
+ default: 4,
29
+ },
30
+ lineColor: {
31
+ type: String,
32
+ default: "#000000",
33
+ },
34
+ bgColor: {
35
+ type: String,
36
+ default: "",
37
+ },
38
+ isCrop: {
39
+ type: Boolean,
40
+ default: false,
41
+ },
42
+ isClearBgColor: {
43
+ type: Boolean,
44
+ default: true,
45
+ },
46
+ format: {
47
+ type: String,
48
+ default: "image/png",
49
+ },
50
+ quality: {
51
+ type: Number,
52
+ default: 1,
53
+ },
54
+ },
55
+ data() {
56
+ return {
57
+ hasDrew: false,
58
+ resultImg: "",
59
+ points: [],
60
+ canvasTxt: null,
61
+ startX: 0,
62
+ startY: 0,
63
+ isDrawing: false,
64
+ sratio: 1,
65
+ strokeCount: 0,
66
+ };
67
+ },
68
+ computed: {
69
+ ratio() {
70
+ return this.height / this.width;
71
+ },
72
+ stageInfo() {
73
+ return this.$refs.canvas.getBoundingClientRect();
74
+ },
75
+ myBg() {
76
+ return this.bgColor ? this.bgColor : "rgba(255, 255, 255, 0)";
77
+ },
78
+ },
79
+ watch: {
80
+ myBg: function (newVal) {
81
+ this.$refs.canvas.style.background = newVal;
82
+ },
83
+ },
84
+ beforeMount() {
85
+ window.addEventListener("resize", this.$_resizeHandler);
86
+ },
87
+ beforeDestroy() {
88
+ window.removeEventListener("resize", this.$_resizeHandler);
89
+ },
90
+ mounted() {
91
+ const canvas = this.$refs.canvas;
92
+ canvas.height = this.height;
93
+ canvas.width = this.width;
94
+ canvas.style.background = this.myBg;
95
+ this.$_resizeHandler();
96
+ // 在画板以外松开鼠标后冻结画笔
97
+ document.onmouseup = () => {
98
+ this.isDrawing = false;
99
+ };
100
+ },
101
+ methods: {
102
+ handleDraw() {
103
+ this.strokeCount++;
104
+ // console.log(`已经画了${this.strokeCount}笔`);
105
+ this.$emit("getStrokeCount", { strokeCount: this.strokeCount });
106
+ },
107
+ $_resizeHandler() {
108
+ const canvas = this.$refs.canvas;
109
+ canvas.style.width = this.width + "px";
110
+ const realw = parseFloat(window.getComputedStyle(canvas).width);
111
+ console.log(this.ratio, this.width, this.height, this.ratio * realw + "px");
112
+ canvas.style.height = this.ratio * realw + "px";
113
+ this.canvasTxt = canvas.getContext("2d");
114
+ this.canvasTxt.scale(1 * this.sratio, 1 * this.sratio);
115
+ this.sratio = realw / this.width;
116
+ this.canvasTxt.scale(1 / this.sratio, 1 / this.sratio);
117
+ },
118
+ // pc
119
+ mouseDown(e) {
120
+ e = e || event;
121
+ e.preventDefault();
122
+ this.isDrawing = true;
123
+ this.hasDrew = true;
124
+ let obj = {
125
+ x: e.offsetX,
126
+ y: e.offsetY,
127
+ };
128
+ this.drawStart(obj);
129
+ },
130
+ mouseMove(e) {
131
+ e = e || event;
132
+ e.preventDefault();
133
+ if (this.isDrawing) {
134
+ let obj = {
135
+ x: e.offsetX,
136
+ y: e.offsetY,
137
+ };
138
+ this.drawMove(obj);
139
+ }
140
+ },
141
+ mouseUp(e) {
142
+ e = e || event;
143
+ e.preventDefault();
144
+ let obj = {
145
+ x: e.offsetX,
146
+ y: e.offsetY,
147
+ };
148
+ this.drawEnd(obj);
149
+ this.isDrawing = false;
150
+ },
151
+ // mobile
152
+ touchStart(e) {
153
+ e = e || event;
154
+ e.preventDefault();
155
+ this.hasDrew = true;
156
+ if (e.touches.length === 1) {
157
+ let obj = {
158
+ x: e.targetTouches[0].clientX - this.$refs.canvas.getBoundingClientRect().left,
159
+ y: e.targetTouches[0].clientY - this.$refs.canvas.getBoundingClientRect().top,
160
+ };
161
+ this.drawStart(obj);
162
+ }
163
+ },
164
+ touchMove(e) {
165
+ e = e || event;
166
+ e.preventDefault();
167
+ if (e.touches.length === 1) {
168
+ let obj = {
169
+ x: e.targetTouches[0].clientX - this.$refs.canvas.getBoundingClientRect().left,
170
+ y: e.targetTouches[0].clientY - this.$refs.canvas.getBoundingClientRect().top,
171
+ };
172
+ this.drawMove(obj);
173
+ }
174
+ },
175
+ touchEnd(e) {
176
+ e = e || event;
177
+ e.preventDefault();
178
+ if (e.touches.length === 1) {
179
+ let obj = {
180
+ x: e.targetTouches[0].clientX - this.$refs.canvas.getBoundingClientRect().left,
181
+ y: e.targetTouches[0].clientY - this.$refs.canvas.getBoundingClientRect().top,
182
+ };
183
+ this.drawEnd(obj);
184
+ }
185
+ },
186
+ // 绘制
187
+ drawStart(obj) {
188
+ this.startX = obj.x;
189
+ this.startY = obj.y;
190
+ this.canvasTxt.beginPath();
191
+ this.canvasTxt.moveTo(this.startX, this.startY);
192
+ this.canvasTxt.lineTo(obj.x, obj.y);
193
+ this.canvasTxt.lineCap = "round";
194
+ this.canvasTxt.lineJoin = "round";
195
+ this.canvasTxt.lineWidth = this.lineWidth * this.sratio;
196
+ this.canvasTxt.stroke();
197
+ this.canvasTxt.closePath();
198
+ this.points.push(obj);
199
+ this.handleDraw();
200
+ },
201
+ drawMove(obj) {
202
+ this.canvasTxt.beginPath();
203
+ this.canvasTxt.moveTo(this.startX, this.startY);
204
+ this.canvasTxt.lineTo(obj.x, obj.y);
205
+ this.canvasTxt.strokeStyle = this.lineColor;
206
+ this.canvasTxt.lineWidth = this.lineWidth * this.sratio;
207
+ this.canvasTxt.lineCap = "round";
208
+ this.canvasTxt.lineJoin = "round";
209
+ this.canvasTxt.stroke();
210
+ this.canvasTxt.closePath();
211
+ this.startY = obj.y;
212
+ this.startX = obj.x;
213
+ this.points.push(obj);
214
+ },
215
+ drawEnd(obj) {
216
+ this.canvasTxt.beginPath();
217
+ this.canvasTxt.moveTo(this.startX, this.startY);
218
+ this.canvasTxt.lineTo(obj.x, obj.y);
219
+ this.canvasTxt.lineCap = "round";
220
+ this.canvasTxt.lineJoin = "round";
221
+ this.canvasTxt.stroke();
222
+ this.canvasTxt.closePath();
223
+ this.points.push(obj);
224
+ this.points.push({ x: -1, y: -1 });
225
+ },
226
+ // 操作
227
+ generate(options) {
228
+ let imgFormat = options && options.format ? options.format : this.format;
229
+ let imgQuality = options && options.quality ? options.quality : this.quality;
230
+ const pm = new Promise((resolve, reject) => {
231
+ if (!this.hasDrew) {
232
+ reject(`Warning: Not Signned!`);
233
+ return;
234
+ }
235
+ var resImgData = this.canvasTxt.getImageData(0, 0, this.$refs.canvas.width, this.$refs.canvas.height);
236
+ this.canvasTxt.globalCompositeOperation = "destination-over";
237
+ this.canvasTxt.fillStyle = this.myBg;
238
+ this.canvasTxt.fillRect(0, 0, this.$refs.canvas.width, this.$refs.canvas.height);
239
+ this.resultImg = this.$refs.canvas.toDataURL(imgFormat, imgQuality);
240
+ var resultImg = this.resultImg;
241
+ this.canvasTxt.clearRect(0, 0, this.$refs.canvas.width, this.$refs.canvas.height);
242
+ this.canvasTxt.putImageData(resImgData, 0, 0);
243
+ this.canvasTxt.globalCompositeOperation = "source-over";
244
+ if (this.isCrop) {
245
+ const crop_area = this.getCropArea(resImgData.data);
246
+ var crop_canvas = document.createElement("canvas");
247
+ const crop_ctx = crop_canvas.getContext("2d");
248
+ crop_canvas.width = crop_area[2] - crop_area[0];
249
+ crop_canvas.height = crop_area[3] - crop_area[1];
250
+ const crop_imgData = this.canvasTxt.getImageData(...crop_area);
251
+ crop_ctx.globalCompositeOperation = "destination-over";
252
+ crop_ctx.putImageData(crop_imgData, 0, 0);
253
+ crop_ctx.fillStyle = this.myBg;
254
+ crop_ctx.fillRect(0, 0, crop_canvas.width, crop_canvas.height);
255
+ resultImg = crop_canvas.toDataURL(imgFormat, imgQuality);
256
+ crop_canvas = null;
257
+ }
258
+ resolve(resultImg);
259
+ });
260
+ return pm;
261
+ },
262
+ reset() {
263
+ this.canvasTxt.clearRect(0, 0, this.$refs.canvas.width, this.$refs.canvas.height);
264
+ if (this.isClearBgColor) {
265
+ this.$emit("update:bgColor", "");
266
+ this.$refs.canvas.style.background = "rgba(255, 255, 255, 0)";
267
+ }
268
+ this.points = [];
269
+ this.hasDrew = false;
270
+ this.resultImg = "";
271
+ this.strokeCount = 0;
272
+ },
273
+ getCropArea(imgData) {
274
+ var topX = this.$refs.canvas.width;
275
+ var btmX = 0;
276
+ var topY = this.$refs.canvas.height;
277
+ var btnY = 0;
278
+ for (var i = 0; i < this.$refs.canvas.width; i++) {
279
+ for (var j = 0; j < this.$refs.canvas.height; j++) {
280
+ var pos = (i + this.$refs.canvas.width * j) * 4;
281
+ if (imgData[pos] > 0 || imgData[pos + 1] > 0 || imgData[pos + 2] || imgData[pos + 3] > 0) {
282
+ btnY = Math.max(j, btnY);
283
+ btmX = Math.max(i, btmX);
284
+ topY = Math.min(j, topY);
285
+ topX = Math.min(i, topX);
286
+ }
287
+ }
288
+ }
289
+ topX++;
290
+ btmX++;
291
+ topY++;
292
+ btnY++;
293
+ const data = [topX, topY, btmX, btnY];
294
+ return data;
295
+ },
296
+ },
297
+ };
298
+ </script>
299
+
300
+ <style scoped>
301
+ canvas {
302
+ max-width: 100%;
303
+ display: block;
304
+ border: 1px dashed #e8e8e8;
305
+ border-radius: 8px;
306
+ /* height: 100% !important;
307
+ width: 100% !important; */
308
+ }
309
+ </style>
@@ -0,0 +1,5 @@
1
+ import AutoGraph from './index.vue';
2
+ AutoGraph.install = (Vue) => {
3
+ Vue.component(AutoGraph.name, AutoGraph);
4
+ };
5
+ export default AutoGraph;