Compare commits
984 Commits
feat-unify
...
v2.0.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
766a3a8ede | ||
|
|
293259a97d | ||
|
|
7584c79519 | ||
|
|
d9bb0bf61d | ||
|
|
cbb401840c | ||
|
|
f8b8624244 | ||
|
|
f3ec85050e | ||
|
|
785a4d97f7 | ||
|
|
ba54d934a2 | ||
|
|
d6ecad6467 | ||
|
|
74cab1e9af | ||
|
|
9da073e838 | ||
|
|
a823851541 | ||
|
|
1764c0de08 | ||
|
|
79fd809993 | ||
|
|
d3a0d36c92 | ||
|
|
0841e632c2 | ||
|
|
d8f8ef032d | ||
|
|
b7f84dbb0d | ||
|
|
17f1a7ce9d | ||
|
|
ca69331286 | ||
|
|
8258ad21d7 | ||
|
|
2a129d0ee3 | ||
|
|
e391520ce3 | ||
|
|
3e8329c31f | ||
|
|
19d7b1be77 | ||
|
|
ee8a05b6e6 | ||
|
|
111f5bdcfb | ||
|
|
4c1b955bd5 | ||
|
|
ad6614e338 | ||
|
|
57c730a7eb | ||
|
|
e1ec5d15ee | ||
|
|
4496e17d45 | ||
|
|
28668f2acb | ||
|
|
87440362ac | ||
|
|
f470817c01 | ||
|
|
4d9330983a | ||
|
|
edecfc7116 | ||
|
|
d4f3b97b3d | ||
|
|
48d17f9244 | ||
|
|
a96fa8f4b7 | ||
|
|
a81c6e1756 | ||
|
|
b3255ab28b | ||
|
|
75b5103637 | ||
|
|
ddee71fc0d | ||
|
|
18ea1a575c | ||
|
|
3e4cc376f9 | ||
|
|
f17c22793b | ||
|
|
965f734618 | ||
|
|
fc1258319e | ||
|
|
7d17e2b332 | ||
|
|
5a79fc4f2d | ||
|
|
db8fd7582b | ||
|
|
daa6458a26 | ||
|
|
b6ac93ae63 | ||
|
|
87e7c4bee2 | ||
|
|
4adc46dd79 | ||
|
|
73f6d6a622 | ||
|
|
b98c3166f2 | ||
|
|
b7503a841a | ||
|
|
0eb3123848 | ||
|
|
a637cd783c | ||
|
|
8530e9bc5e | ||
|
|
f18c05519d | ||
|
|
cbeddb2460 | ||
|
|
be84e64f00 | ||
|
|
34210104d4 | ||
|
|
035586c9ef | ||
|
|
7f52ef9843 | ||
|
|
ca9b33da88 | ||
|
|
c7f64ceb00 | ||
|
|
11d4f86551 | ||
|
|
00aaf3427a | ||
|
|
3e72a0e440 | ||
|
|
618d1d77cb | ||
|
|
0a1023f795 | ||
|
|
71471bac27 | ||
|
|
972c92519c | ||
|
|
17c48608ec | ||
|
|
617b940d64 | ||
|
|
8d36a857eb | ||
|
|
6d5dfbced0 | ||
|
|
59ff14aec4 | ||
|
|
3c39d5db9d | ||
|
|
3980cc584f | ||
|
|
2167525312 | ||
|
|
e724822198 | ||
|
|
0d1abd00a1 | ||
|
|
62aec195ea | ||
|
|
9692945716 | ||
|
|
b8dab8c87d | ||
|
|
a6646be66b | ||
|
|
8cfb54aab1 | ||
|
|
960f3aa3cf | ||
|
|
43f35de27a | ||
|
|
d39ce294b8 | ||
|
|
e7349bfae9 | ||
|
|
ad1ff249aa | ||
|
|
3fed2bb5e0 | ||
|
|
67995ac461 | ||
|
|
39d9aa1896 | ||
|
|
895fd25627 | ||
|
|
7582cac69a | ||
|
|
790917eaf2 | ||
|
|
18d83f161e | ||
|
|
42e9e5edce | ||
|
|
31450e0eac | ||
|
|
34d799049d | ||
|
|
92bf26ced5 | ||
|
|
6214c17903 | ||
|
|
f1e801340f | ||
|
|
4105883ab6 | ||
|
|
feb39bde44 | ||
|
|
ae4ae074d8 | ||
|
|
2ed1b4bf23 | ||
|
|
c773bd8010 | ||
|
|
e4ed2392bb | ||
|
|
ae32b9838b | ||
|
|
f126fc3d04 | ||
|
|
3ac03973fb | ||
|
|
96384d7b39 | ||
|
|
20f720bf27 | ||
|
|
5746da73dd | ||
|
|
642de9a78c | ||
|
|
b8a1fd904b | ||
|
|
31c63130d6 | ||
|
|
6a7c2bca9a | ||
|
|
60bbfd9c92 | ||
|
|
369a8ade42 | ||
|
|
6e19ed2dce | ||
|
|
12d92f3aa4 | ||
|
|
ed5dd5e122 | ||
|
|
854ff4b888 | ||
|
|
2edb1caf18 | ||
|
|
9bdf42a057 | ||
|
|
ad60b7b44c | ||
|
|
58033530c1 | ||
|
|
fa0c570f90 | ||
|
|
73bb93f166 | ||
|
|
75067221da | ||
|
|
3358e164a1 | ||
|
|
696a363591 | ||
|
|
94cde3f517 | ||
|
|
45737c8f7a | ||
|
|
25077b91ca | ||
|
|
a2c8827a35 | ||
|
|
8487a1b159 | ||
|
|
4141d00409 | ||
|
|
924a173d6b | ||
|
|
368ae13db6 | ||
|
|
5c5c0b02df | ||
|
|
888ad61cf2 | ||
|
|
cfa7f59b0b | ||
|
|
3fc6012145 | ||
|
|
463b14736f | ||
|
|
d37034cb52 | ||
|
|
c9d61128bf | ||
|
|
810f4d8e6d | ||
|
|
1bd0f516e2 | ||
|
|
336ef369cc | ||
|
|
efcb25153e | ||
|
|
f8aafd0e0b | ||
|
|
fdb19fb310 | ||
|
|
d497e17a7d | ||
|
|
287097ceed | ||
|
|
789f24d89d | ||
|
|
8c370c550e | ||
|
|
d8fa5784bf | ||
|
|
1baa18888f | ||
|
|
9644b22896 | ||
|
|
5312ba5a45 | ||
|
|
545e9f6571 | ||
|
|
172a3163aa | ||
|
|
42093e2a32 | ||
|
|
f7d23ff830 | ||
|
|
4d189e954c | ||
|
|
8a1f3ac2ef | ||
|
|
049d3fb911 | ||
|
|
18947db22b | ||
|
|
dbd49a05bd | ||
|
|
df07169005 | ||
|
|
21fe89adf6 | ||
|
|
49956d32cc | ||
|
|
b75667d92c | ||
|
|
c9848e7b01 | ||
|
|
e2cda9140b | ||
|
|
e091eb7b64 | ||
|
|
aa3a5fbf84 | ||
|
|
f1ed9c848a | ||
|
|
c2bcc51797 | ||
|
|
2c7192b40c | ||
|
|
6b81559d4c | ||
|
|
15e9a0c0f5 | ||
|
|
8085640ea6 | ||
|
|
5eb851fc82 | ||
|
|
24ede6ac4f | ||
|
|
d39a8c293f | ||
|
|
c44dd111db | ||
|
|
5763ff0d57 | ||
|
|
76f4a73525 | ||
|
|
bf45cd607d | ||
|
|
9c0f1f793f | ||
|
|
674131a0ae | ||
|
|
43438594d2 | ||
|
|
5af0b60644 | ||
|
|
35313f2ce8 | ||
|
|
d01b8b2b15 | ||
|
|
8f061e5c3b | ||
|
|
0c596c69cf | ||
|
|
390eec99a2 | ||
|
|
fe77d88936 | ||
|
|
e4bc388faa | ||
|
|
255c47a8e1 | ||
|
|
03f8dee9d4 | ||
|
|
2b34a01845 | ||
|
|
4e435d4f29 | ||
|
|
89a6e5db20 | ||
|
|
f43f744c3e | ||
|
|
7b9ca460a6 | ||
|
|
1c0a923771 | ||
|
|
76112345f2 | ||
|
|
7985db16f1 | ||
|
|
bec5868068 | ||
|
|
ac8d77a53f | ||
|
|
826d294690 | ||
|
|
23075b7bdd | ||
|
|
096d63cbac | ||
|
|
acc9dc7751 | ||
|
|
68dbf3e9ef | ||
|
|
4eca4c607a | ||
|
|
fe22e1d330 | ||
|
|
085c393767 | ||
|
|
df10ae58f4 | ||
|
|
714dac93bc | ||
|
|
2589cad06e | ||
|
|
2ae3461a9c | ||
|
|
0aece46d91 | ||
|
|
094c7ed392 | ||
|
|
bb16fa51d0 | ||
|
|
36bfbf900a | ||
|
|
c48517a89b | ||
|
|
d89b22a8f7 | ||
|
|
159a165457 | ||
|
|
199c6abcb1 | ||
|
|
96a41f8ebc | ||
|
|
ac3f5567c5 | ||
|
|
9fd85761d7 | ||
|
|
68c68e96b1 | ||
|
|
130e4a3659 | ||
|
|
36b1f37f3f | ||
|
|
0107643e7e | ||
|
|
9fea20cb79 | ||
|
|
a1233aa1fe | ||
|
|
51e5c756a7 | ||
|
|
8df951992e | ||
|
|
558512220e | ||
|
|
1a00993ee8 | ||
|
|
177fa6bfbe | ||
|
|
cb7e887c36 | ||
|
|
255b14a597 | ||
|
|
3f462c1bee | ||
|
|
a6d1baec3e | ||
|
|
8ddc85738a | ||
|
|
52c1eabf1e | ||
|
|
6cd30283e7 | ||
|
|
2380c6ec60 | ||
|
|
f02e92a58e | ||
|
|
a54a007c5a | ||
|
|
2ad3677fdc | ||
|
|
d09d1b96be | ||
|
|
e4e1fee8b4 | ||
|
|
e348caaa0c | ||
|
|
1ee76efeb8 | ||
|
|
716379fc9f | ||
|
|
01c2a20a0f | ||
|
|
4c353136d5 | ||
|
|
c293c43862 | ||
|
|
45dcd1885d | ||
|
|
a4690c21cf | ||
|
|
0ca908c8d5 | ||
|
|
e40a1f87f9 | ||
|
|
09ebd67c37 | ||
|
|
bad7e37f5a | ||
|
|
99b344bdef | ||
|
|
3b7f9e5dec | ||
|
|
2928eaa4ae | ||
|
|
77ef4c05b9 | ||
|
|
f55a2b94e7 | ||
|
|
5fba293245 | ||
|
|
e380ead651 | ||
|
|
57798b9000 | ||
|
|
eb774f9d41 | ||
|
|
e2a0478357 | ||
|
|
0bd5587e65 | ||
|
|
96d8cb0006 | ||
|
|
b0e4383a43 | ||
|
|
5cadcc8259 | ||
|
|
fbc689b235 | ||
|
|
0779aeca6a | ||
|
|
9aca371e9c | ||
|
|
9ea4858770 | ||
|
|
d7b74ed90d | ||
|
|
ffb6b2f68c | ||
|
|
4d560ab937 | ||
|
|
857f811685 | ||
|
|
0bce64c867 | ||
|
|
cacc99683d | ||
|
|
0998fc5376 | ||
|
|
d3a9f7d60f | ||
|
|
ba52c55158 | ||
|
|
27d78c6b4d | ||
|
|
8d4dd3160d | ||
|
|
1b68c39d5d | ||
|
|
6847f7d966 | ||
|
|
8c01974494 | ||
|
|
c74322e783 | ||
|
|
b7d8225dbd | ||
|
|
48e9165483 | ||
|
|
b37c8114d8 | ||
|
|
997790e653 | ||
|
|
3b12503e77 | ||
|
|
f6d605da62 | ||
|
|
35fda2b9a9 | ||
|
|
2d76991d27 | ||
|
|
c9b2fc2674 | ||
|
|
6c65e419e2 | ||
|
|
288bb264e0 | ||
|
|
33a741ca0e | ||
|
|
5f80fa8aa4 | ||
|
|
506412175e | ||
|
|
06c3765d9d | ||
|
|
66f22551c4 | ||
|
|
d30f60a972 | ||
|
|
bf69ba91d5 | ||
|
|
15ff1d2912 | ||
|
|
740f471ff4 | ||
|
|
d1de5f0c4c | ||
|
|
f178b0e0ca | ||
|
|
d4bfdd1e91 | ||
|
|
539db3c56b | ||
|
|
2ac2d79966 | ||
|
|
4db0ba4714 | ||
|
|
6b0df75357 | ||
|
|
e9c2ca0989 | ||
|
|
35204898fc | ||
|
|
bb32edf264 | ||
|
|
db00fcf372 | ||
|
|
801f6e8d18 | ||
|
|
88abcf8a4a | ||
|
|
410dc4fc58 | ||
|
|
ddee396cea | ||
|
|
7fe743d624 | ||
|
|
2cb65c623e | ||
|
|
f612b62b0a | ||
|
|
84fd1b2181 | ||
|
|
6a285f610c | ||
|
|
ce925e0f45 | ||
|
|
67da33931a | ||
|
|
a4c0450f7a | ||
|
|
a81f016e3f | ||
|
|
a58eb4a53c | ||
|
|
3f3caae4fc | ||
|
|
417821b72d | ||
|
|
b1ae4c3712 | ||
|
|
0705fb8b0f | ||
|
|
6a90d1a043 | ||
|
|
74e30390cf | ||
|
|
4ba3d8803a | ||
|
|
f53f4d57f2 | ||
|
|
33d78ffcda | ||
|
|
9e6873e1da | ||
|
|
47f6fc87c7 | ||
|
|
2ee2783a9c | ||
|
|
3a066fc9bb | ||
|
|
ee5fed4cd0 | ||
|
|
16b703f317 | ||
|
|
3537427846 | ||
|
|
3fb0fe43bb | ||
|
|
8693a11a32 | ||
|
|
2259545094 | ||
|
|
f1f5f9cca9 | ||
|
|
2ce17c3974 | ||
|
|
e09d014fa6 | ||
|
|
8c74b8e8df | ||
|
|
c3b6bcec65 | ||
|
|
633bf987ab | ||
|
|
bf1b81e554 | ||
|
|
729021f37c | ||
|
|
bde2634ef3 | ||
|
|
d6da6f759d | ||
|
|
32f851e57b | ||
|
|
30e7e7ab7c | ||
|
|
cfa69baaa3 | ||
|
|
78626b3c04 | ||
|
|
340492f784 | ||
|
|
6cecbb6ec2 | ||
|
|
665ebd7b17 | ||
|
|
c07d7c7c28 | ||
|
|
1d7e40950f | ||
|
|
91bda457e7 | ||
|
|
68aeea70cf | ||
|
|
a0c8bc7fe5 | ||
|
|
0f73536ce0 | ||
|
|
455e387a62 | ||
|
|
99467f87ff | ||
|
|
f7d3a0b499 | ||
|
|
7a19346700 | ||
|
|
8d2269df78 | ||
|
|
1c54b81212 | ||
|
|
b133cbdfea | ||
|
|
6d6fa04a4b | ||
|
|
954de6d58b | ||
|
|
a0ecfa7264 | ||
|
|
54f9c065c8 | ||
|
|
f45d4ca5af | ||
|
|
b8705c4f31 | ||
|
|
d96e7f71d7 | ||
|
|
24fee76237 | ||
|
|
588cc380cd | ||
|
|
5eca551271 | ||
|
|
d59193bc33 | ||
|
|
6928a70d9f | ||
|
|
e0796280f5 | ||
|
|
5522837b00 | ||
|
|
5d803e3fa6 | ||
|
|
29fd85254b | ||
|
|
749c0a2f39 | ||
|
|
737504cef5 | ||
|
|
61af1674b9 | ||
|
|
d8ccff8de5 | ||
|
|
e29c427f8d | ||
|
|
b8d0d1a2ff | ||
|
|
8115950893 | ||
|
|
f458a21a2f | ||
|
|
13a9675894 | ||
|
|
77b5a41af9 | ||
|
|
ffa127593a | ||
|
|
f9c17c732a | ||
|
|
427c5589b2 | ||
|
|
b618f9e865 | ||
|
|
2182c7d34a | ||
|
|
9482e9aba3 | ||
|
|
6d5651fd1d | ||
|
|
c195b69003 | ||
|
|
8216cd7604 | ||
|
|
8d691f2d69 | ||
|
|
09d8c58e73 | ||
|
|
2bf895ad3d | ||
|
|
0823bf1d9c | ||
|
|
6a5abd6762 | ||
|
|
5cb458c45b | ||
|
|
43e8b9939b | ||
|
|
c792482c60 | ||
|
|
e48ca421d8 | ||
|
|
ac23d4c8dc | ||
|
|
68b49ea710 | ||
|
|
99287497cc | ||
|
|
f828c48ab6 | ||
|
|
2626bc794f | ||
|
|
70f9df7650 | ||
|
|
8b39ec2773 | ||
|
|
eafbcb2cde | ||
|
|
f8f5bc7688 | ||
|
|
0335b379ea | ||
|
|
734dd68607 | ||
|
|
3c221345dd | ||
|
|
13bcf3c649 | ||
|
|
19f53f705c | ||
|
|
58fee4a86f | ||
|
|
b93caf1386 | ||
|
|
aa613e2805 | ||
|
|
616584fc19 | ||
|
|
a22e4b814b | ||
|
|
c249c120c1 | ||
|
|
c8d016e1b4 | ||
|
|
2e6d87ab80 | ||
|
|
5c07885a4e | ||
|
|
5f8db36888 | ||
|
|
ce34a7ed2a | ||
|
|
a5e83bfe9f | ||
|
|
1252d266dd | ||
|
|
3c820d53a6 | ||
|
|
f0525c7522 | ||
|
|
600f1b2dd2 | ||
|
|
b3422eaede | ||
|
|
757b79514a | ||
|
|
8b57ffa124 | ||
|
|
cf8121eb00 | ||
|
|
faf2d44fbb | ||
|
|
dcbaf37a69 | ||
|
|
741ba1a039 | ||
|
|
80176e5737 | ||
|
|
88516d9491 | ||
|
|
88dbbe03ea | ||
|
|
ae1fd2e7cf | ||
|
|
04ed5d354d | ||
|
|
fa678e1089 | ||
|
|
d3931f47bc | ||
|
|
bf9bd59b63 | ||
|
|
fb0ff50837 | ||
|
|
93727a0ac7 | ||
|
|
8575d27504 | ||
|
|
fa6ef30cd8 | ||
|
|
14402e6674 | ||
|
|
0915e162fd | ||
|
|
2641e70c78 | ||
|
|
bc44584698 | ||
|
|
82394dd7a3 | ||
|
|
2e688ad686 | ||
|
|
9b998e0c6d | ||
|
|
1045588301 | ||
|
|
fffe49cd0f | ||
|
|
94fc6138a0 | ||
|
|
4f248e57c8 | ||
|
|
ba86399fd3 | ||
|
|
a89164f885 | ||
|
|
7f2344c82c | ||
|
|
e5bf08f709 | ||
|
|
3c8e430533 | ||
|
|
f7209fba53 | ||
|
|
9fae683d8b | ||
|
|
79a2b98a1a | ||
|
|
98b28a631a | ||
|
|
d61769f9b8 | ||
|
|
6fec64f515 | ||
|
|
01d5890b35 | ||
|
|
0ec9fd8534 | ||
|
|
fea583eb5b | ||
|
|
fcf8d9d99d | ||
|
|
bfe5039a1c | ||
|
|
7a57d944c8 | ||
|
|
ca27e87241 | ||
|
|
e674a1ece4 | ||
|
|
6c91fca4e7 | ||
|
|
dfb63346d3 | ||
|
|
4d899d48dc | ||
|
|
fa3a3dfcb0 | ||
|
|
e36210aa27 | ||
|
|
20a599594c | ||
|
|
70f8dbae53 | ||
|
|
e01292376f | ||
|
|
d8022b2682 | ||
|
|
0d7c5b8ace | ||
|
|
1c5c867a19 | ||
|
|
88c9850c44 | ||
|
|
dde5ae796e | ||
|
|
f1ed62cdca | ||
|
|
bfac86d5dd | ||
|
|
341015c584 | ||
|
|
7c5a66978e | ||
|
|
b21fc3f5e7 | ||
|
|
0e52628842 | ||
|
|
64992c59b7 | ||
|
|
c3aae6e5fa | ||
|
|
f7922cafa5 | ||
|
|
8c5496829e | ||
|
|
2a44fd3ca4 | ||
|
|
8514f051a7 | ||
|
|
61feb29fe2 | ||
|
|
fa29881f04 | ||
|
|
46cb8e7d0b | ||
|
|
b6143bc75e | ||
|
|
92e1ec05d2 | ||
|
|
68512206f7 | ||
|
|
88073e97af | ||
|
|
75f23bb1bf | ||
|
|
e8642d0301 | ||
|
|
5f5731f813 | ||
|
|
55159be0dc | ||
|
|
0c4e1dc7ae | ||
|
|
b4abdeb246 | ||
|
|
7e61dda4aa | ||
|
|
283aafb27d | ||
|
|
aafafdd0aa | ||
|
|
198b839dab | ||
|
|
597b8fb5af | ||
|
|
a4cb4cb0ad | ||
|
|
1bc51a51c2 | ||
|
|
8857059da8 | ||
|
|
7939d37fa3 | ||
|
|
df83385cb0 | ||
|
|
5d69fc4b24 | ||
|
|
4f1b550fa9 | ||
|
|
782c12d91d | ||
|
|
4b97d98b3a | ||
|
|
8e3e9b5f50 | ||
|
|
ceed66b7ea | ||
|
|
a8399be4a3 | ||
|
|
19f73d7066 | ||
|
|
36d46d0a45 | ||
|
|
323e5505f5 | ||
|
|
12a2ace498 | ||
|
|
c5eefec24d | ||
|
|
c4c4572885 | ||
|
|
8fcd2a9141 | ||
|
|
f0fad0dba7 | ||
|
|
71c7116493 | ||
|
|
e797879e0d | ||
|
|
2e460ea32a | ||
|
|
ef3b1dce7c | ||
|
|
22e01a80c1 | ||
|
|
770373c48c | ||
|
|
77ff376e75 | ||
|
|
d5fb56f571 | ||
|
|
b37ba41694 | ||
|
|
f7084ba3a3 | ||
|
|
f89a64f10e | ||
|
|
f6fe7816c9 | ||
|
|
ca8e08f3db | ||
|
|
1e188dd26b | ||
|
|
59fb22cd0c | ||
|
|
ede7bcce80 | ||
|
|
07e3f227be | ||
|
|
d0070319a9 | ||
|
|
60ec01eb32 | ||
|
|
47e04ba6e3 | ||
|
|
c7a2a01f12 | ||
|
|
45e5ca0722 | ||
|
|
8ca9a3be05 | ||
|
|
c89b92c2d3 | ||
|
|
38685e9b49 | ||
|
|
65f0c87149 | ||
|
|
71a7247f71 | ||
|
|
27dac34c2b | ||
|
|
99fec48458 | ||
|
|
1c093e5243 | ||
|
|
96d1b79cf5 | ||
|
|
bd4879e88a | ||
|
|
6a5d746703 | ||
|
|
b5271b07fa | ||
|
|
e3fa62a3f8 | ||
|
|
b129123fa0 | ||
|
|
e9a1606f00 | ||
|
|
6cc321b997 | ||
|
|
f668a2b892 | ||
|
|
cf50e77daf | ||
|
|
ef9e4c8ea4 | ||
|
|
ab96d0919f | ||
|
|
dee6aa6754 | ||
|
|
55f59f9f2d | ||
|
|
8f5bc134f2 | ||
|
|
8ca08a5600 | ||
|
|
621a302451 | ||
|
|
bf4254719d | ||
|
|
3bcef87d6c | ||
|
|
bacdcd1760 | ||
|
|
871b61acf5 | ||
|
|
e0b0d5747b | ||
|
|
b61215d540 | ||
|
|
43cc7d8a95 | ||
|
|
d5656ea07c | ||
|
|
880f9d535c | ||
|
|
30bd83b032 | ||
|
|
5d73a5fdd3 | ||
|
|
9f95a4c83e | ||
|
|
8c3c483894 | ||
|
|
8486e08615 | ||
|
|
798a7eb49a | ||
|
|
17f29d3773 | ||
|
|
43c46c873c | ||
|
|
96581511f8 | ||
|
|
be81a8c731 | ||
|
|
74338c06f0 | ||
|
|
9fbe2500e0 | ||
|
|
4f16531016 | ||
|
|
98bebbc796 | ||
|
|
3c85322450 | ||
|
|
9e9410533c | ||
|
|
b5d420c9bf | ||
|
|
9c8fab832e | ||
|
|
f304a4f27a | ||
|
|
0b674fb0ae | ||
|
|
9cd18c9086 | ||
|
|
98d3962f87 | ||
|
|
b4ebf8cde3 | ||
|
|
828497bd08 | ||
|
|
3d0611cfdf | ||
|
|
33b7d990e3 | ||
|
|
24dbc21cfc | ||
|
|
ee9a93b353 | ||
|
|
991b134e23 | ||
|
|
553d9d7519 | ||
|
|
1bcace8d5e | ||
|
|
8d9f503867 | ||
|
|
d1f84cded9 | ||
|
|
533af6b2f9 | ||
|
|
10a21c9f6b | ||
|
|
16bf72ac24 | ||
|
|
aef57f13f0 | ||
|
|
4b3acfca74 | ||
|
|
33b2f67df8 | ||
|
|
4c28df1602 | ||
|
|
9c04f51548 | ||
|
|
d0752b0b26 | ||
|
|
77137990a6 | ||
|
|
7bb0b1a463 | ||
|
|
c8d8698b19 | ||
|
|
97da2a6ec1 | ||
|
|
ce42f5c294 | ||
|
|
80f81c1870 | ||
|
|
4aff485816 | ||
|
|
bb9ea4ca32 | ||
|
|
64cad02b62 | ||
|
|
be0c0566df | ||
|
|
b5ea97e239 | ||
|
|
9c2f70b68c | ||
|
|
8b7606f893 | ||
|
|
c0a654fa63 | ||
|
|
e8ce806082 | ||
|
|
cc0ecedd4e | ||
|
|
4aa303b51f | ||
|
|
496c097e5f | ||
|
|
f95d940ff0 | ||
|
|
78879c56cc | ||
|
|
7d2c4e6431 | ||
|
|
f12d3148aa | ||
|
|
6ae0cd55e6 | ||
|
|
2c2aaaac67 | ||
|
|
97df02c07e | ||
|
|
2b0f8a817c | ||
|
|
089bb8945a | ||
|
|
819ad34481 | ||
|
|
aca79071b9 | ||
|
|
a573cd2391 | ||
|
|
0d54716e59 | ||
|
|
d1ea05c2c0 | ||
|
|
bb78d89037 | ||
|
|
e6ff73c252 | ||
|
|
f00bd16aaf | ||
|
|
7002e64b8f | ||
|
|
ab05a6f384 | ||
|
|
d60e6effa1 | ||
|
|
bd430aab32 | ||
|
|
214995fb23 | ||
|
|
0b71c43e89 | ||
|
|
f29299fde5 | ||
|
|
ecaf8e8970 | ||
|
|
cb5f558c62 | ||
|
|
7db9bc85f8 | ||
|
|
91220d31a7 | ||
|
|
e146018f7d | ||
|
|
09e402357a | ||
|
|
2b2b46a990 | ||
|
|
7a8a57a078 | ||
|
|
f3ef1a4022 | ||
|
|
a6c750f877 | ||
|
|
cf92ed55a4 | ||
|
|
caa403a8dc | ||
|
|
822fbbcd24 | ||
|
|
71972f0d8c | ||
|
|
9326c9a59c | ||
|
|
c46c6d30e7 | ||
|
|
a43f0791ea | ||
|
|
19ed2fec19 | ||
|
|
66373a427b | ||
|
|
0d1c24c536 | ||
|
|
a7b2d5a24b | ||
|
|
4d55e5a57b | ||
|
|
890dd88b5f | ||
|
|
2d36600e3b | ||
|
|
2e038ad7db | ||
|
|
27fcec9846 | ||
|
|
62ed00e31c | ||
|
|
c937555020 | ||
|
|
593a48eea4 | ||
|
|
7ea078dbf3 | ||
|
|
6d4be943d7 | ||
|
|
8ee18819c5 | ||
|
|
e672b75453 | ||
|
|
c4e3c34842 | ||
|
|
c4ff0d24b7 | ||
|
|
501dfdc223 | ||
|
|
c399277350 | ||
|
|
b101b2b857 | ||
|
|
7e8d30382f | ||
|
|
0fdbeb1e7a | ||
|
|
9aec36b201 | ||
|
|
0933486e6f | ||
|
|
33b0c94159 | ||
|
|
6c402b3a17 | ||
|
|
3a9f68384f | ||
|
|
3747771078 | ||
|
|
67dc58e08e | ||
|
|
987f4f73a2 | ||
|
|
dd0bf5611d | ||
|
|
58d20b7c8d | ||
|
|
a4c14c39b3 | ||
|
|
ddc005ec10 | ||
|
|
4d54a3029b | ||
|
|
07cb0a7d3a | ||
|
|
0ee76c1579 | ||
|
|
3560effe2c | ||
|
|
0abcbbae53 | ||
|
|
43844c834e | ||
|
|
d15e551743 | ||
|
|
d1c0cae68e | ||
|
|
a1a2e260f6 | ||
|
|
aebed94140 | ||
|
|
96740a6841 | ||
|
|
c29ecc8b0b | ||
|
|
790cc7b878 | ||
|
|
b71b7bfd0e | ||
|
|
06b1e40930 | ||
|
|
159ffb4af2 | ||
|
|
e69fd0cdc4 | ||
|
|
a467283618 | ||
|
|
a6e5dec2c0 | ||
|
|
b96c2f0d3e | ||
|
|
f8785a4505 | ||
|
|
5b14e3a70f | ||
|
|
e6a99302d6 | ||
|
|
8aa4490ea9 | ||
|
|
a451faad77 | ||
|
|
e3816524da | ||
|
|
75232ee902 | ||
|
|
4405ebd30d | ||
|
|
0946d170d7 | ||
|
|
30361aa7ca | ||
|
|
76b22ce05c | ||
|
|
00f2359b9d | ||
|
|
40b8dbc4d5 | ||
|
|
1c67e06138 | ||
|
|
a2e91bac1e | ||
|
|
19b7429215 | ||
|
|
7412c777ee | ||
|
|
499f36bc62 | ||
|
|
862753d35e | ||
|
|
b691003187 | ||
|
|
a63efa5d26 | ||
|
|
013edc4f11 | ||
|
|
504b3a762f | ||
|
|
f26d7e394d | ||
|
|
56bf44e4b0 | ||
|
|
1d6ab1ae5b | ||
|
|
4e1069ec1d | ||
|
|
63ed00bd28 | ||
|
|
5675ea0720 | ||
|
|
c29a70f90b | ||
|
|
3fe2fbfc08 | ||
|
|
8d97bdc976 | ||
|
|
0bf38c032c | ||
|
|
4a76e419be | ||
|
|
0c2da460a3 | ||
|
|
d9a3b358e7 | ||
|
|
632c09bf01 | ||
|
|
2b0008ffc7 | ||
|
|
c6beee08df | ||
|
|
6c2692bb96 | ||
|
|
d690f4277f | ||
|
|
e874ca1e8c | ||
|
|
7918918a69 | ||
|
|
a4198bf75a | ||
|
|
89ac30438a | ||
|
|
d7ebf0e173 | ||
|
|
d1d27a740f | ||
|
|
148297766c | ||
|
|
144980e45d | ||
|
|
116de1a70a | ||
|
|
bc8b0a5226 | ||
|
|
3f828d4208 | ||
|
|
a3b26ff247 | ||
|
|
f06aafd14e | ||
|
|
8f9e45e660 | ||
|
|
8b890fb5e3 | ||
|
|
133c6bea6b | ||
|
|
c107c8c440 | ||
|
|
825d21a3a9 | ||
|
|
383d419f84 | ||
|
|
b20e842af9 | ||
|
|
d13ba5ff78 | ||
|
|
29ce548662 | ||
|
|
a3ec971be2 | ||
|
|
7747ac07ed | ||
|
|
902145df71 | ||
|
|
31194bd4d6 | ||
|
|
9e1a9bf6c3 | ||
|
|
fb136b0918 | ||
|
|
0cf898bd57 | ||
|
|
60b18a20fa | ||
|
|
62f8e389a8 | ||
|
|
b258b0f651 | ||
|
|
1b7bcd3e32 | ||
|
|
88b03a416c | ||
|
|
8fb8b9328d | ||
|
|
688ce50c58 | ||
|
|
314daede24 | ||
|
|
7b24b90fbc | ||
|
|
7d5985f743 | ||
|
|
5590a3024f | ||
|
|
71e13c83e6 | ||
|
|
ad8cc8a003 | ||
|
|
0cda041315 | ||
|
|
8ef13b6325 | ||
|
|
ccf78c6dd2 | ||
|
|
ded1f8ae4b | ||
|
|
917772cce0 | ||
|
|
6f93de7ad4 | ||
|
|
25368419a3 | ||
|
|
c0392e7370 | ||
|
|
31d1983958 | ||
|
|
50e62dbed7 | ||
|
|
25f5d91e87 | ||
|
|
c8d7cca4ed | ||
|
|
727a0c8e8e | ||
|
|
ef40a6347a | ||
|
|
825731edcc | ||
|
|
d820cce6d4 | ||
|
|
3acf2fe732 | ||
|
|
a2a3a31df5 | ||
|
|
929bc4da9f | ||
|
|
56a36cf306 | ||
|
|
dc7db58a8e | ||
|
|
e8999a7fdf | ||
|
|
b93509a6bb | ||
|
|
a606039976 | ||
|
|
37ee9de02b | ||
|
|
2f2a395406 | ||
|
|
01e2ba6db9 | ||
|
|
62f012f2e9 | ||
|
|
49fb0e1113 | ||
|
|
663ef6f2a6 | ||
|
|
bb7aa78738 | ||
|
|
08a24b9e3c | ||
|
|
151ec13904 | ||
|
|
d7965c5857 | ||
|
|
0033b42008 | ||
|
|
f9d533972f | ||
|
|
c57a4850b6 | ||
|
|
ceb8cd5158 | ||
|
|
825b3bf2ea | ||
|
|
a7905b6a60 | ||
|
|
95f5d725ac | ||
|
|
c1bbc83acd | ||
|
|
e1bb655bf1 | ||
|
|
c63637360f | ||
|
|
f626d8a157 | ||
|
|
26b698097d | ||
|
|
9f2ebba293 | ||
|
|
cb7a8298ec | ||
|
|
551a1f2d01 | ||
|
|
3758db4cb6 | ||
|
|
f6860c3fa6 | ||
|
|
ae71e13c6d | ||
|
|
2b83ea6452 | ||
|
|
3e511069b5 | ||
|
|
02c3f7478d | ||
|
|
0a75035339 | ||
|
|
75fb327d7e | ||
|
|
f243dbdd55 | ||
|
|
24c649d19f | ||
|
|
c2369dd733 | ||
|
|
9577bd9de7 | ||
|
|
6a23fd2d72 | ||
|
|
2e1c143d9b | ||
|
|
caadad501f | ||
|
|
39ab04e051 | ||
|
|
7332dd1e98 | ||
|
|
3d8519519b | ||
|
|
58261fd3a3 | ||
|
|
1298abd9e6 | ||
|
|
5b7da15bdd | ||
|
|
1b878b0016 | ||
|
|
05ed82b091 | ||
|
|
34722916b0 | ||
|
|
4333b58938 | ||
|
|
97a0a60754 | ||
|
|
df1fccffa7 | ||
|
|
1afc06b079 | ||
|
|
ef008adf51 | ||
|
|
f00935d795 | ||
|
|
1031d3e248 | ||
|
|
cc5d6ae5d7 | ||
|
|
60183b6a60 | ||
|
|
a02877e38f | ||
|
|
5b98d5703f | ||
|
|
4303e79e6f | ||
|
|
c606102a29 | ||
|
|
3440da72d6 | ||
|
|
f9d0547fc3 | ||
|
|
35a05c046b | ||
|
|
72c7bb3ecc | ||
|
|
8a57a7f3b9 | ||
|
|
54dd1a0dbe | ||
|
|
0f71961d0c |
175
README.md
@@ -4,71 +4,124 @@
|
||||
|
||||
**`master-fetch` 分支是带有后端接口请求的分支**
|
||||
|
||||
**后端项目地址:[https://gitee.com/MTrun/go-view-serve](https://gitee.com/MTrun/go-view-serve)**
|
||||
|
||||
### feat-unify-test 分支目标
|
||||
+ 实现 backend 后端工厂
|
||||
将后端业务逻辑集中到 backend 了,控制 BackEndFactory 就可以适配不同的后端。
|
||||
伪代码如下:
|
||||
export const BackEndFactory = ():IBackend=>{
|
||||
switch(项目后端配置){
|
||||
case "无数据库":
|
||||
return new MockBackend() // 等同: -master ,没有存储
|
||||
case "indexdb":
|
||||
return new IndexDbBackend() // 这次开发的,用 indexdb 做测试
|
||||
case "java":
|
||||
return new JavaBackend() // 等同: -fetch, 没 java 环境,还没做
|
||||
case "python":
|
||||
return new PythonBackend() // 自定义开发的后端
|
||||
。。。 其他 oss 、云平台的后端 。。。
|
||||
}}
|
||||
意义:
|
||||
1 unify 统一 -fetch 和 master 分支,消除分支之间的差异。
|
||||
2 方便接入不同的自定义后端平台。
|
||||
3 前端存储功能让测试工作更加方便
|
||||
**接口说明地址:[https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb](https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb)**
|
||||
|
||||
+ 完善事件处理机制
|
||||
在事件中修改图表配置
|
||||
在事件中修改图表数据
|
||||
在事件中调用图表 exposed 函数
|
||||
数据驱动界面
|
||||
## 使用
|
||||
|
||||
### 试验功能1:Backend 后端工厂
|
||||
+ 对比 -fetch 分支,梳理后端逻辑到 backend 目录的 ibackend 接口
|
||||
+ 登录 - login
|
||||
+ 登出 - logout
|
||||
+ 预览,token 注入或单点登陆 - checkToken
|
||||
+ 显示项目列表和分页 - projectList
|
||||
+ 保存、发布、修改名称 - updateProject
|
||||
+ 复制项目 - copyProject
|
||||
+ 图表内的图片上传 - uploadFile
|
||||
+ 上传图片显示处理 - getFileUrl
|
||||
+ IndexDbBackend 用indexdb浏览器数据库实现了 project 相关所有功能。
|
||||
+ Todo: 统一后端错误处理
|
||||
+ Todo:开发 javabackend,适配现有的后端
|
||||
所有的接口地址位置:`src\api\path\*`
|
||||
|
||||
### 试验功能2:事件处理机制
|
||||
+ 实现最常用的互动:找到图表元素、显示或隐藏、修改数据
|
||||
+ 核心代码:useLifeHandler.hook.ts
|
||||
+ 在事件代码中通过 runtime 实现运行时刻的图表管理,提供基础函数:
|
||||
+ selectComponents 选择多个图表
|
||||
+ selectOneComponent 选择一个图表
|
||||
+ getChartConfig 读取图表
|
||||
+ setChartConfig 设置图表
|
||||
+ callExposed 调用图表 exposed 的函数
|
||||
+ 以下例子可以在点击事件中加入代码并预览,测试效果。
|
||||
接口地址修改:`.env`
|
||||
|
||||
+ 例子1 切换显示名称为 饼图 和 柱状图 的图表:
|
||||
const range = runtime.fn.selectComponents("饼图 柱状图")
|
||||
const h = runtime.fn.getChartConfig(range, "hide")
|
||||
runtime.fn.setChartConfig(range, "hide", !h)
|
||||
### 🤯 后端项目
|
||||
|
||||
+ 例子2 修改一个名称 柱状图001 组件id 2wolqibrx3c000 的图表数据,以下两句等效
|
||||
runtime.fn.setChartConfig("柱状图001", "dataset", {"dimensions":["product","data1","data2"],"source":[{"product":"Mon","data1":120,"data2":130}]})
|
||||
runtime.fn.setChartConfig("#2wolqibrx3c000", "dataset", {"dimensions":["product","data1","data2"],"source":[{"product":"Mon","data1":120,"data2":230}]})
|
||||
后端项目gitee地址:[https://gitee.com/MTrun/go-view-serve](https://gitee.com/MTrun/go-view-serve)
|
||||
|
||||
+ 例子3 找到一个组并隐藏
|
||||
const c = runtime.fn.selectOneComponent("分组")
|
||||
if(c){
|
||||
console.log(runtime.fn.getChartConfig(c, "isGroup" ))
|
||||
runtime.fn.setChartConfig(c, "hide", true)
|
||||
}
|
||||
接口说明地址:[https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb](https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb)
|
||||
|
||||
```shell
|
||||
# port
|
||||
VITE_DEV_PORT = '8080'
|
||||
|
||||
# development path
|
||||
VITE_DEV_PATH = 'http://127.0.0.1:8080'
|
||||
|
||||
# production path
|
||||
VITE_PRO_PATH = 'http://127.0.0.1:8080'
|
||||
```
|
||||
|
||||
公共前缀修改:`src\settings\httpSetting.ts`
|
||||
|
||||
```shell
|
||||
// 请求前缀
|
||||
export const axiosPre = '/api/goview'
|
||||
```
|
||||
|
||||
接口封装:`src\api\http.ts`
|
||||
|
||||
```ts
|
||||
import axiosInstance from './axios'
|
||||
import { RequestHttpEnum, ContentTypeEnum } from '@/enums/httpEnum'
|
||||
|
||||
export const get = (url: string, params?: object) => {
|
||||
return axiosInstance({
|
||||
url: url,
|
||||
method: RequestHttpEnum.GET,
|
||||
params: params,
|
||||
})
|
||||
}
|
||||
|
||||
export const post = (url: string, data?: object, headersType?: string) => {
|
||||
return axiosInstance({
|
||||
url: url,
|
||||
method: RequestHttpEnum.POST,
|
||||
data: data,
|
||||
headers: {
|
||||
'Content-Type': headersType || ContentTypeEnum.JSON
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const put = (url: string, data?: object, headersType?: string) => {
|
||||
return axiosInstance({
|
||||
url: url,
|
||||
method: RequestHttpEnum.PUT,
|
||||
data: data,
|
||||
headers: {
|
||||
'Content-Type': headersType || ContentTypeEnum.JSON
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const del = (url: string, params?: object) => {
|
||||
return axiosInstance({
|
||||
url: url,
|
||||
method: RequestHttpEnum.DELETE,
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 获取请求函数,默认get
|
||||
export const http = (type?: RequestHttpEnum) => {
|
||||
switch (type) {
|
||||
case RequestHttpEnum.GET:
|
||||
return get
|
||||
|
||||
case RequestHttpEnum.POST:
|
||||
return post
|
||||
|
||||
case RequestHttpEnum.PUT:
|
||||
return put
|
||||
|
||||
case RequestHttpEnum.DELETE:
|
||||
return del
|
||||
|
||||
default:
|
||||
return get
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## 代码提交
|
||||
|
||||
* feat: 新功能
|
||||
* fix: 修复 Bug
|
||||
* docs: 文档修改
|
||||
* perf: 性能优化
|
||||
* revert: 版本回退
|
||||
* ci: CICD集成相关
|
||||
* test: 添加测试代码
|
||||
* refactor: 代码重构
|
||||
* build: 影响项目构建或依赖修改
|
||||
* style: 不影响程序逻辑的代码修改
|
||||
* chore: 不属于以上类型的其他类型(日常事务)
|
||||
|
||||
## 交流
|
||||
|
||||
QQ 群:1030129384
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "go-view",
|
||||
"version": "2.1.0",
|
||||
"version": "2.0.91",
|
||||
"scripts": {
|
||||
"dev": "vite --host",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
@@ -22,7 +22,6 @@
|
||||
"echarts-liquidfill": "^3.1.0",
|
||||
"echarts-stat": "^1.2.0",
|
||||
"echarts-wordcloud": "^2.0.0",
|
||||
"gsap": "^3.11.3",
|
||||
"highlight.js": "^11.5.0",
|
||||
"html2canvas": "^1.4.1",
|
||||
"keymaster": "^1.6.2",
|
||||
@@ -30,7 +29,6 @@
|
||||
"naive-ui": "2.33.4",
|
||||
"pinia": "^2.0.13",
|
||||
"screenfull": "^6.0.1",
|
||||
"three": "^0.145.0",
|
||||
"vue": "^3.2.31",
|
||||
"vue-demi": "^0.13.1",
|
||||
"vue-i18n": "9.1.10",
|
||||
@@ -43,7 +41,6 @@
|
||||
"@commitlint/cli": "^17.0.2",
|
||||
"@commitlint/config-conventional": "^17.0.2",
|
||||
"@types/node": "^16.11.26",
|
||||
"@types/three": "^0.144.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.18.0",
|
||||
"@typescript-eslint/parser": "^5.18.0",
|
||||
"@vicons/carbon": "^0.12.0",
|
||||
|
||||
30
pnpm-lock.yaml
generated
@@ -8,7 +8,6 @@ specifiers:
|
||||
'@types/keymaster': ^1.6.30
|
||||
'@types/lodash': ^4.14.184
|
||||
'@types/node': ^16.11.26
|
||||
'@types/three': ^0.144.0
|
||||
'@typescript-eslint/eslint-plugin': ^5.18.0
|
||||
'@typescript-eslint/parser': ^5.18.0
|
||||
'@vicons/carbon': ^0.12.0
|
||||
@@ -32,7 +31,6 @@ specifiers:
|
||||
eslint-plugin-import: ^2.26.0
|
||||
eslint-plugin-prettier: ^4.0.0
|
||||
eslint-plugin-vue: ^8.5.0
|
||||
gsap: ^3.11.3
|
||||
highlight.js: ^11.5.0
|
||||
html2canvas: ^1.4.1
|
||||
husky: ^8.0.1
|
||||
@@ -47,7 +45,6 @@ specifiers:
|
||||
sass: ^1.49.11
|
||||
sass-loader: ^12.6.0
|
||||
screenfull: ^6.0.1
|
||||
three: ^0.145.0
|
||||
typescript: 4.6.3
|
||||
vite: 2.9.9
|
||||
vite-plugin-compression: ^0.5.1
|
||||
@@ -76,7 +73,6 @@ dependencies:
|
||||
echarts-liquidfill: 3.1.0_echarts@5.3.3
|
||||
echarts-stat: 1.2.0
|
||||
echarts-wordcloud: 2.0.0_echarts@5.3.3
|
||||
gsap: 3.11.3
|
||||
highlight.js: 11.5.1
|
||||
html2canvas: 1.4.1
|
||||
keymaster: 1.6.2
|
||||
@@ -84,7 +80,6 @@ dependencies:
|
||||
naive-ui: 2.33.4_vue@3.2.37
|
||||
pinia: 2.0.14_ub5l46u3nefphax5x2tezui4oq
|
||||
screenfull: 6.0.1
|
||||
three: 0.145.0
|
||||
vue: 3.2.37
|
||||
vue-demi: 0.13.1_vue@3.2.37
|
||||
vue-i18n: 9.1.10_vue@3.2.37
|
||||
@@ -97,7 +92,6 @@ devDependencies:
|
||||
'@commitlint/cli': 17.0.2
|
||||
'@commitlint/config-conventional': 17.0.2
|
||||
'@types/node': 16.11.40
|
||||
'@types/three': 0.144.0
|
||||
'@typescript-eslint/eslint-plugin': 5.28.0_evi7yu7wunhzwb24olrfvzynny
|
||||
'@typescript-eslint/parser': 5.28.0_sfmgizikprcxt7r54j7cnzjamu
|
||||
'@vicons/carbon': 0.12.0
|
||||
@@ -911,7 +905,7 @@ packages:
|
||||
dev: true
|
||||
|
||||
/@types/node/17.0.43:
|
||||
resolution: {integrity: sha512-jnUpgw8fL9kP2iszfIDyBQtw5Mf4/XSqy0Loc1J9pI14ejL83XcCEvSf50Gs/4ET0I9VCCDoOfufQysj0S66xA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/@types/node/-/node-17.0.43.tgz}
|
||||
resolution: {integrity: sha512-jnUpgw8fL9kP2iszfIDyBQtw5Mf4/XSqy0Loc1J9pI14ejL83XcCEvSf50Gs/4ET0I9VCCDoOfufQysj0S66xA==, registry: https://registry.npm.taobao.org/}
|
||||
|
||||
/@types/normalize-package-data/2.4.1:
|
||||
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
|
||||
@@ -927,22 +921,12 @@ packages:
|
||||
'@types/node': 17.0.43
|
||||
dev: true
|
||||
|
||||
/@types/three/0.144.0:
|
||||
resolution: {integrity: sha512-psvEs6q5rLN50jUYZ3D4pZMfxTbdt3A243blt0my7/NcL6chaCZpHe2csbCtx0SOD9fI/XnF3wnVUAYZGqCSYg==}
|
||||
dependencies:
|
||||
'@types/webxr': 0.5.0
|
||||
dev: true
|
||||
|
||||
/@types/through/0.0.30:
|
||||
resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==}
|
||||
dependencies:
|
||||
'@types/node': 17.0.43
|
||||
dev: true
|
||||
|
||||
/@types/webxr/0.5.0:
|
||||
resolution: {integrity: sha512-IUMDPSXnYIbEO2IereEFcgcqfDREOgmbGqtrMpVPpACTU6pltYLwHgVkrnYv0XhWEcjio9sYEfIEzgn3c7nDqA==}
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/eslint-plugin/5.28.0_evi7yu7wunhzwb24olrfvzynny:
|
||||
resolution: {integrity: sha512-DXVU6Cg29H2M6EybqSg2A+x8DgO9TCUBRp4QEXQHJceLS7ogVDP0g3Lkg/SZCqcvkAP/RruuQqK0gdlkgmhSUA==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
@@ -1900,7 +1884,7 @@ packages:
|
||||
dev: true
|
||||
|
||||
/csstype/2.6.20:
|
||||
resolution: {integrity: sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/csstype/-/csstype-2.6.20.tgz}
|
||||
resolution: {integrity: sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==, registry: https://registry.npm.taobao.org/}
|
||||
dev: false
|
||||
|
||||
/csstype/3.0.11:
|
||||
@@ -2107,7 +2091,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
/echarts-wordcloud/2.0.0_echarts@5.3.3:
|
||||
resolution: {integrity: sha512-K7l6pTklqdW7ZWzT/1CS0KhBSINr/cd7c5N1fVMzZMwLQHEwT7x+nivK7g5hkVh7WNcAv4Dn6/ZS5zMKRozC1g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/echarts-wordcloud/-/echarts-wordcloud-2.0.0.tgz}
|
||||
resolution: {integrity: sha512-K7l6pTklqdW7ZWzT/1CS0KhBSINr/cd7c5N1fVMzZMwLQHEwT7x+nivK7g5hkVh7WNcAv4Dn6/ZS5zMKRozC1g==, registry: https://registry.npm.taobao.org/}
|
||||
peerDependencies:
|
||||
echarts: ^5.0.1
|
||||
dependencies:
|
||||
@@ -3048,10 +3032,6 @@ packages:
|
||||
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
|
||||
dev: true
|
||||
|
||||
/gsap/3.11.3:
|
||||
resolution: {integrity: sha512-xc/iIJy+LWiMbRa4IdMtdnnKa/7PXEK6NNzV71gdOYUVeTZN7UWnLU0fB7Hi1iwiz4ZZoYkBZPPYGg+2+zzFHA==}
|
||||
dev: false
|
||||
|
||||
/handlebars/4.7.7:
|
||||
resolution: {integrity: sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==}
|
||||
engines: {node: '>=0.4.7'}
|
||||
@@ -4845,10 +4825,6 @@ packages:
|
||||
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
|
||||
dev: true
|
||||
|
||||
/three/0.145.0:
|
||||
resolution: {integrity: sha512-EKoHQEtEJ4CB6b2BGMBgLZrfwLjXcSUfoI/MiIXUuRpeYsfK5aPWbYhdtIVWOH+x6X0TouldHKHBuc/LAiFzAw==}
|
||||
dev: false
|
||||
|
||||
/through/2.3.8:
|
||||
resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==}
|
||||
dev: true
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
export enum ModuleTypeEnum {
|
||||
SYSTEM = 'sys',
|
||||
PROJECT = 'project',
|
||||
}
|
||||
import { ModuleTypeEnum } from '@/enums/httpEnum'
|
||||
|
||||
// 接口白名单(免登录)
|
||||
export const fetchAllowList = [
|
||||
@@ -1,19 +1,38 @@
|
||||
import axios, { AxiosResponse, AxiosRequestConfig } from 'axios'
|
||||
import { ResultEnum } from "@/enums/httpEnum"
|
||||
import { ErrorPageNameMap } from "@/enums/pageEnum"
|
||||
import { redirectErrorPage } from '@/utils'
|
||||
import { PageEnum, ErrorPageNameMap } from "@/enums/pageEnum"
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { axiosPre } from '@/settings/httpSetting'
|
||||
import { SystemStoreEnum, SystemStoreUserInfoEnum } from '@/store/modules/systemStore/systemStore.d'
|
||||
import { redirectErrorPage, getLocalStorage, routerTurnByName, httpErrorHandle } from '@/utils'
|
||||
import { fetchAllowList } from './axios.config'
|
||||
import includes from 'lodash/includes'
|
||||
|
||||
const axiosInstance = axios.create({
|
||||
baseURL: import.meta.env.DEV ? import.meta.env.VITE_DEV_PATH : import.meta.env.VITE_PRO_PATH,
|
||||
baseURL: `${import.meta.env.PROD ? import.meta.env.VITE_PRO_PATH : ''}${axiosPre}`,
|
||||
timeout: ResultEnum.TIMEOUT,
|
||||
})
|
||||
|
||||
axiosInstance.interceptors.request.use(
|
||||
(config: AxiosRequestConfig) => {
|
||||
// 白名单校验
|
||||
if (includes(fetchAllowList, config.url)) return config
|
||||
// 获取 token
|
||||
const info = getLocalStorage(StorageEnum.GO_SYSTEM_STORE)
|
||||
// 重新登录
|
||||
if (!info) {
|
||||
routerTurnByName(PageEnum.BASE_LOGIN_NAME)
|
||||
return config
|
||||
}
|
||||
const userInfo = info[SystemStoreEnum.USER_INFO]
|
||||
config.headers = {
|
||||
...config.headers,
|
||||
[userInfo[SystemStoreUserInfoEnum.TOKEN_NAME] || 'token']: userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || ''
|
||||
}
|
||||
return config
|
||||
},
|
||||
(error: AxiosRequestConfig) => {
|
||||
Promise.reject(error)
|
||||
(err: AxiosRequestConfig) => {
|
||||
Promise.reject(err)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -21,9 +40,27 @@ axiosInstance.interceptors.request.use(
|
||||
axiosInstance.interceptors.response.use(
|
||||
(res: AxiosResponse) => {
|
||||
const { code } = res.data as { code: number }
|
||||
if (code === ResultEnum.SUCCESS) return Promise.resolve(res.data)
|
||||
// 重定向
|
||||
if (ErrorPageNameMap.get(code)) redirectErrorPage(code)
|
||||
|
||||
// 成功
|
||||
if (code === ResultEnum.SUCCESS) {
|
||||
return Promise.resolve(res.data)
|
||||
}
|
||||
|
||||
// 登录过期
|
||||
if (code === ResultEnum.TOKEN_OVERDUE) {
|
||||
window['$message'].error(window['$t']('http.token_overdue_message'))
|
||||
routerTurnByName(PageEnum.BASE_LOGIN_NAME)
|
||||
return Promise.resolve(res.data)
|
||||
}
|
||||
|
||||
// 固定错误码重定向
|
||||
if (ErrorPageNameMap.get(code)) {
|
||||
redirectErrorPage(code)
|
||||
return Promise.resolve(res.data)
|
||||
}
|
||||
|
||||
// 提示错误
|
||||
window['$message'].error(window['$t']((res.data as any).msg))
|
||||
return Promise.resolve(res.data)
|
||||
},
|
||||
(err: AxiosResponse) => {
|
||||
|
||||
@@ -13,7 +13,7 @@ export const get = (url: string, params?: object) => {
|
||||
return axiosInstance({
|
||||
url: url,
|
||||
method: RequestHttpEnum.GET,
|
||||
params: params
|
||||
params: params,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ export const scatterBasicUrl = '/mock/scatterBasic'
|
||||
export const mapUrl = '/mock/map'
|
||||
export const wordCloudUrl = '/mock/wordCloud'
|
||||
export const treemapUrl = '/mock/treemap'
|
||||
export const threeEarth01Url = '/mock/threeEarth01Data'
|
||||
|
||||
const mockObject: MockMethod[] = [
|
||||
{
|
||||
@@ -92,11 +91,6 @@ const mockObject: MockMethod[] = [
|
||||
method: RequestHttpEnum.GET,
|
||||
response: () => test.fetchTreemap
|
||||
},
|
||||
{
|
||||
url: threeEarth01Url,
|
||||
method: RequestHttpEnum.GET,
|
||||
response: () => test.threeEarth01Data
|
||||
},
|
||||
]
|
||||
|
||||
export default mockObject
|
||||
|
||||
@@ -254,21 +254,4 @@ export default {
|
||||
msg: '请求成功',
|
||||
data: tTreemapJson
|
||||
},
|
||||
// 三维地球
|
||||
threeEarth01Data: {
|
||||
code: 0,
|
||||
status: 200,
|
||||
msg: '请求成功',
|
||||
data: [
|
||||
{
|
||||
startArray: { name: '@name', N: '@integer(10, 100)', E: '@integer(10, 100)' },
|
||||
endArray: [
|
||||
{ name: '@name', N: '@integer(10, 100)', E: '@integer(10, 100)' },
|
||||
{ name: '@name', N: '@integer(10, 100)', E: '@integer(10, 100)' },
|
||||
{ name: '@name', N: '@integer(10, 100)', E: '@integer(10, 100)' },
|
||||
{ name: '@name', N: '@integer(10, 100)', E: '@integer(10, 100)' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 176 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 1.3 MiB |
@@ -1,146 +0,0 @@
|
||||
|
||||
/**
|
||||
* 后端接口,相关功能对应表:
|
||||
* 登录 - login
|
||||
* 登出 - logout
|
||||
* 预览,token 注入或单点登陆 - checkToken
|
||||
* 显示项目列表和分页 - projectList
|
||||
* 保存、发布、修改名称 - updateProject
|
||||
* 复制项目 - copyProject
|
||||
* 图表内的图片上传 - uploadFile
|
||||
* 上传图片显示处理 - getFileUrl
|
||||
* 所有接口返回格式:MyResponseType
|
||||
*/
|
||||
import { IndexDbBackend } from "./indexdb/indexdbbackend";
|
||||
// import { PythonBackend } from "./python/pythonbackend";
|
||||
|
||||
export interface MyResponseType {
|
||||
code: number; // 状态:200 表示接口调用成功,参考:HttpEnum
|
||||
msg: string; // 提示信息,配合 data 和 code
|
||||
data: any; // data = null 表示接口结果错误,错误原因放在 msg
|
||||
}
|
||||
|
||||
export class MyResponse implements MyResponseType {
|
||||
code: number = 200;
|
||||
msg: string = "";
|
||||
data: any = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* 实现 IBackend 后端接口
|
||||
* 错误处理:
|
||||
*/
|
||||
export interface IBackend {
|
||||
/**
|
||||
* 初始化后端系统,测试后端连接,oss地址等
|
||||
* @param data 可选,备用
|
||||
*/
|
||||
init(data:any):any
|
||||
|
||||
/**
|
||||
* 登陆
|
||||
* @param data {} .username .password
|
||||
* @return MyResponseType
|
||||
* .data 须包含:
|
||||
* token:{tokenValue:"", tokenName:""},
|
||||
* userinfo:{nickname:"", username: "", id: 用户ID}
|
||||
* 错误处理:
|
||||
* 1 接口错误 .code 不为 200 .msg 可选,后端反馈错误信息
|
||||
* 2 登陆错误 .code=200 .data = null, msg 可选,反馈不能登陆的原因
|
||||
* 登陆信息.data 记录:
|
||||
* setLocalStorage(GO_LOGIN_INFO_STORE, res.data)
|
||||
*/
|
||||
login(data:any):any
|
||||
|
||||
/**
|
||||
* 通知后端登出
|
||||
*/
|
||||
logout():any
|
||||
|
||||
/**
|
||||
* 检查Token是否有效,配合预览页面和单点登陆,备用
|
||||
* @param data {tokenValue, tokenName}
|
||||
* @return 同 login()
|
||||
*/
|
||||
checkToken(data:any):any
|
||||
|
||||
/**
|
||||
* 项目列表
|
||||
* @param data {} .page, .limit
|
||||
* @return [项目],字段名称需要进行 map
|
||||
* id: projectId
|
||||
* title:projectName
|
||||
* release,
|
||||
* label:remarks
|
||||
* image:indexImage 如果需要挂刷新,在这里处理。如果需要拼接 url(getFileUrl),也在这里处理好。
|
||||
*/
|
||||
projectList(data:any):any
|
||||
|
||||
/**
|
||||
* 新增项目
|
||||
* @param data
|
||||
* .projectName
|
||||
* @return id 新项目 ID
|
||||
*/
|
||||
createProject(data: any):any
|
||||
|
||||
/**
|
||||
* 获取项目
|
||||
* @param data .projectId
|
||||
* @return
|
||||
id:projectId
|
||||
projectName,
|
||||
state: release,
|
||||
remarks,
|
||||
content
|
||||
*/
|
||||
fetchProject(data: any):any
|
||||
|
||||
/**
|
||||
* 修改项目
|
||||
* @param data
|
||||
* .projectId 必须
|
||||
* .projectName 可选
|
||||
* .release 可选
|
||||
* .content 可选
|
||||
* .object File 可选 对象
|
||||
* .remarks 可选
|
||||
* @return
|
||||
*/
|
||||
updateProject(data: any):any
|
||||
|
||||
/**
|
||||
* 复制项目
|
||||
* @param data
|
||||
* .copyId 需要复制的项目ID
|
||||
* .projectName
|
||||
* @return id 新项目ID
|
||||
*/
|
||||
copyProject(data: any):any
|
||||
|
||||
/**
|
||||
* 删除项目
|
||||
* @param data
|
||||
* .projectId
|
||||
* @return
|
||||
*/
|
||||
deleteProject(data: any):any
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param file File 图片对象
|
||||
* @param params 备用 Todo: 上传文件可带上项目ID和其他附加信息,以便后端文件管理
|
||||
* @return .uri 文件对象 uri。建议在图表中保存相对地址,通过 getFileUrl 得到完整地址
|
||||
*/
|
||||
uploadFile(file: File, params: any):any
|
||||
/**
|
||||
* 文件地址转换,处理 uploadFile 的返回地址。如果是绝对地址,可以不处理
|
||||
* @param uploadUri 上传返回的 uri
|
||||
* @return 供 image.src 使用的地址信息
|
||||
*/
|
||||
getFileUrl(uploadUri:string):string
|
||||
}
|
||||
|
||||
export const BackEndFactory = new IndexDbBackend();
|
||||
// export const BackEndFactory = new MockBackend();
|
||||
// export const BackEndFactory = new PythonBackend();
|
||||
@@ -1,147 +0,0 @@
|
||||
/**
|
||||
* IndexDb 帮助类
|
||||
*/
|
||||
|
||||
const win: { [k: string]: any } = window || globalThis;
|
||||
const indexedDB =
|
||||
win.indexedDB || win.mozIndexedDB || win.webkitIndexedDB || win.msIndexedDB;
|
||||
const dbs: { [k: string]: IDBDatabase } = {};
|
||||
let databaseName: string;
|
||||
let request: IDBOpenDBRequest;
|
||||
interface AnyEvent {
|
||||
[k: string]: any;
|
||||
}
|
||||
|
||||
export interface TableOption {
|
||||
storeName: string;
|
||||
option: { [K: string]: any };
|
||||
index: { [K: string]: any }[];
|
||||
}
|
||||
|
||||
export const createDB = (
|
||||
name: string,
|
||||
version?: string,
|
||||
options?: TableOption[],
|
||||
) =>
|
||||
new Promise<IDBDatabase>((resolve, reject) => {
|
||||
if (!indexedDB) reject('浏览器不支持indexedDB');
|
||||
databaseName = name;
|
||||
if (dbs?.[name]) {
|
||||
resolve(dbs[name]);
|
||||
return;
|
||||
}
|
||||
request = indexedDB.open(name, version);
|
||||
createTable(options)?.then((db: IDBDatabase) => resolve(db));
|
||||
request.onsuccess = (event: AnyEvent) => {
|
||||
// IDBDatabase
|
||||
const db = event.target.result;
|
||||
// 缓存起来
|
||||
dbs[name] = db;
|
||||
resolve(db);
|
||||
};
|
||||
request.onerror = (event: AnyEvent) => reject(event);
|
||||
});
|
||||
|
||||
export const createTable = (options?: TableOption[]) => {
|
||||
if (!options) return;
|
||||
return new Promise<IDBDatabase>((resolve) => {
|
||||
request.onupgradeneeded = (event: AnyEvent) => {
|
||||
const db = event.target.result;
|
||||
dbs[databaseName] = db;
|
||||
for (const i in options) {
|
||||
// 判断是否存在表
|
||||
if (!db.objectStoreNames.contains(options[i].storeName)) {
|
||||
const objectStore = db.createObjectStore(
|
||||
options[i].storeName,
|
||||
options[i].option,
|
||||
);
|
||||
for (const j of options[i].index) {
|
||||
objectStore.createIndex(j.name, j.keyPath, {
|
||||
unique: j.unique,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
resolve(db);
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const getTransaction = async (name: string, version?: string) => {
|
||||
let db: IDBDatabase;
|
||||
// 先从缓存获取
|
||||
if (dbs[databaseName]) {
|
||||
db = dbs[databaseName];
|
||||
} else {
|
||||
db = await createDB(databaseName, version);
|
||||
}
|
||||
return db.transaction(name, 'readwrite');
|
||||
};
|
||||
|
||||
const getObjectStore = async (
|
||||
name: string,
|
||||
version?: string,
|
||||
): Promise<IDBObjectStore> => {
|
||||
const transaction = await getTransaction(name, version);
|
||||
return transaction.objectStore(name);
|
||||
};
|
||||
|
||||
const getStore = (name: string, type: string, data: any) =>
|
||||
new Promise<IDBDatabase>((resolve) => {
|
||||
getObjectStore(name).then((objectStore: IDBObjectStore | any) => {
|
||||
const request = objectStore[type](data);
|
||||
request.onsuccess = (event: AnyEvent) =>
|
||||
resolve(event.target.result);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
const findStore = (
|
||||
name: string,
|
||||
start: any,
|
||||
end: any,
|
||||
startInclude: any,
|
||||
endInclude: any,
|
||||
) =>
|
||||
new Promise<IDBDatabase>((resolve, reject) => {
|
||||
getObjectStore(name).then((objectStore: IDBObjectStore) => {
|
||||
const request = objectStore.openCursor(
|
||||
IDBKeyRange.bound(start, end, startInclude, endInclude),
|
||||
);
|
||||
request.onsuccess = (event: AnyEvent) =>
|
||||
resolve(event.target.result);
|
||||
request.onerror = (event: AnyEvent) => reject(event);
|
||||
});
|
||||
});
|
||||
|
||||
export interface DBSelect {
|
||||
add: (data: any) => Promise<IDBDatabase>;
|
||||
get: (data: any) => Promise<IDBDatabase>;
|
||||
getAll: () => Promise<IDBDatabase>;
|
||||
del: (data: any) => Promise<IDBDatabase>;
|
||||
clear: (data: any) => Promise<IDBDatabase>;
|
||||
put: (data: any) => Promise<IDBDatabase>;
|
||||
find: (
|
||||
start: any,
|
||||
end: any,
|
||||
startInclude: any,
|
||||
endInclude: any,
|
||||
) => Promise<IDBDatabase>;
|
||||
}
|
||||
// 获取一个store
|
||||
export const onDBSelect = async (
|
||||
name: string,
|
||||
version: string
|
||||
): Promise<DBSelect> => {
|
||||
const add = (data: any) => getStore(name, 'add', data);
|
||||
const get = (data: any) => getStore(name, 'get', data);
|
||||
const getAll = () => getStore(name, 'getAll', null);
|
||||
const del = (data: any) => getStore(name, 'delete', data);
|
||||
const clear = (data: any) => getStore(name, 'clear', data);
|
||||
const put = (data: any) => getStore(name, 'put', data);
|
||||
const find = (start: any, end: any, startInclude: any, endInclude: any) =>
|
||||
findStore(name, start, end, startInclude, endInclude);
|
||||
const options: DBSelect = { add, get, getAll, clear, del, put, find };
|
||||
getObjectStore(name, version);
|
||||
return options;
|
||||
};
|
||||
@@ -1,155 +0,0 @@
|
||||
import { MyResponse, IBackend } from '../ibackend'
|
||||
import { createDB, DBSelect, onDBSelect } from '../indexdb/indexdb'
|
||||
import { fileToUrl, fileToBlob } from "@/utils"
|
||||
|
||||
const PROJECT_TABLE = "project"
|
||||
const IMAGE_TABLE = "image" // 保存图片,未实现,Todo
|
||||
const DB_NAME = "goview"
|
||||
const DB_VER = "1"
|
||||
|
||||
export class IndexDbBackend implements IBackend {
|
||||
public async init(data: any) {
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
const db:IDBDatabase = await createDB(DB_NAME, DB_VER, [
|
||||
{
|
||||
storeName: PROJECT_TABLE,
|
||||
option: {
|
||||
keyPath: "projectId", autoIncrement:true
|
||||
},
|
||||
index: [
|
||||
{name: 'projectId', keyPath: "projectId", unique: true},
|
||||
{name: 'projectName', keyPath: "projectName", unique: false},
|
||||
{name: 'release', keyPath: "release", unique: false},
|
||||
{name: 'remarks', keyPath: "remarks", unique: false},
|
||||
{name: 'content', keyPath: "content", unique: false},
|
||||
{name: 'indexImage', keyPath: "indexImage", unique: false}
|
||||
]
|
||||
}
|
||||
])
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async login(data:any) {
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
if(data.password == "123456" && data.username == "admin"){
|
||||
rtn.data = {
|
||||
token:{tokenValue:"mockToken", tokenName:"name"},
|
||||
userinfo:{nickname:"nickname", username:data.username, id:1}
|
||||
}
|
||||
}else{
|
||||
rtn.data = null
|
||||
rtn.msg = "admin 和 123456"
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async logout() {
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async checkToken(data: any) {
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
console.log("CheckToken: " + data.token)
|
||||
rtn.data = {
|
||||
token:{tokenValue:"mockToken", tokenName:"name"},
|
||||
userinfo:{nickname:"nickname", username:data.username, id:1}
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async projectList(data:any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
const db:DBSelect = await onDBSelect(PROJECT_TABLE, DB_VER)
|
||||
const r:any = await db.getAll()
|
||||
rtn.data = []
|
||||
r.map(function (item: any) {
|
||||
let url = ""
|
||||
if(item.indexImage){
|
||||
const Url = URL || window.URL || window.webkitURL
|
||||
url = Url.createObjectURL(item.indexImage)
|
||||
}
|
||||
rtn.data.push({
|
||||
id: item.projectId,
|
||||
title: item.projectName,
|
||||
release: item.release == 1,
|
||||
label:item.remarks,
|
||||
image:url
|
||||
})
|
||||
})
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async createProject(data: any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
const db:DBSelect = await onDBSelect(PROJECT_TABLE, DB_VER)
|
||||
rtn.data.id = await db.add({ projectName:data.projectName })
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async fetchProject(data: any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
const db:DBSelect = await onDBSelect(PROJECT_TABLE, DB_VER)
|
||||
const r:any = await db.get(parseInt(data.projectId))
|
||||
rtn.data = {
|
||||
id:r.projectId,
|
||||
projectName: r.projectName,
|
||||
state: r.release,
|
||||
remarks: r.remarks,
|
||||
content: r.content
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async updateProject(data: any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
const db:DBSelect = await onDBSelect(PROJECT_TABLE, DB_VER)
|
||||
const row:any = await db.get(parseInt(data.projectId))
|
||||
if("content" in data) row.content = data.content
|
||||
if("projectName" in data) row.projectName = data.projectName
|
||||
if("release" in data) row.release = data.release
|
||||
if("remarks" in data) row.remarks = data.remarks
|
||||
if("object" in data) {
|
||||
row.indexImage = await fileToBlob(data.object)
|
||||
}
|
||||
await db.put(row)
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async copyProject(data: any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
const db:DBSelect = await onDBSelect(PROJECT_TABLE, DB_VER)
|
||||
const row:any = await db.get(parseInt(data.copyId))
|
||||
rtn.data.id =await db.add({
|
||||
projectName:data.projectName,
|
||||
content:row.content,
|
||||
indexImage:row.indexImage,
|
||||
remarks:row.remarks
|
||||
})
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async deleteProject(data: any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
const db:DBSelect = await onDBSelect(PROJECT_TABLE, DB_VER)
|
||||
await db.del(parseInt(data.projectId))
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async changeProjectRelease(data: any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async uploadFile(data: File, params:any){
|
||||
// Todo: 图片可以保存在表中
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
rtn.data.uri = fileToUrl(data)
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public getFileUrl(uploadUri:string){
|
||||
return uploadUri;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
import axios, { AxiosResponse, AxiosRequestConfig } from 'axios'
|
||||
import { ResultEnum } from "@/enums/httpEnum"
|
||||
import { PageEnum, ErrorPageNameMap } from "@/enums/pageEnum"
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { axiosPre } from '@/settings/httpSetting'
|
||||
import { SystemStoreEnum, SystemStoreUserInfoEnum } from '@/store/modules/systemStore/systemStore.d'
|
||||
import { redirectErrorPage, getLocalStorage, routerTurnByName, httpErrorHandle } from '@/utils'
|
||||
import { fetchAllowList } from './axios.config'
|
||||
import includes from 'lodash/includes'
|
||||
|
||||
const axiosInstance = axios.create({
|
||||
baseURL: `${import.meta.env.PROD ? import.meta.env.VITE_PRO_PATH : ''}${axiosPre}`,
|
||||
timeout: ResultEnum.TIMEOUT,
|
||||
})
|
||||
|
||||
axiosInstance.interceptors.request.use(
|
||||
(config: AxiosRequestConfig) => {
|
||||
// 白名单校验
|
||||
if (includes(fetchAllowList, config.url)) return config
|
||||
// 获取 token
|
||||
const info = getLocalStorage(StorageEnum.GO_SYSTEM_STORE)
|
||||
// 重新登录
|
||||
if (!info) {
|
||||
routerTurnByName(PageEnum.BASE_LOGIN_NAME)
|
||||
return config
|
||||
}
|
||||
const userInfo = info[SystemStoreEnum.USER_INFO]
|
||||
config.headers = {
|
||||
...config.headers,
|
||||
[userInfo[SystemStoreUserInfoEnum.TOKEN_NAME] || 'token']: userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || ''
|
||||
}
|
||||
return config
|
||||
},
|
||||
(err: AxiosRequestConfig) => {
|
||||
Promise.reject(err)
|
||||
}
|
||||
)
|
||||
|
||||
// 响应拦截器
|
||||
axiosInstance.interceptors.response.use(
|
||||
(res: AxiosResponse) => {
|
||||
const { code } = res.data as { code: number }
|
||||
|
||||
// 成功
|
||||
if (code === ResultEnum.SUCCESS) {
|
||||
return Promise.resolve(res.data)
|
||||
}
|
||||
|
||||
// 登录过期
|
||||
if (code === ResultEnum.TOKEN_OVERDUE) {
|
||||
window['$message'].error(window['$t']('http.token_overdue_message'))
|
||||
routerTurnByName(PageEnum.BASE_LOGIN_NAME)
|
||||
return Promise.resolve(res.data)
|
||||
}
|
||||
|
||||
// 固定错误码重定向
|
||||
if (ErrorPageNameMap.get(code)) {
|
||||
redirectErrorPage(code)
|
||||
return Promise.resolve(res.data)
|
||||
}
|
||||
|
||||
// 提示错误
|
||||
window['$message'].error(window['$t']((res.data as any).msg))
|
||||
return Promise.resolve(res.data)
|
||||
},
|
||||
(err: AxiosResponse) => {
|
||||
Promise.reject(err)
|
||||
}
|
||||
)
|
||||
|
||||
export default axiosInstance
|
||||
@@ -1,226 +0,0 @@
|
||||
import axiosInstance from './axios'
|
||||
import {
|
||||
RequestHttpEnum,
|
||||
ContentTypeEnum,
|
||||
RequestBodyEnum,
|
||||
RequestDataTypeEnum,
|
||||
RequestContentTypeEnum,
|
||||
RequestParamsObjType
|
||||
} from '@/enums/httpEnum'
|
||||
import type { RequestGlobalConfigType, RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
|
||||
export const get = (url: string, params?: object) => {
|
||||
return axiosInstance({
|
||||
url: url,
|
||||
method: RequestHttpEnum.GET,
|
||||
params: params,
|
||||
})
|
||||
}
|
||||
|
||||
export const post = (url: string, data?: object, headersType?: string) => {
|
||||
return axiosInstance({
|
||||
url: url,
|
||||
method: RequestHttpEnum.POST,
|
||||
data: data,
|
||||
headers: {
|
||||
'Content-Type': headersType || ContentTypeEnum.JSON
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const patch = (url: string, data?: object, headersType?: string) => {
|
||||
return axiosInstance({
|
||||
url: url,
|
||||
method: RequestHttpEnum.PATCH,
|
||||
data: data,
|
||||
headers: {
|
||||
'Content-Type': headersType || ContentTypeEnum.JSON
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const put = (url: string, data?: object, headersType?: ContentTypeEnum) => {
|
||||
return axiosInstance({
|
||||
url: url,
|
||||
method: RequestHttpEnum.PUT,
|
||||
data: data,
|
||||
headers: {
|
||||
'Content-Type': headersType || ContentTypeEnum.JSON
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const del = (url: string, params?: object) => {
|
||||
return axiosInstance({
|
||||
url: url,
|
||||
method: RequestHttpEnum.DELETE,
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 获取请求函数,默认get
|
||||
export const http = (type?: RequestHttpEnum) => {
|
||||
switch (type) {
|
||||
case RequestHttpEnum.GET:
|
||||
return get
|
||||
|
||||
case RequestHttpEnum.POST:
|
||||
return post
|
||||
|
||||
case RequestHttpEnum.PATCH:
|
||||
return patch
|
||||
|
||||
case RequestHttpEnum.PUT:
|
||||
return put
|
||||
|
||||
case RequestHttpEnum.DELETE:
|
||||
return del
|
||||
|
||||
default:
|
||||
return get
|
||||
}
|
||||
}
|
||||
const prefix = 'javascript:'
|
||||
// 对输入字符进行转义处理
|
||||
export const translateStr = (target: string | object) => {
|
||||
if (typeof target === 'string') {
|
||||
if (target.startsWith(prefix)) {
|
||||
const funcStr = target.split(prefix)[1]
|
||||
let result;
|
||||
try {
|
||||
result = new Function(`${funcStr}`)()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
window['$message'].error('js内容解析有误!')
|
||||
}
|
||||
return result
|
||||
} else {
|
||||
return target
|
||||
}
|
||||
}
|
||||
for (const key in target) {
|
||||
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
||||
const subTarget = (target as any)[key];
|
||||
(target as any)[key] = translateStr(subTarget)
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
|
||||
/**
|
||||
* * 自定义请求
|
||||
* @param targetParams 当前组件参数
|
||||
* @param globalParams 全局参数
|
||||
*/
|
||||
export const customizeHttp = (targetParams: RequestConfigType, globalParams: RequestGlobalConfigType) => {
|
||||
if (!targetParams || !globalParams) {
|
||||
return
|
||||
}
|
||||
|
||||
// 全局
|
||||
const {
|
||||
// 全局请求源地址
|
||||
requestOriginUrl,
|
||||
// 全局请求内容
|
||||
requestParams: globalRequestParams
|
||||
} = globalParams
|
||||
|
||||
// 目标组件(优先级 > 全局组件)
|
||||
const {
|
||||
// 请求地址
|
||||
requestUrl,
|
||||
// 普通 / sql
|
||||
requestContentType,
|
||||
// 获取数据的方式
|
||||
requestDataType,
|
||||
// 请求方式 get/post/del/put/patch
|
||||
requestHttpType,
|
||||
// 请求体类型 none / form-data / x-www-form-urlencoded / json /xml
|
||||
requestParamsBodyType,
|
||||
// SQL 请求对象
|
||||
requestSQLContent,
|
||||
// 请求内容 params / cookie / header / body: 同 requestParamsBodyType
|
||||
requestParams: targetRequestParams
|
||||
} = targetParams
|
||||
|
||||
// 静态排除
|
||||
if (requestDataType === RequestDataTypeEnum.STATIC) return
|
||||
|
||||
if (!requestUrl) {
|
||||
return
|
||||
}
|
||||
|
||||
// 处理头部
|
||||
let headers: RequestParamsObjType = {
|
||||
...globalRequestParams.Header,
|
||||
...targetRequestParams.Header
|
||||
}
|
||||
headers = translateStr(headers)
|
||||
|
||||
// data 参数
|
||||
let data: RequestParamsObjType | FormData | string = {}
|
||||
// params 参数
|
||||
let params: RequestParamsObjType = { ...targetRequestParams.Params }
|
||||
params = translateStr(params)
|
||||
// form 类型处理
|
||||
let formData: FormData = new FormData()
|
||||
formData.set('default', 'defaultData')
|
||||
// 类型处理
|
||||
|
||||
switch (requestParamsBodyType) {
|
||||
case RequestBodyEnum.NONE:
|
||||
break
|
||||
|
||||
case RequestBodyEnum.JSON:
|
||||
headers['Content-Type'] = ContentTypeEnum.JSON
|
||||
data = translateStr(JSON.parse(targetRequestParams.Body['json']))
|
||||
// json 赋值给 data
|
||||
break
|
||||
|
||||
case RequestBodyEnum.XML:
|
||||
headers['Content-Type'] = ContentTypeEnum.XML
|
||||
// xml 字符串赋值给 data
|
||||
data = translateStr(targetRequestParams.Body['xml'])
|
||||
break
|
||||
|
||||
case RequestBodyEnum.X_WWW_FORM_URLENCODED: {
|
||||
headers['Content-Type'] = ContentTypeEnum.FORM_URLENCODED
|
||||
const bodyFormData = targetRequestParams.Body['x-www-form-urlencoded']
|
||||
for (const i in bodyFormData) formData.set(i, translateStr(bodyFormData[i]))
|
||||
// FormData 赋值给 data
|
||||
data = formData
|
||||
break
|
||||
}
|
||||
|
||||
case RequestBodyEnum.FORM_DATA: {
|
||||
headers['Content-Type'] = ContentTypeEnum.FORM_DATA
|
||||
const bodyFormUrlencoded = targetRequestParams.Body['form-data']
|
||||
for (const i in bodyFormUrlencoded) {
|
||||
formData.set(i, translateStr(bodyFormUrlencoded[i]))
|
||||
}
|
||||
// FormData 赋值给 data
|
||||
data = formData
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// sql 处理
|
||||
if (requestContentType === RequestContentTypeEnum.SQL) {
|
||||
headers['Content-Type'] = ContentTypeEnum.JSON
|
||||
data = requestSQLContent
|
||||
}
|
||||
|
||||
try {
|
||||
const url = (new Function("return `" + `${requestOriginUrl}${requestUrl}`.trim() + "`"))();
|
||||
return axiosInstance({
|
||||
url,
|
||||
method: requestHttpType,
|
||||
data,
|
||||
params,
|
||||
headers
|
||||
})
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
window['$message'].error('URL地址格式有误!')
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
import { MyResponse, IBackend } from './ibackend'
|
||||
import { fileToUrl } from '@/utils'
|
||||
|
||||
|
||||
/**
|
||||
* MockBackend
|
||||
* 模拟纯前端,不会保存,也不报错。
|
||||
*/
|
||||
|
||||
export class MockBackend implements IBackend {
|
||||
public async init(data: any) {
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async login(data:any) {
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
if(data.password == "123456" && data.username == "admin"){
|
||||
rtn.data = {
|
||||
token:{tokenValue:"mockToken", tokenName:"name"},
|
||||
userinfo:{nickname:"nickname", username:data.username, id:1}
|
||||
}
|
||||
}else{
|
||||
rtn.data = null
|
||||
rtn.msg = "用户名或密码错误!"
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async logout() {
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async checkToken(data:any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async projectList(data:any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
rtn.data =[
|
||||
{
|
||||
id: 1,
|
||||
title: '假数据不可用',
|
||||
release: true,
|
||||
label: '官方案例'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: '物料2-假数据不可用',
|
||||
release: false,
|
||||
label: '官方案例'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: '物料3-假数据不可用',
|
||||
release: false,
|
||||
label: '官方案例'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: '物料4-假数据不可用',
|
||||
release: false,
|
||||
label: '官方案例'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
title: '物料5-假数据不可用',
|
||||
release: false,
|
||||
label: '官方案例'
|
||||
}
|
||||
];
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async createProject(data: any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
rtn.data.id = "newId"
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async fetchProject(data: any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
rtn.data = {
|
||||
id:data.projectId,
|
||||
projectName: '假数据不可用',
|
||||
indexImage:'',
|
||||
state: 0,
|
||||
remarks: '官方案例',
|
||||
content: null
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async saveProject(data: object){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async updateProject(data: any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async copyProject(data: any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async deleteProject(data: any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async changeProjectRelease(data: any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public async uploadFile(data: File, params:any){
|
||||
let rtn:MyResponse = new MyResponse;
|
||||
rtn.data.uri = fileToUrl(data)
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public getFileUrl(uploadUri:string){
|
||||
return uploadUri;
|
||||
}
|
||||
}
|
||||
@@ -21,23 +21,6 @@
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
|
||||
<collapse-item v-if="grid" name="容器">
|
||||
<setting-item-box name="距离">
|
||||
<setting-item name="左侧距离">
|
||||
<n-input v-model:value="grid.left" size="small"></n-input>
|
||||
</setting-item>
|
||||
<setting-item name="右侧距离">
|
||||
<n-input v-model:value="grid.right" size="small"></n-input>
|
||||
</setting-item>
|
||||
<setting-item name="上侧距离">
|
||||
<n-input v-model:value="grid.top" size="small"></n-input>
|
||||
</setting-item>
|
||||
<setting-item name="下侧距离">
|
||||
<n-input v-model:value="grid.bottom" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
|
||||
<collapse-item v-if="xAxis" name="X轴">
|
||||
<template #header>
|
||||
<n-switch v-model:value="xAxis.show" size="small"></n-switch>
|
||||
@@ -68,9 +51,6 @@
|
||||
<setting-item name="大小">
|
||||
<n-input-number v-model:value="xAxis.axisLabel.fontSize" :min="8" size="small"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="偏移量">
|
||||
<n-input-number v-model:value="xAxis.axisLabel.rotate" :min="-90" :max="90" size="small"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="轴线">
|
||||
<setting-item name="展示">
|
||||
@@ -160,9 +140,6 @@
|
||||
<setting-item name="大小">
|
||||
<n-input-number v-model:value="yAxis.axisLabel.fontSize" :min="8" size="small"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="偏移量">
|
||||
<n-input-number v-model:value="yAxis.axisLabel.rotate" :min="-90" :max="90" size="small"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="轴线">
|
||||
<setting-item name="展示">
|
||||
@@ -312,10 +289,6 @@ const legend = computed(() => {
|
||||
return props.optionData.legend
|
||||
})
|
||||
|
||||
const grid = computed(() => {
|
||||
return props.optionData.grid
|
||||
})
|
||||
|
||||
const visualMap = computed(() => {
|
||||
return props.optionData.visualMap
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<setting-item-box v-if="targetData" name="位置">
|
||||
<setting-item-box name="位置">
|
||||
<setting-item :name="`偏移 X:${targetData.left || 0}px`">
|
||||
<n-input-number v-model:value="targetData.left" size="small" step="10"></n-input-number>
|
||||
</setting-item>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/**
|
||||
* @description: 请求结果集
|
||||
*/
|
||||
// 模块 Path 前缀分类
|
||||
export enum ModuleTypeEnum {
|
||||
SYSTEM = 'sys',
|
||||
PROJECT = 'project',
|
||||
}
|
||||
|
||||
// 请求结果集
|
||||
export enum ResultEnum {
|
||||
DATA_SUCCESS = 0,
|
||||
SUCCESS = 200,
|
||||
@@ -8,7 +12,7 @@ export enum ResultEnum {
|
||||
SERVER_FORBIDDEN = 403,
|
||||
NOT_FOUND = 404,
|
||||
TOKEN_OVERDUE = 886,
|
||||
TIMEOUT = 60000
|
||||
TIMEOUT = 60000,
|
||||
}
|
||||
|
||||
// 数据相关
|
||||
@@ -33,9 +37,7 @@ export enum RequestHttpHeaderEnum {
|
||||
COOKIE = 'Cookie'
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 请求方法
|
||||
*/
|
||||
// 请求方法
|
||||
export enum RequestHttpEnum {
|
||||
GET = 'get',
|
||||
POST = 'post',
|
||||
@@ -116,9 +118,7 @@ export type RequestParams = {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 常用的contentTyp类型
|
||||
*/
|
||||
// 常用的contentTyp类型
|
||||
export enum ContentTypeEnum {
|
||||
// json
|
||||
JSON = 'application/json;charset=UTF-8',
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
export enum StorageEnum {
|
||||
// 全局设置
|
||||
GO_SYSTEM_SETTING_STORE = 'GO_SYSTEM_SETTING',
|
||||
// token 等信息
|
||||
GO_ACCESS_TOKEN_STORE = 'GO_ACCESS_TOKEN',
|
||||
GO_SETTING_STORE = 'GO_SETTING',
|
||||
// 登录信息
|
||||
GO_LOGIN_INFO_STORE = 'GO_LOGIN_INFO',
|
||||
GO_SYSTEM_STORE = 'GO_SYSTEM',
|
||||
// 语言
|
||||
GO_LANG_STORE = 'GO_LANG',
|
||||
// 当前选择的主题
|
||||
|
||||
@@ -2,4 +2,4 @@ export * from '@/hooks/useTheme.hook'
|
||||
export * from '@/hooks/usePreviewScale.hook'
|
||||
export * from '@/hooks/useCode.hook'
|
||||
export * from '@/hooks/useChartDataFetch.hook'
|
||||
export * from '@/hooks/useLifeHandler.hook'
|
||||
export * from '@/hooks/useSystemInit.hook'
|
||||
@@ -59,18 +59,18 @@ export const useChartDataFetch = (
|
||||
|
||||
const fetchFn = async () => {
|
||||
const res = await customizeHttp(toRaw(targetComponent.request), toRaw(chartEditStore.requestGlobalConfig))
|
||||
if (res) {
|
||||
if (res && res.data) {
|
||||
try {
|
||||
const filter = targetComponent.filter
|
||||
// eCharts 组件配合 vChart 库更新方式
|
||||
if (chartFrame === ChartFrameEnum.ECHARTS) {
|
||||
if (vChartRef.value) {
|
||||
vChartRef.value.setOption({ dataset: newFunctionHandle(res?.data, res, filter) })
|
||||
vChartRef.value.setOption({ dataset: newFunctionHandle(res.data, filter) })
|
||||
}
|
||||
}
|
||||
// 更新回调函数
|
||||
if (updateCallback) {
|
||||
updateCallback(newFunctionHandle(res?.data, res, filter))
|
||||
updateCallback(newFunctionHandle(res.data, filter))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
@@ -90,7 +90,7 @@ export const useChartDataFetch = (
|
||||
}
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,280 +0,0 @@
|
||||
import { CreateComponentType, EventLife } from '@/packages/index.d'
|
||||
import * as echarts from 'echarts'
|
||||
import { BackEndFactory } from '@/backend/ibackend'
|
||||
import { reactive, toRef , watch, computed} from 'vue';
|
||||
|
||||
/**
|
||||
* 事件测试:
|
||||
*
|
||||
切换显示名称为 饼图 和 柱状图 的图标
|
||||
const range = runtime.fn.selectComponents("饼图 柱状图")
|
||||
const h = runtime.fn.getChartConfig(range, "hide")
|
||||
runtime.fn.setChartConfig(range, "hide", !h)
|
||||
|
||||
修改一个名称 柱状图001 组件id 2wolqibrx3c000 的图表数据,以下两句等效
|
||||
runtime.fn.setChartConfig("柱状图001", "dataset", {"dimensions":["product","data1","data2"],"source":[{"product":"Mon","data1":120,"data2":130}]})
|
||||
runtime.fn.setChartConfig("#2wolqibrx3c000", "dataset", {"dimensions":["product","data1","data2"],"source":[{"product":"Mon","data1":120,"data2":230}]})
|
||||
|
||||
找到一个组并隐藏
|
||||
const c = runtime.fn.selectOneComponent("分组")
|
||||
if(c){
|
||||
console.log(runtime.fn.getChartConfig(c, "isGroup" ))
|
||||
runtime.fn.setChartConfig(c, "hide", true)
|
||||
}
|
||||
|
||||
调用组件 exposed 函数的例子
|
||||
组件中增加: defineExpose({ actionTest:actionTest })
|
||||
以下调用名称为 柱状图 组件的 actionTest
|
||||
runtime.fn.callExposed("柱状图", "actionTest")
|
||||
|
||||
|
||||
数据驱动界面:
|
||||
图表A 的 MOUNTED 加入对 status1 的 Watch, = "0" 隐藏
|
||||
watch(()=>runtime.variables.status1, newValue => runtime.fn.setChartConfig(this, "hide", newValue == "0"))
|
||||
图表B 的 MOUNTED 也加入对 status1 的 Watch = "1" 隐藏
|
||||
watch(()=>runtime.variables.status1, newValue => runtime.fn.setChartConfig(this, "hide", newValue == "1"))
|
||||
点击事件代码,实现图表A 和 图表B 的切换显示:
|
||||
if(runtime.variables.status1 == "0"){
|
||||
runtime.variables.status1 = "1"
|
||||
} else{
|
||||
runtime.variables.status1 = "0"
|
||||
}
|
||||
|
||||
图表A 的 MOUNTED 加入对 data1 的 Watch
|
||||
watch(()=>runtime.datasets.data1,
|
||||
newValue => runtime.fn.setChartConfig(this, "dataset", newValue))
|
||||
图表B 的 MOUNTED 加入对 data1 的 Watch
|
||||
watch(()=>runtime.datasets.data1,
|
||||
newValue => runtime.fn.setChartConfig(this, "dataset", newValue))
|
||||
点击事件代码,修改datasets.data1,同时更新图表A 和 图表B 的数据 :
|
||||
runtime.datasets.data1 = {"dimensions":["product","data1","data2"],"source":[{"product":"Mon","data1":120,"data2":230}]}
|
||||
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// * 初始化
|
||||
export const useSystemInit = async () => {
|
||||
const res = await BackEndFactory.init({}) as any;
|
||||
}
|
||||
|
||||
const getOneChartConfig = (component:any, configName:string, params?:any)=>{
|
||||
let root = null
|
||||
if(component.proxy.chartConfig) root = component.proxy.chartConfig
|
||||
else if (component.proxy.groupData) root = component.proxy.groupData
|
||||
// if(!root) return null
|
||||
switch(configName){
|
||||
case "hide":
|
||||
return root.status.hide
|
||||
break;
|
||||
case "dataset":
|
||||
return root.option.dataset
|
||||
break;
|
||||
case "isGroup":
|
||||
return root.isGroup
|
||||
break;
|
||||
case "key":
|
||||
return root.key
|
||||
break;
|
||||
case "attr":
|
||||
return root.attr
|
||||
break;
|
||||
case "name":
|
||||
return root.chartConfig.title
|
||||
}
|
||||
}
|
||||
|
||||
const setOneChartConfig = (component:any, configName:string, newValue:any, params?:any)=>{
|
||||
let root = null
|
||||
if(component.proxy.chartConfig) root = component.proxy.chartConfig
|
||||
else if (component.proxy.groupData) root = component.proxy.groupData
|
||||
switch(configName){
|
||||
case "hide":
|
||||
root.status.hide = newValue
|
||||
break;
|
||||
case "dataset":
|
||||
root.option.dataset = newValue
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 选择器语法:参考 css selectors
|
||||
* 名称 组件名称,不能有空格和特殊字符(. # 引号等)
|
||||
* [name=名称] Todo
|
||||
* #id 组件编号
|
||||
* .key 组件类型 Todo
|
||||
* @param selectors
|
||||
* @returns []
|
||||
*/
|
||||
const getComponentsBySelectors = (selectors:string):any[]=>{
|
||||
// 返回:数组,可能多个
|
||||
let rtn:any[] = []
|
||||
const ar = selectors.split(" ")
|
||||
for(let a of ar){
|
||||
rtn = rtn.concat(getComponentsBySelector(a))
|
||||
}
|
||||
return rtn
|
||||
}
|
||||
|
||||
const getComponentsBySelector = (selector:string):any[]=>{
|
||||
// 返回:数组,可能多个
|
||||
const rtn:any[] = []
|
||||
if(selector.substring(0,1) == "#")
|
||||
{
|
||||
const key = selector.substring(1)
|
||||
if(key in components){
|
||||
return [components[key]]
|
||||
}
|
||||
return rtn
|
||||
}
|
||||
for (let key in components) {
|
||||
if(getOneChartConfig(components[key], "name") == selector){
|
||||
rtn.push(components[key])
|
||||
}
|
||||
}
|
||||
return rtn
|
||||
}
|
||||
|
||||
|
||||
// 所有图表组件集合对象
|
||||
const components: { [K in string]?: any } = {}
|
||||
|
||||
const runtime = {
|
||||
// 变量,管理各种状态
|
||||
variables:reactive({}),
|
||||
// 数据集
|
||||
datasets:reactive({}),
|
||||
// 组件列表 {}
|
||||
components:components,
|
||||
// 帮助类
|
||||
fn:{
|
||||
/**
|
||||
* 选择一个组件
|
||||
* @param selectors string 选择器语法 | component | [component]
|
||||
* @return 第一个符合要求的 component 或 null
|
||||
*/
|
||||
selectOneComponent:(selectors:any)=>{
|
||||
const cList = runtime.fn.selectComponents(selectors)
|
||||
if(cList.length > 0){
|
||||
return cList[0]
|
||||
}
|
||||
return null
|
||||
},
|
||||
/**
|
||||
* 选择组件
|
||||
* @param selectors string 选择器语法 | component | [component]
|
||||
* @return 要求的 [component] 或 []
|
||||
*/
|
||||
selectComponents:(selectors:any):any[]=>{
|
||||
if(!selectors) return []
|
||||
if(typeof selectors == "string") return getComponentsBySelectors(selectors)
|
||||
if(Array.isArray(selectors)) return selectors
|
||||
return [selectors]
|
||||
},
|
||||
/**
|
||||
* 获取组件的值,如果多个,使用第一个
|
||||
* @param selectors string 选择器语法 | component | [component]
|
||||
* @param configName 配置名称
|
||||
* @param params 备用参数,可选
|
||||
* @returns 配置的值
|
||||
*/
|
||||
getChartConfig:(selectors:any, configName:string, params?:any)=>{
|
||||
const component:any = runtime.fn.selectOneComponent(selectors)
|
||||
if(!component && !component.proxy) return null
|
||||
return getOneChartConfig(component, configName, params)
|
||||
},
|
||||
/**
|
||||
* 设置组件的值,支持多个
|
||||
* @param selectors string 选择器语法 | component | [component]
|
||||
* @param configName 配置名称
|
||||
* @param newValue 新值
|
||||
* @param params 备用参数,可选
|
||||
* @returns 配置的值
|
||||
*/
|
||||
setChartConfig:(selectors:any, configName:string, newValue:any, params?:any)=>{
|
||||
const cList:any[] = runtime.fn.selectComponents(selectors)
|
||||
for(let c of cList){
|
||||
if(!c && !c.proxy) return null
|
||||
setOneChartConfig(c, configName, newValue, params)
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 调用组件暴露的函数,组件中使用 defineExpose 进行定义
|
||||
* @param selectors string 选择器语法 | component | [component]
|
||||
* @param action 组件中 defineExpose 的函数名
|
||||
* @param params 调用的参数只支持一个参数或没有参数
|
||||
* @returns 无
|
||||
*/
|
||||
callExposed:(selectors:any, action:string, params?:any)=>{
|
||||
const cList:any[] = runtime.fn.selectComponents(selectors)
|
||||
for(let c of cList){
|
||||
if(!c && !c.exposed) return null
|
||||
if(typeof c.exposed[action] == "function") c.exposed[action](params)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 项目提供的npm 包变量
|
||||
export const npmPkgs = { echarts, toRef , watch, computed, runtime }
|
||||
|
||||
export const useLifeHandler = (chartConfig: CreateComponentType) => {
|
||||
const events = chartConfig.events || {}
|
||||
console.log("chartConfig.events")
|
||||
console.log(chartConfig.events)
|
||||
// 生成生命周期事件
|
||||
let lifeEvents = {
|
||||
[EventLife.BEFORE_MOUNT](e: any) {
|
||||
// 存储组件
|
||||
components[chartConfig.id] = e.component
|
||||
const fnStr = (events[EventLife.BEFORE_MOUNT] || '').trim()
|
||||
generateFunc(fnStr, e, e.component)
|
||||
},
|
||||
[EventLife.MOUNTED](e: any) {
|
||||
const fnStr = (events[EventLife.MOUNTED] || '').trim()
|
||||
generateFunc(fnStr, e, e.component)
|
||||
}
|
||||
}
|
||||
// 遍历,按需侦听
|
||||
for(let key in EventLife)
|
||||
{
|
||||
if(key != "BEFORE_MOUNT" && key != "MOUNTED"){
|
||||
const k = EventLife[key as keyof typeof EventLife]
|
||||
const fnStr = (events[<EventLife>k] || '').trim()
|
||||
if(fnStr){
|
||||
lifeEvents[k as keyof typeof lifeEvents] = (e:any) => {
|
||||
const fnStr = (events[<EventLife>k] || '').trim()
|
||||
generateFunc(fnStr, e, components[chartConfig.id])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return lifeEvents
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fnStr 用户方法体代码
|
||||
* @param e 执行生命周期的动态组件实例
|
||||
*/
|
||||
function generateFunc(fnStr: string, e: any, component:any) {
|
||||
if(fnStr == "") return
|
||||
try {
|
||||
// npmPkgs 便于拷贝 echarts 示例时设置option 的formatter等相关内容
|
||||
Function(`
|
||||
"use strict";
|
||||
return (
|
||||
async function(e, components, node_modules){
|
||||
const {${Object.keys(npmPkgs).join()}} = node_modules;
|
||||
${fnStr}
|
||||
}
|
||||
)`)().bind(component)(e, components, npmPkgs)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
23
src/hooks/useSystemInit.hook.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { useSystemStore } from '@/store/modules/systemStore/systemStore'
|
||||
import { SystemStoreEnum } from '@/store/modules/systemStore/systemStore.d'
|
||||
import { ResultEnum } from '@/enums/httpEnum'
|
||||
import { ossUrlApi } from '@/api/path/'
|
||||
|
||||
|
||||
// * 初始化
|
||||
export const useSystemInit = async () => {
|
||||
const systemStore = useSystemStore()
|
||||
|
||||
// 获取 OSS 信息
|
||||
const getOssUrl = async () => {
|
||||
const res = await ossUrlApi({}) as unknown as MyResponseType
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
systemStore.setItem(SystemStoreEnum.FETCH_INFO, {
|
||||
OSSUrl: res.data?.bucketURL
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 执行
|
||||
getOssUrl()
|
||||
}
|
||||
@@ -4,21 +4,17 @@ import { CreateComponentType } from '@/packages/index.d'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
import dataJson from './data.json'
|
||||
|
||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
||||
|
||||
export const seriesItem = {
|
||||
type: 'bar',
|
||||
barWidth: 15,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top',
|
||||
color: '#fff',
|
||||
fontSize: 12
|
||||
},
|
||||
barWidth: null,
|
||||
itemStyle: {
|
||||
color: null,
|
||||
borderRadius: 2
|
||||
borderRadius: 0
|
||||
}
|
||||
}
|
||||
|
||||
export const option = {
|
||||
tooltip: {
|
||||
show: true,
|
||||
@@ -28,7 +24,10 @@ export const option = {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
legend: {
|
||||
show: true
|
||||
},
|
||||
xAxis: {
|
||||
show: true,
|
||||
type: 'category'
|
||||
},
|
||||
|
||||
@@ -1,13 +1,24 @@
|
||||
<template>
|
||||
<!-- Echarts 全局设置 -->
|
||||
<!-- Echarts 全局设置 -->
|
||||
<global-setting :optionData="optionData"></global-setting>
|
||||
<CollapseItem v-for="(item, index) in seriesList" :key="index" :name="`柱状图-${index + 1}`" :expanded="true">
|
||||
<CollapseItem
|
||||
v-for="(item, index) in seriesList"
|
||||
:key="index"
|
||||
:name="`柱状图-${index + 1}`"
|
||||
:expanded="true"
|
||||
>
|
||||
<SettingItemBox name="图形">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="item.itemStyle.color"></n-color-picker>
|
||||
<n-color-picker
|
||||
size="small"
|
||||
:modes="['hex']"
|
||||
v-model:value="item.itemStyle.color"
|
||||
></n-color-picker>
|
||||
</SettingItem>
|
||||
<SettingItem>
|
||||
<n-button size="small" @click="item.itemStyle.color = null"> 恢复默认 </n-button>
|
||||
<n-button size="small" @click="item.itemStyle.color = null">
|
||||
恢复默认
|
||||
</n-button>
|
||||
</SettingItem>
|
||||
<SettingItem name="宽度">
|
||||
<n-input-number
|
||||
@@ -19,40 +30,24 @@
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
<SettingItem name="圆角">
|
||||
<n-input-number v-model:value="item.itemStyle.borderRadius" :min="0" size="small"></n-input-number>
|
||||
<n-input-number
|
||||
v-model:value="item.itemStyle.borderRadius"
|
||||
:min="0"
|
||||
size="small"
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<setting-item-box name="标签">
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-switch v-model:value="item.label.show" size="small" />
|
||||
<n-text>展示标签</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<setting-item name="大小">
|
||||
<n-input-number v-model:value="item.label.fontSize" size="small" :min="1"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="item.label.color"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="位置">
|
||||
<n-select
|
||||
v-model:value="item.label.position"
|
||||
:options="[
|
||||
{ label: 'top', value: 'top' },
|
||||
{ label: 'left', value: 'left' },
|
||||
{ label: 'right', value: 'right' },
|
||||
{ label: 'bottom', value: 'bottom' }
|
||||
]"
|
||||
/>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, computed } from 'vue'
|
||||
import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import {
|
||||
GlobalSetting,
|
||||
CollapseItem,
|
||||
SettingItemBox,
|
||||
SettingItem
|
||||
} from '@/components/Pages/ChartItemSetting'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
|
||||
const props = defineProps({
|
||||
|
||||
@@ -53,21 +53,17 @@ const option = computed(() => {
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
(newData: { dimensions: any }, oldData) => {
|
||||
try {
|
||||
if (!isObject(newData) || !('dimensions' in newData)) return
|
||||
if (Array.isArray(newData?.dimensions)) {
|
||||
const seriesArr = []
|
||||
for (let i = 0; i < newData.dimensions.length - 1; i++) {
|
||||
seriesArr.push(seriesItem)
|
||||
}
|
||||
replaceMergeArr.value = ['series']
|
||||
props.chartConfig.option.series = seriesArr
|
||||
nextTick(() => {
|
||||
replaceMergeArr.value = []
|
||||
})
|
||||
if (!isObject(newData) || !('dimensions' in newData)) return
|
||||
if (newData?.dimensions.length !== oldData?.dimensions.length) {
|
||||
const seriesArr = []
|
||||
for (let i = 0; i < newData.dimensions.length - 1; i++) {
|
||||
seriesArr.push(seriesItem)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
replaceMergeArr.value = ['series']
|
||||
props.chartConfig.option.series = seriesArr
|
||||
nextTick(() => {
|
||||
replaceMergeArr.value = []
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,21 +4,17 @@ import { CreateComponentType } from '@/packages/index.d'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
import dataJson from './data.json'
|
||||
|
||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
||||
|
||||
export const seriesItem = {
|
||||
type: 'bar',
|
||||
barWidth: null,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'right',
|
||||
color: '#fff',
|
||||
fontSize: 12
|
||||
},
|
||||
itemStyle: {
|
||||
color: null,
|
||||
borderRadius: 0
|
||||
}
|
||||
}
|
||||
|
||||
export const option = {
|
||||
tooltip: {
|
||||
show: true,
|
||||
@@ -28,9 +24,12 @@ export const option = {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
show: true
|
||||
},
|
||||
xAxis: {
|
||||
show: true,
|
||||
type: 'value'
|
||||
type: 'value',
|
||||
},
|
||||
yAxis: {
|
||||
show: true,
|
||||
|
||||
@@ -26,39 +26,6 @@
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<setting-item-box name="标签">
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-switch v-model:value="item.label.show" size="small" />
|
||||
<n-text>展示标签</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<setting-item name="大小">
|
||||
<n-input-number
|
||||
v-model:value="item.label.fontSize"
|
||||
size="small"
|
||||
:min="1"
|
||||
></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker
|
||||
size="small"
|
||||
:modes="['hex']"
|
||||
v-model:value="item.label.color"
|
||||
></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="位置">
|
||||
<n-select
|
||||
v-model:value="item.label.position"
|
||||
:options="[
|
||||
{ label: 'top', value: 'top' },
|
||||
{ label: 'left', value: 'left' },
|
||||
{ label: 'right', value: 'right' },
|
||||
{ label: 'bottom', value: 'bottom' },
|
||||
]"
|
||||
/>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -52,21 +52,17 @@ const option = computed(() => {
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
(newData: { dimensions: any }, oldData) => {
|
||||
try {
|
||||
if (!isObject(newData) || !('dimensions' in newData)) return
|
||||
if (Array.isArray(newData?.dimensions)) {
|
||||
const seriesArr = []
|
||||
for (let i = 0; i < newData.dimensions.length - 1; i++) {
|
||||
seriesArr.push(seriesItem)
|
||||
}
|
||||
replaceMergeArr.value = ['series']
|
||||
props.chartConfig.option.series = seriesArr
|
||||
nextTick(() => {
|
||||
replaceMergeArr.value = []
|
||||
})
|
||||
if (!isObject(newData) || !('dimensions' in newData)) return
|
||||
if (newData?.dimensions.length !== oldData?.dimensions.length) {
|
||||
const seriesArr = []
|
||||
for (let i = 0; i < newData.dimensions.length - 1; i++) {
|
||||
seriesArr.push(seriesItem)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
replaceMergeArr.value = ['series']
|
||||
props.chartConfig.option.series = seriesArr
|
||||
nextTick(() => {
|
||||
replaceMergeArr.value = []
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,24 +4,17 @@ import { CreateComponentType } from '@/packages/index.d'
|
||||
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
||||
import dataJson from './data.json'
|
||||
|
||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
||||
|
||||
export const seriesItem = {
|
||||
type: 'line',
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top',
|
||||
color: '#fff',
|
||||
fontSize: 12
|
||||
},
|
||||
symbolSize: 5, //设定实心点的大小
|
||||
itemStyle: {
|
||||
color: null,
|
||||
borderRadius: 0
|
||||
},
|
||||
lineStyle: {
|
||||
type: 'solid',
|
||||
width: 3,
|
||||
color: null
|
||||
itemStyle: {
|
||||
color: null,
|
||||
borderRadius: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +26,9 @@ export const option = {
|
||||
type: 'line'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
show: true
|
||||
},
|
||||
xAxis: {
|
||||
show: true,
|
||||
type: 'category'
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<template>
|
||||
<!-- Echarts 全局设置 -->
|
||||
<global-setting :optionData="optionData"></global-setting>
|
||||
<CollapseItem v-for="(item, index) in seriesList" :key="index" :name="`折线图-${index + 1}`" :expanded="true">
|
||||
<CollapseItem
|
||||
v-for="(item, index) in seriesList"
|
||||
:key="index"
|
||||
:name="`折线图-${index + 1}`"
|
||||
:expanded="true"
|
||||
>
|
||||
<SettingItemBox name="线条">
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="item.lineStyle.color"></n-color-picker>
|
||||
</setting-item>
|
||||
<SettingItem name="宽度">
|
||||
<n-input-number
|
||||
v-model:value="item.lineStyle.width"
|
||||
@@ -13,48 +15,16 @@
|
||||
:max="100"
|
||||
size="small"
|
||||
placeholder="自动计算"
|
||||
></n-input-number>
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
<SettingItem name="类型">
|
||||
<n-select v-model:value="item.lineStyle.type" size="small" :options="lineConf.lineStyle.type"></n-select>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="实心点">
|
||||
<SettingItem name="大小">
|
||||
<n-input-number
|
||||
v-model:value="item.symbolSize"
|
||||
:min="1"
|
||||
:max="100"
|
||||
size="small"
|
||||
placeholder="自动计算"
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<setting-item-box name="标签">
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-switch v-model:value="item.label.show" size="small" />
|
||||
<n-text>展示标签</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<setting-item name="大小">
|
||||
<n-input-number v-model:value="item.label.fontSize" size="small" :min="1"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="item.label.color"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="位置">
|
||||
<n-select
|
||||
v-model:value="item.label.position"
|
||||
:options="[
|
||||
{ label: 'top', value: 'top' },
|
||||
{ label: 'left', value: 'left' },
|
||||
{ label: 'right', value: 'right' },
|
||||
{ label: 'bottom', value: 'bottom' }
|
||||
]"
|
||||
/>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
v-model:value="item.lineStyle.type"
|
||||
size="small"
|
||||
:options="lineConf.lineStyle.type"
|
||||
></n-select>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
@@ -62,7 +32,12 @@
|
||||
import { PropType, computed } from 'vue'
|
||||
import { lineConf } from '@/packages/chartConfiguration/echarts/index'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import {
|
||||
GlobalSetting,
|
||||
CollapseItem,
|
||||
SettingItemBox,
|
||||
SettingItem
|
||||
} from '@/components/Pages/ChartItemSetting'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
|
||||
@@ -53,21 +53,17 @@ const option = computed(() => {
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
(newData: { dimensions: any }, oldData) => {
|
||||
try {
|
||||
if (!isObject(newData) || !('dimensions' in newData)) return
|
||||
if (Array.isArray(newData?.dimensions)) {
|
||||
const seriesArr = []
|
||||
for (let i = 0; i < newData.dimensions.length - 1; i++) {
|
||||
seriesArr.push(seriesItem)
|
||||
}
|
||||
replaceMergeArr.value = ['series']
|
||||
props.chartConfig.option.series = seriesArr
|
||||
nextTick(() => {
|
||||
replaceMergeArr.value = []
|
||||
})
|
||||
if (!isObject(newData) || !('dimensions' in newData)) return
|
||||
if (newData?.dimensions.length !== oldData?.dimensions.length) {
|
||||
const seriesArr = []
|
||||
for (let i = 0; i < newData.dimensions.length - 1; i++) {
|
||||
seriesArr.push(seriesItem)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
replaceMergeArr.value = ['series']
|
||||
props.chartConfig.option.series = seriesArr
|
||||
nextTick(() => {
|
||||
replaceMergeArr.value = []
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ import { graphic } from 'echarts/core'
|
||||
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
||||
import dataJson from './data.json'
|
||||
|
||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
||||
|
||||
const options = {
|
||||
tooltip: {
|
||||
@@ -15,6 +15,9 @@ const options = {
|
||||
type: 'line'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
show: true
|
||||
},
|
||||
xAxis: {
|
||||
show: true,
|
||||
type: 'category'
|
||||
@@ -28,13 +31,6 @@ const options = {
|
||||
{
|
||||
type: 'line',
|
||||
smooth: false,
|
||||
symbolSize: 5, //设定实心点的大小
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top',
|
||||
color: '#fff',
|
||||
fontSize: 12
|
||||
},
|
||||
lineStyle: {
|
||||
type: 'solid',
|
||||
width: 3
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<template>
|
||||
<!-- Echarts 全局设置 -->
|
||||
<global-setting :optionData="optionData"></global-setting>
|
||||
<CollapseItem v-for="(item, index) in seriesList" :key="index" name="单折线面积图" :expanded="true">
|
||||
<CollapseItem
|
||||
v-for="(item, index) in seriesList"
|
||||
:key="index"
|
||||
name="单折线面积图"
|
||||
:expanded="true"
|
||||
>
|
||||
<SettingItemBox name="线条">
|
||||
<SettingItem name="宽度">
|
||||
<n-input-number
|
||||
@@ -13,45 +18,13 @@
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
<SettingItem name="类型">
|
||||
<n-select v-model:value="item.lineStyle.type" size="small" :options="lineConf.lineStyle.type"></n-select>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="实心点">
|
||||
<SettingItem name="大小">
|
||||
<n-input-number
|
||||
v-model:value="item.symbolSize"
|
||||
:min="1"
|
||||
:max="100"
|
||||
size="small"
|
||||
placeholder="自动计算"
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<setting-item-box name="标签">
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-switch v-model:value="item.label.show" size="small" />
|
||||
<n-text>展示标签</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<setting-item name="大小">
|
||||
<n-input-number v-model:value="item.label.fontSize" size="small" :min="1"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker size="small" :modes="['hex']" v-model:value="item.label.color"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="位置">
|
||||
<n-select
|
||||
v-model:value="item.label.position"
|
||||
:options="[
|
||||
{ label: 'top', value: 'top' },
|
||||
{ label: 'left', value: 'left' },
|
||||
{ label: 'right', value: 'right' },
|
||||
{ label: 'bottom', value: 'bottom' }
|
||||
]"
|
||||
/>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
v-model:value="item.lineStyle.type"
|
||||
size="small"
|
||||
:options="lineConf.lineStyle.type"
|
||||
></n-select>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
@@ -59,13 +32,18 @@
|
||||
import { PropType, computed } from 'vue'
|
||||
import { lineConf } from '@/packages/chartConfiguration/echarts/index'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import {
|
||||
GlobalSetting,
|
||||
CollapseItem,
|
||||
SettingItemBox,
|
||||
SettingItem
|
||||
} from '@/components/Pages/ChartItemSetting'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<GlobalThemeJsonType>,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
const seriesList = computed(() => {
|
||||
|
||||
@@ -43,27 +43,23 @@ const option = reactive({
|
||||
watch(
|
||||
() => chartEditStore.getEditCanvasConfig.chartThemeColor,
|
||||
(newColor: keyof typeof chartColorsSearch) => {
|
||||
try {
|
||||
if (!isPreview()) {
|
||||
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
|
||||
props.chartConfig.option.series.forEach((value: any, index: number) => {
|
||||
value.areaStyle.color = new graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{
|
||||
offset: 0,
|
||||
color: themeColor[3]
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: 'rgba(0,0,0, 0)'
|
||||
}
|
||||
])
|
||||
})
|
||||
}
|
||||
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||
props.chartConfig.option = option.value
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
if (!isPreview()) {
|
||||
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
|
||||
props.chartConfig.option.series.forEach((value: any, index: number) => {
|
||||
value.areaStyle.color = new graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{
|
||||
offset: 0,
|
||||
color: themeColor[3]
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: 'rgba(0,0,0, 0)'
|
||||
}
|
||||
])
|
||||
})
|
||||
}
|
||||
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||
props.chartConfig.option = option.value
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
@@ -74,6 +70,9 @@ watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
() => {
|
||||
option.value = props.chartConfig.option
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -5,9 +5,12 @@ import { graphic } from 'echarts/core'
|
||||
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
||||
import dataJson from './data.json'
|
||||
|
||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
||||
|
||||
const option = {
|
||||
legend: {
|
||||
show: true
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: 'axis',
|
||||
@@ -28,13 +31,6 @@ const option = {
|
||||
{
|
||||
type: 'line',
|
||||
smooth: false,
|
||||
symbolSize: 5, //设定实心点的大小
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top',
|
||||
color: '#fff',
|
||||
fontSize: 12
|
||||
},
|
||||
lineStyle: {
|
||||
width: 3,
|
||||
type: 'solid'
|
||||
@@ -56,12 +52,6 @@ const option = {
|
||||
{
|
||||
type: 'line',
|
||||
smooth: false,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top',
|
||||
color: '#fff',
|
||||
fontSize: 12
|
||||
},
|
||||
lineStyle: {
|
||||
width: 3,
|
||||
type: 'solid'
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<n-input-number
|
||||
v-model:value="item.lineStyle.width"
|
||||
:min="1"
|
||||
:max="100"
|
||||
size="small"
|
||||
placeholder="自动计算"
|
||||
></n-input-number>
|
||||
@@ -24,50 +25,6 @@
|
||||
></n-select>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="实心点">
|
||||
<SettingItem name="大小">
|
||||
<n-input-number
|
||||
v-model:value="item.symbolSize"
|
||||
:min="1"
|
||||
:max="100"
|
||||
size="small"
|
||||
placeholder="自动计算"
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<setting-item-box name="标签">
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-switch v-model:value="item.label.show" size="small" />
|
||||
<n-text>展示标签</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<setting-item name="大小">
|
||||
<n-input-number
|
||||
v-model:value="item.label.fontSize"
|
||||
size="small"
|
||||
:min="1"
|
||||
></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker
|
||||
size="small"
|
||||
:modes="['hex']"
|
||||
v-model:value="item.label.color"
|
||||
></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="位置">
|
||||
<n-select
|
||||
v-model:value="item.label.position"
|
||||
:options="[
|
||||
{ label: 'top', value: 'top' },
|
||||
{ label: 'left', value: 'left' },
|
||||
{ label: 'right', value: 'right' },
|
||||
{ label: 'bottom', value: 'bottom' },
|
||||
]"
|
||||
/>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -42,27 +42,23 @@ const option = reactive({
|
||||
watch(
|
||||
() => chartEditStore.getEditCanvasConfig.chartThemeColor,
|
||||
(newColor: keyof typeof chartColorsSearch) => {
|
||||
try {
|
||||
if (!isPreview()) {
|
||||
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
|
||||
props.chartConfig.option.series.forEach((value: any, index: number) => {
|
||||
value.areaStyle.color = new graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{
|
||||
offset: 0,
|
||||
color: themeColor[3 + index]
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: 'rgba(0,0,0, 0)'
|
||||
}
|
||||
])
|
||||
})
|
||||
}
|
||||
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||
props.chartConfig.option = option.value
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
if (!isPreview()) {
|
||||
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
|
||||
props.chartConfig.option.series.forEach((value: any, index: number) => {
|
||||
value.areaStyle.color = new graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{
|
||||
offset: 0,
|
||||
color: themeColor[3 + index]
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: 'rgba(0,0,0, 0)'
|
||||
}
|
||||
])
|
||||
})
|
||||
}
|
||||
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||
props.chartConfig.option = option.value
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
@@ -75,5 +71,6 @@ watch(
|
||||
option.value = props.chartConfig.option
|
||||
}
|
||||
)
|
||||
|
||||
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
|
||||
</script>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { CreateComponentType } from '@/packages/index.d'
|
||||
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
||||
import dataJson from './data.json'
|
||||
|
||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
||||
|
||||
export const option = {
|
||||
tooltip: {
|
||||
@@ -14,6 +14,9 @@ export const option = {
|
||||
type: 'line'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
show: true
|
||||
},
|
||||
xAxis: {
|
||||
show: true,
|
||||
type: 'category'
|
||||
@@ -26,7 +29,6 @@ export const option = {
|
||||
series: [
|
||||
{
|
||||
type: 'line',
|
||||
symbolSize: 5, //设定实心点的大小
|
||||
lineStyle: {
|
||||
type: 'solid',
|
||||
width: 3,
|
||||
|
||||
@@ -39,17 +39,6 @@
|
||||
></n-select>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="实心点">
|
||||
<SettingItem name="大小">
|
||||
<n-input-number
|
||||
v-model:value="item.symbolSize"
|
||||
:min="1"
|
||||
:max="100"
|
||||
size="small"
|
||||
placeholder="自动计算"
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="阴影" :alone="true">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
|
||||
@@ -43,21 +43,17 @@ const option = reactive({
|
||||
watch(
|
||||
() => chartEditStore.getEditCanvasConfig.chartThemeColor,
|
||||
(newColor: keyof typeof chartColorsSearch) => {
|
||||
try {
|
||||
if (!isPreview()) {
|
||||
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
|
||||
props.chartConfig.option.series.forEach((value: any) => {
|
||||
value.lineStyle.shadowColor = themeColor[2]
|
||||
value.lineStyle.color.colorStops.forEach((v: { color: string }, i: number) => {
|
||||
v.color = themeColor[i]
|
||||
})
|
||||
if (!isPreview()) {
|
||||
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
|
||||
props.chartConfig.option.series.forEach((value: any) => {
|
||||
value.lineStyle.shadowColor = themeColor[2]
|
||||
value.lineStyle.color.colorStops.forEach((v: { color: string }, i: number) => {
|
||||
v.color = themeColor[i]
|
||||
})
|
||||
}
|
||||
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||
props.chartConfig.option = option.value
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||
props.chartConfig.option = option.value
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
|
||||
@@ -64,9 +64,9 @@ registerMap(props.chartConfig.option.mapRegion.adcode, { geoJSON: {} as any, spe
|
||||
// 进行更换初始化地图 如果为china 单独处理
|
||||
const registerMapInitAsync = async () => {
|
||||
await nextTick()
|
||||
if (props.chartConfig.option.mapRegion.adcode != 'china') {
|
||||
if (props.chartConfig.option.mapRegion.adcode!="china") {
|
||||
await getGeojson(props.chartConfig.option.mapRegion.adcode)
|
||||
} else {
|
||||
}else{
|
||||
await hainanLandsHandle(props.chartConfig.option.mapRegion.showHainanIsLands)
|
||||
}
|
||||
vEchartsSetOption()
|
||||
@@ -90,12 +90,12 @@ const dataSetHandle = async (dataset: any) => {
|
||||
isPreview() && vEchartsSetOption()
|
||||
}
|
||||
// 处理海南群岛
|
||||
const hainanLandsHandle = async (newData: boolean) => {
|
||||
const hainanLandsHandle=async(newData:boolean)=>{
|
||||
if (newData) {
|
||||
await getGeojson('china')
|
||||
} else {
|
||||
registerMap('china', { geoJSON: mapJsonWithoutHainanIsLands as any, specialAreas: {} })
|
||||
}
|
||||
await getGeojson('china')
|
||||
} else {
|
||||
registerMap('china', { geoJSON: mapJsonWithoutHainanIsLands as any, specialAreas: {} })
|
||||
}
|
||||
}
|
||||
//监听 dataset 数据发生变化
|
||||
watch(
|
||||
@@ -113,12 +113,8 @@ watch(
|
||||
watch(
|
||||
() => props.chartConfig.option.mapRegion.showHainanIsLands,
|
||||
async newData => {
|
||||
try {
|
||||
await hainanLandsHandle(newData)
|
||||
vEchartsSetOption()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
await hainanLandsHandle(newData)
|
||||
vEchartsSetOption()
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
@@ -129,16 +125,12 @@ watch(
|
||||
watch(
|
||||
() => props.chartConfig.option.mapRegion.adcode,
|
||||
async newData => {
|
||||
try {
|
||||
await getGeojson(newData)
|
||||
props.chartConfig.option.geo.map = newData
|
||||
props.chartConfig.option.series.forEach((item: any) => {
|
||||
if (item.type === 'map') item.map = newData
|
||||
})
|
||||
vEchartsSetOption()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
await getGeojson(newData)
|
||||
props.chartConfig.option.geo.map = newData
|
||||
props.chartConfig.option.series.forEach((item: any) => {
|
||||
if (item.type === 'map') item.map = newData
|
||||
})
|
||||
vEchartsSetOption()
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
|
||||
@@ -4,7 +4,7 @@ import { CreateComponentType } from '@/packages/index.d'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import dataJson from './data.json'
|
||||
|
||||
export const includes = ['xAxis', 'yAxis', 'grid']
|
||||
export const includes = ['xAxis', 'yAxis']
|
||||
|
||||
export const option = {
|
||||
dataset: { ...dataJson },
|
||||
|
||||
@@ -75,11 +75,7 @@ const dataSetHandle = (dataset: typeof dataJson) => {
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
newData => {
|
||||
try {
|
||||
dataSetHandle(newData)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
dataSetHandle(newData)
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
|
||||
@@ -57,11 +57,7 @@ const option = shallowReactive({
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
(newData: any) => {
|
||||
try {
|
||||
option.dataset = toNumber(newData, 2)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
option.dataset = toNumber(newData, 2)
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
|
||||
@@ -57,11 +57,7 @@ const dataSetHandle = (dataset: typeof dataJson) => {
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
newData => {
|
||||
try {
|
||||
dataSetHandle(newData)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
dataSetHandle(newData)
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
|
||||
@@ -49,12 +49,8 @@ const dataSetHandle = (dataset: typeof dataJson) => {
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
newData => {
|
||||
try {
|
||||
if (!isArray(newData)) return
|
||||
dataSetHandle(newData)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
if(!isArray(newData)) return
|
||||
dataSetHandle(newData)
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
|
||||
@@ -42,27 +42,23 @@ const option = reactive({
|
||||
watch(
|
||||
() => chartEditStore.getEditCanvasConfig.chartThemeColor,
|
||||
(newColor: keyof typeof chartColorsSearch) => {
|
||||
try {
|
||||
if (!isPreview()) {
|
||||
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
|
||||
// 背景颜色
|
||||
props.chartConfig.option.series[0].backgroundStyle.color = themeColor[2]
|
||||
// 水球颜色
|
||||
props.chartConfig.option.series[0].color[0].colorStops = [
|
||||
{
|
||||
offset: 0,
|
||||
color: themeColor[0]
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: themeColor[1]
|
||||
}
|
||||
]
|
||||
}
|
||||
option.value = props.chartConfig.option
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
if (!isPreview()) {
|
||||
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
|
||||
// 背景颜色
|
||||
props.chartConfig.option.series[0].backgroundStyle.color = themeColor[2]
|
||||
// 水球颜色
|
||||
props.chartConfig.option.series[0].color[0].colorStops = [
|
||||
{
|
||||
offset: 0,
|
||||
color: themeColor[0]
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: themeColor[1]
|
||||
}
|
||||
]
|
||||
}
|
||||
option.value = props.chartConfig.option
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
@@ -79,7 +75,7 @@ const dataHandle = (newData: number | string) => {
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
newData => {
|
||||
if (!isString(newData) && !isNumber(newData)) return
|
||||
if(!isString(newData) && !isNumber(newData)) return
|
||||
props.chartConfig.option.series[0].data = [dataHandle(newData)]
|
||||
option.value = props.chartConfig.option
|
||||
},
|
||||
|
||||
@@ -48,13 +48,7 @@ const dataHandle = (newData: any) => {
|
||||
// 配置时
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
newData => {
|
||||
try {
|
||||
dataHandle(newData)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
newData => dataHandle(newData),
|
||||
{
|
||||
immediate: true,
|
||||
deep: false
|
||||
|
||||
@@ -39,19 +39,15 @@ const option = computed(() => {
|
||||
watch(
|
||||
() => props.chartConfig.option.type,
|
||||
newData => {
|
||||
try {
|
||||
if (newData === 'nomal') {
|
||||
props.chartConfig.option.series[0].radius = '70%'
|
||||
props.chartConfig.option.series[0].roseType = false
|
||||
} else if (newData === 'ring') {
|
||||
props.chartConfig.option.series[0].radius = ['40%', '65%']
|
||||
props.chartConfig.option.series[0].roseType = false
|
||||
} else {
|
||||
props.chartConfig.option.series[0].radius = '70%'
|
||||
props.chartConfig.option.series[0].roseType = true
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
if (newData === 'nomal') {
|
||||
props.chartConfig.option.series[0].radius = '70%'
|
||||
props.chartConfig.option.series[0].roseType = false
|
||||
} else if (newData === 'ring') {
|
||||
props.chartConfig.option.series[0].radius = ['40%', '65%']
|
||||
props.chartConfig.option.series[0].roseType = false
|
||||
} else {
|
||||
props.chartConfig.option.series[0].radius = '70%'
|
||||
props.chartConfig.option.series[0].roseType = true
|
||||
}
|
||||
},
|
||||
{ deep: false, immediate: true }
|
||||
|
||||
@@ -4,7 +4,7 @@ import { CreateComponentType } from '@/packages/index.d'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
import dataJson from './data.json'
|
||||
|
||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
||||
|
||||
export const seriesItem = {
|
||||
type: 'scatter',
|
||||
|
||||
@@ -69,21 +69,17 @@ const option = computed(() => {
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
(newData, oldData) => {
|
||||
try {
|
||||
if (!isArray(newData)) return
|
||||
if (Array.isArray(newData)) {
|
||||
replaceMergeArr.value = ['series']
|
||||
// eslint-disable-next-line vue/no-mutating-props
|
||||
props.chartConfig.option.series = newData.map((item: { dimensions: any[] }, index: number) => ({
|
||||
...seriesItem,
|
||||
datasetIndex: index
|
||||
}))
|
||||
nextTick(() => {
|
||||
replaceMergeArr.value = []
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
if (!isArray(newData)) return
|
||||
if (newData?.length !== oldData?.length) {
|
||||
replaceMergeArr.value = ['series']
|
||||
// eslint-disable-next-line vue/no-mutating-props
|
||||
props.chartConfig.option.series = newData.map((item: { dimensions: any[] }, index: number) => ({
|
||||
...seriesItem,
|
||||
datasetIndex: index
|
||||
}))
|
||||
nextTick(() => {
|
||||
replaceMergeArr.value = []
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ import { CreateComponentType } from '@/packages/index.d'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
import dataJson from './data.json'
|
||||
|
||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
||||
|
||||
export const option = {
|
||||
dataset: dataJson,
|
||||
|
||||
@@ -133,14 +133,10 @@ const renderCountdown: CountdownProps['render'] = ({ hours, minutes, seconds })
|
||||
}
|
||||
|
||||
const updateTotalDuration = () => {
|
||||
try {
|
||||
countdownActive.value = false
|
||||
totalDuration.value = useEndDate.value ? endDate.value - new Date().getTime() : dataset.value * 1000
|
||||
countdownRef.value?.reset && countdownRef.value?.reset()
|
||||
countdownActive.value = true
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
countdownActive.value = false
|
||||
totalDuration.value = useEndDate.value ? endDate.value - new Date().getTime() : dataset.value * 1000
|
||||
countdownRef.value?.reset && countdownRef.value?.reset()
|
||||
countdownActive.value = true
|
||||
}
|
||||
|
||||
watch(
|
||||
|
||||
@@ -60,11 +60,7 @@ const updateDatasetHandler = (newVal: string | number) => {
|
||||
watch(
|
||||
() => props.chartConfig.option,
|
||||
newVal => {
|
||||
try {
|
||||
updateDatasetHandler((newVal as OptionType).dataset)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
updateDatasetHandler((newVal as OptionType).dataset)
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
|
||||
@@ -11,23 +11,23 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, toRefs, ref, reactive, watch, onMounted, onUnmounted } from 'vue'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { useChartDataFetch } from '@/hooks'
|
||||
import { PropType, toRefs, ref, reactive, watch, onMounted, onUnmounted } from "vue";
|
||||
import { CreateComponentType } from "@/packages/index.d";
|
||||
import { useChartEditStore } from "@/store/modules/chartEditStore/chartEditStore";
|
||||
import { useChartDataFetch } from "@/hooks";
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
type: Object as PropType<CreateComponentType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
let yearMonthDay = ref('2021-2-3')
|
||||
let nowData = ref('08:00:00')
|
||||
let newData = ref('2021-2-3 08:00:00')
|
||||
let boxShadow = ref('none')
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
let yearMonthDay = ref("2021-2-3");
|
||||
let nowData = ref("08:00:00");
|
||||
let newData = ref("2021-2-3 08:00:00");
|
||||
let boxShadow = ref("none");
|
||||
|
||||
const { w, h } = toRefs(props.chartConfig.attr)
|
||||
const { w, h } = toRefs(props.chartConfig.attr);
|
||||
|
||||
let {
|
||||
timeColor,
|
||||
@@ -39,55 +39,54 @@ let {
|
||||
hShadow,
|
||||
vShadow,
|
||||
blurShadow,
|
||||
colorShadow
|
||||
} = toRefs(props.chartConfig.option)
|
||||
colorShadow,
|
||||
} = toRefs(props.chartConfig.option);
|
||||
|
||||
watch(
|
||||
props.chartConfig.option,
|
||||
() => {
|
||||
try {
|
||||
if (props.chartConfig.option.showShadow) {
|
||||
boxShadow.value = `${props.chartConfig.option.hShadow}px ${props.chartConfig.option.vShadow}px ${props.chartConfig.option.blurShadow}px ${props.chartConfig.option.colorShadow}`
|
||||
} else {
|
||||
boxShadow.value = 'none'
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
if (props.chartConfig.option.showShadow) {
|
||||
boxShadow.value = `${props.chartConfig.option.hShadow}px ${props.chartConfig.option.vShadow}px ${props.chartConfig.option.blurShadow}px ${props.chartConfig.option.colorShadow}`;
|
||||
} else {
|
||||
boxShadow.value = "none";
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
immediate: true,
|
||||
}
|
||||
)
|
||||
);
|
||||
onMounted(() => {
|
||||
const timer = setInterval(() => {
|
||||
var datetime = new Date()
|
||||
var year = datetime.getFullYear()
|
||||
var month = datetime.getMonth() + 1 < 10 ? '0' + (datetime.getMonth() + 1) : datetime.getMonth() + 1
|
||||
var date = datetime.getDate() < 10 ? '0' + datetime.getDate() : datetime.getDate()
|
||||
var hh = datetime.getHours() // 时
|
||||
var mm = datetime.getMinutes() // 分
|
||||
var ss = datetime.getSeconds() // 分
|
||||
let time = ''
|
||||
if (hh < 10) time += '0'
|
||||
time += hh + ':'
|
||||
if (mm < 10) time += '0'
|
||||
time += mm + ':'
|
||||
if (ss < 10) time += '0'
|
||||
time += ss
|
||||
yearMonthDay.value = `${year}-${month}-${date}`
|
||||
nowData.value = time
|
||||
newData.value = yearMonthDay.value + ' ' + nowData.value
|
||||
}, 500)
|
||||
})
|
||||
var datetime = new Date();
|
||||
var year = datetime.getFullYear();
|
||||
var month =
|
||||
datetime.getMonth() + 1 < 10
|
||||
? "0" + (datetime.getMonth() + 1)
|
||||
: datetime.getMonth() + 1;
|
||||
var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
|
||||
var hh = datetime.getHours(); // 时
|
||||
var mm = datetime.getMinutes(); // 分
|
||||
var ss = datetime.getSeconds(); // 分
|
||||
let time = "";
|
||||
if (hh < 10) time += "0";
|
||||
time += hh + ":";
|
||||
if (mm < 10) time += "0";
|
||||
time += mm + ":";
|
||||
if (ss < 10) time += "0";
|
||||
time += ss;
|
||||
yearMonthDay.value = `${year}-${month}-${date}`;
|
||||
nowData.value = time;
|
||||
newData.value = yearMonthDay.value + " " + nowData.value;
|
||||
}, 500);
|
||||
});
|
||||
onUnmounted(() => {
|
||||
clearInterval()
|
||||
})
|
||||
useChartDataFetch(props.chartConfig, useChartEditStore)
|
||||
clearInterval();
|
||||
});
|
||||
useChartDataFetch(props.chartConfig, useChartEditStore);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@include go('decorates-number') {
|
||||
@include go("decorates-number") {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,236 +0,0 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
import {
|
||||
ArcCurve,
|
||||
BufferAttribute,
|
||||
BufferGeometry,
|
||||
Color,
|
||||
Line,
|
||||
LineBasicMaterial,
|
||||
Points,
|
||||
PointsMaterial,
|
||||
Quaternion,
|
||||
Vector3
|
||||
} from 'three'
|
||||
import { lon2xyz } from './common'
|
||||
|
||||
/*
|
||||
* 绘制一条圆弧飞线
|
||||
* 5个参数含义:( 飞线圆弧轨迹半径, 开始角度, 结束角度)
|
||||
*/
|
||||
function createFlyLine(radius, startAngle, endAngle, color) {
|
||||
const geometry = new BufferGeometry() //声明一个几何体对象BufferGeometry
|
||||
// ArcCurve创建圆弧曲线
|
||||
const arc = new ArcCurve(0, 0, radius, startAngle, endAngle, false)
|
||||
//getSpacedPoints是基类Curve的方法,返回一个vector2对象作为元素组成的数组
|
||||
const pointsArr = arc.getSpacedPoints(100) //分段数80,返回81个顶点
|
||||
geometry.setFromPoints(pointsArr) // setFromPoints方法从pointsArr中提取数据改变几何体的顶点属性vertices
|
||||
// 每个顶点对应一个百分比数据attributes.percent 用于控制点的渲染大小
|
||||
const percentArr = [] //attributes.percent的数据
|
||||
for (let i = 0; i < pointsArr.length; i++) {
|
||||
percentArr.push(i / pointsArr.length)
|
||||
}
|
||||
const percentAttribue = new BufferAttribute(new Float32Array(percentArr), 1)
|
||||
// 通过顶点数据percent点模型从大到小变化,产生小蝌蚪形状飞线
|
||||
geometry.attributes.percent = percentAttribue
|
||||
// 批量计算所有顶点颜色数据
|
||||
const colorArr = []
|
||||
for (let i = 0; i < pointsArr.length; i++) {
|
||||
const color1 = new Color(0xec8f43) //轨迹线颜色 青色
|
||||
const color2 = new Color(0xf3ae76) //黄色
|
||||
const color = color1.lerp(color2, i / pointsArr.length)
|
||||
colorArr.push(color.r, color.g, color.b)
|
||||
}
|
||||
// 设置几何体顶点颜色数据
|
||||
geometry.attributes.color = new BufferAttribute(new Float32Array(colorArr), 3)
|
||||
const size = 1.3
|
||||
// 点模型渲染几何体每个顶点
|
||||
const material = new PointsMaterial({
|
||||
size, //点大小
|
||||
// vertexColors: VertexColors, //使用顶点颜色渲染
|
||||
transparent: true,
|
||||
depthWrite: false
|
||||
})
|
||||
// 修改点材质的着色器源码(注意:不同版本细节可能会稍微会有区别,不过整体思路是一样的)
|
||||
material.onBeforeCompile = function (shader) {
|
||||
// 顶点着色器中声明一个attribute变量:百分比
|
||||
shader.vertexShader = shader.vertexShader.replace(
|
||||
'void main() {',
|
||||
[
|
||||
'attribute float percent;', //顶点大小百分比变量,控制点渲染大小
|
||||
'void main() {'
|
||||
].join('\n') // .join()把数组元素合成字符串
|
||||
)
|
||||
// 调整点渲染大小计算方式
|
||||
shader.vertexShader = shader.vertexShader.replace(
|
||||
'gl_PointSize = size;',
|
||||
['gl_PointSize = percent * size;'].join('\n') // .join()把数组元素合成字符串
|
||||
)
|
||||
}
|
||||
const FlyLine = new Points(geometry, material)
|
||||
material.color = new Color(color)
|
||||
FlyLine.name = '飞行线'
|
||||
|
||||
return FlyLine
|
||||
}
|
||||
|
||||
/**输入地球上任意两点的经纬度坐标,通过函数flyArc可以绘制一个飞线圆弧轨迹
|
||||
* lon1,lat1:轨迹线起点经纬度坐标
|
||||
* lon2,lat2:轨迹线结束点经纬度坐标
|
||||
*/
|
||||
function flyArc(radius, lon1, lat1, lon2, lat2, options) {
|
||||
const sphereCoord1 = lon2xyz(radius, lon1, lat1) //经纬度坐标转球面坐标
|
||||
// startSphereCoord:轨迹线起点球面坐标
|
||||
const startSphereCoord = new Vector3(sphereCoord1.x, sphereCoord1.y, sphereCoord1.z)
|
||||
const sphereCoord2 = lon2xyz(radius, lon2, lat2)
|
||||
// startSphereCoord:轨迹线结束点球面坐标
|
||||
const endSphereCoord = new Vector3(sphereCoord2.x, sphereCoord2.y, sphereCoord2.z)
|
||||
|
||||
//计算绘制圆弧需要的关于y轴对称的起点、结束点和旋转四元数
|
||||
const startEndQua = _3Dto2D(startSphereCoord, endSphereCoord)
|
||||
// 调用arcXOY函数绘制一条圆弧飞线轨迹
|
||||
const arcline = arcXOY(radius, startEndQua.startPoint, startEndQua.endPoint, options)
|
||||
arcline.quaternion.multiply(startEndQua.quaternion)
|
||||
return arcline
|
||||
}
|
||||
/*
|
||||
* 把3D球面上任意的两个飞线起点和结束点绕球心旋转到到XOY平面上,
|
||||
* 同时保持关于y轴对称,借助旋转得到的新起点和新结束点绘制
|
||||
* 一个圆弧,最后把绘制的圆弧反向旋转到原来的起点和结束点即可
|
||||
*/
|
||||
function _3Dto2D(startSphere, endSphere) {
|
||||
/*计算第一次旋转的四元数:表示从一个平面如何旋转到另一个平面*/
|
||||
const origin = new Vector3(0, 0, 0) //球心坐标
|
||||
const startDir = startSphere.clone().sub(origin) //飞线起点与球心构成方向向量
|
||||
const endDir = endSphere.clone().sub(origin) //飞线结束点与球心构成方向向量
|
||||
// dir1和dir2构成一个三角形,.cross()叉乘计算该三角形法线normal
|
||||
const normal = startDir.clone().cross(endDir).normalize()
|
||||
const xoyNormal = new Vector3(0, 0, 1) //XOY平面的法线
|
||||
//.setFromUnitVectors()计算从normal向量旋转达到xoyNormal向量所需要的四元数
|
||||
// quaternion表示把球面飞线旋转到XOY平面上需要的四元数
|
||||
const quaternion3D_XOY = new Quaternion().setFromUnitVectors(normal, xoyNormal)
|
||||
/*第一次旋转:飞线起点、结束点从3D空间第一次旋转到XOY平面*/
|
||||
const startSphereXOY = startSphere.clone().applyQuaternion(quaternion3D_XOY)
|
||||
const endSphereXOY = endSphere.clone().applyQuaternion(quaternion3D_XOY)
|
||||
|
||||
/*计算第二次旋转的四元数*/
|
||||
// middleV3:startSphereXOY和endSphereXOY的中点
|
||||
const middleV3 = startSphereXOY.clone().add(endSphereXOY).multiplyScalar(0.5)
|
||||
const midDir = middleV3.clone().sub(origin).normalize() // 旋转前向量midDir,中点middleV3和球心构成的方向向量
|
||||
const yDir = new Vector3(0, 1, 0) // 旋转后向量yDir,即y轴
|
||||
// .setFromUnitVectors()计算从midDir向量旋转达到yDir向量所需要的四元数
|
||||
// quaternion2表示让第一次旋转到XOY平面的起点和结束点关于y轴对称需要的四元数
|
||||
const quaternionXOY_Y = new Quaternion().setFromUnitVectors(midDir, yDir)
|
||||
|
||||
/*第二次旋转:使旋转到XOY平面的点再次旋转,实现关于Y轴对称*/
|
||||
const startSpherXOY_Y = startSphereXOY.clone().applyQuaternion(quaternionXOY_Y)
|
||||
const endSphereXOY_Y = endSphereXOY.clone().applyQuaternion(quaternionXOY_Y)
|
||||
|
||||
/**一个四元数表示一个旋转过程
|
||||
*.invert()方法表示四元数的逆,简单说就是把旋转过程倒过来
|
||||
* 两次旋转的四元数执行.invert()求逆,然后执行.multiply()相乘
|
||||
*新版本.invert()对应旧版本.invert()
|
||||
*/
|
||||
const quaternionInverse = quaternion3D_XOY.clone().invert().multiply(quaternionXOY_Y.clone().invert())
|
||||
return {
|
||||
// 返回两次旋转四元数的逆四元数
|
||||
quaternion: quaternionInverse,
|
||||
// 范围两次旋转后在XOY平面上关于y轴对称的圆弧起点和结束点坐标
|
||||
startPoint: startSpherXOY_Y,
|
||||
endPoint: endSphereXOY_Y
|
||||
}
|
||||
}
|
||||
/**通过函数arcXOY()可以在XOY平面上绘制一个关于y轴对称的圆弧曲线
|
||||
* startPoint, endPoint:表示圆弧曲线的起点和结束点坐标值,起点和结束点关于y轴对称
|
||||
* 同时在圆弧轨迹的基础上绘制一段飞线*/
|
||||
function arcXOY(radius, startPoint, endPoint, options) {
|
||||
// 计算两点的中点
|
||||
const middleV3 = new Vector3().addVectors(startPoint, endPoint).multiplyScalar(0.5)
|
||||
// 弦垂线的方向dir(弦的中点和圆心构成的向量)
|
||||
const dir = middleV3.clone().normalize()
|
||||
// 计算球面飞线的起点、结束点和球心构成夹角的弧度值
|
||||
const earthRadianAngle = radianAOB(startPoint, endPoint, new Vector3(0, 0, 0))
|
||||
/*设置飞线轨迹圆弧的中间点坐标
|
||||
弧度值 * radius * 0.2:表示飞线轨迹圆弧顶部距离地球球面的距离
|
||||
起点、结束点相聚越远,构成的弧线顶部距离球面越高*/
|
||||
const arcTopCoord = dir.multiplyScalar(radius + earthRadianAngle * radius * 0.2) // 黄色飞行线的高度
|
||||
//求三个点的外接圆圆心(飞线圆弧轨迹的圆心坐标)
|
||||
const flyArcCenter = threePointCenter(startPoint, endPoint, arcTopCoord)
|
||||
// 飞线圆弧轨迹半径flyArcR
|
||||
const flyArcR = Math.abs(flyArcCenter.y - arcTopCoord.y)
|
||||
/*坐标原点和飞线起点构成直线和y轴负半轴夹角弧度值
|
||||
参数分别是:飞线圆弧起点、y轴负半轴上一点、飞线圆弧圆心*/
|
||||
const flyRadianAngle = radianAOB(startPoint, new Vector3(0, -1, 0), flyArcCenter)
|
||||
const startAngle = -Math.PI / 2 + flyRadianAngle //飞线圆弧开始角度
|
||||
const endAngle = Math.PI - startAngle //飞线圆弧结束角度
|
||||
// 调用圆弧线模型的绘制函数
|
||||
const arcline = circleLine(flyArcCenter.x, flyArcCenter.y, flyArcR, startAngle, endAngle, options.color)
|
||||
// const arcline = new Group();// 不绘制轨迹线,使用 Group替换circleLine()即可
|
||||
arcline.center = flyArcCenter //飞线圆弧自定一个属性表示飞线圆弧的圆心
|
||||
arcline.topCoord = arcTopCoord //飞线圆弧自定一个属性表示飞线圆弧中间也就是顶部坐标
|
||||
|
||||
// const flyAngle = Math.PI/ 10; //飞线圆弧固定弧度
|
||||
const flyAngle = (endAngle - startAngle) / 7 //飞线圆弧的弧度和轨迹线弧度相关
|
||||
// 绘制一段飞线,圆心做坐标原点
|
||||
const flyLine = createFlyLine(flyArcR, startAngle, startAngle + flyAngle, options.flyLineColor)
|
||||
flyLine.position.y = flyArcCenter.y //平移飞线圆弧和飞线轨迹圆弧重合
|
||||
//飞线段flyLine作为飞线轨迹arcLine子对象,继承飞线轨迹平移旋转等变换
|
||||
arcline.add(flyLine)
|
||||
//飞线段运动范围startAngle~flyEndAngle
|
||||
flyLine.flyEndAngle = endAngle - startAngle - flyAngle
|
||||
flyLine.startAngle = startAngle
|
||||
// arcline.flyEndAngle:飞线段当前角度位置,这里设置了一个随机值用于演示
|
||||
flyLine.AngleZ = arcline.flyEndAngle * Math.random()
|
||||
// flyLine.rotation.z = arcline.AngleZ;
|
||||
// arcline.flyLine指向飞线段,便于设置动画是访问飞线段
|
||||
arcline.userData['flyLine'] = flyLine
|
||||
|
||||
return arcline
|
||||
}
|
||||
/*计算球面上两点和球心构成夹角的弧度值
|
||||
参数point1, point2:表示地球球面上两点坐标Vector3
|
||||
计算A、B两点和顶点O构成的AOB夹角弧度值*/
|
||||
function radianAOB(A, B, O) {
|
||||
// dir1、dir2:球面上两个点和球心构成的方向向量
|
||||
const dir1 = A.clone().sub(O).normalize()
|
||||
const dir2 = B.clone().sub(O).normalize()
|
||||
//点乘.dot()计算夹角余弦值
|
||||
const cosAngle = dir1.clone().dot(dir2)
|
||||
const radianAngle = Math.acos(cosAngle) //余弦值转夹角弧度值,通过余弦值可以计算夹角范围是0~180度
|
||||
return radianAngle
|
||||
}
|
||||
/*绘制一条圆弧曲线模型Line
|
||||
5个参数含义:(圆心横坐标, 圆心纵坐标, 飞线圆弧轨迹半径, 开始角度, 结束角度)*/
|
||||
function circleLine(x, y, r, startAngle, endAngle, color) {
|
||||
const geometry = new BufferGeometry() //声明一个几何体对象Geometry
|
||||
// ArcCurve创建圆弧曲线
|
||||
const arc = new ArcCurve(x, y, r, startAngle, endAngle, false)
|
||||
//getSpacedPoints是基类Curve的方法,返回一个vector2对象作为元素组成的数组
|
||||
const points = arc.getSpacedPoints(80) //分段数50,返回51个顶点
|
||||
geometry.setFromPoints(points) // setFromPoints方法从points中提取数据改变几何体的顶点属性vertices
|
||||
const material = new LineBasicMaterial({
|
||||
color: color || 0xd18547
|
||||
}) //线条材质
|
||||
const line = new Line(geometry, material) //线条模型对象
|
||||
return line
|
||||
}
|
||||
//求三个点的外接圆圆心,p1, p2, p3表示三个点的坐标Vector3。
|
||||
function threePointCenter(p1, p2, p3) {
|
||||
const L1 = p1.lengthSq() //p1到坐标原点距离的平方
|
||||
const L2 = p2.lengthSq()
|
||||
const L3 = p3.lengthSq()
|
||||
const x1 = p1.x,
|
||||
y1 = p1.y,
|
||||
x2 = p2.x,
|
||||
y2 = p2.y,
|
||||
x3 = p3.x,
|
||||
y3 = p3.y
|
||||
const S = x1 * y2 + x2 * y3 + x3 * y1 - x1 * y3 - x2 * y1 - x3 * y2
|
||||
const x = (L2 * y3 + L1 * y2 + L3 * y1 - L2 * y1 - L3 * y2 - L1 * y3) / S / 2
|
||||
const y = (L3 * x2 + L2 * x1 + L1 * x3 - L1 * x2 - L2 * x3 - L3 * x1) / S / 2
|
||||
// 三点外接圆圆心坐标
|
||||
const center = new Vector3(x, y, 0)
|
||||
return center
|
||||
}
|
||||
|
||||
export { arcXOY, flyArc }
|
||||
@@ -1,137 +0,0 @@
|
||||
import {
|
||||
CatmullRomCurve3,
|
||||
DoubleSide,
|
||||
Group,
|
||||
Mesh,
|
||||
MeshBasicMaterial,
|
||||
PlaneGeometry,
|
||||
Texture,
|
||||
TubeGeometry,
|
||||
Vector3
|
||||
} from 'three'
|
||||
import { punctuation } from '../world/Earth'
|
||||
|
||||
/**
|
||||
* 经纬度坐标转球面坐标
|
||||
* @param {地球半径} R
|
||||
* @param {经度(角度值)} longitude
|
||||
* @param {维度(角度值)} latitude
|
||||
*/
|
||||
export const lon2xyz = (R: number, longitude: number, latitude: number): Vector3 => {
|
||||
let lon = (longitude * Math.PI) / 180 // 转弧度值
|
||||
const lat = (latitude * Math.PI) / 180 // 转弧度值
|
||||
lon = -lon // js坐标系z坐标轴对应经度-90度,而不是90度
|
||||
|
||||
// 经纬度坐标转球面坐标计算公式
|
||||
const x = R * Math.cos(lat) * Math.cos(lon)
|
||||
const y = R * Math.sin(lat)
|
||||
const z = R * Math.cos(lat) * Math.sin(lon)
|
||||
// 返回球面坐标
|
||||
return new Vector3(x, y, z)
|
||||
}
|
||||
|
||||
// 创建波动光圈
|
||||
export const createWaveMesh = (options: { radius: number; lon: number; lat: number; textures: any }) => {
|
||||
const geometry = new PlaneGeometry(1, 1) //默认在XOY平面上
|
||||
const texture = options.textures.aperture
|
||||
|
||||
const material = new MeshBasicMaterial({
|
||||
color: 0xe99f68,
|
||||
map: texture,
|
||||
transparent: true, //使用背景透明的png贴图,注意开启透明计算
|
||||
opacity: 1.0,
|
||||
depthWrite: false //禁止写入深度缓冲区数据
|
||||
})
|
||||
const mesh = new Mesh(geometry, material)
|
||||
// 经纬度转球面坐标
|
||||
const coord = lon2xyz(options.radius * 1.001, options.lon, options.lat)
|
||||
const size = options.radius * 0.12 //矩形平面Mesh的尺寸
|
||||
mesh.scale.set(size, size, size) //设置mesh大小
|
||||
mesh.userData['size'] = size //自顶一个属性,表示mesh静态大小
|
||||
mesh.userData['scale'] = Math.random() * 1.0 //自定义属性._s表示mesh在原始大小基础上放大倍数 光圈在原来mesh.size基础上1~2倍之间变化
|
||||
mesh.position.set(coord.x, coord.y, coord.z)
|
||||
const coordVec3 = new Vector3(coord.x, coord.y, coord.z).normalize()
|
||||
const meshNormal = new Vector3(0, 0, 1)
|
||||
mesh.quaternion.setFromUnitVectors(meshNormal, coordVec3)
|
||||
return mesh
|
||||
}
|
||||
|
||||
// 创建柱状
|
||||
export const createLightPillar = (options: {
|
||||
radius: number
|
||||
lon: number
|
||||
lat: number
|
||||
index: number
|
||||
textures: Record<string, Texture>
|
||||
punctuation: punctuation
|
||||
}) => {
|
||||
const height = options.radius * 0.3
|
||||
const geometry = new PlaneGeometry(options.radius * 0.05, height)
|
||||
geometry.rotateX(Math.PI / 2)
|
||||
geometry.translate(0, 0, height / 2)
|
||||
const material = new MeshBasicMaterial({
|
||||
map: options.textures.light_column,
|
||||
color: options.index == 0 ? options.punctuation.lightColumn.startColor : options.punctuation.lightColumn.endColor,
|
||||
transparent: true,
|
||||
side: DoubleSide,
|
||||
depthWrite: false //是否对深度缓冲区有任何的影响
|
||||
})
|
||||
const mesh = new Mesh(geometry, material)
|
||||
const group = new Group()
|
||||
// 两个光柱交叉叠加
|
||||
group.add(mesh, mesh.clone().rotateZ(Math.PI / 2)) //几何体绕x轴旋转了,所以mesh旋转轴变为z
|
||||
// 经纬度转球面坐标
|
||||
const SphereCoord = lon2xyz(options.radius, options.lon, options.lat) //SphereCoord球面坐标
|
||||
group.position.set(SphereCoord.x, SphereCoord.y, SphereCoord.z) //设置mesh位置
|
||||
const coordVec3 = new Vector3(SphereCoord.x, SphereCoord.y, SphereCoord.z).normalize()
|
||||
const meshNormal = new Vector3(0, 0, 1)
|
||||
group.quaternion.setFromUnitVectors(meshNormal, coordVec3)
|
||||
return group
|
||||
}
|
||||
|
||||
// 光柱底座矩形平面
|
||||
export const createPointMesh = (options: { radius: number; lon: number; lat: number; material: MeshBasicMaterial }) => {
|
||||
const geometry = new PlaneGeometry(1, 1) //默认在XOY平面上
|
||||
const mesh = new Mesh(geometry, options.material)
|
||||
// 经纬度转球面坐标
|
||||
const coord = lon2xyz(options.radius * 1.001, options.lon, options.lat)
|
||||
const size = options.radius * 0.05 // 矩形平面Mesh的尺寸
|
||||
mesh.scale.set(size, size, size) // 设置mesh大小
|
||||
|
||||
// 设置mesh位置
|
||||
mesh.position.set(coord.x, coord.y, coord.z)
|
||||
const coordVec3 = new Vector3(coord.x, coord.y, coord.z).normalize()
|
||||
const meshNormal = new Vector3(0, 0, 1)
|
||||
mesh.quaternion.setFromUnitVectors(meshNormal, coordVec3)
|
||||
return mesh
|
||||
}
|
||||
|
||||
// 获取点
|
||||
export const getCirclePoints = (option: any) => {
|
||||
const list = []
|
||||
for (let j = 0; j < 2 * Math.PI - 0.1; j += (2 * Math.PI) / (option.number || 100)) {
|
||||
list.push([
|
||||
parseFloat((Math.cos(j) * (option.radius || 10)).toFixed(2)),
|
||||
0,
|
||||
parseFloat((Math.sin(j) * (option.radius || 10)).toFixed(2))
|
||||
])
|
||||
}
|
||||
if (option.closed) list.push(list[0])
|
||||
return list
|
||||
}
|
||||
|
||||
// 创建线
|
||||
|
||||
/**
|
||||
* 创建动态的线
|
||||
*/
|
||||
export const createAnimateLine = (option: any) => {
|
||||
// 由多个点数组构成的曲线 通常用于道路
|
||||
const l: Array<any> = []
|
||||
option.pointList.forEach((e: Array<any>) => l.push(new Vector3(e[0], e[1], e[2])))
|
||||
const curve = new CatmullRomCurve3(l) // 曲线路径
|
||||
|
||||
// 管道体
|
||||
const tubeGeometry = new TubeGeometry(curve, option.number || 50, option.radius || 1, option.radialSegments)
|
||||
return new Mesh(tubeGeometry, option.material)
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
export interface IEvents {
|
||||
resize: () => void
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
export interface IWord {
|
||||
dom: HTMLElement
|
||||
data: any
|
||||
width: number
|
||||
height: number
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
uniform vec3 glowColor;
|
||||
uniform float bias;
|
||||
uniform float power;
|
||||
uniform float time;
|
||||
varying vec3 vp;
|
||||
varying vec3 vNormal;
|
||||
varying vec3 vPositionNormal;
|
||||
uniform float scale;
|
||||
// 获取纹理
|
||||
uniform sampler2D map;
|
||||
// 纹理坐标
|
||||
varying vec2 vUv;
|
||||
|
||||
void main(void){
|
||||
float a = pow( bias + scale * abs(dot(vNormal, vPositionNormal)), power );
|
||||
if(vp.y > time && vp.y < time + 20.0) {
|
||||
float t = smoothstep(0.0, 0.8, (1.0 - abs(0.5 - (vp.y - time) / 20.0)) / 3.0 );
|
||||
gl_FragColor = mix(gl_FragColor, vec4(glowColor, 1.0), t * t );
|
||||
}
|
||||
gl_FragColor = mix(gl_FragColor, vec4( glowColor, 1.0 ), a);
|
||||
float b = 0.8;
|
||||
gl_FragColor = gl_FragColor + texture2D( map, vUv );
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
varying vec2 vUv;
|
||||
varying vec3 vNormal;
|
||||
varying vec3 vp;
|
||||
varying vec3 vPositionNormal;
|
||||
void main(void){
|
||||
vUv = uv;
|
||||
vNormal = normalize( normalMatrix * normal ); // 转换到视图空间
|
||||
vp = position;
|
||||
vPositionNormal = normalize(( modelViewMatrix * vec4(position, 1.0) ).xyz);
|
||||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* 资源文件
|
||||
* 把模型和图片分开进行加载
|
||||
*/
|
||||
|
||||
interface ITextures {
|
||||
name: string
|
||||
url: string
|
||||
}
|
||||
|
||||
export interface IResources {
|
||||
textures?: ITextures[]
|
||||
}
|
||||
|
||||
const fileSuffix = ['earth', 'gradient', 'redCircle', 'label', 'aperture', 'glow', 'light_column', 'aircraft']
|
||||
const textures: ITextures[] = []
|
||||
|
||||
const modules = import.meta.globEager("../../images/earth/*");
|
||||
|
||||
for(let item in modules) {
|
||||
const n = item.split('/').pop()
|
||||
if(n) {
|
||||
textures.push({
|
||||
name: n.split('.')[0],
|
||||
url: modules[item].default
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const resources: IResources = {
|
||||
textures
|
||||
}
|
||||
|
||||
export { resources }
|
||||
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* 创建 threejs 四大天王
|
||||
* 场景、相机、渲染器、控制器
|
||||
*/
|
||||
|
||||
import * as THREE from 'three'
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
|
||||
|
||||
export class Basic {
|
||||
public scene!: THREE.Scene
|
||||
public camera!: THREE.PerspectiveCamera
|
||||
public renderer!: THREE.WebGLRenderer
|
||||
public controls!: OrbitControls
|
||||
public dom: HTMLElement
|
||||
|
||||
constructor(dom: HTMLElement) {
|
||||
this.dom = dom
|
||||
this.initScenes()
|
||||
this.setControls()
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化场景
|
||||
*/
|
||||
initScenes() {
|
||||
this.scene = new THREE.Scene()
|
||||
|
||||
this.camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 100000)
|
||||
this.camera.position.set(0, 30, -250)
|
||||
|
||||
this.renderer = new THREE.WebGLRenderer({
|
||||
// canvas: this.dom,
|
||||
alpha: true, // 透明
|
||||
antialias: true // 抗锯齿
|
||||
})
|
||||
this.renderer.setPixelRatio(window.devicePixelRatio) // 设置屏幕像素比
|
||||
this.renderer.setSize(window.innerWidth, window.innerHeight) // 设置渲染器宽高
|
||||
this.dom.appendChild(this.renderer.domElement) // 添加到dom中
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置控制器
|
||||
*/
|
||||
setControls() {
|
||||
// 鼠标控制 相机,渲染dom
|
||||
this.controls = new OrbitControls(this.camera, this.renderer.domElement)
|
||||
|
||||
this.controls.autoRotateSpeed = 3
|
||||
// 使动画循环使用时阻尼或自转 意思是否有惯性
|
||||
this.controls.enableDamping = true
|
||||
// 动态阻尼系数 就是鼠标拖拽旋转灵敏度
|
||||
this.controls.dampingFactor = 0.05
|
||||
// 是否可以缩放
|
||||
this.controls.enableZoom = true
|
||||
// 设置相机距离原点的最远距离
|
||||
this.controls.minDistance = 100
|
||||
// 设置相机距离原点的最远距离
|
||||
this.controls.maxDistance = 300
|
||||
// 是否开启右键拖拽
|
||||
this.controls.enablePan = false
|
||||
}
|
||||
}
|
||||
@@ -1,496 +0,0 @@
|
||||
import {
|
||||
BufferAttribute,
|
||||
BufferGeometry,
|
||||
Color,
|
||||
DoubleSide,
|
||||
Group,
|
||||
Material,
|
||||
Mesh,
|
||||
MeshBasicMaterial,
|
||||
NormalBlending,
|
||||
Object3D,
|
||||
Points,
|
||||
PointsMaterial,
|
||||
ShaderMaterial,
|
||||
SphereGeometry,
|
||||
Sprite,
|
||||
SpriteMaterial,
|
||||
Texture,
|
||||
TextureLoader,
|
||||
Vector3
|
||||
} from 'three'
|
||||
|
||||
import {
|
||||
createAnimateLine,
|
||||
createLightPillar,
|
||||
createPointMesh,
|
||||
createWaveMesh,
|
||||
getCirclePoints,
|
||||
lon2xyz
|
||||
} from '../Utils/common'
|
||||
import gsap from 'gsap'
|
||||
import { flyArc } from '../Utils/arc'
|
||||
import earthVertex from '../shaders/earth/vertex.vs?raw'
|
||||
import earthFragment from '../shaders/earth/fragment.fs?raw'
|
||||
|
||||
export type punctuation = {
|
||||
circleColor: number
|
||||
lightColumn: {
|
||||
startColor: number // 起点颜色
|
||||
endColor: number // 终点颜色
|
||||
}
|
||||
}
|
||||
|
||||
type options = {
|
||||
data: {
|
||||
startArray: {
|
||||
name: string
|
||||
E: number // 经度
|
||||
N: number // 维度
|
||||
}
|
||||
endArray: {
|
||||
name: string
|
||||
E: number // 经度
|
||||
N: number // 维度
|
||||
}[]
|
||||
}[]
|
||||
dom: HTMLElement
|
||||
textures: Record<string, Texture> // 贴图
|
||||
earth: {
|
||||
radius: number // 地球半径
|
||||
rotateSpeed: number // 地球旋转速度
|
||||
isRotation: boolean // 地球组是否自转
|
||||
}
|
||||
satellite: {
|
||||
show: boolean // 是否显示卫星
|
||||
rotateSpeed: number // 旋转速度
|
||||
size: number // 卫星大小
|
||||
number: number // 一个圆环几个球
|
||||
}
|
||||
punctuation: punctuation
|
||||
flyLine: {
|
||||
color: number // 飞线的颜色
|
||||
speed: number // 飞机拖尾线速度
|
||||
flyLineColor: number // 飞行线的颜色
|
||||
}
|
||||
}
|
||||
type uniforms = {
|
||||
glowColor: { value: Color }
|
||||
scale: { type: string; value: number }
|
||||
bias: { type: string; value: number }
|
||||
power: { type: string; value: number }
|
||||
time: { type: string; value: any }
|
||||
isHover: { value: boolean }
|
||||
map: { value?: Texture }
|
||||
}
|
||||
|
||||
export default class earth {
|
||||
public group: Group
|
||||
public earthGroup: Group
|
||||
|
||||
public around!: BufferGeometry
|
||||
public aroundPoints!: Points<BufferGeometry, PointsMaterial>
|
||||
|
||||
public options: options
|
||||
public uniforms: uniforms
|
||||
public timeValue: number
|
||||
|
||||
public earth!: Mesh<SphereGeometry, ShaderMaterial>
|
||||
public punctuationMaterial!: MeshBasicMaterial
|
||||
public markupPoint: Group
|
||||
public waveMeshArr: Object3D[]
|
||||
|
||||
public circleLineList: any[]
|
||||
public circleList: any[]
|
||||
public x: number
|
||||
public n: number
|
||||
public isRotation: boolean
|
||||
public flyLineArcGroup!: Group
|
||||
|
||||
constructor(options: options) {
|
||||
this.options = options
|
||||
|
||||
this.group = new Group()
|
||||
this.group.name = 'group'
|
||||
this.group.scale.set(0, 0, 0)
|
||||
this.earthGroup = new Group()
|
||||
this.group.add(this.earthGroup)
|
||||
this.earthGroup.name = 'EarthGroup'
|
||||
|
||||
// 标注点效果
|
||||
this.markupPoint = new Group()
|
||||
this.markupPoint.name = 'markupPoint'
|
||||
this.waveMeshArr = []
|
||||
|
||||
// 卫星和标签
|
||||
this.circleLineList = []
|
||||
this.circleList = []
|
||||
this.x = 0
|
||||
this.n = 0
|
||||
|
||||
// 地球自转
|
||||
this.isRotation = this.options.earth.isRotation
|
||||
|
||||
// 扫光动画 shader
|
||||
this.timeValue = 200
|
||||
|
||||
this.uniforms = {
|
||||
glowColor: {
|
||||
value: new Color(0x0cd1eb)
|
||||
},
|
||||
scale: {
|
||||
type: 'f',
|
||||
value: -1.0
|
||||
},
|
||||
bias: {
|
||||
type: 'f',
|
||||
value: 1.0
|
||||
},
|
||||
power: {
|
||||
type: 'f',
|
||||
value: 3.3
|
||||
},
|
||||
time: {
|
||||
type: 'f',
|
||||
value: this.timeValue
|
||||
},
|
||||
isHover: {
|
||||
value: false
|
||||
},
|
||||
map: {
|
||||
value: undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async init(): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
const init = async () => {
|
||||
this.createEarth() // 创建地球
|
||||
this.createEarthGlow() // 创建地球辉光
|
||||
this.createEarthAperture() // 创建地球的大气层
|
||||
await this.createMarkupPoint() // 创建柱状点位
|
||||
this.createAnimateCircle() // 创建环绕卫星
|
||||
this.createFlyLine() // 创建飞线
|
||||
this.show()
|
||||
resolve()
|
||||
}
|
||||
init()
|
||||
})
|
||||
}
|
||||
|
||||
createEarth() {
|
||||
const earth_geometry = new SphereGeometry(this.options.earth.radius, 50, 50)
|
||||
const earth_border = new SphereGeometry(this.options.earth.radius + 10, 60, 60)
|
||||
|
||||
const pointMaterial = new PointsMaterial({
|
||||
color: 0x81ffff, //设置颜色,默认 0xFFFFFF
|
||||
transparent: true,
|
||||
sizeAttenuation: true,
|
||||
opacity: 0.1,
|
||||
vertexColors: false, //定义材料是否使用顶点颜色,默认false ---如果该选项设置为true,则color属性失效
|
||||
size: 0.2 //定义粒子的大小。默认为1.0
|
||||
})
|
||||
const points = new Points(earth_border, pointMaterial) //将模型添加到场景
|
||||
|
||||
this.earthGroup.add(points)
|
||||
|
||||
this.uniforms.map.value = this.options.textures.earth
|
||||
|
||||
const earth_material = new ShaderMaterial({
|
||||
// wireframe:true, // 显示模型线条
|
||||
uniforms: this.uniforms as any,
|
||||
vertexShader: earthVertex,
|
||||
fragmentShader: earthFragment
|
||||
})
|
||||
|
||||
earth_material.needsUpdate = true
|
||||
this.earth = new Mesh(earth_geometry, earth_material)
|
||||
this.earth.name = 'earth'
|
||||
this.earthGroup.add(this.earth)
|
||||
}
|
||||
|
||||
createEarthGlow() {
|
||||
const R = this.options.earth.radius //地球半径
|
||||
|
||||
// TextureLoader创建一个纹理加载器对象,可以加载图片作为纹理贴图
|
||||
const texture = this.options.textures.glow // 加载纹理贴图
|
||||
|
||||
// 创建精灵材质对象SpriteMaterial
|
||||
const spriteMaterial = new SpriteMaterial({
|
||||
map: texture, // 设置精灵纹理贴图
|
||||
color: 0x4390d1,
|
||||
transparent: true, //开启透明
|
||||
opacity: 0.7, // 可以通过透明度整体调节光圈
|
||||
depthWrite: false //禁止写入深度缓冲区数据
|
||||
})
|
||||
|
||||
// 创建表示地球光圈的精灵模型
|
||||
const sprite = new Sprite(spriteMaterial)
|
||||
sprite.scale.set(R * 3.0, R * 3.0, 1) //适当缩放精灵
|
||||
this.earthGroup.add(sprite)
|
||||
}
|
||||
|
||||
createEarthAperture() {
|
||||
const vertexShader = [
|
||||
'varying vec3 vVertexWorldPosition;',
|
||||
'varying vec3 vVertexNormal;',
|
||||
'varying vec4 vFragColor;',
|
||||
'void main(){',
|
||||
' vVertexNormal = normalize(normalMatrix * normal);', //将法线转换到视图坐标系中
|
||||
' vVertexWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;', //将顶点转换到世界坐标系中
|
||||
' // set gl_Position',
|
||||
' gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);',
|
||||
'}'
|
||||
].join('\n')
|
||||
|
||||
//大气层效果
|
||||
const AeroSphere = {
|
||||
uniforms: {
|
||||
coeficient: {
|
||||
type: 'f',
|
||||
value: 1.0
|
||||
},
|
||||
power: {
|
||||
type: 'f',
|
||||
value: 3
|
||||
},
|
||||
glowColor: {
|
||||
type: 'c',
|
||||
value: new Color(0x4390d1)
|
||||
}
|
||||
},
|
||||
vertexShader: vertexShader,
|
||||
fragmentShader: [
|
||||
'uniform vec3 glowColor;',
|
||||
'uniform float coeficient;',
|
||||
'uniform float power;',
|
||||
|
||||
'varying vec3 vVertexNormal;',
|
||||
'varying vec3 vVertexWorldPosition;',
|
||||
|
||||
'varying vec4 vFragColor;',
|
||||
|
||||
'void main(){',
|
||||
' vec3 worldCameraToVertex = vVertexWorldPosition - cameraPosition;', //世界坐标系中从相机位置到顶点位置的距离
|
||||
' vec3 viewCameraToVertex = (viewMatrix * vec4(worldCameraToVertex, 0.0)).xyz;', //视图坐标系中从相机位置到顶点位置的距离
|
||||
' viewCameraToVertex= normalize(viewCameraToVertex);', //规一化
|
||||
' float intensity = pow(coeficient + dot(vVertexNormal, viewCameraToVertex), power);',
|
||||
' gl_FragColor = vec4(glowColor, intensity);',
|
||||
'}'
|
||||
].join('\n')
|
||||
}
|
||||
//球体 辉光 大气层
|
||||
const material1 = new ShaderMaterial({
|
||||
uniforms: AeroSphere.uniforms,
|
||||
vertexShader: AeroSphere.vertexShader,
|
||||
fragmentShader: AeroSphere.fragmentShader,
|
||||
blending: NormalBlending,
|
||||
transparent: true,
|
||||
depthWrite: false
|
||||
})
|
||||
const sphere = new SphereGeometry(this.options.earth.radius + 0, 50, 50)
|
||||
const mesh = new Mesh(sphere, material1)
|
||||
this.earthGroup.add(mesh)
|
||||
}
|
||||
|
||||
async createMarkupPoint() {
|
||||
await Promise.all(
|
||||
this.options.data.map(async item => {
|
||||
const radius = this.options.earth.radius
|
||||
const lon = item.startArray.E //经度
|
||||
const lat = item.startArray.N //纬度
|
||||
|
||||
this.punctuationMaterial = new MeshBasicMaterial({
|
||||
color: this.options.punctuation.circleColor,
|
||||
map: this.options.textures.label,
|
||||
transparent: true, //使用背景透明的png贴图,注意开启透明计算
|
||||
depthWrite: false //禁止写入深度缓冲区数据
|
||||
})
|
||||
|
||||
const mesh = createPointMesh({ radius, lon, lat, material: this.punctuationMaterial }) //光柱底座矩形平面
|
||||
this.markupPoint.add(mesh)
|
||||
const LightPillar = createLightPillar({
|
||||
radius: this.options.earth.radius,
|
||||
lon,
|
||||
lat,
|
||||
index: 0,
|
||||
textures: this.options.textures,
|
||||
punctuation: this.options.punctuation
|
||||
}) //光柱
|
||||
this.markupPoint.add(LightPillar)
|
||||
const WaveMesh = createWaveMesh({ radius, lon, lat, textures: this.options.textures }) //波动光圈
|
||||
this.markupPoint.add(WaveMesh)
|
||||
this.waveMeshArr.push(WaveMesh)
|
||||
|
||||
await Promise.all(
|
||||
item.endArray.map(obj => {
|
||||
const lon = obj.E //经度
|
||||
const lat = obj.N //纬度
|
||||
const mesh = createPointMesh({ radius, lon, lat, material: this.punctuationMaterial }) //光柱底座矩形平面
|
||||
this.markupPoint.add(mesh)
|
||||
const LightPillar = createLightPillar({
|
||||
radius: this.options.earth.radius,
|
||||
lon,
|
||||
lat,
|
||||
index: 1,
|
||||
textures: this.options.textures,
|
||||
punctuation: this.options.punctuation
|
||||
}) //光柱
|
||||
this.markupPoint.add(LightPillar)
|
||||
const WaveMesh = createWaveMesh({ radius, lon, lat, textures: this.options.textures }) //波动光圈
|
||||
this.markupPoint.add(WaveMesh)
|
||||
this.waveMeshArr.push(WaveMesh)
|
||||
})
|
||||
)
|
||||
this.earthGroup.add(this.markupPoint)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
createAnimateCircle() {
|
||||
// 创建 圆环 点
|
||||
const list = getCirclePoints({
|
||||
radius: this.options.earth.radius + 15,
|
||||
number: 150, //切割数
|
||||
closed: true // 闭合
|
||||
})
|
||||
const mat = new MeshBasicMaterial({
|
||||
color: '#0c3172',
|
||||
transparent: true,
|
||||
opacity: 0.4,
|
||||
side: DoubleSide
|
||||
})
|
||||
const line = createAnimateLine({
|
||||
pointList: list,
|
||||
material: mat,
|
||||
number: 100,
|
||||
radius: 0.1
|
||||
})
|
||||
this.earthGroup.add(line)
|
||||
|
||||
// 在clone两条线出来
|
||||
const l2 = line.clone()
|
||||
l2.scale.set(1.2, 1.2, 1.2)
|
||||
l2.rotateZ(Math.PI / 6)
|
||||
this.earthGroup.add(l2)
|
||||
|
||||
const l3 = line.clone()
|
||||
l3.scale.set(0.8, 0.8, 0.8)
|
||||
l3.rotateZ(-Math.PI / 6)
|
||||
this.earthGroup.add(l3)
|
||||
|
||||
/**
|
||||
* 旋转的球
|
||||
*/
|
||||
const ball = new Mesh(
|
||||
new SphereGeometry(this.options.satellite.size, 32, 32),
|
||||
new MeshBasicMaterial({
|
||||
color: '#e0b187' // 745F4D
|
||||
})
|
||||
)
|
||||
|
||||
const ball2 = new Mesh(
|
||||
new SphereGeometry(this.options.satellite.size, 32, 32),
|
||||
new MeshBasicMaterial({
|
||||
color: '#628fbb' // 324A62
|
||||
})
|
||||
)
|
||||
|
||||
const ball3 = new Mesh(
|
||||
new SphereGeometry(this.options.satellite.size, 32, 32),
|
||||
new MeshBasicMaterial({
|
||||
color: '#806bdf' //6D5AC4
|
||||
})
|
||||
)
|
||||
|
||||
this.circleLineList.push(line, l2, l3)
|
||||
ball.name = ball2.name = ball3.name = '卫星'
|
||||
|
||||
for (let i = 0; i < this.options.satellite.number; i++) {
|
||||
const ball01 = ball.clone()
|
||||
// 一根线上总共有几个球,根据数量平均分布一下
|
||||
const num = Math.floor(list.length / this.options.satellite.number)
|
||||
ball01.position.set(list[num * (i + 1)][0] * 1, list[num * (i + 1)][1] * 1, list[num * (i + 1)][2] * 1)
|
||||
line.add(ball01)
|
||||
|
||||
const ball02 = ball2.clone()
|
||||
const num02 = Math.floor(list.length / this.options.satellite.number)
|
||||
ball02.position.set(list[num02 * (i + 1)][0] * 1, list[num02 * (i + 1)][1] * 1, list[num02 * (i + 1)][2] * 1)
|
||||
l2.add(ball02)
|
||||
|
||||
const ball03 = ball2.clone()
|
||||
const num03 = Math.floor(list.length / this.options.satellite.number)
|
||||
ball03.position.set(list[num03 * (i + 1)][0] * 1, list[num03 * (i + 1)][1] * 1, list[num03 * (i + 1)][2] * 1)
|
||||
l3.add(ball03)
|
||||
}
|
||||
}
|
||||
|
||||
createFlyLine() {
|
||||
this.flyLineArcGroup = new Group()
|
||||
this.flyLineArcGroup.userData['flyLineArray'] = []
|
||||
this.earthGroup.add(this.flyLineArcGroup)
|
||||
this.options.data.forEach(cities => {
|
||||
cities.endArray.forEach(item => {
|
||||
// 调用函数flyArc绘制球面上任意两点之间飞线圆弧轨迹
|
||||
const arcline = flyArc(
|
||||
this.options.earth.radius,
|
||||
cities.startArray.E,
|
||||
cities.startArray.N,
|
||||
item.E,
|
||||
item.N,
|
||||
this.options.flyLine
|
||||
)
|
||||
|
||||
this.flyLineArcGroup.add(arcline) // 飞线插入flyArcGroup中
|
||||
this.flyLineArcGroup.userData['flyLineArray'].push(arcline.userData['flyLine'])
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
show() {
|
||||
gsap.to(this.group.scale, {
|
||||
x: 1,
|
||||
y: 1,
|
||||
z: 1,
|
||||
duration: 2,
|
||||
ease: 'Quadratic'
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
this.flyLineArcGroup?.userData['flyLineArray']?.forEach((fly: any) => {
|
||||
fly.rotation.z += this.options.flyLine.speed // 调节飞线速度
|
||||
if (fly.rotation.z >= fly.flyEndAngle) fly.rotation.z = 0
|
||||
})
|
||||
|
||||
if (this.isRotation) {
|
||||
this.earthGroup.rotation.y += this.options.earth.rotateSpeed
|
||||
}
|
||||
|
||||
this.circleLineList.forEach(e => {
|
||||
e.rotateY(this.options.satellite.rotateSpeed)
|
||||
})
|
||||
|
||||
this.uniforms.time.value =
|
||||
this.uniforms.time.value < -this.timeValue ? this.timeValue : this.uniforms.time.value - 1
|
||||
|
||||
if (this.waveMeshArr.length) {
|
||||
this.waveMeshArr.forEach((mesh: any) => {
|
||||
mesh.userData['scale'] += 0.007
|
||||
mesh.scale.set(
|
||||
mesh.userData['size'] * mesh.userData['scale'],
|
||||
mesh.userData['size'] * mesh.userData['scale'],
|
||||
mesh.userData['size'] * mesh.userData['scale']
|
||||
)
|
||||
if (mesh.userData['scale'] <= 1.5) {
|
||||
(mesh.material as Material).opacity = (mesh.userData['scale'] - 1) * 2 //2等于1/(1.5-1.0),保证透明度在0~1之间变化
|
||||
} else if (mesh.userData['scale'] > 1.5 && mesh.userData['scale'] <= 2) {
|
||||
(mesh.material as Material).opacity = 1 - (mesh.userData['scale'] - 1.5) * 2 //2等于1/(2.0-1.5) mesh缩放2倍对应0 缩放1.5被对应1
|
||||
} else {
|
||||
mesh.userData['scale'] = 1
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/**
|
||||
* 资源管理和加载
|
||||
*/
|
||||
import { LoadingManager, Texture, TextureLoader } from 'three'
|
||||
import { loadingStart, loadingFinish, loadingError } from '@/utils'
|
||||
import { resources } from './Assets'
|
||||
export class Resources {
|
||||
private manager!: LoadingManager
|
||||
private callback: () => void
|
||||
private textureLoader!: InstanceType<typeof TextureLoader>
|
||||
public textures: Record<string, Texture>
|
||||
constructor(callback: () => void) {
|
||||
this.callback = callback // 资源加载完成的回调
|
||||
this.textures = {} // 贴图对象
|
||||
this.setLoadingManager()
|
||||
this.loadResources()
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理加载状态
|
||||
*/
|
||||
private setLoadingManager() {
|
||||
this.manager = new LoadingManager()
|
||||
// 开始加载
|
||||
this.manager.onStart = () => {
|
||||
loadingStart()
|
||||
}
|
||||
// 加载完成
|
||||
this.manager.onLoad = () => {
|
||||
this.callback()
|
||||
}
|
||||
// 正在进行中
|
||||
this.manager.onProgress = url => {
|
||||
loadingFinish()
|
||||
}
|
||||
|
||||
this.manager.onError = url => {
|
||||
loadingError()
|
||||
window['$message'].error('数据加载失败,请刷新重试!')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载资源
|
||||
*/
|
||||
private loadResources(): void {
|
||||
this.textureLoader = new TextureLoader(this.manager)
|
||||
resources.textures?.forEach(item => {
|
||||
this.textureLoader.load(item.url, t => {
|
||||
this.textures[item.name] = t
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
import { MeshBasicMaterial, PerspectiveCamera, Scene, ShaderMaterial, WebGLRenderer } from 'three'
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
|
||||
// interfaces
|
||||
import { IWord } from '../interfaces/IWord'
|
||||
import { Basic } from './Basic'
|
||||
import { Resources } from './Resources'
|
||||
// earth
|
||||
import Earth from './Earth'
|
||||
|
||||
export default class World {
|
||||
public basic: Basic
|
||||
public scene: Scene
|
||||
public camera: PerspectiveCamera
|
||||
public renderer: WebGLRenderer
|
||||
public controls: OrbitControls
|
||||
public material!: ShaderMaterial | MeshBasicMaterial
|
||||
public resources: Resources
|
||||
public option: IWord
|
||||
public earth!: Earth
|
||||
|
||||
constructor(option: IWord) {
|
||||
/**
|
||||
* 加载资源
|
||||
*/
|
||||
this.option = option
|
||||
this.basic = new Basic(option.dom)
|
||||
this.scene = this.basic.scene
|
||||
this.renderer = this.basic.renderer
|
||||
this.controls = this.basic.controls
|
||||
this.camera = this.basic.camera
|
||||
this.updateSize()
|
||||
this.resources = new Resources(async () => {
|
||||
await this.createEarth()
|
||||
// 开始渲染
|
||||
this.render()
|
||||
})
|
||||
}
|
||||
|
||||
async createEarth(data?: any) {
|
||||
// 资源加载完成,开始制作地球,注释在new Earth()类型里面
|
||||
this.earth = new Earth({
|
||||
data: data || this.option.data,
|
||||
dom: this.option.dom,
|
||||
textures: this.resources.textures,
|
||||
earth: {
|
||||
radius: 50,
|
||||
rotateSpeed: 0.002,
|
||||
isRotation: true
|
||||
},
|
||||
satellite: {
|
||||
show: true,
|
||||
rotateSpeed: -0.01,
|
||||
size: 1,
|
||||
number: 2
|
||||
},
|
||||
punctuation: {
|
||||
circleColor: 0x3892ff,
|
||||
lightColumn: {
|
||||
startColor: 0xe4007f, // 起点颜色
|
||||
endColor: 0xffffff // 终点颜色
|
||||
}
|
||||
},
|
||||
flyLine: {
|
||||
color: 0xf3ae76, // 飞线的颜色
|
||||
flyLineColor: 0xff7714, // 飞行线的颜色
|
||||
speed: 0.004 // 拖尾飞线的速度
|
||||
}
|
||||
})
|
||||
|
||||
this.scene.add(this.earth.group)
|
||||
await this.earth.init()
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染函数
|
||||
*/
|
||||
public render() {
|
||||
requestAnimationFrame(this.render.bind(this))
|
||||
this.renderer.render(this.scene, this.camera)
|
||||
this.controls && this.controls.update()
|
||||
this.earth && this.earth.render()
|
||||
}
|
||||
|
||||
// 更新
|
||||
public updateSize(width?: number, height?: number) {
|
||||
let w = width || this.option.width
|
||||
let h = height || this.option.height
|
||||
// 取小值
|
||||
if (w < h) h = w
|
||||
else w = h
|
||||
|
||||
this.renderer.setSize(w, h)
|
||||
this.camera.aspect = w / h
|
||||
this.camera.updateProjectionMatrix()
|
||||
}
|
||||
|
||||
// 数据更新重新渲染
|
||||
public updateData(data?: any) {
|
||||
if (!this.earth.group) return
|
||||
// 先删除旧的
|
||||
this.scene.remove(this.earth.group)
|
||||
// 递归遍历组对象group释放所有后代网格模型绑定几何体占用内存
|
||||
this.earth.group.traverse((obj: any) => {
|
||||
if (obj.type === 'Mesh') {
|
||||
obj.geometry.dispose()
|
||||
obj.material.dispose()
|
||||
}
|
||||
})
|
||||
// 重新创建
|
||||
this.createEarth(data)
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { PublicConfigClass } from '@/packages/public'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { chartInitConfig } from '@/settings/designSetting'
|
||||
import { ThreeEarth01Config } from './index'
|
||||
import dataJson from './data.json'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
|
||||
export const option = {
|
||||
dataset: dataJson
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||
public key = ThreeEarth01Config.key
|
||||
public attr = { ...chartInitConfig, w: 800, h: 800, zIndex: -1 }
|
||||
public chartConfig = cloneDeep(ThreeEarth01Config)
|
||||
public option = cloneDeep(option)
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<template></template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { option } from './config'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -1,84 +0,0 @@
|
||||
[
|
||||
{
|
||||
"startArray": {
|
||||
"name": "杭州",
|
||||
"N": 30.246026,
|
||||
"E": 120.210792
|
||||
},
|
||||
"endArray": [
|
||||
{
|
||||
"name": "曼谷",
|
||||
"N": 22,
|
||||
"E": 100.49074172973633
|
||||
},
|
||||
{
|
||||
"name": "澳大利亚",
|
||||
"N": -23.68477416688374,
|
||||
"E": 133.857421875
|
||||
},
|
||||
|
||||
{
|
||||
"name": "新疆维吾尔自治区",
|
||||
"N": 41.748,
|
||||
"E": 84.9023
|
||||
},
|
||||
|
||||
{
|
||||
"name": "德黑兰",
|
||||
"N": 35,
|
||||
"E": 51
|
||||
},
|
||||
{
|
||||
"name": "德黑兰",
|
||||
"N": 35,
|
||||
"E": 51
|
||||
},
|
||||
{
|
||||
"name": "美国",
|
||||
"N": 34.125447565116126,
|
||||
"E": 241.7431640625
|
||||
},
|
||||
{
|
||||
"name": "英国",
|
||||
"N": 51.508742458803326,
|
||||
"E": 359.82421875
|
||||
},
|
||||
{
|
||||
"name": "巴西",
|
||||
"N": -9.96885060854611,
|
||||
"E": 668.1445312499999
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"startArray": {
|
||||
"name": "北京",
|
||||
"N": 39.89491,
|
||||
"E": 116.322056
|
||||
},
|
||||
"endArray": [
|
||||
{
|
||||
"name": "西藏",
|
||||
"N": 29.660361,
|
||||
"E": 91.132212
|
||||
},
|
||||
{
|
||||
"name": "广西",
|
||||
"N": 22.830824,
|
||||
"E": 108.30616
|
||||
},
|
||||
|
||||
{
|
||||
"name": "江西",
|
||||
"N": 28.676493,
|
||||
"E": 115.892151
|
||||
},
|
||||
|
||||
{
|
||||
"name": "贵阳",
|
||||
"N": 26.647661,
|
||||
"E": 106.630153
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 566 KiB |
|
Before Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 504 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 42 KiB |
@@ -1,15 +0,0 @@
|
||||
import image from '@/assets/images/chart/decorates/threeEarth01.png'
|
||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||
|
||||
export const ThreeEarth01Config: ConfigType = {
|
||||
key: 'ThreeEarth01',
|
||||
chartKey: 'VThreeEarth01',
|
||||
conKey: 'VCThreeEarth01',
|
||||
title: '三维地球',
|
||||
category: ChatCategoryEnum.THREE,
|
||||
categoryName: ChatCategoryEnumName.THREE,
|
||||
package: PackagesCategoryEnum.DECORATES,
|
||||
chartFrame: ChartFrameEnum.STATIC,
|
||||
image
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
<template>
|
||||
<div ref="chartRef"></div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, PropType, ref, toRefs, watch } from 'vue'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { useChartDataFetch } from '@/hooks'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { option } from './config'
|
||||
import World from './code/world/Word'
|
||||
import throttle from 'lodash/throttle'
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
type: Object as PropType<CreateComponentType & typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const chartEditStore = useChartEditStore()
|
||||
|
||||
const chartRef = ref<HTMLElement>()
|
||||
const { w, h } = toRefs(props.chartConfig.attr)
|
||||
let threeClassInstance: World
|
||||
|
||||
// 初始化
|
||||
const init = () => {
|
||||
const dom: HTMLElement | undefined = chartRef.value
|
||||
if (dom) {
|
||||
threeClassInstance = new World({
|
||||
dom: dom,
|
||||
data: props.chartConfig.option.dataset,
|
||||
width: w.value,
|
||||
height: h.value
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const updateData = (data: any) => {
|
||||
try {
|
||||
threeClassInstance.updateData(data)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
// 改变大小
|
||||
watch(
|
||||
() => [w.value, h.value],
|
||||
throttle(([newWidth], [newHeight]) => {
|
||||
threeClassInstance.updateSize(newWidth, newHeight)
|
||||
}, 100)
|
||||
)
|
||||
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
(newData: any) => {
|
||||
updateData(newData)
|
||||
},
|
||||
{
|
||||
deep: false
|
||||
}
|
||||
)
|
||||
|
||||
// DOM 渲染之后进行初始化
|
||||
onMounted(() => {
|
||||
try {
|
||||
if (navigator.userAgent.indexOf('Chrome') < -1 || navigator.userAgent.indexOf('Edg') > -1) {
|
||||
window['$message'].error('此组件仅在【谷歌】浏览器上能正常展示!')
|
||||
chartEditStore.removeComponentList(undefined, false)
|
||||
return
|
||||
}
|
||||
init()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
})
|
||||
|
||||
useChartDataFetch(props.chartConfig, useChartEditStore, updateData)
|
||||
</script>
|
||||
@@ -1,3 +0,0 @@
|
||||
import { ThreeEarth01Config } from './ThreeEarth01/index'
|
||||
|
||||
export default [ThreeEarth01Config]
|
||||
2
src/packages/components/Decorates/index.d.ts
vendored
@@ -1,13 +1,11 @@
|
||||
export enum ChatCategoryEnum {
|
||||
BORDER = 'Borders',
|
||||
DECORATE = 'Decorates',
|
||||
THREE = 'Three',
|
||||
MORE = 'Mores'
|
||||
}
|
||||
|
||||
export enum ChatCategoryEnumName {
|
||||
BORDER = '边框',
|
||||
DECORATE = '装饰',
|
||||
THREE = '三维',
|
||||
MORE = '更多'
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import Borders from './Borders'
|
||||
import Decorates from './Decorates'
|
||||
import Three from './Three'
|
||||
import Mores from './Mores'
|
||||
|
||||
export const DecorateList = [...Borders, ...Decorates, ...Three, ...Mores]
|
||||
export const DecorateList = [...Borders, ...Decorates, ...Mores]
|
||||
|
||||
@@ -47,12 +47,9 @@ const option = computed(() => {
|
||||
})
|
||||
|
||||
const dataSetHandle = (dataset: typeof dataJson) => {
|
||||
try {
|
||||
dataset && (props.chartConfig.option.series[0].data = dataset)
|
||||
vChartRef.value && isPreview() && vChartRef.value.setOption(props.chartConfig.option)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
dataset && (props.chartConfig.option.series[0].data = dataset)
|
||||
|
||||
vChartRef.value && isPreview() && vChartRef.value.setOption(props.chartConfig.option)
|
||||
}
|
||||
|
||||
// dataset 无法变更条数的补丁
|
||||
|
||||
@@ -10,12 +10,19 @@
|
||||
<div class="rank" :style="`color: ${color};font-size: ${indexFontSize}px`">No.{{ item.ranking }}</div>
|
||||
<div class="info-name" :style="`font-size: ${leftFontSize}px`" v-html="item.name" />
|
||||
<div class="ranking-value" :style="`color: ${textColor};font-size: ${rightFontSize}px`">
|
||||
{{ status.mergedConfig.valueFormatter ? status.mergedConfig.valueFormatter(item) : item.value }}
|
||||
{{
|
||||
status.mergedConfig.valueFormatter
|
||||
? status.mergedConfig.valueFormatter(item)
|
||||
: item.value
|
||||
}}
|
||||
{{ unit }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ranking-column" :style="`border-color: ${borderColor}`">
|
||||
<div class="inside-column" :style="`width: ${item.percent}%;background-color: ${color}`">
|
||||
<div
|
||||
class="inside-column"
|
||||
:style="`width: ${item.percent}%;background-color: ${color}`"
|
||||
>
|
||||
<div class="shine" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -32,8 +39,8 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
type: Object as PropType<CreateComponentType>,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
const { w, h } = toRefs(props.chartConfig.attr)
|
||||
const { rowNum, unit, color, textColor, borderColor, indexFontSize, leftFontSize, rightFontSize } = toRefs(
|
||||
@@ -43,15 +50,13 @@ const { rowNum, unit, color, textColor, borderColor, indexFontSize, leftFontSize
|
||||
const status = reactive({
|
||||
mergedConfig: props.chartConfig.option,
|
||||
rowsData: [],
|
||||
rows: [
|
||||
{
|
||||
scroll: 0,
|
||||
ranking: 1,
|
||||
name: '',
|
||||
value: '',
|
||||
percent: 0
|
||||
}
|
||||
],
|
||||
rows: [{
|
||||
scroll: 0,
|
||||
ranking: 1,
|
||||
name: '',
|
||||
value: '',
|
||||
percent: 0
|
||||
}],
|
||||
heights: [0],
|
||||
animationIndex: 0,
|
||||
animationHandler: 0,
|
||||
@@ -76,16 +81,16 @@ const calcRowsData = () => {
|
||||
// abs of max
|
||||
const maxAbs = Math.abs(max)
|
||||
const total = max + minAbs
|
||||
dataset = dataset.map((row: any, i: number) => ({
|
||||
dataset = dataset.map((row: any, i:number) => ({
|
||||
...row,
|
||||
ranking: i + 1,
|
||||
percent: ((row.value + minAbs) / total) * 100
|
||||
percent: ((row.value + minAbs) / total) * 100,
|
||||
}))
|
||||
const rowLength = dataset.length
|
||||
if (rowLength > rowNum && rowLength < 2 * rowNum) {
|
||||
dataset = [...dataset, ...dataset]
|
||||
}
|
||||
dataset = dataset.map((d: any, i: number) => ({ ...d, scroll: i }))
|
||||
dataset = dataset.map((d:any, i:number) => ({ ...d, scroll: i }))
|
||||
status.rowsData = dataset
|
||||
status.rows = dataset
|
||||
}
|
||||
@@ -129,15 +134,11 @@ const stopAnimation = () => {
|
||||
}
|
||||
|
||||
const onRestart = async () => {
|
||||
try {
|
||||
if (!status.mergedConfig) return
|
||||
stopAnimation()
|
||||
calcRowsData()
|
||||
calcHeights(true)
|
||||
animation(true)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
if (!status.mergedConfig) return
|
||||
stopAnimation()
|
||||
calcRowsData()
|
||||
calcHeights(true)
|
||||
animation(true)
|
||||
}
|
||||
|
||||
onRestart()
|
||||
|
||||
@@ -1,47 +1,24 @@
|
||||
<template>
|
||||
<div class="dv-scroll-board">
|
||||
<div
|
||||
class="header"
|
||||
v-if="status.header.length && status.mergedConfig"
|
||||
:style="`background-color: ${status.mergedConfig.headerBGC};`"
|
||||
>
|
||||
<div
|
||||
class="header-item"
|
||||
v-for="(headerItem, i) in status.header"
|
||||
:key="`${headerItem}${i}`"
|
||||
:style="`
|
||||
<div class="header" v-if="status.header.length && status.mergedConfig"
|
||||
:style="`background-color: ${status.mergedConfig.headerBGC};`">
|
||||
<div class="header-item" v-for="(headerItem, i) in status.header" :key="`${headerItem}${i}`" :style="`
|
||||
height: ${status.mergedConfig.headerHeight}px;
|
||||
line-height: ${status.mergedConfig.headerHeight}px;
|
||||
width: ${status.widths[i]}px;
|
||||
`"
|
||||
:align="status.aligns[i]"
|
||||
v-html="headerItem"
|
||||
/>
|
||||
`" :align="status.aligns[i]" v-html="headerItem" />
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="status.mergedConfig"
|
||||
class="rows"
|
||||
:style="`height: ${h - (status.header.length ? status.mergedConfig.headerHeight : 0)}px;`"
|
||||
>
|
||||
<div
|
||||
class="row-item"
|
||||
v-for="(row, ri) in status.rows"
|
||||
:key="`${row.toString()}${row.scroll}`"
|
||||
:style="`
|
||||
<div v-if="status.mergedConfig" class="rows"
|
||||
:style="`height: ${h - (status.header.length ? status.mergedConfig.headerHeight : 0)}px;`">
|
||||
<div class="row-item" v-for="(row, ri) in status.rows" :key="`${row.toString()}${row.scroll}`" :style="`
|
||||
height: ${status.heights[ri]}px;
|
||||
line-height: ${status.heights[ri]}px;
|
||||
background-color: ${status.mergedConfig[row.rowIndex % 2 === 0 ? 'evenRowBGC' : 'oddRowBGC']};
|
||||
`"
|
||||
>
|
||||
<div
|
||||
class="ceil"
|
||||
v-for="(ceil, ci) in row.ceils"
|
||||
:key="`${ceil}${ri}${ci}`"
|
||||
:style="`width: ${status.widths[ci]}px;`"
|
||||
:align="status.aligns[ci]"
|
||||
v-html="ceil"
|
||||
/>
|
||||
`">
|
||||
<div class="ceil" v-for="(ceil, ci) in row.ceils" :key="`${ceil}${ri}${ci}`"
|
||||
:style="`width: ${status.widths[ci]}px;`" :align="status.aligns[ci]" v-html="ceil" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -58,8 +35,8 @@ import cloneDeep from 'lodash/cloneDeep'
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
type: Object as PropType<CreateComponentType>,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
// 这里能拿到图表宽高等
|
||||
@@ -161,13 +138,11 @@ const status = reactive({
|
||||
mergedConfig: props.chartConfig.option,
|
||||
header: [],
|
||||
rowsData: [],
|
||||
rows: [
|
||||
{
|
||||
ceils: [],
|
||||
rowIndex: 0,
|
||||
scroll: 0
|
||||
}
|
||||
],
|
||||
rows: [{
|
||||
ceils: [],
|
||||
rowIndex: 0,
|
||||
scroll: 0
|
||||
}],
|
||||
widths: [],
|
||||
heights: [0],
|
||||
avgHeight: 0,
|
||||
@@ -188,7 +163,7 @@ const calcData = () => {
|
||||
animation(true)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(()=> {
|
||||
calcData()
|
||||
})
|
||||
|
||||
@@ -210,21 +185,19 @@ const calcHeaderData = () => {
|
||||
const calcRowsData = () => {
|
||||
let { dataset, index, headerBGC, rowNum } = status.mergedConfig
|
||||
if (index) {
|
||||
dataset = dataset.map((row: any, i: number) => {
|
||||
dataset = dataset.map((row:any, i:number) => {
|
||||
row = [...row]
|
||||
const indexTag = `<span class="index" style="background-color: ${headerBGC};border-radius: 3px;padding: 0px 3px;">${
|
||||
i + 1
|
||||
}</span>`
|
||||
const indexTag = `<span class="index" style="background-color: ${headerBGC};border-radius: 3px;padding: 0px 3px;">${i + 1}</span>`
|
||||
row.unshift(indexTag)
|
||||
return row
|
||||
})
|
||||
}
|
||||
dataset = dataset.map((ceils: any, i: number) => ({ ceils, rowIndex: i }))
|
||||
dataset = dataset.map((ceils:any, i:number) => ({ ceils, rowIndex: i }))
|
||||
const rowLength = dataset.length
|
||||
if (rowLength > rowNum && rowLength < 2 * rowNum) {
|
||||
dataset = [...dataset, ...dataset]
|
||||
}
|
||||
dataset = dataset.map((d: any, i: number) => ({ ...d, scroll: i }))
|
||||
dataset = dataset.map((d:any, i:number) => ({ ...d, scroll: i }))
|
||||
|
||||
status.rowsData = dataset
|
||||
status.rows = dataset
|
||||
@@ -233,7 +206,7 @@ const calcRowsData = () => {
|
||||
const calcWidths = () => {
|
||||
const { mergedConfig, rowsData } = status
|
||||
const { columnWidth, header } = mergedConfig
|
||||
const usedWidth = columnWidth.reduce((all: any, ws: number) => all + ws, 0)
|
||||
const usedWidth = columnWidth.reduce((all:any, ws:number) => all + ws, 0)
|
||||
let columnNum = 0
|
||||
if (rowsData[0]) {
|
||||
columnNum = (rowsData[0] as any).ceils.length
|
||||
@@ -281,7 +254,7 @@ const animation = async (start = false) => {
|
||||
const rowLength = rowsData.length
|
||||
if (rowNum >= rowLength) return
|
||||
if (start) {
|
||||
await new Promise(resolve => setTimeout(resolve, waitTime * 1000))
|
||||
await new Promise(resolve => setTimeout(resolve, waitTime*1000))
|
||||
if (updater !== status.updater) return
|
||||
}
|
||||
const animationNum = carousel === 'single' ? 1 : rowNum
|
||||
@@ -296,7 +269,7 @@ const animation = async (start = false) => {
|
||||
const back = animationIndex - rowLength
|
||||
if (back >= 0) animationIndex = back
|
||||
status.animationIndex = animationIndex
|
||||
status.animationHandler = setTimeout(animation, waitTime * 1000 - 300) as any
|
||||
status.animationHandler = setTimeout(animation, waitTime*1000 - 300) as any
|
||||
}
|
||||
|
||||
const stopAnimation = () => {
|
||||
@@ -306,13 +279,9 @@ const stopAnimation = () => {
|
||||
}
|
||||
|
||||
const onRestart = async () => {
|
||||
try {
|
||||
if (!status.mergedConfig) return
|
||||
stopAnimation()
|
||||
calcData()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
if (!status.mergedConfig) return
|
||||
stopAnimation()
|
||||
calcData()
|
||||
}
|
||||
|
||||
watch(
|
||||
@@ -335,7 +304,7 @@ watch(
|
||||
() => {
|
||||
onRestart()
|
||||
},
|
||||
{ deep: true }
|
||||
{deep:true}
|
||||
)
|
||||
|
||||
// 数据更新 (默认更新 dataset,若更新之后有其它操作,可添加回调函数)
|
||||
@@ -347,6 +316,7 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (resData: any[]) => {
|
||||
onUnmounted(() => {
|
||||
stopAnimation()
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
19
src/packages/index.d.ts
vendored
@@ -90,21 +90,6 @@ export const BlendModeEnumList = [
|
||||
{ label: '亮度', value: 'luminosity' }
|
||||
]
|
||||
|
||||
// vue3 生命周期事件
|
||||
export enum EventLife {
|
||||
// 渲染之后
|
||||
MOUNTED = 'vnodeMounted',
|
||||
// 渲染之前
|
||||
BEFORE_MOUNT = 'vnodeBeforeMount',
|
||||
// 鼠标事件
|
||||
MOUSE_CLICK = 'click',
|
||||
MOUSE_OVER = "mouseover",
|
||||
MOUSE_LEAVE = "mouseleave",
|
||||
// 图表事件
|
||||
ECHART_LEGEND_SELECT_CHANGED = "legendselectchanged",
|
||||
ECHART_HIGH_LIGHT = "highlight"
|
||||
}
|
||||
|
||||
// 组件实例类
|
||||
export interface PublicConfigType {
|
||||
id: string
|
||||
@@ -130,9 +115,7 @@ export interface PublicConfigType {
|
||||
}
|
||||
filter?: string
|
||||
status: StatusType
|
||||
events?: {
|
||||
[K in EventLife]?: string
|
||||
}
|
||||
setPosition: Function
|
||||
}
|
||||
|
||||
export interface CreateComponentType extends PublicConfigType, requestConfig {
|
||||
|
||||
@@ -81,8 +81,12 @@ export class PublicConfigClass implements PublicConfigType {
|
||||
public request = cloneDeep(requestConfig)
|
||||
// 数据过滤
|
||||
public filter = undefined
|
||||
// 事件
|
||||
public events = undefined
|
||||
|
||||
// 设置坐标
|
||||
public setPosition(x: number, y: number): void {
|
||||
this.attr.x = x
|
||||
this.attr.y = y
|
||||
}
|
||||
}
|
||||
|
||||
// 多选成组类
|
||||
|
||||
@@ -18,13 +18,11 @@ export function createRouterGuards(router: Router) {
|
||||
const isErrorPage = router.getRoutes().findIndex((item) => item.name === to.name);
|
||||
if (isErrorPage === -1) {
|
||||
next({ name: PageEnum.ERROR_PAGE_NAME_404 })
|
||||
return
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
if (!routerAllowList.includes(to.name) && !loginCheck()) {
|
||||
next({ name: PageEnum.BASE_LOGIN_NAME })
|
||||
return
|
||||
}
|
||||
next()
|
||||
})
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
"axisLabel": {
|
||||
"show": true,
|
||||
"fontSize": 12,
|
||||
"color": "#B9B8CE",
|
||||
"rotate": 0
|
||||
"color": "#B9B8CE"
|
||||
},
|
||||
"position": "bottom",
|
||||
"axisLine": {
|
||||
@@ -59,8 +58,7 @@
|
||||
"axisLabel": {
|
||||
"show": true,
|
||||
"fontSize": 12,
|
||||
"color": "#B9B8CE",
|
||||
"rotate": 0
|
||||
"color": "#B9B8CE"
|
||||
},
|
||||
"position": "left",
|
||||
"axisLine": {
|
||||
@@ -90,12 +88,5 @@
|
||||
"textStyle": {
|
||||
"color": "#B9B8CE"
|
||||
}
|
||||
},
|
||||
"grid": {
|
||||
"show": false,
|
||||
"left": "10%",
|
||||
"top": "60",
|
||||
"right": "10%",
|
||||
"bottom": "60"
|
||||
}
|
||||
}
|
||||
@@ -518,31 +518,34 @@ export const useChartEditStore = defineStore({
|
||||
}
|
||||
const parseHandle = (e: CreateComponentType | CreateComponentGroupType) => {
|
||||
e = cloneDeep(e)
|
||||
// 生成新 id
|
||||
e.id = getUUID()
|
||||
e.attr.x = this.getMousePosition.x + 30
|
||||
e.attr.y = this.getMousePosition.y + 30
|
||||
// 外层生成新 id
|
||||
e.id = getUUID()
|
||||
// 分组列表生成新 id
|
||||
if (e.isGroup) {
|
||||
(e as CreateComponentGroupType).groupList.forEach((item: CreateComponentType) => {
|
||||
item.id = getUUID()
|
||||
})
|
||||
}
|
||||
|
||||
return e
|
||||
}
|
||||
const isCut = recordCharts.type === HistoryActionTypeEnum.CUT
|
||||
const targetList = Array.isArray(recordCharts.charts) ? recordCharts.charts : [ recordCharts.charts ]
|
||||
// 多项
|
||||
targetList.forEach((e: CreateComponentType | CreateComponentGroupType) => {
|
||||
this.addComponentList(parseHandle(e), undefined, true)
|
||||
// 剪切需删除原数据
|
||||
if (isCut) {
|
||||
this.setTargetSelectChart(e.id)
|
||||
this.removeComponentList(undefined, true)
|
||||
}
|
||||
})
|
||||
if (isCut) this.setRecordChart(undefined)
|
||||
if (Array.isArray(recordCharts.charts)) {
|
||||
recordCharts.charts.forEach((e: CreateComponentType) => {
|
||||
this.addComponentList(parseHandle(e), undefined, true)
|
||||
// 剪切需删除原数据
|
||||
if (isCut) {
|
||||
this.setTargetSelectChart(e.id)
|
||||
this.removeComponentList(undefined, true)
|
||||
}
|
||||
})
|
||||
if (isCut) this.setRecordChart(undefined)
|
||||
loadingFinish()
|
||||
return
|
||||
}
|
||||
// 单项
|
||||
this.addComponentList(parseHandle(recordCharts.charts), undefined, true)
|
||||
if (isCut) {
|
||||
this.setTargetSelectChart(recordCharts.charts.id)
|
||||
this.removeComponentList()
|
||||
this.setRecordChart(undefined)
|
||||
}
|
||||
loadingFinish()
|
||||
} catch (value) {
|
||||
loadingError()
|
||||
|
||||
@@ -4,10 +4,10 @@ import { asideCollapsedWidth } from '@/settings/designSetting'
|
||||
import { SettingStoreType, ToolsStatusEnum } from './settingStore.d'
|
||||
import { setLocalStorage, getLocalStorage } from '@/utils'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
const { GO_SYSTEM_SETTING_STORE } = StorageEnum
|
||||
const { GO_SETTING_STORE } = StorageEnum
|
||||
|
||||
const storageSetting: SettingStoreType = getLocalStorage(
|
||||
GO_SYSTEM_SETTING_STORE
|
||||
GO_SETTING_STORE
|
||||
)
|
||||
|
||||
// 全局设置
|
||||
@@ -48,7 +48,7 @@ export const useSettingStore = defineStore({
|
||||
this.$patch(state => {
|
||||
state[key] = value
|
||||
})
|
||||
setLocalStorage(GO_SYSTEM_SETTING_STORE, this.$state)
|
||||
setLocalStorage(GO_SETTING_STORE, this.$state)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -25,23 +25,6 @@ export const base64toFile = (dataurl: string, fileName: string) => {
|
||||
return ImageUrl
|
||||
}
|
||||
|
||||
/**
|
||||
* file转 blob
|
||||
* @param { File } file 文件对象
|
||||
*/
|
||||
export const fileToBlob = (file:File) =>{
|
||||
return new Promise<Blob>(function (resolve, reject) {
|
||||
let reader = new FileReader()
|
||||
reader.readAsArrayBuffer(file)
|
||||
reader.onload = function (e: ProgressEvent<FileReader>) {
|
||||
if(e.target){
|
||||
const blob = new Blob([<ArrayBuffer>e.target.result], { type: file.type });
|
||||
resolve(blob);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* * url转file
|
||||
*/
|
||||
|
||||
@@ -1,27 +1,6 @@
|
||||
/**
|
||||
* 请求失败统一处理,allowRoute 允许跳转。
|
||||
* @param MyResponse MyResponseType,可以为空。
|
||||
* @return
|
||||
* * 请求失败统一处理
|
||||
*/
|
||||
import { ResultEnum } from "@/enums/httpEnum"
|
||||
import { PageEnum, ErrorPageNameMap } from "@/enums/pageEnum"
|
||||
import { redirectErrorPage, routerTurnByName } from '@/utils'
|
||||
|
||||
export const httpErrorHandle = (MyResponse?:any, allowRoute:boolean = true) => {
|
||||
if(MyResponse){
|
||||
const {code, msg} = MyResponse
|
||||
if (MyResponse.code === ResultEnum.TOKEN_OVERDUE) {
|
||||
window['$message'].error(msg || window['$t']('http.token_overdue_message'))
|
||||
if(allowRoute) routerTurnByName(PageEnum.BASE_LOGIN_NAME)
|
||||
return
|
||||
}
|
||||
|
||||
if (MyResponse.code != ResultEnum.SUCCESS) {
|
||||
// 其他错误处理 Todo
|
||||
if (ErrorPageNameMap.get(code) && allowRoute) {
|
||||
redirectErrorPage(code)
|
||||
}
|
||||
}
|
||||
}
|
||||
export const httpErrorHandle = () => {
|
||||
window['$message'].error(window['$t']('http.error_message'))
|
||||
}
|
||||
@@ -4,7 +4,7 @@ export * from '@/utils/router'
|
||||
export * from '@/utils/storage'
|
||||
export * from '@/utils/style'
|
||||
export * from '@/utils/plugin'
|
||||
export * from '@/utils/components'
|
||||
export * from '@/utils/componets'
|
||||
export * from '@/utils/type'
|
||||
export * from '@/utils/file'
|
||||
export * from '@/utils/http'
|
||||