Compare commits

...

165 Commits

Author SHA1 Message Date
奔跑的面条
f9c715c72c build: 升级版本到1.1.6 2022-12-16 14:01:47 +08:00
奔跑的面条
e2b3118d9d Merge branch 'dev' 2022-12-16 13:57:02 +08:00
奔跑的面条
0cd31f48c1 style: 修改注释 2022-12-16 12:11:16 +08:00
奔跑的面条
e35e98c023 feat: 拉取图片路径处理的PR代码 2022-12-16 12:04:42 +08:00
奔跑的面条
11cd4d0da1 perf: 优化数字翻牌组件说明 2022-12-16 11:12:16 +08:00
奔跑的面条
8987dd1682 perf: 优化饼图展示 2022-12-16 11:01:02 +08:00
奔跑的面条
ff1384c825 !108 饼状图新增功能 显示标签,标签显示内容,引导线显示,饼状图圆角设置
Merge pull request !108 from 李少白/master-fetch
2022-12-16 10:44:32 +08:00
奔跑的面条
0e42f4ff35 fix: 解决预览时没有overflow-hidden 的问题 2022-12-16 10:31:04 +08:00
奔跑的面条
cfcc262fd6 fix: 禁用个别弹窗使用esc 2022-12-16 10:15:25 +08:00
奔跑的面条
f4c3a2b04f docs: 修改首页说明 2022-12-16 10:04:25 +08:00
奔跑的面条
31a8957de9 !106 docs: add Cloud IDE preview link
Merge pull request !106 from aresn/master
2022-12-16 01:49:34 +00:00
奔跑的面条
36ca877d49 style: 优化代码格式 2022-12-16 09:19:56 +08:00
奔跑的面条
3bad7ec758 !107 修复过滤器编辑器未更新问题
Merge pull request !107 from Furoe/dev
2022-12-16 01:18:57 +00:00
奔跑的面条
e1e26cafcf fix: 新增编辑接口同步修改所有组件功能 2022-12-15 21:04:00 +08:00
奔跑的面条
99cd66c835 feat: 新增全局请求定时功能 2022-12-15 20:53:28 +08:00
奔跑的面条
e4aac1597f feat: 处理全局接口编辑请求 2022-12-15 20:22:05 +08:00
奔跑的面条
2dc7bc3b61 perf: 优化全局接口功能 2022-12-15 19:49:58 +08:00
奔跑的面条
07b7eec457 perf: 优化全局接口功能 2022-12-15 19:48:16 +08:00
奔跑的面条
eaab8d1d49 feat: 新增数据池配置页面 2022-12-15 19:37:43 +08:00
yangwq7
9903e73a69 fix: 修复过滤器编辑器未更新问题 2022-12-12 11:33:43 +08:00
奔跑的面条
7f1c001c99 fix: 解决颜色列表卡顿的问题 2022-12-10 17:04:24 +08:00
奔跑的面条
46f20f61b5 update README.md.
Signed-off-by: 奔跑的面条 <1262327911@qq.com>
2022-12-09 08:11:47 +00:00
aresn
dba5ab3ef3 update README.md.
Signed-off-by: aresn <admin@aresn.com>
2022-12-07 09:51:33 +00:00
aresn
2251bebee6 add preview.yml.
Signed-off-by: aresn <admin@aresn.com>
2022-12-07 09:49:48 +00:00
奔跑的面条
21ba5c02b0 perf: 优化缩放动画 2022-11-24 11:48:13 +08:00
奔跑的面条
500795b7e5 feat: 新增数据池代码 2022-11-22 21:25:52 +08:00
奔跑的面条
3ac9ffc73c Merge branch 'dev' 2022-11-22 12:44:51 +08:00
奔跑的面条
5ea963fb93 fix: 处理旧数据基础事件报错的问题 2022-11-22 12:42:23 +08:00
奔跑的面条
c420ae467f Merge branch 'dev' 2022-11-21 10:49:25 +08:00
奔跑的面条
be014225c1 fix: 去除页面错误静态数据 2022-11-21 10:49:04 +08:00
奔跑的面条
8334fe5bcc build: 升级版本到 1.1.5 2022-11-19 21:04:53 +08:00
奔跑的面条
f99edce6f4 Merge branch 'dev' 2022-11-19 21:04:32 +08:00
奔跑的面条
936d78975e fix: 解决点击图表分列没反应的bug 2022-11-19 20:37:06 +08:00
奔跑的面条
a25f9bc5a1 !100 胶囊柱图问题 ,滚动排名列表问题
Merge pull request !100 from daidai/dev
2022-11-19 06:03:47 +00:00
刘嘉威
5454f19f3d fix: 滚动排名列表问题当数据量小于等于列表数时,第一条数据会直接不显示 2022-11-18 11:25:41 +08:00
刘嘉威
b95cf946a8 perf: 胶囊图增加cloneDeep防止多个互相影响 2022-11-18 10:16:41 +08:00
刘嘉威
1b9a3f6f5b fix: 胶囊柱图source数量变化页面展示效果数量不变问题 2022-11-18 09:23:37 +08:00
奔跑的面条
d91cd00310 fix: 补充误删的代码 2022-11-17 22:35:49 +08:00
奔跑的面条
e4f821f46d perf: 去除多余代码,优化全局配置页面 2022-11-17 21:39:51 +08:00
奔跑的面条
ed5a452e2f perf: 优化配置页面结构 2022-11-17 00:41:11 +08:00
奔跑的面条
907a0afb77 chore: 优化地址输入框的长度 2022-11-17 00:18:39 +08:00
奔跑的面条
b32c718780 style: 新增注释 2022-11-16 22:55:03 +08:00
潘潘
adbdad1e88 perf: 注释定时同步 2022-11-15 21:42:22 +08:00
潘潘
f8229a0518 perf: 编辑JSON优化 2022-11-15 21:42:09 +08:00
奔跑的面条
48f00e44f6 feat: 新增数据池 hook 2022-11-15 21:25:35 +08:00
奔跑的面条
8c089b800a perf: 修改列表的样式wenti 2022-11-13 21:38:46 +08:00
奔跑的面条
44199fa4c4 feat: 新增图表展示模式切换 2022-11-13 21:28:38 +08:00
奔跑的面条
5e20689356 feat: 新增基础事件功能 2022-11-13 02:36:04 +08:00
奔跑的面条
9a9b752a96 feat: 新增基础事件 2022-11-12 23:03:13 +08:00
奔跑的面条
1ddf056ca6 fix: 修改事件类型错误 2022-11-12 22:03:51 +08:00
奔跑的面条
572ab73c92 perf: 优化事件代码结构 2022-11-12 21:49:04 +08:00
奔跑的面条
afc8f907ce perf: 优化修改json的代码 2022-11-12 17:20:11 +08:00
奔跑的面条
f6bad1513b perf: 优化获取id 的旧代码 2022-11-12 16:16:03 +08:00
奔跑的面条
fce514c490 chore: 转移master-fetch分支获取id函数到dev分支 2022-11-12 16:10:14 +08:00
奔跑的面条
30a9deaee7 fix: 解决部分组件的配置缺失深拷贝的问题 2022-11-12 15:37:41 +08:00
奔跑的面条
f47acca703 update README.md.
Signed-off-by: 奔跑的面条 <1262327911@qq.com>
2022-11-10 10:13:19 +00:00
奔跑的面条
73a6c6b920 update README.md.
Signed-off-by: 奔跑的面条 <1262327911@qq.com>
2022-11-10 10:10:58 +00:00
奔跑的面条
672f7a0a7c Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-11-05 21:46:26 +08:00
奔跑的面条
32762aa8a7 fix: 修改预览页面的报错问题 2022-11-05 21:31:42 +08:00
奔跑的面条
c35dd6fad9 fix: 解决锁定时,修改模块隐藏展示,标尺不会自适应的问题 2022-11-05 21:16:34 +08:00
奔跑的面条
de78fb2149 docs: 新增文档截图 2022-11-05 18:19:33 +08:00
奔跑的面条
8d05953b8b chore: 修改路径地址 2022-11-05 15:45:29 +08:00
奔跑的面条
afed1cb6b3 fix: 处理切换语言,UI框架不会变的问题 2022-11-05 15:23:01 +08:00
奔跑的面条
f6a4e87e05 style: 优化提示文案 2022-11-03 09:27:09 +08:00
奔跑的面条
e36265a2f4 style: 修改 iframe默认地址 2022-11-02 20:03:32 +08:00
奔跑的面条
4a59e69bbe docs: 修改首页地址 2022-11-02 19:46:19 +08:00
奔跑的面条
a442e13a7b feat: 升级版本到1.1.4 2022-11-02 19:05:16 +08:00
奔跑的面条
4d093a4a80 Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-11-02 19:02:38 +08:00
奔跑的面条
3dd94fb408 feat: 新增点击事件案例 2022-11-02 16:35:08 +08:00
奔跑的面条
7e59d8d36c docs: 修改链接地址 2022-11-02 09:57:28 +08:00
奔跑的面条
bb46050bb3 style: 优化代码结构 2022-10-31 09:52:02 +08:00
奔跑的面条
b50620ec2c style: 优化代码结构 2022-10-31 09:30:35 +08:00
奔跑的面条
7bef69af92 style: 修改翻牌器全局引用的目录 2022-10-31 09:29:22 +08:00
奔跑的面条
8241077495 update README.md.
Signed-off-by: 奔跑的面条 <1262327911@qq.com>
2022-10-29 12:09:36 +00:00
奔跑的面条
82b29a2f8b docs: 优化说明文档 2022-10-29 19:57:02 +08:00
奔跑的面条
b789d80f98 fix: 修改主页说明 2022-10-29 19:51:33 +08:00
奔跑的面条
a8c80e2366 docs: 修改主页说明 2022-10-29 19:50:30 +08:00
奔跑的面条
ae8fcd640b perf: 优化 iframe 组件 2022-10-29 19:10:47 +08:00
奔跑的面条
455f3ff09a perf: 优化iframe 2022-10-29 17:55:14 +08:00
奔跑的面条
e4afaded36 !92 新增Iframe组件
Merge pull request !92 from 自由/dev-wu-20221027
2022-10-29 09:27:15 +00:00
奔跑的面条
a10409f829 perf: 优化 mock 列表的快捷写法 2022-10-29 17:15:14 +08:00
奔跑的面条
112138fdc5 perf: 优化高德地图 2022-10-29 17:14:47 +08:00
wuyuting1
73e5ca59df feat: 增加iframe组件 2022-10-28 11:38:39 +08:00
奔跑的面条
38f92febb7 feat: 优化胶囊图,新增配置 2022-10-28 11:13:52 +08:00
奔跑的面条
cd6f1e0438 perf: 优化版权声明的UI 2022-10-28 09:49:35 +08:00
奔跑的面条
1d73f71aaf fix: 优化在线编辑JSON的代码和交互 2022-10-27 21:10:58 +08:00
奔跑的面条
e4e77cd141 !91 增加胶囊柱图
Merge pull request !91 from daidai/dev
2022-10-27 12:30:58 +00:00
奔跑的面条
e0e7270623 !87 feat:新增高德地图
Merge pull request !87 from jiangcheng/dev
2022-10-27 12:27:22 +00:00
奔跑的面条
885c376e2a !85 feat: 新增JSON编辑页面 以及 保存跨窗口同步视图更新
Merge pull request !85 from 潘潘/dev
2022-10-27 12:27:01 +00:00
奔跑的面条
2845e9829d fix: 修改工作台不去除监听的问题 2022-10-27 19:38:58 +08:00
刘嘉威
36b82de301 style: remove console.log 2022-10-27 11:41:53 +08:00
刘嘉威
a2ac99e7cb feat: 胶囊柱图增加mock数据源 2022-10-27 11:40:53 +08:00
刘嘉威
d037e1ff36 feat: 增加胶囊柱图 2022-10-27 11:01:41 +08:00
潘潘
9d4424356d feat: 定时、失焦、保存同步 2022-10-26 12:10:19 +08:00
奔跑的面条
f087a0766b !89 解决编译混淆的警告和i18n的控制台警告
Merge pull request !89 from unidmr/dev
2022-10-25 04:50:31 +00:00
xushihao
0bb7400755 chore:解决控制台关于vue-i18n的告警 2022-10-25 09:55:18 +08:00
xushihao
6460c475b6 build:用terser混淆时会出现警告,需要配置minify为terser,或者用esbuild 2022-10-25 09:52:12 +08:00
蒋承
f8b645f867 feat: 添加点标记 2022-10-24 10:20:06 +08:00
panjianhua
834b330bc8 style: 修改UI 2022-10-22 21:16:37 +08:00
潘潘
a4b4ce57bd feat: 预览页\JSON编辑页\图表页保存同步更新 2022-10-20 15:38:15 +08:00
蒋承
ff7a0830d0 feat: 高德地图新增属性 2022-10-19 10:21:48 +08:00
蒋承
ff43d0c2d8 feat: 新增高德地图 2022-10-19 09:29:50 +08:00
奔跑的面条
bad4b5d7b3 fix: 去除单独颜色设置 2022-10-18 21:23:18 +08:00
奔跑的面条
adaf30dd3b perf: 优化弹幕图片 2022-10-18 21:00:41 +08:00
奔跑的面条
c0fc84061e !81 feat:新增弹幕文字组件
Merge pull request !81 from jiangcheng/dev
2022-10-18 12:58:35 +00:00
蒋承
b84ad0f598 feat: 弹幕文字 2022-10-18 11:24:57 +08:00
奔跑的面条
aa0569ef4b fix: 修改列表图偏移的问题 2022-10-17 09:42:56 +08:00
奔跑的面条
b88d90cb80 perf: 优化文案描述 2022-10-17 09:26:19 +08:00
奔跑的面条
c055129309 perf: 优化标题 2022-10-16 20:49:48 +08:00
奔跑的面条
30351cecb5 feat: 新增案例说明 2022-10-16 20:46:01 +08:00
奔跑的面条
4f6757fff2 perf: 优化事件编辑页面 2022-10-16 16:27:15 +08:00
奔跑的面条
284fdb8e05 perf: 修改事件文件位置,修改图标 2022-10-16 10:41:12 +08:00
奔跑的面条
738bcae563 fix: 去除 setPosition 2022-10-16 10:29:01 +08:00
奔跑的面条
987a68a6d1 !76 新增组件生命周期事件
Merge pull request !76 from 潘潘/dev
2022-10-16 02:28:09 +00:00
奔跑的面条
bdbdd37789 build: 升级版本到1.1.3 2022-10-15 17:17:34 +08:00
奔跑的面条
c8fb5b9152 Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-10-15 17:12:13 +08:00
奔跑的面条
59cb5d609d perf: 去除grid多余配置,添加散点图、热力图的grid 2022-10-15 16:51:16 +08:00
奔跑的面条
4add9ce4c6 !80 feat: 折线图和柱状图添加网格配置,xy轴标签偏移量
Merge pull request !80 from jiangcheng/dev
2022-10-15 02:09:47 +00:00
蒋承
c75d9f7a59 feat: x,y轴标签偏移量 2022-10-14 17:09:26 +08:00
蒋承
2d94085c54 feat: 网格容器配置 2022-10-14 16:50:06 +08:00
蒋承
2a6e5915f5 feat: 柱状图折线图添加网格配置 2022-10-14 16:46:41 +08:00
潘潘
656532e43d Merge branch 'dev' of gitee.com:dromara/go-view into dev
Signed-off-by: 潘潘 <97274247@qq.com>
2022-10-14 07:01:47 +00:00
奔跑的面条
d835a904c9 fix: 解决导入时顺序不对的问题 2022-10-14 14:33:14 +08:00
奔跑的面条
a5bf0e9f6a perf: 优化导入失败提示 2022-10-14 09:37:31 +08:00
奔跑的面条
7e3efa46ee perf: 优化亮色模式图层提示 2022-10-14 09:37:12 +08:00
奔跑的面条
ce68910e48 fix: 解决 分组复制 id 会重复的问题 2022-10-13 21:10:32 +08:00
奔跑的面条
6dce639a0e perf: 优化按下文案tishi 2022-10-13 20:48:12 +08:00
奔跑的面条
c738103fec perf: 优化键盘按下的提示 2022-10-13 20:45:51 +08:00
奔跑的面条
801f298448 perf: 优化报错信息捕获,去除setPosition自带函数 2022-10-13 20:21:33 +08:00
奔跑的面条
e08a7723b6 perf: 优化格式 2022-10-13 19:52:41 +08:00
奔跑的面条
166b5b98e8 !78 feat: 过滤方法增加api返回顶级对象作为参数,增强过滤器兼容性
Merge pull request !78 from dodu/dev-api-filter
2022-10-13 10:05:39 +00:00
奔跑的面条
07e56631da perf: 优化异常处理 2022-10-12 21:57:30 +08:00
奔跑的面条
1435789a6c !77 feat: 折线图和柱状图配置label选项
Merge pull request !77 from jiangcheng/dev
2022-10-12 13:35:36 +00:00
奔跑的面条
7c5fa7610d fix: 新增三维组件限制 2022-10-12 21:30:08 +08:00
奔跑的面条
084e680e12 perf: 优化三维地球内存泄漏 2022-10-12 21:15:08 +08:00
奔跑的面条
380a6b95b7 feat: 新增三维地球 2022-10-12 21:08:24 +08:00
tnt group
9467feff23 fix: 移除开发标记 2022-10-12 16:50:25 +08:00
tnt group
a6f4267915 feat: 过滤方法增加api返回顶级对象作为参数,增强过滤器兼容性 2022-10-12 16:41:49 +08:00
jiangcheng
cfe9efd4dd Merge branch 'dev' of https://gitee.com/jiang_cheng_1/go-view into dev 2022-10-12 11:31:05 +08:00
jiangcheng
971b03620a fix: 格式问题 2022-10-12 11:30:54 +08:00
潘潘
92339dae28 feat: 组件生命周期事件 2022-10-11 18:31:29 +08:00
奔跑的面条
c84f6d9c33 perf: 优化补丁的判单方式 2022-10-11 16:02:43 +08:00
奔跑的面条
e187c012cc perf: 修改ctrl默认值 2022-10-11 15:15:03 +08:00
奔跑的面条
af1c280f28 perf: 优化 ctrl 监听 2022-10-10 18:47:07 +08:00
奔跑的面条
aef155e039 fix: 修复组件导入数据错乱的问题 2022-10-09 16:37:30 +08:00
蒋承
016e48cc69 feat: 折线图和柱状图配置label 2022-10-09 16:04:29 +08:00
蒋承
6dcd39983f feat: 更新 2022-10-09 15:50:46 +08:00
蒋承
b055b6c511 Merge branch 'dev' of https://gitee.com/jiang_cheng_1/go-view into dev 2022-10-09 15:36:00 +08:00
蒋承
1d18c86dc7 feat: 动态数据维度不同,导致整合维度bug 2022-10-09 13:58:29 +08:00
奔跑的面条
443573455b Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-10-09 09:28:38 +08:00
奔跑的面条
d811ab7dfa build: 撤回错误版本号 2022-10-08 21:12:58 +08:00
奔跑的面条
5f79ab6e6d build: 升级版本到1.1.2 2022-10-08 21:12:27 +08:00
奔跑的面条
502edbca5d Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-10-08 21:05:48 +08:00
奔跑的面条
1a04267cb7 build: 升级版本到1.1.1 2022-10-08 20:59:55 +08:00
奔跑的面条
9c2c1bdfa1 Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-10-08 20:59:25 +08:00
奔跑的面条
72e93f3768 Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-09-27 20:16:07 +08:00
奔跑的面条
e6f2066d42 Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-09-22 14:15:00 +08:00
奔跑的面条
2812c39524 Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-09-21 19:54:29 +08:00
奔跑的面条
491485856e Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-09-19 20:46:37 +08:00
奔跑的面条
abde7e176d Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-09-19 20:13:50 +08:00
奔跑的面条
bab8faadee add default pipeline template yaml 2022-09-19 11:58:32 +00:00
奔跑的面条
427d72fb8b Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-09-18 16:48:28 +08:00
奔跑的面条
dc5b20a329 build: 升级版本到1.1.0 2022-09-18 16:33:26 +08:00
奔跑的面条
4cb934eef3 Merge branch 'dev' of https://gitee.com/MTrun/go-view 2022-09-18 16:32:34 +08:00
奔跑的面条
35e8cea0b5 docs: 更新已完成图表说明 2022-09-17 23:00:51 +08:00
212 changed files with 6913 additions and 6442 deletions

View File

@@ -0,0 +1,51 @@
version: '1.0'
name: branch-pipeline
displayName: BranchPipeline
stages:
- stage:
name: compile
displayName: 编译
steps:
- step: build@nodejs
name: build_nodejs
displayName: Nodejs 构建
# 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
nodeVersion: 14.16.0
# 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
commands:
- npm install && rm -rf ./dist && npm run build
# 非必填字段开启后表示将构建产物暂存但不会上传到制品库中7天后自动清除
artifacts:
# 构建产物名字作为产物的唯一标识可向下传递支持自定义默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- name: BUILD_ARTIFACT
# 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
path:
- ./dist
- step: publish@general_artifacts
name: publish_general_artifacts
displayName: 上传制品
# 上游构建任务定义的产物名默认BUILD_ARTIFACT
dependArtifact: BUILD_ARTIFACT
# 上传到制品库时的制品命名默认output
artifactName: output
dependsOn: build_nodejs
- stage:
name: release
displayName: 发布
steps:
- step: publish@release_artifacts
name: publish_release_artifacts
displayName: '发布'
# 上游上传制品任务的产出
dependArtifact: output
# 发布制品版本号
version: '1.0.0.0'
# 是否开启版本号自增,默认开启
autoIncrement: true
triggers:
push:
branches:
exclude:
- master
include:
- .*

View File

@@ -0,0 +1,49 @@
version: '1.0'
name: master-pipeline
displayName: MasterPipeline
stages:
- stage:
name: compile
displayName: 编译
steps:
- step: build@nodejs
name: build_nodejs
displayName: Nodejs 构建
# 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
nodeVersion: 14.16.0
# 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
commands:
- npm install && rm -rf ./dist && npm run build
# 非必填字段开启后表示将构建产物暂存但不会上传到制品库中7天后自动清除
artifacts:
# 构建产物名字作为产物的唯一标识可向下传递支持自定义默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- name: BUILD_ARTIFACT
# 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
path:
- ./dist
- step: publish@general_artifacts
name: publish_general_artifacts
displayName: 上传制品
# 上游构建任务定义的产物名默认BUILD_ARTIFACT
dependArtifact: BUILD_ARTIFACT
# 上传到制品库时的制品命名默认output
artifactName: output
dependsOn: build_nodejs
- stage:
name: release
displayName: 发布
steps:
- step: publish@release_artifacts
name: publish_release_artifacts
displayName: '发布'
# 上游上传制品任务的产出
dependArtifact: output
# 发布制品版本号
version: '1.0.0.0'
# 是否开启版本号自增,默认开启
autoIncrement: true
triggers:
push:
branches:
include:
- master

36
.workflow/pr-pipeline.yml Normal file
View File

@@ -0,0 +1,36 @@
version: '1.0'
name: pr-pipeline
displayName: PRPipeline
stages:
- stage:
name: compile
displayName: 编译
steps:
- step: build@nodejs
name: build_nodejs
displayName: Nodejs 构建
# 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
nodeVersion: 14.16.0
# 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
commands:
- npm install && rm -rf ./dist && npm run build
# 非必填字段开启后表示将构建产物暂存但不会上传到制品库中7天后自动清除
artifacts:
# 构建产物名字作为产物的唯一标识可向下传递支持自定义默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- name: BUILD_ARTIFACT
# 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
path:
- ./dist
- step: publish@general_artifacts
name: publish_general_artifacts
displayName: 上传制品
# 上游构建任务定义的产物名默认BUILD_ARTIFACT
dependArtifact: BUILD_ARTIFACT
# 上传到制品库时的制品命名默认output
artifactName: output
dependsOn: build_nodejs
triggers:
pr:
branches:
include:
- master

View File

@@ -1,30 +1,35 @@
## 总览
![logo](readme/logo-t-y.png)
<p align="center">
<img src="readme/logo-t-y.png" alt="go-view" />
</p>
GoView 是一个高效的拖拽式低代码数据可视化开发平台,将图表或页面元素封装为基础组件,无需编写代码即可制作数据大屏,减少心智负担。
<h4 align="center">开源、精美、便捷的「数据可视化」低代码开发平台</h4>
### 😶 **前端** 分支: **`master`**
#### 😶 **前端** 分支: **`master`**
### 👻 携带 **后端** 请求分支: **`master-fetch`**
#### 👻 携带 **后端** 请求分支: **`master-fetch`**
### 📚 GoView **文档** 地址:[http://www.mtruning.club:81/](http://www.mtruning.club:81/)
#### 📚 GoView **文档** 地址:[https://www.mtruning.club/](https://www.mtruning.club/)
项目纯前端-Demo 地址:[https://www.mtruning.club](https://www.mtruning.club)
项目纯前端-Demo 地址:[https://vue.mtruning.club/](https://vue.mtruning.club/)
项目带后端-Demo 地址:[后端 Demo 地址](http://1.117.240.165:8080/goview/#/login)
文档-在线地址:[http://www.mtruning.club:81/](http://www.mtruning.club:81/)
项目带后端-Demo 地址:[https://demo.mtruning.club/](https://demo.mtruning.club/)
文档-源码地址:[https://gitee.com/MTrun/go-view-doc](https://gitee.com/MTrun/go-view-doc)
### 🤯 后端项目
Cloud IDE 代码在线预览地址:[https://idegitee.com/dromara/go-view](https://idegitee.com/dromara/go-view)
#### 🤯 后端项目看这里!
后端项目gitee地址[https://gitee.com/MTrun/go-view-serve](https://gitee.com/MTrun/go-view-serve)
后端项目 gitee 地址:[https://gitee.com/MTrun/go-view-serve](https://gitee.com/MTrun/go-view-serve)
接口说明地址:[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)
接口说明地址:[https://docs.apipost.cn/...](https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb)
技术点
其它后端方案地址
- 【.NET】[https://gitee.com/sun_xiang_yu/go-view-dotnet](https://gitee.com/sun_xiang_yu/go-view-dotnet)
#### 整体介绍
- 框架:基于 `Vue3` 框架编写,使用 `hooks` 写法抽离部分逻辑,使代码结构更加清晰;
@@ -36,17 +41,29 @@ GoView 是一个高效的拖拽式低代码数据可视化开发平台,将图
- 封装:项目进行了详细的工具类封装如:路由、存储、加/解密、文件处理、主题、NaiveUI 全局方法、组件等
说明文档:
![说明文档](readme/go-view-doc.png)
工作台:
![项目截图](readme/go-view-canvas.png)
![工作台](readme/go-view-canvas.png)
请求配置:
![项目截图](readme/go-view-fetch.png)
![请求配置](readme/go-view-fetch.png)
数据过滤:
![项目截图](readme/go-view-filter.png)
![数据过滤](readme/go-view-filter.png)
高级事件编辑:
![高级事件编辑](readme/go-view-event.png)
快捷主页:
![快捷主页](readme/go-view-indexpage.png)
主题色:
![项目截图](readme/go-view-color.png)
![主题色](readme/go-view-color.png)
亮白主题:
![亮白主题](readme/go-view-theme.png)
主要技术栈为:
@@ -66,14 +83,17 @@ GoView 是一个高效的拖拽式低代码数据可视化开发平台,将图
已完成图表:
| 分类 | 名称 | 名称 | 名称 |
| ------ | ---------------- | ---------------- | -------- |
| 图表 | 柱状图 | 横向柱状图 | 折线图 |
| \* | 单/多 折线面积图 | 饼图 | 水球图 |
| \* | 环形图 | NaiveUI 多种进度 | 🤠 |
| 信息 | 文字 | 图 | 😶 |
| 列表 | 滚动排名列表 | 滚动表格 | 🤓 |
| 小组件 | 边框-01~13 | 装饰-01~05 | 数字翻牌 |
| 分类 | 名称 | 名称 | 名称 | 名称 |
| ------ | ---------------- | ---------- | -------------- | ------------------------ |
| 图表 | 柱状图 | 横向柱状图 | 折线图 | 单/多 折线面积图(渐变色) |
| \* | 饼图 | 环形图 | 水球图 | 雷达图 |
| \* | NaiveUI 多种进度 | 散点图 | 对数回归散点图 | 热力图 |
| \* | 漏斗图 | 中国地图 | 高德地 | 🦊 |
| 信息 | 文字 | 渐变文字 | 词云 | 嵌套网页 |
| \* | 图片 | 视频 | 😺 | 🐯 |
| 列表 | 滚动排名列表 | 滚动表格 | 🐮 | 🐐 |
| 小组件 | 边框-01~13 | 装饰-01~05 | 数字翻牌 | 通用时间 |
| \* | 数字计数 | 倒计时 | 时钟 | 🦁 |
## 浏览器支持
@@ -91,8 +111,7 @@ pnpm install
#yarn
yarn install
#npm
npm install
# 千万不要使用 npm 会报错
```
## 启动
@@ -101,9 +120,6 @@ npm install
#pnpm
pnpm dev
# npm
npm run dev
#yarn
yarn dev
@@ -117,9 +133,6 @@ make dev
#pnpm
pnpm run build
# npm
npm run build
#yarn
yarn run build

View File

@@ -1,3 +1,4 @@
import path from 'path'
export const OUTPUT_DIR = 'dist'
// monaco-editor 路径
@@ -6,7 +7,7 @@ export const prefix = `monaco-editor/esm/vs`
// chunk 警告大小
export const chunkSizeWarningLimit = 2000
// 禁用 brotli 压缩大小报告
// 禁用 brotliSize 压缩大小报告
export const brotliSize = false
// 分包
@@ -14,7 +15,12 @@ export const rollupOptions = {
output: {
chunkFileNames: 'static/js/[name]-[hash].js',
entryFileNames: 'static/js/[name]-[hash].js',
assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
assetFileNames: (chunkInfo) => {
if(['.png', '.jpg', '.jpeg'].includes(path.extname(chunkInfo.name))) {
return `static/[ext]/[name].[ext]`
}
return `static/[ext]/[name]-[hash].[ext]`
},
manualChunks: {
jsonWorker: [`${prefix}/language/json/json.worker`],
cssWorker: [`${prefix}/language/css/css.worker`],

View File

@@ -1,6 +1,6 @@
{
"name": "go-view",
"version": "1.1.11",
"version": "1.1.6",
"scripts": {
"dev": "vite --host",
"build": "vue-tsc --noEmit && vite build",
@@ -11,6 +11,8 @@
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx,.vue src --fix"
},
"dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1",
"@amap/amap-jsapi-types": "^0.0.8",
"@types/color": "^3.0.3",
"@types/crypto-js": "^4.1.1",
"@types/keymaster": "^1.6.30",
@@ -22,6 +24,7 @@
"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",
@@ -29,6 +32,7 @@
"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.9",
@@ -41,6 +45,7 @@
"@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",

48
pnpm-lock.yaml generated
View File

@@ -1,6 +1,8 @@
lockfileVersion: 5.4
specifiers:
'@amap/amap-jsapi-loader': ^1.0.1
'@amap/amap-jsapi-types': ^0.0.8
'@commitlint/cli': ^17.0.2
'@commitlint/config-conventional': ^17.0.2
'@types/color': ^3.0.3
@@ -8,6 +10,7 @@ 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
@@ -31,6 +34,7 @@ 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
@@ -45,6 +49,7 @@ 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
@@ -62,6 +67,8 @@ specifiers:
vuedraggable: ^4.1.0
dependencies:
'@amap/amap-jsapi-loader': 1.0.1
'@amap/amap-jsapi-types': 0.0.8
'@types/color': 3.0.3
'@types/crypto-js': 4.1.1
'@types/keymaster': 1.6.30
@@ -73,6 +80,7 @@ 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
@@ -80,6 +88,7 @@ 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.9_vue@3.2.37
@@ -92,6 +101,7 @@ 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
@@ -126,6 +136,14 @@ devDependencies:
packages:
/@amap/amap-jsapi-loader/1.0.1:
resolution: {integrity: sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw==}
dev: false
/@amap/amap-jsapi-types/0.0.8:
resolution: {integrity: sha512-q0FyZDIJcXjsMLGc3oS9rjfJsErOvt9rcp6AgzY4k14vo7bBhdq4eKwoSdVp/pYjR/rfaKBns5v10ycZOFwf/A==}
dev: false
/@ampproject/remapping/2.2.0:
resolution: {integrity: sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==}
engines: {node: '>=6.0.0'}
@@ -905,7 +923,7 @@ packages:
dev: true
/@types/node/17.0.43:
resolution: {integrity: sha512-jnUpgw8fL9kP2iszfIDyBQtw5Mf4/XSqy0Loc1J9pI14ejL83XcCEvSf50Gs/4ET0I9VCCDoOfufQysj0S66xA==, registry: https://registry.npm.taobao.org/}
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}
/@types/normalize-package-data/2.4.1:
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
@@ -921,12 +939,22 @@ 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}
@@ -1884,7 +1912,7 @@ packages:
dev: true
/csstype/2.6.20:
resolution: {integrity: sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==, registry: https://registry.npm.taobao.org/}
resolution: {integrity: sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/csstype/-/csstype-2.6.20.tgz}
dev: false
/csstype/3.0.11:
@@ -2091,7 +2119,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/}
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}
peerDependencies:
echarts: ^5.0.1
dependencies:
@@ -3032,6 +3060,10 @@ 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'}
@@ -3042,7 +3074,7 @@ packages:
source-map: 0.6.1
wordwrap: 1.0.0
optionalDependencies:
uglify-js: 3.16.0
uglify-js: 3.17.4
dev: true
/hard-rejection/2.1.0:
@@ -4825,6 +4857,10 @@ 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
@@ -4978,8 +5014,8 @@ packages:
hasBin: true
dev: true
/uglify-js/3.16.0:
resolution: {integrity: sha512-FEikl6bR30n0T3amyBh3LoiBdqHRy/f4H80+My34HOesOKyHfOsxAPAxOoqC0JUnC1amnO0IwkYC3sko51caSw==}
/uglify-js/3.17.4:
resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==}
engines: {node: '>=0.8.0'}
hasBin: true
requiresBuild: true

10
preview.yml Normal file
View File

@@ -0,0 +1,10 @@
# preview.yml
autoOpen: true # 打开工作空间时是否自动开启所有应用的预览
apps:
- port: 3000 # 应用的端口
run: npm i --registry=https://registry.npmmirror.com && npm run dev # 应用的启动命令
command: # 使用此命令启动服务且不执行run
root: ./ # 应用的启动目录
name: GoView # 应用名称
description: 开源、精美、便捷的「数据可视化」低代码开发平台 # 应用描述
autoOpen: true # 打开工作空间时是否自动开启预览(优先级高于根级 autoOpen)

BIN
readme/go-view-doc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

BIN
readme/go-view-theme.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 KiB

View File

@@ -1,9 +1,9 @@
<template>
<n-config-provider
:locale="zhCN"
:theme="darkTheme"
:hljs="hljsTheme"
:date-locale="dateZhCN"
:locale="locale"
:date-locale="dateLocale"
:theme-overrides="overridesTheme"
>
<go-app-provider>
@@ -14,11 +14,10 @@
</template>
<script lang="ts" setup>
import { zhCN, dateZhCN, NConfigProvider } from 'naive-ui'
import { NConfigProvider } from 'naive-ui'
import { GoAppProvider } from '@/components/GoAppProvider'
import { I18n } from '@/components/I18n'
import { useDarkThemeHook, useThemeOverridesHook, useCode } from '@/hooks'
import { useDarkThemeHook, useThemeOverridesHook, useCode, useLang } from '@/hooks'
// 暗黑主题
const darkTheme = useDarkThemeHook()
@@ -28,4 +27,8 @@ const overridesTheme = useThemeOverridesHook()
// 代码主题
const hljsTheme = useCode()
// 全局语言
const { locale, dateLocale } = useLang()
</script>

View File

@@ -116,7 +116,6 @@ export const customizeHttp = (targetParams: RequestConfigType, globalParams: Req
if (!targetParams || !globalParams) {
return
}
// 全局
const {
// 全局请求源地址

View File

@@ -15,8 +15,10 @@ export const radarUrl = '/mock/radarData'
export const heatMapUrl = '/mock/heatMapData'
export const scatterBasicUrl = '/mock/scatterBasic'
export const mapUrl = '/mock/map'
export const capsuleUrl = '/mock/capsule'
export const wordCloudUrl = '/mock/wordCloud'
export const treemapUrl = '/mock/treemap'
export const threeEarth01Url = '/mock/threeEarth01Data'
const mockObject: MockMethod[] = [
{
@@ -81,6 +83,11 @@ const mockObject: MockMethod[] = [
method: RequestHttpEnum.GET,
response: () => test.fetchMap
},
{
url: capsuleUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchCapsule
},
{
url: wordCloudUrl,
method: RequestHttpEnum.GET,
@@ -91,6 +98,11 @@ const mockObject: MockMethod[] = [
method: RequestHttpEnum.GET,
response: () => test.fetchTreemap
},
{
url: threeEarth01Url,
method: RequestHttpEnum.GET,
response: () => test.threeEarth01Data
},
]
export default mockObject

View File

@@ -1,79 +1,9 @@
{
"point": [
"markers|50": [
{
"name": "北京",
"value": [116.405285, 39.904989, 200]
},
{
"name": "郑州",
"value": [113.665412, 34.757975, 888]
},
{
"name": "青海",
"value": [101.778916, 36.623178, 666]
},
{
"name": "宁夏回族自治区",
"value": [106.278179, 38.46637, 66]
},
{
"name": "哈尔滨市",
"value": [126.642464, 45.756967, 101]
"name": "某某地市",
"value": "@integer(2, 20)",
"position": ["@float(115, 117, 1, 6)", "@float(38, 40, 1, 6)"]
}
],
"map": [
{
"name": "北京市",
"value": "@integer(0, 1000)"
},
{
"name": "河北省",
"value": "@integer(0, 1000)"
},
{
"name": "江苏省",
"value": "@integer(0, 1000)"
},
{
"name": "福建省",
"value": "@integer(0, 1000)"
},
{
"name": "山东省",
"value": "@integer(0, 1000)"
},
{
"name": "河南省",
"value": "@integer(0, 1000)"
},
{
"name": "湖北省",
"value": "@integer(0, 1000)"
},
{
"name": "广西壮族自治区",
"value": "@integer(0, 1000)"
},
{
"name": "海南省",
"value": "@integer(0, 1000)"
},
{
"name": "青海省",
"value": "@integer(0, 1000)"
},
{
"name": "新疆维吾尔自治区",
"value": "@integer(0, 1000)"
}
],
"pieces": [
{ "gte": 1000, "label": ">1000" },
{ "gte": 600, "lte": 999, "label": "600-999" },
{ "gte": 200, "lte": 599, "label": "200-599" },
{ "gte": 50, "lte": 199, "label": "49-199" },
{ "gte": 10, "lte": 49, "label": "10-49" },
{ "lte": 9, "label": "<9" }
]
}

View File

@@ -11,27 +11,7 @@ export default {
msg: '请求成功',
data: {
dimensions: ['product', 'dataOne'],
source: [
{
product: '@name',
'dataOne|0-900': 3
},
{
product: '@name',
'dataOne|0-900': 3
},
{
product: '@name',
'dataOne|0-900': 3
},
{
product: '@name',
'dataOne|0-900': 3
},
{
product: '@name',
'dataOne|0-900': 3
},
'source|50': [
{
product: '@name',
'dataOne|0-900': 3
@@ -39,6 +19,22 @@ export default {
]
}
},
// 胶囊图
fetchCapsule: {
code: 0,
status: 200,
msg: '请求成功',
data: {
dimensions: ['name', 'value'],
source: [
{ name: '厦门', 'value|0-40': 20 },
{ name: '南阳', 'value|20-60': 40 },
{ name: '北京', 'value|40-80': 60 },
{ name: '上海', 'value|60-100': 80 },
{ name: '新疆', value: 100 }
]
}
},
// 图表
fetchMockData: {
code: 0,
@@ -46,32 +42,7 @@ export default {
msg: '请求成功',
data: {
dimensions: ['product', 'dataOne', 'dataTwo'],
source: [
{
product: '@name',
'dataOne|100-900': 3,
'dataTwo|100-900': 3
},
{
product: '@name',
'dataOne|100-900': 3,
'dataTwo|100-900': 3
},
{
product: '@name',
'dataOne|100-900': 3,
'dataTwo|100-900': 3
},
{
product: '@name',
'dataOne|100-900': 3,
'dataTwo|100-900': 3
},
{
product: '@name',
'dataOne|100-900': 3,
'dataTwo|100-900': 3
},
'source|50': [
{
product: '@name',
'dataOne|100-900': 3,
@@ -85,21 +56,7 @@ export default {
code: 0,
status: 200,
msg: '请求成功',
data: [
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 }
]
'data|50': [{ name: '@name', 'value|100-900': 5 }]
},
// 轮播表格
fetchScrollBoard: {
@@ -254,4 +211,16 @@ export default {
msg: '请求成功',
data: tTreemapJson
},
// 三维地球
threeEarth01Data: {
code: 0,
status: 200,
msg: '请求成功',
data: [
{
startArray: { name: '@name', N: '@integer(10, 100)', E: '@integer(10, 100)' },
'endArray|10': [{ name: '@name', N: '@integer(10, 100)', E: '@integer(10, 100)' }]
}
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -11,7 +11,7 @@
</template>
<n-list-item>
<n-space :size="20">
<n-space class="go-my-2" :size="20">
<n-text class="item-left">版权声明</n-text>
<n-text>
GoView 版权属于
@@ -21,8 +21,7 @@
</n-list-item>
<n-list-item>
<n-divider style="margin-top: 0" />
<n-space :size="20">
<n-space class="go-my-2" :size="20">
<n-text class="item-left">协议备注</n-text>
<n-text>
请遵守开源 MIT 协议以上声明 <n-text type="error">不可删除</n-text>否则视作侵权行为后果自负
@@ -31,8 +30,7 @@
</n-list-item>
<n-list-item>
<n-divider style="margin-top: 0" />
<n-space :size="20">
<n-space class="go-mt-2" :size="20">
<n-text class="item-left">商业授权</n-text>
<n-text>
若不想保留版权声明请通过仓库/交流群 联系项目作者进行授权
@@ -44,15 +42,21 @@
</template>
<script lang="ts" setup>
import { ref, watch } from 'vue'
import { icon } from '@/plugins'
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
const emit = defineEmits(['update:modelShow'])
defineProps({
const props = defineProps({
modelShow: Boolean
})
const emit = defineEmits(['update:modelShow'])
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
const modelShow = ref(false)
watch(() => props.modelShow, (newValue) => {
modelShow.value = newValue
})
const closeHandle = () => {
emit('update:modelShow', false)
}

View File

@@ -69,21 +69,20 @@
</template>
<script script lang="ts" setup>
import { reactive } from 'vue'
import { reactive, ref, watch } from 'vue'
import { ListType } from './index.d'
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
import { SettingStoreEnums, ToolsStatusEnum } from '@/store/modules/settingStore/settingStore.d'
import { icon } from '@/plugins'
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
const emit = defineEmits(['update:modelShow'])
defineProps({
const props = defineProps({
modelShow: Boolean
})
const emit = defineEmits(['update:modelShow'])
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
const settingStore = useSettingStore()
const modelShow = ref(false)
const list = reactive<ListType[]>([
{
@@ -168,6 +167,10 @@ const list = reactive<ListType[]>([
}
])
watch(() => props.modelShow, (newValue) => {
modelShow.value = newValue
})
const closeHandle = () => {
emit('update:modelShow', false)
}

View File

@@ -21,6 +21,23 @@
</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>
@@ -51,6 +68,9 @@
<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="展示">
@@ -140,6 +160,9 @@
<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="展示">
@@ -289,6 +312,10 @@ const legend = computed(() => {
return props.optionData.legend
})
const grid = computed(() => {
return props.optionData.grid
})
const visualMap = computed(() => {
return props.optionData.visualMap
})

View File

@@ -1,5 +1,5 @@
<template>
<setting-item-box name="位置">
<setting-item-box v-if="targetData" 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>

View File

@@ -1,4 +1,5 @@
import Flipper from './index.vue'
type FlipType = 'up' | 'down'
export { Flipper, FlipType }

View File

@@ -1,19 +1,13 @@
<template>
<div class="M-Flipper" :class="[flipType, { go: isFlipping }]">
<div class="go-Flipper" :class="[flipType, { go: isFlipping }]">
<div class="digital front" :data-front="frontTextFromData"></div>
<div class="digital back" :data-back="backTextFromData"></div>
</div>
</template>
<script lang="ts">
export default {
name: 'Flipper'
}
</script>
<script lang="ts" setup>
import { ref, PropType, watch } from 'vue'
import { FlipType } from '.'
import { FlipType } from './index'
const props = defineProps({
flipType: {
@@ -131,7 +125,7 @@ $lineColor: #4a9ef8;
}
// #endregion
.M-Flipper {
.go-Flipper {
display: inline-block;
position: relative;
width: $width;

View File

@@ -99,6 +99,7 @@ const colorSelectHandle = (color: AppThemeColorType) => {
overflow: hidden;
border-radius: 5px;
@extend .go-background-filter-shallow;
backdrop-filter: none;
}
&-color {
width: 8px;

View File

@@ -9,6 +9,12 @@ export enum DragKeyEnum {
DRAG_KEY = 'ChartData'
}
// 不同页面保存操作
export enum SavePageEnum {
CHART = 'SaveChart',
JSON = 'SaveJSON'
}
// 操作枚举
export enum MenuEnum {
// 移动
@@ -42,6 +48,8 @@ export enum MenuEnum {
BACK = 'back',
// 前进
FORWORD = 'forward',
// 保存
SAVE = 'save',
// 锁定
LOCK = 'lock',
// 解除锁定

View File

@@ -15,7 +15,9 @@ export enum RequestDataTypeEnum {
// 静态数据
STATIC = 0,
// 请求数据
AJAX = 1
AJAX = 1,
// 数据池
Pond = 2
}
// 请求主体类型

View File

@@ -12,6 +12,12 @@ export enum PreviewEnum {
CHART_PREVIEW_NAME = 'ChartPreview',
}
export enum EditEnum {
// 图表JSON编辑
CHART_EDIT = '/chart/edit/:id(.*)*',
CHART_EDIT_NAME = 'ChartEdit',
}
export enum PageEnum {
// 登录
BASE_LOGIN = '/login',

View File

@@ -1,4 +1,7 @@
export * from '@/hooks/useTheme.hook'
export * from '@/hooks/usePreviewScale.hook'
export * from '@/hooks/useCode.hook'
export * from '@/hooks/useChartDataFetch.hook'
export * from '@/hooks/useChartDataFetch.hook'
export * from '@/hooks/useChartDataPondFetch.hook'
export * from '@/hooks/useLifeHandler.hook'
export * from '@/hooks/useLang.hook'

View File

@@ -1,6 +1,7 @@
import { ref, toRefs, toRaw } from 'vue'
import type VChart from 'vue-echarts'
import { customizeHttp } from '@/api/http'
import { useChartDataPondFetch } from '@/hooks/'
import { CreateComponentType, ChartFrameEnum } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { RequestDataTypeEnum } from '@/enums/httpEnum'
@@ -23,6 +24,21 @@ export const useChartDataFetch = (
const vChartRef = ref<typeof VChart | null>(null)
let fetchInterval: any = 0
// 数据池
const { addGlobalDataInterface } = useChartDataPondFetch()
// 组件类型
const { chartFrame } = targetComponent.chartConfig
// eCharts 组件配合 vChart 库更新方式
const echartsUpdateHandle = (dataset: any) => {
if (chartFrame === ChartFrameEnum.ECHARTS) {
if (vChartRef.value) {
vChartRef.value.setOption({ dataset: dataset })
}
}
}
const requestIntervalFn = () => {
const chartEditStore = useChartEditStore()
@@ -41,9 +57,6 @@ export const useChartDataFetch = (
requestInterval: targetInterval
} = toRefs(targetComponent.request)
// 组件类型
const { chartFrame } = targetComponent.chartConfig
// 非请求类型
if (requestDataType.value !== RequestDataTypeEnum.AJAX) return
@@ -58,19 +71,14 @@ export const useChartDataFetch = (
clearInterval(fetchInterval)
const fetchFn = async () => {
const res = await customizeHttp(toRaw(targetComponent.request), toRaw(chartEditStore.requestGlobalConfig))
if (res && res.data) {
const res = await customizeHttp(toRaw(targetComponent.request), toRaw(chartEditStore.getRequestGlobalConfig))
if (res) {
try {
const filter = targetComponent.filter
// eCharts 组件配合 vChart 库更新方式
if (chartFrame === ChartFrameEnum.ECHARTS) {
if (vChartRef.value) {
vChartRef.value.setOption({ dataset: newFunctionHandle(res.data, filter) })
}
}
echartsUpdateHandle(newFunctionHandle(res?.data, res, filter))
// 更新回调函数
if (updateCallback) {
updateCallback(newFunctionHandle(res.data, filter))
updateCallback(newFunctionHandle(res?.data, res, filter))
}
} catch (error) {
console.error(error)
@@ -80,7 +88,6 @@ export const useChartDataFetch = (
// 立即调用
fetchFn()
// 定时时间
const time = targetInterval && targetInterval.value ? targetInterval.value : globalRequestInterval.value
// 单位
@@ -90,10 +97,15 @@ export const useChartDataFetch = (
}
// eslint-disable-next-line no-empty
} catch (error) {
console.log(error);
console.log(error)
}
}
isPreview() && requestIntervalFn()
if (isPreview()) {
// 判断是否是数据池类型
targetComponent.request.requestDataType === RequestDataTypeEnum.Pond
? addGlobalDataInterface(targetComponent, useChartEditStore, updateCallback || echartsUpdateHandle)
: requestIntervalFn()
}
return { vChartRef }
}

View File

@@ -0,0 +1,115 @@
import { toRaw } from 'vue'
import { customizeHttp } from '@/api/http'
import { CreateComponentType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { RequestGlobalConfigType, RequestDataPondItemType } from '@/store/modules/chartEditStore/chartEditStore.d'
import { newFunctionHandle, intervalUnitHandle } from '@/utils'
// 获取类型
type ChartEditStoreType = typeof useChartEditStore
// 数据池存储的数据类型
type DataPondMapType = {
updateCallback: (...args: any) => any
filter?: string | undefined
}
// 数据池 Map 中请求对应 callback
const mittDataPondMap = new Map<string, DataPondMapType[]>()
// 创建单个数据项轮询接口
const newPondItemInterval = (
requestGlobalConfig: RequestGlobalConfigType,
requestDataPondItem: RequestDataPondItemType,
dataPondMapItem?: DataPondMapType[]
) => {
if (!dataPondMapItem) return
let fetchInterval: any = 0
clearInterval(fetchInterval)
// 请求
const fetchFn = async () => {
try {
const res = await customizeHttp(toRaw(requestDataPondItem.dataPondRequestConfig), toRaw(requestGlobalConfig))
if (res) {
try {
// 遍历更新回调函数
dataPondMapItem.forEach(item => {
item.updateCallback(newFunctionHandle(res?.data, res, item.filter))
})
} catch (error) {
console.error(error)
return error
}
}
} catch (error) {
return error
}
}
// 立即调用
fetchFn()
const targetInterval = requestDataPondItem.dataPondRequestConfig.requestInterval
const targetUnit = requestDataPondItem.dataPondRequestConfig.requestIntervalUnit
const globalRequestInterval = requestGlobalConfig.requestInterval
const globalUnit = requestGlobalConfig.requestIntervalUnit
// 定时时间
const time = targetInterval ? targetInterval : globalRequestInterval
// 单位
const unit = targetInterval ? targetUnit : globalUnit
// 开启轮询
if (time) fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
}
/**
* 数据池接口处理
*/
export const useChartDataPondFetch = () => {
// 新增全局接口
const addGlobalDataInterface = (
targetComponent: CreateComponentType,
useChartEditStore: ChartEditStoreType,
updateCallback: (...args: any) => any
) => {
const chartEditStore = useChartEditStore()
const { requestDataPond } = chartEditStore.getRequestGlobalConfig
// 组件对应的数据池 Id
const requestDataPondId = targetComponent.request.requestDataPondId as string
// 新增数据项
const mittPondIdArr = mittDataPondMap.get(requestDataPondId) || []
mittPondIdArr.push({
updateCallback: updateCallback,
filter: targetComponent.filter
})
mittDataPondMap.set(requestDataPondId, mittPondIdArr)
}
// 清除旧数据
const clearMittDataPondMap = () => {
mittDataPondMap.clear()
}
// 初始化数据池
const initDataPond = (requestGlobalConfig: RequestGlobalConfigType) => {
const { requestDataPond } = requestGlobalConfig
// 根据 mapId 查找对应的数据池配置
for (let pondKey of mittDataPondMap.keys()) {
const requestDataPondItem = requestDataPond.find(item => item.dataPondId === pondKey)
if (requestDataPondItem) {
newPondItemInterval(requestGlobalConfig, requestDataPondItem, mittDataPondMap.get(pondKey))
}
}
}
return {
addGlobalDataInterface,
clearMittDataPondMap,
initDataPond
}
}

24
src/hooks/useLang.hook.ts Normal file
View File

@@ -0,0 +1,24 @@
import { computed } from 'vue'
import { LangEnum } from '@/enums/styleEnum'
import { useLangStore } from '@/store/modules/langStore/langStore'
import { zhCN, enUS, dateEnUS, dateZhCN } from 'naive-ui'
type LangStoreType = typeof useLangStore
// 语言切换
export const useLang = () => {
const lang = useLangStore()
const locale = computed(() => {
return lang.getLang === LangEnum.ZH ? zhCN : enUS
})
const dateLocale = computed(() => {
return lang.getLang === LangEnum.ZH ? dateZhCN : dateEnUS
})
return {
locale,
dateLocale
}
}

View File

@@ -0,0 +1,78 @@
import { CreateComponentType, CreateComponentGroupType, EventLife, BaseEvent } from '@/packages/index.d'
import * as echarts from 'echarts'
// 所有图表组件集合对象
const components: { [K in string]?: any } = {}
// 项目提供的npm 包变量
export const npmPkgs = { echarts }
// 组件事件处理 hook
export const useLifeHandler = (chartConfig: CreateComponentType | CreateComponentGroupType) => {
if (!chartConfig.events) return {}
// 处理基础事件
const baseEvent: { [key: string]: any } = {}
for (const key in chartConfig.events.baseEvent) {
const fnStr: string | undefined = (chartConfig.events.baseEvent as any)[key]
// 动态绑定基础事件
if (fnStr) {
baseEvent[key] = generateBaseFunc(fnStr)
}
}
// 生成生命周期事件
const events = chartConfig.events.advancedEvents || {}
const lifeEvents = {
[EventLife.VNODE_BEFORE_MOUNT](e: any) {
// 存储组件
components[chartConfig.id] = e.component
const fnStr = (events[EventLife.VNODE_BEFORE_MOUNT] || '').trim()
generateFunc(fnStr, e)
},
[EventLife.VNODE_MOUNTED](e: any) {
const fnStr = (events[EventLife.VNODE_MOUNTED] || '').trim()
generateFunc(fnStr, e)
}
}
return { ...baseEvent, ...lifeEvents }
}
/**
* 生成基础函数
* @param fnStr 用户方法体代码
* @param event 鼠标事件
*/
export function generateBaseFunc(fnStr: string) {
try {
return new Function(`
return (
async function(mouseEvent){
${fnStr}
}
)`)()
} catch (error) {
console.error(error)
}
}
/**
* 生成高级函数
* @param fnStr 用户方法体代码
* @param e 执行生命周期的动态组件实例
*/
function generateFunc(fnStr: string, e: any) {
try {
// npmPkgs 便于拷贝 echarts 示例时设置option 的formatter等相关内容
Function(`
"use strict";
return (
async function(e, components, node_modules){
const {${Object.keys(npmPkgs).join()}} = node_modules;
${fnStr}
}
)`)().bind(e?.component)(e, components, npmPkgs)
} catch (error) {
console.error(error)
}
}

View File

@@ -1,2 +1,3 @@
export * from './axis'
export * from './line'
export * from './line'
export * from './label'

View File

@@ -0,0 +1,7 @@
export const labelConfig = {
position: [
{ label: '外侧', value: 'outside' },
{ label: '内部', value: 'inside' },
{ label: '中心', value: 'center' }
]
}

View File

@@ -4,17 +4,21 @@ import { CreateComponentType } from '@/packages/index.d'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export const includes = ['legend', 'xAxis', 'yAxis']
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
export const seriesItem = {
type: 'bar',
barWidth: null,
barWidth: 15,
label: {
show: true,
position: 'top',
color: '#fff',
fontSize: 12
},
itemStyle: {
color: null,
borderRadius: 0
borderRadius: 2
}
}
export const option = {
tooltip: {
show: true,
@@ -24,10 +28,7 @@ export const option = {
type: 'shadow'
}
},
legend: {
show: true
},
xAxis: {
xAxis: {
show: true,
type: 'category'
},

View File

@@ -1,25 +1,8 @@
<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>
</SettingItem>
<SettingItem>
<n-button size="small" @click="item.itemStyle.color = null">
恢复默认
</n-button>
</SettingItem>
<SettingItem name="宽度">
<n-input-number
v-model:value="item.barWidth"
@@ -30,24 +13,40 @@
></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({

View File

@@ -53,17 +53,21 @@ const option = computed(() => {
watch(
() => props.chartConfig.option.dataset,
(newData: { dimensions: any }, oldData) => {
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)
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 = []
})
}
replaceMergeArr.value = ['series']
props.chartConfig.option.series = seriesArr
nextTick(() => {
replaceMergeArr.value = []
})
} catch (error) {
console.log(error)
}
},
{

View File

@@ -4,17 +4,21 @@ import { CreateComponentType } from '@/packages/index.d'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export const includes = ['legend', 'xAxis', 'yAxis']
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
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,
@@ -24,12 +28,9 @@ export const option = {
type: 'shadow'
}
},
legend: {
show: true
},
xAxis: {
show: true,
type: 'value',
type: 'value'
},
yAxis: {
show: true,

View File

@@ -3,12 +3,6 @@
<global-setting :optionData="optionData"></global-setting>
<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>
</SettingItem>
<SettingItem>
<n-button size="small" @click="item.itemStyle.color = null">恢复默认</n-button>
</SettingItem>
<SettingItem name="宽度">
<n-input-number
v-model:value="item.barWidth"
@@ -26,6 +20,39 @@
></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>

View File

@@ -52,17 +52,21 @@ const option = computed(() => {
watch(
() => props.chartConfig.option.dataset,
(newData: { dimensions: any }, oldData) => {
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)
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 = []
})
}
replaceMergeArr.value = ['series']
props.chartConfig.option.series = seriesArr
nextTick(() => {
replaceMergeArr.value = []
})
} catch (error) {
console.log(error)
}
},
{

View File

@@ -0,0 +1,25 @@
import { PublicConfigClass } from '@/packages/public'
import { CapsuleChartConfig } from './index'
import { CreateComponentType } from '@/packages/index.d'
import { chartInitConfig } from '@/settings/designSetting'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export const option = {
dataset: dataJson,
colors: ['#c4ebad', '#6be6c1', '#a0a7e6', '#96dee8', '#3fb1e3' ],
unit: '',
itemHeight: 10,
valueFontSize: 16,
paddingRight: 50,
paddingLeft: 50,
showValue: true
}
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = CapsuleChartConfig.key
public attr = { ...chartInitConfig, zIndex: -1 }
public chartConfig = cloneDeep(CapsuleChartConfig)
public option = cloneDeep(option)
}

View File

@@ -0,0 +1,53 @@
<template>
<!-- Echarts 全局设置 -->
<global-setting :optionData="optionData"> </global-setting>
<!-- 胶囊柱图 -->
<collapse-item name="胶囊柱图" expanded>
<SettingItemBox name="布局">
<setting-item name="左侧边距">
<n-input-number v-model:value="optionData.paddingLeft" :min="10" :step="1" size="small"></n-input-number>
</setting-item>
<setting-item name="右侧边距">
<n-input-number v-model:value="optionData.paddingRight" :min="10" :step="1" size="small"></n-input-number>
</setting-item>
<setting-item name="每块高度(px)">
<n-input-number v-model:value="optionData.itemHeight" :min="0" :step="1" size="small"></n-input-number>
</setting-item>
</SettingItemBox>
<SettingItemBox name="文本">
<setting-item name="所有文字大小">
<n-input-number v-model:value="optionData.valueFontSize" :min="0" :step="1" size="small"></n-input-number>
</setting-item>
<setting-item name="单位">
<n-input v-model:value="optionData.unit" size="small"></n-input>
</setting-item>
<SettingItem>
<n-space>
<n-switch v-model:value="optionData.showValue" size="small"></n-switch>
<n-text>显示数值</n-text>
</n-space>
</SettingItem>
</SettingItemBox>
<SettingItemBox name="颜色">
<setting-item v-for="(item, index) in optionData.colors" :key="index" :name="`颜色${index}`">
<n-color-picker v-model:value="optionData.colors[index]" size="small" :modes="['hex']"></n-color-picker>
</setting-item>
</SettingItemBox>
</collapse-item>
</template>
<script setup lang="ts">
import { PropType, computed } from 'vue'
import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
import { option } from './config'
const props = defineProps({
optionData: {
type: Object as PropType<typeof option & GlobalThemeJsonType>,
required: true
}
})
</script>

View File

@@ -0,0 +1,10 @@
{
"dimensions": ["name", "value"],
"source": [
{ "name": "厦门", "value": 20 },
{ "name": "南阳", "value": 40 },
{ "name": "北京", "value": 60 },
{ "name": "上海", "value": 80 },
{ "name": "新疆", "value": 100 }
]
}

View File

@@ -0,0 +1,15 @@
import image from '@/assets/images/chart/charts/capsule.png'
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const CapsuleChartConfig: ConfigType = {
key: 'CapsuleChart',
chartKey: 'VCapsuleChart',
conKey: 'VCCapsuleChart',
title: '胶囊柱图',
category: ChatCategoryEnum.BAR,
categoryName: ChatCategoryEnumName.BAR,
package: PackagesCategoryEnum.CHARTS,
chartFrame: ChartFrameEnum.COMMON,
image
}

View File

@@ -0,0 +1,226 @@
<template>
<div
v-if="state.mergedConfig"
class="go-dv-capsule-chart"
:style="{
fontSize: numberSizeHandle(state.mergedConfig.valueFontSize),
paddingLeft: numberSizeHandle(state.mergedConfig.paddingLeft),
paddingRight: numberSizeHandle(state.mergedConfig.paddingRight)
}"
>
<div class="label-column">
<div
v-for="item in state.mergedConfig.dataset.source"
:key="item[state.mergedConfig.dataset.dimensions[0]]"
:style="{ height: state.capsuleItemHeight, lineHeight: state.capsuleItemHeight }"
>
{{ item[state.mergedConfig.dataset.dimensions[0]] }}
</div>
<div class="laset">&nbsp;</div>
</div>
<div class="capsule-container">
<div
v-for="(capsule, index) in state.capsuleLength"
:key="index"
class="capsule-item"
:style="{ height: state.capsuleItemHeight }"
>
<div
class="capsule-item-column"
:style="`width: ${capsule * 100}%; background-color: ${
state.mergedConfig.colors[index % state.mergedConfig.colors.length]
};height:calc(100% - ${2}px);`"
>
<div v-if="state.mergedConfig.showValue" class="capsule-item-value">
{{ state.capsuleValue[index] }}
</div>
</div>
</div>
<div class="unit-label">
<div v-for="(label, index) in state.labelData" :key="label + index">
{{ label }}
</div>
</div>
</div>
<div v-if="state.mergedConfig.unit" class="unit-text">
{{ state.mergedConfig.unit }}
</div>
</div>
</template>
<script setup lang="ts">
import { onMounted, watch, reactive, PropType } from 'vue'
import { useChartDataFetch } from '@/hooks'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import config, { option } from './config'
import cloneDeep from 'lodash/cloneDeep'
type DataProps = {
name: string | number
value: string | number
[key: string]: string | number
}
interface StateProps {
defaultConfig: {
dataset: {
dimensions: Array<string>
source: Array<DataProps>
}
colors: Array<string>
unit: string
showValue: boolean
itemHeight: number
valueFontSize: number
paddingLeft: number
paddingRight: number
}
mergedConfig: any
capsuleLength: Array<number>
capsuleValue: Array<string | Object>
labelData: Array<number>
capsuleItemHeight: string
}
const props = defineProps({
chartConfig: {
type: Object as PropType<config>,
default: () => ({})
}
})
const state = reactive<StateProps>({
defaultConfig: option,
mergedConfig: null,
capsuleLength: [],
capsuleValue: [],
labelData: [],
capsuleItemHeight: ''
})
watch(
() => props.chartConfig.option,
newVal => {
calcData(newVal)
},
{
deep: true
}
)
const calcData = (data: any) => {
mergeConfig(props.chartConfig.option)
calcCapsuleLengthAndLabelData()
}
const mergeConfig = (data: any) => {
state.mergedConfig = cloneDeep(data || {})
}
// 数据解析
const calcCapsuleLengthAndLabelData = () => {
const { source } = state.mergedConfig.dataset
if (!source.length) return
state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight)
const capsuleValue = source.map((item: DataProps) => item[state.mergedConfig.dataset.dimensions[1]])
const maxValue = Math.max(...capsuleValue)
state.capsuleValue = capsuleValue
state.capsuleLength = capsuleValue.map((v: any) => (maxValue ? v / maxValue : 0))
const oneFifth = maxValue / 5
const labelData = Array.from(new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth))))
state.labelData = labelData
}
const numberSizeHandle = (val: string | number) => {
return val + 'px'
}
onMounted(() => {
calcData(props.chartConfig.option)
})
// 预览
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
calcData(newData)
})
</script>
<style lang="scss" scoped>
@include go('dv-capsule-chart') {
position: relative;
display: flex;
flex-direction: row;
box-sizing: border-box;
padding: 20px;
padding-right: 50px;
color: #b9b8cc;
.label-column {
display: flex;
flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
padding-right: 10px;
text-align: right;
> div:not(:last-child) {
margin: 5px 0;
}
}
.capsule-container {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.capsule-item {
box-shadow: 0 0 3px #999;
height: 10px;
margin: 5px 0px;
border-radius: 5px;
.capsule-item-column {
position: relative;
height: 8px;
margin-top: 1px;
border-radius: 5px;
transition: all 0.3s;
display: flex;
justify-content: flex-end;
align-items: center;
.capsule-item-value {
padding-left: 10px;
transform: translateX(100%);
}
}
}
.unit-label {
height: 20px;
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
}
.unit-text {
text-align: right;
display: flex;
align-items: flex-end;
line-height: 20px;
margin-left: 10px;
}
}
</style>

View File

@@ -1,4 +1,5 @@
import { BarCommonConfig } from './BarCommon/index'
import { BarCrossrangeConfig } from './BarCrossrange/index'
import { CapsuleChartConfig } from './CapsuleChart/index'
export default [BarCommonConfig, BarCrossrangeConfig]
export default [BarCommonConfig, BarCrossrangeConfig, CapsuleChartConfig]

View File

@@ -2,19 +2,27 @@ import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { LineCommonConfig } from './index'
import { CreateComponentType } from '@/packages/index.d'
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export const includes = ['legend', 'xAxis', 'yAxis']
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
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,
itemStyle: {
color: null,
borderRadius: 0
}
color: null
}
}
@@ -26,9 +34,6 @@ export const option = {
type: 'line'
}
},
legend: {
show: true
},
xAxis: {
show: true,
type: 'category'
@@ -43,7 +48,7 @@ export const option = {
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = LineCommonConfig.key
public chartConfig = LineCommonConfig
public chartConfig = cloneDeep(LineCommonConfig)
// 图表配置项
public option = echartOptionProfixHandle(option, includes)
}

View File

@@ -1,12 +1,7 @@
<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="线条">
<SettingItem name="宽度">
<n-input-number
@@ -15,16 +10,48 @@
: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>
<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>
</CollapseItem>
</template>
@@ -32,12 +59,7 @@
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: {

View File

@@ -53,17 +53,21 @@ const option = computed(() => {
watch(
() => props.chartConfig.option.dataset,
(newData: { dimensions: any }, oldData) => {
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)
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 = []
})
}
replaceMergeArr.value = ['series']
props.chartConfig.option.series = seriesArr
nextTick(() => {
replaceMergeArr.value = []
})
} catch (error) {
console.log(error)
}
},
{

View File

@@ -3,9 +3,10 @@ import { LineGradientSingleConfig } from './index'
import { CreateComponentType } from '@/packages/index.d'
import { graphic } from 'echarts/core'
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export const includes = ['legend', 'xAxis', 'yAxis']
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
const options = {
tooltip: {
@@ -15,9 +16,6 @@ const options = {
type: 'line'
}
},
legend: {
show: true
},
xAxis: {
show: true,
type: 'category'
@@ -31,6 +29,13 @@ const options = {
{
type: 'line',
smooth: false,
symbolSize: 5, //设定实心点的大小
label: {
show: true,
position: 'top',
color: '#fff',
fontSize: 12
},
lineStyle: {
type: 'solid',
width: 3
@@ -54,7 +59,7 @@ const options = {
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = LineGradientSingleConfig.key
public chartConfig = LineGradientSingleConfig
public chartConfig = cloneDeep(LineGradientSingleConfig)
// 图表配置项
public option = echartOptionProfixHandle(options, includes)
}

View File

@@ -1,12 +1,7 @@
<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
@@ -18,13 +13,45 @@
></n-input-number>
</SettingItem>
<SettingItem name="类型">
<n-select
v-model:value="item.lineStyle.type"
size="small"
:options="lineConf.lineStyle.type"
></n-select>
<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>
</CollapseItem>
</template>
@@ -32,18 +59,13 @@
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(() => {

View File

@@ -43,23 +43,27 @@ const option = reactive({
watch(
() => chartEditStore.getEditCanvasConfig.chartThemeColor,
(newColor: keyof typeof chartColorsSearch) => {
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)'
}
])
})
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)
}
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
props.chartConfig.option = option.value
},
{
immediate: true
@@ -70,9 +74,6 @@ watch(
() => props.chartConfig.option.dataset,
() => {
option.value = props.chartConfig.option
},
{
deep: false
}
)

View File

@@ -3,14 +3,12 @@ import { LineGradientsConfig } from './index'
import { CreateComponentType } from '@/packages/index.d'
import { graphic } from 'echarts/core'
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export const includes = ['legend', 'xAxis', 'yAxis']
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
const option = {
legend: {
show: true
},
tooltip: {
show: true,
trigger: 'axis',
@@ -31,6 +29,13 @@ const option = {
{
type: 'line',
smooth: false,
symbolSize: 5, //设定实心点的大小
label: {
show: true,
position: 'top',
color: '#fff',
fontSize: 12
},
lineStyle: {
width: 3,
type: 'solid'
@@ -52,6 +57,12 @@ const option = {
{
type: 'line',
smooth: false,
label: {
show: true,
position: 'top',
color: '#fff',
fontSize: 12
},
lineStyle: {
width: 3,
type: 'solid'
@@ -75,7 +86,7 @@ const option = {
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = LineGradientsConfig.key
public chartConfig = LineGradientsConfig
public chartConfig = cloneDeep(LineGradientsConfig)
// 图表配置项
public option = echartOptionProfixHandle(option, includes)
}

View File

@@ -12,7 +12,6 @@
<n-input-number
v-model:value="item.lineStyle.width"
:min="1"
:max="100"
size="small"
placeholder="自动计算"
></n-input-number>
@@ -25,6 +24,50 @@
></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>

View File

@@ -42,23 +42,27 @@ const option = reactive({
watch(
() => chartEditStore.getEditCanvasConfig.chartThemeColor,
(newColor: keyof typeof chartColorsSearch) => {
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)'
}
])
})
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)
}
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
props.chartConfig.option = option.value
},
{
immediate: true
@@ -71,6 +75,5 @@ watch(
option.value = props.chartConfig.option
}
)
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
</script>

View File

@@ -2,9 +2,10 @@ import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { LineLinearSingleConfig } from './index'
import { CreateComponentType } from '@/packages/index.d'
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export const includes = ['legend', 'xAxis', 'yAxis']
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
export const option = {
tooltip: {
@@ -14,9 +15,6 @@ export const option = {
type: 'line'
}
},
legend: {
show: true
},
xAxis: {
show: true,
type: 'category'
@@ -29,6 +27,7 @@ export const option = {
series: [
{
type: 'line',
symbolSize: 5, //设定实心点的大小
lineStyle: {
type: 'solid',
width: 3,
@@ -56,7 +55,7 @@ export const option = {
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = LineLinearSingleConfig.key
public chartConfig = LineLinearSingleConfig
public chartConfig = cloneDeep(LineLinearSingleConfig)
// 图表配置项
public option = echartOptionProfixHandle(option, includes)
}

View File

@@ -39,6 +39,17 @@
></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

View File

@@ -43,17 +43,21 @@ const option = reactive({
watch(
() => chartEditStore.getEditCanvasConfig.chartThemeColor,
(newColor: keyof typeof chartColorsSearch) => {
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]
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]
})
})
})
}
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

View File

@@ -0,0 +1,83 @@
import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d'
import { MapAmapConfig } from './index'
import { chartInitConfig } from '@/settings/designSetting'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export enum ThemeEnum {
NORMAL = 'normal',
DARK = 'dark',
LIGHT = 'light',
WHITES_MOKE = 'whitesmoke',
FRESH = 'fresh',
GREY = 'grey',
GRAFFITI = 'graffiti',
MACARON = 'macaron',
BLUE = 'blue',
DARKBLUE = 'darkblue',
WINE = 'wine'
}
export enum LangEnum {
ZH_CN = 'zh_cn',
EN = 'en',
ZH_EN = 'zh_en'
}
export enum ViewModeEnum {
PLANE = '2D',
STEREOSCOPIC = '3D'
}
export enum FeaturesEnum {
BG = 'bg',
POINT = 'point',
ROAD = 'road',
BUILDING = 'building'
}
export enum MarkerEnum {
// 圆圈
CIRCLE_MARKER = 'CircleMarker',
// 定位标点
MARKER = 'Marker',
// 暂无
NONE = 'none'
}
export const option = {
dataset: dataJson,
mapOptions: {
pitch: 60,
skyColor: '#53A9DE',
amapKey: 'd5f3e16589dbecae64d05fe90e2ba4f2',
amapStyleKey: ThemeEnum.DARK,
amapStyleKeyCustom: '',
amapLon: 116.397428,
amapLat: 39.90923,
amapZindex: 11,
marker: {
fillColor: '#E98984FF',
fillOpacity: 0.5,
strokeColor: 'white',
strokeWeight: 2,
strokeOpacity: 0.5,
zIndex: 10,
bubble: true,
cursor: 'pointer',
clickable: true
},
mapMarkerType: MarkerEnum.CIRCLE_MARKER,
viewMode: ViewModeEnum.PLANE,
lang: LangEnum.ZH_CN,
features: [FeaturesEnum.BG, FeaturesEnum.POINT, FeaturesEnum.ROAD, FeaturesEnum.BUILDING]
}
}
export default class Config extends PublicConfigClass implements CreateComponentType {
public key = MapAmapConfig.key
public attr = { ...chartInitConfig, w: 1000, h: 800, zIndex: -1 }
public chartConfig = cloneDeep(MapAmapConfig)
public option = cloneDeep(option)
}

View File

@@ -0,0 +1,199 @@
<template>
<collapse-item name="基础" :expanded="true">
<setting-item-box name="语言类型" :alone="true">
<setting-item>
<n-select size="small" v-model:value="optionData.mapOptions.lang" :options="langOptions" />
</setting-item>
</setting-item-box>
<setting-item-box name="Key" :alone="true">
<setting-item name="请务必使用自己的高德应用 key">
<n-input v-model:value="optionData.mapOptions.amapKey" size="small"></n-input>
</setting-item>
</setting-item-box>
<setting-item-box name="自定义地图样式ID" :alone="true">
<setting-item>
<n-input size="small" v-model:value="optionData.mapOptions.amapStyleKeyCustom" />
</setting-item>
</setting-item-box>
</collapse-item>
<collapse-item name="地图" :expanded="true">
<setting-item-box name="主题">
<setting-item>
<n-select size="small" v-model:value="optionData.mapOptions.amapStyleKey" :options="themeOptions" />
</setting-item>
</setting-item-box>
<setting-item-box name="内容" :alone="true">
<n-checkbox-group v-model:value="optionData.mapOptions.features">
<n-space item-style="display: flex;">
<n-checkbox :value="item.value" :label="item.label" v-for="(item, index) in featuresOptions" :key="index" />
</n-space>
</n-checkbox-group>
</setting-item-box>
<setting-item-box name="位置">
<setting-item name="经度">
<n-input-number v-model:value="optionData.mapOptions.amapLon" :show-button="false" size="small">
<template #suffix>°</template>
</n-input-number>
</setting-item>
<setting-item name="纬度">
<n-input-number v-model:value="optionData.mapOptions.amapLat" :show-button="false" size="small">
<template #suffix>°</template>
</n-input-number>
</setting-item>
<setting-item name="初始缩放">
<n-input-number v-model:value="optionData.mapOptions.amapZindex" :min="0" size="small"></n-input-number>
</setting-item>
</setting-item-box>
<setting-item-box name="模式" :alone="true">
<setting-item>
<n-radio-group v-model:value="optionData.mapOptions.viewMode" name="radiogroup">
<n-space>
<n-radio v-for="song in viewModeOptions" :key="song.value" :value="song.value">
{{ song.label }}
</n-radio>
</n-space>
</n-radio-group>
</setting-item>
</setting-item-box>
<template v-if="optionData.mapOptions.viewMode === '3D'">
<setting-item-box>
<setting-item name="天空色">
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.mapOptions.skyColor"></n-color-picker>
</setting-item>
<setting-item name="俯仰角">
<n-input-number v-model:value="optionData.mapOptions.pitch" :min="0" :max="83" size="small"></n-input-number>
</setting-item>
</setting-item-box>
</template>
</collapse-item>
<collapse-item name="标记" :expanded="true">
<setting-item-box name="样式">
<setting-item name="类型">
<n-select size="small" v-model:value="optionData.mapOptions.mapMarkerType" :options="MarkerOptions" />
</setting-item>
<setting-item name="颜色">
<n-color-picker v-model:value="optionData.mapOptions.marker.fillColor" size="small"></n-color-picker>
</setting-item>
</setting-item-box>
</collapse-item>
</template>
<script setup lang="ts">
import { PropType } from 'vue'
import { option, MarkerEnum, ThemeEnum, LangEnum, ViewModeEnum, FeaturesEnum } from './config'
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
defineProps({
optionData: {
type: Object as PropType<typeof option>,
required: true
}
})
const themeOptions = [
{
value: ThemeEnum.NORMAL,
label: '标准'
},
{
value: ThemeEnum.DARK,
label: '幻影黑'
},
{
value: ThemeEnum.LIGHT,
label: '月光银'
},
{
value: ThemeEnum.WHITES_MOKE,
label: '远山黛'
},
{
value: ThemeEnum.FRESH,
label: '草色青'
},
{
value: ThemeEnum.GREY,
label: '雅士灰'
},
{
value: ThemeEnum.GRAFFITI,
label: '涂鸦'
},
{
value: ThemeEnum.MACARON,
label: '马卡龙'
},
{
value: ThemeEnum.BLUE,
label: '靛青蓝'
},
{
value: ThemeEnum.DARKBLUE,
label: '极夜蓝'
},
{
value: ThemeEnum.WINE,
label: '酱籽'
}
]
const langOptions = [
{
value: LangEnum.ZH_CN,
label: '中文简体'
},
{
value: LangEnum.EN,
label: '英文'
},
{
value: LangEnum.ZH_EN,
label: '中英文对照'
}
]
const viewModeOptions = [
{
value: ViewModeEnum.PLANE,
label: '2D'
},
{
value: ViewModeEnum.STEREOSCOPIC,
label: '3D'
}
]
const featuresOptions = [
{
value: FeaturesEnum.BG,
label: '显示地图背景'
},
{
value: FeaturesEnum.POINT,
label: '显示标识'
},
{
value: FeaturesEnum.ROAD,
label: '显示道路'
},
{
value: FeaturesEnum.BUILDING,
label: '显示建筑'
}
]
const MarkerOptions = [
{
value: MarkerEnum.CIRCLE_MARKER,
label: '圆形标点'
},
{
value: MarkerEnum.MARKER,
label: '定位标点'
},
{
value: MarkerEnum.NONE,
label: '隐藏标点'
}
]
</script>

View File

@@ -0,0 +1,19 @@
{
"markers": [
{
"name": "某某地市",
"value": 10,
"position": [116.300467, 39.907761]
},
{
"name": "某某地市",
"value": 15,
"position": [116.400567, 39.908761]
},
{
"name": "某某地市",
"value": 20,
"position": [116.200467, 39.937761]
}
]
}

View File

@@ -0,0 +1,15 @@
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import image from '@/assets/images/chart/charts/map_amap.png'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const MapAmapConfig: ConfigType = {
key: 'MapAmap',
chartKey: 'VMapAmap',
conKey: 'VCMapAmap',
title: '高德地图',
category: ChatCategoryEnum.MAP,
categoryName: ChatCategoryEnumName.MAP,
package: PackagesCategoryEnum.CHARTS,
chartFrame: ChartFrameEnum.COMMON,
image
}

View File

@@ -0,0 +1,130 @@
<template>
<div ref="vChartRef"></div>
</template>
<script setup lang="ts">
import { ref, PropType, toRefs, watch } from 'vue'
import AMapLoader from '@amap/amap-jsapi-loader'
import { CreateComponentType } from '@/packages/index.d'
import { useChartDataFetch } from '@/hooks'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { MarkerEnum } from './config'
import { isArray } from '@/utils'
const props = defineProps({
chartConfig: {
type: Object as PropType<CreateComponentType>,
required: true
}
})
let {
amapKey,
amapStyleKey,
amapLon,
amapLat,
amapZindex,
mapMarkerType,
lang,
amapStyleKeyCustom,
features,
viewMode,
pitch,
skyColor,
marker
} = toRefs(props.chartConfig.option.mapOptions)
let mapIns: any = null
let markers: any = []
let AMapIns: any = null
const vChartRef = ref<HTMLElement>()
const initMap = (newData: any) => {
// 初始化
AMapLoader.load({
key: amapKey.value, //api服务key--另外需要在public中使用安全密钥
version: '1.4.8', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
plugins: ['AMap.PlaceSearch', 'AMap.AutoComplete'] // 需要使用的的插件列表
})
.then(AMap => {
AMapIns = AMap
mapIns = new AMap.Map(vChartRef.value, {
resizeEnable: true,
zoom: amapZindex.value, // 地图显示的缩放级别
center: [amapLon.value, amapLat.value],
mapStyle: `amap://styles/${amapStyleKeyCustom.value !== '' ? amapStyleKeyCustom.value : amapStyleKey.value}`, //自定义地图的显示样式
lang: lang.value,
features: features.value,
pitch: pitch.value, // 地图俯仰角度,有效范围 0 度- 83 度
skyColor: skyColor.value,
viewMode: viewMode.value, // 地图模式
willReadFrequently: true
})
dataHandle(props.chartConfig.option.dataset)
})
.catch(e => {})
}
const dataHandle = (newData: any) => {
if (!mapIns && !AMapIns) {
initMap(props.chartConfig.option)
return
}
if (isArray(newData.markers)) {
// 先清除旧标记
mapIns.remove(markers)
markers = []
// 记录新标记
if (mapMarkerType.value === MarkerEnum.MARKER) {
newData.markers.forEach((markerItem: any) => {
const markerInstance = new AMapIns.Marker({
position: [markerItem.position[0], markerItem.position[1]],
offset: new AMapIns.Pixel(-13, -30)
})
markers.push(markerInstance)
markerInstance.setMap(mapIns)
})
} else if (mapMarkerType.value === MarkerEnum.CIRCLE_MARKER) {
newData.markers.forEach((markerItem: any) => {
const markerInstance = new AMapIns.CircleMarker({
center: [markerItem.position[0], markerItem.position[1]],
radius: markerItem.value,
...marker.value
})
markers.push(markerInstance)
markerInstance.setMap(mapIns)
})
}
}
}
const stopWatch = watch(
() => props.chartConfig.option.mapOptions,
option => {
initMap(option)
},
{
immediate: true,
deep: true
}
)
watch(
() => props.chartConfig.option.dataset,
newData => {
try {
dataHandle(newData)
} catch (error) {
console.log(error)
}
},
{
deep: false
}
)
// 预览
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
stopWatch()
dataHandle(newData)
})
</script>

View File

@@ -2,6 +2,7 @@ import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { MapBaseConfig } from './index'
import { chartInitConfig } from '@/settings/designSetting'
import { CreateComponentType } from '@/packages/index.d'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export const includes = []
@@ -151,6 +152,6 @@ export const MapDefaultConfig = { ...option }
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = MapBaseConfig.key
public attr = { ...chartInitConfig, w: 750, h: 800, zIndex: -1 }
public chartConfig = MapBaseConfig
public chartConfig = cloneDeep(MapBaseConfig)
public option = echartOptionProfixHandle(option, includes)
}

View File

@@ -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,8 +113,12 @@ watch(
watch(
() => props.chartConfig.option.mapRegion.showHainanIsLands,
async newData => {
await hainanLandsHandle(newData)
vEchartsSetOption()
try {
await hainanLandsHandle(newData)
vEchartsSetOption()
} catch (error) {
console.log(error)
}
},
{
deep: false
@@ -125,12 +129,16 @@ watch(
watch(
() => props.chartConfig.option.mapRegion.adcode,
async newData => {
await getGeojson(newData)
props.chartConfig.option.geo.map = newData
props.chartConfig.option.series.forEach((item: any) => {
if (item.type === 'map') item.map = newData
})
vEchartsSetOption()
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)
}
},
{
deep: false

View File

@@ -1,3 +1,4 @@
import { MapBaseConfig } from './MapBase/index'
import { MapAmapConfig } from './MapAmap/index'
export default [ MapBaseConfig ]
export default [MapBaseConfig, MapAmapConfig]

View File

@@ -4,7 +4,7 @@ import { CreateComponentType } from '@/packages/index.d'
import { cloneDeep } from 'lodash'
import dataJson from './data.json'
export const includes = ['xAxis', 'yAxis']
export const includes = ['xAxis', 'yAxis', 'grid']
export const option = {
dataset: { ...dataJson },

View File

@@ -75,7 +75,11 @@ const dataSetHandle = (dataset: typeof dataJson) => {
watch(
() => props.chartConfig.option.dataset,
newData => {
dataSetHandle(newData)
try {
dataSetHandle(newData)
} catch (error) {
console.log(error)
}
},
{
deep: false

View File

@@ -57,7 +57,11 @@ const option = shallowReactive({
watch(
() => props.chartConfig.option.dataset,
(newData: any) => {
option.dataset = toNumber(newData, 2)
try {
option.dataset = toNumber(newData, 2)
} catch (error) {
console.log(error)
}
},
{
deep: false

View File

@@ -57,7 +57,11 @@ const dataSetHandle = (dataset: typeof dataJson) => {
watch(
() => props.chartConfig.option.dataset,
newData => {
dataSetHandle(newData)
try {
dataSetHandle(newData)
} catch (error) {
console.log(error)
}
},
{
deep: false

View File

@@ -49,8 +49,12 @@ const dataSetHandle = (dataset: typeof dataJson) => {
watch(
() => props.chartConfig.option.dataset,
newData => {
if(!isArray(newData)) return
dataSetHandle(newData)
try {
if (!isArray(newData)) return
dataSetHandle(newData)
} catch (error) {
console.log(error)
}
},
{
deep: false

View File

@@ -42,23 +42,27 @@ const option = reactive({
watch(
() => chartEditStore.getEditCanvasConfig.chartThemeColor,
(newColor: keyof typeof chartColorsSearch) => {
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]
}
]
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)
}
option.value = props.chartConfig.option
},
{
immediate: true
@@ -75,7 +79,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
},

View File

@@ -1,6 +1,7 @@
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { PieCircleConfig } from './index'
import { CreateComponentType } from '@/packages/index.d'
import cloneDeep from 'lodash/cloneDeep'
export const includes = []
@@ -57,7 +58,7 @@ const option = {
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = PieCircleConfig.key
public chartConfig = PieCircleConfig
public chartConfig = cloneDeep(PieCircleConfig)
// 图表配置项
public option = echartOptionProfixHandle(option, includes)

View File

@@ -48,7 +48,13 @@ const dataHandle = (newData: any) => {
// 配置时
watch(
() => props.chartConfig.option.dataset,
newData => dataHandle(newData),
newData => {
try {
dataHandle(newData)
} catch (error) {
console.log(error)
}
},
{
immediate: true,
deep: false

View File

@@ -1,6 +1,7 @@
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { PieCommonConfig } from './index'
import { CreateComponentType } from '@/packages/index.d'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export const includes = ['legend']
@@ -42,7 +43,9 @@ const option = {
},
label: {
show: false,
position: 'center'
position: 'center',
formatter: '{b}',
fontSize:12
},
emphasis: {
label: {
@@ -61,7 +64,7 @@ const option = {
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = PieCommonConfig.key
public chartConfig = PieCommonConfig
public chartConfig = cloneDeep(PieCommonConfig)
// 图表配置项
public option = echartOptionProfixHandle(option, includes)

View File

@@ -7,6 +7,48 @@
<n-select v-model:value="optionData.type" size="small" :options="fontWeightOptions" />
</SettingItem>
</SettingItemBox>
<SettingItemBox name="标签">
<SettingItem>
<n-space>
<n-switch v-model:value="optionData.series[0].label.show" size="small"></n-switch>
<n-text>展示标签</n-text>
</n-space>
</SettingItem>
<setting-item>
<n-space>
<n-switch v-model:value="optionData.series[0].labelLine.show" size="small"></n-switch>
<n-text>引导线</n-text>
</n-space>
</setting-item>
<SettingItem name="位置">
<n-select v-model:value="optionData.series[0].label.position" size="small" :options="labelConfig.position" />
</SettingItem>
<setting-item name="展示类型">
<n-select v-model:value="optionData.series[0].label.formatter" size="small" :options="labelFormatterOptions" />
</setting-item>
</SettingItemBox>
<setting-item-box name="圆角">
<setting-item>
<n-space>
<n-input-number
v-model:value="optionData.series[0].itemStyle.borderRadius"
size="small"
:min="0"
></n-input-number>
<n-text>圆角大小</n-text>
</n-space>
</setting-item>
<setting-item>
<n-space>
<n-input-number
v-model:value="optionData.series[0].itemStyle.borderWidth"
size="small"
:min="0"
></n-input-number>
<n-text>线条宽度</n-text>
</n-space>
</setting-item>
</setting-item-box>
</CollapseItem>
</template>
@@ -15,6 +57,7 @@ import { PropType, watch } from 'vue'
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
import { PieTypeObject, PieTypeEnum } from './config'
import { labelConfig } from '@/packages/chartConfiguration/echarts'
const props = defineProps({
optionData: {
@@ -36,4 +79,10 @@ const fontWeightOptions = [
value: PieTypeObject[PieTypeEnum.ROSE]
}
]
const labelFormatterOptions = [
{ label: '数据名', value: '{b}' },
{ label: '百分比', value: '{d}' },
{ label: '列名:百分比', value: '{b}:{d}%' }
]
</script>

View File

@@ -39,15 +39,19 @@ const option = computed(() => {
watch(
() => props.chartConfig.option.type,
newData => {
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
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)
}
},
{ deep: false, immediate: true }

View File

@@ -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']
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
export const seriesItem = {
type: 'scatter',

View File

@@ -69,17 +69,21 @@ const option = computed(() => {
watch(
() => props.chartConfig.option.dataset,
(newData, oldData) => {
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 = []
})
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)
}
},
{

View File

@@ -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']
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
export const option = {
dataset: dataJson,

View File

@@ -3,7 +3,7 @@ import { CreateComponentType } from '@/packages/index.d'
import { CountDownConfig } from './index'
import cloneDeep from 'lodash/cloneDeep'
import { chartInitConfig } from '@/settings/designSetting'
import { FlipType } from '@/components/Flipper'
import { FlipType } from '@/components/Pages/Flipper'
type STYLE = '时分秒' | '冒号'

View File

@@ -76,7 +76,7 @@
<script setup lang="ts">
import { PropType, toRefs, watch, ref, onMounted } from 'vue'
import { CreateComponentType } from '@/packages/index.d'
import { Flipper } from '@/components/Flipper'
import { Flipper } from '@/components/Pages/Flipper'
import { OptionType } from './config'
import { CountdownInst, CountdownProps } from 'naive-ui/es/countdown/src/Countdown'
@@ -133,10 +133,14 @@ const renderCountdown: CountdownProps['render'] = ({ hours, minutes, seconds })
}
const updateTotalDuration = () => {
countdownActive.value = false
totalDuration.value = useEndDate.value ? endDate.value - new Date().getTime() : dataset.value * 1000
countdownRef.value?.reset && countdownRef.value?.reset()
countdownActive.value = true
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)
}
}
watch(

View File

@@ -3,7 +3,7 @@ import { CreateComponentType } from '@/packages/index.d'
import { FlipperNumberConfig } from './index'
import cloneDeep from 'lodash/cloneDeep'
import { chartInitConfig } from '@/settings/designSetting'
import { FlipType } from '@/components/Flipper'
import { FlipType } from '@/components/Pages/Flipper'
export interface OptionType {
dataset: number | string

View File

@@ -6,7 +6,7 @@ export const FlipperNumberConfig: ConfigType = {
key: 'FlipperNumber',
chartKey: 'VFlipperNumber',
conKey: 'VCFlipperNumber',
title: '数字翻牌',
title: '数字翻牌-需动态触发',
category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.DECORATES,

View File

@@ -21,7 +21,7 @@ import { PropType, toRefs, watch, ref } from 'vue'
import { CreateComponentType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { useChartDataFetch } from '@/hooks'
import { Flipper } from '@/components/Flipper'
import { Flipper } from '@/components/Pages/Flipper'
import { OptionType } from './config'
const props = defineProps({
@@ -60,7 +60,11 @@ const updateDatasetHandler = (newVal: string | number) => {
watch(
() => props.chartConfig.option,
newVal => {
updateDatasetHandler((newVal as OptionType).dataset)
try {
updateDatasetHandler((newVal as OptionType).dataset)
} catch (error) {
console.log(error)
}
},
{
immediate: true,

View File

@@ -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,54 +39,55 @@ let {
hShadow,
vShadow,
blurShadow,
colorShadow,
} = toRefs(props.chartConfig.option);
colorShadow
} = toRefs(props.chartConfig.option)
watch(
props.chartConfig.option,
() => {
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";
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)
}
},
{
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>

View File

@@ -0,0 +1,236 @@
// 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)
/*计算第二次旋转的四元数*/
// middleV3startSphereXOY和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 }

View File

@@ -0,0 +1,137 @@
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)
}

View File

@@ -0,0 +1,4 @@
export interface IEvents {
resize: () => void
}

View File

@@ -0,0 +1,6 @@
export interface IWord {
dom: HTMLElement
data: any
width: number
height: number
}

View File

@@ -0,0 +1,23 @@
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 );
}

View File

@@ -0,0 +1,12 @@
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 );
}

View File

@@ -0,0 +1,34 @@
/**
* 资源文件
* 把模型和图片分开进行加载
*/
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 }

View File

@@ -0,0 +1,62 @@
/**
* 创建 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
}
}

View File

@@ -0,0 +1,496 @@
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
}
})
}
}
}

Some files were not shown because too many files have changed in this diff Show More