更新1.2.0
Squashed commit of the following: commit f6c4e5c18170f5699a680113c5591b80833548d8 Author: Sun <95302870@qq.com> Date: Wed Dec 27 17:33:49 2023 +0800 更新正式版本1.2.0 commit ebf493d6b1da02dd516a2cb5d0f61f70aaab242f Author: Sun <95302870@qq.com> Date: Tue Dec 26 15:43:32 2023 +0800 增加通过后端获取网站图标 commit 2462b364c2dca3648ea79a32d9305a8df86402b8 Author: Sun <95302870@qq.com> Date: Tue Dec 26 13:21:16 2023 +0800 优化导出导出提示语 commit 71f7cbb48ddc2c7c660f6cd57579422e99195fe1 Author: Sun <95302870@qq.com> Date: Tue Dec 26 13:15:45 2023 +0800 加载图片增加loading commit 546ad3c93e935262ee5959be075371127343b663 Author: Sun <95302870@qq.com> Date: Tue Dec 26 12:45:11 2023 +0800 优化文件管理返回的路径带有.的问题 commit 322c3f01cd0fbc2b21bd1e12f07d069a9dbc031e Author: Sun <95302870@qq.com> Date: Tue Dec 26 12:29:42 2023 +0800 修复 commit 8a718378a843bdd78d43b42ddd987ce5b1741000 Author: Sun <95302870@qq.com> Date: Wed Dec 20 13:44:28 2023 +0800 更新说明文件 commit 9295bd6e7b2d05c469d8b9123aadfb3dbb90499c Author: Sun <95302870@qq.com> Date: Wed Dec 20 11:51:57 2023 +0800 更新1.2.0-beta23-12-20 commit 17d61f1694131890d56e27f5dcde9f901a624452 Merge: 9697541 9e53e74 Author: Sun <95302870@qq.com> Date: Wed Dec 20 11:32:16 2023 +0800 Merge branch 'dev' of https://github.com/hslr-s/sun-panel into dev commit 9e53e74ea6bfcd92a1719256e8f37536fa20893d Author: 红烧猎人 <38825747+hslr-s@users.noreply.github.com> Date: Wed Dec 20 11:29:34 2023 +0800 Create LICENSE commit 9697541da670d84b5fca11283741296e389ed99f Author: Sun <95302870@qq.com> Date: Wed Dec 20 11:23:20 2023 +0800 增加编辑模式点击图标修改图标数据 commit a6045d78476e4e6dae3ed9377ed8aa2df72b9bed Author: Sun <95302870@qq.com> Date: Wed Dec 20 11:11:51 2023 +0800 优化添加图标的时候增加loading避免多次点击并添加 commit 1e8ae7a65dbad44a79a8eae1ec167883beb790dc Author: Sun <95302870@qq.com> Date: Wed Dec 20 10:53:31 2023 +0800 修改配置文件更改上传文件夹,路由没有监听的bug commit e21185e29ac8e90ef6b953f45824e8d0802d13c0 Author: Sun <95302870@qq.com> Date: Wed Dec 20 10:52:56 2023 +0800 优化内置app的文字说明 commit 266a8191ecfe356d936b79115da80a2a61fc57c9 Author: Sun <95302870@qq.com> Date: Tue Dec 19 20:46:38 2023 +0800 重新调整各个内置应用的样式适配app启动器 commit f9f9ebe9d2f23971c7dfd17740481b141111508e Author: Sun <95302870@qq.com> Date: Tue Dec 19 20:45:57 2023 +0800 升级naive-ui到2.36.0版本 commit 0c4ff7ca23202f35e5b72b5f2ec3a2b690b6926e Author: Sun <95302870@qq.com> Date: Tue Dec 19 16:50:38 2023 +0800 登录时账号首尾去空格 commit b55da5a3060f38581ff78cc85bd2de27b6c2ede3 Author: Sun <95302870@qq.com> Date: Tue Dec 19 12:07:01 2023 +0800 完成上传文件管理器 commit 6355b9f826e6e8882b87fc2aef80960fcdd8e752 Author: Sun <95302870@qq.com> Date: Tue Dec 19 11:44:12 2023 +0800 修改配置同步云端为保存 commit c3d2dd9b28d05ec7b07574721c8e473add67d9d3 Author: Sun <95302870@qq.com> Date: Tue Dec 19 11:43:21 2023 +0800 基础完成上传文件管理 commit 775c98a3cca3135e14fac24ac09af756b01f4ba5 Author: Sun <95302870@qq.com> Date: Mon Dec 18 22:08:50 2023 +0800 增加上传文件管理的内置应用 commit 79780faa6b52c48a506b78322e5499ccfaee4b47 Author: Sun <95302870@qq.com> Date: Mon Dec 18 13:45:06 2023 +0800 开发文件删除和文件列表 commit 3d2eac74ef32612334e6700a5a1c65e72ed5495f Author: Sun <95302870@qq.com> Date: Sun Dec 17 20:01:48 2023 +0800 修改启动后输出生成配置文件的错误级别 commit 083a34cdd8d3b713dfbaf193708cedaa5a9aadc6 Author: Sun <95302870@qq.com> Date: Sun Dec 17 17:17:52 2023 +0800 修复恢复默认背景色无效的问题 commit a933d5fd2f245c1df007dd7904f02178634b2d5f Author: Sun <95302870@qq.com> Date: Sun Dec 17 16:40:25 2023 +0800 优化 图标编辑组件并增加根据网址url提取图标 commit 2cd5c1ca60cc8310c361c6e49125eda96f8e1e59 Author: Sun <95302870@qq.com> Date: Sat Dec 16 21:48:41 2023 +0800 增加ico文件上传支持 commit 7b8bd203bdb2fd98db72e7058ee701ff9b1eb7ed Author: Sun <95302870@qq.com> Date: Sat Dec 16 21:23:54 2023 +0800 优化窗口尺寸 commit 7191817d3fd3c3c1ac33d30be9cebbbf719be3e1 Author: Sun <95302870@qq.com> Date: Sat Dec 16 21:16:38 2023 +0800 启动器左侧菜单根据屏幕自动伸缩 commit a060982fc368c86f44bb639a124fd4a209c4ebb8 Author: Sun <95302870@qq.com> Date: Sat Dec 16 21:12:54 2023 +0800 排序模式禁用左右键点击 commit 6a8b8b5effbc5c4f3866038d8bf547193352d028 Author: Sun <95302870@qq.com> Date: Sat Dec 16 13:47:25 2023 +0800 全新图标排序方式,减少首页全局按钮 Squashed commit of the following: commit f2ae66b7539e84f7f88fb739150775d2d4fd0107 Author: Sun <95302870@qq.com> Date: Sat Dec 16 13:45:46 2023 +0800 优化添加图标的方式和编辑弹窗的添加编辑逻辑 commit 09a89002274b693bbf4cc1c25bd50f8791a5d3b4 Author: Sun <95302870@qq.com> Date: Fri Dec 15 21:12:34 2023 +0800 优化保存排序 commit 08cb6f53ef448dcfb0858b329656eba48265f6e4 Author: Sun <95302870@qq.com> Date: Fri Dec 15 21:04:09 2023 +0800 取消全局排序模式,组单独排序 commit 080926d28bc4c15796d4fe956e6f865a9ac505d4 Author: Sun <95302870@qq.com> Date: Fri Dec 15 17:26:45 2023 +0800 重新调整图标显示 commit 1eb5a712c2917a0f35897a6444b5643a3eb0d809 Author: Sun <95302870@qq.com> Date: Fri Dec 15 13:38:30 2023 +0800 增加分组hover状态监听 commit 1ef17b5e8f754c2d5397466c9a82a23618f2b15f Author: Sun <95302870@qq.com> Date: Thu Dec 14 22:27:36 2023 +0800 解决旧版本升级导致刷新后丢失登录的问题 commit 56929001842242d99a8ea061fd663c99ad4ed2f5 Author: Sun <95302870@qq.com> Date: Thu Dec 14 13:44:35 2023 +0800 更新1.2.0-beta23-12-14 commit a1c7e98104f9a3939392452c8b5be62d69df97b4 Author: Sun <95302870@qq.com> Date: Thu Dec 14 13:43:35 2023 +0800 优化部分提示内容以及构建的测试 commit 62ca5f88bcad032082941752508299b05cdd3a3e Author: Sun <95302870@qq.com> Date: Thu Dec 14 12:47:25 2023 +0800 优化手机端时钟样式 commit a2ef23fdf867dfb007e3689e2cdf264f08597f37 Author: Sun <95302870@qq.com> Date: Thu Dec 14 12:22:19 2023 +0800 增加快捷图标搜索的开关 commit a41980331b6c9ca9ca3b34e6bfb4198bcb09c05a Author: Sun <95302870@qq.com> Date: Thu Dec 14 11:52:52 2023 +0800 优化代码 commit aee0329a8fcdc8459681e499ffe08c4191acb28b Author: Sun <95302870@qq.com> Date: Thu Dec 14 11:06:32 2023 +0800 更换设置组件为app启动器,增加内置应用的概念 Squashed commit of the following: commit a5e40ae3ccce65eb3208474dbc0fdd9850146195 Author: Sun <95302870@qq.com> Date: Thu Dec 14 11:04:39 2023 +0800 删除设置设置等组件完成替换app启动器 commit c2aedae0862abdbe2bafabfb46a1aafdc30fe3a2 Author: Sun <95302870@qq.com> Date: Thu Dec 14 10:48:20 2023 +0800 迁移设置的内置应用到组件apps,增加app启动器 commit adcabcc46fe4fee4a094250a78d2b1f0b1e012ba Author: Sun <95302870@qq.com> Date: Wed Dec 13 23:13:44 2023 +0800 完成新的设置功能 commit b1193e2252c69bd9bfb697ea587d706ccebf9346 Author: Sun <95302870@qq.com> Date: Wed Dec 13 20:05:02 2023 +0800 初步完成了设置组件的升级版本 commit f35223f40be4a575c89622427debeecad18d09cb Author: Sun <95302870@qq.com> Date: Sun Dec 10 18:45:23 2023 +0800 更换dockerfile基础镜像 Squashed commit of the following: commit bd722767ba695059e610d60597a1836708f0e300 Author: Sun <95302870@qq.com> Date: Sun Dec 10 17:56:33 2023 +0800 更换后端alpine基础镜像3.18旧版本,新版本导致sqlite3报错 commit e5a2855e3206bd86b5b800fbcf0c8b97da8feca9 Author: Sun <95302870@qq.com> Date: Sun Dec 10 14:38:21 2023 +0800 后端 尝试升级sqlite解决编译失败的问题 commit e1789e93dc25b678685405fd31163a08c6c5871a Author: Sun <95302870@qq.com> Date: Sun Dec 10 13:43:56 2023 +0800 尝试修改go.mod 版本号排查问题 commit f80eea9283741ff6344dabc0f355ee14b8b271e3 Author: Sun <95302870@qq.com> Date: Sun Dec 10 13:30:19 2023 +0800 调试编译错误 commit f1596cc7351ca998e3a00e2876c62466485b2a2c Author: Sun <95302870@qq.com> Date: Sun Dec 10 13:23:12 2023 +0800 增加编译调试信息 commit 314b81646247c3e453501754fc57650a3ed1d7c0 Author: Sun <95302870@qq.com> Date: Sun Dec 10 13:11:22 2023 +0800 取消golang国内镜像尝试,编译镜像 commit 809e4ab700cdf248027834441517fe005276bfa7 Author: Sun <95302870@qq.com> Date: Sun Dec 10 10:58:50 2023 +0800 更新1.2.0-beta23-12-10 Squashed commit of the following: commit ba962f6e7f9d45825f358ffe129e677bdf513c3e Author: Sun <95302870@qq.com> Date: Sun Dec 10 10:57:40 2023 +0800 更新1.2.0-beta23-12-10 commit f9c9d442dd1abe16eb5f2a3b5ffbda35a0a42858 Author: Sun <95302870@qq.com> Date: Sun Dec 10 10:57:21 2023 +0800 优化导入文件筛选类型 commit 0f103b87ec5581088cd521786d032cff5cf3ba58 Author: Sun <95302870@qq.com> Date: Sun Dec 10 10:38:09 2023 +0800 编译前的优化 commit 380575f5b23483bb5b31273a2578605aa32e9da9 Author: Sun <95302870@qq.com> Date: Sat Dec 9 23:31:33 2023 +0800 解决并发请求导致两个默认分组的bug commit 09ee3e4cfb282b059e28e7f56c3549d0b209ecbd Author: Sun <95302870@qq.com> Date: Sat Dec 9 22:28:40 2023 +0800 增加导入导出图标 Squashed commit of the following: commit b4a755aaf6eff6665866c1f08441f42a296ec81f Author: Sun <95302870@qq.com> Date: Sat Dec 9 22:18:49 2023 +0800 导出导入完成 commit 7be0436b18e1fee1c33013e27cadc838071b86a9 Author: Sun <95302870@qq.com> Date: Sat Dec 9 21:24:23 2023 +0800 增加批量添加图标接口 commit 96e15348aea83a0e0c9420c7182f7448f9482b10 Author: Sun <95302870@qq.com> Date: Sat Dec 9 21:23:55 2023 +0800 导入导出图标完成 commit 3fd4d29a4c6c1cc3090f1f5bbc6a1154a8923bbb Author: Sun <95302870@qq.com> Date: Sat Dec 9 20:00:57 2023 +0800 优化代码加入相关loading commit 2938eea93601ae1df92842f1f02f7471e0f0e85d Author: Sun <95302870@qq.com> Date: Sat Dec 9 19:17:53 2023 +0800 完成基础的导出,支持跨模块 commit 4c96702cd449bf7a6224cb2d6aa5117de75f24fd Author: Sun <95302870@qq.com> Date: Sat Dec 9 14:58:49 2023 +0800 初步完成导出导入工具和测试 commit 45bf44f3588df302ebaf7cf13cb15bb6a2b50d2a Author: Sun <95302870@qq.com> Date: Fri Dec 8 21:19:00 2023 +0800 更换本地化svg图标显示方案 Squashed commit of the following: commit e0241985b55fa39145abd2c468735bdf5182d57e Author: Sun <95302870@qq.com> Date: Fri Dec 8 21:04:06 2023 +0800 更换直接使用本地svg的方案 commit d20e11cd303240a6fdbce66a94c45956a28a175d Merge: 67023d0 f0e4257 Author: Sun <95302870@qq.com> Date: Fri Dec 8 16:22:19 2023 +0800 Merge branch 'dev' into feature/icon commit 67023d0ce494b46460729cf39a45af8c9fd10124 Author: Sun <95302870@qq.com> Date: Fri Dec 8 12:17:45 2023 +0800 修改原图标组件为在线图标组件 commit 379441c869489fdf44cb92a0cace75f9e5318915 Author: Sun <95302870@qq.com> Date: Fri Dec 8 12:14:59 2023 +0800 适配本地化图标 commit da6feaa655e792d176f56777e089393f7658eda2 Author: Sun <95302870@qq.com> Date: Fri Dec 8 12:14:07 2023 +0800 图标本地化 commit 02d84f66069653dedfc35578b1b26dad6edac0e3 Author: Sun <95302870@qq.com> Date: Thu Dec 7 23:09:41 2023 +0800 增加离线图标库(源svgicon组件)的兼容并增加在线图标库组件 commit f0e425737217083668a00212dba5f7e82cab9a02 Author: Sun <95302870@qq.com> Date: Fri Dec 8 13:16:42 2023 +0800 删除暂时无用语言包 commit 60983b94d8e50be08fb233b111b1008c22f86acc Author: Sun <95302870@qq.com> Date: Fri Dec 8 13:15:03 2023 +0800 删除无用文件 commit ba962f6e7f9d45825f358ffe129e677bdf513c3e Author: Sun <95302870@qq.com> Date: Sun Dec 10 10:57:40 2023 +0800 更新1.2.0-beta23-12-10 commit f9c9d442dd1abe16eb5f2a3b5ffbda35a0a42858 Author: Sun <95302870@qq.com> Date: Sun Dec 10 10:57:21 2023 +0800 优化导入文件筛选类型 commit 0f103b87ec5581088cd521786d032cff5cf3ba58 Author: Sun <95302870@qq.com> Date: Sun Dec 10 10:38:09 2023 +0800 编译前的优化 commit 380575f5b23483bb5b31273a2578605aa32e9da9 Author: Sun <95302870@qq.com> Date: Sat Dec 9 23:31:33 2023 +0800 解决并发请求导致两个默认分组的bug commit 09ee3e4cfb282b059e28e7f56c3549d0b209ecbd Author: Sun <95302870@qq.com> Date: Sat Dec 9 22:28:40 2023 +0800 增加导入导出图标 Squashed commit of the following: commit b4a755aaf6eff6665866c1f08441f42a296ec81f Author: Sun <95302870@qq.com> Date: Sat Dec 9 22:18:49 2023 +0800 导出导入完成 commit 7be0436b18e1fee1c33013e27cadc838071b86a9 Author: Sun <95302870@qq.com> Date: Sat Dec 9 21:24:23 2023 +0800 增加批量添加图标接口 commit 96e15348aea83a0e0c9420c7182f7448f9482b10 Author: Sun <95302870@qq.com> Date: Sat Dec 9 21:23:55 2023 +0800 导入导出图标完成 commit 3fd4d29a4c6c1cc3090f1f5bbc6a1154a8923bbb Author: Sun <95302870@qq.com> Date: Sat Dec 9 20:00:57 2023 +0800 优化代码加入相关loading commit 2938eea93601ae1df92842f1f02f7471e0f0e85d Author: Sun <95302870@qq.com> Date: Sat Dec 9 19:17:53 2023 +0800 完成基础的导出,支持跨模块 commit 4c96702cd449bf7a6224cb2d6aa5117de75f24fd Author: Sun <95302870@qq.com> Date: Sat Dec 9 14:58:49 2023 +0800 初步完成导出导入工具和测试 commit 45bf44f3588df302ebaf7cf13cb15bb6a2b50d2a Author: Sun <95302870@qq.com> Date: Fri Dec 8 21:19:00 2023 +0800 更换本地化svg图标显示方案 Squashed commit of the following: commit e0241985b55fa39145abd2c468735bdf5182d57e Author: Sun <95302870@qq.com> Date: Fri Dec 8 21:04:06 2023 +0800 更换直接使用本地svg的方案 commit d20e11cd303240a6fdbce66a94c45956a28a175d Merge: 67023d0 f0e4257 Author: Sun <95302870@qq.com> Date: Fri Dec 8 16:22:19 2023 +0800 Merge branch 'dev' into feature/icon commit 67023d0ce494b46460729cf39a45af8c9fd10124 Author: Sun <95302870@qq.com> Date: Fri Dec 8 12:17:45 2023 +0800 修改原图标组件为在线图标组件 commit 379441c869489fdf44cb92a0cace75f9e5318915 Author: Sun <95302870@qq.com> Date: Fri Dec 8 12:14:59 2023 +0800 适配本地化图标 commit da6feaa655e792d176f56777e089393f7658eda2 Author: Sun <95302870@qq.com> Date: Fri Dec 8 12:14:07 2023 +0800 图标本地化 commit 02d84f66069653dedfc35578b1b26dad6edac0e3 Author: Sun <95302870@qq.com> Date: Thu Dec 7 23:09:41 2023 +0800 增加离线图标库(源svgicon组件)的兼容并增加在线图标库组件 commit f0e425737217083668a00212dba5f7e82cab9a02 Author: Sun <95302870@qq.com> Date: Fri Dec 8 13:16:42 2023 +0800 删除暂时无用语言包 commit 60983b94d8e50be08fb233b111b1008c22f86acc Author: Sun <95302870@qq.com> Date: Fri Dec 8 13:15:03 2023 +0800 删除无用文件 commit 2f0b230812834ed306749a9c2f65bdcdfbda6dd6 Author: Sun <95302870@qq.com> Date: Fri Dec 8 12:19:11 2023 +0800 图标本地化处理 Squashed commit of the following: commit 67023d0ce494b46460729cf39a45af8c9fd10124 Author: Sun <95302870@qq.com> Date: Fri Dec 8 12:17:45 2023 +0800 修改原图标组件为在线图标组件 commit 379441c869489fdf44cb92a0cace75f9e5318915 Author: Sun <95302870@qq.com> Date: Fri Dec 8 12:14:59 2023 +0800 适配本地化图标 commit da6feaa655e792d176f56777e089393f7658eda2 Author: Sun <95302870@qq.com> Date: Fri Dec 8 12:14:07 2023 +0800 图标本地化 commit 02d84f66069653dedfc35578b1b26dad6edac0e3 Author: Sun <95302870@qq.com> Date: Thu Dec 7 23:09:41 2023 +0800 增加离线图标库(源svgicon组件)的兼容并增加在线图标库组件 commit 524230b66a7d6657b375ef0ce418b9c5332871e4 Author: Sun <95302870@qq.com> Date: Thu Dec 7 14:58:23 2023 +0800 修改自动构建文件版本号的问题 commit c03be7e4fee8c9b27ae2db3d1d6f72d211877bbf Author: Sun <95302870@qq.com> Date: Thu Dec 7 14:07:03 2023 +0800 解决偶然出现刷新页面后登录失效的问题 commit a48c6eefa843b6b739f17cc30617ec95d78d7bc7 Author: Sun <95302870@qq.com> Date: Thu Dec 7 11:16:11 2023 +0800 修复 账号管理页面语言包未适配的问题 commit 1392a5d9355b9e54da92891ebe312709e486618c Author: Sun <95302870@qq.com> Date: Thu Dec 7 00:26:21 2023 +0800 编译增加musl的amd64版本 commit ee49f4fef6aed5f7afedad995058724bffc7e38f Author: Sun <95302870@qq.com> Date: Wed Dec 6 16:22:45 2023 +0800 1.2.0-beta23-12-6编译前修正 commit ba13f996592749a60a2f676d03fa6e1d6b512f84 Merge: 4e4c6c2 e393366 Author: Sun <95302870@qq.com> Date: Wed Dec 6 15:55:37 2023 +0800 Merge branch 'dev' into feature/visitor commit e39336653c30bbaadcaeba327186e6ca3a4eab2b Author: Sun <95302870@qq.com> Date: Wed Dec 6 15:55:21 2023 +0800 重新适配新版国际化文件 commit 54aa74d3165169d5d745affe27a5d0aaf46b9f0d Author: Sun <95302870@qq.com> Date: Wed Dec 6 15:54:08 2023 +0800 修复创建用户无法保存成功昵称 commit 484fe270f88fdfb1d7e97c7a5ce22ecf5ba6af7f Author: Sun <95302870@qq.com> Date: Wed Dec 6 15:53:23 2023 +0800 修改 密码增加成功提示 commit 29a100a7971424b86fbff7b3650e06eed5904b7b Author: Sun <95302870@qq.com> Date: Wed Dec 6 15:38:16 2023 +0800 增加修改密码和修改昵称的功能 设置的账号信息页面国际化适配 commit 99e9365a1ba9d4c0aaabe6e4ba0b6b704bda0c63 Author: Sun <95302870@qq.com> Date: Wed Dec 6 15:29:38 2023 +0800 修改配置文件默认端口提示 commit 8c1a0d6d90fcdfb61916052040664ab42ac74b33 Author: Sun <95302870@qq.com> Date: Tue Dec 5 21:33:39 2023 +0800 增加上下边距百分比调整 commit 4e4c6c27817cc2bc038f156267caaec6233f52d2 Merge: 8a3ff34 0231d76 Author: Sun <95302870@qq.com> Date: Tue Dec 5 15:53:20 2023 +0800 Merge branch 'dev' into feature/visitor commit 0231d76d7a913bd1284bd3b9d98677aad4cf844c Author: Sun <95302870@qq.com> Date: Tue Dec 5 15:10:37 2023 +0800 公开模式隐藏右键中的敏感菜单 commit 3560f8f1859f3408c1837c4215255da933807e4e Author: Sun <95302870@qq.com> Date: Tue Dec 5 15:05:39 2023 +0800 修改语法,改为对象传值法 commit 2ec1277cf0a18716356e59de40e4d0078b054883 Author: Sun <95302870@qq.com> Date: Mon Dec 4 20:50:20 2023 +0800 初步测试完成访客模式 Squashed commit of the following: commit 8a3ff3477d9a6c388b0750d6011ba3c7a74442da Author: Sun <95302870@qq.com> Date: Mon Dec 4 20:47:44 2023 +0800 访客模式基本完成 commit b067b20c4377ca1fc9fd303feece815a7b0c6303 Author: Sun <95302870@qq.com> Date: Mon Dec 4 16:43:12 2023 +0800 适配访客模式 commit ed6dcdf4192bb9aa95cac2eabb65aff369f93bb4 Author: Sun <95302870@qq.com> Date: Mon Dec 4 14:17:51 2023 +0800 调整auth store并优化auth使用逻辑 commit be92c33496e59b5e8e187bec952d1fccb63ef08b Author: Sun <95302870@qq.com> Date: Sun Dec 3 21:47:43 2023 +0800 优化登录接口不返回密码等数据 commit e75a02071de8d11311c87de97378bf2a361512f9 Author: Sun <95302870@qq.com> Date: Sun Dec 3 21:08:51 2023 +0800 初步完成访客模式 commit c6805c99f5decaf204e9d3958914338649c9e9e6 Author: Sun <95302870@qq.com> Date: Sat Dec 2 22:26:08 2023 +0800 增加访客模式的获取和设置接口 commit 8a3ff3477d9a6c388b0750d6011ba3c7a74442da Author: Sun <95302870@qq.com> Date: Mon Dec 4 20:47:44 2023 +0800 访客模式基本完成 commit b067b20c4377ca1fc9fd303feece815a7b0c6303 Author: Sun <95302870@qq.com> Date: Mon Dec 4 16:43:12 2023 +0800 适配访客模式 commit ed6dcdf4192bb9aa95cac2eabb65aff369f93bb4 Author: Sun <95302870@qq.com> Date: Mon Dec 4 14:17:51 2023 +0800 调整auth store并优化auth使用逻辑 commit be92c33496e59b5e8e187bec952d1fccb63ef08b Author: Sun <95302870@qq.com> Date: Sun Dec 3 21:47:43 2023 +0800 优化登录接口不返回密码等数据 commit e75a02071de8d11311c87de97378bf2a361512f9 Author: Sun <95302870@qq.com> Date: Sun Dec 3 21:08:51 2023 +0800 初步完成访客模式 commit c6805c99f5decaf204e9d3958914338649c9e9e6 Author: Sun <95302870@qq.com> Date: Sat Dec 2 22:26:08 2023 +0800 增加访客模式的获取和设置接口 commit d81c86e23e272a654eb4af218891676b3d7835bf Author: Sun <95302870@qq.com> Date: Sat Dec 2 15:24:42 2023 +0800 搜索框增加清空搜索内容按钮并国际化支持 commit 1223502a9311393fbfa326f4adf9e49288361bb5 Author: Sun <95302870@qq.com> Date: Sat Dec 2 14:30:37 2023 +0800 管理员页面适配国际化并增加角色列 commit a0211b429de0636bbe0e109d3f02aaa42429828c Author: Sun <95302870@qq.com> Date: Sat Dec 2 12:05:33 2023 +0800 命令行重置密码改为重置管理员密码 commit 1825f931e8f974b50f9a83f19cc16334a578a798 Merge: 34370a4 6f8ba4e Author: Sun <95302870@qq.com> Date: Fri Dec 1 21:17:04 2023 +0800 Merge branch 'bug' into dev commit 6f8ba4e6949638dd9037507fc341365375ee74b6 Author: Sun <95302870@qq.com> Date: Fri Dec 1 21:16:18 2023 +0800 修复用户首次无云端数据将使用默认数据 commit 34370a48486632c4a6fced5a84df34713738233b Author: Sun <95302870@qq.com> Date: Fri Dec 1 20:34:28 2023 +0800 用户编辑窗口增加权限的保存并适配国际化 commit 393a80900a80097e99e569dbe35c0685a89b942f Author: Sun <95302870@qq.com> Date: Fri Dec 1 20:03:22 2023 +0800 取消登录调试 commit 38ec834354ad0c31b2c38872bb630ce2eb04dc12 Author: Sun <95302870@qq.com> Date: Fri Dec 1 20:03:10 2023 +0800 修复仅有一个管理员账号的时候删除拦截未成功的问题 commit 7c5130ad8dbccdaaf9cf8bd8a75f87a0ce9beeef Author: Sun <95302870@qq.com> Date: Fri Dec 1 19:59:20 2023 +0800 完成平台管理账号并在删除至少保留一个管理平台的账号 commit 907f93b9238052265e903529d0597dc91f9e1d21 Author: Sun <95302870@qq.com> Date: Fri Dec 1 19:30:22 2023 +0800 用户管理增加管理权限可以操作,并取消账号的邮箱限制 commit 41f5d20b4c6aad9b8f1992c171714d93e06b3243 Author: Sun <95302870@qq.com> Date: Fri Dec 1 12:28:32 2023 +0800 适配登录页面语言国际化 commit 7e54a46cddd8bdbd888349b1f663cfe320a34455 Merge: ae310fc 74bc8c0 Author: 红烧猎人 <38825747+hslr-s@users.noreply.github.com> Date: Thu Nov 30 22:53:10 2023 +0800 Merge pull request #28 from gitlyp/feature/frontEndSearch feature: 新增前端搜索功能 commit ae310fc2484e342f2847fe9c0ec7ecd848c3388b Author: Sun <95302870@qq.com> Date: Thu Nov 30 12:02:43 2023 +0800 更新构建文件 commit c0838ccec93685e359c68f263067722ca449c728 Merge: 57f54bda62a4f5Author: Sun <95302870@qq.com> Date: Thu Nov 30 10:40:29 2023 +0800 Merge branch 'master' into dev commit 74bc8c05d1f88f7536d350be53060775632e7b9b Author: Rock.L <redrockfly@outlook.com> Date: Wed Nov 29 18:03:47 2023 +0800 feature: 新增前端搜索功能 ts编译报错解决 commit 57f54bd034e6f039a1b1f290448b15aa21909050 Merge: 4443f7c3154b67Author: Sun <95302870@qq.com> Date: Wed Nov 29 10:51:32 2023 +0800 Merge branch 'master' into dev commit ca15d154604bdb908dab06e8a17eaa833161c403 Author: Rock.L <redrockfly@outlook.com> Date: Wed Nov 29 10:35:13 2023 +0800 feature: 新增前端搜索功能 fix:排序时禁用前端搜索功能 commit 68347888c481ae27c6cc3e66752ca073fbac393e Author: Rock.L <redrockfly@outlook.com> Date: Tue Nov 28 23:31:08 2023 +0800 feature: 新增前端搜索功能 新增前端搜索功能 commit 4443f7c8251b31687ed93114930ab3d769f4ed6c Author: Sun <95302870@qq.com> Date: Tue Nov 28 22:10:49 2023 +0800 美化关于页 commit 95ca46d460eba469ca8ae54f65c7773835061c0f Author: Sun <95302870@qq.com> Date: Tue Nov 28 21:59:48 2023 +0800 更新版本号,更新说明文件增加新版预览截图 commit 052e5f81fe4065e10199d52bc041329fc9c5fe86 Author: Sun <95302870@qq.com> Date: Tue Nov 28 21:06:52 2023 +0800 修复后端mkdirAll权限的问题 commit ace57d5ba69c311e40997d5791cf03a8b28e0c07 Author: Sun <95302870@qq.com> Date: Tue Nov 28 20:59:35 2023 +0800 修改配置文件 commit 099015f2767cedfd6eae91e60131817471eb1f24 Author: Sun <95302870@qq.com> Date: Tue Nov 28 14:10:39 2023 +0800 增加docker-compose文件 commit e229003431ff2476f0ab63a8dffb88504716ba48 Author: Sun <95302870@qq.com> Date: Tue Nov 28 13:53:20 2023 +0800 提交更新日志文件 commit e8736b8b62db6d590c063b42757599381429541e Author: Sun <95302870@qq.com> Date: Tue Nov 28 13:49:38 2023 +0800 增加隐藏小图标 commit 038af3aaa91a023cc10aabff5b0cfd15c64d0b46 Author: Sun <95302870@qq.com> Date: Tue Nov 28 13:49:04 2023 +0800 优化 密码限制 commit 4cd15a383923bf3de56e9e4dc6df3bf97236ed18 Author: Sun <95302870@qq.com> Date: Tue Nov 28 12:34:59 2023 +0800 增加反馈入口 commit daf6aea902893f816dca5c0bb09326f2f110ddcc Merge: 3edfaddb057e25Author: Sun <95302870@qq.com> Date: Mon Nov 27 22:19:59 2023 +0800 Merge branch 'master' into dev commit 3edfaddd173efcbbde867dc9ce9b022920b39061 Author: Sun <95302870@qq.com> Date: Mon Nov 27 22:17:08 2023 +0800 修改docker的编译镜像和运行镜像为alpine,兼容极空间设备 commit 3445f97152c2f6b9f1f9f68b46e4b84f8240c9c2 Author: Sun <95302870@qq.com> Date: Mon Nov 27 13:58:59 2023 +0800 修复前端编译错误 commit 3ef02013ffb595e7805692350389bb623155cfe9 Author: Sun <95302870@qq.com> Date: Mon Nov 27 13:56:12 2023 +0800 更新beta版本号 commit 620f0f1e1523f34e87001e8a2bbe3d4a01cb0b9b Author: Sun <95302870@qq.com> Date: Mon Nov 27 13:53:46 2023 +0800 修复 添加图标成功后遗留旧数据的问题 commit 55d877d1ca11e83d9f7325a321aeb5b65ad4ee8b Author: Sun <95302870@qq.com> Date: Mon Nov 27 13:41:55 2023 +0800 增加置顶按钮 commit f28dd63328aeca5d8c3c036c5786304f8a33b1f9 Author: Sun <95302870@qq.com> Date: Mon Nov 27 12:56:14 2023 +0800 优化roundmodal的样式和手机端设置样式 commit c19ce176878ea2ef06b0a5dc75bd6d8239892302 Author: Sun <95302870@qq.com> Date: Mon Nov 27 11:06:44 2023 +0800 优化手机端logo文字显示问题 commit 018dabb2faddc0541fb33ef5a51a126575a59cf5 Author: Sun <95302870@qq.com> Date: Mon Nov 27 10:51:02 2023 +0800 更新说明文件 commit 02239e3686933e4c33e430be8300ec2d0be41887 Author: Sun <95302870@qq.com> Date: Sun Nov 26 22:59:11 2023 +0800 优化 登录页面 commit 6aa92e8ba6c4eeb2fa2995ee93aeeac86b54b551 Author: Sun <95302870@qq.com> Date: Sat Nov 25 23:59:40 2023 +0800 增加编译脚本 commit d93df810fa95a7baa28ca5323903b93f286ba741 Author: Sun <95302870@qq.com> Date: Sat Nov 25 15:48:00 2023 +0800 修改相关logo图片 commit 036a56ddc7a555d6227c92dfa2abfe84f9042662 Merge: 7018872feacc89Author: Sun <95302870@qq.com> Date: Fri Nov 24 16:00:23 2023 +0800 Merge branch 'master' into dev commit 7018872ce9fd0fa8f1ff4731a16b2ea90fb9153f Author: Sun <95302870@qq.com> Date: Fri Nov 24 15:31:31 2023 +0800 更新版本标签 commit 4fae97dd932ce4638d869a0c7a123c788c3e3e43 Author: Sun <95302870@qq.com> Date: Fri Nov 24 15:07:39 2023 +0800 更新版本1.1.0 测试版 commit 890a3c3dbdccbe4dfd5a6915e87a2649c9141e7b Author: Sun <95302870@qq.com> Date: Fri Nov 24 14:31:26 2023 +0800 右键菜单新增打开局域网或者互联网地址,优化分组管理图标不统一的问题 commit 4f014cf4aa384a2c8a03585ffd6ce41c941b9356 Author: Sun <95302870@qq.com> Date: Fri Nov 24 13:33:43 2023 +0800 增加 关联删除,优化添加密码长度限制20 commit 5658e6c379b077d359fff75c5e9b904cbce5f81e Author: Sun <95302870@qq.com> Date: Fri Nov 24 12:09:41 2023 +0800 增加更新日志 commit f142d1b378e0525db157a93cca61ee86bf1eb08d Author: Sun <95302870@qq.com> Date: Fri Nov 24 12:09:30 2023 +0800 添加应用图标验证分组信息必填 commit 2ff2b6b32a4bb70653e3a7312ccb0f4b0b945f07 Author: Sun <95302870@qq.com> Date: Thu Nov 23 23:45:10 2023 +0800 优化关于页面,及更新版本序号为2 commit c9b482b24e2d23d638501dbaa44f826386c420b5 Author: Sun <95302870@qq.com> Date: Thu Nov 23 22:12:13 2023 +0800 优化关于设置版本号 commit ed70059ffbce1ae8a9e2e0378803f7875ada342b Author: Sun <95302870@qq.com> Date: Thu Nov 23 21:41:22 2023 +0800 修复分组管理不能滚动的问题 commit faa4222b1494271878c2c7469c14a4efa49c6761 Author: Sun <95302870@qq.com> Date: Thu Nov 23 21:24:34 2023 +0800 修复分组写死的问题 commit 4f2d0c858e55735b9ba3a8453de9407b76346805 Author: Sun <95302870@qq.com> Date: Thu Nov 23 20:24:39 2023 +0800 初步尝试构建测试版本 commit 596bed19dcf3bceb77e30f9c24218888f8da7e64 Author: Sun <95302870@qq.com> Date: Thu Nov 23 19:24:05 2023 +0800 修复搜索框配置bug,云端没有默认值,前端打不开搜索引擎选择栏 commit 489fbf748a7e35c6b69198b19038c01a548e20f2 Author: Sun <95302870@qq.com> Date: Thu Nov 23 19:22:57 2023 +0800 增加logo和版本打印,修复模块配置的索引报错 commit 263dab607af8a830acee44e37776bda4da814b40 Author: Sun <95302870@qq.com> Date: Wed Nov 22 23:02:37 2023 +0800 调整排序样式 commit c0adf335d3e48e6770d56eb506b471852fbfbc43 Author: Sun <95302870@qq.com> Date: Wed Nov 22 22:58:18 2023 +0800 说明文件增加logo commit 721d22e75b93d3646f5f206d208a9a743840a25b Author: Sun <95302870@qq.com> Date: Wed Nov 22 22:40:40 2023 +0800 更换logo commit 4df58fec7b2054ce97cf2989045affd144aa4f8b Author: Sun <95302870@qq.com> Date: Wed Nov 22 22:38:27 2023 +0800 完善关于页面 commit 63777f0bbac85550fafe1b084bd664c7722ab934 Author: Sun <95302870@qq.com> Date: Wed Nov 22 21:12:14 2023 +0800 字体为纯白色的时候,详情图标会根据背景的明暗度计算字体颜色 commit f328dc73305665a921e030dd4a06d759d0cac3bf Author: Sun <95302870@qq.com> Date: Wed Nov 22 17:21:40 2023 +0800 详情图标居中 commit 663f37bf1a26b7dff24edcfb149222ac780cb90d Author: Sun <95302870@qq.com> Date: Wed Nov 22 16:45:11 2023 +0800 将图标单独拆分为子组件应用图标 commit 30cd5ab460e032f7f6d7c23eb7a9c7af735d0f41 Author: Sun <95302870@qq.com> Date: Wed Nov 22 13:36:32 2023 +0800 增加详情图标隐藏描述信息等设置 commit 945a94e76cae4251953512cc09f348ad38bb9a38 Author: Sun <95302870@qq.com> Date: Wed Nov 22 12:28:46 2023 +0800 优化图标背景色:支持透明图标并更换背景颜色字段 commit 437053fc9d8d9e3c55aac4d259e4b4c4bc11de58 Author: Sun <95302870@qq.com> Date: Wed Nov 22 11:20:56 2023 +0800 完善搜索框 commit a9914f8e8ced23b8c50701a85d522c8f0fcd1c2b Author: Sun <95302870@qq.com> Date: Wed Nov 22 01:27:16 2023 +0800 关闭模块配置相关接口开发模式 commit 2a9e22d4b781f43c0f9b8a867d26c295e756175b Author: Sun <95302870@qq.com> Date: Wed Nov 22 01:24:09 2023 +0800 完成搜索框的样式和模块配置的state等api对接 commit 7f771650ef7272e474f74ed689ab844bf90b946f Author: Sun <95302870@qq.com> Date: Wed Nov 22 00:45:25 2023 +0800 增加搜索引擎图标 commit a0e0039ae89eaa27e4b849baa0168716866682ea Author: Sun <95302870@qq.com> Date: Tue Nov 21 19:54:36 2023 +0800 增加 模块配置表 commit 017869794177d7a5d4c12c0eac6fb7c7fe79734e Author: Sun <95302870@qq.com> Date: Tue Nov 21 13:10:39 2023 +0800 图标标题加粗 commit 7a2d896a44262b54d6a1d2d12fe6bbbc31b1ca49 Author: Sun <95302870@qq.com> Date: Tue Nov 21 12:53:39 2023 +0800 增加图标的预设颜色 commit a6c3120c186646b323e57ecce0f85ec9c79a41a5 Author: Sun <95302870@qq.com> Date: Tue Nov 21 12:18:46 2023 +0800 增加遮罩 commit 84d3db81ea2aaa0f67a67690e449d15401e8e511 Author: Sun <95302870@qq.com> Date: Tue Nov 21 11:05:24 2023 +0800 极简小图标增加鼠标悬浮详情 commit 666a6a117bc30c64a78ab0fe2cb7836c602b2741 Author: Sun <95302870@qq.com> Date: Mon Nov 20 23:33:10 2023 +0800 修复 sort字段未修改归0的问题 commit 71afd530d7a740763326a6117f8e7c04ac1f7f69 Author: Sun <95302870@qq.com> Date: Mon Nov 20 23:32:48 2023 +0800 适配纯透明图标,增强图标背景色,增加图标url连接支持 commit 619c5e28e1c51c16e14ed09601709ab751ee2454 Author: Sun <95302870@qq.com> Date: Mon Nov 20 22:37:43 2023 +0800 修复 每次修改图标都重置了排序号 commit 8a17f1c0bf2f00c530dee61cd5070a74ca4a53b2 Author: Sun <95302870@qq.com> Date: Mon Nov 20 21:21:20 2023 +0800 分组为空的时候显示添加图标的图标 commit 755cf3dc569e402cb3dfc9915e94de4f2595571b Author: Sun <95302870@qq.com> Date: Mon Nov 20 20:52:45 2023 +0800 首页图标排序完成 commit 5ccf23c68b3284be00dadf94073a665826737a77 Author: Sun <95302870@qq.com> Date: Mon Nov 20 14:30:12 2023 +0800 添加修改图标适配分组 commit 47209d729270bf4704428ecd91606d4721bd9a13 Author: Sun <95302870@qq.com> Date: Mon Nov 20 11:06:32 2023 +0800 保存分组和分组排序已经完成 commit 17403de7ed236a097d70cd5ecbbe261e620ff377 Merge: d0d88eb980d81aAuthor: Sun <95302870@qq.com> Date: Sun Nov 19 23:38:00 2023 +0800 Merge branch 'master' into dev commit d0d88eb548bbe9d7f5ad663f383db858843a8d8c Merge: 728dbc8 47b479c Author: Sun <95302870@qq.com> Date: Sun Nov 19 11:13:34 2023 +0800 Merge branch 'docker-build' into dev commit 47b479cf8da7214dd9e0592b461743ab7d3824ed Author: Sun <95302870@qq.com> Date: Sun Nov 19 11:12:54 2023 +0800 修改前端程序名 commit 728dbc80ff7885d0b4cf289b06763cc60ed17d7e Author: Sun <95302870@qq.com> Date: Thu Nov 16 13:44:47 2023 +0800 新增删除应用分组和修改应用分组,以及图标真正的按组读取 commit a3dbd948ca743384a2de3685083695603d674bf1 Author: Sun <95302870@qq.com> Date: Wed Nov 15 22:49:58 2023 +0800 增加图标组api commit de21f3f232c1243917b5c55ba4bedb01437f8564 Author: Sun <95302870@qq.com> Date: Wed Nov 15 22:49:44 2023 +0800 重新划分应用盒子的结构 commit 7c409112ba1f8eefb7df7fffdb78b285e3f5322c Author: Sun <95302870@qq.com> Date: Wed Nov 15 22:27:07 2023 +0800 [后端] 增加应用分组 commit ebf9500529c7db30b1c6e1ed4056013d0f83827a Merge: acedcb3 97d4f83 Author: Sun <95302870@qq.com> Date: Wed Nov 15 20:38:05 2023 +0800 Merge branch 'feature/drag' into dev commit acedcb32a03ed0ee1833143912a9215182da3fb6 Merge: f105e10c84eae3Author: Sun <95302870@qq.com> Date: Wed Nov 15 20:37:26 2023 +0800 Merge branch 'master' into dev commit 97d4f8368dffca2a16d729e666068a552feca87d Author: Sun <95302870@qq.com> Date: Wed Nov 15 20:36:19 2023 +0800 更新软件包 commit 5108f65275181b899b8fc100c615cb6065dcca5d Author: Sun <95302870@qq.com> Date: Wed Nov 15 20:30:39 2023 +0800 简单监听了一下拖拽 commit dae9aea41f1540ccb74abea2a31af5d2a1e4dcfd Merge: 396db51f672034Author: Sun <95302870@qq.com> Date: Wed Nov 15 10:01:00 2023 +0800 Merge branch 'master' into feature/drag commit 396db51979d513559512b0a9702dd0d616c2872b Author: Sun <95302870@qq.com> Date: Wed Nov 15 00:08:02 2023 +0800 历史性时刻,拖拽图标 commit f105e10fe1ced11d0b32eba37cfbfdb94f6ad07b Author: Sun <95302870@qq.com> Date: Tue Nov 14 11:35:52 2023 +0800 尝试增加一个分组标题 commit 7e2354f4ed509c7d05667604b7eb56e91f911ed0 Author: Sun <95302870@qq.com> Date: Sun Nov 12 23:07:37 2023 +0800 优化 枚举引用错误 commit 27e85b7da339706ea97604a785bf013dad5f9534 Author: Sun <95302870@qq.com> Date: Sun Nov 12 23:06:50 2023 +0800 优化路由 commit fef462804c0d445f5b9bc7e38e226b55c26017ee Author: Sun <95302870@qq.com> Date: Sun Nov 12 21:28:57 2023 +0800 更换enums的位置
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
<script setup lang="ts">
|
||||
import { NDivider, NGradientText } from 'naive-ui'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { get } from '@/api/system/about'
|
||||
import srcSvglogo from '@/assets/logo.svg'
|
||||
import srcGitee from '@/assets/about_image/gitee.png'
|
||||
import srcGithub from '@/assets/about_image/github.png'
|
||||
import srcDocker from '@/assets/about_image/docker.png'
|
||||
import srcQQGroupQR from '@/assets/about_image/qq_group_qr.jpg'
|
||||
import { RoundCardModal } from '@/components/common'
|
||||
|
||||
interface Version {
|
||||
versionName: string
|
||||
versionCode: number
|
||||
}
|
||||
|
||||
const versionName = ref('')
|
||||
const qqGroupQRShow = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
get<Version>().then((res) => {
|
||||
if (res.code === 0)
|
||||
versionName.value = res.data.versionName
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="pt-10">
|
||||
<div>
|
||||
<div class="flex flex-col items-center justify-center">
|
||||
<img :src="srcSvglogo" width="100" height="100" alt="">
|
||||
<div class="text-3xl font-semibold">
|
||||
{{ $t('common.appName') }}
|
||||
</div>
|
||||
<div class="text-xl">
|
||||
<NGradientText type="info">
|
||||
<a href="https://github.com/hslr-s/sun-panel/releases" class="font-semibold" title="点此查看更新说明" target="_blank">v{{ versionName }}</a>
|
||||
</NGradientText>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<NDivider> • </NDivider>
|
||||
<div class="flex flex-col items-center justify-center text-base">
|
||||
<div>
|
||||
建议反馈:<a href="https://github.com/hslr-s/sun-panel/issues" target="_blank" class="link">Github Issues</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
QQ交流群:<a href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=_I9WIoJn1roIdoaAqelSj9qClLKlXIa1&authKey=GfsQP2GagHnus0jMc7U8Sm6VhWjtsipXUzCHbFwQsGyHMgmYWx6ZbAP%2Bhut%2B4D6N&noverify=0&group_code=276594668" target="_blank" class="link">276594668</a>
|
||||
|
|
||||
<span class="link cursor-pointer" @click="qqGroupQRShow = !qqGroupQRShow">
|
||||
二维码(推荐)
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
开发者:<a href="https://blog.enianteam.com/u/sun/content/11" target="_blank" class="link">红烧猎人</a> | <a href="https://github.com/hslr-s/sun-panel/blob/master/doc/donate.md" target="_blank" class="text-red-600 hover:text-red-900">🧧打赏</a>
|
||||
</div>
|
||||
|
||||
<div class="flex mt-[10px]">
|
||||
<div class="flex items-center mx-[10px]">
|
||||
<img class="w-[20px] h-[20px] mr-[5px]" :src="srcGithub" alt="">
|
||||
<a href="https://github.com/hslr-s/sun-panel" target="_blank" class="link">Github</a>
|
||||
</div>
|
||||
<div class="flex items-center mx-[10px]">
|
||||
<img class="w-[20px] h-[20px] mr-[5px]" :src="srcGitee" alt="">
|
||||
<a href="https://gitee.com/hslr/sun-panel" target="_blank" class="link">Gitee</a>
|
||||
</div>
|
||||
<div class="flex items-center mx-[10px]">
|
||||
<img class="w-[20px] h-[20px] mr-[5px]" :src="srcDocker" alt="">
|
||||
<a href="https://hub.docker.com/r/hslr/sun-panel" target="_blank" class="link">Docker</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<RoundCardModal v-model:show="qqGroupQRShow" title="交流群二维码" style="width: 300px;">
|
||||
<div class="text-center">
|
||||
- 如果失效请返回联系作者 -
|
||||
</div>
|
||||
<div class="flex justify-center">
|
||||
<img :src="srcQQGroupQR" class="h-[260px]">
|
||||
</div>
|
||||
</RoundCardModal>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.link{
|
||||
color:rgb(0, 89, 255)
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,360 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import type { UploadFileInfo } from 'naive-ui'
|
||||
import { NAlert, NButton, NCheckbox, NCheckboxGroup, NDivider, NInput, NSpace, NUpload, useMessage } from 'naive-ui'
|
||||
import { RoundCardModal, SvgIcon } from '@/components/common'
|
||||
import type { IconGroup, ImportJsonResult } from '@/utils/jsonImportExport'
|
||||
import { ConfigVersionLowError, FormatError, exportJson, importJsonString } from '@/utils/jsonImportExport'
|
||||
import { get as getAbout } from '@/api/system/about'
|
||||
import { edit as addGroup, getList as getGroupList } from '@/api/panel/itemIconGroup'
|
||||
import { addMultiple as addMultipleIcons, getListByGroupId } from '@/api/panel/itemIcon'
|
||||
|
||||
import { t } from '@/locales'
|
||||
|
||||
interface ItemGroup extends Panel.ItemIconGroup {
|
||||
items?: Panel.ItemInfo[]
|
||||
}
|
||||
|
||||
const ms = useMessage()
|
||||
|
||||
const jsonData = ref<string | null>(null)
|
||||
const importWarning = ref<string[]>([])
|
||||
const importRoundModalShow = ref(false)
|
||||
const exportRoundModalShow = ref(false)
|
||||
const loading = ref(false)
|
||||
const uploadLoading = ref(false)
|
||||
const version = ref('') // 当前软件版本
|
||||
const debug = ref(false)
|
||||
|
||||
const importObj = ref<ImportJsonResult | null> (null)
|
||||
|
||||
const importItems = ref<string[]>(['icons']) // 当前软件版本支持导入导出的项目
|
||||
const checkedItems = ref<string[]>(['icons']) // 当前准备导入的项目
|
||||
|
||||
// 导入图标
|
||||
async function importIcons(): Promise<string | null> {
|
||||
const groups = importObj.value?.geticons()
|
||||
const batchSize = 50
|
||||
|
||||
if (!groups)
|
||||
return null
|
||||
|
||||
try {
|
||||
for (let i = 0; i < groups.length; i++) {
|
||||
const element = groups[i]
|
||||
|
||||
// 创建组得到组id
|
||||
const createGroupResponse = await addGroup<Panel.ItemIconGroup>({
|
||||
title: element.title,
|
||||
sort: element.sort,
|
||||
})
|
||||
|
||||
if (createGroupResponse.code === 0) {
|
||||
const groupId = createGroupResponse.data?.id
|
||||
|
||||
if (groupId) {
|
||||
let addIcons: Panel.ItemInfo[] = []
|
||||
|
||||
// 批量添加子项
|
||||
for (let iconI = 0; iconI < element.children.length; iconI++) {
|
||||
const iconElement = element.children[iconI]
|
||||
|
||||
addIcons.push({
|
||||
title: iconElement.title,
|
||||
sort: iconElement.sort,
|
||||
icon: iconElement.icon,
|
||||
url: iconElement.url,
|
||||
lanUrl: iconElement.lanUrl,
|
||||
description: iconElement.description,
|
||||
openMethod: iconElement.openMethod,
|
||||
itemIconGroupId: groupId,
|
||||
})
|
||||
|
||||
// 每 batchSize 个添加一次
|
||||
if (addIcons.length === batchSize || iconI === element.children.length - 1) {
|
||||
const response = await addMultipleIcons(addIcons)
|
||||
|
||||
if (response.code !== 0)
|
||||
return response.msg
|
||||
|
||||
addIcons = []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return createGroupResponse.msg
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof Error)
|
||||
return `发生错误: ${error.message}`
|
||||
else
|
||||
return '发生未知错误'
|
||||
}
|
||||
}
|
||||
|
||||
// 导出图标
|
||||
async function exportIcons(): Promise<IconGroup[]> {
|
||||
const iconGroups: IconGroup[] = []
|
||||
|
||||
// 获取组数据
|
||||
const { code, data } = await getGroupList<Common.ListResponse<ItemGroup[]>>()
|
||||
|
||||
if (code === 0) {
|
||||
// 使用 Promise.all 等待所有异步操作完成
|
||||
await Promise.all(data.list.map(async (element) => {
|
||||
const group: IconGroup = {
|
||||
title: element.title as string,
|
||||
sort: element.sort as 0,
|
||||
children: [],
|
||||
}
|
||||
|
||||
const res = await getListByGroupId<Common.ListResponse<Panel.ItemInfo[]>>(element.id)
|
||||
|
||||
if (res.code === 0) {
|
||||
for (const iconElement of res.data.list) {
|
||||
group.children.push({
|
||||
icon: iconElement.icon,
|
||||
sort: iconElement.sort || 99999,
|
||||
title: iconElement.title,
|
||||
url: iconElement.url,
|
||||
lanUrl: iconElement.lanUrl || '',
|
||||
description: iconElement.description || '',
|
||||
openMethod: iconElement.openMethod || 1,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
iconGroups.push(group)
|
||||
}))
|
||||
|
||||
return iconGroups
|
||||
}
|
||||
else {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
interface Version {
|
||||
versionName: string
|
||||
versionCode: number
|
||||
}
|
||||
|
||||
getAbout<Version>().then((res) => {
|
||||
if (res.code === 0)
|
||||
version.value = res.data.versionName
|
||||
})
|
||||
})
|
||||
|
||||
function handleFileChange(options: { file: UploadFileInfo; fileList: Array<UploadFileInfo> }) {
|
||||
uploadLoading.value = true
|
||||
console.log(options.file.file)
|
||||
if (options.file.file) {
|
||||
const reader = new FileReader()
|
||||
reader.onload = () => {
|
||||
if (reader.result) {
|
||||
jsonData.value = reader.result as string
|
||||
importCheck()
|
||||
}
|
||||
else {
|
||||
ms.error('异常请重新上传')
|
||||
}
|
||||
uploadLoading.value = false
|
||||
}
|
||||
reader.readAsText(options.file.file)
|
||||
}
|
||||
}
|
||||
|
||||
// 验证导入文件
|
||||
function importCheck() {
|
||||
importWarning.value = []
|
||||
if (jsonData.value) {
|
||||
try {
|
||||
importObj.value = importJsonString(jsonData.value)
|
||||
if (importObj.value) {
|
||||
if (!importObj.value.isPassCheckMd5())
|
||||
importWarning.value.push('文件被修改过,谨慎导入')
|
||||
|
||||
if (!importObj.value.isPassCheckConfigVersionOld())
|
||||
importWarning.value.push('配置文件版本过低,但是兼容')
|
||||
|
||||
if (!importObj.value.isPassCheckConfigVersionNew())
|
||||
importWarning.value.push('当前软件版本可能过旧,很有可能无法兼容该配置文件,请谨慎导入。推荐将软件更新到新版后再次导入')
|
||||
|
||||
// (暂时不做)此处可以判断,当前的配置文件是否存在的导入项目(不存在隐藏importItems里面的值)操作变量:importItems
|
||||
|
||||
// 通过了验证,打开弹窗
|
||||
importRoundModalShow.value = !importRoundModalShow.value
|
||||
|
||||
// console.log(importObj.value.geticons())
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof ConfigVersionLowError) {
|
||||
ms.error('配置文件版本过低,无法兼容')
|
||||
console.log('配置文件版本过低')
|
||||
}
|
||||
else if (error instanceof FormatError) {
|
||||
ms.error('格式不正确,无法导入')
|
||||
console.log('格式不正确')
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ms.error('数据不正确')
|
||||
}
|
||||
}
|
||||
|
||||
// 开始导出
|
||||
async function handleStartExport() {
|
||||
loading.value = true
|
||||
console.log('要导出的项目', checkedItems.value)
|
||||
// 获取软件版本号
|
||||
const exportResult = exportJson(version.value)
|
||||
if (checkedItems.value.includes('icons')) {
|
||||
console.log('export icons ...')
|
||||
const iconGroups = await exportIcons()
|
||||
exportResult.addIconsData(iconGroups)
|
||||
console.log('export icons finish', iconGroups)
|
||||
}
|
||||
|
||||
console.log('导出结果')
|
||||
|
||||
jsonData.value = exportResult.string()
|
||||
exportResult.exportFile()
|
||||
loading.value = false
|
||||
exportRoundModalShow.value = false
|
||||
// ms.success(t('common.success'))
|
||||
}
|
||||
|
||||
// 开始导入
|
||||
async function handleStartImport() {
|
||||
loading.value = true
|
||||
if (checkedItems.value.includes('icons')) {
|
||||
console.log('export icons ...')
|
||||
const errMsg = await importIcons()
|
||||
if (errMsg !== null)
|
||||
ms.success(`${t('common.failed')}:${errMsg}`)
|
||||
}
|
||||
|
||||
loading.value = false
|
||||
importRoundModalShow.value = false
|
||||
ms.success(`${t('common.success')},请手动刷新页面`)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="pt-2">
|
||||
<NAlert type="info" :bordered="false">
|
||||
<p>导入图标配置数据不会清空现有图标数据</p>
|
||||
</NAlert>
|
||||
<div class="flex justify-center m-[50px]">
|
||||
<div class="m-[10px]">
|
||||
<NUpload
|
||||
accept=".sun-panel.json,.sunpanel.json"
|
||||
directory-dnd
|
||||
:default-upload="false"
|
||||
:show-file-list="false"
|
||||
@change="handleFileChange"
|
||||
>
|
||||
<NButton type="info" size="large" :loading="uploadLoading">
|
||||
<template #icon>
|
||||
<SvgIcon icon="fa6:solid-file-import" />
|
||||
</template>
|
||||
导入配置
|
||||
</NButton>
|
||||
</NUpload>
|
||||
</div>
|
||||
<div class="m-[10px]">
|
||||
<NButton type="info" size="large" @click="exportRoundModalShow = !exportRoundModalShow">
|
||||
<template #icon>
|
||||
<SvgIcon icon="fa6:solid-file-export" />
|
||||
</template>
|
||||
导出配置
|
||||
</NButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-center">
|
||||
<a href="https://hslr-s.github.io/sun-panel-tool-page/#/" target="_blank">浏览器书签转换工具</a>
|
||||
</div>
|
||||
|
||||
<!-- 调试模式 -->
|
||||
<div v-if="debug">
|
||||
<NButton @click="importCheck">
|
||||
检查导入
|
||||
</NButton>
|
||||
|
||||
<!-- <NButton @click="exportJsonS">
|
||||
导出JSON
|
||||
</NButton> -->
|
||||
|
||||
<NButton @click="jsonData = ''">
|
||||
清空导入数据
|
||||
</NButton>
|
||||
|
||||
<NInput
|
||||
v-model:value="jsonData"
|
||||
type="textarea"
|
||||
placeholder="基本的 Textarea"
|
||||
/>
|
||||
|
||||
<div v-if="jsonData">
|
||||
<h2>JSON 数据</h2>
|
||||
<pre>{{ jsonData }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<RoundCardModal v-model:show="importRoundModalShow" style="max-width: 400px;" title="导入">
|
||||
<div v-if="importWarning.length > 0">
|
||||
<NAlert :title="$t('common.warning')" type="warning">
|
||||
<div v-for="(text, index) in importWarning " :key="index">
|
||||
{{ text }}
|
||||
</div>
|
||||
</NAlert>
|
||||
</div>
|
||||
<NDivider title-placement="left">
|
||||
请选择要导入的配置数据
|
||||
</NDivider>
|
||||
|
||||
<NSpace justify="center" style="margin-top: 20px;">
|
||||
<NCheckboxGroup v-model:value="checkedItems">
|
||||
<NCheckbox v-if="importItems.includes('icons')" value="icons" label="图标" />
|
||||
<NCheckbox v-if="importItems.includes('style')" value="style" label="样式配置" />
|
||||
</NCheckboxGroup>
|
||||
</NSpace>
|
||||
<NSpace justify="center">
|
||||
<div class="mt-[50px]">
|
||||
<NButton type="success" :disabled="checkedItems.length === 0" :loading="loading" @click="handleStartImport">
|
||||
继续导入
|
||||
</NButton>
|
||||
</div>
|
||||
</NSpace>
|
||||
</RoundCardModal>
|
||||
|
||||
<RoundCardModal v-model:show="exportRoundModalShow" style="max-width: 400px;" title="导出">
|
||||
<NDivider title-placement="left">
|
||||
请选择要导出的配置数据
|
||||
</NDivider>
|
||||
|
||||
<NSpace justify="center" style="margin-top: 20px;">
|
||||
<NCheckboxGroup v-model:value="checkedItems">
|
||||
<NCheckbox v-if="importItems.includes('icons')" value="icons" label="图标" />
|
||||
<NCheckbox v-if="importItems.includes('style')" value="style" label="样式配置" />
|
||||
</NCheckboxGroup>
|
||||
</NSpace>
|
||||
<NSpace justify="center">
|
||||
<div class="mt-[50px]">
|
||||
<NButton type="success" :disabled="checkedItems.length === 0" :loading="loading" @click="handleStartExport">
|
||||
继续导出
|
||||
</NButton>
|
||||
</div>
|
||||
</NSpace>
|
||||
</RoundCardModal>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,199 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import type { FormInst, FormRules } from 'naive-ui'
|
||||
import { NButton, NCard, NForm, NFormItem, NInput, useDialog, useMessage } from 'naive-ui'
|
||||
import { VueDraggable } from 'vue-draggable-plus'
|
||||
import { deletes, edit, getList, saveSort } from '@/api/panel/itemIconGroup'
|
||||
import { RoundCardModal, SvgIcon } from '@/components/common'
|
||||
|
||||
interface EditModalArg {
|
||||
show: boolean
|
||||
editStatus: number // 1.添加 2.编辑
|
||||
model: Panel.ItemIconGroup
|
||||
rules: FormRules
|
||||
}
|
||||
|
||||
const formRef = ref<FormInst | null>(null)
|
||||
const ms = useMessage()
|
||||
const dialog = useDialog()
|
||||
const sortStatus = ref(false)
|
||||
|
||||
const defaultMNodal = {
|
||||
title: '',
|
||||
icon: 'material-symbols:folder-outline',
|
||||
sort: 9999,
|
||||
}
|
||||
|
||||
const editModalArg = ref<EditModalArg>({
|
||||
show: false,
|
||||
editStatus: 1,
|
||||
model: defaultMNodal,
|
||||
rules: {
|
||||
title: [
|
||||
{
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
message: '必填项',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
const groups = ref<Panel.ItemIconGroup[]>([])
|
||||
|
||||
function handleAddGroup() {
|
||||
editModalArg.value.show = !editModalArg.value.show
|
||||
}
|
||||
|
||||
function handleEditGroup(groupInfo: Panel.ItemIconGroup) {
|
||||
editModalArg.value.show = true
|
||||
editModalArg.value.model = groupInfo
|
||||
editModalArg.value.editStatus = 2
|
||||
}
|
||||
|
||||
function handleDragSort() {
|
||||
sortStatus.value = true
|
||||
}
|
||||
|
||||
function handleSaveSort() {
|
||||
const saveItems: Common.SortItemRequest[] = []
|
||||
for (let i = 0; i < groups.value.length; i++) {
|
||||
const element = groups.value[i]
|
||||
saveItems.push({
|
||||
id: element.id as number,
|
||||
sort: i + 1,
|
||||
})
|
||||
}
|
||||
saveSort(saveItems).then(({ code, msg }) => {
|
||||
if (code === 0) {
|
||||
ms.success('保存成功')
|
||||
sortStatus.value = false
|
||||
}
|
||||
else {
|
||||
ms.error(`保存失败:${msg}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function handleDelete(groupInfo: Panel.ItemIconGroup) {
|
||||
dialog.warning({
|
||||
title: '警告',
|
||||
content: `你确定删除此分组[ ${groupInfo.title} ],删除后此分组应用图标将丢失?`,
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: () => {
|
||||
if (groupInfo.id) {
|
||||
deletes([groupInfo.id]).then(({ code, msg }) => {
|
||||
if (code !== 0)
|
||||
ms.error(`删除失败:${msg}`)
|
||||
else
|
||||
refreshList()
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function handleSaveGroup() {
|
||||
formRef.value?.validate((errors) => {
|
||||
if (!errors) {
|
||||
edit(editModalArg.value.model).then(({ code, msg }) => {
|
||||
if (code !== 0)
|
||||
ms.error(msg)
|
||||
|
||||
refreshList()
|
||||
editModalArg.value.show = false
|
||||
editModalArg.value.model = { ...defaultMNodal }
|
||||
})
|
||||
}
|
||||
else { console.log(errors) }
|
||||
})
|
||||
}
|
||||
|
||||
function refreshList() {
|
||||
getList<Common.ListResponse<Panel.ItemIconGroup[]>>().then(({ code, data }) => {
|
||||
groups.value = data.list
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
refreshList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="h-full">
|
||||
<div class="p-2">
|
||||
<NButton type="success" size="small" style="margin-right: 10px;" @click="handleAddGroup">
|
||||
新增分组
|
||||
</NButton>
|
||||
|
||||
<NButton v-if="!sortStatus" size="small" @click="handleDragSort">
|
||||
排序
|
||||
</NButton>
|
||||
|
||||
<NButton v-else type="warning" size="small" @click="handleSaveSort">
|
||||
保存排序
|
||||
</NButton>
|
||||
</div>
|
||||
|
||||
<div class=" overflow-auto w-full mt-[20px] bg-slate-200 rounded-xl" style="height:calc(100% - 65px)">
|
||||
<VueDraggable
|
||||
v-model="groups"
|
||||
item-key="sort" :animation="300"
|
||||
:style="{ padding: sortStatus ? '20px' : '10px' }"
|
||||
:disabled="!sortStatus"
|
||||
>
|
||||
<div v-for="(item, index) in groups" :key="index" class="w-full">
|
||||
<NCard size="small" style="border-radius:10px;margin-bottom: 10px;">
|
||||
<div class="flex" :class="sortStatus ? 'cursor-move' : ''">
|
||||
<div class="flex items-center">
|
||||
<span class="mr-[10px]">
|
||||
<SvgIcon class="text-[20px]" icon="material-symbols:ad-group-outline-rounded" />
|
||||
<!-- <SvgIcon class="text-[20px]" :icon="item.icon" /> -->
|
||||
</span>
|
||||
<span>
|
||||
{{ item.title }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="ml-auto">
|
||||
<span>
|
||||
<NButton strong secondary type="success" size="small" @click="handleEditGroup(item)">
|
||||
<template #icon>
|
||||
<SvgIcon icon="basil:edit-solid" />
|
||||
</template>
|
||||
</NButton>
|
||||
</span>
|
||||
<span class="ml-[10px]">
|
||||
<NButton strong secondary type="error" size="small" class="ml-[10px]" @click="handleDelete(item)">
|
||||
<template #icon>
|
||||
<SvgIcon icon="material-symbols:delete" />
|
||||
</template>
|
||||
</NButton>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</NCard>
|
||||
</div>
|
||||
</VueDraggable>
|
||||
</div>
|
||||
|
||||
<RoundCardModal v-model:show="editModalArg.show" size="small" type="small" :title="editModalArg.editStatus === 1 ? '添加' : '编辑'" style="width: 400px;">
|
||||
<NForm ref="formRef" :model="editModalArg.model" :rules="editModalArg.rules">
|
||||
<NFormItem path="title" label="分组名称">
|
||||
<NInput v-model:value="editModalArg.model.title" type="text" :maxlength="20" show-count placeholder="请输入" />
|
||||
</NFormItem>
|
||||
|
||||
<!-- <NFormItem path="name" label="昵称">
|
||||
<NInput v-model:value="editModalArg.model" type="text" placeholder="请输入昵称" />
|
||||
</NFormItem> -->
|
||||
</NForm>
|
||||
<template #footer>
|
||||
<NButton type="success" size="small" class="float-right" @click="handleSaveGroup">
|
||||
确定
|
||||
</NButton>
|
||||
</template>
|
||||
</RoundCardModal>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,244 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import type { UploadFileInfo } from 'naive-ui'
|
||||
import { NButton, NCard, NColorPicker, NGrid, NGridItem, NInput, NPopconfirm, NSelect, NSlider, NSwitch, NUpload, NUploadDragger, useMessage } from 'naive-ui'
|
||||
import { useAuthStore, usePanelState } from '@/store'
|
||||
import { set as setUserConfig } from '@/api/panel/userConfig'
|
||||
import { PanelPanelConfigStyleEnum } from '@/enums/panel'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const panelState = usePanelState()
|
||||
const ms = useMessage()
|
||||
|
||||
const isSaveing = ref(false)
|
||||
|
||||
const iconTypeOptions = [
|
||||
{
|
||||
label: '详情图标',
|
||||
value: PanelPanelConfigStyleEnum.info,
|
||||
},
|
||||
{
|
||||
label: '小图标',
|
||||
value: PanelPanelConfigStyleEnum.icon,
|
||||
},
|
||||
]
|
||||
|
||||
watch(panelState.panelConfig, () => {
|
||||
if (!isSaveing.value) {
|
||||
isSaveing.value = true
|
||||
|
||||
setTimeout(() => {
|
||||
panelState.recordState()// 本地记录
|
||||
setUserConfig({ panel: panelState.panelConfig }).then((res) => {
|
||||
if (res.code === 0)
|
||||
ms.success('配置已保存')
|
||||
else
|
||||
ms.error(`配置保存失败${res.msg}`)
|
||||
isSaveing.value = false
|
||||
})
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
|
||||
function handleUploadBackgroundFinish({
|
||||
file,
|
||||
event,
|
||||
}: {
|
||||
file: UploadFileInfo
|
||||
event?: ProgressEvent
|
||||
}) {
|
||||
const res = JSON.parse((event?.target as XMLHttpRequest).response)
|
||||
panelState.panelConfig.backgroundImageSrc = res.data.imageUrl
|
||||
return file
|
||||
}
|
||||
|
||||
function uploadCloud() {
|
||||
setUserConfig({ panel: panelState.panelConfig }).then((res) => {
|
||||
if (res.code === 0)
|
||||
ms.success('配置已同步到云端')
|
||||
else
|
||||
ms.error(`配置同步到云端失败${res.msg}`)
|
||||
})
|
||||
}
|
||||
|
||||
function resetPanelConfig() {
|
||||
panelState.resetPanelConfig()
|
||||
uploadCloud()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="bg-slate-200 rounded-[10px] p-[8px] overflow-auto">
|
||||
<NCard style="border-radius:10px" size="small">
|
||||
<div class="text-slate-500 mb-[5px] font-bold">
|
||||
LOGO
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
文本内容
|
||||
</div>
|
||||
<div class="flex items-center mt-[5px]">
|
||||
<NInput v-model:value="panelState.panelConfig.logoText" type="text" show-count :maxlength="20" placeholder="请输入文字" />
|
||||
</div>
|
||||
</div>
|
||||
</NCard>
|
||||
|
||||
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
|
||||
<div class="text-slate-500 mb-[5px] font-bold">
|
||||
时钟
|
||||
</div>
|
||||
<div class="flex items-center mt-[5px]">
|
||||
<span class="mr-[10px]">显示秒</span>
|
||||
<NSwitch v-model:value="panelState.panelConfig.clockShowSecond" />
|
||||
</div>
|
||||
</NCard>
|
||||
|
||||
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
|
||||
<div class="text-slate-500 mb-[5px] font-bold">
|
||||
搜索框
|
||||
</div>
|
||||
<div class="flex items-center mt-[5px]">
|
||||
<span class="mr-[10px]">显示</span>
|
||||
<NSwitch v-model:value="panelState.panelConfig.searchBoxShow" />
|
||||
</div>
|
||||
<div v-if="panelState.panelConfig.searchBoxShow" class="flex items-center mt-[5px]">
|
||||
<span class="mr-[10px]">允许搜索快捷图标</span>
|
||||
<NSwitch v-model:value="panelState.panelConfig.searchBoxSearchIcon" />
|
||||
</div>
|
||||
</NCard>
|
||||
|
||||
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
|
||||
<div class="text-slate-500 mb-[5px] font-bold">
|
||||
图标
|
||||
</div>
|
||||
<div class="mt-[5px]">
|
||||
<div>
|
||||
样式
|
||||
</div>
|
||||
<div class="flex items-center mt-[5px]">
|
||||
<NSelect v-model:value="panelState.panelConfig.iconStyle" :options="iconTypeOptions" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="panelState.panelConfig.iconStyle === PanelPanelConfigStyleEnum.info" class="mt-[5px]">
|
||||
<div>
|
||||
隐藏描述信息
|
||||
</div>
|
||||
<div class="flex items-center mt-[5px]">
|
||||
<NSwitch v-model:value="panelState.panelConfig.iconTextInfoHideDescription" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="panelState.panelConfig.iconStyle === PanelPanelConfigStyleEnum.icon" class="mt-[5px]">
|
||||
<div>
|
||||
隐藏标题
|
||||
</div>
|
||||
<div class="flex items-center mt-[5px]">
|
||||
<NSwitch v-model:value="panelState.panelConfig.iconTextIconHideTitle" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-[5px]">
|
||||
<div>
|
||||
文字颜色
|
||||
</div>
|
||||
<div class="flex items-center mt-[5px]">
|
||||
<NColorPicker
|
||||
v-model:value="panelState.panelConfig.iconTextColor"
|
||||
:show-alpha="false"
|
||||
size="small"
|
||||
:modes="['hex']"
|
||||
:swatches="[
|
||||
'#000000',
|
||||
'#ffffff',
|
||||
'#18A058',
|
||||
'#2080F0',
|
||||
'#F0A020',
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</NCard>
|
||||
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
|
||||
<div class="text-slate-500 mb-[5px] font-bold">
|
||||
壁纸
|
||||
</div>
|
||||
<NUpload
|
||||
action="/api/file/uploadImg"
|
||||
:show-file-list="false"
|
||||
name="imgfile"
|
||||
:headers="{
|
||||
token: authStore.token as string,
|
||||
}"
|
||||
:directory-dnd="true"
|
||||
@finish="handleUploadBackgroundFinish"
|
||||
>
|
||||
<NUploadDragger style="width: 100%;">
|
||||
<div
|
||||
class="h-[200px] w-full border bg-slate-100 flex justify-center items-center cursor-pointer rounded-[10px]"
|
||||
:style="{ background: `url(${panelState.panelConfig.backgroundImageSrc}) no-repeat`, backgroundSize: 'cover' }"
|
||||
>
|
||||
<div class="text-shadow text-white">
|
||||
点击上传替换图片或拖拽到框内
|
||||
</div>
|
||||
</div>
|
||||
</NUploadDragger>
|
||||
</NUpload>
|
||||
|
||||
<div class="flex items-center mt-[10px]">
|
||||
<span class="mr-[10px]">模糊</span>
|
||||
<NSlider v-model:value="panelState.panelConfig.backgroundBlur" class="max-w-[200px]" :step="2" :max="20" />
|
||||
</div>
|
||||
|
||||
<div class="flex items-center mt-[10px]">
|
||||
<span class="mr-[10px]">遮罩</span>
|
||||
<NSlider v-model:value="panelState.panelConfig.backgroundMaskNumber" class="max-w-[200px]" :step="0.1" :max="1" />
|
||||
</div>
|
||||
</NCard>
|
||||
|
||||
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
|
||||
<div class="text-slate-500 mb-[5px] font-bold">
|
||||
其他
|
||||
</div>
|
||||
|
||||
<NGrid cols="2">
|
||||
<NGridItem span="12 400:12">
|
||||
<div class="flex items-center mt-[10px]">
|
||||
<span class="mr-[10px]">上边距 (%)</span>
|
||||
<NSlider v-model:value="panelState.panelConfig.marginTop" class="max-w-[200px]" :step="1" :max="50" />
|
||||
</div>
|
||||
</NGridItem>
|
||||
<NGridItem span="12 400:6">
|
||||
<div class="flex items-center mt-[10px]">
|
||||
<span class="mr-[10px]">下边距 (%)</span>
|
||||
<NSlider v-model:value="panelState.panelConfig.marginBottom" class="max-w-[200px]" :step="1" :max="50" />
|
||||
</div>
|
||||
</NGridItem>
|
||||
</NGrid>
|
||||
</NCard>
|
||||
|
||||
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
|
||||
<NPopconfirm
|
||||
@positive-click="resetPanelConfig"
|
||||
>
|
||||
<template #trigger>
|
||||
<NButton size="small" quaternary type="error">
|
||||
重置
|
||||
</NButton>
|
||||
</template>
|
||||
确定要重置这些样式吗?
|
||||
</NPopconfirm>
|
||||
|
||||
<NButton size="small" quaternary type="success" class="ml-[10px]" @click="uploadCloud">
|
||||
立即同步到云端
|
||||
</NButton>
|
||||
</NCard>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.text-shadow{
|
||||
text-shadow: 0px 0px 5px gray;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,183 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NButtonGroup, NCard, NEllipsis, NGrid, NGridItem, NImage, NImageGroup, NSpin, useDialog, useMessage } from 'naive-ui'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { deletes, getList } from '@/api/system/file'
|
||||
import { set as savePanelConfig } from '@/api/panel/userConfig'
|
||||
import { RoundCardModal, SvgIcon } from '@/components/common'
|
||||
import { copyToClipboard, timeFormat } from '@/utils/cmn'
|
||||
import { t } from '@/locales'
|
||||
import { usePanelState } from '@/store'
|
||||
|
||||
interface InfoModalState {
|
||||
title: string
|
||||
show: boolean
|
||||
fileInfo: File.Info | null
|
||||
}
|
||||
const imageList = ref<File.Info[]>([])
|
||||
const ms = useMessage()
|
||||
const dialog = useDialog()
|
||||
const panelStore = usePanelState()
|
||||
const loading = ref(false)
|
||||
const infoModalState = ref<InfoModalState>({
|
||||
show: false,
|
||||
title: '',
|
||||
fileInfo: null,
|
||||
})
|
||||
|
||||
async function getFileList() {
|
||||
loading.value = true
|
||||
const { data } = await getList<Common.ListResponse<File.Info[]>>()
|
||||
imageList.value = data.list
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
async function copyImageUrl(text: string) {
|
||||
const res = await copyToClipboard(text)
|
||||
if (res)
|
||||
ms.success(t('apps.uploadsFileManager.copySuccess'))
|
||||
|
||||
else
|
||||
ms.error(t('apps.uploadsFileManager.copyFailed'))
|
||||
}
|
||||
|
||||
function handleDelete(id: number) {
|
||||
dialog.warning({
|
||||
title: t('common.warning'),
|
||||
content: t('apps.uploadsFileManager.deleteWarningText'),
|
||||
positiveText: t('common.confirm'),
|
||||
negativeText: t('common.cancel'),
|
||||
onPositiveClick: () => {
|
||||
deletesImges(id)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async function deletesImges(id: number) {
|
||||
try {
|
||||
const { code, msg } = await deletes([id])
|
||||
if (code === 0) {
|
||||
getFileList()
|
||||
ms.success(t('common.success'))
|
||||
}
|
||||
else {
|
||||
ms.error(`${t('common.failed')}:${msg}`)
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
ms.error(t('common.failed'))
|
||||
}
|
||||
}
|
||||
|
||||
function handleInfoClick(fileInfo: File.Info) {
|
||||
infoModalState.value.fileInfo = fileInfo
|
||||
infoModalState.value.show = true
|
||||
}
|
||||
|
||||
function handleSetWallpaper(imgSrc: string) {
|
||||
panelStore.panelConfig.backgroundImageSrc = imgSrc
|
||||
savePanelConfig({ panel: panelStore.panelConfig })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getFileList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="bg-slate-200 p-2 h-full">
|
||||
<NSpin v-show="loading" size="small" />
|
||||
<div class="flex justify-center">
|
||||
<NImageGroup>
|
||||
<NGrid cols="2 300:2 600:4 900:6 1100:9" :x-gap="5" :y-gap="5">
|
||||
<NGridItem v-for=" item, index in imageList" :key="index">
|
||||
<NCard size="small" style="border-radius: 5px;" :bordered="true">
|
||||
<template #cover>
|
||||
<div class="card transparent-grid">
|
||||
<NImage :lazy="true" style="object-fit: contain;height: 100%;" :src="item.src" />
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<span class="text-xs">
|
||||
<NEllipsis>
|
||||
{{ item.fileName }}
|
||||
</NEllipsis>
|
||||
</span>
|
||||
<div class="flex justify-center mt-[10px]">
|
||||
<NButtonGroup>
|
||||
<NButton size="tiny" tertiary style="cursor: pointer;" :title="$t('apps.uploadsFileManager.copyLink')" @click="copyImageUrl(item.src)">
|
||||
<template #icon>
|
||||
<SvgIcon icon="ion-copy" />
|
||||
</template>
|
||||
</NButton>
|
||||
<NButton size="tiny" tertiary style="cursor: pointer;" :title="timeFormat(item.createTime)" @click="handleInfoClick(item)">
|
||||
<template #icon>
|
||||
<SvgIcon icon="mdi-information-box-outline" />
|
||||
</template>
|
||||
</NButton>
|
||||
<NButton size="tiny" tertiary style="cursor: pointer;" :title="$t('apps.uploadsFileManager.setWallpaper')" @click="handleSetWallpaper(item.src)">
|
||||
<template #icon>
|
||||
<SvgIcon icon="lucide:wallpaper" />
|
||||
</template>
|
||||
</NButton>
|
||||
<NButton size="tiny" tertiary type="error" style="cursor: pointer;" :title="$t('common.delete')" @click="handleDelete(item.id as number)">
|
||||
<template #icon>
|
||||
<SvgIcon icon="material-symbols-delete" />
|
||||
</template>
|
||||
</NButton>
|
||||
</NButtonGroup>
|
||||
</div>
|
||||
</template>
|
||||
</NCard>
|
||||
</NGridItem>
|
||||
</NGrid>
|
||||
</NImageGroup>
|
||||
</div>
|
||||
|
||||
<RoundCardModal v-model:show="infoModalState.show" style="max-width: 300px;" size="small" :title="$t('apps.uploadsFileManager.infoTitle')">
|
||||
<div>
|
||||
<div>
|
||||
<div class="mb-2">
|
||||
<span class="text-slate-500">
|
||||
{{ $t('apps.uploadsFileManager.fileName') }}
|
||||
</span>
|
||||
<div class="text-xs">
|
||||
{{ infoModalState.fileInfo?.fileName }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<span class="text-slate-500">
|
||||
{{ $t('apps.uploadsFileManager.path') }}
|
||||
</span>
|
||||
<div class="text-xs">
|
||||
{{ infoModalState.fileInfo?.src }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<span class="text-slate-500">
|
||||
{{ $t('apps.uploadsFileManager.uploadTime') }}
|
||||
</span>
|
||||
<div class="text-xs">
|
||||
{{ timeFormat(infoModalState.fileInfo?.createTime) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</RoundCardModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.card {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.transparent-grid {
|
||||
background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%),
|
||||
linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%);
|
||||
background-size: 16px 16px;
|
||||
background-position: 0 0, 8px 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,201 @@
|
||||
<script setup lang="ts">
|
||||
import type { FormInst, FormRules } from 'naive-ui'
|
||||
import { NButton, NCard, NDivider, NForm, NFormItem, NInput, useDialog, useMessage } from 'naive-ui'
|
||||
import { ref } from 'vue'
|
||||
import { useAuthStore, usePanelState, useUserStore } from '@/store'
|
||||
import { logout } from '@/api'
|
||||
import { router } from '@/router'
|
||||
import { RoundCardModal, SvgIcon } from '@/components/common/'
|
||||
import { updateInfo, updatePassword } from '@/api/system/user'
|
||||
import { updateLocalUserInfo } from '@/utils/cmn'
|
||||
import { t } from '@/locales'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const authStore = useAuthStore()
|
||||
const panelState = usePanelState()
|
||||
const ms = useMessage()
|
||||
const dialog = useDialog()
|
||||
|
||||
const nickName = ref(authStore.userInfo?.name || '')
|
||||
const isEditNickNameStatus = ref(false)
|
||||
const formRef = ref<FormInst | null>(null)
|
||||
|
||||
const updatePasswordModalState = ref({
|
||||
show: false,
|
||||
loading: false,
|
||||
form: {
|
||||
password: '',
|
||||
oldPassword: '',
|
||||
confirmPassword: '',
|
||||
},
|
||||
})
|
||||
|
||||
const updatePasswordModalFormRules: FormRules = {
|
||||
oldPassword: {
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
min: 6,
|
||||
max: 20,
|
||||
message: t('adminSettingUsers.formRules.passwordLimit'),
|
||||
},
|
||||
password: {
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
min: 6,
|
||||
max: 20,
|
||||
message: t('adminSettingUsers.formRules.passwordLimit'),
|
||||
},
|
||||
confirmPassword: {
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
min: 6,
|
||||
max: 20,
|
||||
message: t('adminSettingUsers.formRules.passwordLimit'),
|
||||
},
|
||||
}
|
||||
|
||||
async function logoutApi() {
|
||||
await logout()
|
||||
userStore.resetUserInfo()
|
||||
authStore.removeToken()
|
||||
panelState.removeState()
|
||||
ms.success(t('settingUserInfo.logoutSuccess'))
|
||||
router.push({ path: '/login' })
|
||||
location.reload()// 强制刷新一下页面
|
||||
}
|
||||
|
||||
function handleSaveInfo() {
|
||||
updateInfo(nickName.value).then(({ code, msg }) => {
|
||||
if (code === 0) {
|
||||
updateLocalUserInfo()
|
||||
isEditNickNameStatus.value = false
|
||||
}
|
||||
else {
|
||||
ms.error(`${t('common.editFail')}:${msg}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function handleUpdatePassword(e: MouseEvent) {
|
||||
e.preventDefault()
|
||||
formRef.value?.validate((errors) => {
|
||||
if (errors) {
|
||||
console.log(errors)
|
||||
return
|
||||
}
|
||||
|
||||
if (updatePasswordModalState.value.form.password !== updatePasswordModalState.value.form.confirmPassword) {
|
||||
ms.error(t('settingUserInfo.confirmPasswordInconsistentMsg'))
|
||||
return
|
||||
}
|
||||
updatePasswordModalState.value.loading = true
|
||||
updatePassword(updatePasswordModalState.value.form.oldPassword, updatePasswordModalState.value.form.password).then(({ code, msg }) => {
|
||||
if (code === 0) {
|
||||
// 成功
|
||||
updatePasswordModalState.value.show = false
|
||||
ms.success(t('common.success'))
|
||||
}
|
||||
else if (code === 0) {
|
||||
// 旧密码错误
|
||||
|
||||
}
|
||||
else {
|
||||
// 其他错误
|
||||
ms.error(`${t('common.failed')}:${msg}`)
|
||||
}
|
||||
}).finally(() => {
|
||||
updatePasswordModalState.value.loading = false
|
||||
}).catch(() => {
|
||||
ms.error(t('common.serverError'))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function handleLogout() {
|
||||
dialog.warning({
|
||||
title: t('common.warning'),
|
||||
content: t('settingUserInfo.confirmLogoutText'),
|
||||
positiveText: t('common.confirm'),
|
||||
negativeText: t('common.cancel'),
|
||||
onPositiveClick: () => {
|
||||
logoutApi()
|
||||
},
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="bg-slate-200 p-2 h-full">
|
||||
<NCard style="border-radius:10px" size="small">
|
||||
<div>
|
||||
<div class="text-slate-500 font-bold">
|
||||
{{ $t('common.username') }}
|
||||
</div>
|
||||
{{ authStore.userInfo?.username }}
|
||||
</div>
|
||||
|
||||
<div class="mt-[10px]">
|
||||
<div class="text-slate-500 font-bold">
|
||||
{{ $t('common.nikeName') }}
|
||||
</div>
|
||||
|
||||
<div v-if="!isEditNickNameStatus">
|
||||
{{ authStore.userInfo?.name }}
|
||||
|
||||
<NButton size="small" text type="info" @click="isEditNickNameStatus = !isEditNickNameStatus">
|
||||
{{ $t('common.edit') }}
|
||||
</NButton>
|
||||
</div>
|
||||
|
||||
<div v-else class="flex items-center">
|
||||
<div class="max-w-[150px]">
|
||||
<NInput v-model:value="nickName" type="text" :placeholder="$t('common.inputPlaceholder')" />
|
||||
</div>
|
||||
<NButton size="small" quaternary type="info" @click="handleSaveInfo">
|
||||
{{ $t('common.save') }}
|
||||
</NButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<NDivider style="margin: 10px 0;" dashed />
|
||||
<div>
|
||||
<NButton size="small" text type="info" @click="updatePasswordModalState.show = !updatePasswordModalState.show">
|
||||
{{ $t('settingUserInfo.updatePassword') }}
|
||||
</NButton>
|
||||
</div>
|
||||
</NCard>
|
||||
|
||||
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
|
||||
<NButton size="small" text type="error" @click="handleLogout">
|
||||
<template #icon>
|
||||
<SvgIcon icon="tabler:logout" />
|
||||
</template>
|
||||
{{ $t('settingUserInfo.logout') }}
|
||||
</NButton>
|
||||
</NCard>
|
||||
|
||||
<RoundCardModal v-model:show="updatePasswordModalState.show" size="small" preset="card" style="width: 400px" :title="$t('settingUserInfo.updatePassword')">
|
||||
<NForm ref="formRef" :model="updatePasswordModalState.form" :rules="updatePasswordModalFormRules">
|
||||
<NFormItem path="oldPassword" :label="$t('settingUserInfo.oldPassword')">
|
||||
<NInput v-model:value="updatePasswordModalState.form.oldPassword" :maxlength="20" type="password" :placeholder="$t('settingUserInfo.oldPassword')" />
|
||||
</NFormItem>
|
||||
|
||||
<NFormItem path="password" :label="$t('settingUserInfo.newPassword')">
|
||||
<NInput v-model:value="updatePasswordModalState.form.password" :maxlength="20" type="password" :placeholder="$t('settingUserInfo.newPassword')" />
|
||||
</NFormItem>
|
||||
|
||||
<NFormItem path="confirmPassword" :label="$t('settingUserInfo.confirmPassword')">
|
||||
<NInput v-model:value="updatePasswordModalState.form.confirmPassword" :maxlength="20" type="password" :placeholder="$t('settingUserInfo.confirmPassword')" />
|
||||
</NFormItem>
|
||||
</NForm>
|
||||
|
||||
<template #footer>
|
||||
<div class="float-right">
|
||||
<NButton type="success" size="small" :loading="updatePasswordModalState.loading" @click="handleUpdatePassword">
|
||||
{{ $t('common.save') }}
|
||||
</NButton>
|
||||
</div>
|
||||
</template>
|
||||
</RoundCardModal>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,141 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, defineEmits, defineProps, ref, watch } from 'vue'
|
||||
import type { FormInst, FormRules } from 'naive-ui'
|
||||
import { NButton, NForm, NFormItem, NInput, NSelect, useMessage } from 'naive-ui'
|
||||
import { edit as userManageEdit } from '@/api/panel/users'
|
||||
import { RoundCardModal } from '@/components/common'
|
||||
import { t } from '@/locales'
|
||||
|
||||
interface Props {
|
||||
visible: boolean
|
||||
userId?: number
|
||||
userInfo?: User.Info
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const emit = defineEmits<Emit>()
|
||||
const message = useMessage()
|
||||
|
||||
interface Emit {
|
||||
(e: 'update:visible', visible: boolean): void
|
||||
(e: 'done', id: number): void// 创建完成
|
||||
}
|
||||
|
||||
const formInitValue = {
|
||||
name: '',
|
||||
username: '',
|
||||
role: 2,
|
||||
status: 3,
|
||||
}
|
||||
|
||||
const model = ref<User.Info>(formInitValue)
|
||||
const formRef = ref<FormInst | null>(null)
|
||||
|
||||
const roleOtions = ref([
|
||||
{
|
||||
label: t('common.role.regularUser'),
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: t('common.role.admin'),
|
||||
value: 1,
|
||||
},
|
||||
])
|
||||
|
||||
const rules: FormRules = {
|
||||
username: [
|
||||
{
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
message: t('adminSettingUsers.formRules.usernameRequired'),
|
||||
min: 5,
|
||||
},
|
||||
],
|
||||
role: {
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
type: 'number',
|
||||
message: t('adminSettingUsers.formRules.roleRequired'),
|
||||
},
|
||||
// status: {
|
||||
// required: true,
|
||||
// trigger: 'blur',
|
||||
// type: 'number',
|
||||
// message: '请选择账号状态',
|
||||
// },
|
||||
password: {
|
||||
trigger: 'blur',
|
||||
min: 6,
|
||||
max: 20,
|
||||
message: t('adminSettingUsers.formRules.passwordLimit'),
|
||||
},
|
||||
}
|
||||
|
||||
// 更新值父组件传来的值
|
||||
const show = computed({
|
||||
get: () => props.visible,
|
||||
set: (visible: boolean) => {
|
||||
emit('update:visible', visible)
|
||||
},
|
||||
})
|
||||
|
||||
watch(show, (newValue, oldValue) => {
|
||||
if (props.userInfo?.id)
|
||||
model.value = props.userInfo || {}
|
||||
|
||||
else
|
||||
model.value = formInitValue
|
||||
})
|
||||
|
||||
const add = async () => {
|
||||
const res = await userManageEdit<User.Info>(model.value)
|
||||
if (res.code === 0)
|
||||
emit('done', res.data.id as number)
|
||||
|
||||
else if (res.code !== -1)
|
||||
message.warning(t('common.failed'))
|
||||
}
|
||||
|
||||
const handleValidateButtonClick = (e: MouseEvent) => {
|
||||
e.preventDefault()
|
||||
formRef.value?.validate((errors) => {
|
||||
if (!errors)
|
||||
add()
|
||||
else
|
||||
console.log(errors)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RoundCardModal v-model:show="show" size="small" preset="card" style="width: 400px" :title="`${userInfo?.id ? $t('common.edit') : $t('common.add')}`">
|
||||
<NForm ref="formRef" :model="model" :rules="rules">
|
||||
<NFormItem path="username" :label="$t('common.username')">
|
||||
<NInput v-model:value="model.username" type="text" :placeholder="$t('common.inputPlaceholder')" />
|
||||
</NFormItem>
|
||||
|
||||
<NFormItem path="name" :label="$t('common.nikeName')">
|
||||
<NInput v-model:value="model.name" type="text" :placeholder="$t('common.inputPlaceholder')" />
|
||||
</NFormItem>
|
||||
|
||||
<NFormItem path="role" :label="$t('adminSettingUsers.role')">
|
||||
<NSelect
|
||||
v-model:value="model.role"
|
||||
:options="roleOtions"
|
||||
/>
|
||||
</NFormItem>
|
||||
|
||||
<NFormItem path="password" :label="$t('common.password')">
|
||||
<NInput v-model:value="model.password" :maxlength="20" type="password" :placeholder="`${userInfo?.id ? $t('adminSettingUsers.EditpasswordPlaceholder') : $t('adminSettingUsers.passwordPlaceholder')}`" />
|
||||
</NFormItem>
|
||||
</NForm>
|
||||
|
||||
<template #footer>
|
||||
<div class="float-right">
|
||||
<NButton type="success" size="small" @click="handleValidateButtonClick">
|
||||
{{ $t('common.save') }}
|
||||
</NButton>
|
||||
</div>
|
||||
</template>
|
||||
</RoundCardModal>
|
||||
</template>
|
||||
@@ -0,0 +1,240 @@
|
||||
<script lang="ts" setup>
|
||||
import { h, onMounted, reactive, ref } from 'vue'
|
||||
import { NAlert, NButton, NDataTable, NDropdown, NTag, useDialog, useMessage } from 'naive-ui'
|
||||
import type { DataTableColumns, PaginationProps } from 'naive-ui'
|
||||
import EditUser from './EditUser/index.vue'
|
||||
import { getPublicVisitUser, setPublicVisitUser, deletes as usersDeletes, getList as usersGetList } from '@/api/panel/users'
|
||||
import { SvgIcon } from '@/components/common'
|
||||
import { useAuthStore } from '@/store'
|
||||
import { t } from '@/locales'
|
||||
import { AdminAuthRole } from '@/enums/admin'
|
||||
|
||||
const message = useMessage()
|
||||
const authStore = useAuthStore()
|
||||
const tableIsLoading = ref<boolean>(false)
|
||||
const editUserDialogShow = ref<boolean>(false)
|
||||
const keyWord = ref<string>()
|
||||
const editUserUserInfo = ref<User.Info>()
|
||||
const dialog = useDialog()
|
||||
const publicVisitUserId = ref<number | null>(null)
|
||||
|
||||
const createColumns = ({
|
||||
update,
|
||||
}: {
|
||||
update: (row: User.Info) => void
|
||||
}): DataTableColumns<User.Info> => {
|
||||
return [
|
||||
{
|
||||
title: t('common.username'),
|
||||
key: 'username',
|
||||
render(row: User.Info) {
|
||||
let publicVisitHtml = ''
|
||||
if (publicVisitUserId.value && publicVisitUserId.value === row.id)
|
||||
publicVisitHtml = `[${t('adminSettingUsers.pblicText')}]-`
|
||||
|
||||
if (row.username === authStore.userInfo?.username)
|
||||
return `${publicVisitHtml}${row.username} (${t('adminSettingUsers.currentUseUsername')})`
|
||||
return publicVisitHtml + row.username
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t('common.nikeName'),
|
||||
key: 'name',
|
||||
},
|
||||
{
|
||||
title: t('adminSettingUsers.role'),
|
||||
key: 'role',
|
||||
render(row) {
|
||||
switch (row.role) {
|
||||
case AdminAuthRole.admin:
|
||||
return h(NTag, { type: 'info' }, t('common.role.admin'))
|
||||
case AdminAuthRole.regularUser:
|
||||
return h(NTag, t('common.role.regularUser'))
|
||||
default:
|
||||
return '-'
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t('common.action'),
|
||||
key: '',
|
||||
render(row) {
|
||||
const btn = h(
|
||||
NButton,
|
||||
{
|
||||
strong: true,
|
||||
tertiary: true,
|
||||
size: 'small',
|
||||
},
|
||||
{
|
||||
default() {
|
||||
return h(
|
||||
SvgIcon, {
|
||||
icon: 'mingcute:more-1-fill',
|
||||
},
|
||||
)
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
return h(NDropdown, {
|
||||
trigger: 'click',
|
||||
onSelect(key: string | number) {
|
||||
switch (key) {
|
||||
case 'update':
|
||||
update(row)
|
||||
break
|
||||
case 'publicMode':
|
||||
// 取消
|
||||
if (publicVisitUserId.value && publicVisitUserId.value === row.id) {
|
||||
setPublicVisitUser(null).then(({ code }) => {
|
||||
if (code === 0)
|
||||
publicVisitUserId.value = null
|
||||
})
|
||||
}
|
||||
else {
|
||||
// 设置
|
||||
setPublicVisitUser(row.id as number).then(({ code }) => {
|
||||
if (code === 0)
|
||||
publicVisitUserId.value = row.id as number
|
||||
else if (code === 1111)
|
||||
message.error('用户不存在,请刷新后再试')
|
||||
})
|
||||
}
|
||||
break
|
||||
case 'delete':
|
||||
dialog.warning({
|
||||
title: t('common.warning'),
|
||||
content: t('adminSettingUsers.deletePromptContent', { name: row.name, username: row.username }),
|
||||
positiveText: t('common.confirm'),
|
||||
negativeText: t('common.cancel'),
|
||||
onPositiveClick: () => {
|
||||
deletes([row.id as number])
|
||||
},
|
||||
})
|
||||
break
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
},
|
||||
options: [
|
||||
{
|
||||
label: t('common.edit'),
|
||||
key: 'update',
|
||||
},
|
||||
{
|
||||
label: t('adminSettingUsers.setOrUnsetPublicMode'),
|
||||
key: 'publicMode',
|
||||
},
|
||||
{
|
||||
label: t('common.delete'),
|
||||
key: 'delete',
|
||||
},
|
||||
],
|
||||
}, { default: () => btn })
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
const userList = ref<User.Info[]>()
|
||||
|
||||
const columns = createColumns({
|
||||
update(row: User.Info) {
|
||||
editUserUserInfo.value = row
|
||||
editUserDialogShow.value = true
|
||||
},
|
||||
})
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
showSizePicker: true,
|
||||
pageSizes: [10, 30, 50, 100, 200],
|
||||
pageSize: 10,
|
||||
itemCount: 0,
|
||||
onChange: (page: number) => {
|
||||
pagination.page = page
|
||||
getList(null)
|
||||
},
|
||||
onUpdatePageSize: (pageSize: number) => {
|
||||
pagination.pageSize = pageSize
|
||||
pagination.page = 1
|
||||
getList(null)
|
||||
},
|
||||
prefix(item: PaginationProps) {
|
||||
return t('adminSettingUsers.userCountText', { count: item.itemCount })
|
||||
},
|
||||
})
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
getList(page)
|
||||
}
|
||||
|
||||
// 添加
|
||||
function handleAdd() {
|
||||
editUserDialogShow.value = true
|
||||
editUserUserInfo.value = {}
|
||||
}
|
||||
|
||||
function handelDone() {
|
||||
editUserDialogShow.value = false
|
||||
message.success(t('common.success'))
|
||||
getList(null)
|
||||
}
|
||||
|
||||
async function getList(page: number | null) {
|
||||
tableIsLoading.value = true
|
||||
const req: AdminUserManage.GetListRequest = {
|
||||
page: page || pagination.page,
|
||||
limit: pagination.pageSize,
|
||||
}
|
||||
if (keyWord.value !== '')
|
||||
req.keyWord = keyWord.value
|
||||
|
||||
const { data } = await usersGetList<Common.ListResponse<User.Info[]>>(req)
|
||||
pagination.itemCount = data.count
|
||||
if (data.list)
|
||||
userList.value = data.list
|
||||
tableIsLoading.value = false
|
||||
}
|
||||
|
||||
async function deletes(ids: number[]) {
|
||||
const { code } = await usersDeletes(ids)
|
||||
if (code === 0) {
|
||||
message.success(t('common.deleteSuccess'))
|
||||
getList(null)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getPublicVisitUser<User.Info>().then(({ data }) => {
|
||||
publicVisitUserId.value = data.id || null
|
||||
})
|
||||
getList(null)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="overflow-auto pt-2">
|
||||
<NAlert type="info" :bordered="false">
|
||||
{{ $t('adminSettingUsers.alertText') }}
|
||||
</NAlert>
|
||||
<div class="my-[10px]">
|
||||
<NButton type="primary" size="small" ghost @click="handleAdd">
|
||||
{{ $t('common.add') }}
|
||||
</NButton>
|
||||
</div>
|
||||
|
||||
<NDataTable
|
||||
:columns="columns"
|
||||
:data="userList"
|
||||
:pagination="pagination"
|
||||
:bordered="false"
|
||||
:loading="tableIsLoading"
|
||||
:remote="true"
|
||||
|
||||
@update:page="handlePageChange"
|
||||
/>
|
||||
<EditUser v-model:visible="editUserDialogShow" :user-info="editUserUserInfo" @done="handelDone" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,15 @@
|
||||
import About from './About/index.vue'
|
||||
import ImportExport from './ImportExport/index.vue'
|
||||
import ItemGroupManage from './ItemGroupManage/index.vue'
|
||||
import Style from './Style/index.vue'
|
||||
import UserInfo from './UserInfo/index.vue'
|
||||
import Users from './Users/index.vue'
|
||||
|
||||
export {
|
||||
About,
|
||||
ImportExport,
|
||||
ItemGroupManage,
|
||||
Style,
|
||||
UserInfo,
|
||||
Users,
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<script setup lang="ts">
|
||||
import { defineAsyncComponent, onMounted, shallowRef, watch } from 'vue'
|
||||
import { NSpin } from 'naive-ui'
|
||||
|
||||
const props = defineProps<{
|
||||
componentName: string | null
|
||||
}>()
|
||||
const loading = shallowRef(false)
|
||||
const dynamicComponent = shallowRef('')
|
||||
|
||||
function updateComponent() {
|
||||
loading.value = true
|
||||
dynamicComponent.value = defineAsyncComponent(() =>
|
||||
import(`../../apps/${props.componentName}/index.vue`)
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
}).catch(() => {
|
||||
// 组件不存在
|
||||
dynamicComponent.value = ''
|
||||
return null
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
watch(() => props.componentName, () => {
|
||||
updateComponent()
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
updateComponent()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="h-full">
|
||||
<NSpin :show="loading" style="height: 100%;" content-style="height: 100%;" :delay="500" description="loading...">
|
||||
<component :is="dynamicComponent" v-if="dynamicComponent" />
|
||||
<!-- <component :is="getComponent(componentName || '')" v-if="dynamicComponent" /> -->
|
||||
<div
|
||||
v-else-if="!dynamicComponent"
|
||||
>
|
||||
Component not found!
|
||||
</div>
|
||||
</NSpin>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { NAvatar, NImage } from 'naive-ui'
|
||||
import { computed, ref, withDefaults } from 'vue'
|
||||
import { SvgIcon } from '@/components/common'
|
||||
import { SvgIconOnline } from '@/components/common'
|
||||
|
||||
interface Prop {
|
||||
itemIcon?: Panel.ItemIcon | null
|
||||
@@ -39,7 +39,7 @@ const iconExt = computed(() => {
|
||||
|
||||
<div v-else-if="itemIcon?.itemType === 3">
|
||||
<NAvatar :size="props.size" :style="{ backgroundColor: (forceBackground ?? itemIcon?.backgroundColor) || defaultBackground }">
|
||||
<SvgIcon style="font-size: 35px;" :icon="itemIcon.text" />
|
||||
<SvgIconOnline style="font-size: 35px;" :icon="itemIcon.text" />
|
||||
</NAvatar>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
|
||||
const jsonData = ref<string | null>(null)
|
||||
|
||||
const handleFileChange = (event: Event) => {
|
||||
const input = event.target as HTMLInputElement
|
||||
const file = input.files?.[0]
|
||||
|
||||
if (file) {
|
||||
const reader = new FileReader()
|
||||
reader.onload = () => {
|
||||
if (reader.result)
|
||||
jsonData.value = reader.result as string
|
||||
}
|
||||
reader.readAsText(file)
|
||||
}
|
||||
}
|
||||
|
||||
const exportJson = () => {
|
||||
if (jsonData.value) {
|
||||
const blob = new Blob([jsonData.value], { type: 'application/json' })
|
||||
const link = document.createElement('a')
|
||||
link.href = URL.createObjectURL(blob)
|
||||
link.download = 'exported_data.json'
|
||||
link.click()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<input type="file" @change="handleFileChange">
|
||||
<button @click="exportJson">
|
||||
导出JSON
|
||||
</button>
|
||||
|
||||
<div v-if="jsonData">
|
||||
<h2>JSON 数据</h2>
|
||||
<pre>{{ jsonData }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,55 +0,0 @@
|
||||
<script setup lang='ts'>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { NSpin } from 'naive-ui'
|
||||
import { fetchChatConfig } from '@/api'
|
||||
import { getAboutDescription as getAboutDescriptionApi } from '@/api/openness'
|
||||
|
||||
interface ConfigState {
|
||||
timeoutMs?: number
|
||||
reverseProxy?: string
|
||||
apiModel?: string
|
||||
socksProxy?: string
|
||||
httpsProxy?: string
|
||||
usage?: string
|
||||
}
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const config = ref<ConfigState>()
|
||||
|
||||
const content = ref<string>()
|
||||
|
||||
async function fetchConfig() {
|
||||
try {
|
||||
loading.value = true
|
||||
const { data } = await fetchChatConfig<ConfigState>()
|
||||
config.value = data
|
||||
}
|
||||
finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchConfig()
|
||||
getAboutDescription()
|
||||
})
|
||||
|
||||
async function getAboutDescription() {
|
||||
const { data } = await getAboutDescriptionApi<string>()
|
||||
content.value = data
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NSpin :show="loading">
|
||||
<div class="p-4 space-y-4">
|
||||
<h2 class="text-xl font-bold">
|
||||
{{ $t('common.appName') }}
|
||||
</h2>
|
||||
<div>
|
||||
<span v-html="content" />
|
||||
</div>
|
||||
</div>
|
||||
</NSpin>
|
||||
</template>
|
||||
@@ -1,225 +0,0 @@
|
||||
<!-- eslint-disable eslint-comments/no-unlimited-disable
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import { NButton, NInput, NPopconfirm, NSelect, useMessage } from 'naive-ui'
|
||||
import type { Language, Theme } from '@/store/modules/app/helper'
|
||||
import { SvgIcon } from '@/components/common'
|
||||
import { useAppStore, useUserStore } from '@/store'
|
||||
import type { UserInfo } from '@/store/modules/user/helper'
|
||||
import { getCurrentDate } from '@/utils/functions'
|
||||
import { useBasicLayout } from '@/hooks/useBasicLayout'
|
||||
import { t } from '@/locales'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const { isMobile } = useBasicLayout()
|
||||
|
||||
const ms = useMessage()
|
||||
|
||||
const theme = computed(() => appStore.theme)
|
||||
|
||||
const userInfo = computed(() => userStore.userInfo)
|
||||
|
||||
const avatar = ref(userInfo.value.headImage ?? '')
|
||||
|
||||
const name = ref(userInfo.value.name ?? '')
|
||||
|
||||
// const description = ref(userInfo.value.description ?? '')
|
||||
|
||||
const language = computed({
|
||||
get() {
|
||||
return appStore.language
|
||||
},
|
||||
set(value: Language) {
|
||||
appStore.setLanguage(value)
|
||||
},
|
||||
})
|
||||
|
||||
const themeOptions: { label: string; key: Theme; icon: string }[] = [
|
||||
{
|
||||
label: 'Auto',
|
||||
key: 'auto',
|
||||
icon: 'ri:contrast-line',
|
||||
},
|
||||
{
|
||||
label: 'Light',
|
||||
key: 'light',
|
||||
icon: 'ri:sun-foggy-line',
|
||||
},
|
||||
{
|
||||
label: 'Dark',
|
||||
key: 'dark',
|
||||
icon: 'ri:moon-foggy-line',
|
||||
},
|
||||
]
|
||||
|
||||
const languageOptions: { label: string; key: Language; value: Language }[] = [
|
||||
{ label: '简体中文', key: 'zh-CN', value: 'zh-CN' },
|
||||
{ label: '繁體中文', key: 'zh-TW', value: 'zh-TW' },
|
||||
{ label: 'English', key: 'en-US', value: 'en-US' },
|
||||
{ label: '한국어', key: 'ko-KR', value: 'ko-KR' },
|
||||
]
|
||||
|
||||
function updateUserInfo(options: Partial<UserInfo>) {
|
||||
// userStore.updateUserInfo(options)
|
||||
ms.success(t('common.success'))
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
userStore.resetUserInfo()
|
||||
ms.success(t('common.success'))
|
||||
window.location.reload()
|
||||
}
|
||||
|
||||
function exportData(): void {
|
||||
const date = getCurrentDate()
|
||||
const data: string = localStorage.getItem('chatStorage') || '{}'
|
||||
const jsonString: string = JSON.stringify(JSON.parse(data), null, 2)
|
||||
const blob: Blob = new Blob([jsonString], { type: 'application/json' })
|
||||
const url: string = URL.createObjectURL(blob)
|
||||
const link: HTMLAnchorElement = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = `chat-store_${date}.json`
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
}
|
||||
|
||||
function importData(event: Event): void {
|
||||
const target = event.target as HTMLInputElement
|
||||
if (!target || !target.files)
|
||||
return
|
||||
|
||||
const file: File = target.files[0]
|
||||
if (!file)
|
||||
return
|
||||
|
||||
const reader: FileReader = new FileReader()
|
||||
reader.onload = () => {
|
||||
try {
|
||||
const data = JSON.parse(reader.result as string)
|
||||
localStorage.setItem('chatStorage', JSON.stringify(data))
|
||||
ms.success(t('common.success'))
|
||||
location.reload()
|
||||
}
|
||||
catch (error) {
|
||||
ms.error(t('common.invalidFileFormat'))
|
||||
}
|
||||
}
|
||||
reader.readAsText(file)
|
||||
}
|
||||
|
||||
function clearData(): void {
|
||||
localStorage.removeItem('chatStorage')
|
||||
location.reload()
|
||||
}
|
||||
|
||||
function handleImportButtonClick(): void {
|
||||
const fileInput = document.getElementById('fileInput') as HTMLElement
|
||||
if (fileInput)
|
||||
fileInput.click()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="p-4 space-y-5 min-h-[200px]">
|
||||
<div class="space-y-6">
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.avatarLink') }}</span>
|
||||
<div class="flex-1">
|
||||
<NInput v-model:value="avatar" placeholder="" />
|
||||
</div>
|
||||
<NButton size="tiny" text type="primary" @click="updateUserInfo({ headImage })">
|
||||
{{ $t('common.save') }}
|
||||
</NButton>
|
||||
</div>
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.name') }}</span>
|
||||
<div class="w-[200px]">
|
||||
<NInput v-model:value="name" placeholder="" />
|
||||
</div>
|
||||
<NButton size="tiny" text type="primary" @click="updateUserInfo({ name })">
|
||||
{{ $t('common.save') }}
|
||||
</NButton>
|
||||
</div>
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.description') }}</span>
|
||||
<div class="flex-1">
|
||||
<NInput v-model:value="description" placeholder="" />
|
||||
</div>
|
||||
<NButton size="tiny" text type="primary" @click="updateUserInfo({ description })">
|
||||
{{ $t('common.save') }}
|
||||
</NButton>
|
||||
</div>
|
||||
<div
|
||||
class="flex items-center space-x-4"
|
||||
:class="isMobile && 'items-start'"
|
||||
>
|
||||
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.chatHistory') }}</span>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-4">
|
||||
<NButton size="small" @click="exportData">
|
||||
<template #icon>
|
||||
<SvgIcon icon="ri:download-2-fill" />
|
||||
</template>
|
||||
{{ $t('common.export') }}
|
||||
</NButton>
|
||||
|
||||
<input id="fileInput" type="file" style="display:none" @change="importData">
|
||||
<NButton size="small" @click="handleImportButtonClick">
|
||||
<template #icon>
|
||||
<SvgIcon icon="ri:upload-2-fill" />
|
||||
</template>
|
||||
{{ $t('common.import') }}
|
||||
</NButton>
|
||||
|
||||
<NPopconfirm placement="bottom" @positive-click="clearData">
|
||||
<template #trigger>
|
||||
<NButton size="small">
|
||||
<template #icon>
|
||||
<SvgIcon icon="ri:close-circle-line" />
|
||||
</template>
|
||||
{{ $t('common.clear') }}
|
||||
</NButton>
|
||||
</template>
|
||||
{{ $t('chat.clearHistoryConfirm') }}
|
||||
</NPopconfirm>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.theme') }}</span>
|
||||
<div class="flex flex-wrap items-center gap-4">
|
||||
<template v-for="item of themeOptions" :key="item.key">
|
||||
<NButton
|
||||
size="small"
|
||||
:type="item.key === theme ? 'primary' : undefined"
|
||||
@click="appStore.setTheme(item.key)"
|
||||
>
|
||||
<template #icon>
|
||||
<SvgIcon :icon="item.icon" />
|
||||
</template>
|
||||
</NButton>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.language') }}</span>
|
||||
<div class="flex flex-wrap items-center gap-4">
|
||||
<NSelect
|
||||
style="width: 140px"
|
||||
:value="language"
|
||||
:options="languageOptions"
|
||||
@update-value="value => appStore.setLanguage(value)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.resetUserInfo') }}</span>
|
||||
<NButton size="small" @click="handleReset">
|
||||
{{ $t('common.reset') }}
|
||||
</NButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template> -->
|
||||
@@ -1,62 +0,0 @@
|
||||
<script setup lang='ts'>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { NButton, NInput, NInputGroup, NSpin } from 'naive-ui'
|
||||
import { useClipboard } from '@vueuse/core'
|
||||
import { getReferralCode as getReferralCodeApi } from '@/api/system/user'
|
||||
// import { copyText } from '@/utils/format'
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const referralCode = ref<string>('')
|
||||
const url = ref<string>('')
|
||||
const copyButtonText = ref<string>('')
|
||||
|
||||
async function getReferralCode() {
|
||||
try {
|
||||
loading.value = true
|
||||
const { data } = await getReferralCodeApi<User.GetReferralCodeResponse>()
|
||||
referralCode.value = data.referralCode
|
||||
url.value = `${getCurrentDomain()}/#/register?referralCode=${referralCode.value}`
|
||||
}
|
||||
finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function getCurrentDomain() {
|
||||
return `${location.protocol}//${location.hostname}${location.port === '' ? '' : (`:${location.port}`)}`
|
||||
}
|
||||
|
||||
function handleCopy() {
|
||||
const { copy } = useClipboard()
|
||||
// copyText({ text: urlCopy })
|
||||
copy(url.value)
|
||||
copyButtonText.value = '复制完成!'
|
||||
setInterval(() => {
|
||||
copyButtonText.value = '复制链接'
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getReferralCode()
|
||||
copyButtonText.value = '复制链接'
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NSpin :show="loading">
|
||||
<div class="p-4 space-y-4">
|
||||
<h2 class="text-xl ">
|
||||
您的专属推荐链接
|
||||
</h2>
|
||||
<div>
|
||||
<NInputGroup>
|
||||
<NInput v-model:value="url" readonly type="text" />
|
||||
<NButton type="primary" ghost @click="handleCopy">
|
||||
{{ copyButtonText }}
|
||||
</NButton>
|
||||
</NInputGroup>
|
||||
</div>
|
||||
</div>
|
||||
</NSpin>
|
||||
</template>
|
||||
@@ -1,227 +0,0 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import type { UploadFileInfo } from 'naive-ui'
|
||||
import { NAvatar, NButton, NInput, NUpload, useDialog, useMessage } from 'naive-ui'
|
||||
// import type { Language, Theme } from '@/store/modules/app/helper'
|
||||
import type { Theme } from '@/store/modules/app/helper'
|
||||
import { SvgIcon } from '@/components/common'
|
||||
import { useAppStore, useAuthStore, useUserStore } from '@/store'
|
||||
import type { UserInfo } from '@/store/modules/user/helper'
|
||||
import { t } from '@/locales'
|
||||
import { UserUpdateInfo, logout } from '@/api'
|
||||
import { router } from '@/router'
|
||||
|
||||
// import defaultAvatar from '@/assets/userDefaultAvatar.png'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const userStore = useUserStore()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const ms = useMessage()
|
||||
const dialog = useDialog()
|
||||
|
||||
const theme = computed(() => appStore.theme)
|
||||
|
||||
const userInfo = computed(() => userStore.userInfo)
|
||||
|
||||
const avatar = ref(userInfo.value.headImage ?? '')
|
||||
|
||||
const name = ref(userInfo.value.name ?? '')
|
||||
|
||||
// const description = ref(userInfo.value.description ?? '')
|
||||
|
||||
// const language = computed({
|
||||
// get() {
|
||||
// return appStore.language
|
||||
// },
|
||||
// set(value: Language) {
|
||||
// appStore.setLanguage(value)
|
||||
// },
|
||||
// })
|
||||
|
||||
const themeOptions: { label: string; key: Theme; icon: string }[] = [
|
||||
{
|
||||
label: 'Auto',
|
||||
key: 'auto',
|
||||
icon: 'ri:contrast-line',
|
||||
},
|
||||
{
|
||||
label: 'Light',
|
||||
key: 'light',
|
||||
icon: 'ri:sun-foggy-line',
|
||||
},
|
||||
{
|
||||
label: 'Dark',
|
||||
key: 'dark',
|
||||
icon: 'ri:moon-foggy-line',
|
||||
},
|
||||
]
|
||||
|
||||
// const languageOptions: { label: string; key: Language; value: Language }[] = [
|
||||
// { label: '简体中文', key: 'zh-CN', value: 'zh-CN' },
|
||||
// { label: '繁體中文', key: 'zh-TW', value: 'zh-TW' },
|
||||
// { label: 'English', key: 'en-US', value: 'en-US' },
|
||||
// { label: '한국어', key: 'ko-KR', value: 'ko-KR' },
|
||||
// ]
|
||||
|
||||
function updateUserInfo(options: Partial<UserInfo>) {
|
||||
userStore.updateUserInfo({
|
||||
headImage: userInfo.value.headImage,
|
||||
name: options.name as string,
|
||||
})
|
||||
UserUpdateInfo(userInfo.value.headImage as string, options.name as string)
|
||||
ms.success(t('common.success'))
|
||||
}
|
||||
|
||||
// function uploadHeadImage(options: Partial<UserInfo>) {
|
||||
|
||||
// }
|
||||
|
||||
function onLogoutClick() {
|
||||
dialog.warning({
|
||||
title: '警告',
|
||||
content: '你确定要退出登录',
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: () => {
|
||||
logoutApi()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async function logoutApi() {
|
||||
await logout()
|
||||
userStore.resetUserInfo()
|
||||
authStore.removeToken()
|
||||
ms.success('您已经安全退出,期待与你再次相见!')
|
||||
router.push({ path: '/login' })
|
||||
}
|
||||
|
||||
const handleFinish = ({
|
||||
file,
|
||||
event,
|
||||
}: {
|
||||
file: UploadFileInfo
|
||||
event?: ProgressEvent
|
||||
}) => {
|
||||
const res = JSON.parse((event?.target as XMLHttpRequest).response)
|
||||
// {
|
||||
// "code": 0,
|
||||
// "data": {
|
||||
// "imageUrl": "/uploads/2023/5/12/c94306cfdf37fe7844753cd98fd57aaf.jpg"
|
||||
// },
|
||||
// "msg": "OK"
|
||||
// }
|
||||
const imageUrl = res.data.imageUrl
|
||||
userStore.updateUserInfo({
|
||||
headImage: imageUrl,
|
||||
name: userInfo.value.name,
|
||||
})
|
||||
avatar.value = imageUrl
|
||||
UserUpdateInfo(imageUrl, userInfo.value.name || '')
|
||||
|
||||
return file
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="p-4 space-y-5 min-h-[200px]">
|
||||
<div class="space-y-6">
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">账号/邮箱</span>
|
||||
<div class="w-[200px]">
|
||||
<NInput v-model:value="userInfo.username" :disabled="true" readonly placeholder="" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">密码</span>
|
||||
<div class="w-[200px]">
|
||||
<NButton @click="router.push({ path: '/resetPassword', query: { u: userInfo.username } })">
|
||||
重置密码
|
||||
</NButton>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.avatar') }}</span>
|
||||
<div class="w-[50px]">
|
||||
<NAvatar
|
||||
round
|
||||
:size="48"
|
||||
:src="avatar ? avatar : ''"
|
||||
/>
|
||||
</div>
|
||||
<NUpload
|
||||
action="/api/file/uploadImg"
|
||||
name="imgfile"
|
||||
:headers="{
|
||||
token: authStore.token as string,
|
||||
}"
|
||||
@finish="handleFinish"
|
||||
>
|
||||
<NButton size="tiny" text type="primary">
|
||||
上传文件
|
||||
</NButton>
|
||||
</NUpload>
|
||||
<!-- <NButton size="tiny" text type="primary" @click="uploadHeadImage({ avatar })">
|
||||
选择文件
|
||||
</NButton> -->
|
||||
</div>
|
||||
<!-- <div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.avatarLink') }}</span>
|
||||
<div class="flex-1">
|
||||
<NInput v-model:value="avatar" placeholder="" />
|
||||
</div>
|
||||
<NButton size="tiny" text type="primary" @click="updateUserInfo({ avatar })">
|
||||
{{ $t('common.save') }}
|
||||
</NButton>
|
||||
</div> -->
|
||||
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.name') }}</span>
|
||||
<div class="w-[200px]">
|
||||
<NInput v-model:value="name" placeholder="" />
|
||||
</div>
|
||||
<NButton size="tiny" text type="primary" @click="updateUserInfo({ name })">
|
||||
{{ $t('common.save') }}
|
||||
</NButton>
|
||||
</div>
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.theme') }}</span>
|
||||
<div class="flex flex-wrap items-center gap-4">
|
||||
<template v-for="item of themeOptions" :key="item.key">
|
||||
<NButton
|
||||
size="small"
|
||||
:type="item.key === theme ? 'primary' : undefined"
|
||||
@click="appStore.setTheme(item.key)"
|
||||
>
|
||||
<template #icon>
|
||||
<SvgIcon :icon="item.icon" />
|
||||
</template>
|
||||
</NButton>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.language') }}</span>
|
||||
<div class="flex flex-wrap items-center gap-4">
|
||||
<NSelect
|
||||
style="width: 140px"
|
||||
:value="language"
|
||||
:options="languageOptions"
|
||||
@update-value="value => appStore.setLanguage(value)"
|
||||
/>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex-shrink-0 w-[100px]" />
|
||||
<NButton size="small" type="error" strong secondary @click="onLogoutClick">
|
||||
<template #icon>
|
||||
<SvgIcon icon="oi:account-logout" />
|
||||
</template>
|
||||
安全退出账号
|
||||
</NButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,80 +0,0 @@
|
||||
<script setup lang='ts'>
|
||||
import { computed, ref } from 'vue'
|
||||
import { NModal, NTabPane, NTabs } from 'naive-ui'
|
||||
import UserInfo from './UserInfo.vue'
|
||||
// import Advanced from './Advanced.vue'
|
||||
import About from './About.vue'
|
||||
import InviteUsers from './InviteUsers.vue'
|
||||
|
||||
// import { useAuthStore } from '@/store'
|
||||
import { SvgIcon } from '@/components/common'
|
||||
|
||||
interface Props {
|
||||
visible: boolean
|
||||
}
|
||||
|
||||
interface Emit {
|
||||
(e: 'update:visible', visible: boolean): void
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const emit = defineEmits<Emit>()
|
||||
|
||||
// const authStore = useAuthStore()
|
||||
|
||||
// const isChatGPTAPI = computed<boolean>(() => !!authStore.isChatGPTAPI)
|
||||
|
||||
const active = ref('General')
|
||||
|
||||
const show = computed({
|
||||
get() {
|
||||
return props.visible
|
||||
},
|
||||
set(visible: boolean) {
|
||||
emit('update:visible', visible)
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NModal v-model:show="show" :auto-focus="false" preset="card" style="width: 95%; max-width: 640px">
|
||||
<div>
|
||||
<NTabs v-model:value="active" type="line" animated>
|
||||
<NTabPane name="General" tab="General">
|
||||
<template #tab>
|
||||
<SvgIcon class="text-lg" icon="ri:file-user-line" />
|
||||
<span class="ml-2">设置</span>
|
||||
</template>
|
||||
<div class="min-h-[100px]">
|
||||
<UserInfo />
|
||||
</div>
|
||||
</NTabPane>
|
||||
<!-- <NTabPane v-if="isChatGPTAPI" name="Advanced" tab="Advanced">
|
||||
<template #tab>
|
||||
<SvgIcon class="text-lg" icon="ri:equalizer-line" />
|
||||
<span class="ml-2">{{ $t('setting.advanced') }}</span>
|
||||
</template>
|
||||
<div class="min-h-[100px]">
|
||||
<Advanced />
|
||||
</div>
|
||||
</NTabPane> -->
|
||||
<NTabPane name="InviteUsers" tab="InviteUsers">
|
||||
<template #tab>
|
||||
<SvgIcon class="text-lg" icon="mdi:invite" />
|
||||
<span class="ml-2">邀请新用户</span>
|
||||
</template>
|
||||
<InviteUsers />
|
||||
</NTabPane>
|
||||
|
||||
<NTabPane name="About" tab="about">
|
||||
<template #tab>
|
||||
<SvgIcon class="text-lg" icon="mdi:about-circle-outline" />
|
||||
<span class="ml-2">关于</span>
|
||||
</template>
|
||||
<About />
|
||||
</NTabPane>
|
||||
</NTabs>
|
||||
</div>
|
||||
</NModal>
|
||||
</template>
|
||||
@@ -1,21 +1,52 @@
|
||||
<script setup lang='ts'>
|
||||
import { computed, useAttrs } from 'vue'
|
||||
import { Icon } from '@iconify/vue'
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent } from 'vue'
|
||||
|
||||
interface Props {
|
||||
icon?: string
|
||||
function compatibleName(inputString: string): string {
|
||||
// 使用正则表达式替换所有的冒号
|
||||
const resultString = inputString.replace(/:/g, '-')
|
||||
return resultString
|
||||
}
|
||||
|
||||
defineProps<Props>()
|
||||
export default defineComponent({
|
||||
name: 'SvgIcon',
|
||||
props: {
|
||||
icon: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
className: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const symbolId = computed(() => `#${compatibleName(props.icon)}`)
|
||||
const svgClass = computed(() => {
|
||||
if (props.className)
|
||||
return `svg-icon ${props.className}`
|
||||
|
||||
const attrs = useAttrs()
|
||||
return 'svg-icon'
|
||||
})
|
||||
|
||||
const bindAttrs = computed<{ class: string; style: string }>(() => ({
|
||||
class: (attrs.class as string) || '',
|
||||
style: (attrs.style as string) || '',
|
||||
}))
|
||||
return {
|
||||
symbolId,
|
||||
svgClass,
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Icon :icon="icon ?? ''" v-bind="bindAttrs" />
|
||||
<svg :class="svgClass" aria-hidden="true">
|
||||
<use class="svg-use" :href="symbolId" />
|
||||
</svg>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.svg-icon {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
fill: currentColor;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<script setup lang='ts'>
|
||||
import { computed, useAttrs } from 'vue'
|
||||
import { Icon } from '@iconify/vue'
|
||||
|
||||
interface Props {
|
||||
icon?: string
|
||||
}
|
||||
|
||||
defineProps<Props>()
|
||||
|
||||
const attrs = useAttrs()
|
||||
|
||||
const bindAttrs = computed<{ class: string; style: string }>(() => ({
|
||||
class: (attrs.class as string) || '',
|
||||
style: (attrs.style as string) || '',
|
||||
}))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Icon :icon="icon ?? ''" v-bind="bindAttrs" />
|
||||
</template>
|
||||
@@ -1,19 +1,23 @@
|
||||
import HoverButton from './HoverButton/index.vue'
|
||||
import SvgIcon from './SvgIcon/index.vue'
|
||||
import Setting from './Setting/index.vue'
|
||||
import Captcha from './Captcha/index.vue'
|
||||
import Verification from './Verification/index.vue'
|
||||
import ItemIcon from './ItemIcon/index.vue'
|
||||
import NaiveProvider from './NaiveProvider/index.vue'
|
||||
import RoundCardModal from './RoundCardModal/index.vue'
|
||||
import SvgIconOnline from './SvgIconOnline/index.vue'
|
||||
import JsonImportExport from './JsonImportExport/index.vue'
|
||||
import AppLoader from './AppLoader/index.vue'
|
||||
|
||||
export {
|
||||
Verification,
|
||||
HoverButton,
|
||||
SvgIcon,
|
||||
Setting,
|
||||
Captcha,
|
||||
ItemIcon,
|
||||
NaiveProvider,
|
||||
RoundCardModal,
|
||||
SvgIconOnline,
|
||||
JsonImportExport,
|
||||
AppLoader,
|
||||
}
|
||||
|
||||
@@ -59,10 +59,10 @@ onBeforeUnmount(() => {
|
||||
|
||||
<template>
|
||||
<div class="w-full text-center">
|
||||
<span class="text-3xl font-[600]">
|
||||
<span class="text-2xl sm:text-2xl md:text-3xl font-[600]">
|
||||
{{ currentDate.time }}
|
||||
</span>
|
||||
<div>
|
||||
<div class="hidden sm:hidden md:block">
|
||||
<span>
|
||||
{{ currentDate.date }}
|
||||
</span>
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { defineEmits, onMounted, ref } from 'vue'
|
||||
import { NAvatar, NCheckbox } from 'naive-ui'
|
||||
import { SvgIcon } from '@/components/common'
|
||||
import { useModuleConfig } from '@/store/modules'
|
||||
import { useAuthStore } from '@/store'
|
||||
import { VisitMode } from '@/enums/auth'
|
||||
|
||||
import SvgSrcBaidu from '@/assets/search_engine_svg/baidu.svg'
|
||||
import SvgSrcBing from '@/assets/search_engine_svg/bing.svg'
|
||||
import SvgSrcGoogle from '@/assets/search_engine_svg/google.svg'
|
||||
|
||||
interface State {
|
||||
currentSearchEngine: DeskModule.SearchBox.SearchEngine
|
||||
searchEngineList: DeskModule.SearchBox.SearchEngine[]
|
||||
newWindowOpen: boolean
|
||||
}
|
||||
|
||||
withDefaults(defineProps<{
|
||||
background?: string
|
||||
textColor?: string
|
||||
@@ -22,8 +18,17 @@ withDefaults(defineProps<{
|
||||
textColor: 'white',
|
||||
})
|
||||
|
||||
const emits = defineEmits(['itemSearch'])
|
||||
|
||||
interface State {
|
||||
currentSearchEngine: DeskModule.SearchBox.SearchEngine
|
||||
searchEngineList: DeskModule.SearchBox.SearchEngine[]
|
||||
newWindowOpen: boolean
|
||||
}
|
||||
|
||||
const moduleConfigName = 'deskModuleSearchBox'
|
||||
const moduleConfig = useModuleConfig()
|
||||
const authStore = useAuthStore()
|
||||
const searchTerm = ref('')
|
||||
const isFocused = ref(false)
|
||||
const searchSelectListShow = ref(false)
|
||||
@@ -62,6 +67,9 @@ const onBlur = (): void => {
|
||||
}
|
||||
|
||||
function handleEngineClick() {
|
||||
// 访客模式不允许修改
|
||||
if (authStore.visitMode === VisitMode.VISIT_MODE_PUBLIC)
|
||||
return
|
||||
searchSelectListShow.value = !searchSelectListShow.value
|
||||
}
|
||||
|
||||
@@ -75,7 +83,7 @@ function handleSearchClick() {
|
||||
const keyword = searchTerm
|
||||
// 如果网址中存在 %s,则直接替换为关键字
|
||||
const fullUrl = replaceOrAppendKeywordToUrl(url, keyword.value)
|
||||
|
||||
handleClearSearchTerm()
|
||||
if (state.value.newWindowOpen)
|
||||
window.open(fullUrl)
|
||||
else
|
||||
@@ -91,6 +99,15 @@ function replaceOrAppendKeywordToUrl(url: string, keyword: string) {
|
||||
return url + (keyword ? `${encodeURIComponent(keyword)}` : '')
|
||||
}
|
||||
|
||||
const handleItemSearch = () => {
|
||||
emits('itemSearch', searchTerm.value)
|
||||
}
|
||||
|
||||
function handleClearSearchTerm() {
|
||||
searchTerm.value = ''
|
||||
emits('itemSearch', searchTerm.value)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
moduleConfig.getValueByNameFromCloud<State>('deskModuleSearchBox').then(({ code, data }) => {
|
||||
if (code === 0)
|
||||
@@ -108,9 +125,13 @@ onMounted(() => {
|
||||
<NAvatar :src="state.currentSearchEngine.iconSrc" style="background-color: transparent;" :size="20" />
|
||||
</div>
|
||||
|
||||
<input v-model="searchTerm" placeholder="请输入搜索内容" @focus="onFocus" @blur="onBlur">
|
||||
<div class="w-[20px] flex justify-center cursor-pointer" @click="handleSearchClick">
|
||||
<SvgIcon icon="iconamoon:search-fill" />
|
||||
<input v-model="searchTerm" :placeholder="$t('deskModule.searchBox.inputPlaceholder')" @focus="onFocus" @blur="onBlur" @input="handleItemSearch">
|
||||
|
||||
<div v-if="searchTerm !== ''" class="w-[25px] mr-[10px] flex justify-center cursor-pointer" @click="handleClearSearchTerm">
|
||||
<SvgIcon style="width: 20px;height: 20px;" icon="line-md:close-small" />
|
||||
</div>
|
||||
<div class="w-[25px] flex justify-center cursor-pointer" @click="handleSearchClick">
|
||||
<SvgIcon style="width: 20px;height: 20px;" icon="iconamoon:search-fill" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -138,7 +159,7 @@ onMounted(() => {
|
||||
<div class="mt-[10px]">
|
||||
<NCheckbox v-model:checked="state.newWindowOpen" @update-checked="moduleConfig.saveToCloud(moduleConfigName, state)">
|
||||
<span :style="{ color: textColor }">
|
||||
新窗口打开
|
||||
{{ $t('deskModule.searchBox.openWithNewOpen') }}
|
||||
</span>
|
||||
</NCheckbox>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user