正在显示
45 个修改的文件
包含
4584 行增加
和
0 行删除
Augly_Animation.wxss
0 → 100644
1 | +/* animation */ | ||
2 | + | ||
3 | +.Augly-bounce, | ||
4 | +.Augly-flip, | ||
5 | +.Augly-flash, | ||
6 | +.Augly-shake, | ||
7 | +.Augly-swing, | ||
8 | +.Augly-wobble, | ||
9 | +.Augly-ring { | ||
10 | + -webkit-animation: 1s ease; | ||
11 | + animation: 1s ease; | ||
12 | +} | ||
13 | + | ||
14 | +.Augly-fadein, | ||
15 | +.Augly-fadeinT, | ||
16 | +.Augly-fadeinR, | ||
17 | +.Augly-fadeinB, | ||
18 | +.Augly-fadeinL, | ||
19 | +.Augly-bouncein, | ||
20 | +.Augly-bounceinT, | ||
21 | +.Augly-bounceinR, | ||
22 | +.Augly-bounceinB, | ||
23 | +.Augly-bounceinL, | ||
24 | +.Augly-rotatein, | ||
25 | +.Augly-rotateinLT, | ||
26 | +.Augly-rotateinLB, | ||
27 | +.Augly-rotateinRT, | ||
28 | +.Augly-rotateinRB, | ||
29 | +.Augly-flipin, | ||
30 | +.Augly-flipinX, | ||
31 | +.Augly-flipinY { | ||
32 | + -webkit-animation: 0.6s ease-out backwards; | ||
33 | + animation: 0.6s ease-out backwards; | ||
34 | +} | ||
35 | + | ||
36 | +.Augly-fadeout, | ||
37 | +.Augly-fadeoutT, | ||
38 | +.Augly-fadeoutR, | ||
39 | +.Augly-fadeoutB, | ||
40 | +.Augly-fadeoutL, | ||
41 | +.Augly-bounceout, | ||
42 | +.Augly-bounceoutT, | ||
43 | +.Augly-bounceoutR, | ||
44 | +.Augly-bounceoutB, | ||
45 | +.Augly-bounceoutL, | ||
46 | +.Augly-rotateout, | ||
47 | +.Augly-rotateoutLT, | ||
48 | +.Augly-rotateoutLB, | ||
49 | +.Augly-rotateoutRT, | ||
50 | +.Augly-rotateoutRB, | ||
51 | +.Augly-flipout, | ||
52 | +.Augly-flipoutX, | ||
53 | +.Augly-flipoutY { | ||
54 | + -webkit-animation: 1s ease-in forwards; | ||
55 | + animation: 1s ease-in forwards; | ||
56 | +} | ||
57 | + | ||
58 | +/* 淡入 */ | ||
59 | + | ||
60 | +Augly-fadeinT .Augly-fadein { | ||
61 | + -webkit-animation-name: fadein; | ||
62 | + animation-name: fadein; | ||
63 | +} | ||
64 | + | ||
65 | +/* 淡入-从上 */ | ||
66 | + | ||
67 | +.Augly-fadeinT { | ||
68 | + -webkit-animation-name: fadeinT; | ||
69 | + animation-name: fadeinT; | ||
70 | +} | ||
71 | + | ||
72 | +/* 淡入-从右 */ | ||
73 | + | ||
74 | +.Augly-fadeinR { | ||
75 | + -webkit-animation-name: fadeinR; | ||
76 | + animation-name: fadeinR; | ||
77 | +} | ||
78 | + | ||
79 | +/* 淡入-从下 */ | ||
80 | + | ||
81 | +.Augly-fadeinB { | ||
82 | + -webkit-animation-name: fadeinB; | ||
83 | + animation-name: fadeinB; | ||
84 | +} | ||
85 | + | ||
86 | +/* 淡入-从左 */ | ||
87 | + | ||
88 | +.Augly-fadeinL { | ||
89 | + -webkit-animation-name: fadeinL; | ||
90 | + animation-name: fadeinL; | ||
91 | +} | ||
92 | + | ||
93 | +/* 淡出 */ | ||
94 | + | ||
95 | +.Augly-fadeout { | ||
96 | + -webkit-animation-name: fadeout; | ||
97 | + animation-name: fadeout; | ||
98 | +} | ||
99 | + | ||
100 | +/* 淡出-向上 */ | ||
101 | + | ||
102 | +.Augly-fadeoutT { | ||
103 | + -webkit-animation-name: fadeoutT; | ||
104 | + animation-name: fadeoutT; | ||
105 | +} | ||
106 | + | ||
107 | +/* 淡出-向右 */ | ||
108 | + | ||
109 | +.Augly-fadeoutR { | ||
110 | + -webkit-animation-name: fadeoutR; | ||
111 | + animation-name: fadeoutR; | ||
112 | +} | ||
113 | + | ||
114 | +/* 淡出-向下 */ | ||
115 | + | ||
116 | +.Augly-fadeoutB { | ||
117 | + -webkit-animation-name: fadeoutB; | ||
118 | + animation-name: fadeoutB; | ||
119 | +} | ||
120 | + | ||
121 | +/* 淡出-向左 */ | ||
122 | + | ||
123 | +.Augly-fadeoutL { | ||
124 | + -webkit-animation-name: fadeoutL; | ||
125 | + animation-name: fadeoutL; | ||
126 | +} | ||
127 | + | ||
128 | +/* 弹跳 */ | ||
129 | + | ||
130 | +.Augly-bounce { | ||
131 | + -webkit-animation-name: bounce; | ||
132 | + animation-name: bounce; | ||
133 | +} | ||
134 | + | ||
135 | +/* 弹入 */ | ||
136 | + | ||
137 | +.Augly-bouncein { | ||
138 | + -webkit-animation-name: bouncein; | ||
139 | + animation-name: bouncein; | ||
140 | +} | ||
141 | + | ||
142 | +/* 弹入-从上 */ | ||
143 | + | ||
144 | +.Augly-bounceinT { | ||
145 | + -webkit-animation-name: bounceinT; | ||
146 | + animation-name: bounceinT; | ||
147 | +} | ||
148 | + | ||
149 | +/* 弹入-从右 */ | ||
150 | + | ||
151 | +.Augly-bounceinR { | ||
152 | + -webkit-animation-name: bounceinR; | ||
153 | + animation-name: bounceinR; | ||
154 | +} | ||
155 | + | ||
156 | +/* 弹入-从下 */ | ||
157 | + | ||
158 | +.Augly-bounceinB { | ||
159 | + -webkit-animation-name: bounceinB; | ||
160 | + animation-name: bounceinB; | ||
161 | +} | ||
162 | + | ||
163 | +/* 弹入-从左 */ | ||
164 | + | ||
165 | +.Augly-bounceinL { | ||
166 | + -webkit-animation-name: bounceinL; | ||
167 | + animation-name: bounceinL; | ||
168 | +} | ||
169 | + | ||
170 | +/* 弹出 */ | ||
171 | + | ||
172 | +.Augly-bounceout { | ||
173 | + -webkit-animation-name: bounceout; | ||
174 | + animation-name: bounceout; | ||
175 | +} | ||
176 | + | ||
177 | +/* 弹出-向上 */ | ||
178 | + | ||
179 | +.Augly-bounceoutT { | ||
180 | + -webkit-animation-name: bounceoutT; | ||
181 | + animation-name: bounceoutT; | ||
182 | +} | ||
183 | + | ||
184 | +/* 弹出-向右 */ | ||
185 | + | ||
186 | +.Augly-bounceoutR { | ||
187 | + -webkit-animation-name: bounceoutR; | ||
188 | + animation-name: bounceoutR; | ||
189 | +} | ||
190 | + | ||
191 | +/* 弹出-向下 */ | ||
192 | + | ||
193 | +.Augly-bounceoutB { | ||
194 | + -webkit-animation-name: bounceoutB; | ||
195 | + animation-name: bounceoutB; | ||
196 | +} | ||
197 | + | ||
198 | +/* 弹出-向左 */ | ||
199 | + | ||
200 | +.Augly-bounceoutL { | ||
201 | + -webkit-animation-name: bounceoutL; | ||
202 | + animation-name: bounceoutL; | ||
203 | +} | ||
204 | + | ||
205 | +/* 转入 */ | ||
206 | + | ||
207 | +.Augly-rotatein { | ||
208 | + -webkit-animation-name: rotatein; | ||
209 | + animation-name: rotatein; | ||
210 | +} | ||
211 | + | ||
212 | +/* 转入-从左上 */ | ||
213 | + | ||
214 | +.Augly-rotateinLT { | ||
215 | + -webkit-animation-name: rotateinLT; | ||
216 | + animation-name: rotateinLT; | ||
217 | +} | ||
218 | + | ||
219 | +/* 转入-从左下 */ | ||
220 | + | ||
221 | +.Augly-rotateinLB { | ||
222 | + -webkit-animation-name: rotateinLB; | ||
223 | + animation-name: rotateinLB; | ||
224 | +} | ||
225 | + | ||
226 | +/* 转入-从右上 */ | ||
227 | + | ||
228 | +.Augly-rotateinRT { | ||
229 | + -webkit-animation-name: rotateinRT; | ||
230 | + animation-name: rotateinRT; | ||
231 | +} | ||
232 | + | ||
233 | +/* 转入-从右下*/ | ||
234 | + | ||
235 | +.Augly-rotateinRB { | ||
236 | + -webkit-animation-name: rotateinRB; | ||
237 | + animation-name: rotateinRB; | ||
238 | +} | ||
239 | + | ||
240 | +/* 转出 */ | ||
241 | + | ||
242 | +.Augly-rotateout { | ||
243 | + -webkit-animation-name: rotateout; | ||
244 | + animation-name: rotateout; | ||
245 | +} | ||
246 | + | ||
247 | +/* 转出-向左上 */ | ||
248 | + | ||
249 | +.Augly-rotateoutLT { | ||
250 | + -webkit-animation-name: rotateoutLT; | ||
251 | + animation-name: rotateoutLT; | ||
252 | +} | ||
253 | + | ||
254 | +/* 转出-向左下 */ | ||
255 | + | ||
256 | +.Augly-rotateoutLB { | ||
257 | + -webkit-animation-name: rotateoutLB; | ||
258 | + animation-name: rotateoutLB; | ||
259 | +} | ||
260 | + | ||
261 | +/* 转出-向右上 */ | ||
262 | + | ||
263 | +.Augly-rotateoutRT { | ||
264 | + -webkit-animation-name: rotateoutRT; | ||
265 | + animation-name: rotateoutRT; | ||
266 | +} | ||
267 | + | ||
268 | +/* 转出-向右下 */ | ||
269 | + | ||
270 | +.Augly-rotateoutRB { | ||
271 | + -webkit-animation-name: rotateoutRB; | ||
272 | + animation-name: rotateoutRB; | ||
273 | +} | ||
274 | + | ||
275 | +/* 翻转 */ | ||
276 | + | ||
277 | +.Augly-flip { | ||
278 | + -webkit-animation-name: flip; | ||
279 | + animation-name: flip; | ||
280 | +} | ||
281 | + | ||
282 | +/* 翻入-X轴 */ | ||
283 | + | ||
284 | +.Augly-flipinX { | ||
285 | + -webkit-animation-name: flipinX; | ||
286 | + animation-name: flipinX; | ||
287 | +} | ||
288 | + | ||
289 | +/* 翻入-Y轴 */ | ||
290 | + | ||
291 | +.Augly-flipin, | ||
292 | +.Augly-flipinY { | ||
293 | + -webkit-animation-name: flipinY; | ||
294 | + animation-name: flipinY; | ||
295 | +} | ||
296 | + | ||
297 | +/* 翻出-X轴 */ | ||
298 | + | ||
299 | +.Augly-flipoutX { | ||
300 | + -webkit-animation-name: flipoutX; | ||
301 | + animation-name: flipoutX; | ||
302 | +} | ||
303 | + | ||
304 | +/* 翻出-Y轴 */ | ||
305 | + | ||
306 | +.Augly-flipout, | ||
307 | +.Augly-flipoutY { | ||
308 | + -webkit-animation-name: flipoutY; | ||
309 | + animation-name: flipoutY; | ||
310 | +} | ||
311 | + | ||
312 | +/* 闪烁 */ | ||
313 | + | ||
314 | +.Augly-flash { | ||
315 | + -webkit-animation-name: flash; | ||
316 | + animation-name: flash; | ||
317 | +} | ||
318 | + | ||
319 | +/* 震颤 */ | ||
320 | + | ||
321 | +.Augly-shake { | ||
322 | + -webkit-animation-name: shake; | ||
323 | + animation-name: shake; | ||
324 | +} | ||
325 | + | ||
326 | +/* 摇摆 */ | ||
327 | + | ||
328 | +.Augly-swing { | ||
329 | + -webkit-animation-name: swing; | ||
330 | + animation-name: swing; | ||
331 | +} | ||
332 | + | ||
333 | +/* 摇晃 */ | ||
334 | + | ||
335 | +.Augly-wobble { | ||
336 | + -webkit-animation-name: wobble; | ||
337 | + animation-name: wobble; | ||
338 | +} | ||
339 | + | ||
340 | +/* 震铃 */ | ||
341 | + | ||
342 | +.Augly-ring { | ||
343 | + -webkit-animation-name: ring; | ||
344 | + animation-name: ring; | ||
345 | +} | ||
346 | + | ||
347 | +/* define */ | ||
348 | + | ||
349 | +/* 淡入 */ | ||
350 | + | ||
351 | +@-webkit-keyframes fadein { | ||
352 | + 0% { | ||
353 | + opacity: 0; | ||
354 | + } | ||
355 | + 100% { | ||
356 | + opacity: 1; | ||
357 | + } | ||
358 | +} | ||
359 | + | ||
360 | +@keyframes fadein { | ||
361 | + 0% { | ||
362 | + opacity: 0; | ||
363 | + } | ||
364 | + 100% { | ||
365 | + opacity: 1; | ||
366 | + } | ||
367 | +} | ||
368 | + | ||
369 | +/* 淡入-从上 */ | ||
370 | + | ||
371 | +@-webkit-keyframes fadeinT { | ||
372 | + 0% { | ||
373 | + opacity: 0; | ||
374 | + -webkit-transform: translateY(-100rpx); | ||
375 | + } | ||
376 | + 100% { | ||
377 | + opacity: 1; | ||
378 | + -webkit-transform: translateY(0); | ||
379 | + } | ||
380 | +} | ||
381 | + | ||
382 | +@keyframes fadeinT { | ||
383 | + 0% { | ||
384 | + opacity: 0; | ||
385 | + -webkit-transform: translateY(-100px); | ||
386 | + transform: translateY(-100px); | ||
387 | + } | ||
388 | + 100% { | ||
389 | + opacity: 1; | ||
390 | + -webkit-transform: translateY(0); | ||
391 | + transform: translateY(0); | ||
392 | + } | ||
393 | +} | ||
394 | + | ||
395 | +/* 淡入-从右 */ | ||
396 | + | ||
397 | +@-webkit-keyframes fadeinR { | ||
398 | + 0% { | ||
399 | + opacity: 0; | ||
400 | + -webkit-transform: translateX(100px); | ||
401 | + } | ||
402 | + 100% { | ||
403 | + opacity: 1; | ||
404 | + -webkit-transform: translateX(0); | ||
405 | + } | ||
406 | +} | ||
407 | + | ||
408 | +@keyframes fadeinR { | ||
409 | + 0% { | ||
410 | + opacity: 0; | ||
411 | + -webkit-transform: translateX(100px); | ||
412 | + transform: translateX(100px); | ||
413 | + } | ||
414 | + 100% { | ||
415 | + opacity: 1; | ||
416 | + -webkit-transform: translateX(0); | ||
417 | + transform: translateX(0); | ||
418 | + } | ||
419 | +} | ||
420 | + | ||
421 | +/* 淡入-从下 */ | ||
422 | + | ||
423 | +@-webkit-keyframes fadeinB { | ||
424 | + 0% { | ||
425 | + opacity: 0; | ||
426 | + -webkit-transform: translateY(100px); | ||
427 | + } | ||
428 | + 100% { | ||
429 | + opacity: 1; | ||
430 | + -webkit-transform: translateY(0); | ||
431 | + } | ||
432 | +} | ||
433 | + | ||
434 | +@keyframes fadeinB { | ||
435 | + 0% { | ||
436 | + opacity: 0; | ||
437 | + -webkit-transform: translateY(100px); | ||
438 | + transform: translateY(100px); | ||
439 | + } | ||
440 | + 100% { | ||
441 | + opacity: 1; | ||
442 | + -webkit-transform: translateY(0); | ||
443 | + transform: translateY(0); | ||
444 | + } | ||
445 | +} | ||
446 | + | ||
447 | +/* 淡入-从左 */ | ||
448 | + | ||
449 | +@-webkit-keyframes fadeinL { | ||
450 | + 0% { | ||
451 | + opacity: 0; | ||
452 | + -webkit-transform: translateX(-100px); | ||
453 | + } | ||
454 | + 100% { | ||
455 | + opacity: 1; | ||
456 | + -webkit-transform: translateX(0); | ||
457 | + } | ||
458 | +} | ||
459 | + | ||
460 | +@keyframes fadeinL { | ||
461 | + 0% { | ||
462 | + opacity: 0; | ||
463 | + -webkit-transform: translateX(-100px); | ||
464 | + transform: translateX(-100px); | ||
465 | + } | ||
466 | + 100% { | ||
467 | + opacity: 1; | ||
468 | + -webkit-transform: translateX(0); | ||
469 | + transform: translateX(0); | ||
470 | + } | ||
471 | +} | ||
472 | + | ||
473 | +/* 淡出 */ | ||
474 | + | ||
475 | +@-webkit-keyframes fadeout { | ||
476 | + 0% { | ||
477 | + opacity: 1; | ||
478 | + } | ||
479 | + 100% { | ||
480 | + opacity: 0; | ||
481 | + } | ||
482 | +} | ||
483 | + | ||
484 | +@keyframes fadeout { | ||
485 | + 0% { | ||
486 | + opacity: 1; | ||
487 | + } | ||
488 | + 100% { | ||
489 | + opacity: 0; | ||
490 | + } | ||
491 | +} | ||
492 | + | ||
493 | +/* 淡出-向上 */ | ||
494 | + | ||
495 | +@-webkit-keyframes fadeoutT { | ||
496 | + 0% { | ||
497 | + opacity: 1; | ||
498 | + -webkit-transform: translateY(0); | ||
499 | + } | ||
500 | + 100% { | ||
501 | + opacity: 0; | ||
502 | + -webkit-transform: translateY(-100px); | ||
503 | + } | ||
504 | +} | ||
505 | + | ||
506 | +@keyframes fadeoutT { | ||
507 | + 0% { | ||
508 | + opacity: 1; | ||
509 | + -webkit-transform: translateY(0); | ||
510 | + transform: translateY(0); | ||
511 | + } | ||
512 | + 100% { | ||
513 | + opacity: 0; | ||
514 | + -webkit-transform: translateY(-100px); | ||
515 | + transform: translateY(-100px); | ||
516 | + } | ||
517 | +} | ||
518 | + | ||
519 | +/* 淡出-向右 */ | ||
520 | + | ||
521 | +@-webkit-keyframes fadeoutR { | ||
522 | + 0% { | ||
523 | + opacity: 1; | ||
524 | + -webkit-transform: translateX(0); | ||
525 | + } | ||
526 | + 100% { | ||
527 | + opacity: 0; | ||
528 | + -webkit-transform: translateX(100px); | ||
529 | + } | ||
530 | +} | ||
531 | + | ||
532 | +@keyframes fadeoutR { | ||
533 | + 0% { | ||
534 | + opacity: 1; | ||
535 | + -webkit-transform: translateX(0); | ||
536 | + transform: translateX(0); | ||
537 | + } | ||
538 | + 100% { | ||
539 | + opacity: 0; | ||
540 | + -webkit-transform: translateX(100px); | ||
541 | + transform: translateX(100px); | ||
542 | + } | ||
543 | +} | ||
544 | + | ||
545 | +/* 淡出-向下 */ | ||
546 | + | ||
547 | +@-webkit-keyframes fadeoutB { | ||
548 | + 0% { | ||
549 | + opacity: 1; | ||
550 | + -webkit-transform: translateY(0); | ||
551 | + } | ||
552 | + 100% { | ||
553 | + opacity: 0; | ||
554 | + -webkit-transform: translateY(100px); | ||
555 | + } | ||
556 | +} | ||
557 | + | ||
558 | +@keyframes fadeoutB { | ||
559 | + 0% { | ||
560 | + opacity: 1; | ||
561 | + -webkit-transform: translateY(0); | ||
562 | + transform: translateY(0); | ||
563 | + } | ||
564 | + 100% { | ||
565 | + opacity: 0; | ||
566 | + -webkit-transform: translateY(100px); | ||
567 | + transform: translateY(100px); | ||
568 | + } | ||
569 | +} | ||
570 | + | ||
571 | +/* 淡出-向左 */ | ||
572 | + | ||
573 | +@-webkit-keyframes fadeoutL { | ||
574 | + 0% { | ||
575 | + opacity: 1; | ||
576 | + -webkit-transform: translateX(0); | ||
577 | + } | ||
578 | + 100% { | ||
579 | + opacity: 0; | ||
580 | + -webkit-transform: translateX(-100px); | ||
581 | + } | ||
582 | +} | ||
583 | + | ||
584 | +@keyframes fadeoutL { | ||
585 | + 0% { | ||
586 | + opacity: 1; | ||
587 | + -webkit-transform: translateX(0); | ||
588 | + transform: translateX(0); | ||
589 | + } | ||
590 | + 100% { | ||
591 | + opacity: 0; | ||
592 | + -webkit-transform: translateX(-100px); | ||
593 | + transform: translateX(-100px); | ||
594 | + } | ||
595 | +} | ||
596 | + | ||
597 | +/* 弹跳 */ | ||
598 | + | ||
599 | +@-webkit-keyframes bounce { | ||
600 | + 0%, | ||
601 | + 20%, | ||
602 | + 50%, | ||
603 | + 80%, | ||
604 | + 100% { | ||
605 | + -webkit-transform: translateY(0); | ||
606 | + } | ||
607 | + 40% { | ||
608 | + -webkit-transform: translateY(-30px); | ||
609 | + } | ||
610 | + 60% { | ||
611 | + -webkit-transform: translateY(-15px); | ||
612 | + } | ||
613 | +} | ||
614 | + | ||
615 | +@keyframes bounce { | ||
616 | + 0%, | ||
617 | + 20%, | ||
618 | + 50%, | ||
619 | + 80%, | ||
620 | + 100% { | ||
621 | + -webkit-transform: translateY(0); | ||
622 | + transform: translateY(0); | ||
623 | + } | ||
624 | + 40% { | ||
625 | + -webkit-transform: translateY(-30px); | ||
626 | + transform: translateY(-30px); | ||
627 | + } | ||
628 | + 60% { | ||
629 | + -webkit-transform: translateY(-15px); | ||
630 | + transform: translateY(-15px); | ||
631 | + } | ||
632 | +} | ||
633 | + | ||
634 | +/* 弹入 */ | ||
635 | + | ||
636 | +@-webkit-keyframes bouncein { | ||
637 | + 0% { | ||
638 | + opacity: 0; | ||
639 | + -webkit-transform: scale(0.3); | ||
640 | + } | ||
641 | + 50% { | ||
642 | + opacity: 1; | ||
643 | + -webkit-transform: scale(1.05); | ||
644 | + } | ||
645 | + 70% { | ||
646 | + -webkit-transform: scale(0.9); | ||
647 | + } | ||
648 | + 100% { | ||
649 | + -webkit-transform: scale(1); | ||
650 | + } | ||
651 | +} | ||
652 | + | ||
653 | +@keyframes bouncein { | ||
654 | + 0% { | ||
655 | + opacity: 0; | ||
656 | + -webkit-transform: scale(0.3); | ||
657 | + transform: scale(0.3); | ||
658 | + } | ||
659 | + 50% { | ||
660 | + opacity: 1; | ||
661 | + -webkit-transform: scale(1.05); | ||
662 | + transform: scale(1.05); | ||
663 | + } | ||
664 | + 70% { | ||
665 | + -webkit-transform: scale(0.9); | ||
666 | + transform: scale(0.9); | ||
667 | + } | ||
668 | + 100% { | ||
669 | + -webkit-transform: scale(1); | ||
670 | + transform: scale(1); | ||
671 | + } | ||
672 | +} | ||
673 | + | ||
674 | +/* 弹入-从上 */ | ||
675 | + | ||
676 | +@-webkit-keyframes bounceinT { | ||
677 | + 0% { | ||
678 | + opacity: 0; | ||
679 | + -webkit-transform: translateY(-100px); | ||
680 | + } | ||
681 | + 60% { | ||
682 | + opacity: 1; | ||
683 | + -webkit-transform: translateY(30px); | ||
684 | + } | ||
685 | + 80% { | ||
686 | + -webkit-transform: translateY(-10px); | ||
687 | + } | ||
688 | + 100% { | ||
689 | + -webkit-transform: translateY(0); | ||
690 | + } | ||
691 | +} | ||
692 | + | ||
693 | +@keyframes bounceinT { | ||
694 | + 0% { | ||
695 | + opacity: 0; | ||
696 | + -webkit-transform: translateY(-100px); | ||
697 | + transform: translateY(-100px); | ||
698 | + } | ||
699 | + 60% { | ||
700 | + opacity: 1; | ||
701 | + -webkit-transform: translateY(30px); | ||
702 | + transform: translateY(30px); | ||
703 | + } | ||
704 | + 80% { | ||
705 | + -webkit-transform: translateY(-10px); | ||
706 | + transform: translateY(-10px); | ||
707 | + } | ||
708 | + 100% { | ||
709 | + -webkit-transform: translateY(0); | ||
710 | + transform: translateY(0); | ||
711 | + } | ||
712 | +} | ||
713 | + | ||
714 | +/* 弹入-从右 */ | ||
715 | + | ||
716 | +@-webkit-keyframes bounceinR { | ||
717 | + 0% { | ||
718 | + opacity: 0; | ||
719 | + -webkit-transform: translateX(100px); | ||
720 | + } | ||
721 | + 60% { | ||
722 | + opacity: 1; | ||
723 | + -webkit-transform: translateX(-30px); | ||
724 | + } | ||
725 | + 80% { | ||
726 | + -webkit-transform: translateX(10px); | ||
727 | + } | ||
728 | + 100% { | ||
729 | + -webkit-transform: translateX(0); | ||
730 | + } | ||
731 | +} | ||
732 | + | ||
733 | +@keyframes bounceinR { | ||
734 | + 0% { | ||
735 | + opacity: 0; | ||
736 | + -webkit-transform: translateX(100px); | ||
737 | + transform: translateX(100px); | ||
738 | + } | ||
739 | + 60% { | ||
740 | + opacity: 1; | ||
741 | + -webkit-transform: translateX(-30px); | ||
742 | + transform: translateX(-30px); | ||
743 | + } | ||
744 | + 80% { | ||
745 | + -webkit-transform: translateX(10px); | ||
746 | + transform: translateX(10px); | ||
747 | + } | ||
748 | + 100% { | ||
749 | + -webkit-transform: translateX(0); | ||
750 | + transform: translateX(0); | ||
751 | + } | ||
752 | +} | ||
753 | + | ||
754 | +/* 弹入-从下 */ | ||
755 | + | ||
756 | +@-webkit-keyframes bounceinB { | ||
757 | + 0% { | ||
758 | + opacity: 0; | ||
759 | + -webkit-transform: translateY(100px); | ||
760 | + } | ||
761 | + 60% { | ||
762 | + opacity: 1; | ||
763 | + -webkit-transform: translateY(-30px); | ||
764 | + } | ||
765 | + 80% { | ||
766 | + -webkit-transform: translateY(10px); | ||
767 | + } | ||
768 | + 100% { | ||
769 | + -webkit-transform: translateY(0); | ||
770 | + } | ||
771 | +} | ||
772 | + | ||
773 | +@keyframes bounceinB { | ||
774 | + 0% { | ||
775 | + opacity: 0; | ||
776 | + -webkit-transform: translateY(100px); | ||
777 | + transform: translateY(100px); | ||
778 | + } | ||
779 | + 60% { | ||
780 | + opacity: 1; | ||
781 | + -webkit-transform: translateY(-30px); | ||
782 | + transform: translateY(-30px); | ||
783 | + } | ||
784 | + 80% { | ||
785 | + -webkit-transform: translateY(10px); | ||
786 | + transform: translateY(10px); | ||
787 | + } | ||
788 | + 100% { | ||
789 | + -webkit-transform: translateY(0); | ||
790 | + transform: translateY(0); | ||
791 | + } | ||
792 | +} | ||
793 | + | ||
794 | +/* 弹入-从左 */ | ||
795 | + | ||
796 | +@-webkit-keyframes bounceinL { | ||
797 | + 0% { | ||
798 | + opacity: 0; | ||
799 | + -webkit-transform: translateX(-100px); | ||
800 | + } | ||
801 | + 60% { | ||
802 | + opacity: 1; | ||
803 | + -webkit-transform: translateX(30px); | ||
804 | + } | ||
805 | + 80% { | ||
806 | + -webkit-transform: translateX(-10px); | ||
807 | + } | ||
808 | + 100% { | ||
809 | + -webkit-transform: translateX(0); | ||
810 | + } | ||
811 | +} | ||
812 | + | ||
813 | +@keyframes bounceinL { | ||
814 | + 0% { | ||
815 | + opacity: 0; | ||
816 | + -webkit-transform: translateX(-100px); | ||
817 | + transform: translateX(-100px); | ||
818 | + } | ||
819 | + 60% { | ||
820 | + opacity: 1; | ||
821 | + -webkit-transform: translateX(30px); | ||
822 | + transform: translateX(30px); | ||
823 | + } | ||
824 | + 80% { | ||
825 | + -webkit-transform: translateX(-10px); | ||
826 | + transform: translateX(-10px); | ||
827 | + } | ||
828 | + 100% { | ||
829 | + -webkit-transform: translateX(0); | ||
830 | + transform: translateX(0); | ||
831 | + } | ||
832 | +} | ||
833 | + | ||
834 | +/* 弹出 */ | ||
835 | + | ||
836 | +@-webkit-keyframes bounceout { | ||
837 | + 0% { | ||
838 | + -webkit-transform: scale(1); | ||
839 | + } | ||
840 | + 25% { | ||
841 | + -webkit-transform: scale(0.95); | ||
842 | + } | ||
843 | + 50% { | ||
844 | + opacity: 1; | ||
845 | + -webkit-transform: scale(1.1); | ||
846 | + } | ||
847 | + 100% { | ||
848 | + opacity: 0; | ||
849 | + -webkit-transform: scale(0.3); | ||
850 | + } | ||
851 | +} | ||
852 | + | ||
853 | +@keyframes bounceout { | ||
854 | + 0% { | ||
855 | + -webkit-transform: scale(1); | ||
856 | + transform: scale(1); | ||
857 | + } | ||
858 | + 25% { | ||
859 | + -webkit-transform: scale(0.95); | ||
860 | + transform: scale(0.95); | ||
861 | + } | ||
862 | + 50% { | ||
863 | + opacity: 1; | ||
864 | + -webkit-transform: scale(1.1); | ||
865 | + transform: scale(1.1); | ||
866 | + } | ||
867 | + 100% { | ||
868 | + opacity: 0; | ||
869 | + -webkit-transform: scale(0.3); | ||
870 | + transform: scale(0.3); | ||
871 | + } | ||
872 | +} | ||
873 | + | ||
874 | +/* 弹出-向上*/ | ||
875 | + | ||
876 | +@-webkit-keyframes bounceoutT { | ||
877 | + 0% { | ||
878 | + -webkit-transform: translateY(0); | ||
879 | + } | ||
880 | + 20% { | ||
881 | + opacity: 1; | ||
882 | + -webkit-transform: translateY(20px); | ||
883 | + } | ||
884 | + 100% { | ||
885 | + opacity: 0; | ||
886 | + -webkit-transform: translateY(-100px); | ||
887 | + } | ||
888 | +} | ||
889 | + | ||
890 | +@keyframes bounceoutT { | ||
891 | + 0% { | ||
892 | + -webkit-transform: translateY(0); | ||
893 | + transform: translateY(0); | ||
894 | + } | ||
895 | + 20% { | ||
896 | + opacity: 1; | ||
897 | + -webkit-transform: translateY(20px); | ||
898 | + transform: translateY(20px); | ||
899 | + } | ||
900 | + 100% { | ||
901 | + opacity: 0; | ||
902 | + -webkit-transform: translateY(-100px); | ||
903 | + transform: translateY(-100px); | ||
904 | + } | ||
905 | +} | ||
906 | + | ||
907 | +/* 弹出-向右*/ | ||
908 | + | ||
909 | +@-webkit-keyframes bounceoutR { | ||
910 | + 0% { | ||
911 | + -webkit-transform: translateX(0); | ||
912 | + } | ||
913 | + 20% { | ||
914 | + opacity: 1; | ||
915 | + -webkit-transform: translateX(-20px); | ||
916 | + } | ||
917 | + 100% { | ||
918 | + opacity: 0; | ||
919 | + -webkit-transform: translateX(100px); | ||
920 | + } | ||
921 | +} | ||
922 | + | ||
923 | +@keyframes bounceoutR { | ||
924 | + 0% { | ||
925 | + -webkit-transform: translateX(0); | ||
926 | + transform: translateX(0); | ||
927 | + } | ||
928 | + 20% { | ||
929 | + opacity: 1; | ||
930 | + -webkit-transform: translateX(-20px); | ||
931 | + transform: translateX(-20px); | ||
932 | + } | ||
933 | + 100% { | ||
934 | + opacity: 0; | ||
935 | + -webkit-transform: translateX(100px); | ||
936 | + transform: translateX(100px); | ||
937 | + } | ||
938 | +} | ||
939 | + | ||
940 | +/* 弹出-向下 */ | ||
941 | + | ||
942 | +@-webkit-keyframes bounceoutB { | ||
943 | + 0% { | ||
944 | + -webkit-transform: translateY(0); | ||
945 | + } | ||
946 | + 20% { | ||
947 | + opacity: 1; | ||
948 | + -webkit-transform: translateY(-20px); | ||
949 | + } | ||
950 | + 100% { | ||
951 | + opacity: 0; | ||
952 | + -webkit-transform: translateY(100px); | ||
953 | + } | ||
954 | +} | ||
955 | + | ||
956 | +@keyframes bounceoutB { | ||
957 | + 0% { | ||
958 | + -webkit-transform: translateY(0); | ||
959 | + transform: translateY(0); | ||
960 | + } | ||
961 | + 20% { | ||
962 | + opacity: 1; | ||
963 | + -webkit-transform: translateY(-20px); | ||
964 | + transform: translateY(-20px); | ||
965 | + } | ||
966 | + 100% { | ||
967 | + opacity: 0; | ||
968 | + -webkit-transform: translateY(100px); | ||
969 | + transform: translateY(100px); | ||
970 | + } | ||
971 | +} | ||
972 | + | ||
973 | +/* 弹出-向左 */ | ||
974 | + | ||
975 | +@-webkit-keyframes bounceoutL { | ||
976 | + 0% { | ||
977 | + -webkit-transform: translateX(0); | ||
978 | + } | ||
979 | + 20% { | ||
980 | + opacity: 1; | ||
981 | + -webkit-transform: translateX(20px); | ||
982 | + } | ||
983 | + 100% { | ||
984 | + opacity: 0; | ||
985 | + -webkit-transform: translateX(-100px); | ||
986 | + } | ||
987 | +} | ||
988 | + | ||
989 | +@keyframes bounceoutL { | ||
990 | + 0% { | ||
991 | + -webkit-transform: translateX(0); | ||
992 | + transform: translateX(0); | ||
993 | + } | ||
994 | + 20% { | ||
995 | + opacity: 1; | ||
996 | + -webkit-transform: translateX(20px); | ||
997 | + transform: translateX(20px); | ||
998 | + } | ||
999 | + 100% { | ||
1000 | + opacity: 0; | ||
1001 | + -webkit-transform: translateX(-200px); | ||
1002 | + transform: translateX(-200px); | ||
1003 | + } | ||
1004 | +} | ||
1005 | + | ||
1006 | +/* 转入 */ | ||
1007 | + | ||
1008 | +@-webkit-keyframes rotatein { | ||
1009 | + 0% { | ||
1010 | + opacity: 0; | ||
1011 | + -webkit-transform: rotate(-200deg); | ||
1012 | + } | ||
1013 | + 100% { | ||
1014 | + opacity: 1; | ||
1015 | + -webkit-transform: rotate(0); | ||
1016 | + } | ||
1017 | +} | ||
1018 | + | ||
1019 | +@keyframes rotatein { | ||
1020 | + 0% { | ||
1021 | + opacity: 0; | ||
1022 | + -webkit-transform: rotate(-200deg); | ||
1023 | + transform: rotate(-200deg); | ||
1024 | + } | ||
1025 | + 100% { | ||
1026 | + opacity: 1; | ||
1027 | + -webkit-transform: rotate(0); | ||
1028 | + transform: rotate(0); | ||
1029 | + } | ||
1030 | +} | ||
1031 | + | ||
1032 | +/* 转入-从左上 */ | ||
1033 | + | ||
1034 | +@-webkit-keyframes rotateinLT { | ||
1035 | + 0% { | ||
1036 | + -webkit-transform-origin: left bottom; | ||
1037 | + -webkit-transform: rotate(-90deg); | ||
1038 | + opacity: 0; | ||
1039 | + } | ||
1040 | + 100% { | ||
1041 | + -webkit-transform-origin: left bottom; | ||
1042 | + -webkit-transform: rotate(0); | ||
1043 | + opacity: 1; | ||
1044 | + } | ||
1045 | +} | ||
1046 | + | ||
1047 | +@keyframes rotateinLT { | ||
1048 | + 0% { | ||
1049 | + -webkit-transform-origin: left bottom; | ||
1050 | + transform-origin: left bottom; | ||
1051 | + -webkit-transform: rotate(-90deg); | ||
1052 | + transform: rotate(-90deg); | ||
1053 | + opacity: 0; | ||
1054 | + } | ||
1055 | + 100% { | ||
1056 | + -webkit-transform-origin: left bottom; | ||
1057 | + transform-origin: left bottom; | ||
1058 | + -webkit-transform: rotate(0); | ||
1059 | + transform: rotate(0); | ||
1060 | + opacity: 1; | ||
1061 | + } | ||
1062 | +} | ||
1063 | + | ||
1064 | +/* 转入-从左下 */ | ||
1065 | + | ||
1066 | +@-webkit-keyframes rotateineftB { | ||
1067 | + 0% { | ||
1068 | + -webkit-transform-origin: left bottom; | ||
1069 | + -webkit-transform: rotate(90deg); | ||
1070 | + opacity: 0; | ||
1071 | + } | ||
1072 | + 100% { | ||
1073 | + -webkit-transform-origin: left bottom; | ||
1074 | + -webkit-transform: rotate(0); | ||
1075 | + opacity: 1; | ||
1076 | + } | ||
1077 | +} | ||
1078 | + | ||
1079 | +@keyframes rotateineftB { | ||
1080 | + 0% { | ||
1081 | + -webkit-transform-origin: left bottom; | ||
1082 | + transform-origin: left bottom; | ||
1083 | + -webkit-transform: rotate(90deg); | ||
1084 | + transform: rotate(90deg); | ||
1085 | + opacity: 0; | ||
1086 | + } | ||
1087 | + 100% { | ||
1088 | + -webkit-transform-origin: left bottom; | ||
1089 | + transform-origin: left bottom; | ||
1090 | + -webkit-transform: rotate(0); | ||
1091 | + transform: rotate(0); | ||
1092 | + opacity: 1; | ||
1093 | + } | ||
1094 | +} | ||
1095 | + | ||
1096 | +/* 转入-从右上 */ | ||
1097 | + | ||
1098 | +@-webkit-keyframes rotateinRT { | ||
1099 | + 0% { | ||
1100 | + -webkit-transform-origin: right bottom; | ||
1101 | + -webkit-transform: rotate(90deg); | ||
1102 | + opacity: 0; | ||
1103 | + } | ||
1104 | + 100% { | ||
1105 | + -webkit-transform-origin: right bottom; | ||
1106 | + -webkit-transform: rotate(0); | ||
1107 | + opacity: 1; | ||
1108 | + } | ||
1109 | +} | ||
1110 | + | ||
1111 | +@keyframes rotateinRT { | ||
1112 | + 0% { | ||
1113 | + -webkit-transform-origin: right bottom; | ||
1114 | + transform-origin: right bottom; | ||
1115 | + -webkit-transform: rotate(90deg); | ||
1116 | + transform: rotate(90deg); | ||
1117 | + opacity: 0; | ||
1118 | + } | ||
1119 | + 100% { | ||
1120 | + -webkit-transform-origin: right bottom; | ||
1121 | + transform-origin: right bottom; | ||
1122 | + -webkit-transform: rotate(0); | ||
1123 | + transform: rotate(0); | ||
1124 | + opacity: 1; | ||
1125 | + } | ||
1126 | +} | ||
1127 | + | ||
1128 | +/* 转入-从右下*/ | ||
1129 | + | ||
1130 | +@-webkit-keyframes rotateinRB { | ||
1131 | + 0% { | ||
1132 | + -webkit-transform-origin: right bottom; | ||
1133 | + -webkit-transform: rotate(-90deg); | ||
1134 | + opacity: 0; | ||
1135 | + } | ||
1136 | + 100% { | ||
1137 | + -webkit-transform-origin: right bottom; | ||
1138 | + -webkit-transform: rotate(0); | ||
1139 | + opacity: 1; | ||
1140 | + } | ||
1141 | +} | ||
1142 | + | ||
1143 | +@keyframes rotateinRB { | ||
1144 | + 0% { | ||
1145 | + -webkit-transform-origin: right bottom; | ||
1146 | + transform-origin: right bottom; | ||
1147 | + -webkit-transform: rotate(-90deg); | ||
1148 | + transform: rotate(-90deg); | ||
1149 | + opacity: 0; | ||
1150 | + } | ||
1151 | + 100% { | ||
1152 | + -webkit-transform-origin: right bottom; | ||
1153 | + transform-origin: right bottom; | ||
1154 | + -webkit-transform: rotate(0); | ||
1155 | + transform: rotate(0); | ||
1156 | + opacity: 1; | ||
1157 | + } | ||
1158 | +} | ||
1159 | + | ||
1160 | +/* 转出 */ | ||
1161 | + | ||
1162 | +@-webkit-keyframes rotateout { | ||
1163 | + 0% { | ||
1164 | + -webkit-transform-origin: center center; | ||
1165 | + -webkit-transform: rotate(0); | ||
1166 | + opacity: 1; | ||
1167 | + } | ||
1168 | + 100% { | ||
1169 | + -webkit-transform-origin: center center; | ||
1170 | + -webkit-transform: rotate(200deg); | ||
1171 | + opacity: 0; | ||
1172 | + } | ||
1173 | +} | ||
1174 | + | ||
1175 | +@keyframes rotateout { | ||
1176 | + 0% { | ||
1177 | + -webkit-transform-origin: center center; | ||
1178 | + transform-origin: center center; | ||
1179 | + -webkit-transform: rotate(0); | ||
1180 | + transform: rotate(0); | ||
1181 | + opacity: 1; | ||
1182 | + } | ||
1183 | + 100% { | ||
1184 | + -webkit-transform-origin: center center; | ||
1185 | + transform-origin: center center; | ||
1186 | + -webkit-transform: rotate(200deg); | ||
1187 | + transform: rotate(200deg); | ||
1188 | + opacity: 0; | ||
1189 | + } | ||
1190 | +} | ||
1191 | + | ||
1192 | +/* 转出-向左上 */ | ||
1193 | + | ||
1194 | +@-webkit-keyframes rotateoutLT { | ||
1195 | + 0% { | ||
1196 | + -webkit-transform-origin: left bottom; | ||
1197 | + -webkit-transform: rotate(0); | ||
1198 | + opacity: 1; | ||
1199 | + } | ||
1200 | + 100% { | ||
1201 | + -webkit-transform-origin: left bottom; | ||
1202 | + -webkit-transform: rotate(-90deg); | ||
1203 | + opacity: 0; | ||
1204 | + } | ||
1205 | +} | ||
1206 | + | ||
1207 | +@keyframes rotateoutLT { | ||
1208 | + 0% { | ||
1209 | + -webkit-transform-origin: left bottom; | ||
1210 | + transform-origin: left bottom; | ||
1211 | + -webkit-transform: rotate(0); | ||
1212 | + transform: rotate(0); | ||
1213 | + opacity: 1; | ||
1214 | + } | ||
1215 | + 100% { | ||
1216 | + -webkit-transform-origin: left bottom; | ||
1217 | + transform-origin: left bottom; | ||
1218 | + -webkit-transform: rotate(-90deg); | ||
1219 | + transform: rotate(-90deg); | ||
1220 | + opacity: 0; | ||
1221 | + } | ||
1222 | +} | ||
1223 | + | ||
1224 | +/* 转出-向左下 */ | ||
1225 | + | ||
1226 | +@-webkit-keyframes rotateoutLB { | ||
1227 | + 0% { | ||
1228 | + -webkit-transform-origin: left bottom; | ||
1229 | + -webkit-transform: rotate(0); | ||
1230 | + opacity: 1; | ||
1231 | + } | ||
1232 | + 100% { | ||
1233 | + -webkit-transform-origin: left bottom; | ||
1234 | + -webkit-transform: rotate(90deg); | ||
1235 | + opacity: 0; | ||
1236 | + } | ||
1237 | +} | ||
1238 | + | ||
1239 | +@keyframes rotateoutLB { | ||
1240 | + 0% { | ||
1241 | + -webkit-transform-origin: left bottom; | ||
1242 | + transform-origin: left bottom; | ||
1243 | + -webkit-transform: rotate(0); | ||
1244 | + transform: rotate(0); | ||
1245 | + opacity: 1; | ||
1246 | + } | ||
1247 | + 100% { | ||
1248 | + -webkit-transform-origin: left bottom; | ||
1249 | + transform-origin: left bottom; | ||
1250 | + -webkit-transform: rotate(90deg); | ||
1251 | + transform: rotate(90deg); | ||
1252 | + opacity: 0; | ||
1253 | + } | ||
1254 | +} | ||
1255 | + | ||
1256 | +/* 转出-向右上 */ | ||
1257 | + | ||
1258 | +@-webkit-keyframes rotateoutRT { | ||
1259 | + 0% { | ||
1260 | + -webkit-transform-origin: right bottom; | ||
1261 | + -webkit-transform: rotate(0); | ||
1262 | + opacity: 1; | ||
1263 | + } | ||
1264 | + 100% { | ||
1265 | + -webkit-transform-origin: right bottom; | ||
1266 | + -webkit-transform: rotate(90deg); | ||
1267 | + opacity: 0; | ||
1268 | + } | ||
1269 | +} | ||
1270 | + | ||
1271 | +@keyframes rotateoutRT { | ||
1272 | + 0% { | ||
1273 | + -webkit-transform-origin: right bottom; | ||
1274 | + transform-origin: right bottom; | ||
1275 | + -webkit-transform: rotate(0); | ||
1276 | + transform: rotate(0); | ||
1277 | + opacity: 1; | ||
1278 | + } | ||
1279 | + 100% { | ||
1280 | + -webkit-transform-origin: right bottom; | ||
1281 | + transform-origin: right bottom; | ||
1282 | + -webkit-transform: rotate(90deg); | ||
1283 | + transform: rotate(90deg); | ||
1284 | + opacity: 0; | ||
1285 | + } | ||
1286 | +} | ||
1287 | + | ||
1288 | +/* 转出-向右下 */ | ||
1289 | + | ||
1290 | +@-webkit-keyframes rotateoutBR { | ||
1291 | + 0% { | ||
1292 | + -webkit-transform-origin: right bottom; | ||
1293 | + -webkit-transform: rotate(0); | ||
1294 | + opacity: 1; | ||
1295 | + } | ||
1296 | + 100% { | ||
1297 | + -webkit-transform-origin: right bottom; | ||
1298 | + -webkit-transform: rotate(-90deg); | ||
1299 | + opacity: 0; | ||
1300 | + } | ||
1301 | +} | ||
1302 | + | ||
1303 | +@keyframes rotateoutBR { | ||
1304 | + 0% { | ||
1305 | + -webkit-transform-origin: right bottom; | ||
1306 | + transform-origin: right bottom; | ||
1307 | + -webkit-transform: rotate(0); | ||
1308 | + transform: rotate(0); | ||
1309 | + opacity: 1; | ||
1310 | + } | ||
1311 | + 100% { | ||
1312 | + -webkit-transform-origin: right bottom; | ||
1313 | + transform-origin: right bottom; | ||
1314 | + -webkit-transform: rotate(-90deg); | ||
1315 | + transform: rotate(-90deg); | ||
1316 | + opacity: 0; | ||
1317 | + } | ||
1318 | +} | ||
1319 | + | ||
1320 | +/* 翻转 */ | ||
1321 | + | ||
1322 | +@-webkit-keyframes flip { | ||
1323 | + 0% { | ||
1324 | + -webkit-transform: perspective(400px) rotateY(0); | ||
1325 | + -webkit-animation-timing-function: ease-out; | ||
1326 | + } | ||
1327 | + 40% { | ||
1328 | + -webkit-transform: perspective(400px) translateZ(150px) rotateY(170deg); | ||
1329 | + -webkit-animation-timing-function: ease-out; | ||
1330 | + } | ||
1331 | + 50% { | ||
1332 | + -webkit-transform: perspective(400px) translateZ(150px) rotateY(190deg) scale(1); | ||
1333 | + -webkit-animation-timing-function: ease-in; | ||
1334 | + } | ||
1335 | + 80% { | ||
1336 | + -webkit-transform: perspective(400px) rotateY(360deg) scale(0.95); | ||
1337 | + -webkit-animation-timing-function: ease-in; | ||
1338 | + } | ||
1339 | + 100% { | ||
1340 | + -webkit-transform: perspective(400px) scale(1); | ||
1341 | + -webkit-animation-timing-function: ease-in; | ||
1342 | + } | ||
1343 | +} | ||
1344 | + | ||
1345 | +@keyframes flip { | ||
1346 | + 0% { | ||
1347 | + -webkit-transform: perspective(400px) rotateY(0); | ||
1348 | + transform: perspective(400px) rotateY(0); | ||
1349 | + -webkit-animation-timing-function: ease-out; | ||
1350 | + animation-timing-function: ease-out; | ||
1351 | + } | ||
1352 | + 40% { | ||
1353 | + -webkit-transform: perspective(400px) translateZ(150px) rotateY(170deg); | ||
1354 | + transform: perspective(400px) translateZ(150px) rotateY(170deg); | ||
1355 | + -webkit-animation-timing-function: ease-out; | ||
1356 | + animation-timing-function: ease-out; | ||
1357 | + } | ||
1358 | + 50% { | ||
1359 | + -webkit-transform: perspective(400px) translateZ(150px) rotateY(190deg) scale(1); | ||
1360 | + transform: perspective(400px) translateZ(150px) rotateY(190deg) scale(1); | ||
1361 | + -webkit-animation-timing-function: ease-in; | ||
1362 | + animation-timing-function: ease-in; | ||
1363 | + } | ||
1364 | + 80% { | ||
1365 | + -webkit-transform: perspective(400px) rotateY(360deg) scale(0.95); | ||
1366 | + transform: perspective(400px) rotateY(360deg) scale(0.95); | ||
1367 | + -webkit-animation-timing-function: ease-in; | ||
1368 | + animation-timing-function: ease-in; | ||
1369 | + } | ||
1370 | + 100% { | ||
1371 | + -webkit-transform: perspective(400px) scale(1); | ||
1372 | + transform: perspective(400px) scale(1); | ||
1373 | + -webkit-animation-timing-function: ease-in; | ||
1374 | + animation-timing-function: ease-in; | ||
1375 | + } | ||
1376 | +} | ||
1377 | + | ||
1378 | +/* 翻入-X轴 */ | ||
1379 | + | ||
1380 | +@-webkit-keyframes flipinX { | ||
1381 | + 0% { | ||
1382 | + -webkit-transform: perspective(400px) rotateX(90deg); | ||
1383 | + opacity: 0; | ||
1384 | + } | ||
1385 | + 40% { | ||
1386 | + -webkit-transform: perspective(400px) rotateX(-10deg); | ||
1387 | + } | ||
1388 | + 70% { | ||
1389 | + -webkit-transform: perspective(400px) rotateX(10deg); | ||
1390 | + } | ||
1391 | + 100% { | ||
1392 | + -webkit-transform: perspective(400px) rotateX(0); | ||
1393 | + opacity: 1; | ||
1394 | + } | ||
1395 | +} | ||
1396 | + | ||
1397 | +@keyframes flipinX { | ||
1398 | + 0% { | ||
1399 | + -webkit-transform: perspective(400px) rotateX(90deg); | ||
1400 | + transform: perspective(400px) rotateX(90deg); | ||
1401 | + opacity: 0; | ||
1402 | + } | ||
1403 | + 40% { | ||
1404 | + -webkit-transform: perspective(400px) rotateX(-10deg); | ||
1405 | + transform: perspective(400px) rotateX(-10deg); | ||
1406 | + } | ||
1407 | + 70% { | ||
1408 | + -webkit-transform: perspective(400px) rotateX(10deg); | ||
1409 | + transform: perspective(400px) rotateX(10deg); | ||
1410 | + } | ||
1411 | + 100% { | ||
1412 | + -webkit-transform: perspective(400px) rotateX(0); | ||
1413 | + transform: perspective(400px) rotateX(0); | ||
1414 | + opacity: 1; | ||
1415 | + } | ||
1416 | +} | ||
1417 | + | ||
1418 | +/* 翻入-Y轴 */ | ||
1419 | + | ||
1420 | +@-webkit-keyframes flipinY { | ||
1421 | + 0% { | ||
1422 | + -webkit-transform: perspective(400px) rotateY(90deg); | ||
1423 | + opacity: 0; | ||
1424 | + } | ||
1425 | + 40% { | ||
1426 | + -webkit-transform: perspective(400px) rotateY(-10deg); | ||
1427 | + } | ||
1428 | + 70% { | ||
1429 | + -webkit-transform: perspective(400px) rotateY(10deg); | ||
1430 | + } | ||
1431 | + 100% { | ||
1432 | + -webkit-transform: perspective(400px) rotateY(0); | ||
1433 | + opacity: 1; | ||
1434 | + } | ||
1435 | +} | ||
1436 | + | ||
1437 | +@keyframes flipinY { | ||
1438 | + 0% { | ||
1439 | + -webkit-transform: perspective(400px) rotateY(90deg); | ||
1440 | + transform: perspective(400px) rotateY(90deg); | ||
1441 | + opacity: 0; | ||
1442 | + } | ||
1443 | + 40% { | ||
1444 | + -webkit-transform: perspective(400px) rotateY(-10deg); | ||
1445 | + transform: perspective(400px) rotateY(-10deg); | ||
1446 | + } | ||
1447 | + 70% { | ||
1448 | + -webkit-transform: perspective(400px) rotateY(10deg); | ||
1449 | + transform: perspective(400px) rotateY(10deg); | ||
1450 | + } | ||
1451 | + 100% { | ||
1452 | + -webkit-transform: perspective(400px) rotateY(0); | ||
1453 | + transform: perspective(400px) rotateY(0); | ||
1454 | + opacity: 1; | ||
1455 | + } | ||
1456 | +} | ||
1457 | + | ||
1458 | +/* 翻出-X轴 */ | ||
1459 | + | ||
1460 | +@-webkit-keyframes flipoutX { | ||
1461 | + 0% { | ||
1462 | + -webkit-transform: perspective(400px) rotateX(0); | ||
1463 | + opacity: 1; | ||
1464 | + } | ||
1465 | + 100% { | ||
1466 | + -webkit-transform: perspective(400px) rotateX(90deg); | ||
1467 | + opacity: 0; | ||
1468 | + } | ||
1469 | +} | ||
1470 | + | ||
1471 | +@keyframes flipoutX { | ||
1472 | + 0% { | ||
1473 | + -webkit-transform: perspective(400px) rotateX(0); | ||
1474 | + transform: perspective(400px) rotateX(0); | ||
1475 | + opacity: 1; | ||
1476 | + } | ||
1477 | + 100% { | ||
1478 | + -webkit-transform: perspective(400px) rotateX(90deg); | ||
1479 | + transform: perspective(400px) rotateX(90deg); | ||
1480 | + opacity: 0; | ||
1481 | + } | ||
1482 | +} | ||
1483 | + | ||
1484 | +/* 翻出-Y轴 */ | ||
1485 | + | ||
1486 | +@-webkit-keyframes flipoutY { | ||
1487 | + 0% { | ||
1488 | + -webkit-transform: perspective(400px) rotateY(0); | ||
1489 | + opacity: 1; | ||
1490 | + } | ||
1491 | + 100% { | ||
1492 | + -webkit-transform: perspective(400px) rotateY(90deg); | ||
1493 | + opacity: 0; | ||
1494 | + } | ||
1495 | +} | ||
1496 | + | ||
1497 | +@keyframes flipoutY { | ||
1498 | + 0% { | ||
1499 | + -webkit-transform: perspective(400px) rotateY(0); | ||
1500 | + transform: perspective(400px) rotateY(0); | ||
1501 | + opacity: 1; | ||
1502 | + } | ||
1503 | + 100% { | ||
1504 | + -webkit-transform: perspective(400px) rotateY(90deg); | ||
1505 | + transform: perspective(400px) rotateY(90deg); | ||
1506 | + opacity: 0; | ||
1507 | + } | ||
1508 | +} | ||
1509 | + | ||
1510 | +/* 闪烁 */ | ||
1511 | + | ||
1512 | +@-webkit-keyframes flash { | ||
1513 | + 0%, | ||
1514 | + 50%, | ||
1515 | + 100% { | ||
1516 | + opacity: 1; | ||
1517 | + } | ||
1518 | + 25%, | ||
1519 | + 75% { | ||
1520 | + opacity: 0; | ||
1521 | + } | ||
1522 | +} | ||
1523 | + | ||
1524 | +@keyframes flash { | ||
1525 | + 0%, | ||
1526 | + 50%, | ||
1527 | + 100% { | ||
1528 | + opacity: 1; | ||
1529 | + } | ||
1530 | + 25%, | ||
1531 | + 75% { | ||
1532 | + opacity: 0; | ||
1533 | + } | ||
1534 | +} | ||
1535 | + | ||
1536 | +/* 震颤 */ | ||
1537 | + | ||
1538 | +@-webkit-keyframes shake { | ||
1539 | + 0%, | ||
1540 | + 100% { | ||
1541 | + -webkit-transform: translateX(0); | ||
1542 | + } | ||
1543 | + 10%, | ||
1544 | + 30%, | ||
1545 | + 50%, | ||
1546 | + 70%, | ||
1547 | + 90% { | ||
1548 | + -webkit-transform: translateX(-10px); | ||
1549 | + } | ||
1550 | + 20%, | ||
1551 | + 40%, | ||
1552 | + 60%, | ||
1553 | + 80% { | ||
1554 | + -webkit-transform: translateX(10px); | ||
1555 | + } | ||
1556 | +} | ||
1557 | + | ||
1558 | +@keyframes shake { | ||
1559 | + 0%, | ||
1560 | + 100% { | ||
1561 | + -webkit-transform: translateX(0); | ||
1562 | + transform: translateX(0); | ||
1563 | + } | ||
1564 | + 10%, | ||
1565 | + 30%, | ||
1566 | + 50%, | ||
1567 | + 70%, | ||
1568 | + 90% { | ||
1569 | + -webkit-transform: translateX(-10px); | ||
1570 | + transform: translateX(-10px); | ||
1571 | + } | ||
1572 | + 20%, | ||
1573 | + 40%, | ||
1574 | + 60%, | ||
1575 | + 80% { | ||
1576 | + -webkit-transform: translateX(10px); | ||
1577 | + transform: translateX(10px); | ||
1578 | + } | ||
1579 | +} | ||
1580 | + | ||
1581 | +/* 摇摆 */ | ||
1582 | + | ||
1583 | +@-webkit-keyframes swing { | ||
1584 | + 20% { | ||
1585 | + -webkit-transform: rotate(30deg); | ||
1586 | + } | ||
1587 | + 40% { | ||
1588 | + -webkit-transform: rotate(-20deg); | ||
1589 | + } | ||
1590 | + 60% { | ||
1591 | + -webkit-transform: rotate(10deg); | ||
1592 | + } | ||
1593 | + 80% { | ||
1594 | + -webkit-transform: rotate(-10deg); | ||
1595 | + } | ||
1596 | + 100% { | ||
1597 | + -webkit-transform: rotate(0); | ||
1598 | + } | ||
1599 | +} | ||
1600 | + | ||
1601 | +@keyframes swing { | ||
1602 | + 20% { | ||
1603 | + -webkit-transform: rotate(30deg); | ||
1604 | + transform: rotate(30deg); | ||
1605 | + } | ||
1606 | + 40% { | ||
1607 | + -webkit-transform: rotate(-20deg); | ||
1608 | + transform: rotate(-20deg); | ||
1609 | + } | ||
1610 | + 60% { | ||
1611 | + -webkit-transform: rotate(10deg); | ||
1612 | + transform: rotate(10deg); | ||
1613 | + } | ||
1614 | + 80% { | ||
1615 | + -webkit-transform: rotate(-10deg); | ||
1616 | + transform: rotate(-10deg); | ||
1617 | + } | ||
1618 | + 100% { | ||
1619 | + -webkit-transform: rotate(0); | ||
1620 | + transform: rotate(0); | ||
1621 | + } | ||
1622 | +} | ||
1623 | + | ||
1624 | +/* 摇晃 */ | ||
1625 | + | ||
1626 | +@-webkit-keyframes wobble { | ||
1627 | + 0% { | ||
1628 | + -webkit-transform: translateX(0); | ||
1629 | + } | ||
1630 | + 15% { | ||
1631 | + -webkit-transform: translateX(-100px) rotate(-5deg); | ||
1632 | + } | ||
1633 | + 30% { | ||
1634 | + -webkit-transform: translateX(80px) rotate(3deg); | ||
1635 | + } | ||
1636 | + 45% { | ||
1637 | + -webkit-transform: translateX(-65px) rotate(-3deg); | ||
1638 | + } | ||
1639 | + 60% { | ||
1640 | + -webkit-transform: translateX(40px) rotate(2deg); | ||
1641 | + } | ||
1642 | + 75% { | ||
1643 | + -webkit-transform: translateX(-20px) rotate(-1deg); | ||
1644 | + } | ||
1645 | + 100% { | ||
1646 | + -webkit-transform: translateX(0); | ||
1647 | + } | ||
1648 | +} | ||
1649 | + | ||
1650 | +@keyframes wobble { | ||
1651 | + 0% { | ||
1652 | + -webkit-transform: translateX(0); | ||
1653 | + transform: translateX(0); | ||
1654 | + } | ||
1655 | + 15% { | ||
1656 | + -webkit-transform: translateX(-100px) rotate(-5deg); | ||
1657 | + transform: translateX(-100px) rotate(-5deg); | ||
1658 | + } | ||
1659 | + 30% { | ||
1660 | + -webkit-transform: translateX(80px) rotate(3deg); | ||
1661 | + transform: translateX(80px) rotate(3deg); | ||
1662 | + } | ||
1663 | + 45% { | ||
1664 | + -webkit-transform: translateX(-65px) rotate(-3deg); | ||
1665 | + transform: translateX(-65px) rotate(-3deg); | ||
1666 | + } | ||
1667 | + 60% { | ||
1668 | + -webkit-transform: translateX(40px) rotate(2deg); | ||
1669 | + transform: translateX(40px) rotate(2deg); | ||
1670 | + } | ||
1671 | + 75% { | ||
1672 | + -webkit-transform: translateX(-20px) rotate(-1deg); | ||
1673 | + transform: translateX(-20px) rotate(-1deg); | ||
1674 | + } | ||
1675 | + 100% { | ||
1676 | + -webkit-transform: translateX(0); | ||
1677 | + transform: translateX(0); | ||
1678 | + } | ||
1679 | +} | ||
1680 | + | ||
1681 | +/* 震铃 */ | ||
1682 | + | ||
1683 | +@-webkit-keyframes ring { | ||
1684 | + 0% { | ||
1685 | + -webkit-transform: scale(1); | ||
1686 | + } | ||
1687 | + 10%, | ||
1688 | + 20% { | ||
1689 | + -webkit-transform: scale(0.9) rotate(-3deg); | ||
1690 | + } | ||
1691 | + 30%, | ||
1692 | + 50%, | ||
1693 | + 70%, | ||
1694 | + 90% { | ||
1695 | + -webkit-transform: scale(1.1) rotate(3deg); | ||
1696 | + } | ||
1697 | + 40%, | ||
1698 | + 60%, | ||
1699 | + 80% { | ||
1700 | + -webkit-transform: scale(1.1) rotate(-3deg); | ||
1701 | + } | ||
1702 | + 100% { | ||
1703 | + -webkit-transform: scale(1) rotate(0); | ||
1704 | + } | ||
1705 | +} | ||
1706 | + | ||
1707 | +@keyframes ring { | ||
1708 | + 0% { | ||
1709 | + -webkit-transform: scale(1); | ||
1710 | + transform: scale(1); | ||
1711 | + } | ||
1712 | + 10%, | ||
1713 | + 20% { | ||
1714 | + -webkit-transform: scale(0.9) rotate(-3deg); | ||
1715 | + transform: scale(0.9) rotate(-3deg); | ||
1716 | + } | ||
1717 | + 30%, | ||
1718 | + 50%, | ||
1719 | + 70%, | ||
1720 | + 90% { | ||
1721 | + -webkit-transform: scale(1.1) rotate(3deg); | ||
1722 | + transform: scale(1.1) rotate(3deg); | ||
1723 | + } | ||
1724 | + 40%, | ||
1725 | + 60%, | ||
1726 | + 80% { | ||
1727 | + -webkit-transform: scale(1.1) rotate(-3deg); | ||
1728 | + transform: scale(1.1) rotate(-3deg); | ||
1729 | + } | ||
1730 | + 100% { | ||
1731 | + -webkit-transform: scale(1) rotate(0); | ||
1732 | + transform: scale(1) rotate(0); | ||
1733 | + } | ||
1734 | +} |
app.js
0 → 100644
1 | +//app.js | ||
2 | +// import md5 from 'utils/md5.js'; | ||
3 | +const App = require('./utils/ald-stat.js').App; | ||
4 | + | ||
5 | +const ald = require('./utils/ald-stat.js'); | ||
6 | +App({ | ||
7 | + onLaunch: function () { | ||
8 | + let that=this; | ||
9 | + wx.login({ | ||
10 | + success: (res) => { | ||
11 | + let url = 'public/getSessionKey'; | ||
12 | + let params = { | ||
13 | + code: res.code | ||
14 | + } | ||
15 | + that.post(url, params).then((res) => { | ||
16 | + | ||
17 | + wx.setStorageSync('openid', res.openid); | ||
18 | + wx.setStorageSync('session_key', res.session_key); | ||
19 | + //记录小程序打开次数 | ||
20 | + that.setStatisticsOpenTimes(res.openid) | ||
21 | + // 调用sendSession方法,将session_key以参数形式传入 | ||
22 | + that.aldstat.sendSession(res.session_key); | ||
23 | + // 调用sendOpenid方法,将openid以参数形式传入 | ||
24 | + that.aldstat.sendOpenid(res.openid); | ||
25 | + }).catch((errMsg) => { | ||
26 | + console.log(errMsg) | ||
27 | + }) | ||
28 | + } | ||
29 | + }) | ||
30 | + }, | ||
31 | + | ||
32 | + onShow: function () { | ||
33 | + }, | ||
34 | + /** | ||
35 | + * 自定义post函数,返回Promise | ||
36 | + * +------------------- | ||
37 | + * @param {String} url 接口网址 | ||
38 | + * @param {arrayObject} data 要传的数组对象 like: {name: 'name', age: 32} | ||
39 | + * +------------------- | ||
40 | + * @return {Promise} promise 返回promise供后续操作 | ||
41 | + */ | ||
42 | + post: function (url, data, headerParams) { | ||
43 | + wx.showNavigationBarLoading() | ||
44 | + wx.showLoading({ | ||
45 | + title: '加载中', | ||
46 | + }) | ||
47 | + var promise = new Promise((resolve, reject) => { | ||
48 | + let that = this; | ||
49 | + let postData = data; | ||
50 | + let baseUrl = 'https://shuhou.superkangaroo.net/api/wxapp/'; | ||
51 | + //网络请求 | ||
52 | + let header = { | ||
53 | + 'content-type': 'application/x-www-form-urlencoded' | ||
54 | + } | ||
55 | + header = Object.assign(header, headerParams) | ||
56 | + wx.request({ | ||
57 | + url: baseUrl + url, | ||
58 | + data: postData, | ||
59 | + method: 'POST', | ||
60 | + header: header, | ||
61 | + success: function (res) {//返回取得的数据 | ||
62 | + if (res.data.code == '20000') { | ||
63 | + resolve(res.data.data); | ||
64 | + } else if (res.data.code == '40001') {//返回错误提示信息 | ||
65 | + wx.showModal({ | ||
66 | + title: '提示', | ||
67 | + content: res.data.msg, | ||
68 | + showCancel: false, | ||
69 | + success: function (res) { | ||
70 | + if (res.confirm) { | ||
71 | + wx.removeStorageSync('token'); | ||
72 | + wx.navigateTo({ | ||
73 | + url: '/pages/start/start', | ||
74 | + }) | ||
75 | + } | ||
76 | + } | ||
77 | + }) | ||
78 | + } else if (res.data.code == '40000') { | ||
79 | + wx.showModal({ | ||
80 | + title: '提示', | ||
81 | + content: res.data.msg, | ||
82 | + showCancel: false, | ||
83 | + success: function (res) { } | ||
84 | + }) | ||
85 | + } else if (res.data.code == '40005'){ | ||
86 | + | ||
87 | + } else if (res.data.code == '40006'){ | ||
88 | + | ||
89 | + } | ||
90 | + else { | ||
91 | + wx.showModal({ | ||
92 | + title: '提示', | ||
93 | + content: res.data.msg, | ||
94 | + showCancel: false, | ||
95 | + }) | ||
96 | + reject(res.data) | ||
97 | + } | ||
98 | + setTimeout(function () { | ||
99 | + wx.hideLoading() | ||
100 | + wx.hideNavigationBarLoading() | ||
101 | + }, 500) | ||
102 | + }, | ||
103 | + error: function (e) { | ||
104 | + reject('网络出错'); | ||
105 | + // wx.hideLoading() | ||
106 | + wx.hideNavigationBarLoading() | ||
107 | + } | ||
108 | + }) | ||
109 | + }); | ||
110 | + return promise; | ||
111 | + }, | ||
112 | + | ||
113 | + //根据年月日获取(星期等信息)////later=0 当前 later=1明天 later=2后天 | ||
114 | + dateLater(later) { | ||
115 | + let dateObj = {}; | ||
116 | + let show_day = new Array('星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'); | ||
117 | + let date = new Date(); | ||
118 | + date.setDate(date.getDate() + later); | ||
119 | + let day = date.getDay(); | ||
120 | + dateObj.year = date.getFullYear(); | ||
121 | + dateObj.month = ((date.getMonth() + 1) < 10 ? ("0" + (date.getMonth() + 1)) : date.getMonth() + 1); | ||
122 | + dateObj.day = (date.getDate() < 10 ? ("0" + date.getDate()) : date.getDate()); | ||
123 | + dateObj.week = show_day[day]; | ||
124 | + dateObj.dataday = date.getFullYear() + '-' + ((date.getMonth() + 1) < 10 ? ("0" + (date.getMonth() + 1)) : date.getMonth() + 1) + '-' + (date.getDate() < 10 ? ("0" + date.getDate()) : date.getDate()); | ||
125 | + dateObj.houser = date.getHours();//当前时间点 | ||
126 | + console.log(date.getHours()) | ||
127 | + dateObj.housers = (date.getHours() < 10 ? ("0" + date.getHours()) : date.getHours()) + ':00:00';//当前时间点 | ||
128 | + dateObj.datadayhouser = date.getFullYear() + '/' + ((date.getMonth() + 1) < 10 ? ("0" + (date.getMonth() + 1)) : date.getMonth() + 1) + '/' + (date.getDate() < 10 ? ("0" + date.getDate()) : date.getDate()) + ' ' + (date.getHours() < 10 ? ("0" + date.getHours()) : date.getHours()) + ':00';//当前时间并时间点 | ||
129 | + return dateObj; | ||
130 | + }, | ||
131 | + //记录打开小程序日志 | ||
132 | + setStatisticsOpenTimes(openid){ | ||
133 | + let that=this; | ||
134 | + let url = 'index/setStatisticsOpenTimes'; | ||
135 | + let params={ | ||
136 | + 'doctor_id': that.globalData.doctor_id, | ||
137 | + 'openid':openid | ||
138 | + } | ||
139 | + that.post(url,params).then((res)=>{ | ||
140 | + | ||
141 | + }).catch((errMsg)=>{ | ||
142 | + console.log(errMsg) | ||
143 | + }) | ||
144 | + }, | ||
145 | + //记录页面访问日志 | ||
146 | + setStatisticsVisitorLog(page){ | ||
147 | + let that = this; | ||
148 | + wx.login({ | ||
149 | + success: (res) => { | ||
150 | + let url = 'public/getSessionKey'; | ||
151 | + let params = { | ||
152 | + code: res.code | ||
153 | + } | ||
154 | + that.post(url, params).then((res) => { | ||
155 | + let url = 'index/setStatisticsVisitorLog'; | ||
156 | + let params = { | ||
157 | + 'doctor_id': that.globalData.doctorid, | ||
158 | + 'page': page, | ||
159 | + 'openid': res.openid | ||
160 | + } | ||
161 | + that.post(url, params).then((res) => { | ||
162 | + | ||
163 | + }).catch((errMsg) => { | ||
164 | + console.log(errMsg) | ||
165 | + }) | ||
166 | + }).catch((errMsg) => { | ||
167 | + console.log(errMsg) | ||
168 | + }) | ||
169 | + } | ||
170 | + }) | ||
171 | + }, | ||
172 | + globalData: { | ||
173 | + userInfo: '', | ||
174 | + doctorid: 0,//字符串id,用于获取医生详情 | ||
175 | + doctor_id: 0//本小程序中使用的id | ||
176 | + } | ||
177 | +}) |
app.json
0 → 100644
1 | +{ | ||
2 | + | ||
3 | + "pages": [ | ||
4 | + "pages/start/start", | ||
5 | + "pages/index/index", | ||
6 | + "pages/aboutme/aboutme", | ||
7 | + "pages/addrecord/addrecord", | ||
8 | + "pages/addfile/addfile", | ||
9 | + "pages/introduce/introduce", | ||
10 | + "pages/my/my", | ||
11 | + "pages/opinion/opinion", | ||
12 | + "pages/record/record", | ||
13 | + "pages/normal/normal", | ||
14 | + "pages/file_manage/file_manage", | ||
15 | + "pages/article/article", | ||
16 | + "pages/mold/mold", | ||
17 | + "pages/line/line", | ||
18 | + "pages/article_detail/article_detail", | ||
19 | + "pages/ence_push/ence_push", | ||
20 | + "pages/map/map", | ||
21 | + "pages/editfile/editfile", | ||
22 | + "pages/editrecord/editrecord", | ||
23 | + "pages/agreement/agreement" | ||
24 | + ], | ||
25 | + "window": { | ||
26 | + "backgroundTextStyle": "light", | ||
27 | + "navigationBarBackgroundColor": "#3AA0EA", | ||
28 | + "navigationBarTitleText": "术后小程序", | ||
29 | + "navigationBarTextStyle": "white", | ||
30 | + "enablePullDownRefresh": false | ||
31 | + }, | ||
32 | + "tabBar": { | ||
33 | + "color": "#A1A1A1", | ||
34 | + "selectedColor": "#1CB9FA", | ||
35 | + "list": [ | ||
36 | + { | ||
37 | + "pagePath": "pages/index/index", | ||
38 | + "text": "血项测评", | ||
39 | + "iconPath": "img/x2.png", | ||
40 | + "selectedIconPath": "img/x1.png" | ||
41 | + }, | ||
42 | + { | ||
43 | + "pagePath": "pages/my/my", | ||
44 | + "text": "我的", | ||
45 | + "iconPath": "img/w2.png", | ||
46 | + "selectedIconPath": "img/w1.png" | ||
47 | + } | ||
48 | + ] | ||
49 | + } | ||
50 | +} |
app.wxss
0 → 100644
1 | +/**app.wxss**/ | ||
2 | +@import "/pages/template/online-push.wxss"; | ||
3 | +.nodata{ | ||
4 | + color:#999; | ||
5 | + font-size:30rpx; | ||
6 | + margin-top:36%; | ||
7 | + left:50%; | ||
8 | + transform:translateX(-50%); | ||
9 | + position: absolute; | ||
10 | + z-index:100; | ||
11 | +} | ||
12 | +.notest{ | ||
13 | + margin: 80rpx 0 80rpx 0; | ||
14 | + color:#999; | ||
15 | + font-size:38rpx; | ||
16 | + text-align: center; | ||
17 | +} | ||
18 | +.addnomore{ | ||
19 | + padding:20rpx 0; | ||
20 | + color:#999; | ||
21 | + font-size:28rpx; | ||
22 | + text-align: center; | ||
23 | +} | ||
24 | +.wxParse-strong .WxEmojiView{ | ||
25 | + font-weight:bold; | ||
26 | +} | ||
27 | +.wxParse-img{ | ||
28 | + width:100% !important; | ||
29 | +} | ||
30 | +@font-face {font-family: "iconfont"; | ||
31 | + src: url('//at.alicdn.com/t/font_873289_cq7godatqkt.eot?t=1539597789388'); /* IE9*/ | ||
32 | + src: url('//at.alicdn.com/t/font_873289_cq7godatqkt.eot?t=1539597789388#iefix') format('embedded-opentype'), /* IE6-IE8 */ | ||
33 | + url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAToAAsAAAAAB1wAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFY8kUh1Y21hcAAAAYAAAABfAAABnLQEHHVnbHlmAAAB4AAAAP0AAAEc9+4YrGhlYWQAAALgAAAALwAAADYS9VG4aGhlYQAAAxAAAAAgAAAAJAfgA4RobXR4AAADMAAAAA4AAAAQEAAAAGxvY2EAAANAAAAACgAAAAoAygBgbWF4cAAAA0wAAAAeAAAAIAESADBuYW1lAAADbAAAAUUAAAJtPlT+fXBvc3QAAAS0AAAAMQAAAEK3MBnAeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2BkYWCcwMDKwMHUyXSGgYGhH0IzvmYwYuRgYGBiYGVmwAoC0lxTGByeST9rZm7438AQw9zA0AAUZgTJAQDpFQyBeJztkLENgDAMBM9JQBFiA/pUlIiBqNgju3qN4DgUDMFbZ/lfXxmYgGjsRgK5EbouS8XzyOJ54jSfbQLopkVra9/LJd7IfsXelJlfq+/jdbF/bdB/rGXgeR0QHlwuFDoAeJw9jjFOw0AQRefbli1lSdBu1utdMEQ2jt1FwhgHUeQcySG4giPlDlQpKZyCng462lQpuAJFjuCwIVJGo/9H+po3Qx7Zcl+cPV2QppTuiDBAcItohukERTBDqW4g/TQvogmqulTSD+5xWG89b7s+6Qj8itvGSGidaS2c/Tmz+tHnvP9zlFcc40yDQHT4dn7dZxL2on8JX6pyiroqkKe+jJw33X4xFTM0UnYrFiuGZdR+sjjsoQmfQjS9MGb/nJUHd0nXlpPwym6HPBlAqoeEW2b9yJOyrnJ3181NZrq5fVFgY0dshDF4R2tNdAvosekWQ62HaM1YE/0BIQk2gwAAAHicY2BkYGAA4meXXs2L57f5ysDNwgAC11+13UXQ/5tYGJnrgVwOBiaQKACMZg1LAHicY2BkYGBu+N/AEMPCwMDw/z8LIwNQBAWwAABx8gRseJxjYWBgYEHCAACwABEAAAAAAAAAPABgAI4AAHicY2BkYGBgYVABYhBgAmIuIGRg+A/mMwAADJYBQwAAeJxlj01OwzAQhV/6B6QSqqhgh+QFYgEo/RGrblhUavdddN+mTpsqiSPHrdQDcB6OwAk4AtyAO/BIJ5s2lsffvHljTwDc4Acejt8t95E9XDI7cg0XuBeuU38QbpBfhJto41W4Rf1N2MczpsJtdGF5g9e4YvaEd2EPHXwI13CNT+E69S/hBvlbuIk7/Aq30PHqwj7mXle4jUcv9sdWL5xeqeVBxaHJIpM5v4KZXu+Sha3S6pxrW8QmU4OgX0lTnWlb3VPs10PnIhVZk6oJqzpJjMqt2erQBRvn8lGvF4kehCblWGP+tsYCjnEFhSUOjDFCGGSIyujoO1Vm9K+xQ8Jee1Y9zed0WxTU/3OFAQL0z1xTurLSeTpPgT1fG1J1dCtuy56UNJFezUkSskJe1rZUQuoBNmVXjhF6XNGJPyhnSP8ACVpuyAAAAHicY2BigAAuBuyAhZGJkZmRhZGVgT0rMy89PTGfoyIzMS+9Mr+UOSszkYEBAGYqB7wAAAA=') format('woff'), | ||
34 | + url('//at.alicdn.com/t/font_873289_cq7godatqkt.ttf?t=1539597789388') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ | ||
35 | + url('//at.alicdn.com/t/font_873289_cq7godatqkt.svg?t=1539597789388#iconfont') format('svg'); /* iOS 4.1- */ | ||
36 | +} | ||
37 | + | ||
38 | +.iconfont { | ||
39 | + font-family:"iconfont" !important; | ||
40 | + font-size:16px; | ||
41 | + font-style:normal; | ||
42 | + -webkit-font-smoothing: antialiased; | ||
43 | + -moz-osx-font-smoothing: grayscale; | ||
44 | +} | ||
45 | + | ||
46 | +.icon-jinggao:before { content: "\e61b"; } | ||
47 | + | ||
48 | +.icon-xiangyou:before { content: "\e683"; } | ||
49 | + | ||
50 | +.icon-jia:before { content: "\e626"; } |
dist/wxcharts-min.js
0 → 100644
1 | +/* | ||
2 | + * charts for WeChat small app v1.0 | ||
3 | + * | ||
4 | + * https://github.com/xiaolin3303/wx-charts | ||
5 | + * 2016-11-28 | ||
6 | + * | ||
7 | + * Designed and built with all the love of Web | ||
8 | + */ | ||
9 | + | ||
10 | +"use strict";function assign(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(t),a=1;a<arguments.length;a++){var n=arguments[a];if(null!=n)for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(i[o]=n[o])}return i}function findRange(t,e,i){if(isNaN(t))throw new Error("[wxCharts] unvalid series data!");i=i||10,e=e||"upper";for(var a=1;i<1;)i*=10,a*=10;for(t="upper"===e?Math.ceil(t*a):Math.floor(t*a);t%i!=0;)"upper"===e?t++:t--;return t/a}function calValidDistance(t,e,i,a){var n=a.width-i.padding-e.xAxisPoints[0],o=e.eachSpacing*a.categories.length,r=t;return t>=0?r=0:Math.abs(t)>=o-n&&(r=n-o),r}function isInAngleRange(t,e,i){function a(t){for(;t<0;)t+=2*Math.PI;for(;t>2*Math.PI;)t-=2*Math.PI;return t}return t=a(t),e=a(e),i=a(i),e>i&&(i+=2*Math.PI,t<e&&(t+=2*Math.PI)),t>=e&&t<=i}function calRotateTranslate(t,e,i){var a=t,n=i-e,o=a+(i-n-a)/Math.sqrt(2);return o*=-1,{transX:o,transY:(i-n)*(Math.sqrt(2)-1)-(i-n-a)/Math.sqrt(2)}}function createCurveControlPoints(t,e){function i(t,e){return!(!t[e-1]||!t[e+1])&&(t[e].y>=Math.max(t[e-1].y,t[e+1].y)||t[e].y<=Math.min(t[e-1].y,t[e+1].y))}var a=null,n=null,o=null,r=null;if(e<1?(a=t[0].x+.2*(t[1].x-t[0].x),n=t[0].y+.2*(t[1].y-t[0].y)):(a=t[e].x+.2*(t[e+1].x-t[e-1].x),n=t[e].y+.2*(t[e+1].y-t[e-1].y)),e>t.length-3){var s=t.length-1;o=t[s].x-.2*(t[s].x-t[s-1].x),r=t[s].y-.2*(t[s].y-t[s-1].y)}else o=t[e+1].x-.2*(t[e+2].x-t[e].x),r=t[e+1].y-.2*(t[e+2].y-t[e].y);return i(t,e+1)&&(r=t[e+1].y),i(t,e)&&(n=t[e].y),{ctrA:{x:a,y:n},ctrB:{x:o,y:r}}}function convertCoordinateOrigin(t,e,i){return{x:i.x+t,y:i.y-e}}function avoidCollision(t,e){if(e)for(;util.isCollision(t,e);)t.start.x>0?t.start.y--:t.start.x<0?t.start.y++:t.start.y>0?t.start.y++:t.start.y--;return t}function fillSeriesColor(t,e){var i=0;return t.map(function(t){return t.color||(t.color=e.colors[i],i=(i+1)%e.colors.length),t})}function getDataRange(t,e){var i=0,a=e-t;return i=a>=1e4?1e3:a>=1e3?100:a>=100?10:a>=10?5:a>=1?1:a>=.1?.1:.01,{minRange:findRange(t,"lower",i),maxRange:findRange(e,"upper",i)}}function measureText(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;t=String(t);var t=t.split(""),i=0;return t.forEach(function(t){/[a-zA-Z]/.test(t)?i+=7:/[0-9]/.test(t)?i+=5.5:/\./.test(t)?i+=2.7:/-/.test(t)?i+=3.25:/[\u4e00-\u9fa5]/.test(t)?i+=10:/\(|\)/.test(t)?i+=3.73:/\s/.test(t)?i+=2.5:/%/.test(t)?i+=8:i+=10}),i*e/10}function dataCombine(t){return t.reduce(function(t,e){return(t.data?t.data:t).concat(e.data)},[])}function getSeriesDataItem(t,e){var i=[];return t.forEach(function(t){if(null!==t.data[e]&&void 0!==t.data[e]){var a={};a.color=t.color,a.name=t.name,a.data=t.format?t.format(t.data[e]):t.data[e],i.push(a)}}),i}function getMaxTextListLength(t){var e=t.map(function(t){return measureText(t)});return Math.max.apply(null,e)}function getRadarCoordinateSeries(t){for(var e=2*Math.PI/t,i=[],a=0;a<t;a++)i.push(e*a);return i.map(function(t){return-1*t+Math.PI/2})}function getToolTipData(t,e,i,a){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=t.map(function(t){return{text:n.format?n.format(t,a[i]):t.name+": "+t.data,color:t.color}}),r=[],s={x:0,y:0};return e.forEach(function(t){void 0!==t[i]&&null!==t[i]&&r.push(t[i])}),r.forEach(function(t){s.x=Math.round(t.x),s.y+=t.y}),s.y/=r.length,{textList:o,offset:s}}function findCurrentIndex(t,e,i,a){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=-1;return isInExactChartArea(t,i,a)&&e.forEach(function(e,i){t.x+n>e&&(o=i)}),o}function isInExactChartArea(t,e,i){return t.x<e.width-i.padding&&t.x>i.padding+i.yAxisWidth+i.yAxisTitleWidth&&t.y>i.padding&&t.y<e.height-i.legendHeight-i.xAxisHeight-i.padding}function findRadarChartCurrentIndex(t,e,i){var a=2*Math.PI/i,n=-1;if(isInExactPieChartArea(t,e.center,e.radius)){var o=function(t){return t<0&&(t+=2*Math.PI),t>2*Math.PI&&(t-=2*Math.PI),t},r=Math.atan2(e.center.y-t.y,t.x-e.center.x);r*=-1,r<0&&(r+=2*Math.PI);e.angleList.map(function(t){return t=o(-1*t)}).forEach(function(t,e){var i=o(t-a/2),s=o(t+a/2);s<i&&(s+=2*Math.PI),(r>=i&&r<=s||r+2*Math.PI>=i&&r+2*Math.PI<=s)&&(n=e)})}return n}function findPieChartCurrentIndex(t,e){var i=-1;if(isInExactPieChartArea(t,e.center,e.radius)){var a=Math.atan2(e.center.y-t.y,t.x-e.center.x);a=-a;for(var n=0,o=e.series.length;n<o;n++){var r=e.series[n];if(isInAngleRange(a,r._start_,r._start_+2*r._proportion_*Math.PI)){i=n;break}}}return i}function isInExactPieChartArea(t,e,i){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<=Math.pow(i,2)}function splitPoints(t){var e=[],i=[];return t.forEach(function(t,a){null!==t?i.push(t):(i.length&&e.push(i),i=[])}),i.length&&e.push(i),e}function calLegendData(t,e,i){if(!1===e.legend)return{legendList:[],legendHeight:0};var a=[],n=0,o=[];return t.forEach(function(t){var i=30+measureText(t.name||"undefined");n+i>e.width?(a.push(o),n=i,o=[t]):(n+=i,o.push(t))}),o.length&&a.push(o),{legendList:a,legendHeight:a.length*(i.fontSize+8)+5}}function calCategoriesData(t,e,i){var a={angle:0,xAxisHeight:i.xAxisHeight},n=getXAxisPoints(t,e,i),o=n.eachSpacing,r=t.map(function(t){return measureText(t)}),s=Math.max.apply(this,r);return s+2*i.xAxisTextPadding>o&&(a.angle=45*Math.PI/180,a.xAxisHeight=2*i.xAxisTextPadding+s*Math.sin(a.angle)),a}function getRadarDataPoints(t,e,i,a,n){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,r=n.extra.radar||{};r.max=r.max||0;var s=Math.max(r.max,Math.max.apply(null,dataCombine(a))),l=[];return a.forEach(function(a){var n={};n.color=a.color,n.data=[],a.data.forEach(function(a,r){var l={};l.angle=t[r],l.proportion=a/s,l.position=convertCoordinateOrigin(i*l.proportion*o*Math.cos(l.angle),i*l.proportion*o*Math.sin(l.angle),e),n.data.push(l)}),l.push(n)}),l}function getPieDataPoints(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=0,a=0;return t.forEach(function(t){t.data=null===t.data?0:t.data,i+=t.data}),t.forEach(function(t){t.data=null===t.data?0:t.data,t._proportion_=t.data/i*e}),t.forEach(function(t){t._start_=a,a+=2*t._proportion_*Math.PI}),t}function getPieTextMaxLength(t){t=getPieDataPoints(t);var e=0;return t.forEach(function(t){var i=t.format?t.format(+t._proportion_.toFixed(2)):util.toFixed(100*t._proportion_)+"%";e=Math.max(e,measureText(i))}),e}function fixColumeData(t,e,i,a,n,o){return t.map(function(t){return null===t?null:(t.width=(e-2*n.columePadding)/i,o.extra.column&&o.extra.column.width&&+o.extra.column.width>0?t.width=Math.min(t.width,+o.extra.column.width):t.width=Math.min(t.width,25),t.x+=(a+.5-i/2)*t.width,t)})}function getXAxisPoints(t,e,i){var a=i.yAxisWidth+i.yAxisTitleWidth,n=e.width-2*i.padding-a,o=e.enableScroll?Math.min(5,t.length):t.length,r=n/o,s=[],l=i.padding+a,h=e.width-i.padding;return t.forEach(function(t,e){s.push(l+e*r)}),!0===e.enableScroll?s.push(l+t.length*r):s.push(h),{xAxisPoints:s,startX:l,endX:h,eachSpacing:r}}function getDataPoints(t,e,i,a,n,o,r){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:1,l=[],h=o.height-2*r.padding-r.xAxisHeight-r.legendHeight;return t.forEach(function(t,c){if(null===t)l.push(null);else{var d={};d.x=a[c]+Math.round(n/2);var x=h*(t-e)/(i-e);x*=s,d.y=o.height-r.xAxisHeight-r.legendHeight-Math.round(x)-r.padding,l.push(d)}}),l}function getYAxisTextList(t,e,i){var a=dataCombine(t);a=a.filter(function(t){return null!==t});var n=Math.min.apply(this,a),o=Math.max.apply(this,a);if("number"==typeof e.yAxis.min&&(n=Math.min(e.yAxis.min,n)),"number"==typeof e.yAxis.max&&(o=Math.max(e.yAxis.max,o)),n===o){var r=o||1;n-=r,o+=r}for(var s=getDataRange(n,o),l=s.minRange,h=s.maxRange,c=[],d=(h-l)/i.yAxisSplit,x=0;x<=i.yAxisSplit;x++)c.push(l+d*x);return c.reverse()}function calYAxisData(t,e,i){var a=getYAxisTextList(t,e,i),n=i.yAxisWidth,o=a.map(function(t){return t=util.toFixed(t,2),t=e.yAxis.format?e.yAxis.format(Number(t)):t,n=Math.max(n,measureText(t)+5),t});return!0===e.yAxis.disabled&&(n=0),{rangesFormat:o,ranges:a,yAxisWidth:n}}function drawPointShape(t,e,i,a){a.beginPath(),a.setStrokeStyle("#ffffff"),a.setLineWidth(1),a.setFillStyle(e),"diamond"===i?t.forEach(function(t,e){null!==t&&(a.moveTo(t.x,t.y-4.5),a.lineTo(t.x-4.5,t.y),a.lineTo(t.x,t.y+4.5),a.lineTo(t.x+4.5,t.y),a.lineTo(t.x,t.y-4.5))}):"circle"===i?t.forEach(function(t,e){null!==t&&(a.moveTo(t.x+3.5,t.y),a.arc(t.x,t.y,4,0,2*Math.PI,!1))}):"rect"===i?t.forEach(function(t,e){null!==t&&(a.moveTo(t.x-3.5,t.y-3.5),a.rect(t.x-3.5,t.y-3.5,7,7))}):"triangle"===i&&t.forEach(function(t,e){null!==t&&(a.moveTo(t.x,t.y-4.5),a.lineTo(t.x-4.5,t.y+4.5),a.lineTo(t.x+4.5,t.y+4.5),a.lineTo(t.x,t.y-4.5))}),a.closePath(),a.fill(),a.stroke()}function drawRingTitle(t,e,i){var a=t.title.fontSize||e.titleFontSize,n=t.subtitle.fontSize||e.subtitleFontSize,o=t.title.name||"",r=t.subtitle.name||"",s=t.title.color||e.titleColor,l=t.subtitle.color||e.subtitleColor,h=o?a:0,c=r?n:0;if(r){var d=measureText(r,n),x=(t.width-d)/2+(t.subtitle.offsetX||0),f=(t.height-e.legendHeight+n)/2;o&&(f-=(h+5)/2),i.beginPath(),i.setFontSize(n),i.setFillStyle(l),i.fillText(r,x,f),i.stroke(),i.closePath()}if(o){var u=measureText(o,a),g=(t.width-u)/2+(t.title.offsetX||0),p=(t.height-e.legendHeight+a)/2;r&&(p+=(c+5)/2),i.beginPath(),i.setFontSize(a),i.setFillStyle(s),i.fillText(o,g,p),i.stroke(),i.closePath()}}function drawPointText(t,e,i,a){var n=e.data;a.beginPath(),a.setFontSize(i.fontSize),a.setFillStyle("#666666"),t.forEach(function(t,i){if(null!==t){var o=e.format?e.format(n[i]):n[i];a.fillText(o,t.x-measureText(o)/2,t.y-2)}}),a.closePath(),a.stroke()}function drawRadarLabel(t,e,i,a,n,o){var r=a.extra.radar||{};e+=n.radarLabelTextMargin,o.beginPath(),o.setFontSize(n.fontSize),o.setFillStyle(r.labelColor||"#666666"),t.forEach(function(t,r){var s={x:e*Math.cos(t),y:e*Math.sin(t)},l=convertCoordinateOrigin(s.x,s.y,i),h=l.x,c=l.y;util.approximatelyEqual(s.x,0)?h-=measureText(a.categories[r]||"")/2:s.x<0&&(h-=measureText(a.categories[r]||"")),o.fillText(a.categories[r]||"",h,c+n.fontSize/2)}),o.stroke(),o.closePath()}function drawPieText(t,e,i,a,n,o){var r=n+i.pieChartLinePadding,s=[],l=null;t.map(function(t){return{arc:2*Math.PI-(t._start_+2*Math.PI*t._proportion_/2),text:t.format?t.format(+t._proportion_.toFixed(2)):util.toFixed(100*t._proportion_)+"%",color:t.color}}).forEach(function(t){var e=Math.cos(t.arc)*r,a=Math.sin(t.arc)*r,o=Math.cos(t.arc)*n,h=Math.sin(t.arc)*n,c=e>=0?e+i.pieChartTextPadding:e-i.pieChartTextPadding,d=a,x=measureText(t.text),f=d;l&&util.isSameXCoordinateArea(l.start,{x:c})&&(f=c>0?Math.min(d,l.start.y):e<0?Math.max(d,l.start.y):d>0?Math.max(d,l.start.y):Math.min(d,l.start.y)),c<0&&(c-=x);var u={lineStart:{x:o,y:h},lineEnd:{x:e,y:a},start:{x:c,y:f},width:x,height:i.fontSize,text:t.text,color:t.color};l=avoidCollision(u,l),s.push(l)}),s.forEach(function(t){var e=convertCoordinateOrigin(t.lineStart.x,t.lineStart.y,o),n=convertCoordinateOrigin(t.lineEnd.x,t.lineEnd.y,o),r=convertCoordinateOrigin(t.start.x,t.start.y,o);a.setLineWidth(1),a.setFontSize(i.fontSize),a.beginPath(),a.setStrokeStyle(t.color),a.setFillStyle(t.color),a.moveTo(e.x,e.y);var s=t.start.x<0?r.x+t.width:r.x,l=t.start.x<0?r.x-5:r.x+5;a.quadraticCurveTo(n.x,n.y,s,r.y),a.moveTo(e.x,e.y),a.stroke(),a.closePath(),a.beginPath(),a.moveTo(r.x+t.width,r.y),a.arc(s,r.y,2,0,2*Math.PI),a.closePath(),a.fill(),a.beginPath(),a.setFillStyle("#666666"),a.fillText(t.text,l,r.y+3),a.closePath(),a.stroke(),a.closePath()})}function drawToolTipSplitLine(t,e,i,a){var n=i.padding,o=e.height-i.padding-i.xAxisHeight-i.legendHeight;a.beginPath(),a.setStrokeStyle("#cccccc"),a.setLineWidth(1),a.moveTo(t,n),a.lineTo(t,o),a.stroke(),a.closePath()}function drawToolTip(t,e,i,a,n){var o=!1;e=assign({x:0,y:0},e),e.y-=8;var r=t.map(function(t){return measureText(t.text)}),s=9+4*a.toolTipPadding+Math.max.apply(null,r),l=2*a.toolTipPadding+t.length*a.toolTipLineHeight;e.x-Math.abs(i._scrollDistance_)+8+s>i.width&&(o=!0),n.beginPath(),n.setFillStyle(i.tooltip.option.background||a.toolTipBackground),n.setGlobalAlpha(a.toolTipOpacity),o?(n.moveTo(e.x,e.y+10),n.lineTo(e.x-8,e.y+10-5),n.lineTo(e.x-8,e.y+10+5),n.moveTo(e.x,e.y+10),n.fillRect(e.x-s-8,e.y,s,l)):(n.moveTo(e.x,e.y+10),n.lineTo(e.x+8,e.y+10-5),n.lineTo(e.x+8,e.y+10+5),n.moveTo(e.x,e.y+10),n.fillRect(e.x+8,e.y,s,l)),n.closePath(),n.fill(),n.setGlobalAlpha(1),t.forEach(function(t,i){n.beginPath(),n.setFillStyle(t.color);var r=e.x+8+2*a.toolTipPadding,l=e.y+(a.toolTipLineHeight-a.fontSize)/2+a.toolTipLineHeight*i+a.toolTipPadding;o&&(r=e.x-s-8+2*a.toolTipPadding),n.fillRect(r,l,4,a.fontSize),n.closePath()}),n.beginPath(),n.setFontSize(a.fontSize),n.setFillStyle("#ffffff"),t.forEach(function(t,i){var r=e.x+8+2*a.toolTipPadding+4+5;o&&(r=e.x-s-8+2*a.toolTipPadding+4+5);var l=e.y+(a.toolTipLineHeight-a.fontSize)/2+a.toolTipLineHeight*i+a.toolTipPadding;n.fillText(t.text,r,l+a.fontSize)}),n.stroke(),n.closePath()}function drawYAxisTitle(t,e,i,a){var n=i.xAxisHeight+(e.height-i.xAxisHeight-measureText(t))/2;a.save(),a.beginPath(),a.setFontSize(i.fontSize),a.setFillStyle(e.yAxis.titleFontColor||"#333333"),a.translate(0,e.height),a.rotate(-90*Math.PI/180),a.fillText(t,n,i.padding+.5*i.fontSize),a.stroke(),a.closePath(),a.restore()}function drawColumnDataPoints(t,e,i,a){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=calYAxisData(t,e,i),r=o.ranges,s=getXAxisPoints(e.categories,e,i),l=s.xAxisPoints,h=s.eachSpacing,c=r.pop(),d=r.shift();return a.save(),e._scrollDistance_&&0!==e._scrollDistance_&&!0===e.enableScroll&&a.translate(e._scrollDistance_,0),t.forEach(function(o,r){var s=o.data,x=getDataPoints(s,c,d,l,h,e,i,n);x=fixColumeData(x,h,t.length,r,i,e),a.beginPath(),a.setFillStyle(o.color),x.forEach(function(t,n){if(null!==t){var o=t.x-t.width/2+1,r=e.height-t.y-i.padding-i.xAxisHeight-i.legendHeight;a.moveTo(o,t.y),a.rect(o,t.y,t.width-2,r)}}),a.closePath(),a.fill()}),t.forEach(function(o,r){var s=o.data,x=getDataPoints(s,c,d,l,h,e,i,n);x=fixColumeData(x,h,t.length,r,i,e),!1!==e.dataLabel&&1===n&&drawPointText(x,o,i,a)}),a.restore(),{xAxisPoints:l,eachSpacing:h}}function drawAreaDataPoints(t,e,i,a){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=calYAxisData(t,e,i),r=o.ranges,s=getXAxisPoints(e.categories,e,i),l=s.xAxisPoints,h=s.eachSpacing,c=r.pop(),d=r.shift(),x=e.height-i.padding-i.xAxisHeight-i.legendHeight,f=[];return a.save(),e._scrollDistance_&&0!==e._scrollDistance_&&!0===e.enableScroll&&a.translate(e._scrollDistance_,0),e.tooltip&&e.tooltip.textList&&e.tooltip.textList.length&&1===n&&drawToolTipSplitLine(e.tooltip.offset.x,e,i,a),t.forEach(function(t,o){var r=t.data,s=getDataPoints(r,c,d,l,h,e,i,n);if(f.push(s),splitPoints(s).forEach(function(i){if(a.beginPath(),a.setStrokeStyle(t.color),a.setFillStyle(t.color),a.setGlobalAlpha(.6),a.setLineWidth(2),i.length>1){var n=i[0],o=i[i.length-1];a.moveTo(n.x,n.y),"curve"===e.extra.lineStyle?i.forEach(function(t,e){if(e>0){var n=createCurveControlPoints(i,e-1);a.bezierCurveTo(n.ctrA.x,n.ctrA.y,n.ctrB.x,n.ctrB.y,t.x,t.y)}}):i.forEach(function(t,e){e>0&&a.lineTo(t.x,t.y)}),a.lineTo(o.x,x),a.lineTo(n.x,x),a.lineTo(n.x,n.y)}else{var r=i[0];a.moveTo(r.x-h/2,r.y),a.lineTo(r.x+h/2,r.y),a.lineTo(r.x+h/2,x),a.lineTo(r.x-h/2,x),a.moveTo(r.x-h/2,r.y)}a.closePath(),a.fill(),a.setGlobalAlpha(1)}),!1!==e.dataPointShape){var u=i.dataPointShape[o%i.dataPointShape.length];drawPointShape(s,t.color,u,a)}}),!1!==e.dataLabel&&1===n&&t.forEach(function(t,o){drawPointText(getDataPoints(t.data,c,d,l,h,e,i,n),t,i,a)}),a.restore(),{xAxisPoints:l,calPoints:f,eachSpacing:h}}function drawLineDataPoints(t,e,i,a){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=calYAxisData(t,e,i),r=o.ranges,s=getXAxisPoints(e.categories,e,i),l=s.xAxisPoints,h=s.eachSpacing,c=r.pop(),d=r.shift(),x=[];return a.save(),e._scrollDistance_&&0!==e._scrollDistance_&&!0===e.enableScroll&&a.translate(e._scrollDistance_,0),e.tooltip&&e.tooltip.textList&&e.tooltip.textList.length&&1===n&&drawToolTipSplitLine(e.tooltip.offset.x,e,i,a),t.forEach(function(t,o){var r=t.data,s=getDataPoints(r,c,d,l,h,e,i,n);if(x.push(s),splitPoints(s).forEach(function(i,n){a.beginPath(),a.setStrokeStyle(t.color),a.setLineWidth(2),1===i.length?(a.moveTo(i[0].x,i[0].y),a.arc(i[0].x,i[0].y,1,0,2*Math.PI)):(a.moveTo(i[0].x,i[0].y),"curve"===e.extra.lineStyle?i.forEach(function(t,e){if(e>0){var n=createCurveControlPoints(i,e-1);a.bezierCurveTo(n.ctrA.x,n.ctrA.y,n.ctrB.x,n.ctrB.y,t.x,t.y)}}):i.forEach(function(t,e){e>0&&a.lineTo(t.x,t.y)}),a.moveTo(i[0].x,i[0].y)),a.closePath(),a.stroke()}),!1!==e.dataPointShape){var f=i.dataPointShape[o%i.dataPointShape.length];drawPointShape(s,t.color,f,a)}}),!1!==e.dataLabel&&1===n&&t.forEach(function(t,o){drawPointText(getDataPoints(t.data,c,d,l,h,e,i,n),t,i,a)}),a.restore(),{xAxisPoints:l,calPoints:x,eachSpacing:h}}function drawToolTipBridge(t,e,i,a){i.save(),t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&i.translate(t._scrollDistance_,0),t.tooltip&&t.tooltip.textList&&t.tooltip.textList.length&&1===a&&drawToolTip(t.tooltip.textList,t.tooltip.offset,t,e,i),i.restore()}function drawXAxis(t,e,i,a){var n=getXAxisPoints(t,e,i),o=n.xAxisPoints,r=(n.startX,n.endX,n.eachSpacing),s=e.height-i.padding-i.xAxisHeight-i.legendHeight,l=s+i.xAxisLineHeight;a.save(),e._scrollDistance_&&0!==e._scrollDistance_&&a.translate(e._scrollDistance_,0),a.beginPath(),a.setStrokeStyle(e.xAxis.gridColor||"#cccccc"),!0!==e.xAxis.disableGrid&&("calibration"===e.xAxis.type?o.forEach(function(t,e){e>0&&(a.moveTo(t-r/2,s),a.lineTo(t-r/2,s+4))}):o.forEach(function(t,e){a.moveTo(t,s),a.lineTo(t,l)})),a.closePath(),a.stroke();var h=e.width-2*i.padding-i.yAxisWidth-i.yAxisTitleWidth,c=Math.min(t.length,Math.ceil(h/i.fontSize/1.5)),d=Math.ceil(t.length/c);t=t.map(function(t,e){return e%d!=0?"":t}),0===i._xAxisTextAngle_?(a.beginPath(),a.setFontSize(i.fontSize),a.setFillStyle(e.xAxis.fontColor||"#666666"),t.forEach(function(t,e){var n=r/2-measureText(t)/2;a.fillText(t,o[e]+n,s+i.fontSize+5)}),a.closePath(),a.stroke()):t.forEach(function(t,n){a.save(),a.beginPath(),a.setFontSize(i.fontSize),a.setFillStyle(e.xAxis.fontColor||"#666666");var l=measureText(t),h=r/2-l,c=calRotateTranslate(o[n]+r/2,s+i.fontSize/2+5,e.height),d=c.transX,x=c.transY;a.rotate(-1*i._xAxisTextAngle_),a.translate(d,x),a.fillText(t,o[n]+h,s+i.fontSize+5),a.closePath(),a.stroke(),a.restore()}),a.restore()}function drawYAxisGrid(t,e,i){for(var a=t.height-2*e.padding-e.xAxisHeight-e.legendHeight,n=Math.floor(a/e.yAxisSplit),o=e.yAxisWidth+e.yAxisTitleWidth,r=e.padding+o,s=t.width-e.padding,l=[],h=0;h<e.yAxisSplit;h++)l.push(e.padding+n*h);l.push(e.padding+n*e.yAxisSplit+2),i.beginPath(),i.setStrokeStyle(t.yAxis.gridColor||"#cccccc"),i.setLineWidth(1),l.forEach(function(t,e){i.moveTo(r,t),i.lineTo(s,t)}),i.closePath(),i.stroke()}function drawYAxis(t,e,i,a){if(!0!==e.yAxis.disabled){var n=calYAxisData(t,e,i),o=n.rangesFormat,r=i.yAxisWidth+i.yAxisTitleWidth,s=e.height-2*i.padding-i.xAxisHeight-i.legendHeight,l=Math.floor(s/i.yAxisSplit),h=i.padding+r,c=e.width-i.padding,d=e.height-i.padding-i.xAxisHeight-i.legendHeight;a.setFillStyle(e.background||"#ffffff"),e._scrollDistance_<0&&a.fillRect(0,0,h,d+i.xAxisHeight+5),a.fillRect(c,0,e.width,d+i.xAxisHeight+5);for(var x=[],f=0;f<=i.yAxisSplit;f++)x.push(i.padding+l*f);a.stroke(),a.beginPath(),a.setFontSize(i.fontSize),a.setFillStyle(e.yAxis.fontColor||"#666666"),o.forEach(function(t,e){var n=x[e]?x[e]:d;a.fillText(t,i.padding+i.yAxisTitleWidth,n+i.fontSize/2)}),a.closePath(),a.stroke(),e.yAxis.title&&drawYAxisTitle(e.yAxis.title,e,i,a)}}function drawLegend(t,e,i,a){if(e.legend){var n=calLegendData(t,e,i),o=n.legendList;o.forEach(function(t,n){var o=0;t.forEach(function(t){t.name=t.name||"undefined",o+=15+measureText(t.name)+15});var r=(e.width-o)/2+5,s=e.height-i.padding-i.legendHeight+n*(i.fontSize+8)+5+8;a.setFontSize(i.fontSize),t.forEach(function(t){switch(e.type){case"line":a.beginPath(),a.setLineWidth(1),a.setStrokeStyle(t.color),a.moveTo(r-2,s+5),a.lineTo(r+17,s+5),a.stroke(),a.closePath(),a.beginPath(),a.setLineWidth(1),a.setStrokeStyle("#ffffff"),a.setFillStyle(t.color),a.moveTo(r+7.5,s+5),a.arc(r+7.5,s+5,4,0,2*Math.PI),a.fill(),a.stroke(),a.closePath();break;case"pie":case"ring":a.beginPath(),a.setFillStyle(t.color),a.moveTo(r+7.5,s+5),a.arc(r+7.5,s+5,7,0,2*Math.PI),a.closePath(),a.fill();break;default:a.beginPath(),a.setFillStyle(t.color),a.moveTo(r,s),a.rect(r,s,15,10),a.closePath(),a.fill()}r+=20,a.beginPath(),a.setFillStyle(e.extra.legendTextColor||"#333333"),a.fillText(t.name,r,s+9),a.closePath(),a.stroke(),r+=measureText(t.name)+10})})}}function drawPieDataPoints(t,e,i,a){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=e.extra.pie||{};t=getPieDataPoints(t,n);var r={x:e.width/2,y:(e.height-i.legendHeight)/2},s=Math.min(r.x-i.pieChartLinePadding-i.pieChartTextPadding-i._pieTextMaxLength_,r.y-i.pieChartLinePadding-i.pieChartTextPadding);if(e.dataLabel?s-=10:s-=2*i.padding,t=t.map(function(t){return t._start_+=(o.offsetAngle||0)*Math.PI/180,t}),t.forEach(function(t){a.beginPath(),a.setLineWidth(2),a.setStrokeStyle("#ffffff"),a.setFillStyle(t.color),a.moveTo(r.x,r.y),a.arc(r.x,r.y,s,t._start_,t._start_+2*t._proportion_*Math.PI),a.closePath(),a.fill(),!0!==e.disablePieStroke&&a.stroke()}),"ring"===e.type){var l=.6*s;"number"==typeof e.extra.ringWidth&&e.extra.ringWidth>0&&(l=Math.max(0,s-e.extra.ringWidth)),a.beginPath(),a.setFillStyle(e.background||"#ffffff"),a.moveTo(r.x,r.y),a.arc(r.x,r.y,l,0,2*Math.PI),a.closePath(),a.fill()}if(!1!==e.dataLabel&&1===n){for(var h=!1,c=0,d=t.length;c<d;c++)if(t[c].data>0){h=!0;break}h&&drawPieText(t,e,i,a,s,r)}return 1===n&&"ring"===e.type&&drawRingTitle(e,i,a),{center:r,radius:s,series:t}}function drawRadarDataPoints(t,e,i,a){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=e.extra.radar||{},r=getRadarCoordinateSeries(e.categories.length),s={x:e.width/2,y:(e.height-i.legendHeight)/2},l=Math.min(s.x-(getMaxTextListLength(e.categories)+i.radarLabelTextMargin),s.y-i.radarLabelTextMargin);l-=i.padding,a.beginPath(),a.setLineWidth(1),a.setStrokeStyle(o.gridColor||"#cccccc"),r.forEach(function(t){var e=convertCoordinateOrigin(l*Math.cos(t),l*Math.sin(t),s);a.moveTo(s.x,s.y),a.lineTo(e.x,e.y)}),a.stroke(),a.closePath();for(var h=1;h<=i.radarGridCount;h++)!function(t){var e={};a.beginPath(),a.setLineWidth(1),a.setStrokeStyle(o.gridColor||"#cccccc"),r.forEach(function(n,o){var r=convertCoordinateOrigin(l/i.radarGridCount*t*Math.cos(n),l/i.radarGridCount*t*Math.sin(n),s);0===o?(e=r,a.moveTo(r.x,r.y)):a.lineTo(r.x,r.y)}),a.lineTo(e.x,e.y),a.stroke(),a.closePath()}(h);return getRadarDataPoints(r,s,l,t,e,n).forEach(function(t,n){if(a.beginPath(),a.setFillStyle(t.color),a.setGlobalAlpha(.6),t.data.forEach(function(t,e){0===e?a.moveTo(t.position.x,t.position.y):a.lineTo(t.position.x,t.position.y)}),a.closePath(),a.fill(),a.setGlobalAlpha(1),!1!==e.dataPointShape){var o=i.dataPointShape[n%i.dataPointShape.length];drawPointShape(t.data.map(function(t){return t.position}),t.color,o,a)}}),drawRadarLabel(r,l,s,e,i,a),{center:s,radius:l,angleList:r}}function drawCanvas(t,e){e.draw()}function Animation(t){this.isStop=!1,t.duration=void 0===t.duration?1e3:t.duration,t.timing=t.timing||"linear";var e=function(){return"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:"undefined"!=typeof setTimeout?function(t,e){setTimeout(function(){var e=+new Date;t(e)},e)}:function(t){t(null)}}(),i=null,a=function(n){if(null===n||!0===this.isStop)return t.onProcess&&t.onProcess(1),void(t.onAnimationFinish&&t.onAnimationFinish());if(null===i&&(i=n),n-i<t.duration){var o=(n-i)/t.duration;o=(0,Timing[t.timing])(o),t.onProcess&&t.onProcess(o),e(a,17)}else t.onProcess&&t.onProcess(1),t.onAnimationFinish&&t.onAnimationFinish()};a=a.bind(this),e(a,17)}function drawCharts(t,e,i,a){var n=this,o=e.series,r=e.categories;o=fillSeriesColor(o,i);var s=calLegendData(o,e,i),l=s.legendHeight;i.legendHeight=l;var h=calYAxisData(o,e,i),c=h.yAxisWidth;if(i.yAxisWidth=c,r&&r.length){var d=calCategoriesData(r,e,i),x=d.xAxisHeight,f=d.angle;i.xAxisHeight=x,i._xAxisTextAngle_=f}"pie"!==t&&"ring"!==t||(i._pieTextMaxLength_=!1===e.dataLabel?0:getPieTextMaxLength(o));var u=e.animation?1e3:0;switch(this.animationInstance&&this.animationInstance.stop(),t){case"line":this.animationInstance=new Animation({timing:"easeIn",duration:u,onProcess:function(t){drawYAxisGrid(e,i,a);var s=drawLineDataPoints(o,e,i,a,t),l=s.xAxisPoints,h=s.calPoints,c=s.eachSpacing;n.chartData.xAxisPoints=l,n.chartData.calPoints=h,n.chartData.eachSpacing=c,drawXAxis(r,e,i,a),drawLegend(e.series,e,i,a),drawYAxis(o,e,i,a),drawToolTipBridge(e,i,a,t),drawCanvas(e,a)},onAnimationFinish:function(){n.event.trigger("renderComplete")}});break;case"column":this.animationInstance=new Animation({timing:"easeIn",duration:u,onProcess:function(t){drawYAxisGrid(e,i,a);var s=drawColumnDataPoints(o,e,i,a,t),l=s.xAxisPoints,h=s.eachSpacing;n.chartData.xAxisPoints=l,n.chartData.eachSpacing=h,drawXAxis(r,e,i,a),drawLegend(e.series,e,i,a),drawYAxis(o,e,i,a),drawCanvas(e,a)},onAnimationFinish:function(){n.event.trigger("renderComplete")}});break;case"area":this.animationInstance=new Animation({timing:"easeIn",duration:u,onProcess:function(t){drawYAxisGrid(e,i,a);var s=drawAreaDataPoints(o,e,i,a,t),l=s.xAxisPoints,h=s.calPoints,c=s.eachSpacing;n.chartData.xAxisPoints=l,n.chartData.calPoints=h,n.chartData.eachSpacing=c,drawXAxis(r,e,i,a),drawLegend(e.series,e,i,a),drawYAxis(o,e,i,a),drawToolTipBridge(e,i,a,t),drawCanvas(e,a)},onAnimationFinish:function(){n.event.trigger("renderComplete")}});break;case"ring":case"pie":this.animationInstance=new Animation({timing:"easeInOut",duration:u,onProcess:function(t){n.chartData.pieData=drawPieDataPoints(o,e,i,a,t),drawLegend(e.series,e,i,a),drawCanvas(e,a)},onAnimationFinish:function(){n.event.trigger("renderComplete")}});break;case"radar":this.animationInstance=new Animation({timing:"easeInOut",duration:u,onProcess:function(t){n.chartData.radarData=drawRadarDataPoints(o,e,i,a,t),drawLegend(e.series,e,i,a),drawCanvas(e,a)},onAnimationFinish:function(){n.event.trigger("renderComplete")}})}}function Event(){this.events={}}var config={yAxisWidth:15,yAxisSplit:5,xAxisHeight:15,xAxisLineHeight:15,legendHeight:15,yAxisTitleWidth:15,padding:12,columePadding:3,fontSize:10,dataPointShape:["diamond","circle","triangle","rect"],colors:["#7cb5ec","#f7a35c","#434348","#90ed7d","#f15c80","#8085e9"],pieChartLinePadding:25,pieChartTextPadding:15,xAxisTextPadding:3,titleColor:"#333333",titleFontSize:20,subtitleColor:"#999999",subtitleFontSize:15,toolTipPadding:3,toolTipBackground:"#000000",toolTipOpacity:.7,toolTipLineHeight:14,radarGridCount:3,radarLabelTextMargin:15},util={toFixed:function(t,e){return e=e||2,this.isFloat(t)&&(t=t.toFixed(e)),t},isFloat:function(t){return t%1!=0},approximatelyEqual:function(t,e){return Math.abs(t-e)<1e-10},isSameSign:function(t,e){return Math.abs(t)===t&&Math.abs(e)===e||Math.abs(t)!==t&&Math.abs(e)!==e},isSameXCoordinateArea:function(t,e){return this.isSameSign(t.x,e.x)},isCollision:function(t,e){return t.end={},t.end.x=t.start.x+t.width,t.end.y=t.start.y-t.height,e.end={},e.end.x=e.start.x+e.width,e.end.y=e.start.y-e.height,!(e.start.x>t.end.x||e.end.x<t.start.x||e.end.y>t.start.y||e.start.y<t.end.y)}},Timing={easeIn:function(t){return Math.pow(t,3)},easeOut:function(t){return Math.pow(t-1,3)+1},easeInOut:function(t){return(t/=.5)<1?.5*Math.pow(t,3):.5*(Math.pow(t-2,3)+2)},linear:function(t){return t}};Animation.prototype.stop=function(){this.isStop=!0},Event.prototype.addEventListener=function(t,e){this.events[t]=this.events[t]||[],this.events[t].push(e)},Event.prototype.trigger=function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var a=e[0],n=e.slice(1);this.events[a]&&this.events[a].forEach(function(t){try{t.apply(null,n)}catch(t){console.error(t)}})};var Charts=function(t){t.title=t.title||{},t.subtitle=t.subtitle||{},t.yAxis=t.yAxis||{},t.xAxis=t.xAxis||{},t.extra=t.extra||{},t.legend=!1!==t.legend,t.animation=!1!==t.animation;var e=assign({},config);e.yAxisTitleWidth=!0!==t.yAxis.disabled&&t.yAxis.title?e.yAxisTitleWidth:0,e.pieChartLinePadding=!1===t.dataLabel?0:e.pieChartLinePadding,e.pieChartTextPadding=!1===t.dataLabel?0:e.pieChartTextPadding,this.opts=t,this.config=e,this.context=wx.createCanvasContext(t.canvasId),this.chartData={},this.event=new Event,this.scrollOption={currentOffset:0,startTouchX:0,distance:0},drawCharts.call(this,t.type,t,e,this.context)};Charts.prototype.updateData=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.opts.series=t.series||this.opts.series,this.opts.categories=t.categories||this.opts.categories,this.opts.title=assign({},this.opts.title,t.title||{}),this.opts.subtitle=assign({},this.opts.subtitle,t.subtitle||{}),drawCharts.call(this,this.opts.type,this.opts,this.config,this.context)},Charts.prototype.stopAnimation=function(){this.animationInstance&&this.animationInstance.stop()},Charts.prototype.addEventListener=function(t,e){this.event.addEventListener(t,e)},Charts.prototype.getCurrentDataIndex=function(t){var e=t.touches&&t.touches.length?t.touches:t.changedTouches;if(e&&e.length){var i=e[0],a=i.x,n=i.y;return"pie"===this.opts.type||"ring"===this.opts.type?findPieChartCurrentIndex({x:a,y:n},this.chartData.pieData):"radar"===this.opts.type?findRadarChartCurrentIndex({x:a,y:n},this.chartData.radarData,this.opts.categories.length):findCurrentIndex({x:a,y:n},this.chartData.xAxisPoints,this.opts,this.config,Math.abs(this.scrollOption.currentOffset))}return-1},Charts.prototype.showToolTip=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("line"===this.opts.type||"area"===this.opts.type){var i=this.getCurrentDataIndex(t),a=this.scrollOption.currentOffset,n=assign({},this.opts,{_scrollDistance_:a,animation:!1});if(i>-1){var o=getSeriesDataItem(this.opts.series,i);if(0!==o.length){var r=getToolTipData(o,this.chartData.calPoints,i,this.opts.categories,e),s=r.textList,l=r.offset;n.tooltip={textList:s,offset:l,option:e}}}drawCharts.call(this,n.type,n,this.config,this.context)}},Charts.prototype.scrollStart=function(t){t.touches[0]&&!0===this.opts.enableScroll&&(this.scrollOption.startTouchX=t.touches[0].x)},Charts.prototype.scroll=function(t){if(t.touches[0]&&!0===this.opts.enableScroll){var e=t.touches[0].x-this.scrollOption.startTouchX,i=this.scrollOption.currentOffset,a=calValidDistance(i+e,this.chartData,this.config,this.opts);this.scrollOption.distance=e=a-i;var n=assign({},this.opts,{_scrollDistance_:i+e,animation:!1});drawCharts.call(this,n.type,n,this.config,this.context)}},Charts.prototype.scrollEnd=function(t){if(!0===this.opts.enableScroll){var e=this.scrollOption,i=e.currentOffset,a=e.distance;this.scrollOption.currentOffset=i+a,this.scrollOption.distance=0}},module.exports=Charts; |
dist/wxcharts.js
0 → 100644
1 | +/* | ||
2 | + * charts for WeChat small app v1.0 | ||
3 | + * | ||
4 | + * https://github.com/xiaolin3303/wx-charts | ||
5 | + * 2016-11-28 | ||
6 | + * | ||
7 | + * Designed and built with all the love of Web | ||
8 | + */ | ||
9 | + | ||
10 | +'use strict'; | ||
11 | + | ||
12 | +var config = { | ||
13 | + yAxisWidth: 15, | ||
14 | + yAxisSplit: 5, | ||
15 | + xAxisHeight: 15, | ||
16 | + xAxisLineHeight: 15, | ||
17 | + legendHeight: 15, | ||
18 | + yAxisTitleWidth: 15, | ||
19 | + padding: 12, | ||
20 | + columePadding: 3, | ||
21 | + fontSize: 10, | ||
22 | + dataPointShape: ['diamond', 'circle', 'triangle', 'rect'], | ||
23 | + colors: ['#7cb5ec', '#f7a35c', '#434348', '#90ed7d', '#f15c80', '#8085e9'], | ||
24 | + pieChartLinePadding: 25, | ||
25 | + pieChartTextPadding: 15, | ||
26 | + xAxisTextPadding: 3, | ||
27 | + titleColor: '#333333', | ||
28 | + titleFontSize: 20, | ||
29 | + subtitleColor: '#999999', | ||
30 | + subtitleFontSize: 15, | ||
31 | + toolTipPadding: 3, | ||
32 | + toolTipBackground: '#000000', | ||
33 | + toolTipOpacity: 0.7, | ||
34 | + toolTipLineHeight: 14, | ||
35 | + radarGridCount: 3, | ||
36 | + radarLabelTextMargin: 15 | ||
37 | +}; | ||
38 | + | ||
39 | +// Object.assign polyfill | ||
40 | +// https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign | ||
41 | +function assign(target, varArgs) { | ||
42 | + if (target == null) { | ||
43 | + // TypeError if undefined or null | ||
44 | + throw new TypeError('Cannot convert undefined or null to object'); | ||
45 | + } | ||
46 | + | ||
47 | + var to = Object(target); | ||
48 | + | ||
49 | + for (var index = 1; index < arguments.length; index++) { | ||
50 | + var nextSource = arguments[index]; | ||
51 | + | ||
52 | + if (nextSource != null) { | ||
53 | + // Skip over if undefined or null | ||
54 | + for (var nextKey in nextSource) { | ||
55 | + // Avoid bugs when hasOwnProperty is shadowed | ||
56 | + if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { | ||
57 | + to[nextKey] = nextSource[nextKey]; | ||
58 | + } | ||
59 | + } | ||
60 | + } | ||
61 | + } | ||
62 | + return to; | ||
63 | +} | ||
64 | + | ||
65 | +var util = { | ||
66 | + toFixed: function toFixed(num, limit) { | ||
67 | + limit = limit || 2; | ||
68 | + if (this.isFloat(num)) { | ||
69 | + num = num.toFixed(limit); | ||
70 | + } | ||
71 | + return num; | ||
72 | + }, | ||
73 | + isFloat: function isFloat(num) { | ||
74 | + return num % 1 !== 0; | ||
75 | + }, | ||
76 | + approximatelyEqual: function approximatelyEqual(num1, num2) { | ||
77 | + return Math.abs(num1 - num2) < 1e-10; | ||
78 | + }, | ||
79 | + isSameSign: function isSameSign(num1, num2) { | ||
80 | + return Math.abs(num1) === num1 && Math.abs(num2) === num2 || Math.abs(num1) !== num1 && Math.abs(num2) !== num2; | ||
81 | + }, | ||
82 | + isSameXCoordinateArea: function isSameXCoordinateArea(p1, p2) { | ||
83 | + return this.isSameSign(p1.x, p2.x); | ||
84 | + }, | ||
85 | + isCollision: function isCollision(obj1, obj2) { | ||
86 | + obj1.end = {}; | ||
87 | + obj1.end.x = obj1.start.x + obj1.width; | ||
88 | + obj1.end.y = obj1.start.y - obj1.height; | ||
89 | + obj2.end = {}; | ||
90 | + obj2.end.x = obj2.start.x + obj2.width; | ||
91 | + obj2.end.y = obj2.start.y - obj2.height; | ||
92 | + var flag = obj2.start.x > obj1.end.x || obj2.end.x < obj1.start.x || obj2.end.y > obj1.start.y || obj2.start.y < obj1.end.y; | ||
93 | + | ||
94 | + return !flag; | ||
95 | + } | ||
96 | +}; | ||
97 | + | ||
98 | +function findRange(num, type, limit) { | ||
99 | + if (isNaN(num)) { | ||
100 | + throw new Error('[wxCharts] unvalid series data!'); | ||
101 | + } | ||
102 | + limit = limit || 10; | ||
103 | + type = type ? type : 'upper'; | ||
104 | + var multiple = 1; | ||
105 | + while (limit < 1) { | ||
106 | + limit *= 10; | ||
107 | + multiple *= 10; | ||
108 | + } | ||
109 | + if (type === 'upper') { | ||
110 | + num = Math.ceil(num * multiple); | ||
111 | + } else { | ||
112 | + num = Math.floor(num * multiple); | ||
113 | + } | ||
114 | + while (num % limit !== 0) { | ||
115 | + if (type === 'upper') { | ||
116 | + num++; | ||
117 | + } else { | ||
118 | + num--; | ||
119 | + } | ||
120 | + } | ||
121 | + | ||
122 | + return num / multiple; | ||
123 | +} | ||
124 | + | ||
125 | +function calValidDistance(distance, chartData, config, opts) { | ||
126 | + | ||
127 | + var dataChartAreaWidth = opts.width - config.padding - chartData.xAxisPoints[0]; | ||
128 | + var dataChartWidth = chartData.eachSpacing * opts.categories.length; | ||
129 | + var validDistance = distance; | ||
130 | + if (distance >= 0) { | ||
131 | + validDistance = 0; | ||
132 | + } else if (Math.abs(distance) >= dataChartWidth - dataChartAreaWidth) { | ||
133 | + validDistance = dataChartAreaWidth - dataChartWidth; | ||
134 | + } | ||
135 | + return validDistance; | ||
136 | +} | ||
137 | + | ||
138 | +function isInAngleRange(angle, startAngle, endAngle) { | ||
139 | + function adjust(angle) { | ||
140 | + while (angle < 0) { | ||
141 | + angle += 2 * Math.PI; | ||
142 | + } | ||
143 | + while (angle > 2 * Math.PI) { | ||
144 | + angle -= 2 * Math.PI; | ||
145 | + } | ||
146 | + | ||
147 | + return angle; | ||
148 | + } | ||
149 | + | ||
150 | + angle = adjust(angle); | ||
151 | + startAngle = adjust(startAngle); | ||
152 | + endAngle = adjust(endAngle); | ||
153 | + if (startAngle > endAngle) { | ||
154 | + endAngle += 2 * Math.PI; | ||
155 | + if (angle < startAngle) { | ||
156 | + angle += 2 * Math.PI; | ||
157 | + } | ||
158 | + } | ||
159 | + | ||
160 | + return angle >= startAngle && angle <= endAngle; | ||
161 | +} | ||
162 | + | ||
163 | +function calRotateTranslate(x, y, h) { | ||
164 | + var xv = x; | ||
165 | + var yv = h - y; | ||
166 | + | ||
167 | + var transX = xv + (h - yv - xv) / Math.sqrt(2); | ||
168 | + transX *= -1; | ||
169 | + | ||
170 | + var transY = (h - yv) * (Math.sqrt(2) - 1) - (h - yv - xv) / Math.sqrt(2); | ||
171 | + | ||
172 | + return { | ||
173 | + transX: transX, | ||
174 | + transY: transY | ||
175 | + }; | ||
176 | +} | ||
177 | + | ||
178 | +function createCurveControlPoints(points, i) { | ||
179 | + | ||
180 | + function isNotMiddlePoint(points, i) { | ||
181 | + if (points[i - 1] && points[i + 1]) { | ||
182 | + return points[i].y >= Math.max(points[i - 1].y, points[i + 1].y) || points[i].y <= Math.min(points[i - 1].y, points[i + 1].y); | ||
183 | + } else { | ||
184 | + return false; | ||
185 | + } | ||
186 | + } | ||
187 | + | ||
188 | + var a = 0.2; | ||
189 | + var b = 0.2; | ||
190 | + var pAx = null; | ||
191 | + var pAy = null; | ||
192 | + var pBx = null; | ||
193 | + var pBy = null; | ||
194 | + if (i < 1) { | ||
195 | + pAx = points[0].x + (points[1].x - points[0].x) * a; | ||
196 | + pAy = points[0].y + (points[1].y - points[0].y) * a; | ||
197 | + } else { | ||
198 | + pAx = points[i].x + (points[i + 1].x - points[i - 1].x) * a; | ||
199 | + pAy = points[i].y + (points[i + 1].y - points[i - 1].y) * a; | ||
200 | + } | ||
201 | + | ||
202 | + if (i > points.length - 3) { | ||
203 | + var last = points.length - 1; | ||
204 | + pBx = points[last].x - (points[last].x - points[last - 1].x) * b; | ||
205 | + pBy = points[last].y - (points[last].y - points[last - 1].y) * b; | ||
206 | + } else { | ||
207 | + pBx = points[i + 1].x - (points[i + 2].x - points[i].x) * b; | ||
208 | + pBy = points[i + 1].y - (points[i + 2].y - points[i].y) * b; | ||
209 | + } | ||
210 | + | ||
211 | + // fix issue https://github.com/xiaolin3303/wx-charts/issues/79 | ||
212 | + if (isNotMiddlePoint(points, i + 1)) { | ||
213 | + pBy = points[i + 1].y; | ||
214 | + } | ||
215 | + if (isNotMiddlePoint(points, i)) { | ||
216 | + pAy = points[i].y; | ||
217 | + } | ||
218 | + | ||
219 | + return { | ||
220 | + ctrA: { x: pAx, y: pAy }, | ||
221 | + ctrB: { x: pBx, y: pBy } | ||
222 | + }; | ||
223 | +} | ||
224 | + | ||
225 | +function convertCoordinateOrigin(x, y, center) { | ||
226 | + return { | ||
227 | + x: center.x + x, | ||
228 | + y: center.y - y | ||
229 | + }; | ||
230 | +} | ||
231 | + | ||
232 | +function avoidCollision(obj, target) { | ||
233 | + if (target) { | ||
234 | + // is collision test | ||
235 | + while (util.isCollision(obj, target)) { | ||
236 | + if (obj.start.x > 0) { | ||
237 | + obj.start.y--; | ||
238 | + } else if (obj.start.x < 0) { | ||
239 | + obj.start.y++; | ||
240 | + } else { | ||
241 | + if (obj.start.y > 0) { | ||
242 | + obj.start.y++; | ||
243 | + } else { | ||
244 | + obj.start.y--; | ||
245 | + } | ||
246 | + } | ||
247 | + } | ||
248 | + } | ||
249 | + return obj; | ||
250 | +} | ||
251 | + | ||
252 | +function fillSeriesColor(series, config) { | ||
253 | + var index = 0; | ||
254 | + return series.map(function (item) { | ||
255 | + if (!item.color) { | ||
256 | + item.color = config.colors[index]; | ||
257 | + index = (index + 1) % config.colors.length; | ||
258 | + } | ||
259 | + return item; | ||
260 | + }); | ||
261 | +} | ||
262 | + | ||
263 | +function getDataRange(minData, maxData) { | ||
264 | + var limit = 0; | ||
265 | + var range = maxData - minData; | ||
266 | + if (range >= 10000) { | ||
267 | + limit = 1000; | ||
268 | + } else if (range >= 1000) { | ||
269 | + limit = 100; | ||
270 | + } else if (range >= 100) { | ||
271 | + limit = 10; | ||
272 | + } else if (range >= 10) { | ||
273 | + limit = 5; | ||
274 | + } else if (range >= 1) { | ||
275 | + limit = 1; | ||
276 | + } else if (range >= 0.1) { | ||
277 | + limit = 0.1; | ||
278 | + } else { | ||
279 | + limit = 0.01; | ||
280 | + } | ||
281 | + return { | ||
282 | + minRange: findRange(minData, 'lower', limit), | ||
283 | + maxRange: findRange(maxData, 'upper', limit) | ||
284 | + }; | ||
285 | +} | ||
286 | + | ||
287 | +function measureText(text) { | ||
288 | + var fontSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10; | ||
289 | + | ||
290 | + // wx canvas 未实现measureText方法, 此处自行实现 | ||
291 | + text = String(text); | ||
292 | + var text = text.split(''); | ||
293 | + var width = 0; | ||
294 | + text.forEach(function (item) { | ||
295 | + if (/[a-zA-Z]/.test(item)) { | ||
296 | + width += 7; | ||
297 | + } else if (/[0-9]/.test(item)) { | ||
298 | + width += 5.5; | ||
299 | + } else if (/\./.test(item)) { | ||
300 | + width += 2.7; | ||
301 | + } else if (/-/.test(item)) { | ||
302 | + width += 3.25; | ||
303 | + } else if (/[\u4e00-\u9fa5]/.test(item)) { | ||
304 | + width += 10; | ||
305 | + } else if (/\(|\)/.test(item)) { | ||
306 | + width += 3.73; | ||
307 | + } else if (/\s/.test(item)) { | ||
308 | + width += 2.5; | ||
309 | + } else if (/%/.test(item)) { | ||
310 | + width += 8; | ||
311 | + } else { | ||
312 | + width += 10; | ||
313 | + } | ||
314 | + }); | ||
315 | + return width * fontSize / 10; | ||
316 | +} | ||
317 | + | ||
318 | +function dataCombine(series) { | ||
319 | + return series.reduce(function (a, b) { | ||
320 | + return (a.data ? a.data : a).concat(b.data); | ||
321 | + }, []); | ||
322 | +} | ||
323 | + | ||
324 | +function getSeriesDataItem(series, index) { | ||
325 | + var data = []; | ||
326 | + series.forEach(function (item) { | ||
327 | + if (item.data[index] !== null && typeof item.data[index] !== 'undefined') { | ||
328 | + var seriesItem = {}; | ||
329 | + seriesItem.color = item.color; | ||
330 | + seriesItem.name = item.name; | ||
331 | + seriesItem.data = item.format ? item.format(item.data[index]) : item.data[index]; | ||
332 | + data.push(seriesItem); | ||
333 | + } | ||
334 | + }); | ||
335 | + | ||
336 | + return data; | ||
337 | +} | ||
338 | + | ||
339 | + | ||
340 | + | ||
341 | +function getMaxTextListLength(list) { | ||
342 | + var lengthList = list.map(function (item) { | ||
343 | + return measureText(item); | ||
344 | + }); | ||
345 | + return Math.max.apply(null, lengthList); | ||
346 | +} | ||
347 | + | ||
348 | +function getRadarCoordinateSeries(length) { | ||
349 | + var eachAngle = 2 * Math.PI / length; | ||
350 | + var CoordinateSeries = []; | ||
351 | + for (var i = 0; i < length; i++) { | ||
352 | + CoordinateSeries.push(eachAngle * i); | ||
353 | + } | ||
354 | + | ||
355 | + return CoordinateSeries.map(function (item) { | ||
356 | + return -1 * item + Math.PI / 2; | ||
357 | + }); | ||
358 | +} | ||
359 | + | ||
360 | +function getToolTipData(seriesData, calPoints, index, categories) { | ||
361 | + var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; | ||
362 | + | ||
363 | + var textList = seriesData.map(function (item) { | ||
364 | + return { | ||
365 | + text: option.format ? option.format(item, categories[index]) : item.name + ': ' + item.data, | ||
366 | + color: item.color | ||
367 | + }; | ||
368 | + }); | ||
369 | + var validCalPoints = []; | ||
370 | + var offset = { | ||
371 | + x: 0, | ||
372 | + y: 0 | ||
373 | + }; | ||
374 | + calPoints.forEach(function (points) { | ||
375 | + if (typeof points[index] !== 'undefined' && points[index] !== null) { | ||
376 | + validCalPoints.push(points[index]); | ||
377 | + } | ||
378 | + }); | ||
379 | + validCalPoints.forEach(function (item) { | ||
380 | + offset.x = Math.round(item.x); | ||
381 | + offset.y += item.y; | ||
382 | + }); | ||
383 | + | ||
384 | + offset.y /= validCalPoints.length; | ||
385 | + return { textList: textList, offset: offset }; | ||
386 | +} | ||
387 | + | ||
388 | +function findCurrentIndex(currentPoints, xAxisPoints, opts, config) { | ||
389 | + var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; | ||
390 | + | ||
391 | + var currentIndex = -1; | ||
392 | + if (isInExactChartArea(currentPoints, opts, config)) { | ||
393 | + xAxisPoints.forEach(function (item, index) { | ||
394 | + if (currentPoints.x + offset > item) { | ||
395 | + currentIndex = index; | ||
396 | + } | ||
397 | + }); | ||
398 | + } | ||
399 | + | ||
400 | + return currentIndex; | ||
401 | +} | ||
402 | + | ||
403 | +function isInExactChartArea(currentPoints, opts, config) { | ||
404 | + return currentPoints.x < opts.width - config.padding && currentPoints.x > config.padding + config.yAxisWidth + config.yAxisTitleWidth && currentPoints.y > config.padding && currentPoints.y < opts.height - config.legendHeight - config.xAxisHeight - config.padding; | ||
405 | +} | ||
406 | + | ||
407 | +function findRadarChartCurrentIndex(currentPoints, radarData, count) { | ||
408 | + var eachAngleArea = 2 * Math.PI / count; | ||
409 | + var currentIndex = -1; | ||
410 | + if (isInExactPieChartArea(currentPoints, radarData.center, radarData.radius)) { | ||
411 | + var fixAngle = function fixAngle(angle) { | ||
412 | + if (angle < 0) { | ||
413 | + angle += 2 * Math.PI; | ||
414 | + } | ||
415 | + if (angle > 2 * Math.PI) { | ||
416 | + angle -= 2 * Math.PI; | ||
417 | + } | ||
418 | + return angle; | ||
419 | + }; | ||
420 | + | ||
421 | + var angle = Math.atan2(radarData.center.y - currentPoints.y, currentPoints.x - radarData.center.x); | ||
422 | + angle = -1 * angle; | ||
423 | + if (angle < 0) { | ||
424 | + angle += 2 * Math.PI; | ||
425 | + } | ||
426 | + | ||
427 | + var angleList = radarData.angleList.map(function (item) { | ||
428 | + item = fixAngle(-1 * item); | ||
429 | + | ||
430 | + return item; | ||
431 | + }); | ||
432 | + | ||
433 | + angleList.forEach(function (item, index) { | ||
434 | + var rangeStart = fixAngle(item - eachAngleArea / 2); | ||
435 | + var rangeEnd = fixAngle(item + eachAngleArea / 2); | ||
436 | + if (rangeEnd < rangeStart) { | ||
437 | + rangeEnd += 2 * Math.PI; | ||
438 | + } | ||
439 | + if (angle >= rangeStart && angle <= rangeEnd || angle + 2 * Math.PI >= rangeStart && angle + 2 * Math.PI <= rangeEnd) { | ||
440 | + currentIndex = index; | ||
441 | + } | ||
442 | + }); | ||
443 | + } | ||
444 | + | ||
445 | + return currentIndex; | ||
446 | +} | ||
447 | + | ||
448 | +function findPieChartCurrentIndex(currentPoints, pieData) { | ||
449 | + var currentIndex = -1; | ||
450 | + if (isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) { | ||
451 | + var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x); | ||
452 | + angle = -angle; | ||
453 | + for (var i = 0, len = pieData.series.length; i < len; i++) { | ||
454 | + var item = pieData.series[i]; | ||
455 | + if (isInAngleRange(angle, item._start_, item._start_ + item._proportion_ * 2 * Math.PI)) { | ||
456 | + currentIndex = i; | ||
457 | + break; | ||
458 | + } | ||
459 | + } | ||
460 | + } | ||
461 | + | ||
462 | + return currentIndex; | ||
463 | +} | ||
464 | + | ||
465 | +function isInExactPieChartArea(currentPoints, center, radius) { | ||
466 | + return Math.pow(currentPoints.x - center.x, 2) + Math.pow(currentPoints.y - center.y, 2) <= Math.pow(radius, 2); | ||
467 | +} | ||
468 | + | ||
469 | +function splitPoints(points) { | ||
470 | + var newPoints = []; | ||
471 | + var items = []; | ||
472 | + points.forEach(function (item, index) { | ||
473 | + if (item !== null) { | ||
474 | + items.push(item); | ||
475 | + } else { | ||
476 | + if (items.length) { | ||
477 | + newPoints.push(items); | ||
478 | + } | ||
479 | + items = []; | ||
480 | + } | ||
481 | + }); | ||
482 | + if (items.length) { | ||
483 | + newPoints.push(items); | ||
484 | + } | ||
485 | + | ||
486 | + return newPoints; | ||
487 | +} | ||
488 | + | ||
489 | +function calLegendData(series, opts, config) { | ||
490 | + if (opts.legend === false) { | ||
491 | + return { | ||
492 | + legendList: [], | ||
493 | + legendHeight: 0 | ||
494 | + }; | ||
495 | + } | ||
496 | + var padding = 5; | ||
497 | + var marginTop = 8; | ||
498 | + var shapeWidth = 15; | ||
499 | + var legendList = []; | ||
500 | + var widthCount = 0; | ||
501 | + var currentRow = []; | ||
502 | + series.forEach(function (item) { | ||
503 | + var itemWidth = 3 * padding + shapeWidth + measureText(item.name || 'undefined'); | ||
504 | + if (widthCount + itemWidth > opts.width) { | ||
505 | + legendList.push(currentRow); | ||
506 | + widthCount = itemWidth; | ||
507 | + currentRow = [item]; | ||
508 | + } else { | ||
509 | + widthCount += itemWidth; | ||
510 | + currentRow.push(item); | ||
511 | + } | ||
512 | + }); | ||
513 | + if (currentRow.length) { | ||
514 | + legendList.push(currentRow); | ||
515 | + } | ||
516 | + | ||
517 | + return { | ||
518 | + legendList: legendList, | ||
519 | + legendHeight: legendList.length * (config.fontSize + marginTop) + padding | ||
520 | + }; | ||
521 | +} | ||
522 | + | ||
523 | +function calCategoriesData(categories, opts, config) { | ||
524 | + var result = { | ||
525 | + angle: 0, | ||
526 | + xAxisHeight: config.xAxisHeight | ||
527 | + }; | ||
528 | + | ||
529 | + var _getXAxisPoints = getXAxisPoints(categories, opts, config), | ||
530 | + eachSpacing = _getXAxisPoints.eachSpacing; | ||
531 | + | ||
532 | + // get max length of categories text | ||
533 | + | ||
534 | + | ||
535 | + var categoriesTextLenth = categories.map(function (item) { | ||
536 | + return measureText(item); | ||
537 | + }); | ||
538 | + | ||
539 | + var maxTextLength = Math.max.apply(this, categoriesTextLenth); | ||
540 | + | ||
541 | + if (maxTextLength + 2 * config.xAxisTextPadding > eachSpacing) { | ||
542 | + result.angle = 45 * Math.PI / 180; | ||
543 | + result.xAxisHeight = 2 * config.xAxisTextPadding + maxTextLength * Math.sin(result.angle); | ||
544 | + } | ||
545 | + | ||
546 | + return result; | ||
547 | +} | ||
548 | + | ||
549 | +function getRadarDataPoints(angleList, center, radius, series, opts) { | ||
550 | + var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1; | ||
551 | + | ||
552 | + var radarOption = opts.extra.radar || {}; | ||
553 | + radarOption.max = radarOption.max || 0; | ||
554 | + var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series))); | ||
555 | + | ||
556 | + var data = []; | ||
557 | + series.forEach(function (each) { | ||
558 | + var listItem = {}; | ||
559 | + listItem.color = each.color; | ||
560 | + listItem.data = []; | ||
561 | + each.data.forEach(function (item, index) { | ||
562 | + var tmp = {}; | ||
563 | + tmp.angle = angleList[index]; | ||
564 | + | ||
565 | + tmp.proportion = item / maxData; | ||
566 | + tmp.position = convertCoordinateOrigin(radius * tmp.proportion * process * Math.cos(tmp.angle), radius * tmp.proportion * process * Math.sin(tmp.angle), center); | ||
567 | + listItem.data.push(tmp); | ||
568 | + }); | ||
569 | + | ||
570 | + data.push(listItem); | ||
571 | + }); | ||
572 | + | ||
573 | + return data; | ||
574 | +} | ||
575 | + | ||
576 | +function getPieDataPoints(series) { | ||
577 | + var process = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; | ||
578 | + | ||
579 | + var count = 0; | ||
580 | + var _start_ = 0; | ||
581 | + series.forEach(function (item) { | ||
582 | + item.data = item.data === null ? 0 : item.data; | ||
583 | + count += item.data; | ||
584 | + }); | ||
585 | + series.forEach(function (item) { | ||
586 | + item.data = item.data === null ? 0 : item.data; | ||
587 | + item._proportion_ = item.data / count * process; | ||
588 | + }); | ||
589 | + series.forEach(function (item) { | ||
590 | + item._start_ = _start_; | ||
591 | + _start_ += 2 * item._proportion_ * Math.PI; | ||
592 | + }); | ||
593 | + | ||
594 | + return series; | ||
595 | +} | ||
596 | + | ||
597 | +function getPieTextMaxLength(series) { | ||
598 | + series = getPieDataPoints(series); | ||
599 | + var maxLength = 0; | ||
600 | + series.forEach(function (item) { | ||
601 | + var text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%'; | ||
602 | + maxLength = Math.max(maxLength, measureText(text)); | ||
603 | + }); | ||
604 | + | ||
605 | + return maxLength; | ||
606 | +} | ||
607 | + | ||
608 | +function fixColumeData(points, eachSpacing, columnLen, index, config, opts) { | ||
609 | + return points.map(function (item) { | ||
610 | + if (item === null) { | ||
611 | + return null; | ||
612 | + } | ||
613 | + item.width = (eachSpacing - 2 * config.columePadding) / columnLen; | ||
614 | + | ||
615 | + if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) { | ||
616 | + // customer column width | ||
617 | + item.width = Math.min(item.width, +opts.extra.column.width); | ||
618 | + } else { | ||
619 | + // default width should less tran 25px | ||
620 | + // don't ask me why, I don't know | ||
621 | + item.width = Math.min(item.width, 25); | ||
622 | + } | ||
623 | + item.x += (index + 0.5 - columnLen / 2) * item.width; | ||
624 | + | ||
625 | + return item; | ||
626 | + }); | ||
627 | +} | ||
628 | + | ||
629 | +function getXAxisPoints(categories, opts, config) { | ||
630 | + var yAxisTotalWidth = config.yAxisWidth + config.yAxisTitleWidth; | ||
631 | + var spacingValid = opts.width - 2 * config.padding - yAxisTotalWidth; | ||
632 | + var dataCount = opts.enableScroll ? Math.min(5, categories.length) : categories.length; | ||
633 | + var eachSpacing = spacingValid / dataCount; | ||
634 | + | ||
635 | + var xAxisPoints = []; | ||
636 | + var startX = config.padding + yAxisTotalWidth; | ||
637 | + var endX = opts.width - config.padding; | ||
638 | + categories.forEach(function (item, index) { | ||
639 | + xAxisPoints.push(startX + index * eachSpacing); | ||
640 | + }); | ||
641 | + if (opts.enableScroll === true) { | ||
642 | + xAxisPoints.push(startX + categories.length * eachSpacing); | ||
643 | + } else { | ||
644 | + xAxisPoints.push(endX); | ||
645 | + } | ||
646 | + | ||
647 | + return { xAxisPoints: xAxisPoints, startX: startX, endX: endX, eachSpacing: eachSpacing }; | ||
648 | +} | ||
649 | + | ||
650 | +function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) { | ||
651 | + var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1; | ||
652 | + | ||
653 | + var points = []; | ||
654 | + var validHeight = opts.height - 2 * config.padding - config.xAxisHeight - config.legendHeight; | ||
655 | + data.forEach(function (item, index) { | ||
656 | + if (item === null) { | ||
657 | + points.push(null); | ||
658 | + } else { | ||
659 | + var point = {}; | ||
660 | + point.x = xAxisPoints[index] + Math.round(eachSpacing / 2); | ||
661 | + var height = validHeight * (item - minRange) / (maxRange - minRange); | ||
662 | + height *= process; | ||
663 | + point.y = opts.height - config.xAxisHeight - config.legendHeight - Math.round(height) - config.padding; | ||
664 | + points.push(point); | ||
665 | + } | ||
666 | + }); | ||
667 | + | ||
668 | + return points; | ||
669 | +} | ||
670 | + | ||
671 | +function getYAxisTextList(series, opts, config) { | ||
672 | + var data = dataCombine(series); | ||
673 | + // remove null from data | ||
674 | + data = data.filter(function (item) { | ||
675 | + return item !== null; | ||
676 | + }); | ||
677 | + var minData = Math.min.apply(this, data); | ||
678 | + var maxData = Math.max.apply(this, data); | ||
679 | + if (typeof opts.yAxis.min === 'number') { | ||
680 | + minData = Math.min(opts.yAxis.min, minData); | ||
681 | + } | ||
682 | + if (typeof opts.yAxis.max === 'number') { | ||
683 | + maxData = Math.max(opts.yAxis.max, maxData); | ||
684 | + } | ||
685 | + | ||
686 | + // fix issue https://github.com/xiaolin3303/wx-charts/issues/9 | ||
687 | + if (minData === maxData) { | ||
688 | + var rangeSpan = maxData || 1; | ||
689 | + minData -= rangeSpan; | ||
690 | + maxData += rangeSpan; | ||
691 | + } | ||
692 | + | ||
693 | + var dataRange = getDataRange(minData, maxData); | ||
694 | + var minRange = dataRange.minRange; | ||
695 | + var maxRange = dataRange.maxRange; | ||
696 | + | ||
697 | + var range = []; | ||
698 | + var eachRange = (maxRange - minRange) / config.yAxisSplit; | ||
699 | + | ||
700 | + for (var i = 0; i <= config.yAxisSplit; i++) { | ||
701 | + range.push(minRange + eachRange * i); | ||
702 | + } | ||
703 | + return range.reverse(); | ||
704 | +} | ||
705 | + | ||
706 | +function calYAxisData(series, opts, config) { | ||
707 | + | ||
708 | + var ranges = getYAxisTextList(series, opts, config); | ||
709 | + var yAxisWidth = config.yAxisWidth; | ||
710 | + var rangesFormat = ranges.map(function (item) { | ||
711 | + item = util.toFixed(item, 2); | ||
712 | + item = opts.yAxis.format ? opts.yAxis.format(Number(item)) : item; | ||
713 | + yAxisWidth = Math.max(yAxisWidth, measureText(item) + 5); | ||
714 | + return item; | ||
715 | + }); | ||
716 | + if (opts.yAxis.disabled === true) { | ||
717 | + yAxisWidth = 0; | ||
718 | + } | ||
719 | + | ||
720 | + return { rangesFormat: rangesFormat, ranges: ranges, yAxisWidth: yAxisWidth }; | ||
721 | +} | ||
722 | + | ||
723 | +function drawPointShape(points, color, shape, context) { | ||
724 | + context.beginPath(); | ||
725 | + context.setStrokeStyle("#ffffff"); | ||
726 | + context.setLineWidth(1); | ||
727 | + context.setFillStyle(color); | ||
728 | + | ||
729 | + if (shape === 'diamond') { | ||
730 | + points.forEach(function (item, index) { | ||
731 | + if (item !== null) { | ||
732 | + context.moveTo(item.x, item.y - 4.5); | ||
733 | + context.lineTo(item.x - 4.5, item.y); | ||
734 | + context.lineTo(item.x, item.y + 4.5); | ||
735 | + context.lineTo(item.x + 4.5, item.y); | ||
736 | + context.lineTo(item.x, item.y - 4.5); | ||
737 | + } | ||
738 | + }); | ||
739 | + } else if (shape === 'circle') { | ||
740 | + points.forEach(function (item, index) { | ||
741 | + if (item !== null) { | ||
742 | + context.moveTo(item.x + 3.5, item.y); | ||
743 | + context.arc(item.x, item.y, 4, 0, 2 * Math.PI, false); | ||
744 | + } | ||
745 | + }); | ||
746 | + } else if (shape === 'rect') { | ||
747 | + points.forEach(function (item, index) { | ||
748 | + if (item !== null) { | ||
749 | + context.moveTo(item.x - 3.5, item.y - 3.5); | ||
750 | + context.rect(item.x - 3.5, item.y - 3.5, 7, 7); | ||
751 | + } | ||
752 | + }); | ||
753 | + } else if (shape === 'triangle') { | ||
754 | + points.forEach(function (item, index) { | ||
755 | + if (item !== null) { | ||
756 | + context.moveTo(item.x, item.y - 4.5); | ||
757 | + context.lineTo(item.x - 4.5, item.y + 4.5); | ||
758 | + context.lineTo(item.x + 4.5, item.y + 4.5); | ||
759 | + context.lineTo(item.x, item.y - 4.5); | ||
760 | + } | ||
761 | + }); | ||
762 | + } | ||
763 | + context.closePath(); | ||
764 | + context.fill(); | ||
765 | + context.stroke(); | ||
766 | +} | ||
767 | + | ||
768 | +function drawRingTitle(opts, config, context) { | ||
769 | + var titlefontSize = opts.title.fontSize || config.titleFontSize; | ||
770 | + var subtitlefontSize = opts.subtitle.fontSize || config.subtitleFontSize; | ||
771 | + var title = opts.title.name || ''; | ||
772 | + var subtitle = opts.subtitle.name || ''; | ||
773 | + var titleFontColor = opts.title.color || config.titleColor; | ||
774 | + var subtitleFontColor = opts.subtitle.color || config.subtitleColor; | ||
775 | + var titleHeight = title ? titlefontSize : 0; | ||
776 | + var subtitleHeight = subtitle ? subtitlefontSize : 0; | ||
777 | + var margin = 5; | ||
778 | + if (subtitle) { | ||
779 | + var textWidth = measureText(subtitle, subtitlefontSize); | ||
780 | + var startX = (opts.width - textWidth) / 2 + (opts.subtitle.offsetX || 0); | ||
781 | + var startY = (opts.height - config.legendHeight + subtitlefontSize) / 2; | ||
782 | + if (title) { | ||
783 | + startY -= (titleHeight + margin) / 2; | ||
784 | + } | ||
785 | + context.beginPath(); | ||
786 | + context.setFontSize(subtitlefontSize); | ||
787 | + context.setFillStyle(subtitleFontColor); | ||
788 | + context.fillText(subtitle, startX, startY); | ||
789 | + context.stroke(); | ||
790 | + context.closePath(); | ||
791 | + } | ||
792 | + if (title) { | ||
793 | + var _textWidth = measureText(title, titlefontSize); | ||
794 | + var _startX = (opts.width - _textWidth) / 2 + (opts.title.offsetX || 0); | ||
795 | + var _startY = (opts.height - config.legendHeight + titlefontSize) / 2; | ||
796 | + if (subtitle) { | ||
797 | + _startY += (subtitleHeight + margin) / 2; | ||
798 | + } | ||
799 | + context.beginPath(); | ||
800 | + context.setFontSize(titlefontSize); | ||
801 | + context.setFillStyle(titleFontColor); | ||
802 | + context.fillText(title, _startX, _startY); | ||
803 | + context.stroke(); | ||
804 | + context.closePath(); | ||
805 | + } | ||
806 | +} | ||
807 | + | ||
808 | +function drawPointText(points, series, config, context) { | ||
809 | + // 绘制数据文案 | ||
810 | + var data = series.data; | ||
811 | + | ||
812 | + context.beginPath(); | ||
813 | + context.setFontSize(config.fontSize); | ||
814 | + context.setFillStyle('#666666'); | ||
815 | + points.forEach(function (item, index) { | ||
816 | + if (item !== null) { | ||
817 | + var formatVal = series.format ? series.format(data[index]) : data[index]; | ||
818 | + context.fillText(formatVal, item.x - measureText(formatVal) / 2, item.y - 2); | ||
819 | + } | ||
820 | + }); | ||
821 | + context.closePath(); | ||
822 | + context.stroke(); | ||
823 | +} | ||
824 | + | ||
825 | +function drawRadarLabel(angleList, radius, centerPosition, opts, config, context) { | ||
826 | + var radarOption = opts.extra.radar || {}; | ||
827 | + radius += config.radarLabelTextMargin; | ||
828 | + context.beginPath(); | ||
829 | + context.setFontSize(config.fontSize); | ||
830 | + context.setFillStyle(radarOption.labelColor || '#666666'); | ||
831 | + angleList.forEach(function (angle, index) { | ||
832 | + var pos = { | ||
833 | + x: radius * Math.cos(angle), | ||
834 | + y: radius * Math.sin(angle) | ||
835 | + }; | ||
836 | + var posRelativeCanvas = convertCoordinateOrigin(pos.x, pos.y, centerPosition); | ||
837 | + var startX = posRelativeCanvas.x; | ||
838 | + var startY = posRelativeCanvas.y; | ||
839 | + if (util.approximatelyEqual(pos.x, 0)) { | ||
840 | + startX -= measureText(opts.categories[index] || '') / 2; | ||
841 | + } else if (pos.x < 0) { | ||
842 | + startX -= measureText(opts.categories[index] || ''); | ||
843 | + } | ||
844 | + context.fillText(opts.categories[index] || '', startX, startY + config.fontSize / 2); | ||
845 | + }); | ||
846 | + context.stroke(); | ||
847 | + context.closePath(); | ||
848 | +} | ||
849 | + | ||
850 | +function drawPieText(series, opts, config, context, radius, center) { | ||
851 | + var lineRadius = radius + config.pieChartLinePadding; | ||
852 | + var textObjectCollection = []; | ||
853 | + var lastTextObject = null; | ||
854 | + | ||
855 | + var seriesConvert = series.map(function (item) { | ||
856 | + var arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._proportion_ / 2); | ||
857 | + var text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%'; | ||
858 | + var color = item.color; | ||
859 | + return { arc: arc, text: text, color: color }; | ||
860 | + }); | ||
861 | + seriesConvert.forEach(function (item) { | ||
862 | + // line end | ||
863 | + var orginX1 = Math.cos(item.arc) * lineRadius; | ||
864 | + var orginY1 = Math.sin(item.arc) * lineRadius; | ||
865 | + | ||
866 | + // line start | ||
867 | + var orginX2 = Math.cos(item.arc) * radius; | ||
868 | + var orginY2 = Math.sin(item.arc) * radius; | ||
869 | + | ||
870 | + // text start | ||
871 | + var orginX3 = orginX1 >= 0 ? orginX1 + config.pieChartTextPadding : orginX1 - config.pieChartTextPadding; | ||
872 | + var orginY3 = orginY1; | ||
873 | + | ||
874 | + var textWidth = measureText(item.text); | ||
875 | + var startY = orginY3; | ||
876 | + | ||
877 | + if (lastTextObject && util.isSameXCoordinateArea(lastTextObject.start, { x: orginX3 })) { | ||
878 | + if (orginX3 > 0) { | ||
879 | + startY = Math.min(orginY3, lastTextObject.start.y); | ||
880 | + } else if (orginX1 < 0) { | ||
881 | + startY = Math.max(orginY3, lastTextObject.start.y); | ||
882 | + } else { | ||
883 | + if (orginY3 > 0) { | ||
884 | + startY = Math.max(orginY3, lastTextObject.start.y); | ||
885 | + } else { | ||
886 | + startY = Math.min(orginY3, lastTextObject.start.y); | ||
887 | + } | ||
888 | + } | ||
889 | + } | ||
890 | + | ||
891 | + if (orginX3 < 0) { | ||
892 | + orginX3 -= textWidth; | ||
893 | + } | ||
894 | + | ||
895 | + var textObject = { | ||
896 | + lineStart: { | ||
897 | + x: orginX2, | ||
898 | + y: orginY2 | ||
899 | + }, | ||
900 | + lineEnd: { | ||
901 | + x: orginX1, | ||
902 | + y: orginY1 | ||
903 | + }, | ||
904 | + start: { | ||
905 | + x: orginX3, | ||
906 | + y: startY | ||
907 | + }, | ||
908 | + width: textWidth, | ||
909 | + height: config.fontSize, | ||
910 | + text: item.text, | ||
911 | + color: item.color | ||
912 | + }; | ||
913 | + | ||
914 | + lastTextObject = avoidCollision(textObject, lastTextObject); | ||
915 | + textObjectCollection.push(lastTextObject); | ||
916 | + }); | ||
917 | + | ||
918 | + textObjectCollection.forEach(function (item) { | ||
919 | + var lineStartPoistion = convertCoordinateOrigin(item.lineStart.x, item.lineStart.y, center); | ||
920 | + var lineEndPoistion = convertCoordinateOrigin(item.lineEnd.x, item.lineEnd.y, center); | ||
921 | + var textPosition = convertCoordinateOrigin(item.start.x, item.start.y, center); | ||
922 | + context.setLineWidth(1); | ||
923 | + context.setFontSize(config.fontSize); | ||
924 | + context.beginPath(); | ||
925 | + context.setStrokeStyle(item.color); | ||
926 | + context.setFillStyle(item.color); | ||
927 | + context.moveTo(lineStartPoistion.x, lineStartPoistion.y); | ||
928 | + var curveStartX = item.start.x < 0 ? textPosition.x + item.width : textPosition.x; | ||
929 | + var textStartX = item.start.x < 0 ? textPosition.x - 5 : textPosition.x + 5; | ||
930 | + context.quadraticCurveTo(lineEndPoistion.x, lineEndPoistion.y, curveStartX, textPosition.y); | ||
931 | + context.moveTo(lineStartPoistion.x, lineStartPoistion.y); | ||
932 | + context.stroke(); | ||
933 | + context.closePath(); | ||
934 | + context.beginPath(); | ||
935 | + context.moveTo(textPosition.x + item.width, textPosition.y); | ||
936 | + context.arc(curveStartX, textPosition.y, 2, 0, 2 * Math.PI); | ||
937 | + context.closePath(); | ||
938 | + context.fill(); | ||
939 | + context.beginPath(); | ||
940 | + context.setFillStyle('#666666'); | ||
941 | + context.fillText(item.text, textStartX, textPosition.y + 3); | ||
942 | + context.closePath(); | ||
943 | + context.stroke(); | ||
944 | + | ||
945 | + context.closePath(); | ||
946 | + }); | ||
947 | +} | ||
948 | + | ||
949 | +function drawToolTipSplitLine(offsetX, opts, config, context) { | ||
950 | + var startY = config.padding; | ||
951 | + var endY = opts.height - config.padding - config.xAxisHeight - config.legendHeight; | ||
952 | + context.beginPath(); | ||
953 | + context.setStrokeStyle('#cccccc'); | ||
954 | + context.setLineWidth(1); | ||
955 | + context.moveTo(offsetX, startY); | ||
956 | + context.lineTo(offsetX, endY); | ||
957 | + context.stroke(); | ||
958 | + context.closePath(); | ||
959 | +} | ||
960 | + | ||
961 | +function drawToolTip(textList, offset, opts, config, context) { | ||
962 | + var legendWidth = 4; | ||
963 | + var legendMarginRight = 5; | ||
964 | + var arrowWidth = 8; | ||
965 | + var isOverRightBorder = false; | ||
966 | + offset = assign({ | ||
967 | + x: 0, | ||
968 | + y: 0 | ||
969 | + }, offset); | ||
970 | + offset.y -= 8; | ||
971 | + var textWidth = textList.map(function (item) { | ||
972 | + return measureText(item.text); | ||
973 | + }); | ||
974 | + | ||
975 | + var toolTipWidth = legendWidth + legendMarginRight + 4 * config.toolTipPadding + Math.max.apply(null, textWidth); | ||
976 | + var toolTipHeight = 2 * config.toolTipPadding + textList.length * config.toolTipLineHeight; | ||
977 | + | ||
978 | + // if beyond the right border | ||
979 | + if (offset.x - Math.abs(opts._scrollDistance_) + arrowWidth + toolTipWidth > opts.width) { | ||
980 | + isOverRightBorder = true; | ||
981 | + } | ||
982 | + | ||
983 | + // draw background rect | ||
984 | + context.beginPath(); | ||
985 | + context.setFillStyle(opts.tooltip.option.background || config.toolTipBackground); | ||
986 | + context.setGlobalAlpha(config.toolTipOpacity); | ||
987 | + if (isOverRightBorder) { | ||
988 | + context.moveTo(offset.x, offset.y + 10); | ||
989 | + context.lineTo(offset.x - arrowWidth, offset.y + 10 - 5); | ||
990 | + context.lineTo(offset.x - arrowWidth, offset.y + 10 + 5); | ||
991 | + context.moveTo(offset.x, offset.y + 10); | ||
992 | + context.fillRect(offset.x - toolTipWidth - arrowWidth, offset.y, toolTipWidth, toolTipHeight); | ||
993 | + } else { | ||
994 | + context.moveTo(offset.x, offset.y + 10); | ||
995 | + context.lineTo(offset.x + arrowWidth, offset.y + 10 - 5); | ||
996 | + context.lineTo(offset.x + arrowWidth, offset.y + 10 + 5); | ||
997 | + context.moveTo(offset.x, offset.y + 10); | ||
998 | + context.fillRect(offset.x + arrowWidth, offset.y, toolTipWidth, toolTipHeight); | ||
999 | + } | ||
1000 | + | ||
1001 | + context.closePath(); | ||
1002 | + context.fill(); | ||
1003 | + context.setGlobalAlpha(1); | ||
1004 | + | ||
1005 | + // draw legend | ||
1006 | + textList.forEach(function (item, index) { | ||
1007 | + context.beginPath(); | ||
1008 | + context.setFillStyle(item.color); | ||
1009 | + var startX = offset.x + arrowWidth + 2 * config.toolTipPadding; | ||
1010 | + var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * index + config.toolTipPadding; | ||
1011 | + if (isOverRightBorder) { | ||
1012 | + startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding; | ||
1013 | + } | ||
1014 | + context.fillRect(startX, startY, legendWidth, config.fontSize); | ||
1015 | + context.closePath(); | ||
1016 | + }); | ||
1017 | + | ||
1018 | + // draw text list | ||
1019 | + context.beginPath(); | ||
1020 | + context.setFontSize(config.fontSize); | ||
1021 | + context.setFillStyle('#ffffff'); | ||
1022 | + textList.forEach(function (item, index) { | ||
1023 | + var startX = offset.x + arrowWidth + 2 * config.toolTipPadding + legendWidth + legendMarginRight; | ||
1024 | + if (isOverRightBorder) { | ||
1025 | + startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding + +legendWidth + legendMarginRight; | ||
1026 | + } | ||
1027 | + var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * index + config.toolTipPadding; | ||
1028 | + context.fillText(item.text, startX, startY + config.fontSize); | ||
1029 | + }); | ||
1030 | + context.stroke(); | ||
1031 | + context.closePath(); | ||
1032 | +} | ||
1033 | + | ||
1034 | +function drawYAxisTitle(title, opts, config, context) { | ||
1035 | + var startX = config.xAxisHeight + (opts.height - config.xAxisHeight - measureText(title)) / 2; | ||
1036 | + context.save(); | ||
1037 | + context.beginPath(); | ||
1038 | + context.setFontSize(config.fontSize); | ||
1039 | + context.setFillStyle(opts.yAxis.titleFontColor || '#333333'); | ||
1040 | + context.translate(0, opts.height); | ||
1041 | + context.rotate(-90 * Math.PI / 180); | ||
1042 | + context.fillText(title, startX, config.padding + 0.5 * config.fontSize); | ||
1043 | + context.stroke(); | ||
1044 | + context.closePath(); | ||
1045 | + context.restore(); | ||
1046 | +} | ||
1047 | + | ||
1048 | +function drawColumnDataPoints(series, opts, config, context) { | ||
1049 | + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; | ||
1050 | + | ||
1051 | + var _calYAxisData = calYAxisData(series, opts, config), | ||
1052 | + ranges = _calYAxisData.ranges; | ||
1053 | + | ||
1054 | + var _getXAxisPoints = getXAxisPoints(opts.categories, opts, config), | ||
1055 | + xAxisPoints = _getXAxisPoints.xAxisPoints, | ||
1056 | + eachSpacing = _getXAxisPoints.eachSpacing; | ||
1057 | + | ||
1058 | + var minRange = ranges.pop(); | ||
1059 | + var maxRange = ranges.shift(); | ||
1060 | + context.save(); | ||
1061 | + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { | ||
1062 | + context.translate(opts._scrollDistance_, 0); | ||
1063 | + } | ||
1064 | + | ||
1065 | + series.forEach(function (eachSeries, seriesIndex) { | ||
1066 | + var data = eachSeries.data; | ||
1067 | + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); | ||
1068 | + points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts); | ||
1069 | + | ||
1070 | + // 绘制柱状数据图 | ||
1071 | + context.beginPath(); | ||
1072 | + context.setFillStyle(eachSeries.color); | ||
1073 | + points.forEach(function (item, index) { | ||
1074 | + if (item !== null) { | ||
1075 | + var startX = item.x - item.width / 2 + 1; | ||
1076 | + var height = opts.height - item.y - config.padding - config.xAxisHeight - config.legendHeight; | ||
1077 | + context.moveTo(startX, item.y); | ||
1078 | + context.rect(startX, item.y, item.width - 2, height); | ||
1079 | + } | ||
1080 | + }); | ||
1081 | + context.closePath(); | ||
1082 | + context.fill(); | ||
1083 | + }); | ||
1084 | + series.forEach(function (eachSeries, seriesIndex) { | ||
1085 | + var data = eachSeries.data; | ||
1086 | + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); | ||
1087 | + points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts); | ||
1088 | + if (opts.dataLabel !== false && process === 1) { | ||
1089 | + drawPointText(points, eachSeries, config, context); | ||
1090 | + } | ||
1091 | + }); | ||
1092 | + context.restore(); | ||
1093 | + return { | ||
1094 | + xAxisPoints: xAxisPoints, | ||
1095 | + eachSpacing: eachSpacing | ||
1096 | + }; | ||
1097 | +} | ||
1098 | + | ||
1099 | +function drawAreaDataPoints(series, opts, config, context) { | ||
1100 | + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; | ||
1101 | + | ||
1102 | + var _calYAxisData2 = calYAxisData(series, opts, config), | ||
1103 | + ranges = _calYAxisData2.ranges; | ||
1104 | + | ||
1105 | + var _getXAxisPoints2 = getXAxisPoints(opts.categories, opts, config), | ||
1106 | + xAxisPoints = _getXAxisPoints2.xAxisPoints, | ||
1107 | + eachSpacing = _getXAxisPoints2.eachSpacing; | ||
1108 | + | ||
1109 | + var minRange = ranges.pop(); | ||
1110 | + var maxRange = ranges.shift(); | ||
1111 | + var endY = opts.height - config.padding - config.xAxisHeight - config.legendHeight; | ||
1112 | + var calPoints = []; | ||
1113 | + | ||
1114 | + context.save(); | ||
1115 | + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { | ||
1116 | + context.translate(opts._scrollDistance_, 0); | ||
1117 | + } | ||
1118 | + | ||
1119 | + if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) { | ||
1120 | + drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context); | ||
1121 | + } | ||
1122 | + | ||
1123 | + series.forEach(function (eachSeries, seriesIndex) { | ||
1124 | + var data = eachSeries.data; | ||
1125 | + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); | ||
1126 | + calPoints.push(points); | ||
1127 | + | ||
1128 | + var splitPointList = splitPoints(points); | ||
1129 | + | ||
1130 | + splitPointList.forEach(function (points) { | ||
1131 | + // 绘制区域数据 | ||
1132 | + context.beginPath(); | ||
1133 | + context.setStrokeStyle(eachSeries.color); | ||
1134 | + context.setFillStyle(eachSeries.color); | ||
1135 | + context.setGlobalAlpha(0.6); | ||
1136 | + context.setLineWidth(2); | ||
1137 | + if (points.length > 1) { | ||
1138 | + var firstPoint = points[0]; | ||
1139 | + var lastPoint = points[points.length - 1]; | ||
1140 | + | ||
1141 | + context.moveTo(firstPoint.x, firstPoint.y); | ||
1142 | + if (opts.extra.lineStyle === 'curve') { | ||
1143 | + points.forEach(function (item, index) { | ||
1144 | + if (index > 0) { | ||
1145 | + var ctrlPoint = createCurveControlPoints(points, index - 1); | ||
1146 | + context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y); | ||
1147 | + } | ||
1148 | + }); | ||
1149 | + } else { | ||
1150 | + points.forEach(function (item, index) { | ||
1151 | + if (index > 0) { | ||
1152 | + context.lineTo(item.x, item.y); | ||
1153 | + } | ||
1154 | + }); | ||
1155 | + } | ||
1156 | + | ||
1157 | + context.lineTo(lastPoint.x, endY); | ||
1158 | + context.lineTo(firstPoint.x, endY); | ||
1159 | + context.lineTo(firstPoint.x, firstPoint.y); | ||
1160 | + } else { | ||
1161 | + var item = points[0]; | ||
1162 | + context.moveTo(item.x - eachSpacing / 2, item.y); | ||
1163 | + context.lineTo(item.x + eachSpacing / 2, item.y); | ||
1164 | + context.lineTo(item.x + eachSpacing / 2, endY); | ||
1165 | + context.lineTo(item.x - eachSpacing / 2, endY); | ||
1166 | + context.moveTo(item.x - eachSpacing / 2, item.y); | ||
1167 | + } | ||
1168 | + context.closePath(); | ||
1169 | + context.fill(); | ||
1170 | + context.setGlobalAlpha(1); | ||
1171 | + }); | ||
1172 | + | ||
1173 | + if (opts.dataPointShape !== false) { | ||
1174 | + var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length]; | ||
1175 | + drawPointShape(points, eachSeries.color, shape, context); | ||
1176 | + } | ||
1177 | + }); | ||
1178 | + if (opts.dataLabel !== false && process === 1) { | ||
1179 | + series.forEach(function (eachSeries, seriesIndex) { | ||
1180 | + var data = eachSeries.data; | ||
1181 | + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); | ||
1182 | + drawPointText(points, eachSeries, config, context); | ||
1183 | + }); | ||
1184 | + } | ||
1185 | + | ||
1186 | + context.restore(); | ||
1187 | + | ||
1188 | + return { | ||
1189 | + xAxisPoints: xAxisPoints, | ||
1190 | + calPoints: calPoints, | ||
1191 | + eachSpacing: eachSpacing | ||
1192 | + }; | ||
1193 | +} | ||
1194 | + | ||
1195 | +function drawLineDataPoints(series, opts, config, context) { | ||
1196 | + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; | ||
1197 | + | ||
1198 | + var _calYAxisData3 = calYAxisData(series, opts, config), | ||
1199 | + ranges = _calYAxisData3.ranges; | ||
1200 | + | ||
1201 | + var _getXAxisPoints3 = getXAxisPoints(opts.categories, opts, config), | ||
1202 | + xAxisPoints = _getXAxisPoints3.xAxisPoints, | ||
1203 | + eachSpacing = _getXAxisPoints3.eachSpacing; | ||
1204 | + | ||
1205 | + var minRange = ranges.pop(); | ||
1206 | + var maxRange = ranges.shift(); | ||
1207 | + var calPoints = []; | ||
1208 | + | ||
1209 | + context.save(); | ||
1210 | + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { | ||
1211 | + context.translate(opts._scrollDistance_, 0); | ||
1212 | + } | ||
1213 | + | ||
1214 | + if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) { | ||
1215 | + drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context); | ||
1216 | + } | ||
1217 | + | ||
1218 | + series.forEach(function (eachSeries, seriesIndex) { | ||
1219 | + var data = eachSeries.data; | ||
1220 | + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); | ||
1221 | + calPoints.push(points); | ||
1222 | + var splitPointList = splitPoints(points); | ||
1223 | + | ||
1224 | + splitPointList.forEach(function (points, index) { | ||
1225 | + context.beginPath(); | ||
1226 | + context.setStrokeStyle(eachSeries.color); | ||
1227 | + context.setLineWidth(2); | ||
1228 | + if (points.length === 1) { | ||
1229 | + context.moveTo(points[0].x, points[0].y); | ||
1230 | + context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI); | ||
1231 | + } else { | ||
1232 | + context.moveTo(points[0].x, points[0].y); | ||
1233 | + if (opts.extra.lineStyle === 'curve') { | ||
1234 | + points.forEach(function (item, index) { | ||
1235 | + if (index > 0) { | ||
1236 | + var ctrlPoint = createCurveControlPoints(points, index - 1); | ||
1237 | + context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y); | ||
1238 | + } | ||
1239 | + }); | ||
1240 | + } else { | ||
1241 | + points.forEach(function (item, index) { | ||
1242 | + if (index > 0) { | ||
1243 | + context.lineTo(item.x, item.y); | ||
1244 | + } | ||
1245 | + }); | ||
1246 | + } | ||
1247 | + context.moveTo(points[0].x, points[0].y); | ||
1248 | + } | ||
1249 | + context.closePath(); | ||
1250 | + context.stroke(); | ||
1251 | + }); | ||
1252 | + | ||
1253 | + if (opts.dataPointShape !== false) { | ||
1254 | + var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length]; | ||
1255 | + drawPointShape(points, eachSeries.color, shape, context); | ||
1256 | + } | ||
1257 | + }); | ||
1258 | + if (opts.dataLabel !== false && process === 1) { | ||
1259 | + series.forEach(function (eachSeries, seriesIndex) { | ||
1260 | + var data = eachSeries.data; | ||
1261 | + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); | ||
1262 | + drawPointText(points, eachSeries, config, context); | ||
1263 | + }); | ||
1264 | + } | ||
1265 | + | ||
1266 | + context.restore(); | ||
1267 | + | ||
1268 | + return { | ||
1269 | + xAxisPoints: xAxisPoints, | ||
1270 | + calPoints: calPoints, | ||
1271 | + eachSpacing: eachSpacing | ||
1272 | + }; | ||
1273 | +} | ||
1274 | + | ||
1275 | +function drawToolTipBridge(opts, config, context, process) { | ||
1276 | + context.save(); | ||
1277 | + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { | ||
1278 | + context.translate(opts._scrollDistance_, 0); | ||
1279 | + } | ||
1280 | + if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) { | ||
1281 | + drawToolTip(opts.tooltip.textList, opts.tooltip.offset, opts, config, context); | ||
1282 | + } | ||
1283 | + context.restore(); | ||
1284 | +} | ||
1285 | + | ||
1286 | +function drawXAxis(categories, opts, config, context) { | ||
1287 | + var _getXAxisPoints4 = getXAxisPoints(categories, opts, config), | ||
1288 | + xAxisPoints = _getXAxisPoints4.xAxisPoints, | ||
1289 | + startX = _getXAxisPoints4.startX, | ||
1290 | + endX = _getXAxisPoints4.endX, | ||
1291 | + eachSpacing = _getXAxisPoints4.eachSpacing; | ||
1292 | + | ||
1293 | + var startY = opts.height - config.padding - config.xAxisHeight - config.legendHeight; | ||
1294 | + var endY = startY + config.xAxisLineHeight; | ||
1295 | + | ||
1296 | + context.save(); | ||
1297 | + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) { | ||
1298 | + context.translate(opts._scrollDistance_, 0); | ||
1299 | + } | ||
1300 | + | ||
1301 | + context.beginPath(); | ||
1302 | + context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc"); | ||
1303 | + | ||
1304 | + if (opts.xAxis.disableGrid !== true) { | ||
1305 | + if (opts.xAxis.type === 'calibration') { | ||
1306 | + xAxisPoints.forEach(function (item, index) { | ||
1307 | + if (index > 0) { | ||
1308 | + context.moveTo(item - eachSpacing / 2, startY); | ||
1309 | + context.lineTo(item - eachSpacing / 2, startY + 4); | ||
1310 | + } | ||
1311 | + }); | ||
1312 | + } else { | ||
1313 | + xAxisPoints.forEach(function (item, index) { | ||
1314 | + context.moveTo(item, startY); | ||
1315 | + context.lineTo(item, endY); | ||
1316 | + }); | ||
1317 | + } | ||
1318 | + } | ||
1319 | + context.closePath(); | ||
1320 | + context.stroke(); | ||
1321 | + | ||
1322 | + // 对X轴列表做抽稀处理 | ||
1323 | + var validWidth = opts.width - 2 * config.padding - config.yAxisWidth - config.yAxisTitleWidth; | ||
1324 | + var maxXAxisListLength = Math.min(categories.length, Math.ceil(validWidth / config.fontSize / 1.5)); | ||
1325 | + var ratio = Math.ceil(categories.length / maxXAxisListLength); | ||
1326 | + | ||
1327 | + categories = categories.map(function (item, index) { | ||
1328 | + return index % ratio !== 0 ? '' : item; | ||
1329 | + }); | ||
1330 | + | ||
1331 | + if (config._xAxisTextAngle_ === 0) { | ||
1332 | + context.beginPath(); | ||
1333 | + context.setFontSize(config.fontSize); | ||
1334 | + context.setFillStyle(opts.xAxis.fontColor || '#666666'); | ||
1335 | + categories.forEach(function (item, index) { | ||
1336 | + var offset = eachSpacing / 2 - measureText(item) / 2; | ||
1337 | + context.fillText(item, xAxisPoints[index] + offset, startY + config.fontSize + 5); | ||
1338 | + }); | ||
1339 | + context.closePath(); | ||
1340 | + context.stroke(); | ||
1341 | + } else { | ||
1342 | + categories.forEach(function (item, index) { | ||
1343 | + context.save(); | ||
1344 | + context.beginPath(); | ||
1345 | + context.setFontSize(config.fontSize); | ||
1346 | + context.setFillStyle(opts.xAxis.fontColor || '#666666'); | ||
1347 | + var textWidth = measureText(item); | ||
1348 | + var offset = eachSpacing / 2 - textWidth; | ||
1349 | + | ||
1350 | + var _calRotateTranslate = calRotateTranslate(xAxisPoints[index] + eachSpacing / 2, startY + config.fontSize / 2 + 5, opts.height), | ||
1351 | + transX = _calRotateTranslate.transX, | ||
1352 | + transY = _calRotateTranslate.transY; | ||
1353 | + | ||
1354 | + context.rotate(-1 * config._xAxisTextAngle_); | ||
1355 | + context.translate(transX, transY); | ||
1356 | + context.fillText(item, xAxisPoints[index] + offset, startY + config.fontSize + 5); | ||
1357 | + context.closePath(); | ||
1358 | + context.stroke(); | ||
1359 | + context.restore(); | ||
1360 | + }); | ||
1361 | + } | ||
1362 | + | ||
1363 | + context.restore(); | ||
1364 | +} | ||
1365 | + | ||
1366 | +function drawYAxisGrid(opts, config, context) { | ||
1367 | + var spacingValid = opts.height - 2 * config.padding - config.xAxisHeight - config.legendHeight; | ||
1368 | + var eachSpacing = Math.floor(spacingValid / config.yAxisSplit); | ||
1369 | + var yAxisTotalWidth = config.yAxisWidth + config.yAxisTitleWidth; | ||
1370 | + var startX = config.padding + yAxisTotalWidth; | ||
1371 | + var endX = opts.width - config.padding; | ||
1372 | + | ||
1373 | + var points = []; | ||
1374 | + for (var i = 0; i < config.yAxisSplit; i++) { | ||
1375 | + points.push(config.padding + eachSpacing * i); | ||
1376 | + } | ||
1377 | + points.push(config.padding + eachSpacing * config.yAxisSplit + 2); | ||
1378 | + | ||
1379 | + context.beginPath(); | ||
1380 | + context.setStrokeStyle(opts.yAxis.gridColor || "#cccccc"); | ||
1381 | + context.setLineWidth(1); | ||
1382 | + points.forEach(function (item, index) { | ||
1383 | + context.moveTo(startX, item); | ||
1384 | + context.lineTo(endX, item); | ||
1385 | + }); | ||
1386 | + context.closePath(); | ||
1387 | + context.stroke(); | ||
1388 | +} | ||
1389 | + | ||
1390 | +function drawYAxis(series, opts, config, context) { | ||
1391 | + if (opts.yAxis.disabled === true) { | ||
1392 | + return; | ||
1393 | + } | ||
1394 | + | ||
1395 | + var _calYAxisData4 = calYAxisData(series, opts, config), | ||
1396 | + rangesFormat = _calYAxisData4.rangesFormat; | ||
1397 | + | ||
1398 | + var yAxisTotalWidth = config.yAxisWidth + config.yAxisTitleWidth; | ||
1399 | + | ||
1400 | + var spacingValid = opts.height - 2 * config.padding - config.xAxisHeight - config.legendHeight; | ||
1401 | + var eachSpacing = Math.floor(spacingValid / config.yAxisSplit); | ||
1402 | + var startX = config.padding + yAxisTotalWidth; | ||
1403 | + var endX = opts.width - config.padding; | ||
1404 | + var endY = opts.height - config.padding - config.xAxisHeight - config.legendHeight; | ||
1405 | + | ||
1406 | + // set YAxis background | ||
1407 | + context.setFillStyle(opts.background || '#ffffff'); | ||
1408 | + if (opts._scrollDistance_ < 0) { | ||
1409 | + context.fillRect(0, 0, startX, endY + config.xAxisHeight + 5); | ||
1410 | + } | ||
1411 | + context.fillRect(endX, 0, opts.width, endY + config.xAxisHeight + 5); | ||
1412 | + | ||
1413 | + var points = []; | ||
1414 | + for (var i = 0; i <= config.yAxisSplit; i++) { | ||
1415 | + points.push(config.padding + eachSpacing * i); | ||
1416 | + } | ||
1417 | + | ||
1418 | + context.stroke(); | ||
1419 | + context.beginPath(); | ||
1420 | + context.setFontSize(config.fontSize); | ||
1421 | + context.setFillStyle(opts.yAxis.fontColor || '#666666'); | ||
1422 | + rangesFormat.forEach(function (item, index) { | ||
1423 | + var pos = points[index] ? points[index] : endY; | ||
1424 | + context.fillText(item, config.padding + config.yAxisTitleWidth, pos + config.fontSize / 2); | ||
1425 | + }); | ||
1426 | + context.closePath(); | ||
1427 | + context.stroke(); | ||
1428 | + | ||
1429 | + if (opts.yAxis.title) { | ||
1430 | + drawYAxisTitle(opts.yAxis.title, opts, config, context); | ||
1431 | + } | ||
1432 | +} | ||
1433 | + | ||
1434 | +function drawLegend(series, opts, config, context) { | ||
1435 | + if (!opts.legend) { | ||
1436 | + return; | ||
1437 | + } | ||
1438 | + // each legend shape width 15px | ||
1439 | + // the spacing between shape and text in each legend is the `padding` | ||
1440 | + // each legend spacing is the `padding` | ||
1441 | + // legend margin top `config.padding` | ||
1442 | + | ||
1443 | + var _calLegendData = calLegendData(series, opts, config), | ||
1444 | + legendList = _calLegendData.legendList; | ||
1445 | + | ||
1446 | + var padding = 5; | ||
1447 | + var marginTop = 8; | ||
1448 | + var shapeWidth = 15; | ||
1449 | + legendList.forEach(function (itemList, listIndex) { | ||
1450 | + var width = 0; | ||
1451 | + itemList.forEach(function (item) { | ||
1452 | + item.name = item.name || 'undefined'; | ||
1453 | + width += 3 * padding + measureText(item.name) + shapeWidth; | ||
1454 | + }); | ||
1455 | + var startX = (opts.width - width) / 2 + padding; | ||
1456 | + var startY = opts.height - config.padding - config.legendHeight + listIndex * (config.fontSize + marginTop) + padding + marginTop; | ||
1457 | + | ||
1458 | + context.setFontSize(config.fontSize); | ||
1459 | + itemList.forEach(function (item) { | ||
1460 | + switch (opts.type) { | ||
1461 | + case 'line': | ||
1462 | + context.beginPath(); | ||
1463 | + context.setLineWidth(1); | ||
1464 | + context.setStrokeStyle(item.color); | ||
1465 | + context.moveTo(startX - 2, startY + 5); | ||
1466 | + context.lineTo(startX + 17, startY + 5); | ||
1467 | + context.stroke(); | ||
1468 | + context.closePath(); | ||
1469 | + context.beginPath(); | ||
1470 | + context.setLineWidth(1); | ||
1471 | + context.setStrokeStyle('#ffffff'); | ||
1472 | + context.setFillStyle(item.color); | ||
1473 | + context.moveTo(startX + 7.5, startY + 5); | ||
1474 | + context.arc(startX + 7.5, startY + 5, 4, 0, 2 * Math.PI); | ||
1475 | + context.fill(); | ||
1476 | + context.stroke(); | ||
1477 | + context.closePath(); | ||
1478 | + break; | ||
1479 | + case 'pie': | ||
1480 | + case 'ring': | ||
1481 | + context.beginPath(); | ||
1482 | + context.setFillStyle(item.color); | ||
1483 | + context.moveTo(startX + 7.5, startY + 5); | ||
1484 | + context.arc(startX + 7.5, startY + 5, 7, 0, 2 * Math.PI); | ||
1485 | + context.closePath(); | ||
1486 | + context.fill(); | ||
1487 | + break; | ||
1488 | + default: | ||
1489 | + context.beginPath(); | ||
1490 | + context.setFillStyle(item.color); | ||
1491 | + context.moveTo(startX, startY); | ||
1492 | + context.rect(startX, startY, 15, 10); | ||
1493 | + context.closePath(); | ||
1494 | + context.fill(); | ||
1495 | + } | ||
1496 | + startX += padding + shapeWidth; | ||
1497 | + context.beginPath(); | ||
1498 | + context.setFillStyle(opts.extra.legendTextColor || '#333333'); | ||
1499 | + context.fillText(item.name, startX, startY + 9); | ||
1500 | + context.closePath(); | ||
1501 | + context.stroke(); | ||
1502 | + startX += measureText(item.name) + 2 * padding; | ||
1503 | + }); | ||
1504 | + }); | ||
1505 | +} | ||
1506 | +function drawPieDataPoints(series, opts, config, context) { | ||
1507 | + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; | ||
1508 | + | ||
1509 | + var pieOption = opts.extra.pie || {}; | ||
1510 | + series = getPieDataPoints(series, process); | ||
1511 | + var centerPosition = { | ||
1512 | + x: opts.width / 2, | ||
1513 | + y: (opts.height - config.legendHeight) / 2 | ||
1514 | + }; | ||
1515 | + var radius = Math.min(centerPosition.x - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, centerPosition.y - config.pieChartLinePadding - config.pieChartTextPadding); | ||
1516 | + if (opts.dataLabel) { | ||
1517 | + radius -= 10; | ||
1518 | + } else { | ||
1519 | + radius -= 2 * config.padding; | ||
1520 | + } | ||
1521 | + series = series.map(function (eachSeries) { | ||
1522 | + eachSeries._start_ += (pieOption.offsetAngle || 0) * Math.PI / 180; | ||
1523 | + return eachSeries; | ||
1524 | + }); | ||
1525 | + series.forEach(function (eachSeries) { | ||
1526 | + context.beginPath(); | ||
1527 | + context.setLineWidth(2); | ||
1528 | + context.setStrokeStyle('#ffffff'); | ||
1529 | + context.setFillStyle(eachSeries.color); | ||
1530 | + context.moveTo(centerPosition.x, centerPosition.y); | ||
1531 | + context.arc(centerPosition.x, centerPosition.y, radius, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI); | ||
1532 | + context.closePath(); | ||
1533 | + context.fill(); | ||
1534 | + if (opts.disablePieStroke !== true) { | ||
1535 | + context.stroke(); | ||
1536 | + } | ||
1537 | + }); | ||
1538 | + | ||
1539 | + if (opts.type === 'ring') { | ||
1540 | + var innerPieWidth = radius * 0.6; | ||
1541 | + if (typeof opts.extra.ringWidth === 'number' && opts.extra.ringWidth > 0) { | ||
1542 | + innerPieWidth = Math.max(0, radius - opts.extra.ringWidth); | ||
1543 | + } | ||
1544 | + context.beginPath(); | ||
1545 | + context.setFillStyle(opts.background || '#ffffff'); | ||
1546 | + context.moveTo(centerPosition.x, centerPosition.y); | ||
1547 | + context.arc(centerPosition.x, centerPosition.y, innerPieWidth, 0, 2 * Math.PI); | ||
1548 | + context.closePath(); | ||
1549 | + context.fill(); | ||
1550 | + } | ||
1551 | + | ||
1552 | + if (opts.dataLabel !== false && process === 1) { | ||
1553 | + // fix https://github.com/xiaolin3303/wx-charts/issues/132 | ||
1554 | + var valid = false; | ||
1555 | + for (var i = 0, len = series.length; i < len; i++) { | ||
1556 | + if (series[i].data > 0) { | ||
1557 | + valid = true; | ||
1558 | + break; | ||
1559 | + } | ||
1560 | + } | ||
1561 | + | ||
1562 | + if (valid) { | ||
1563 | + drawPieText(series, opts, config, context, radius, centerPosition); | ||
1564 | + } | ||
1565 | + } | ||
1566 | + | ||
1567 | + if (process === 1 && opts.type === 'ring') { | ||
1568 | + drawRingTitle(opts, config, context); | ||
1569 | + } | ||
1570 | + | ||
1571 | + return { | ||
1572 | + center: centerPosition, | ||
1573 | + radius: radius, | ||
1574 | + series: series | ||
1575 | + }; | ||
1576 | +} | ||
1577 | + | ||
1578 | +function drawRadarDataPoints(series, opts, config, context) { | ||
1579 | + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; | ||
1580 | + | ||
1581 | + var radarOption = opts.extra.radar || {}; | ||
1582 | + var coordinateAngle = getRadarCoordinateSeries(opts.categories.length); | ||
1583 | + var centerPosition = { | ||
1584 | + x: opts.width / 2, | ||
1585 | + y: (opts.height - config.legendHeight) / 2 | ||
1586 | + }; | ||
1587 | + | ||
1588 | + var radius = Math.min(centerPosition.x - (getMaxTextListLength(opts.categories) + config.radarLabelTextMargin), centerPosition.y - config.radarLabelTextMargin); | ||
1589 | + | ||
1590 | + radius -= config.padding; | ||
1591 | + | ||
1592 | + // draw grid | ||
1593 | + context.beginPath(); | ||
1594 | + context.setLineWidth(1); | ||
1595 | + context.setStrokeStyle(radarOption.gridColor || "#cccccc"); | ||
1596 | + coordinateAngle.forEach(function (angle) { | ||
1597 | + var pos = convertCoordinateOrigin(radius * Math.cos(angle), radius * Math.sin(angle), centerPosition); | ||
1598 | + context.moveTo(centerPosition.x, centerPosition.y); | ||
1599 | + context.lineTo(pos.x, pos.y); | ||
1600 | + }); | ||
1601 | + context.stroke(); | ||
1602 | + context.closePath(); | ||
1603 | + | ||
1604 | + // draw split line grid | ||
1605 | + | ||
1606 | + var _loop = function _loop(i) { | ||
1607 | + var startPos = {}; | ||
1608 | + context.beginPath(); | ||
1609 | + context.setLineWidth(1); | ||
1610 | + context.setStrokeStyle(radarOption.gridColor || "#cccccc"); | ||
1611 | + coordinateAngle.forEach(function (angle, index) { | ||
1612 | + var pos = convertCoordinateOrigin(radius / config.radarGridCount * i * Math.cos(angle), radius / config.radarGridCount * i * Math.sin(angle), centerPosition); | ||
1613 | + if (index === 0) { | ||
1614 | + startPos = pos; | ||
1615 | + context.moveTo(pos.x, pos.y); | ||
1616 | + } else { | ||
1617 | + context.lineTo(pos.x, pos.y); | ||
1618 | + } | ||
1619 | + }); | ||
1620 | + context.lineTo(startPos.x, startPos.y); | ||
1621 | + context.stroke(); | ||
1622 | + context.closePath(); | ||
1623 | + }; | ||
1624 | + | ||
1625 | + for (var i = 1; i <= config.radarGridCount; i++) { | ||
1626 | + _loop(i); | ||
1627 | + } | ||
1628 | + | ||
1629 | + var radarDataPoints = getRadarDataPoints(coordinateAngle, centerPosition, radius, series, opts, process); | ||
1630 | + radarDataPoints.forEach(function (eachSeries, seriesIndex) { | ||
1631 | + // 绘制区域数据 | ||
1632 | + context.beginPath(); | ||
1633 | + context.setFillStyle(eachSeries.color); | ||
1634 | + context.setGlobalAlpha(0.6); | ||
1635 | + eachSeries.data.forEach(function (item, index) { | ||
1636 | + if (index === 0) { | ||
1637 | + context.moveTo(item.position.x, item.position.y); | ||
1638 | + } else { | ||
1639 | + context.lineTo(item.position.x, item.position.y); | ||
1640 | + } | ||
1641 | + }); | ||
1642 | + context.closePath(); | ||
1643 | + context.fill(); | ||
1644 | + context.setGlobalAlpha(1); | ||
1645 | + | ||
1646 | + if (opts.dataPointShape !== false) { | ||
1647 | + var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length]; | ||
1648 | + var points = eachSeries.data.map(function (item) { | ||
1649 | + return item.position; | ||
1650 | + }); | ||
1651 | + drawPointShape(points, eachSeries.color, shape, context); | ||
1652 | + } | ||
1653 | + }); | ||
1654 | + // draw label text | ||
1655 | + drawRadarLabel(coordinateAngle, radius, centerPosition, opts, config, context); | ||
1656 | + | ||
1657 | + return { | ||
1658 | + center: centerPosition, | ||
1659 | + radius: radius, | ||
1660 | + angleList: coordinateAngle | ||
1661 | + }; | ||
1662 | +} | ||
1663 | + | ||
1664 | +function drawCanvas(opts, context) { | ||
1665 | + context.draw(); | ||
1666 | +} | ||
1667 | + | ||
1668 | +var Timing = { | ||
1669 | + easeIn: function easeIn(pos) { | ||
1670 | + return Math.pow(pos, 3); | ||
1671 | + }, | ||
1672 | + | ||
1673 | + easeOut: function easeOut(pos) { | ||
1674 | + return Math.pow(pos - 1, 3) + 1; | ||
1675 | + }, | ||
1676 | + | ||
1677 | + easeInOut: function easeInOut(pos) { | ||
1678 | + if ((pos /= 0.5) < 1) { | ||
1679 | + return 0.5 * Math.pow(pos, 3); | ||
1680 | + } else { | ||
1681 | + return 0.5 * (Math.pow(pos - 2, 3) + 2); | ||
1682 | + } | ||
1683 | + }, | ||
1684 | + | ||
1685 | + linear: function linear(pos) { | ||
1686 | + return pos; | ||
1687 | + } | ||
1688 | +}; | ||
1689 | + | ||
1690 | +function Animation(opts) { | ||
1691 | + this.isStop = false; | ||
1692 | + opts.duration = typeof opts.duration === 'undefined' ? 1000 : opts.duration; | ||
1693 | + opts.timing = opts.timing || 'linear'; | ||
1694 | + | ||
1695 | + var delay = 17; | ||
1696 | + | ||
1697 | + var createAnimationFrame = function createAnimationFrame() { | ||
1698 | + if (typeof requestAnimationFrame !== 'undefined') { | ||
1699 | + return requestAnimationFrame; | ||
1700 | + } else if (typeof setTimeout !== 'undefined') { | ||
1701 | + return function (step, delay) { | ||
1702 | + setTimeout(function () { | ||
1703 | + var timeStamp = +new Date(); | ||
1704 | + step(timeStamp); | ||
1705 | + }, delay); | ||
1706 | + }; | ||
1707 | + } else { | ||
1708 | + return function (step) { | ||
1709 | + step(null); | ||
1710 | + }; | ||
1711 | + } | ||
1712 | + }; | ||
1713 | + var animationFrame = createAnimationFrame(); | ||
1714 | + var startTimeStamp = null; | ||
1715 | + var _step = function step(timestamp) { | ||
1716 | + if (timestamp === null || this.isStop === true) { | ||
1717 | + opts.onProcess && opts.onProcess(1); | ||
1718 | + opts.onAnimationFinish && opts.onAnimationFinish(); | ||
1719 | + return; | ||
1720 | + } | ||
1721 | + if (startTimeStamp === null) { | ||
1722 | + startTimeStamp = timestamp; | ||
1723 | + } | ||
1724 | + if (timestamp - startTimeStamp < opts.duration) { | ||
1725 | + var process = (timestamp - startTimeStamp) / opts.duration; | ||
1726 | + var timingFunction = Timing[opts.timing]; | ||
1727 | + process = timingFunction(process); | ||
1728 | + opts.onProcess && opts.onProcess(process); | ||
1729 | + animationFrame(_step, delay); | ||
1730 | + } else { | ||
1731 | + opts.onProcess && opts.onProcess(1); | ||
1732 | + opts.onAnimationFinish && opts.onAnimationFinish(); | ||
1733 | + } | ||
1734 | + }; | ||
1735 | + _step = _step.bind(this); | ||
1736 | + | ||
1737 | + animationFrame(_step, delay); | ||
1738 | +} | ||
1739 | + | ||
1740 | +// stop animation immediately | ||
1741 | +// and tigger onAnimationFinish | ||
1742 | +Animation.prototype.stop = function () { | ||
1743 | + this.isStop = true; | ||
1744 | +}; | ||
1745 | + | ||
1746 | +function drawCharts(type, opts, config, context) { | ||
1747 | + var _this = this; | ||
1748 | + | ||
1749 | + var series = opts.series; | ||
1750 | + var categories = opts.categories; | ||
1751 | + series = fillSeriesColor(series, config); | ||
1752 | + | ||
1753 | + var _calLegendData = calLegendData(series, opts, config), | ||
1754 | + legendHeight = _calLegendData.legendHeight; | ||
1755 | + | ||
1756 | + config.legendHeight = legendHeight; | ||
1757 | + | ||
1758 | + var _calYAxisData = calYAxisData(series, opts, config), | ||
1759 | + yAxisWidth = _calYAxisData.yAxisWidth; | ||
1760 | + | ||
1761 | + config.yAxisWidth = yAxisWidth; | ||
1762 | + if (categories && categories.length) { | ||
1763 | + var _calCategoriesData = calCategoriesData(categories, opts, config), | ||
1764 | + xAxisHeight = _calCategoriesData.xAxisHeight, | ||
1765 | + angle = _calCategoriesData.angle; | ||
1766 | + | ||
1767 | + config.xAxisHeight = xAxisHeight; | ||
1768 | + config._xAxisTextAngle_ = angle; | ||
1769 | + } | ||
1770 | + if (type === 'pie' || type === 'ring') { | ||
1771 | + config._pieTextMaxLength_ = opts.dataLabel === false ? 0 : getPieTextMaxLength(series); | ||
1772 | + } | ||
1773 | + | ||
1774 | + var duration = opts.animation ? 1000 : 0; | ||
1775 | + this.animationInstance && this.animationInstance.stop(); | ||
1776 | + switch (type) { | ||
1777 | + case 'line': | ||
1778 | + this.animationInstance = new Animation({ | ||
1779 | + timing: 'easeIn', | ||
1780 | + duration: duration, | ||
1781 | + onProcess: function onProcess(process) { | ||
1782 | + drawYAxisGrid(opts, config, context); | ||
1783 | + | ||
1784 | + var _drawLineDataPoints = drawLineDataPoints(series, opts, config, context, process), | ||
1785 | + xAxisPoints = _drawLineDataPoints.xAxisPoints, | ||
1786 | + calPoints = _drawLineDataPoints.calPoints, | ||
1787 | + eachSpacing = _drawLineDataPoints.eachSpacing; | ||
1788 | + | ||
1789 | + _this.chartData.xAxisPoints = xAxisPoints; | ||
1790 | + _this.chartData.calPoints = calPoints; | ||
1791 | + _this.chartData.eachSpacing = eachSpacing; | ||
1792 | + drawXAxis(categories, opts, config, context); | ||
1793 | + drawLegend(opts.series, opts, config, context); | ||
1794 | + drawYAxis(series, opts, config, context); | ||
1795 | + drawToolTipBridge(opts, config, context, process); | ||
1796 | + drawCanvas(opts, context); | ||
1797 | + }, | ||
1798 | + onAnimationFinish: function onAnimationFinish() { | ||
1799 | + _this.event.trigger('renderComplete'); | ||
1800 | + } | ||
1801 | + }); | ||
1802 | + break; | ||
1803 | + case 'column': | ||
1804 | + this.animationInstance = new Animation({ | ||
1805 | + timing: 'easeIn', | ||
1806 | + duration: duration, | ||
1807 | + onProcess: function onProcess(process) { | ||
1808 | + drawYAxisGrid(opts, config, context); | ||
1809 | + | ||
1810 | + var _drawColumnDataPoints = drawColumnDataPoints(series, opts, config, context, process), | ||
1811 | + xAxisPoints = _drawColumnDataPoints.xAxisPoints, | ||
1812 | + eachSpacing = _drawColumnDataPoints.eachSpacing; | ||
1813 | + | ||
1814 | + _this.chartData.xAxisPoints = xAxisPoints; | ||
1815 | + _this.chartData.eachSpacing = eachSpacing; | ||
1816 | + drawXAxis(categories, opts, config, context); | ||
1817 | + drawLegend(opts.series, opts, config, context); | ||
1818 | + drawYAxis(series, opts, config, context); | ||
1819 | + drawCanvas(opts, context); | ||
1820 | + }, | ||
1821 | + onAnimationFinish: function onAnimationFinish() { | ||
1822 | + _this.event.trigger('renderComplete'); | ||
1823 | + } | ||
1824 | + }); | ||
1825 | + break; | ||
1826 | + case 'area': | ||
1827 | + this.animationInstance = new Animation({ | ||
1828 | + timing: 'easeIn', | ||
1829 | + duration: duration, | ||
1830 | + onProcess: function onProcess(process) { | ||
1831 | + drawYAxisGrid(opts, config, context); | ||
1832 | + | ||
1833 | + var _drawAreaDataPoints = drawAreaDataPoints(series, opts, config, context, process), | ||
1834 | + xAxisPoints = _drawAreaDataPoints.xAxisPoints, | ||
1835 | + calPoints = _drawAreaDataPoints.calPoints, | ||
1836 | + eachSpacing = _drawAreaDataPoints.eachSpacing; | ||
1837 | + | ||
1838 | + _this.chartData.xAxisPoints = xAxisPoints; | ||
1839 | + _this.chartData.calPoints = calPoints; | ||
1840 | + _this.chartData.eachSpacing = eachSpacing; | ||
1841 | + drawXAxis(categories, opts, config, context); | ||
1842 | + drawLegend(opts.series, opts, config, context); | ||
1843 | + drawYAxis(series, opts, config, context); | ||
1844 | + drawToolTipBridge(opts, config, context, process); | ||
1845 | + drawCanvas(opts, context); | ||
1846 | + }, | ||
1847 | + onAnimationFinish: function onAnimationFinish() { | ||
1848 | + _this.event.trigger('renderComplete'); | ||
1849 | + } | ||
1850 | + }); | ||
1851 | + break; | ||
1852 | + case 'ring': | ||
1853 | + case 'pie': | ||
1854 | + this.animationInstance = new Animation({ | ||
1855 | + timing: 'easeInOut', | ||
1856 | + duration: duration, | ||
1857 | + onProcess: function onProcess(process) { | ||
1858 | + _this.chartData.pieData = drawPieDataPoints(series, opts, config, context, process); | ||
1859 | + drawLegend(opts.series, opts, config, context); | ||
1860 | + drawCanvas(opts, context); | ||
1861 | + }, | ||
1862 | + onAnimationFinish: function onAnimationFinish() { | ||
1863 | + _this.event.trigger('renderComplete'); | ||
1864 | + } | ||
1865 | + }); | ||
1866 | + break; | ||
1867 | + case 'radar': | ||
1868 | + this.animationInstance = new Animation({ | ||
1869 | + timing: 'easeInOut', | ||
1870 | + duration: duration, | ||
1871 | + onProcess: function onProcess(process) { | ||
1872 | + _this.chartData.radarData = drawRadarDataPoints(series, opts, config, context, process); | ||
1873 | + drawLegend(opts.series, opts, config, context); | ||
1874 | + drawCanvas(opts, context); | ||
1875 | + }, | ||
1876 | + onAnimationFinish: function onAnimationFinish() { | ||
1877 | + _this.event.trigger('renderComplete'); | ||
1878 | + } | ||
1879 | + }); | ||
1880 | + break; | ||
1881 | + } | ||
1882 | +} | ||
1883 | + | ||
1884 | +// simple event implement | ||
1885 | + | ||
1886 | +function Event() { | ||
1887 | + this.events = {}; | ||
1888 | +} | ||
1889 | + | ||
1890 | +Event.prototype.addEventListener = function (type, listener) { | ||
1891 | + this.events[type] = this.events[type] || []; | ||
1892 | + this.events[type].push(listener); | ||
1893 | +}; | ||
1894 | + | ||
1895 | +Event.prototype.trigger = function () { | ||
1896 | + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
1897 | + args[_key] = arguments[_key]; | ||
1898 | + } | ||
1899 | + | ||
1900 | + var type = args[0]; | ||
1901 | + var params = args.slice(1); | ||
1902 | + if (!!this.events[type]) { | ||
1903 | + this.events[type].forEach(function (listener) { | ||
1904 | + try { | ||
1905 | + listener.apply(null, params); | ||
1906 | + } catch (e) { | ||
1907 | + console.error(e); | ||
1908 | + } | ||
1909 | + }); | ||
1910 | + } | ||
1911 | +}; | ||
1912 | + | ||
1913 | +var Charts = function Charts(opts) { | ||
1914 | + opts.title = opts.title || {}; | ||
1915 | + opts.subtitle = opts.subtitle || {}; | ||
1916 | + opts.yAxis = opts.yAxis || {}; | ||
1917 | + opts.xAxis = opts.xAxis || {}; | ||
1918 | + opts.extra = opts.extra || {}; | ||
1919 | + opts.legend = opts.legend === false ? false : true; | ||
1920 | + opts.animation = opts.animation === false ? false : true; | ||
1921 | + var config$$1 = assign({}, config); | ||
1922 | + config$$1.yAxisTitleWidth = opts.yAxis.disabled !== true && opts.yAxis.title ? config$$1.yAxisTitleWidth : 0; | ||
1923 | + config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : config$$1.pieChartLinePadding; | ||
1924 | + config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding; | ||
1925 | + | ||
1926 | + this.opts = opts; | ||
1927 | + this.config = config$$1; | ||
1928 | + this.context = wx.createCanvasContext(opts.canvasId); | ||
1929 | + // store calcuated chart data | ||
1930 | + // such as chart point coordinate | ||
1931 | + this.chartData = {}; | ||
1932 | + this.event = new Event(); | ||
1933 | + this.scrollOption = { | ||
1934 | + currentOffset: 0, | ||
1935 | + startTouchX: 0, | ||
1936 | + distance: 0 | ||
1937 | + }; | ||
1938 | + | ||
1939 | + drawCharts.call(this, opts.type, opts, config$$1, this.context); | ||
1940 | +}; | ||
1941 | + | ||
1942 | +Charts.prototype.updateData = function () { | ||
1943 | + var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
1944 | + | ||
1945 | + this.opts.series = data.series || this.opts.series; | ||
1946 | + this.opts.categories = data.categories || this.opts.categories; | ||
1947 | + | ||
1948 | + this.opts.title = assign({}, this.opts.title, data.title || {}); | ||
1949 | + this.opts.subtitle = assign({}, this.opts.subtitle, data.subtitle || {}); | ||
1950 | + | ||
1951 | + drawCharts.call(this, this.opts.type, this.opts, this.config, this.context); | ||
1952 | +}; | ||
1953 | + | ||
1954 | +Charts.prototype.stopAnimation = function () { | ||
1955 | + this.animationInstance && this.animationInstance.stop(); | ||
1956 | +}; | ||
1957 | + | ||
1958 | +Charts.prototype.addEventListener = function (type, listener) { | ||
1959 | + this.event.addEventListener(type, listener); | ||
1960 | +}; | ||
1961 | + | ||
1962 | +Charts.prototype.getCurrentDataIndex = function (e) { | ||
1963 | + var touches = e.touches && e.touches.length ? e.touches : e.changedTouches; | ||
1964 | + if (touches && touches.length) { | ||
1965 | + var _touches$ = touches[0], | ||
1966 | + x = _touches$.x, | ||
1967 | + y = _touches$.y; | ||
1968 | + | ||
1969 | + if (this.opts.type === 'pie' || this.opts.type === 'ring') { | ||
1970 | + return findPieChartCurrentIndex({ x: x, y: y }, this.chartData.pieData); | ||
1971 | + } else if (this.opts.type === 'radar') { | ||
1972 | + return findRadarChartCurrentIndex({ x: x, y: y }, this.chartData.radarData, this.opts.categories.length); | ||
1973 | + } else { | ||
1974 | + return findCurrentIndex({ x: x, y: y }, this.chartData.xAxisPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset)); | ||
1975 | + } | ||
1976 | + } | ||
1977 | + return -1; | ||
1978 | +}; | ||
1979 | + | ||
1980 | +Charts.prototype.showToolTip = function (e) { | ||
1981 | + var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
1982 | + | ||
1983 | + if (this.opts.type === 'line' || this.opts.type === 'area') { | ||
1984 | + var index = this.getCurrentDataIndex(e); | ||
1985 | + var currentOffset = this.scrollOption.currentOffset; | ||
1986 | + | ||
1987 | + var opts = assign({}, this.opts, { | ||
1988 | + _scrollDistance_: currentOffset, | ||
1989 | + animation: false | ||
1990 | + }); | ||
1991 | + if (index > -1) { | ||
1992 | + var seriesData = getSeriesDataItem(this.opts.series, index); | ||
1993 | + if (seriesData.length !== 0) { | ||
1994 | + var _getToolTipData = getToolTipData(seriesData, this.chartData.calPoints, index, this.opts.categories, option), | ||
1995 | + textList = _getToolTipData.textList, | ||
1996 | + offset = _getToolTipData.offset; | ||
1997 | + | ||
1998 | + opts.tooltip = { | ||
1999 | + textList: textList, | ||
2000 | + offset: offset, | ||
2001 | + option: option | ||
2002 | + }; | ||
2003 | + } | ||
2004 | + } | ||
2005 | + drawCharts.call(this, opts.type, opts, this.config, this.context); | ||
2006 | + } | ||
2007 | +}; | ||
2008 | + | ||
2009 | +Charts.prototype.scrollStart = function (e) { | ||
2010 | + if (e.touches[0] && this.opts.enableScroll === true) { | ||
2011 | + this.scrollOption.startTouchX = e.touches[0].x; | ||
2012 | + } | ||
2013 | +}; | ||
2014 | + | ||
2015 | +Charts.prototype.scroll = function (e) { | ||
2016 | + // TODO throtting... | ||
2017 | + if (e.touches[0] && this.opts.enableScroll === true) { | ||
2018 | + var _distance = e.touches[0].x - this.scrollOption.startTouchX; | ||
2019 | + var currentOffset = this.scrollOption.currentOffset; | ||
2020 | + | ||
2021 | + var validDistance = calValidDistance(currentOffset + _distance, this.chartData, this.config, this.opts); | ||
2022 | + | ||
2023 | + this.scrollOption.distance = _distance = validDistance - currentOffset; | ||
2024 | + var opts = assign({}, this.opts, { | ||
2025 | + _scrollDistance_: currentOffset + _distance, | ||
2026 | + animation: false | ||
2027 | + }); | ||
2028 | + | ||
2029 | + drawCharts.call(this, opts.type, opts, this.config, this.context); | ||
2030 | + } | ||
2031 | +}; | ||
2032 | + | ||
2033 | +Charts.prototype.scrollEnd = function (e) { | ||
2034 | + if (this.opts.enableScroll === true) { | ||
2035 | + var _scrollOption = this.scrollOption, | ||
2036 | + currentOffset = _scrollOption.currentOffset, | ||
2037 | + distance = _scrollOption.distance; | ||
2038 | + | ||
2039 | + this.scrollOption.currentOffset = currentOffset + distance; | ||
2040 | + this.scrollOption.distance = 0; | ||
2041 | + } | ||
2042 | +}; | ||
2043 | + | ||
2044 | +module.exports = Charts; |
img/+.png
0 → 100644
7.0 KB
img/LoadFail.png
0 → 100644
7.3 KB
img/abouticon.png
0 → 100644
2.6 KB
img/bq.png
0 → 100644
4.6 KB
img/choose_no.png
0 → 100644
1.5 KB
img/choose_yes.png
0 → 100644
2.0 KB
img/colse.png
0 → 100644
5.7 KB
img/cyicon.png
0 → 100644
3.1 KB
img/d.png
0 → 100644
6.3 KB
img/edit.png
0 → 100644
3.0 KB
img/edit_yijian.png
0 → 100644
1.9 KB
img/jia.png
0 → 100644
1.8 KB
img/lehuicon.png
0 → 100644
6.3 KB
img/link.png
0 → 100644
2.4 KB
img/man.png
0 → 100644
7.5 KB
img/map_icon.png
0 → 100644
2.8 KB
img/map_icon1.png
0 → 100644
838 字节
img/no_puimg.png
0 → 100644
6.8 KB
img/noimg.png
0 → 100644
3.0 KB
img/plan.png
0 → 100644
10.6 KB
img/qst.png
0 → 100644
5.0 KB
img/startimg.png
0 → 100644
97.2 KB
img/swicth.png
0 → 100644
4.4 KB
img/swicth_g.png
0 → 100644
5.1 KB
img/w1.png
0 → 100644
2.1 KB
img/w2.png
0 → 100644
1.9 KB
img/woman.png
0 → 100644
7.6 KB
img/x1.png
0 → 100644
2.6 KB
img/x2.png
0 → 100644
2.3 KB
img/y.png
0 → 100644
3.0 KB
img/yd.png
0 → 100644
6.4 KB
pages/aboutme/aboutme.js
0 → 100644
1 | +// pages/aboutme/aboutme.js | ||
2 | +// 请注意常量的命名必须是Page | ||
3 | +const Page = require('../../utils/ald-stat.js').Page; | ||
4 | +const app=getApp(); | ||
5 | +var wxParse = require('../../wxParse/wxParse.js') | ||
6 | +Page({ | ||
7 | + | ||
8 | + /** | ||
9 | + * 页面的初始数据 | ||
10 | + */ | ||
11 | + data: { | ||
12 | + }, | ||
13 | + getAboutUs(){ | ||
14 | + let that=this; | ||
15 | + let url ='index/getAboutUs'; | ||
16 | + let params = { | ||
17 | + doctor_id: app.globalData.doctor_id | ||
18 | + } | ||
19 | + app.post(url, params).then((res)=>{ | ||
20 | + | ||
21 | + that.setData({ | ||
22 | + listdata:res | ||
23 | + }) | ||
24 | + wxParse.wxParse('content', 'html', res.post_content, that, 5); | ||
25 | + }).catch((errMsg)=>{ | ||
26 | + console.log(errMsg) | ||
27 | + }) | ||
28 | + }, | ||
29 | + /** | ||
30 | + * 生命周期函数--监听页面加载 | ||
31 | + */ | ||
32 | + onLoad: function (options) { | ||
33 | +let that=this; | ||
34 | + that.getAboutUs(); | ||
35 | + app.setStatisticsVisitorLog('/pages/aboutme/aboutme'); | ||
36 | + }, | ||
37 | + | ||
38 | + /** | ||
39 | + * 生命周期函数--监听页面初次渲染完成 | ||
40 | + */ | ||
41 | + onReady: function () { | ||
42 | + | ||
43 | + }, | ||
44 | + | ||
45 | + /** | ||
46 | + * 生命周期函数--监听页面显示 | ||
47 | + */ | ||
48 | + onShow: function () { | ||
49 | + | ||
50 | + }, | ||
51 | + | ||
52 | + /** | ||
53 | + * 生命周期函数--监听页面隐藏 | ||
54 | + */ | ||
55 | + onHide: function () { | ||
56 | + | ||
57 | + }, | ||
58 | + | ||
59 | + /** | ||
60 | + * 生命周期函数--监听页面卸载 | ||
61 | + */ | ||
62 | + onUnload: function () { | ||
63 | + | ||
64 | + }, | ||
65 | + | ||
66 | + /** | ||
67 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
68 | + */ | ||
69 | + onPullDownRefresh: function () { | ||
70 | + | ||
71 | + }, | ||
72 | + | ||
73 | + /** | ||
74 | + * 页面上拉触底事件的处理函数 | ||
75 | + */ | ||
76 | + onReachBottom: function () { | ||
77 | + | ||
78 | + }, | ||
79 | + | ||
80 | + /** | ||
81 | + * 用户点击右上角分享 | ||
82 | + */ | ||
83 | + onShareAppMessage: function () { | ||
84 | + | ||
85 | + } | ||
86 | +}) |
pages/aboutme/aboutme.json
0 → 100644
1 | +{} |
pages/aboutme/aboutme.wxml
0 → 100644
pages/aboutme/aboutme.wxss
0 → 100644
1 | +/* pages/aboutme/aboutme.wxss */ | ||
2 | +.title{ | ||
3 | + color:#333; | ||
4 | + font-size:36rpx; | ||
5 | + text-align: center; | ||
6 | + margin: 0 0 30rpx 0; | ||
7 | +} | ||
8 | +.aboutme_content{ | ||
9 | + width:100%; | ||
10 | + height: 100%; | ||
11 | + padding:60rpx 40rpx; | ||
12 | + box-sizing: border-box; | ||
13 | + font-size: 30rpx; | ||
14 | + color:#666; | ||
15 | + line-height: 1.5; | ||
16 | +} |
pages/addfile/addfile.js
0 → 100644
1 | +// pages/addfile/addfile.js | ||
2 | +// 请注意常量的命名必须是Page | ||
3 | +const Page = require('../../utils/ald-stat.js').Page; | ||
4 | +const app=getApp(); | ||
5 | +Page({ | ||
6 | + | ||
7 | + /** | ||
8 | + * 页面的初始数据 | ||
9 | + */ | ||
10 | + data: { | ||
11 | + date:'请选择出生日期', | ||
12 | + disease:'', | ||
13 | + mdate:"",//默认1988当月当日 | ||
14 | + enddate:'',//出生日期不能选择今天 | ||
15 | + chooseagreen:true,//选择协议 | ||
16 | + for_who:'请选择',//与本人的关系 | ||
17 | + for_me:[],//与本人的关系选项 | ||
18 | + for_meitem:[], | ||
19 | + sexman:true,//ture表示选择男,flase选择女 | ||
20 | + patient:'',//患者姓名 | ||
21 | + address: ['请选择', '', ''], | ||
22 | + }, | ||
23 | + setdisease(e){ | ||
24 | + this.setData({ | ||
25 | + disease: e.detail.value | ||
26 | + }) | ||
27 | + }, | ||
28 | + bindRegionChange: function (e) { | ||
29 | + console.log('picker发送选择改变,携带值为', e.detail.value) | ||
30 | + this.setData({ | ||
31 | + address: e.detail.value | ||
32 | + }) | ||
33 | + }, | ||
34 | + bindDateChange: function (e) { | ||
35 | + console.log('picker发送选择改变,携带值为', e.detail.value) | ||
36 | + this.setData({ | ||
37 | + date: e.detail.value | ||
38 | + }) | ||
39 | + }, | ||
40 | + setsexman_yes(){ | ||
41 | + this.setData({ | ||
42 | + sexman:true | ||
43 | + }) | ||
44 | + }, | ||
45 | + setsexman_no() { | ||
46 | + this.setData({ | ||
47 | + sexman: false | ||
48 | + }) | ||
49 | + }, | ||
50 | + setchoose(){ | ||
51 | + this.setData({ | ||
52 | + chooseagreen: !this.data.chooseagreen | ||
53 | + }) | ||
54 | + }, | ||
55 | + setpatient(e){ | ||
56 | + this.setData({ | ||
57 | + patient: e.detail.value | ||
58 | + }) | ||
59 | + }, | ||
60 | + setfor_who(e){ | ||
61 | + this.setData({ | ||
62 | + for_who: e.detail.value | ||
63 | + }) | ||
64 | + }, | ||
65 | + setaddress(e){ | ||
66 | + this.setData({ | ||
67 | + address: e.detail.value | ||
68 | + }) | ||
69 | + }, | ||
70 | + addFiles(){//添加档案 | ||
71 | + let that=this; | ||
72 | + let err='' | ||
73 | + let address_str=''; | ||
74 | + for (let obj of that.data.address){ | ||
75 | + address_str +=obj; | ||
76 | + } | ||
77 | + console.log(address_str); | ||
78 | + if (that.data.patient ==''){ | ||
79 | + err = '请输入姓名'; | ||
80 | + } else if (that.data.date == '请选择出生日期'){ | ||
81 | + err = '请选择出生日期'; | ||
82 | + | ||
83 | + } else if (that.data.disease =='请选择疾病名称'){ | ||
84 | + err = '请选择疾病名称'; | ||
85 | + | ||
86 | + } else if (that.data.for_who == '') { | ||
87 | + err = '请填写与本人的关系'; | ||
88 | + } else if (that.data.disease=='请选择疾病名称'){ | ||
89 | + err = '请选择疾病名称'; | ||
90 | + } else if (address_str === '请选择'){ | ||
91 | + err = '请选择现住址'; | ||
92 | + } else if (!that.data.chooseagreen){ | ||
93 | + err = '请同意授权隐私协议'; | ||
94 | + } | ||
95 | + if(err == ''){ | ||
96 | + let url ='user/addFiles'; | ||
97 | + let params={ | ||
98 | + patient: that.data.patient, | ||
99 | + birthday: that.data.date, | ||
100 | + for_who: that.data.for_who, | ||
101 | + sex: that.data.sexman?1:2, | ||
102 | + disease_name: that.data.disease, | ||
103 | + address: address_str | ||
104 | + } | ||
105 | + let header={ | ||
106 | + 'XX-Token': wx.getStorageSync('token'), | ||
107 | + 'XX-Device-Type':'' | ||
108 | + } | ||
109 | + app.post(url,params,header).then((res)=>{ | ||
110 | + console.log(res) | ||
111 | + wx.showToast({ | ||
112 | + title: '添加档案成功', | ||
113 | + icon: 'none', | ||
114 | + duration: 2000 | ||
115 | + }) | ||
116 | + setTimeout(function(){ | ||
117 | + wx.navigateTo({ | ||
118 | + url: '/pages/addrecord/addrecord?fields_id=' + res.id + '&patient=' + res.patient, | ||
119 | + }) | ||
120 | + },1000) | ||
121 | + }).catch((errMsg)=>{ | ||
122 | + console.log(errMsg) | ||
123 | + }) | ||
124 | + }else{ | ||
125 | + wx.showModal({ | ||
126 | + title: '提示', | ||
127 | + content: err, | ||
128 | + showCancel: false, | ||
129 | + confirmText:'知道了', | ||
130 | + success(res) { | ||
131 | + if (res.confirm) { | ||
132 | + } else if (res.cancel) { | ||
133 | + | ||
134 | + } | ||
135 | + } | ||
136 | + }) | ||
137 | + } | ||
138 | + }, | ||
139 | + bindPickeritem(e){ | ||
140 | + console.log(e); | ||
141 | + let that=this; | ||
142 | + let for_meitem = that.data.for_meitem | ||
143 | + that.setData({ | ||
144 | + for_who:for_meitem[e.detail.value] | ||
145 | + }) | ||
146 | + }, | ||
147 | + //到用户协议 | ||
148 | + goagreement(){ | ||
149 | + wx.navigateTo({ | ||
150 | + url: '/pages/agreement/agreement', | ||
151 | + success: function(res) {}, | ||
152 | + fail: function(res) {}, | ||
153 | + complete: function(res) {}, | ||
154 | + }) | ||
155 | + }, | ||
156 | + //查询通用管理字段 | ||
157 | + getFieldList(){ | ||
158 | + let that=this; | ||
159 | + let url ='public/getFieldList'; | ||
160 | + app.post(url,{}).then((res)=>{ | ||
161 | + console.log(res); | ||
162 | + that.getFieldOptionList(res[5].id); | ||
163 | + }).catch((errMsg)=>{ | ||
164 | + console.log(errMsg); | ||
165 | + }) | ||
166 | + }, | ||
167 | + getFieldOptionList(fields_id){ | ||
168 | + let that=this; | ||
169 | + console.log(fields_id); | ||
170 | + let url = 'public/getFieldOptionList'; | ||
171 | + let params={ | ||
172 | + fields_id: fields_id | ||
173 | + } | ||
174 | + app.post(url, params).then((res) => { | ||
175 | + console.log(res); | ||
176 | + let item=[]; | ||
177 | + for (let obj of res){ | ||
178 | + item.push(obj.name) | ||
179 | + } | ||
180 | + that.setData({ | ||
181 | + for_me:res, | ||
182 | + for_meitem:item | ||
183 | + }) | ||
184 | + }).catch((errMsg) => { | ||
185 | + console.log(errMsg); | ||
186 | + }) | ||
187 | + }, | ||
188 | + /** | ||
189 | + * 生命周期函数--监听页面加载 | ||
190 | + */ | ||
191 | + onLoad: function (options) { | ||
192 | + let that=this; | ||
193 | + let dateobj=app.dateLater(0); | ||
194 | + app.setStatisticsVisitorLog('/pages/addfile/addfile'); | ||
195 | + that.getFieldList(); | ||
196 | + that.setData({ | ||
197 | + enddate: dateobj.dataday, | ||
198 | + mdate: '1988-' + dateobj.month+'-'+dateobj.day | ||
199 | + }) | ||
200 | + }, | ||
201 | + | ||
202 | + /** | ||
203 | + * 生命周期函数--监听页面初次渲染完成 | ||
204 | + */ | ||
205 | + onReady: function () { | ||
206 | + | ||
207 | + }, | ||
208 | + | ||
209 | + /** | ||
210 | + * 生命周期函数--监听页面显示 | ||
211 | + */ | ||
212 | + onShow: function () { | ||
213 | + | ||
214 | + | ||
215 | + | ||
216 | + }, | ||
217 | + | ||
218 | + /** | ||
219 | + * 生命周期函数--监听页面隐藏 | ||
220 | + */ | ||
221 | + onHide: function () { | ||
222 | + | ||
223 | + }, | ||
224 | + | ||
225 | + /** | ||
226 | + * 生命周期函数--监听页面卸载 | ||
227 | + */ | ||
228 | + onUnload: function () { | ||
229 | + | ||
230 | + }, | ||
231 | + | ||
232 | + /** | ||
233 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
234 | + */ | ||
235 | + onPullDownRefresh: function () { | ||
236 | + | ||
237 | + }, | ||
238 | + | ||
239 | + /** | ||
240 | + * 页面上拉触底事件的处理函数 | ||
241 | + */ | ||
242 | + onReachBottom: function () { | ||
243 | + | ||
244 | + }, | ||
245 | + | ||
246 | + /** | ||
247 | + * 用户点击右上角分享 | ||
248 | + */ | ||
249 | + onShareAppMessage: function () { | ||
250 | + | ||
251 | + } | ||
252 | +}) |
pages/addfile/addfile.json
0 → 100644
1 | +{"navigationBarTitleText": "添加档案"} |
pages/addfile/addfile.wxml
0 → 100644
1 | +<!--pages/addfile/addfile.wxml--> | ||
2 | +<view class='top_tip'> | ||
3 | + 为了给您提供更准确的化疗后追踪服务,请务必如实填写以下资料 | ||
4 | +</view> | ||
5 | +<view class='record_main addfile_top'> | ||
6 | + <view class='input_box'> | ||
7 | + <view>姓名:</view> | ||
8 | + <view class="input_cell"> | ||
9 | + <input placeholder='请输入姓名或昵称' type='text' placeholder-class='placeholderStyle' bindinput='setpatient'></input> | ||
10 | + </view> | ||
11 | + </view> | ||
12 | + <picker mode="date" value="{{mdate}}" end="{{enddate}}" bindchange="bindDateChange"> | ||
13 | + <view class='input_box'> | ||
14 | + <view>生日:</view> | ||
15 | + <view class="input_cell">{{date}}</view> | ||
16 | + </view> | ||
17 | + </picker> | ||
18 | + <view class='sexbox'> | ||
19 | + <view class='man_box' bindtap='setsexman_yes'> | ||
20 | + <view class='seximg'> | ||
21 | + <image src='../../img/man.png'></image> | ||
22 | + </view> | ||
23 | + <view class='no_choose_box' wx:if='{{sexman}}'> | ||
24 | + <image src='../../img/choose_yes.png'></image> | ||
25 | + </view> | ||
26 | + <view class='no_choose_box' wx:else> | ||
27 | + <image src='../../img/choose_no.png'></image> | ||
28 | + </view> | ||
29 | + <view>男</view> | ||
30 | + </view> | ||
31 | + <view class='man_box' bindtap='setsexman_no'> | ||
32 | + <view class='seximg'> | ||
33 | + <image src='../../img/woman.png'></image> | ||
34 | + </view> | ||
35 | + <view class='no_choose_box' wx:if='{{sexman}}'> | ||
36 | + <image src='../../img/choose_no.png'></image> | ||
37 | + </view> | ||
38 | + <view class='no_choose_box' wx:else> | ||
39 | + <image src='../../img/choose_yes.png'></image> | ||
40 | + </view> | ||
41 | + <view>女</view> | ||
42 | + </view> | ||
43 | + </view> | ||
44 | +<picker bindchange="bindPickeritem" range="{{for_meitem}}"> | ||
45 | + <view class='input_box'> | ||
46 | + <view>与本人关系</view> | ||
47 | + <view class="input_cell"> | ||
48 | + <view class="picker"> | ||
49 | + {{for_who}} | ||
50 | + </view> | ||
51 | + </view> | ||
52 | + </view> | ||
53 | + </picker> | ||
54 | + <view class='input_box'> | ||
55 | + <view>疾病名称:</view> | ||
56 | + <view class="input_cell"> | ||
57 | + <input placeholder='请输入疾病名称' type='text' placeholder-class='placeholderStyle' bindinput='setdisease'></input> | ||
58 | + </view> | ||
59 | + </view> | ||
60 | + <picker mode="region" bindchange="bindRegionChange" value="{{address}}" custom-item="{{customItem}}"> | ||
61 | + <view class='input_box'> | ||
62 | + <view>现住址</view> | ||
63 | + <view class="input_cell"> | ||
64 | + <view class="picker"> | ||
65 | + {{address[0]}}{{address[1]}}{{address[2]}} | ||
66 | + </view> | ||
67 | + </view> | ||
68 | + </view> | ||
69 | + </picker> | ||
70 | + <view class='agreenbox'> | ||
71 | + <view class='no_choose_box' wx:if='{{chooseagreen}}' bindtap='setchoose'> | ||
72 | + <image src='../../img/choose_yes.png'></image> | ||
73 | + </view> | ||
74 | + <view class='no_choose_box' wx:else bindtap='setchoose'> | ||
75 | + <image src='../../img/choose_no.png'></image> | ||
76 | + </view> | ||
77 | + <view class='agreen_txt'>我已阅读并同意 | ||
78 | + <text class='txt_a' bindtap='goagreement'>《用户授权隐私协议》</text> | ||
79 | + </view> | ||
80 | + </view> | ||
81 | + | ||
82 | + | ||
83 | + <cover-view class='btn addfile_btn' bindtap='addFiles'>保存 并开始记录</cover-view> | ||
84 | + | ||
85 | + | ||
86 | +</view> |
pages/addfile/addfile.wxss
0 → 100644
1 | +/* pages/addfile/addfile.wxss */ | ||
2 | +@import '/pages/addrecord/addrecord.wxss'; | ||
3 | +.addfile_top{ | ||
4 | + margin-top: 40rpx; | ||
5 | +} | ||
6 | +.input_cell{ | ||
7 | + font-size:34rpx; | ||
8 | +} | ||
9 | +.input_cell input { | ||
10 | +text-align:right; | ||
11 | +padding:0 10rpx 0 0; | ||
12 | +color:#999; | ||
13 | +font-size:34rpx; | ||
14 | +} | ||
15 | +.placeholderStyle{ | ||
16 | + font-size:34rpx; | ||
17 | + color:#999; | ||
18 | +} | ||
19 | +.sexbox{ | ||
20 | + margin: 48rpx 88rpx; | ||
21 | + display: flex; | ||
22 | + align-items: center; | ||
23 | + justify-content: space-between; | ||
24 | +} | ||
25 | +.man_box{ | ||
26 | + display: flex; | ||
27 | + align-items: center; | ||
28 | + color:#000; | ||
29 | + font-size:34rpx; | ||
30 | +} | ||
31 | +.seximg{ | ||
32 | + display: flex; | ||
33 | + align-items: center; | ||
34 | + justify-content: center; | ||
35 | + width: 80rpx; | ||
36 | + height: 80rpx; | ||
37 | + border-radius: 50%; | ||
38 | + overflow: hidden; | ||
39 | +} | ||
40 | +.seximg image{ | ||
41 | + width:100%; | ||
42 | + height: 100%; | ||
43 | +} | ||
44 | +.no_choose_box{ | ||
45 | + margin: 0 14rpx 0 30rpx; | ||
46 | + display: flex; | ||
47 | + align-items: center; | ||
48 | + justify-content: center; | ||
49 | + width: 44rpx; | ||
50 | + height: 44rpx; | ||
51 | + border-radius: 50%; | ||
52 | + overflow: hidden; | ||
53 | +} | ||
54 | +.no_choose_box image{ | ||
55 | + width:100%; | ||
56 | + height: 100%; | ||
57 | +} | ||
58 | +.agreenbox{ | ||
59 | + margin:160rpx 0 0 0; | ||
60 | + display: flex; | ||
61 | + align-items: center; | ||
62 | + justify-content: center | ||
63 | +} | ||
64 | +.agreen_txt{ | ||
65 | + font-size:28rpx; | ||
66 | + padding:0 0 6rpx 0; | ||
67 | + border-bottom:1rpx solid #ededed; | ||
68 | +} | ||
69 | +.txt_a{ | ||
70 | + color:#88a8c6; | ||
71 | +} |
-
请 注册 或 登录 后发表评论