145 Commits
Author SHA1 Message Date
dvadmin-开发-李强 666f072b58 Accept Merge Request #22: (develop -> master)
Merge Request: add nginx config

Created By: @dvadmin-开发-李强
Accepted By: @dvadmin-开发-李强
URL: https://dvadmin-private.coding.net/p/code/d/dvadmin3/git/merge/22?initial=true
2024-06-21 08:32:02 +08:00
liqianglog 3086addd10 Merge pull request #10 from stevenchen0018/master
add nginx config
2024-06-21 08:29:56 +08:00
1638245306 e72f2ce01c 修改授权的文字描述 2024-06-21 08:28:23 +08:00
dvadmin-开发-李强 de638e7e4b Accept Merge Request #21: (develop -> master)
Merge Request: 更新 static

Created By: @dvadmin-开发-李强
Accepted By: @dvadmin-开发-李强
URL: https://dvadmin-private.coding.net/p/code/d/dvadmin3/git/merge/21?initial=true
2024-06-21 08:14:54 +08:00
李强 500433e06f 更新 static 2024-06-21 08:14:11 +08:00
dvadmin-开发-李强 e29ae657f6 Accept Merge Request #20: (develop -> master)
Merge Request: 新功能

Created By: @dvadmin-开发-李强
Accepted By: @dvadmin-开发-李强
URL: https://dvadmin-private.coding.net/p/code/d/dvadmin3/git/merge/20?initial=true
2024-06-21 08:08:05 +08:00
李强 57d90e8a71 Merge branch 'master' of https://gitee.com/huge-dream/django-vue3-admin into develop
# Conflicts:
#	backend/dvadmin/system/views/role_menu_button_permission.py
#	web/src/views/system/role/components/PermissionComNew/index.vue
#	web/src/views/system/role/components/PermissionComNew/types.ts
2024-06-21 08:02:59 +08:00
李强 3332d1abb5 删除 hooks-uvicorn 2024-06-21 08:01:31 +08:00
李强 a6d6fb3c54 Merge remote-tracking branch 'origin/develop' into develop 2024-06-21 07:57:54 +08:00
dvadmin b3ceb8ce6d !17 update docker_env/web/DockerfileBuild.
Merge pull request !17 from linshui/N/A
2024-06-20 23:53:55 +00:00
dvadmin 773690677e !22 修改columnPermission函数
Merge pull request !22 from 木子-李/columnPer20240528
2024-06-20 23:52:27 +00:00
dvadmin becbe7e7f9 !21 新增菜单接口权限批量创建功能
Merge pull request !21 from 好奇宝宝/develop
2024-06-20 23:51:17 +00:00
dvadmin a812f1304b !19 修改权限配置页面的布局
Merge pull request !19 from 木子-李/muzili
2024-06-20 23:50:31 +00:00
dvadmin 5e3bf1b9c4 !28 列字段权限→自动匹配→添加model页面增加模糊搜索框
Merge pull request !28 from 北风南里/N/A
2024-06-20 23:49:44 +00:00
dvadmin-开发-李强 f379ac754d Accept Merge Request #19: (develop -> master)
Merge Request: 正式发布v3.0.3版本

Created By: @dvadmin-开发-李强
Accepted By: @dvadmin-开发-李强
URL: https://dvadmin-private.coding.net/p/code/d/dvadmin3/git/merge/19?initial=true
2024-06-21 07:48:11 +08:00
李强 f34b7967d5 refactor: 优化main.py,移除无效代码和浏览器自动打开功能
- 移除了`extra-hooks/__init__.py`中的注释,该文件现在为空。
- 在`main.py`中移除了未使用的导入语句和函数,以及启动浏览器的代码。
- 删除了`main.spec`文件,因为它是PyInstaller打包配置的一部分,现在的更改侧重于源代码的清理和优化。
2024-06-21 07:36:31 +08:00
李强 60ca268851 新增:打包编译功能 2024-06-18 14:11:41 +08:00
李强 38bb65f9d5 新增:打包编译功能 2024-06-18 12:46:57 +08:00
李强 1f81ac5854 feat: 取消升级提示 2024-06-18 12:26:34 +08:00
stevenchen 95a046c2fe add nginx config
Signed-off-by: stevenchen <stevenchen@stevenchendeMacBook-Air.local>
2024-06-13 10:53:38 +08:00
好奇宝宝 92fa2f2d76 update backend/dvadmin/system/views/menu_button.py.
Signed-off-by: 好奇宝宝 <11259906+haoqibb@user.noreply.gitee.com>
2024-06-05 00:56:38 +00:00
猿小天 8a0420c14f 文档地址修改
Signed-off-by: 猿小天 <1638245306@qq.com>
2024-06-04 13:52:05 +00:00
china_ahhui bcc5e2f77a 修复document的title出现undefined的bug 2024-06-02 12:41:31 +08:00
china_ahhui 389add2a8a 修复角色权限操作界面打开某个集时会出现两块相似内容的bug 2024-06-02 12:25:33 +08:00
china_ahhui 30d7467369 优化登录按钮交互 2024-06-02 12:07:46 +08:00
china_ahhui 6e3f05c58f 登录界面扫码按钮ui优化 2024-06-02 11:33:48 +08:00
china_ahhui 7ed699593c 更新初始化文件以及初始化逻辑(角色菜单和角色菜单按钮) 2024-06-02 11:28:34 +08:00
北风南里 00fc9cdad4 列字段权限→自动匹配→添加model页面增加模糊搜索框
Signed-off-by: 北风南里 <wskaudh@qq.com>
2024-05-31 04:15:05 +00:00
李小涛 1e38f73829 feat(muzili20240528): 修改columnPermission函数
在权限列表设置列表不可见,默认不显示,但在前端还是可以通过列控制选择出来,
因此在columnPermission函数中增加了列表可见判断条件:“如果列表可见的false,则禁止在列设置中选择”
2024-05-28 15:23:15 +08:00
好奇宝宝 bee0d672b3 修复新增接口方法错误 2024-05-28 11:52:56 +08:00
李小涛 089e0ca5c1 feat(muzili): 修改权限配置页面
增加菜单页面显示权限配置
2024-05-27 17:59:47 +08:00
好奇宝宝 1dbdc816af 增加菜单权限接口批量创建功能 2024-05-27 16:30:31 +08:00
李小涛 b542ef9086 feat(muzili): 修改权限配置页面
1、修改了权限配置页面布局
2、修复权限页面,保存菜单授权按钮的后端逻辑
2024-05-24 22:17:31 +08:00
猿小天 3720fbe4a0 功能变化: 1.允许动态修改网站小图标;
2.允许动态修改网站标题;
2024-05-22 21:50:42 +08:00
猿小天 91d15ec15b 功能变化: 账号密码错误超过5次进行封号 2024-05-22 21:47:58 +08:00
猿小天 e8d39d0150 功能变化: 修复授权管理的bug 2024-05-21 21:48:58 +08:00
猿小天 3786b4123b 功能变化: 登录加入判断,超过5次账号密码不正确则锁定 2024-05-21 21:46:11 +08:00
猿小天 767cbbe366 修复BUG: 用户管理导入导出按钮权限 2024-05-10 10:23:00 +08:00
猿小天 49d56f6378 修复BUG: 无任何菜单权限时,无法进入首页问题 2024-05-09 11:24:33 +08:00
猿小天 e6f898bef4 功能变化: 删除打印 2024-05-09 11:20:41 +08:00
猿小天 0d9ee1f4d4 修复BUG:
1.密码重置;
2.个人中心密码修改
2024-05-09 11:11:23 +08:00
猿小天 a03b14a32d 修复BUG: 修复demo缺少文件问题 2024-05-09 10:20:41 +08:00
linshui 5a5861a0e8 update docker_env/web/DockerfileBuild.
更新淘宝npmurl

Signed-off-by: linshui <9517545+linshuinew@user.noreply.gitee.com>
2024-05-04 10:14:04 +00:00
china_ahhui a6e20d88da init命令添加可指定app进行初始化,'python manage.py init -app app1 app2 ...'或 'python manage.py init -A app1 app2 ...' 2024-04-11 16:57:14 +08:00
李强 94767d8bc1 feat: 修复e-icon-picker 2024-04-04 23:27:36 +08:00
李强 28a96de928 修复授权时无列权限报错bug 2024-03-31 01:02:25 +08:00
李强 665e5ce092 docker-compose.yml 更新 2024-03-30 21:47:24 +08:00
李强 b604893697 redis 默认密码 2024-03-30 21:45:08 +08:00
李强 cdf3d7cab8 部署环境优化 2024-03-30 21:41:59 +08:00
猿小天 18b44e2aa4 修复BUG: 修复页面缓存问题 2024-03-18 22:21:58 +08:00
猿小天 69b05e94b4 Merge remote-tracking branch 'origin/develop' into develop 2024-03-18 22:18:48 +08:00
猿小天 93cdd46e64 修复BUG: 修复页面缓存问题 2024-03-18 22:17:00 +08:00
李强 5bd57232d8 feat: 优化docker部署 2024-03-18 21:22:22 +08:00
李强 2cfd8f0798 feat: 前端lodash包优化成lodash-es 2024-03-18 21:21:19 +08:00
李强 edf45c08d1 feat: fast-crud版本更新 2024-03-18 18:18:44 +08:00
李强 988daf03dd 优化系统配置表的key值大小 2024-03-18 14:28:25 +08:00
李强 c686a6e74a Merge remote-tracking branch 'origin/master' 2024-03-12 23:01:08 +08:00
dvadmin-开发-李强 82a16545b4 Accept Merge Request #5: (develop -> master)
1. 新增: 大数据选择器组件
2. 新增: docker默认一键启动参数
3. 新增: 集成celery和Redis
4. 新增: 封装时间范围的搜索,示例在登录日志页面
5. 优化: 角色授权中的获取授权列表接口
6. 优化: 角色授权中字段权限显示判断
7. 优化: 个人中心修改密码成功后,强制退出登录状态
8. 优化: getBaseURL函数
9. 修复: 页面缓存无效问题
10. 修复: 登录页背景logo设置无效问题
11. 修复: 全局过滤器导致过滤无效问题
12. 修复: 当dept_belong_id为null时,触发接口报错
2024-03-12 22:45:36 +08:00
猿小天 39638e2e6a 功能变化: 优化个人中心修改密码后强制退出登录状态 2024-02-28 15:27:03 +08:00
猿小天 d3e5f258e5 修复BUG: 修复页面缓存问题 2024-02-25 16:30:49 +08:00
猿小天 77a27cba14 Merge remote-tracking branch 'origin/develop' into develop 2024-02-25 15:03:26 +08:00
猿小天 26bbf67da8 新功能: 角色授权字段权限判断 2024-02-25 15:03:07 +08:00
李强 d4f754976e Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	backend/application/settings.py
2024-02-21 17:49:38 +08:00
猿小天 85805e0d4b 功能变化: 优化角色授权中的获取授权列表 2024-02-16 22:41:15 +08:00
猿小天 8a646e5ef7 新功能: 新增大数据选择组件 2024-02-16 20:13:20 +08:00
猿小天 71eec9cfbd 修复BUG:
1.消息中心不加载目标数据问题;
2.地区数据加载问题
2024-01-18 22:12:55 +08:00
猿小天 9bd79b9dc6 修复BUG:
1.角色管理没有分页问题;
2.自定义指令引用问题
2024-01-18 20:25:02 +08:00
李强 e210b7dd17 Merge remote-tracking branch 'origin/develop' into develop 2024-01-12 00:28:56 +08:00
李强 4d00661163 feat: 优化getBaseURL函数 2024-01-12 00:28:52 +08:00
H0nGzA1 6798fca362 fix: 修复登录页背景logo设置 2024-01-04 19:49:40 +08:00
猿小天 6f5bbb045d 修复BUG: 全局过滤器导致的过滤无效 2024-01-04 16:53:12 +08:00
猿小天 bbf3018b20 Merge remote-tracking branch 'origin/develop' into develop 2024-01-03 23:23:24 +08:00
猿小天 5510a18280 修复BUG: 全局过滤器导致的过滤无效 2024-01-03 23:23:13 +08:00
李强 97737c3ef1 feat: 更新docker默认一键启动参数 2024-01-02 23:17:39 +08:00
李强 0b554f3669 feat: 默认集成celery与redis 2024-01-02 22:10:57 +08:00
猿小天 63453450ad 修复BUG: 当dept_belong_id为null时,触发接口报错 2024-01-02 14:39:16 +08:00
猿小天 fea6ebd98e Merge remote-tracking branch 'origin/develop' into develop 2024-01-02 13:50:52 +08:00
猿小天 d4e43e28e8 新功能: 封装时间范围的搜索,示例在登录日志页面 2024-01-02 13:50:43 +08:00
dvadmin dffe47e79c !13 正式发布v3.0.1版本
Merge pull request !13 from dvadmin/develop
2024-01-01 15:23:20 +00:00
dvadmin-开发-李强 9973688675 Accept Merge Request #4: (develop -> master)
Merge Request: 正式发布v3.0.1版本

Created By: @dvadmin-开发-李强
Accepted By: @dvadmin-开发-李强
URL: https://dvadmin-private.coding.net/p/code/d/dvadmin3/git/merge/4?initial=true
2024-01-01 22:56:43 +08:00
李强 98a5bbd60a feat: 文档更新 2024-01-01 22:41:01 +08:00
李强 ac7e8a7764 feat: CustomModelSerializer序列化器中dept_belong_id 添加默认值 2024-01-01 22:31:43 +08:00
猿小天 26ed59d1ff 功能变化: 修复部分bug 2024-01-01 15:30:48 +08:00
猿小天 369157fa4f 修复BUG: 当部门没有返回顶级部门时,部门接口为空情况 2024-01-01 15:00:17 +08:00
猿小天 8961733025 功能变化: 修复部分bug 2024-01-01 14:47:53 +08:00
猿小天 577b88332f 功能变化: 菜单授权返回包含父级的完整名称 2023-12-28 01:25:58 +08:00
猿小天 411f065bfc 功能变化: 菜单授权返回包含父级的完整名称 2023-12-28 00:41:07 +08:00
猿小天 8d37d929b2 功能变化: 菜单按钮排序 2023-12-27 23:35:28 +08:00
猿小天 c0d6cd54c3 Merge remote-tracking branch 'origin/develop' into develop 2023-12-27 23:29:22 +08:00
猿小天 ae8366f097 功能变化: 部门允许选择父级 2023-12-27 23:29:15 +08:00
猿小天 4baf5da0ff 新功能: 框架外路由 2023-12-27 23:22:25 +08:00
猿小天 c00f5f2beb 新功能: 框架外路由 2023-12-27 23:22:05 +08:00
李强 5143afdd85 feat: 列权限初始化 2023-12-27 21:26:21 +08:00
李强 b4153d1848 feat: 优化commonCrudConfig 2023-12-27 19:14:46 +08:00
猿小天 d2c0c54080 Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	web/src/utils/commonCrud.ts
2023-12-27 19:10:53 +08:00
猿小天 7f184b2a9a 新功能:
1.部门显示组件
2023-12-27 19:08:55 +08:00
李强 87f9784445 feat: 优化commonCrudConfig顺序 2023-12-26 15:39:04 +08:00
李强 e900cc2280 feat: 优化所有类型的table居中显示 2023-12-26 15:38:09 +08:00
李强 4a26257a61 Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	web/src/settings.ts
2023-12-26 15:37:08 +08:00
李强 06476c182e feat: 优化所有类型的table居中显示 2023-12-26 15:36:26 +08:00
猿小天 6146e6edb6 修复BUG:
1.新增用户时,默认密码
2023-12-26 12:46:19 +08:00
猿小天 85f5ff1935 修复BUG:
1.允许table表头被选中
2023-12-26 11:50:52 +08:00
猿小天 86e33e44e1 功能变化: 将网络字体改为本地字体 2023-12-26 11:33:37 +08:00
猿小天 217f3c8e14 Merge remote-tracking branch 'origin/develop' into develop 2023-12-26 10:49:44 +08:00
猿小天 d0feaa23e5 功能变化: 修改baseUrl函数 2023-12-26 10:49:09 +08:00
李强 fa67a27908 feat: 删除log打印 2023-12-26 09:51:45 +08:00
李强 56145dfe61 feat: 删除log打印 2023-12-26 09:50:49 +08:00
李强 3def205e6e Merge remote-tracking branch 'origin/develop' into develop 2023-12-26 09:48:06 +08:00
李强 873400bcce feat: 新增 placeholder 的默认值 2023-12-26 09:47:59 +08:00
猿小天 0c1cf1218b 新功能: 1. 引入fa 图标,兼容dvadmin2的图标 2023-12-25 20:35:33 +08:00
猿小天 d8e5ad9057 新功能: 加入隐私和条款文件 2023-12-25 20:13:05 +08:00
猿小天 3639cad58c 新功能: 1. 封装所有的更新时间、更新数据、部门等,类似dvadmin2的,一键加入 2023-12-25 20:02:43 +08:00
猿小天 c99eb1a9bc 修复BUG:
1.系统配置没有在刷新页面的时候获取;
2.登录页面网站标题等信息更新名字不刷新;
3.列权限排序,且需可以搜索
2023-12-25 18:48:11 +08:00
猿小天 7ae15022c0 新功能:
1.菜单新增框架外显示字段
2023-12-24 23:05:00 +08:00
猿小天 68b3d479ca 新功能:
1.菜单新增是否固定配置;
2.菜单新增框外显示配置
2023-12-24 12:09:15 +08:00
猿小天 2826cafa75 修复BUG:
1.验证码输入错误不刷新问题
2023-12-24 11:04:28 +08:00
猿小天 ba4a580bb0 修复BUG:
1.修复更新提示,拒绝后仍然弹出问题
2023-12-20 23:56:09 +08:00
猿小天 f322d38ab8 Merge remote-tracking branch 'origin/develop' into develop 2023-12-20 23:45:49 +08:00
猿小天 7d315a7d28 修复BUG:
1.文件上传返回值缺少问题
2023-12-20 23:44:45 +08:00
猿小天 916071814a 修复BUG:
1.接口报错后,继续通过的情况
2023-12-20 23:43:32 +08:00
李强 acf113e5e6 feat: 升级中心弹窗bug 2023-12-19 01:06:18 +08:00
李强 083eef9df1 Merge branch 'master' into develop 2023-12-19 00:54:05 +08:00
李强 e8c64d6d11 feat: 新增存活检测中间件 2023-12-19 00:50:42 +08:00
李强 d1abc58b40 feat: add __init__.py 2023-12-19 00:34:14 +08:00
李强 0c8ce0ce27 feat: 更新celery.py 添加重试机制 2023-12-18 18:14:18 +08:00
猿小天 23d320434e Merge remote-tracking branch 'origin/develop' into develop 2023-12-06 18:28:09 +08:00
猿小天 14907e140d 修复BUG:
1.修复加入列权限后没有分页问题
2023-12-06 18:28:00 +08:00
猿小天 1132e04080 修复BUG:
1.修复加入列权限后没有分页问题
2023-12-06 18:15:18 +08:00
猿小天 39fee0875d 修复BUG:
1.修复加入列权限后没有分页问题
2023-12-06 18:00:21 +08:00
符锦辉 5898ae85de chore: 后端降低channels版本为3 2023-12-05 17:56:43 +08:00
猿小天 172a867bad 修复BUG:
1.部门信息递归获取子部门
2023-12-04 23:57:40 +08:00
猿小天 5a308695fd 修复BUG:
1.个人中心密码修改,未对密码进行md5加密
2023-12-04 23:53:22 +08:00
猿小天 0c5c3c4ecd 修复BUG:
1.修复字段权限不显示序号的问题
2023-12-04 18:19:58 +08:00
猿小天 9a8241023b 修复BUG:
1.个人中心密码修改,未对密码进行md5加密
2023-12-03 23:28:53 +08:00
猿小天 27be35616b 修复BUG:
1.菜单管理中状态在编辑时显示不正确的问题
2023-12-03 23:24:32 +08:00
猿小天 e6f0a5e0ea 修复BUG:
1.修复角色相关代码中存在is_admin引起的错误
2023-12-03 23:07:18 +08:00
猿小天 cbebd8305c 修复BUG:
1.自定义权限bug
2023-12-03 23:04:26 +08:00
猿小天 66b68523f5 功能变化:
1.优化字典配置的表格显示;
2023-12-03 22:51:58 +08:00
猿小天 95b14e5a42 功能变化:
1.优化角色管理中的列权限;
2023-12-03 22:51:42 +08:00
猿小天 583b172a37 功能变化:
1.优化对字段权限的处理
2023-12-03 22:42:37 +08:00
猿小天 2227564c6f 功能变化:
1.优化对字段权限的处理
2023-12-03 15:19:42 +08:00
猿小天 5e3ecfc0a6 功能变化:
1.优化对字段权限的处理
2023-12-03 15:03:18 +08:00
猿小天 d467915f97 Merge remote-tracking branch 'origin/develop' into develop 2023-12-01 17:31:47 +08:00
猿小天 197714e845 修复BUG:
1.修复settings中上传文件的bug;
2.优化字典展示
2023-12-01 17:31:37 +08:00
dvadmin fd3adeed57 !9 正式发布v3.0.0版本
Merge pull request !9 from dvadmin/develop
2023-11-30 15:59:22 +00:00
286 changed files with 16626 additions and 2122 deletions
-175
View File
@@ -1,175 +0,0 @@
# Django-Vue3-Admin
[![img](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitee.com/huge-dream/django-vue3-admin/blob/master/LICENSE) [![img](https://img.shields.io/badge/python-%3E=3.7.x-green.svg)](https://python.org/) [![PyPI - Django Version badge](https://img.shields.io/badge/django%20versions-3.2-blue)](https://docs.djangoproject.com/zh-hans/3.2/) [![img](https://img.shields.io/badge/node-%3E%3D%2012.0.0-brightgreen)](https://nodejs.org/zh-cn/) [![img](https://gitee.com/huge-dream/django-vue3-admin/badge/star.svg?theme=dark)](https://gitee.com/huge-dream/django-vue3-admin)
[preview](https://demo.dvadmin.com) | [Official website document](https://www.django-vue-admin.com) | [qq group](https://qm.qq.com/cgi-bin/qm/qr?k=fOdnHhC8DJlRHGYSnyhoB8P5rgogA6Vs&jump_from=webapi) | [community](https://bbs.django-vue-admin.com) | [plugins market](https://bbs.django-vue-admin.com/plugMarket.html) | [Github](https://github.com/liqianglog/django-vue-admin)
💡 **「About」**
It is a completely open-source rapid development platform, provided free for personal use and authorized for group use.
Django-Vue3-Admin is a comprehensive basic development platform based on the RBAC (Role-Based Access Control) model for permission control, with column-level granularity. It follows a frontend-backend separation architecture, with Django and Django Rest Framework used for the backend, and Vue3, Composition API, TypeScript, Vite, and Element Plus used for the frontend.
## framework introduction
💡 [django-vue3-admin](https://gitee.com/huge-dream/django-vue3-admin.git) Is a set of all open source rapid development platform, no reservation for individuals and enterprises free use.
* 🧑‍🤝‍🧑Front-end adoption Vue3+TS+pinia+fastcrud。
* 👭The backend uses the Python language Django framework as well as the powerful[Django REST Framework](https://pypi.org/project/djangorestframework)。
* 👫Permission authentication use[Django REST Framework SimpleJWT](https://pypi.org/project/djangorestframework-simplejwt)Supports the multi-terminal authentication system.
* 👬Support loading dynamic permission menu, multi - way easy permission control.
* 👬Enhanced Column Permission Control, with granularity down to each column.
* 💏Special thanks: [vue-next-admin](https://lyt-top.gitee.io/vue-next-admin-doc-preview/).
* 💡Special thanks:[jetbrains](https://www.jetbrains.com/) To provide a free IntelliJ IDEA license for this open source project.
## Online experience
👩‍👧‍👦👩‍👧‍👦 demo address:[https://demo.dvadmin.com](https://demo.dvadmin.com)
* demo accountsuperadmin
* demo passwordadmin123456
👩‍👦‍👦docs:[https://django-vue-admin.com](https://django-vue-admin.com)
## communication
* Communication community:[click here](https://bbs.django-vue-admin.com)👩‍👦‍👦
* plugins market:[click here](https://bbs.django-vue-admin.com/plugMarket.html)👩‍👦‍👦
## source code url:
gitee(Main push)[https://gitee.com/huge-dream/django-vue3-admin](https://gitee.com/huge-dream/django-vue3-admin)👩‍👦‍👦
github[https://github.com/huge-dream/django-vue3-admin](https://github.com/huge-dream/django-vue3-admin)👩‍👦‍👦
## core function
1. 👨‍⚕️Menu Management: Configure system menus, operation permissions, button permission flags, backend interface permissions, etc.
2. 🧑‍⚕️Department Management: Configure system organizational structure (company, department, role).
3. 👩‍⚕️Role Management: Role menu permission assignment, data permission assignment, set role-based data scope permissions by department.
4. 🧑‍🎓Button Permission Control: Authorize role-specific button permissions and interface permissions, enabling authorization of data scope for each interface.
5. 🧑‍🎓Field Column Permission Control: Authorize page field display permissions, specifically for the display permissions of a certain column.
6. 👨‍🎓User Management: Users are system operators, and this function is mainly used for system user configuration.
7. 👬API Whitelist: Configure interfaces that do not require permission verification.
8. 🧑‍🔧Dictionary Management: Maintain frequently used and relatively fixed data in the system.
9. 🧑‍🔧Region Management: Manage provinces, cities, counties, and districts.
10. 📁File Management: Unified management of all files, images, etc., on the platform.
11. 🗓️Operation Logs: Record and query logs for normal system operations and exceptional system information.
12. 🔌[Plugin Market](https://bbs.django-vue-admin.com/plugMarket.html): Applications and plugins developed based on the Django-Vue-Admin framework.
## plugins market 🔌
Updating...
## Repository Branch Explanation 💈
Main Branch: master (stable version)
Development Branch: develop
## before start project you need:
~~~
Python >= 3.11.0 (Minimum version 3.9+)
Node.js >= 16.0
Mysql >= 8.0 (Optional, default database: SQLite3, supports 5.7+, recommended version: 8.0)
Redis (Optional, latest version)
~~~
## frontend♝
```bash
# clone code
git clone https://gitee.com/huge-dream/django-vue3-admin.git
# enter code dir
cd web
# install dependence
npm install yarn
yarn install --registry=https://registry.npm.taobao.org
# Start service
yarn run dev
# Visit http://localhost:8080 in your browser
# Parameters such as boot port can be configured in the #.env.development file
# Build the production environment
# yarn run build
```
## backend💈
~~~bash
1. enter code dir cd backend
2. copy ./conf/env.example.py to ./conf dirrename as env.py
3. in env.py configure database information
mysql database recommended version: 8.0
mysql database character set: utf8mb4
4. install pip dependence
pip3 install -r requirements.txt
5. Execute the migration command:
python3 manage.py makemigrations
python3 manage.py migrate
6. Initialization data
python3 manage.py init
7. Initialize provincial, municipal and county data:
python3 manage.py init_area
8. start backend
python3 manage.py runserver 0.0.0.0:8000
or uvicorn :
uvicorn application.asgi:application --port 8000 --host 0.0.0.0 --workers 8
~~~
### visit backend swagger
* visit url[http://localhost:8080](http://localhost:8080) (The default address is this one. If you want to change it, follow the configuration file)
* account`superadmin` password`admin123456`
### docker-compose
~~~shell
docker-compose up -d
# Initialize backend data (first execution only)
docker exec -ti dvadmin3-django bash
python manage.py makemigrations
python manage.py migrate
python manage.py init_area
python manage.py init
exit
frontend urlhttp://127.0.0.1:8080
backend urlhttp://127.0.0.1:8080/api
# Change 127.0.0.1 to your own public ip address on the server
account`superadmin` password`admin123456`
# docker-compose stop
docker-compose down
# docker-compose restart
docker-compose restart
# docker-compose on start build
docker-compose up -d --build
~~~
## Demo screenshot✅
![image-01](https://foruda.gitee.com/images/1701348994587355489/1bc749e7_5074988.png)
![image-02](https://foruda.gitee.com/images/1701349037811908960/80d361db_5074988.png)
![image-03](https://foruda.gitee.com/images/1701349224478845203/954f0a7b_5074988.png)
![image-04](https://foruda.gitee.com/images/1701349248928658877/64926724_5074988.png)
![image-05](https://foruda.gitee.com/images/1701349259068943299/1306ba40_5074988.png)
![image-06](https://foruda.gitee.com/images/1701349294894429495/e3b3a8cf_5074988.png)
![image-07](https://foruda.gitee.com/images/1701350432536247561/3b26685e_5074988.png)
![image-08](https://foruda.gitee.com/images/1701350455264771992/b364c57f_5074988.png)
![image-09](https://foruda.gitee.com/images/1701350479266000753/e4e4f7c5_5074988.png)
![image-10](https://foruda.gitee.com/images/1701350501421625746/f8dd215e_5074988.png)
+90 -129
View File
@@ -1,171 +1,135 @@
# Django-Vue3-Admin # Django-Vue3-Admin
[![img](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitee.com/liqianglog/django-vue-admin/blob/master/LICENSE) [![img](https://img.shields.io/badge/python-%3E=3.7.x-green.svg)](https://python.org/) [![PyPI - Django Version badge](https://img.shields.io/badge/django%20versions-3.2-blue)](https://docs.djangoproject.com/zh-hans/3.2/) [![img](https://img.shields.io/badge/node-%3E%3D%2012.0.0-brightgreen)](https://nodejs.org/zh-cn/) [![img](https://gitee.com/liqianglog/django-vue-admin/badge/star.svg?theme=dark)](https://gitee.com/liqianglog/django-vue-admin) [![img](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitee.com/huge-dream/django-vue3-admin/blob/master/LICENSE) [![img](https://img.shields.io/badge/python-%3E=3.7.x-green.svg)](https://python.org/) [![PyPI - Django Version badge](https://img.shields.io/badge/django%20versions-3.2-blue)](https://docs.djangoproject.com/zh-hans/3.2/) [![img](https://img.shields.io/badge/node-%3E%3D%2012.0.0-brightgreen)](https://nodejs.org/zh-cn/) [![img](https://gitee.com/huge-dream/django-vue3-admin/badge/star.svg?theme=dark)](https://gitee.com/huge-dream/django-vue3-admin)
[预 览](https://demo.dvadmin.com) | [官网文档](https://www.django-vue-admin.com) | [群聊](https://qm.qq.com/cgi-bin/qm/qr?k=fOdnHhC8DJlRHGYSnyhoB8P5rgogA6Vs&jump_from=webapi) | [社区](https://bbs.django-vue-admin.com) | [插件市场](https://bbs.django-vue-admin.com/plugMarket.html) | [Github](https://github.com/liqianglog/django-vue-admin) [preview](https://demo.dvadmin.com) | [Official website document](https://www.django-vue-admin.com) | [qq group](https://qm.qq.com/cgi-bin/qm/qr?k=fOdnHhC8DJlRHGYSnyhoB8P5rgogA6Vs&jump_from=webapi) | [community](https://bbs.django-vue-admin.com) | [plugins market](https://bbs.django-vue-admin.com/plugMarket.html) | [Github](https://github.com/liqianglog/django-vue-admin)
💡 **「About」**
It is a completely open-source rapid development platform, provided free for personal use and authorized for group use.
Django-Vue3-Admin is a comprehensive basic development platform based on the RBAC (Role-Based Access Control) model for permission control, with column-level granularity. It follows a frontend-backend separation architecture, with Django and Django Rest Framework used for the backend, and Vue3, Composition API, TypeScript, Vite, and Element Plus used for the frontend.
## framework introduction
💡 **「关于」** 💡 [django-vue3-admin](https://gitee.com/huge-dream/django-vue3-admin.git) Is a set of all open source rapid development platform, no reservation for individuals and enterprises free use.
我们是一群热爱代码的青年,在这个炙热的时代下,我们希望静下心来通过Code带来一点我们的色彩和颜色 * 🧑‍🤝‍🧑Front-end adoption Vue3+TS+pinia+fastcrud
* 👭The backend uses the Python language Django framework as well as the powerful[Django REST Framework](https://pypi.org/project/djangorestframework)。
* 👫Permission authentication use[Django REST Framework SimpleJWT](https://pypi.org/project/djangorestframework-simplejwt)Supports the multi-terminal authentication system.
* 👬Support loading dynamic permission menu, multi - way easy permission control.
* 👬Enhanced Column Permission Control, with granularity down to each column.
* 💏Special thanks: [vue-next-admin](https://lyt-top.gitee.io/vue-next-admin-doc-preview/).
* 💡Special thanks:[jetbrains](https://www.jetbrains.com/) To provide a free IntelliJ IDEA license for this open source project.
因为热爱,所以拥抱未来! ## Online experience
👩‍👧‍👦👩‍👧‍👦 demo address:[https://demo.dvadmin.com](https://demo.dvadmin.com)
## 平台简介 * demo accountsuperadmin
💡 [django-vue3-admin](https://gitee.com/huge-dream/django-vue3-admin.git) 是一套全部开源的快速开发平台,毫无保留给个人免费使用、团体授权使用。 * demo passwordadmin123456
django-vue3-admin 基于RBAC模型的权限控制的一整套基础开发平台,权限粒度达到列级别,前后端分离,后端采用django + django-rest-framework,前端采用基于 vue3 + CompositionAPI + typescript + vite + element plus
👩‍👦‍👦docs:[https://django-vue-admin.com](https://django-vue-admin.com)
## communication
* Communication community:[click here](https://bbs.django-vue-admin.com)👩‍👦‍👦
* 🧑‍🤝‍🧑前端采用 Vue3+TS+pinia+fastcrud(感谢[vue-next-admin](https://lyt-top.gitee.io/vue-next-admin-doc-preview/)) * plugins market:[click here](https://bbs.django-vue-admin.com/plugMarket.html)👩‍👦‍👦
* 👭后端采用 Python 语言 Django 框架以及强大的 [Django REST Framework](https://pypi.org/project/djangorestframework)。
* 👫权限认证使用[Django REST Framework SimpleJWT](https://pypi.org/project/djangorestframework-simplejwt),支持多终端认证系统。
* 👬支持加载动态权限菜单,多方式轻松权限控制。
* 👬全新的列权限管控,粒度细化到每一列。
* 💏特别鸣谢:[vue-next-admin](https://lyt-top.gitee.io/vue-next-admin-doc-preview/)。
* 💡特别感谢[jetbrains](https://www.jetbrains.com/) 为本开源项目提供免费的 IntelliJ IDEA 授权。
#### 🏭 环境支持 ## source code url:
| Edge | Firefox | Chrome | Safari | gitee(Main push)[https://gitee.com/huge-dream/django-vue3-admin](https://gitee.com/huge-dream/django-vue3-admin)👩‍👦‍👦
| --------- | ------------ | ----------- | ----------- |
| Edge ≥ 79 | Firefox ≥ 78 | Chrome ≥ 64 | Safari ≥ 12 |
> 由于 Vue3 不再支持 IE11,故而 ElementPlus 也不支持 IE11 及之前版本。 github[https://github.com/huge-dream/django-vue3-admin](https://github.com/huge-dream/django-vue3-admin)👩‍👦‍👦
## core function
1. 👨‍⚕️Menu Management: Configure system menus, operation permissions, button permission flags, backend interface permissions, etc.
2. 🧑‍⚕️Department Management: Configure system organizational structure (company, department, role).
3. 👩‍⚕️Role Management: Role menu permission assignment, data permission assignment, set role-based data scope permissions by department.
4. 🧑‍🎓Button Permission Control: Authorize role-specific button permissions and interface permissions, enabling authorization of data scope for each interface.
5. 🧑‍🎓Field Column Permission Control: Authorize page field display permissions, specifically for the display permissions of a certain column.
6. 👨‍🎓User Management: Users are system operators, and this function is mainly used for system user configuration.
7. 👬API Whitelist: Configure interfaces that do not require permission verification.
8. 🧑‍🔧Dictionary Management: Maintain frequently used and relatively fixed data in the system.
9. 🧑‍🔧Region Management: Manage provinces, cities, counties, and districts.
10. 📁File Management: Unified management of all files, images, etc., on the platform.
11. 🗓️Operation Logs: Record and query logs for normal system operations and exceptional system information.
12. 🔌[Plugin Market](https://bbs.django-vue-admin.com/plugMarket.html): Applications and plugins developed based on the Django-Vue-Admin framework.
## 在线体验 ## plugins market 🔌
👩‍👧‍👦演示地址:[https://demo.dvadmin.com](https://demo.dvadmin.com) Updating...
- 账号:superadmin ## Repository Branch Explanation 💈
Main Branch: master (stable version)
Development Branch: develop
- 密码:admin123456 ## before start project you need:
👩‍👦‍👦文档地址:[coding](https://dvadmin-private.coding.net/share/km/cec69f3d-30fe-47d5-bd97-e9e851f0b776/K-2)
## 交流
- 交流社区:[戳我](https://bbs.django-vue-admin.com)👩‍👦‍👦
- 插件市场:[戳我](https://bbs.django-vue-admin.com/plugMarket.html)👩‍👦‍👦
- django-vue-admin交流01群(已满)812482043 [点击链接加入群聊](https://qm.qq.com/cgi-bin/qm/qr?k=aJVwjDvH-Es4MPJQuoO32N0SucK22TE5&jump_from=webapi)
- django-vue-admin交流02群(已满)687252418 [点击链接加入群聊](https://qm.qq.com/cgi-bin/qm/qr?k=4jJN4IjWGfxJ8YJXbb_gTsuWjR34WLdc&jump_from=webapi)
- django-vue-admin交流03群:442108213 [点击链接加入群聊](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=wsm5oSz3K8dElBYUDtLTcQSEPhINFkl8&authKey=M6sbER0z59ZakgBr5erFeZyFZU15CI52bErNZa%2FxSvvGIuVAbY0N5866v89hm%2FK4&noverify=0&group_code=442108213)
- 二维码
<img src='https://images.gitee.com/uploads/images/2022/0530/233203_5fb11883_5074988.jpeg' width='200'>
## 源码地址
gitee地址(主推)[https://gitee.com/huge-dream/django-vue3-admin](https://gitee.com/huge-dream/django-vue3-admin)👩‍👦‍👦
github地址:[https://github.com/huge-dream/django-vue3-admin](https://github.com/huge-dream/django-vue3-admin)👩‍👦‍👦
## 内置功能
1. 👨‍⚕️菜单管理:配置系统菜单,操作权限,按钮权限标识、后端接口权限等。
2. 🧑‍⚕️部门管理:配置系统组织机构(公司、部门、角色)。
3. 👩‍⚕️角色管理:角色菜单权限分配、数据权限分配、设置角色按部门进行数据范围权限划分。
4. 🧑‍🎓按钮权限控制:授权角色的按钮权限和接口权限,可做到每一个接口都能授权数据范围。
5. 🧑‍🎓字段列权限控制:授权页面的字段显示权限,具体到某一列的显示权限。
7. 👨‍🎓用户管理:用户是系统操作者,该功能主要完成系统用户配置。
8. 👬接口白名单:配置不需要进行权限校验的接口。
9. 🧑‍🔧字典管理:对系统中经常使用的一些较为固定的数据进行维护。
10. 🧑‍🔧地区管理:对省市县区域进行管理。
11. 📁附件管理:对平台上所有文件、图片等进行统一管理。
12. 🗓️操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
13. 🔌[插件市场 ](https://bbs.django-vue-admin.com/plugMarket.html):基于Django-Vue-Admin框架开发的应用和插件。
## 插件市场 🔌
更新中...
## 仓库分支说明 💈
主分支:master(稳定版本)
开发分支:develop
## 准备工作
~~~ ~~~
Python >= 3.11.0 (最低3.9+版本) Python >= 3.11.0 (Minimum version 3.9+)
nodejs >= 16.0 Node.js >= 16.0
Mysql >= 8.0 (可选,默认数据库sqlite3,支持5.7+,推荐8.0版本) Mysql >= 8.0 (Optional, default database: SQLite3, supports 5.7+, recommended version: 8.0)
Redis (可选,最新版) Redis (Optional, latest version)
~~~ ~~~
## 前端 ## frontend
```bash ```bash
# 克隆项目 # clone code
git clone https://gitee.com/huge-dream/django-vue3-admin.git git clone https://gitee.com/huge-dream/django-vue3-admin.git
# 进入项目目录 # enter code dir
cd web cd web
# 安装依赖 # install dependence
npm install yarn npm install yarn
yarn install --registry=https://registry.npm.taobao.org yarn install --registry=https://registry.npm.taobao.org
# 启动服务 # Start service
yarn build yarn run dev
# 浏览器访问 http://localhost:8080 # Visit http://localhost:8080 in your browser
# .env.development 文件中可配置启动端口等参数 # Parameters such as boot port can be configured in the #.env.development file
# 构建生产环境 # Build the production environment
# yarn run build # yarn run build
``` ```
## backend💈
## 后端💈
~~~bash ~~~bash
1. 进入项目目录 cd backend 1. enter code dir cd backend
2. 在项目根目录中,复制 ./conf/env.example.py 文件为一份新的到 ./conf 文件夹下,并重命名为 env.py 2. copy ./conf/env.example.py to ./conf dirrename as env.py
3. env.py 中配置数据库信息 3. in env.py configure database information
mysql数据库版本建议:8.0 mysql database recommended version: 8.0
mysql数据库字符集:utf8mb4 mysql database character set: utf8mb4
4. 安装依赖环境 4. install pip dependence
pip3 install -r requirements.txt pip3 install -r requirements.txt
5. 执行迁移命令: 5. Execute the migration command:
python3 manage.py makemigrations python3 manage.py makemigrations
python3 manage.py migrate python3 manage.py migrate
6. 初始化数据 6. Initialization data
python3 manage.py init python3 manage.py init
7. 初始化省市县数据: 7. Initialize provincial, municipal and county data:
python3 manage.py init_area python3 manage.py init_area
8. 启动项目 8. start backend
python3 manage.py runserver 0.0.0.0:8000 python3 manage.py runserver 0.0.0.0:8000
或使用 uvicorn : or uvicorn :
uvicorn application.asgi:application --port 8000 --host 0.0.0.0 --workers 8 uvicorn application.asgi:application --port 8000 --host 0.0.0.0 --workers 8
~~~ ~~~
## 开发建议
前后端backend与web各自单独一个窗口打开进行开发
### 访问项目 ### visit backend swagger
- 访问地址[http://localhost:8080](http://localhost:8080) (默认为此地址,如有修改请按照配置文件) * visit url[http://localhost:8080](http://localhost:8080) (The default address is this one. If you want to change it, follow the configuration file)
- 账号`superadmin` 密码`admin123456` * account`superadmin` password`admin123456`
### docker-compose
### docker-compose 运行
~~~shell ~~~shell
# 先安装docker-compose (自行百度安装),执行此命令等待安装,如有使用celery插件请打开docker-compose.yml中celery 部分注释
docker-compose up -d docker-compose up -d
# 初始化后端数据(第一次执行即可) # Initialize backend data (first execution only)
docker exec -ti dvadmin3-django bash docker exec -ti dvadmin3-django bash
python manage.py makemigrations python manage.py makemigrations
python manage.py migrate python manage.py migrate
@@ -173,22 +137,20 @@ python manage.py init_area
python manage.py init python manage.py init
exit exit
前端地址http://127.0.0.1:8080 frontend urlhttp://127.0.0.1:8080
后端地址http://127.0.0.1:8080/api backend urlhttp://127.0.0.1:8080/api
# 在服务器上请把127.0.0.1 换成自己公网ip # Change 127.0.0.1 to your own public ip address on the server
账号:superadmin 密码:admin123456 account`superadmin` password`admin123456`
# docker-compose 停止 # docker-compose stop
docker-compose down docker-compose down
# docker-compose 重启 # docker-compose restart
docker-compose restart docker-compose restart
# docker-compose 启动时重新进行 build # docker-compose on start build
docker-compose up -d --build docker-compose up -d --build
~~~ ~~~
## Demo screenshot✅
## 演示图✅
![image-01](https://foruda.gitee.com/images/1701348994587355489/1bc749e7_5074988.png) ![image-01](https://foruda.gitee.com/images/1701348994587355489/1bc749e7_5074988.png)
@@ -211,4 +173,3 @@ docker-compose up -d --build
![image-10](https://foruda.gitee.com/images/1701350501421625746/f8dd215e_5074988.png) ![image-10](https://foruda.gitee.com/images/1701350501421625746/f8dd215e_5074988.png)
+214
View File
@@ -0,0 +1,214 @@
# Django-Vue3-Admin
[![img](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitee.com/liqianglog/django-vue-admin/blob/master/LICENSE) [![img](https://img.shields.io/badge/python-%3E=3.7.x-green.svg)](https://python.org/) [![PyPI - Django Version badge](https://img.shields.io/badge/django%20versions-3.2-blue)](https://docs.djangoproject.com/zh-hans/3.2/) [![img](https://img.shields.io/badge/node-%3E%3D%2012.0.0-brightgreen)](https://nodejs.org/zh-cn/) [![img](https://gitee.com/liqianglog/django-vue-admin/badge/star.svg?theme=dark)](https://gitee.com/liqianglog/django-vue-admin)
[预 览](https://demo.dvadmin.com) | [官网文档](https://www.django-vue-admin.com) | [群聊](https://qm.qq.com/cgi-bin/qm/qr?k=fOdnHhC8DJlRHGYSnyhoB8P5rgogA6Vs&jump_from=webapi) | [社区](https://bbs.django-vue-admin.com) | [插件市场](https://bbs.django-vue-admin.com/plugMarket.html) | [Github](https://github.com/liqianglog/django-vue-admin)
💡 **「关于」**
我们是一群热爱代码的青年,在这个炙热的时代下,我们希望静下心来通过Code带来一点我们的色彩和颜色。
因为热爱,所以拥抱未来!
## 平台简介
💡 [django-vue3-admin](https://gitee.com/huge-dream/django-vue3-admin.git) 是一套全部开源的快速开发平台,毫无保留给个人免费使用、团体授权使用。
django-vue3-admin 基于RBAC模型的权限控制的一整套基础开发平台,权限粒度达到列级别,前后端分离,后端采用django + django-rest-framework,前端采用基于 vue3 + CompositionAPI + typescript + vite + element plus
* 🧑‍🤝‍🧑前端采用 Vue3+TS+pinia+fastcrud(感谢[vue-next-admin](https://lyt-top.gitee.io/vue-next-admin-doc-preview/))
* 👭后端采用 Python 语言 Django 框架以及强大的 [Django REST Framework](https://pypi.org/project/djangorestframework)。
* 👫权限认证使用[Django REST Framework SimpleJWT](https://pypi.org/project/djangorestframework-simplejwt),支持多终端认证系统。
* 👬支持加载动态权限菜单,多方式轻松权限控制。
* 👬全新的列权限管控,粒度细化到每一列。
* 💏特别鸣谢:[vue-next-admin](https://lyt-top.gitee.io/vue-next-admin-doc-preview/)。
* 💡特别感谢[jetbrains](https://www.jetbrains.com/) 为本开源项目提供免费的 IntelliJ IDEA 授权。
#### 🏭 环境支持
| Edge | Firefox | Chrome | Safari |
| --------- | ------------ | ----------- | ----------- |
| Edge ≥ 79 | Firefox ≥ 78 | Chrome ≥ 64 | Safari ≥ 12 |
> 由于 Vue3 不再支持 IE11,故而 ElementPlus 也不支持 IE11 及之前版本。
## 在线体验
👩‍👧‍👦演示地址:[https://demo.dvadmin.com](https://demo.dvadmin.com)
- 账号:superadmin
- 密码:admin123456
👩‍👦‍👦文档地址:[DVAdmin官网](https://www.django-vue-admin.com)
## 交流
- 交流社区:[戳我](https://bbs.django-vue-admin.com)👩‍👦‍👦
- 插件市场:[戳我](https://bbs.django-vue-admin.com/plugMarket.html)👩‍👦‍👦
- django-vue-admin交流01群(已满)812482043 [点击链接加入群聊](https://qm.qq.com/cgi-bin/qm/qr?k=aJVwjDvH-Es4MPJQuoO32N0SucK22TE5&jump_from=webapi)
- django-vue-admin交流02群(已满)687252418 [点击链接加入群聊](https://qm.qq.com/cgi-bin/qm/qr?k=4jJN4IjWGfxJ8YJXbb_gTsuWjR34WLdc&jump_from=webapi)
- django-vue-admin交流03群:442108213 [点击链接加入群聊](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=wsm5oSz3K8dElBYUDtLTcQSEPhINFkl8&authKey=M6sbER0z59ZakgBr5erFeZyFZU15CI52bErNZa%2FxSvvGIuVAbY0N5866v89hm%2FK4&noverify=0&group_code=442108213)
- 二维码
<img src='https://images.gitee.com/uploads/images/2022/0530/233203_5fb11883_5074988.jpeg' width='200'>
## 源码地址
gitee地址(主推)[https://gitee.com/huge-dream/django-vue3-admin](https://gitee.com/huge-dream/django-vue3-admin)👩‍👦‍👦
github地址:[https://github.com/huge-dream/django-vue3-admin](https://github.com/huge-dream/django-vue3-admin)👩‍👦‍👦
## 内置功能
1. 👨‍⚕️菜单管理:配置系统菜单,操作权限,按钮权限标识、后端接口权限等。
2. 🧑‍⚕️部门管理:配置系统组织机构(公司、部门、角色)。
3. 👩‍⚕️角色管理:角色菜单权限分配、数据权限分配、设置角色按部门进行数据范围权限划分。
4. 🧑‍🎓按钮权限控制:授权角色的按钮权限和接口权限,可做到每一个接口都能授权数据范围。
5. 🧑‍🎓字段列权限控制:授权页面的字段显示权限,具体到某一列的显示权限。
7. 👨‍🎓用户管理:用户是系统操作者,该功能主要完成系统用户配置。
8. 👬接口白名单:配置不需要进行权限校验的接口。
9. 🧑‍🔧字典管理:对系统中经常使用的一些较为固定的数据进行维护。
10. 🧑‍🔧地区管理:对省市县区域进行管理。
11. 📁附件管理:对平台上所有文件、图片等进行统一管理。
12. 🗓️操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
13. 🔌[插件市场 ](https://bbs.django-vue-admin.com/plugMarket.html):基于Django-Vue-Admin框架开发的应用和插件。
## 插件市场 🔌
更新中...
## 仓库分支说明 💈
主分支:master(稳定版本)
开发分支:develop
## 准备工作
~~~
Python >= 3.11.0 (最低3.9+版本)
nodejs >= 16.0
Mysql >= 8.0 (可选,默认数据库sqlite3,支持5.7+,推荐8.0版本)
Redis (可选,最新版)
~~~
## 前端♝
```bash
# 克隆项目
git clone https://gitee.com/huge-dream/django-vue3-admin.git
# 进入项目目录
cd web
# 安装依赖
npm install yarn
yarn install --registry=https://registry.npm.taobao.org
# 启动服务
yarn build
# 浏览器访问 http://localhost:8080
# .env.development 文件中可配置启动端口等参数
# 构建生产环境
# yarn run build
```
## 后端💈
~~~bash
1. 进入项目目录 cd backend
2. 在项目根目录中,复制 ./conf/env.example.py 文件为一份新的到 ./conf 文件夹下,并重命名为 env.py
3. 在 env.py 中配置数据库信息
mysql数据库版本建议:8.0
mysql数据库字符集:utf8mb4
4. 安装依赖环境
pip3 install -r requirements.txt
5. 执行迁移命令:
python3 manage.py makemigrations
python3 manage.py migrate
6. 初始化数据
python3 manage.py init
7. 初始化省市县数据:
python3 manage.py init_area
8. 启动项目
python3 manage.py runserver 0.0.0.0:8000
或使用 uvicorn :
uvicorn application.asgi:application --port 8000 --host 0.0.0.0 --workers 8
~~~
## 开发建议
前后端backend与web各自单独一个窗口打开进行开发
### 访问项目
- 访问地址:[http://localhost:8080](http://localhost:8080) (默认为此地址,如有修改请按照配置文件)
- 账号:`superadmin` 密码:`admin123456`
### docker-compose 运行
~~~shell
# 先安装docker-compose (自行百度安装),执行此命令等待安装,如有使用celery插件请打开docker-compose.yml中celery 部分注释
docker-compose up -d
# 初始化后端数据(第一次执行即可)
docker exec -ti dvadmin3-django bash
python manage.py makemigrations
python manage.py migrate
python manage.py init_area
python manage.py init
exit
前端地址:http://127.0.0.1:8080
后端地址:http://127.0.0.1:8080/api
# 在服务器上请把127.0.0.1 换成自己公网ip
账号:superadmin 密码:admin123456
# docker-compose 停止
docker-compose down
# docker-compose 重启
docker-compose restart
# docker-compose 启动时重新进行 build
docker-compose up -d --build
~~~
## 演示图✅
![image-01](https://foruda.gitee.com/images/1701348994587355489/1bc749e7_5074988.png)
![image-02](https://foruda.gitee.com/images/1701349037811908960/80d361db_5074988.png)
![image-03](https://foruda.gitee.com/images/1701349224478845203/954f0a7b_5074988.png)
![image-04](https://foruda.gitee.com/images/1701349248928658877/64926724_5074988.png)
![image-05](https://foruda.gitee.com/images/1701349259068943299/1306ba40_5074988.png)
![image-06](https://foruda.gitee.com/images/1701349294894429495/e3b3a8cf_5074988.png)
![image-07](https://foruda.gitee.com/images/1701350432536247561/3b26685e_5074988.png)
![image-08](https://foruda.gitee.com/images/1701350455264771992/b364c57f_5074988.png)
![image-09](https://foruda.gitee.com/images/1701350479266000753/e4e4f7c5_5074988.png)
![image-10](https://foruda.gitee.com/images/1701350501421625746/f8dd215e_5074988.png)
+22
View File
@@ -1,9 +1,11 @@
import functools
import os import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'application.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'application.settings')
from django.conf import settings from django.conf import settings
from celery import platforms from celery import platforms
# 租户模式 # 租户模式
if "django_tenants" in settings.INSTALLED_APPS: if "django_tenants" in settings.INSTALLED_APPS:
from tenant_schemas_celery.app import CeleryApp as TenantAwareCeleryApp from tenant_schemas_celery.app import CeleryApp as TenantAwareCeleryApp
@@ -16,3 +18,23 @@ else:
app.config_from_object('django.conf:settings') app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
platforms.C_FORCE_ROOT = True platforms.C_FORCE_ROOT = True
def retry_base_task_error():
"""
celery 失败重试装饰器
:return:
"""
def wraps(func):
@app.task(bind=True, retry_delay=180, max_retries=3)
@functools.wraps(func)
def wrapper(self, *args, **kwargs):
try:
return func(*args, **kwargs)
except Exception as exc:
raise self.retry(exc=exc)
return wrapper
return wraps
+8
View File
@@ -63,6 +63,7 @@ INSTALLED_APPS = [
] ]
MIDDLEWARE = [ MIDDLEWARE = [
"dvadmin.utils.middleware.HealthCheckMiddleware",
"django.middleware.security.SecurityMiddleware", "django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware", "whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware", "django.contrib.sessions.middleware.SessionMiddleware",
@@ -154,6 +155,11 @@ STATICFILES_DIRS = [
MEDIA_ROOT = "media" # 项目下的目录 MEDIA_ROOT = "media" # 项目下的目录
MEDIA_URL = "/media/" # 跟STATIC_URL类似,指定用户可以通过这个url找到文件 MEDIA_URL = "/media/" # 跟STATIC_URL类似,指定用户可以通过这个url找到文件
#添加以下代码以后就不用写{% load staticfiles %},可以直接引用
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder"
)
# 收集静态文件,必须将 MEDIA_ROOT,STATICFILES_DIRS先注释 # 收集静态文件,必须将 MEDIA_ROOT,STATICFILES_DIRS先注释
# python manage.py collectstatic # python manage.py collectstatic
# STATIC_ROOT=os.path.join(BASE_DIR,'static') # STATIC_ROOT=os.path.join(BASE_DIR,'static')
@@ -402,5 +408,7 @@ PLUGINS_URL_PATTERNS = []
# from dvadmin_third.settings import * # 第三方用户管理 # from dvadmin_third.settings import * # 第三方用户管理
# from dvadmin_ak_sk.settings import * # 秘钥管理管理 # from dvadmin_ak_sk.settings import * # 秘钥管理管理
# from dvadmin_tenants.settings import * # 租户管理 # from dvadmin_tenants.settings import * # 租户管理
#from dvadmin_social_auth.settings import *
#from dvadmin_uniapp.settings import *
# ... # ...
# ********** 一键导入插件配置结束 ********** # ********** 一键导入插件配置结束 **********
+30
View File
@@ -53,6 +53,33 @@ schema_view = get_schema_view(
permission_classes=(permissions.AllowAny,), permission_classes=(permissions.AllowAny,),
generator_class=CustomOpenAPISchemaGenerator, generator_class=CustomOpenAPISchemaGenerator,
) )
# 前端页面映射
from django.http import Http404, HttpResponse
from django.shortcuts import render
import mimetypes
import os
def web_view(request):
return render(request, 'web/index.html')
def serve_web_files(request, filename):
# 设定文件路径
filepath = os.path.join(settings.BASE_DIR, 'templates', 'web', filename)
# 检查文件是否存在
if not os.path.exists(filepath):
raise Http404("File does not exist")
# 根据文件扩展名,确定 MIME 类型
mime_type, _ = mimetypes.guess_type(filepath)
# 打开文件并读取内容
with open(filepath, 'rb') as f:
response = HttpResponse(f.read(), content_type=mime_type)
return response
urlpatterns = ( urlpatterns = (
[ [
@@ -85,6 +112,9 @@ urlpatterns = (
# 仅用于开发,上线需关闭 # 仅用于开发,上线需关闭
path("api/token/", LoginTokenView.as_view()), path("api/token/", LoginTokenView.as_view()),
# 前端页面映射
path('web/', web_view, name='web_view'),
path('web/<path:filename>', serve_web_files, name='serve_web_files'),
] ]
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+ static(settings.STATIC_URL, document_root=settings.STATIC_URL) + static(settings.STATIC_URL, document_root=settings.STATIC_URL)
+11 -9
View File
@@ -7,30 +7,32 @@ from application.settings import BASE_DIR
# ================================================= # # ================================================= #
# 数据库 ENGINE ,默认演示使用 sqlite3 数据库,正式环境建议使用 mysql 数据库 # 数据库 ENGINE ,默认演示使用 sqlite3 数据库,正式环境建议使用 mysql 数据库
# sqlite3 设置 # sqlite3 设置
DATABASE_ENGINE = "django.db.backends.sqlite3" # DATABASE_ENGINE = "django.db.backends.sqlite3"
DATABASE_NAME = os.path.join(BASE_DIR, "db.sqlite3") # DATABASE_NAME = os.path.join(BASE_DIR, "db.sqlite3")
# 使用mysql时,改为此配置 # 使用mysql时,改为此配置
# DATABASE_ENGINE = "django.db.backends.mysql" DATABASE_ENGINE = "django.db.backends.mysql"
# DATABASE_NAME = 'django-vue-admin' # mysql 时使用 DATABASE_NAME = 'django-vue3-admin' # mysql 时使用
# 数据库地址 改为自己数据库地址 # 数据库地址 改为自己数据库地址
DATABASE_HOST = "127.0.0.1" DATABASE_HOST = '127.0.0.1'
# # 数据库端口 # # 数据库端口
DATABASE_PORT = 3306 DATABASE_PORT = 3306
# # 数据库用户名 # # 数据库用户名
DATABASE_USER = "root" DATABASE_USER = "root"
# # 数据库密码 # # 数据库密码
DATABASE_PASSWORD = "123456" DATABASE_PASSWORD = 'DVADMIN3'
# 表前缀 # 表前缀
TABLE_PREFIX = "dvadmin_" TABLE_PREFIX = "dvadmin_"
# ================================================= # # ================================================= #
# ******** redis配置,无redis 可不进行配置 ******** # # ******** redis配置,无redis 可不进行配置 ******** #
# ================================================= # # ================================================= #
# REDIS_PASSWORD = '' REDIS_DB = 1
# REDIS_HOST = '127.0.0.1' CELERY_BROKER_DB = 3
# REDIS_URL = f'redis://:{REDIS_PASSWORD or ""}@{REDIS_HOST}:6380' REDIS_PASSWORD = 'DVADMIN3'
REDIS_HOST = '127.0.0.1'
REDIS_URL = f'redis://:{REDIS_PASSWORD or ""}@{REDIS_HOST}:6379'
# ================================================= # # ================================================= #
# ****************** 功能 启停 ******************* # # ****************** 功能 启停 ******************* #
# ================================================= # # ================================================= #
@@ -5,6 +5,7 @@ from rest_framework import serializers
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'application.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'application.settings')
import django import django
django.setup() django.setup()
from dvadmin.system.models import ( from dvadmin.system.models import (
Role, Dept, Users, Menu, MenuButton, Role, Dept, Users, Menu, MenuButton,
@@ -60,9 +61,10 @@ class MenuFieldInitSerializer(CustomModelSerializer):
class Meta: class Meta:
model = MenuField model = MenuField
fields = ['id', 'menu','field_name','title','model'] fields = ['id', 'menu', 'field_name', 'title', 'model']
read_only_fields = ["id"] read_only_fields = ["id"]
class MenuInitSerializer(CustomModelSerializer): class MenuInitSerializer(CustomModelSerializer):
""" """
递归深度获取数信息(用于生成初始化json文件) 递归深度获取数信息(用于生成初始化json文件)
@@ -71,6 +73,7 @@ class MenuInitSerializer(CustomModelSerializer):
children = serializers.SerializerMethodField() children = serializers.SerializerMethodField()
menu_button = serializers.SerializerMethodField() menu_button = serializers.SerializerMethodField()
menu_field = serializers.SerializerMethodField() menu_field = serializers.SerializerMethodField()
def get_children(self, obj: Menu): def get_children(self, obj: Menu):
data = [] data = []
instance = Menu.objects.filter(parent_id=obj.id) instance = Menu.objects.filter(parent_id=obj.id)
@@ -90,7 +93,7 @@ class MenuInitSerializer(CustomModelSerializer):
data = [] data = []
instance = obj.menufield_set.order_by('field_name') instance = obj.menufield_set.order_by('field_name')
if instance: if instance:
data = list(instance.values('field_name', 'title','model')) data = list(instance.values('field_name', 'title', 'model'))
return data return data
def save(self, **kwargs): def save(self, **kwargs):
@@ -131,8 +134,9 @@ class MenuInitSerializer(CustomModelSerializer):
for field_data in menu_field: for field_data in menu_field:
field_data['menu'] = instance.id field_data['menu'] = instance.id
filter_data = { filter_data = {
'menu':field_data['menu'], 'menu': field_data['menu'],
'field_name':field_data['field_name'] 'field_name': field_data['field_name'],
'model': field_data['model']
} }
instance_obj = MenuField.objects.filter(**filter_data).first() instance_obj = MenuField.objects.filter(**filter_data).first()
serializer = MenuFieldInitSerializer(instance_obj, data=field_data, request=self.request) serializer = MenuFieldInitSerializer(instance_obj, data=field_data, request=self.request)
@@ -143,7 +147,7 @@ class MenuInitSerializer(CustomModelSerializer):
class Meta: class Meta:
model = Menu model = Menu
fields = ['name', 'icon', 'sort', 'is_link', 'is_catalog', 'web_path', 'component', 'component_name', 'status', fields = ['name', 'icon', 'sort', 'is_link', 'is_catalog', 'web_path', 'component', 'component_name', 'status',
'cache', 'visible', 'parent', 'children', 'menu_button','menu_field', 'creator', 'dept_belong_id'] 'cache', 'visible', 'parent', 'children', 'menu_button', 'menu_field', 'creator', 'dept_belong_id']
extra_kwargs = { extra_kwargs = {
'creator': {'write_only': True}, 'creator': {'write_only': True},
'dept_belong_id': {'write_only': True} 'dept_belong_id': {'write_only': True}
@@ -171,22 +175,24 @@ class RoleMenuInitSerializer(CustomModelSerializer):
""" """
初始化角色菜单(用于生成初始化json文件) 初始化角色菜单(用于生成初始化json文件)
""" """
role_key = serializers.CharField(max_length=100, required=True) role__key = serializers.CharField(max_length=100, required=True)
menu_component_name = serializers.CharField(max_length=100, required=True) menu__web_path = serializers.CharField(max_length=100, required=True)
menu__component_name = serializers.CharField(max_length=100, required=True, allow_blank=True)
def create(self, validated_data): def create(self, validated_data):
init_data = self.initial_data init_data = self.initial_data
validated_data.pop('menu_component_name') validated_data.pop('menu__web_path')
validated_data.pop('role_key') validated_data.pop('menu__component_name')
role_id = Role.objects.filter(key=init_data['role_key']).first() validated_data.pop('role__key')
menu_id = Menu.objects.filter(component_name=init_data['menu_component_name']).first() role_id = Role.objects.filter(key=init_data['role__key']).first()
menu_id = Menu.objects.filter(web_path=init_data['menu__web_path'], component_name=init_data['menu__component_name']).first()
validated_data['role'] = role_id validated_data['role'] = role_id
validated_data['menu'] = menu_id validated_data['menu'] = menu_id
return super().create(validated_data) return super().create(validated_data)
class Meta: class Meta:
model = RoleMenuPermission model = RoleMenuPermission
fields = ['role_key', 'menu_component_name', 'creator', 'dept_belong_id'] fields = ['role__key', 'menu__web_path', 'menu__component_name', 'creator', 'dept_belong_id']
read_only_fields = ["id"] read_only_fields = ["id"]
extra_kwargs = { extra_kwargs = {
'role': {'required': False}, 'role': {'required': False},
@@ -200,25 +206,30 @@ class RoleMenuButtonInitSerializer(CustomModelSerializer):
""" """
初始化角色菜单按钮(用于生成初始化json文件) 初始化角色菜单按钮(用于生成初始化json文件)
""" """
role_key = serializers.CharField(max_length=100, required=True) role__key = serializers.CharField(max_length=100, required=True)
menu_button_value = serializers.CharField(max_length=100, required=True) menu_button__value = serializers.CharField(max_length=100, required=True)
data_range = serializers.CharField(max_length=100, required=False) data_range = serializers.CharField(max_length=100, required=False)
def create(self, validated_data): def create(self, validated_data):
init_data = self.initial_data init_data = self.initial_data
validated_data.pop('menu_button_value') validated_data.pop('menu_button__value')
validated_data.pop('role_key') validated_data.pop('role__key')
role_id = Role.objects.filter(key=init_data['role_key']).first() role_id = Role.objects.filter(key=init_data['role__key']).first()
menu_button_id = MenuButton.objects.filter(value=init_data['menu_button_value']).first() menu_button_id = MenuButton.objects.filter(value=init_data['menu_button__value']).first()
validated_data['role'] = role_id validated_data['role'] = role_id
validated_data['menu_button'] = menu_button_id validated_data['menu_button'] = menu_button_id
instance = super().create(validated_data) instance = super().create(validated_data)
instance.dept.set([]) instance.dept.set([])
return instance return instance
def save(self, **kwargs):
if self.instance and self.initial_data.get('reset'):
return super().save(**kwargs)
return self.instance
class Meta: class Meta:
model = RoleMenuButtonPermission model = RoleMenuButtonPermission
fields = ['role_key', 'menu_button_value', 'data_range', 'dept', 'creator', 'dept_belong_id'] fields = ['role__key', 'menu_button__value', 'data_range', 'dept', 'creator', 'dept_belong_id']
read_only_fields = ["id"] read_only_fields = ["id"]
extra_kwargs = { extra_kwargs = {
'role': {'required': False}, 'role': {'required': False},
@@ -1,12 +1,7 @@
[ [
{ {
"role_key": "admin", "role__key": "admin",
"menu_button_value": "menu:Search", "menu_button__value": "menu:Search",
"data_range": 0
},
{
"role_key": "public",
"menu_button_value":"menu:Search",
"data_range": 0 "data_range": 0
} }
] ]
@@ -1,10 +1,12 @@
[ [
{ {
"role_key": "admin", "role__key": "admin",
"menu_component_name": "menu" "menu__web_path": "/system",
"menu__component_name": ""
}, },
{ {
"role_key": "public", "role__key": "admin",
"menu_component_name": "menu" "menu__web_path": "/menu",
"menu__component_name": "menu"
} }
] ]
@@ -12,6 +12,34 @@
"placeholder": null, "placeholder": null,
"setting": null, "setting": null,
"children": [ "children": [
{
"parent": 10,
"title": "网页标题",
"key": "web_title",
"value": "DVAdmin",
"sort": 1,
"status": true,
"data_options": null,
"form_item_type": 0,
"rule": [],
"placeholder": "请输入网站标题",
"setting": null,
"children": []
},
{
"parent": 10,
"title": "网站小图标",
"key": "web_favicon",
"value": "",
"sort": 1,
"status": true,
"data_options": null,
"form_item_type": 0,
"rule": [],
"placeholder": "请输入网站小图标",
"setting": null,
"children": []
},
{ {
"parent": 10, "parent": 10,
"title": "开启验证码", "title": "开启验证码",
@@ -182,7 +210,7 @@
"parent": 1, "parent": 1,
"title": "隐私链接", "title": "隐私链接",
"key": "privacy_url", "key": "privacy_url",
"value": "#", "value": "/api/system/clause/privacy.html",
"sort": 7, "sort": 7,
"status": true, "status": true,
"data_options": null, "data_options": null,
@@ -196,7 +224,7 @@
"parent": 1, "parent": 1,
"title": "条款链接", "title": "条款链接",
"key": "clause_url", "key": "clause_url",
"value": "#", "value": "/api/system/clause/terms_service.html",
"sort": 8, "sort": 8,
"status": true, "status": true,
"data_options": null, "data_options": null,
@@ -45,13 +45,13 @@ class Initialize(CoreInitialize):
""" """
初始化角色菜单信息 初始化角色菜单信息
""" """
self.init_base(RoleMenuInitSerializer, unique_fields=['role', 'menu']) self.init_base(RoleMenuInitSerializer, unique_fields=['role__key', 'menu__web_path', 'menu__component_name'])
def init_role_menu_button(self): def init_role_menu_button(self):
""" """
初始化角色菜单按钮信息 初始化角色菜单按钮信息
""" """
self.init_base(RoleMenuButtonInitSerializer, unique_fields=['role', 'menu_button']) self.init_base(RoleMenuButtonInitSerializer, unique_fields=['role__key', 'menu_button__value'])
def init_api_white_list(self): def init_api_white_list(self):
""" """
@@ -22,6 +22,8 @@ class Command(BaseCommand):
parser.add_argument("-Y", nargs="*") parser.add_argument("-Y", nargs="*")
parser.add_argument("-n", nargs="*") parser.add_argument("-n", nargs="*")
parser.add_argument("-N", nargs="*") parser.add_argument("-N", nargs="*")
parser.add_argument("-app", nargs="*")
parser.add_argument("-A", nargs="*")
def handle(self, *args, **options): def handle(self, *args, **options):
reset = False reset = False
@@ -29,9 +31,10 @@ class Command(BaseCommand):
reset = True reset = True
if isinstance(options.get("n"), list) or isinstance(options.get("N"), list): if isinstance(options.get("n"), list) or isinstance(options.get("N"), list):
reset = False reset = False
assign_apps = options.get("app") or options.get("A") or []
for app in settings.INSTALLED_APPS: for app in settings.INSTALLED_APPS:
if assign_apps and app not in assign_apps:
continue
try: try:
exec( exec(
f""" f"""
+25 -1
View File
@@ -70,6 +70,7 @@ class Users(CoreModel, AbstractUser):
blank=True, blank=True,
help_text="关联部门", help_text="关联部门",
) )
login_error_count = models.IntegerField(default=0, verbose_name="登录错误次数", help_text="登录错误次数")
objects = CustomUserManager() objects = CustomUserManager()
def set_password(self, raw_password): def set_password(self, raw_password):
@@ -162,6 +163,7 @@ class Menu(CoreModel):
(1, ""), (1, ""),
) )
is_link = models.BooleanField(default=False, verbose_name="是否外链", help_text="是否外链") is_link = models.BooleanField(default=False, verbose_name="是否外链", help_text="是否外链")
link_url = models.CharField(max_length=255, verbose_name="链接地址", null=True, blank=True, help_text="链接地址")
is_catalog = models.BooleanField(default=False, verbose_name="是否目录", help_text="是否目录") is_catalog = models.BooleanField(default=False, verbose_name="是否目录", help_text="是否目录")
web_path = models.CharField(max_length=128, verbose_name="路由地址", null=True, blank=True, help_text="路由地址") web_path = models.CharField(max_length=128, verbose_name="路由地址", null=True, blank=True, help_text="路由地址")
component = models.CharField(max_length=128, verbose_name="组件地址", null=True, blank=True, help_text="组件地址") component = models.CharField(max_length=128, verbose_name="组件地址", null=True, blank=True, help_text="组件地址")
@@ -171,7 +173,29 @@ class Menu(CoreModel):
cache = models.BooleanField(default=False, blank=True, verbose_name="是否页面缓存", help_text="是否页面缓存") cache = models.BooleanField(default=False, blank=True, verbose_name="是否页面缓存", help_text="是否页面缓存")
visible = models.BooleanField(default=True, blank=True, verbose_name="侧边栏中是否显示", visible = models.BooleanField(default=True, blank=True, verbose_name="侧边栏中是否显示",
help_text="侧边栏中是否显示") help_text="侧边栏中是否显示")
is_iframe = models.BooleanField(default=False, blank=True, verbose_name="框架外显示", help_text="框架外显示")
is_affix = models.BooleanField(default=False, blank=True, verbose_name="是否固定", help_text="是否固定")
@classmethod
def get_all_parent(cls, id: int, all_list=None, nodes=None):
"""
递归获取给定ID的所有层级
:param id: 参数ID
:param all_list: 所有列表
:param nodes: 递归列表
:return: nodes
"""
if not all_list:
all_list = Menu.objects.values("id", "name", "parent")
if nodes is None:
nodes = []
for ele in all_list:
if ele.get("id") == id:
parent_id = ele.get("parent")
if parent_id is not None:
cls.get_all_parent(parent_id, all_list, nodes)
nodes.append(ele)
return nodes
class Meta: class Meta:
db_table = table_prefix + "system_menu" db_table = table_prefix + "system_menu"
verbose_name = "菜单表" verbose_name = "菜单表"
@@ -462,7 +486,7 @@ class SystemConfig(CoreModel):
help_text="父级", help_text="父级",
) )
title = models.CharField(max_length=50, verbose_name="标题", help_text="标题") title = models.CharField(max_length=50, verbose_name="标题", help_text="标题")
key = models.CharField(max_length=20, verbose_name="", help_text="", db_index=True) key = models.CharField(max_length=100, verbose_name="", help_text="", db_index=True)
value = models.JSONField(max_length=100, verbose_name="", help_text="", null=True, blank=True) value = models.JSONField(max_length=100, verbose_name="", help_text="", null=True, blank=True)
sort = models.IntegerField(default=0, verbose_name="排序", help_text="排序", blank=True) sort = models.IntegerField(default=0, verbose_name="排序", help_text="排序", blank=True)
status = models.BooleanField(default=True, verbose_name="启用状态", help_text="启用状态") status = models.BooleanField(default=True, verbose_name="启用状态", help_text="启用状态")
+55
View File
@@ -1 +1,56 @@
from functools import wraps
from django.db.models import Func, F, OuterRef, Exists
from django.test import TestCase from django.test import TestCase
import django
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "application.settings")
django.setup()
from dvadmin.system.models import Menu, RoleMenuPermission, RoleMenuButtonPermission, MenuButton
import time
def timing_decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
start_time = time.time()
result = func(*args, **kwargs)
end_time = time.time()
run_time = end_time - start_time
print(f"{func.__name__} ran in {run_time:.6f} seconds")
return result
return wrapper
@timing_decorator
def getMenu():
data = []
queryset = Menu.objects.filter(status=1, is_catalog=False).values('name', 'id')
for item in queryset:
parent_list = Menu.get_all_parent(item['id'])
names = [d["name"] for d in parent_list]
completeName = "/".join(names)
isCheck = RoleMenuPermission.objects.filter(
menu__id=item['id'],
role__id=1,
).exists()
mbCheck = RoleMenuButtonPermission.objects.filter(
menu_button = OuterRef("pk"),
role__id=1,
)
btns = MenuButton.objects.filter(
menu__id=item['id'],
).annotate(isCheck=Exists(mbCheck)).values('id', 'name', 'value', 'isCheck',data_range=F('menu_button_permission__data_range'))
# print(b)
dicts = {
'name': completeName,
'id': item['id'],
'isCheck': isCheck,
'btns':btns
}
print(dicts)
data.append(dicts)
# print(data)
if __name__ == '__main__':
getMenu()
+3
View File
@@ -3,6 +3,7 @@ from rest_framework import routers
from dvadmin.system.views.api_white_list import ApiWhiteListViewSet from dvadmin.system.views.api_white_list import ApiWhiteListViewSet
from dvadmin.system.views.area import AreaViewSet from dvadmin.system.views.area import AreaViewSet
from dvadmin.system.views.clause import PrivacyView, TermsServiceView
from dvadmin.system.views.dept import DeptViewSet from dvadmin.system.views.dept import DeptViewSet
from dvadmin.system.views.dictionary import DictionaryViewSet from dvadmin.system.views.dictionary import DictionaryViewSet
from dvadmin.system.views.file_list import FileViewSet from dvadmin.system.views.file_list import FileViewSet
@@ -46,5 +47,7 @@ urlpatterns = [
path('login_log/', LoginLogViewSet.as_view({'get': 'list'})), path('login_log/', LoginLogViewSet.as_view({'get': 'list'})),
path('login_log/<int:pk>/', LoginLogViewSet.as_view({'get': 'retrieve'})), path('login_log/<int:pk>/', LoginLogViewSet.as_view({'get': 'retrieve'})),
path('dept_lazy_tree/', DeptViewSet.as_view({'get': 'dept_lazy_tree'})), path('dept_lazy_tree/', DeptViewSet.as_view({'get': 'dept_lazy_tree'})),
path('clause/privacy.html', PrivacyView.as_view()),
path('clause/terms_service.html', TermsServiceView.as_view()),
] ]
urlpatterns += system_url.urls urlpatterns += system_url.urls
+3 -6
View File
@@ -60,12 +60,9 @@ class AreaViewSet(CustomModelViewSet):
del params['page'] del params['page']
if limit: if limit:
del params['limit'] del params['limit']
if params: if params and pcode:
if pcode: queryset = self.queryset.filter(enable=True, pcode=pcode)
queryset = self.queryset.filter(enable=True, pcode=pcode)
else:
queryset = self.queryset.filter(enable=True)
else: else:
queryset = self.queryset.filter(enable=True, pcode__isnull=True) queryset = self.queryset.filter(enable=True)
return queryset return queryset
+23
View File
@@ -0,0 +1,23 @@
from rest_framework.views import APIView
from django.shortcuts import render
class PrivacyView(APIView):
"""
后台隐私政策
"""
permission_classes = []
def get(self, request, *args, **kwargs):
return render(request, 'privacy.html')
class TermsServiceView(APIView):
"""
后台服务条款
"""
permission_classes = []
def get(self, request, *args, **kwargs):
return render(request, 'terms_service.html')
+4 -7
View File
@@ -115,13 +115,10 @@ class DeptViewSet(CustomModelViewSet):
del params['page'] del params['page']
if limit: if limit:
del params['limit'] del params['limit']
if params: if params and parent:
if parent: queryset = self.queryset.filter(status=True, parent=parent)
queryset = self.queryset.filter(status=True, parent=parent)
else:
queryset = self.queryset.filter(status=True)
else: else:
queryset = self.queryset.filter(status=True, parent__isnull=True) queryset = self.queryset.filter(status=True)
queryset = self.filter_queryset(queryset) queryset = self.filter_queryset(queryset)
serializer = DeptSerializer(queryset, many=True, request=request) serializer = DeptSerializer(queryset, many=True, request=request)
data = serializer.data data = serializer.data
@@ -143,7 +140,7 @@ class DeptViewSet(CustomModelViewSet):
if item in [0, 2]: if item in [0, 2]:
dept_list = [user_dept_id] dept_list = [user_dept_id]
elif item == 1: elif item == 1:
dept_list = Dept.recursion_dept_info(dept_id=user_dept_id) dept_list = Dept.recursion_all_dept(dept_id=user_dept_id)
elif item == 3: elif item == 3:
dept_list = Dept.objects.values_list('id', flat=True) dept_list = Dept.objects.values_list('id', flat=True)
elif item == 4: elif item == 4:
+31 -21
View File
@@ -86,28 +86,38 @@ class LoginSerializer(TokenObtainPairSerializer):
user = Users.objects.get(username=attrs['username']) user = Users.objects.get(username=attrs['username'])
if not user.is_active: if not user.is_active:
raise CustomValidationError("账号被锁定") raise CustomValidationError("账号被锁定,联系管理员解锁")
try:
data = super().validate(attrs)
data["name"] = self.user.name
data["userId"] = self.user.id
data["avatar"] = self.user.avatar
data['user_type'] = self.user.user_type
dept = getattr(self.user, 'dept', None)
if dept:
data['dept_info'] = {
'dept_id': dept.id,
'dept_name': dept.name,
data = super().validate(attrs) }
data["name"] = self.user.name role = getattr(self.user, 'role', None)
data["userId"] = self.user.id if role:
data["avatar"] = self.user.avatar data['role_info'] = role.values('id', 'name', 'key')
data['user_type'] = self.user.user_type request = self.context.get("request")
dept = getattr(self.user, 'dept', None) request.user = self.user
if dept: # 记录登录日志
data['dept_info'] = { save_login_log(request=request)
'dept_id': dept.id, user.login_error_count = 0
'dept_name': dept.name, user.save()
return {"code": 2000, "msg": "请求成功", "data": data}
} except Exception as e:
role = getattr(self.user, 'role', None) user.login_error_count += 1
if role: if user.login_error_count >= 5:
data['role_info'] = role.values('id', 'name', 'key') user.is_active = False
request = self.context.get("request") raise CustomValidationError("账号已被锁定,联系管理员解锁")
request.user = self.user user.save()
# 记录登录日志 count = 5 - user.login_error_count
save_login_log(request=request) raise CustomValidationError(f"账号/密码错误;重试{count}次后将被锁定~")
return {"code": 2000, "msg": "请求成功", "data": data}
class LoginView(TokenObtainPairView): class LoginView(TokenObtainPairView):
+2 -2
View File
@@ -71,8 +71,8 @@ class WebRouterSerializer(CustomModelSerializer):
class Meta: class Meta:
model = Menu model = Menu
fields = ( fields = (
'id', 'parent', 'icon', 'sort', 'path', 'name', 'title', 'is_link', 'is_catalog', 'web_path', 'component', 'id', 'parent', 'icon', 'sort', 'path', 'name', 'title', 'is_link','link_url', 'is_catalog', 'web_path', 'component',
'component_name', 'cache', 'visible', 'status') 'component_name', 'cache', 'visible','is_iframe','is_affix', 'status')
read_only_fields = ["id"] read_only_fields = ["id"]
+26 -1
View File
@@ -63,7 +63,7 @@ class MenuButtonViewSet(CustomModelViewSet):
:param kwargs: :param kwargs:
:return: :return:
""" """
queryset = self.filter_queryset(self.get_queryset()) queryset = self.filter_queryset(self.get_queryset()).order_by('name')
serializer = self.get_serializer(queryset, many=True, request=request) serializer = self.get_serializer(queryset, many=True, request=request)
return SuccessResponse(serializer.data,msg="获取成功") return SuccessResponse(serializer.data,msg="获取成功")
@@ -81,3 +81,28 @@ class MenuButtonViewSet(CustomModelViewSet):
role_id = request.user.role.values_list('id', flat=True) role_id = request.user.role.values_list('id', flat=True)
queryset = RoleMenuButtonPermission.objects.filter(role__in=role_id).values_list('menu_button__value',flat=True).distinct() queryset = RoleMenuButtonPermission.objects.filter(role__in=role_id).values_list('menu_button__value',flat=True).distinct()
return DetailResponse(data=queryset) return DetailResponse(data=queryset)
@action(methods=['post'], detail=False, permission_classes=[IsAuthenticated])
def batch_create(self, request, *args, **kwargs):
"""
批量创建菜单增删改查查权限
创建的数据来源于菜单需要规范创建菜单参数
value菜单的component_name:method
api:菜单的web_path增加'/api'前缀并根据method增加{id}
"""
menu_obj = Menu.objects.filter(id=request.data['menu']).first()
result_list = [
{'menu': menu_obj.id, 'name': '新增', 'value': f'{menu_obj.component_name}:Create', 'api': f'/api{menu_obj.web_path}/',
'method': 1},
{'menu': menu_obj.id, 'name': '删除', 'value': f'{menu_obj.component_name}:Delete', 'api': f'/api{menu_obj.web_path}/{{id}}/',
'method': 3},
{'menu': menu_obj.id, 'name': '修改', 'value': f'{menu_obj.component_name}:Update', 'api': f'/api{menu_obj.web_path}/{{id}}/',
'method': 2},
{'menu': menu_obj.id, 'name': '查询', 'value': f'{menu_obj.component_name}:Search', 'api': f'/api{menu_obj.web_path}/',
'method': 0},
{'menu': menu_obj.id, 'name': '详情', 'value': f'{menu_obj.component_name}:Retrieve', 'api': f'/api{menu_obj.web_path}/{{id}}/',
'method': 0}]
serializer = self.get_serializer(data=result_list, many=True)
serializer.is_valid(raise_exception=True)
serializer.save()
return SuccessResponse(serializer.data, msg="批量创建成功")
+1 -1
View File
@@ -26,7 +26,7 @@ class MenuFieldViewSet(CustomModelViewSet):
""" """
列权限视图集 列权限视图集
""" """
queryset = MenuField.objects.all() queryset = MenuField.objects.order_by('-model')
serializer_class = MenuFieldSerializer serializer_class = MenuFieldSerializer
def list(self, request, *args, **kwargs): def list(self, request, *args, **kwargs):
+6 -6
View File
@@ -47,12 +47,12 @@ class RoleCreateUpdateSerializer(CustomModelSerializer):
def validate(self, attrs: dict): def validate(self, attrs: dict):
return super().validate(attrs) return super().validate(attrs)
def save(self, **kwargs): # def save(self, **kwargs):
is_superuser = self.request.user.is_superuser # is_superuser = self.request.user.is_superuser
if not is_superuser: # if not is_superuser:
self.validated_data.pop('admin') # self.validated_data.pop('admin')
data = super().save(**kwargs) # data = super().save(**kwargs)
return data # return data
class Meta: class Meta:
model = Role model = Role
@@ -23,13 +23,13 @@ class RoleMenuButtonPermissionSerializer(CustomModelSerializer):
""" """
菜单按钮-序列化器 菜单按钮-序列化器
""" """
class Meta: class Meta:
model = RoleMenuButtonPermission model = RoleMenuButtonPermission
fields = "__all__" fields = "__all__"
read_only_fields = ["id"] read_only_fields = ["id"]
class RoleMenuButtonPermissionCreateUpdateSerializer(CustomModelSerializer): class RoleMenuButtonPermissionCreateUpdateSerializer(CustomModelSerializer):
""" """
初始化菜单按钮-序列化器 初始化菜单按钮-序列化器
@@ -67,17 +67,17 @@ class RoleButtonPermissionSerializer(CustomModelSerializer):
return None return None
return obj.data_range return obj.data_range
class Meta: class Meta:
model = MenuButton model = MenuButton
fields = ['id','name','value','isCheck','data_range'] fields = ['id', 'name', 'value', 'isCheck', 'data_range']
class RoleFieldPermissionSerializer(CustomModelSerializer): class RoleFieldPermissionSerializer(CustomModelSerializer):
class Meta: class Meta:
model = FieldPermission model = FieldPermission
fields = "__all__" fields = "__all__"
class RoleMenuFieldSerializer(CustomModelSerializer): class RoleMenuFieldSerializer(CustomModelSerializer):
is_query = serializers.SerializerMethodField() is_query = serializers.SerializerMethodField()
is_create = serializers.SerializerMethodField() is_create = serializers.SerializerMethodField()
@@ -103,19 +103,38 @@ class RoleMenuFieldSerializer(CustomModelSerializer):
if queryset: if queryset:
return queryset.is_update return queryset.is_update
return False return False
class Meta: class Meta:
model = MenuField model = MenuField
fields = ['id','field_name','title','is_query','is_create','is_update'] fields = ['id', 'field_name', 'title', 'is_query', 'is_create', 'is_update']
class RoleMenuSerializer(CustomModelSerializer):
menus = serializers.SerializerMethodField()
def get_menus(self, instance):
menu_list = Menu.objects.filter(parent=instance['id']).values('id', 'name')
serializer = RoleMenuPermissionSerializer(menu_list, many=True, request=self.request)
return serializer.data
class Meta:
model = Menu
fields = ['id', 'name', 'menus']
class RoleMenuPermissionSerializer(CustomModelSerializer): class RoleMenuPermissionSerializer(CustomModelSerializer):
""" """
菜单和按钮权限 菜单和按钮权限
""" """
# name = serializers.SerializerMethodField()
isCheck = serializers.SerializerMethodField() isCheck = serializers.SerializerMethodField()
btns = serializers.SerializerMethodField() btns = serializers.SerializerMethodField()
columns = serializers.SerializerMethodField() columns = serializers.SerializerMethodField()
# def get_name(self, instance):
# parent_list = Menu.get_all_parent(instance['id'])
# names = [d["name"] for d in parent_list]
# return "/".join(names)
def get_isCheck(self, instance): def get_isCheck(self, instance):
params = self.request.query_params params = self.request.query_params
return RoleMenuPermission.objects.filter( return RoleMenuPermission.objects.filter(
@@ -125,19 +144,18 @@ class RoleMenuPermissionSerializer(CustomModelSerializer):
def get_btns(self, instance): def get_btns(self, instance):
btn_list = MenuButton.objects.filter(menu__id=instance['id']).values('id', 'name', 'value') btn_list = MenuButton.objects.filter(menu__id=instance['id']).values('id', 'name', 'value')
serializer = RoleButtonPermissionSerializer(btn_list,many=True,request=self.request) serializer = RoleButtonPermissionSerializer(btn_list, many=True, request=self.request)
return serializer.data return serializer.data
def get_columns(self, instance): def get_columns(self, instance):
col_list = MenuField.objects.filter(menu=instance['id']) col_list = MenuField.objects.filter(menu=instance['id'])
serializer = RoleMenuFieldSerializer(col_list,many=True,request=self.request) serializer = RoleMenuFieldSerializer(col_list, many=True, request=self.request)
return serializer.data return serializer.data
class Meta: class Meta:
model = Menu model = Menu
fields = ['id','name','isCheck','btns','columns'] fields = ['id', 'name', 'isCheck', 'btns', 'columns']
class RoleMenuButtonPermissionViewSet(CustomModelViewSet): class RoleMenuButtonPermissionViewSet(CustomModelViewSet):
""" """
@@ -162,22 +180,54 @@ class RoleMenuButtonPermissionViewSet(CustomModelViewSet):
:return: menu,btns,columns :return: menu,btns,columns
""" """
params = request.query_params params = request.query_params
role = params.get('role',None) role = params.get('role', None)
if role is None: if role is None:
return ErrorResponse(msg="未获取到角色信息") return ErrorResponse(msg="未获取到角色信息")
is_superuser = request.user.is_superuser is_superuser = request.user.is_superuser
if is_superuser: if is_superuser:
queryset = Menu.objects.filter(status=1,is_catalog=False).values('name', 'id').all() queryset = Menu.objects.filter(status=1, is_catalog=True).values('name', 'id').all()
else: else:
role_id = request.user.role.values_list('id', flat=True) role_id = request.user.role.values_list('id', flat=True)
menu_list = RoleMenuPermission.objects.filter(role__in=role_id).values_list('id',flat=True) menu_list = RoleMenuPermission.objects.filter(role__in=role_id).values_list('id', flat=True)
queryset = Menu.objects.filter(status=1, is_catalog=False,id__in=menu_list).values('name', 'id').all() queryset = Menu.objects.filter(status=1, is_catalog=True, id__in=menu_list).values('name', 'id').all()
serializer = RoleMenuPermissionSerializer(queryset,many=True,request=request) serializer = RoleMenuSerializer(queryset, many=True, request=request)
data = serializer.data data = serializer.data
return DetailResponse(data=data) return DetailResponse(data=data)
# data = []
# if is_superuser:
# queryset = Menu.objects.filter(status=1, is_catalog=False).values('name', 'id').all()
# else:
# role_id = request.user.role.values_list('id', flat=True)
# menu_list = RoleMenuPermission.objects.filter(role__in=role_id).values_list('id', flat=True)
# queryset = Menu.objects.filter(status=1, is_catalog=False, id__in=menu_list).values('name', 'id')
# for item in queryset:
# parent_list = Menu.get_all_parent(item['id'])
# names = [d["name"] for d in parent_list]
# completeName = "/".join(names)
# isCheck = RoleMenuPermission.objects.filter(
# menu__id=item['id'],
# role__id=role,
# ).exists()
# mbCheck = RoleMenuButtonPermission.objects.filter(
# menu_button=OuterRef("pk"),
# role__id=role,
# )
# btns = MenuButton.objects.filter(
# menu__id=item['id'],
# ).annotate(isCheck=Exists(mbCheck)).values('id', 'name', 'value', 'isCheck',
# data_range=F('menu_button_permission__data_range'))
# dicts = {
# 'name': completeName,
# 'id': item['id'],
# 'isCheck': isCheck,
# 'btns': btns,
#
# }
# data.append(dicts)
# return DetailResponse(data=data)
@action(methods=['PUT'], detail=True, permission_classes=[IsAuthenticated]) @action(methods=['PUT'], detail=True, permission_classes=[IsAuthenticated])
def set_role_premission(self,request,pk): def set_role_premission(self, request, pk):
""" """
对角色的菜单和按钮及按钮范围授权: 对角色的菜单和按钮及按钮范围授权:
:param request: :param request:
@@ -187,22 +237,30 @@ class RoleMenuButtonPermissionViewSet(CustomModelViewSet):
body = request.data body = request.data
RoleMenuPermission.objects.filter(role=pk).delete() RoleMenuPermission.objects.filter(role=pk).delete()
RoleMenuButtonPermission.objects.filter(role=pk).delete() RoleMenuButtonPermission.objects.filter(role=pk).delete()
for menu in body: for item in body:
if menu.get('isCheck'): for menu in item["menus"]:
menu_parent = Menu.objects.filter(id=menu.get('id')).values('parent').first() if menu.get('isCheck'):
RoleMenuPermission.objects.create(role_id=pk, menu_id=menu_parent.get('parent')) menu_parent = Menu.get_all_parent(menu.get('id'))
RoleMenuPermission.objects.create(role_id=pk, menu_id=menu.get('id')) role_menu_permission_list = []
for btn in menu.get('btns'): for d in menu_parent:
if btn.get('isCheck'): role_menu_permission_list.append(RoleMenuPermission(role_id=pk, menu_id=d["id"]))
data_range = btn.get('data_range',0) or 0 RoleMenuPermission.objects.bulk_create(role_menu_permission_list)
instance = RoleMenuButtonPermission.objects.create(role_id=pk, menu_button_id=btn.get('id'),data_range=data_range) # RoleMenuPermission.objects.create(role_id=pk, menu_id=menu.get('id'))
instance.dept.set(btn.get('dept',[])) for btn in menu.get('btns'):
for col in menu.get('columns'): if btn.get('isCheck'):
FieldPermission.objects.update_or_create(role_id=pk,field_id=col.get('id'),is_query=col.get('is_query'),is_create=col.get('is_create'),is_update=col.get('is_update')) data_range = btn.get('data_range', 0) or 0
instance = RoleMenuButtonPermission.objects.create(role_id=pk, menu_button_id=btn.get('id'),
data_range=data_range)
instance.dept.set(btn.get('dept', []))
for col in menu.get('columns'):
FieldPermission.objects.update_or_create(role_id=pk, field_id=col.get('id'),
defaults={
'is_query': col.get('is_query'),
'is_create': col.get('is_create'),
'is_update': col.get('is_update')
})
return DetailResponse(msg="授权成功") return DetailResponse(msg="授权成功")
@action(methods=['GET'], detail=False, permission_classes=[IsAuthenticated]) @action(methods=['GET'], detail=False, permission_classes=[IsAuthenticated])
def role_menu_get_button(self, request): def role_menu_get_button(self, request):
""" """
@@ -213,8 +271,7 @@ class RoleMenuButtonPermissionViewSet(CustomModelViewSet):
if params := request.query_params: if params := request.query_params:
if menu_id := params.get('menu', None): if menu_id := params.get('menu', None):
is_superuser = request.user.is_superuser is_superuser = request.user.is_superuser
is_admin = request.user.role.values_list('admin', flat=True) if is_superuser:
if is_superuser or True in is_admin:
queryset = MenuButton.objects.filter(menu=menu_id).values('id', 'name') queryset = MenuButton.objects.filter(menu=menu_id).values('id', 'name')
else: else:
role_list = request.user.role.values_list('id', flat=True) role_list = request.user.role.values_list('id', flat=True)
@@ -324,8 +381,7 @@ class RoleMenuButtonPermissionViewSet(CustomModelViewSet):
""" """
params = request.query_params params = request.query_params
is_superuser = request.user.is_superuser is_superuser = request.user.is_superuser
is_admin = request.user.role.values_list('admin', flat=True) if is_superuser:
if is_superuser or True in is_admin:
queryset = Dept.objects.values('id', 'name', 'parent') queryset = Dept.objects.values('id', 'name', 'parent')
else: else:
if not params: if not params:
@@ -353,8 +409,7 @@ class RoleMenuButtonPermissionViewSet(CustomModelViewSet):
if menu_id is None: if menu_id is None:
return ErrorResponse(msg="未获取到参数") return ErrorResponse(msg="未获取到参数")
is_superuser = request.user.is_superuser is_superuser = request.user.is_superuser
is_admin = request.user.role.values_list('admin', flat=True) if is_superuser:
if is_superuser or True in is_admin:
queryset = RoleMenuButtonPermission.objects.filter(menu_button__menu=menu_id).values( queryset = RoleMenuButtonPermission.objects.filter(menu_button__menu=menu_id).values(
'id', 'id',
'data_range', 'data_range',
+21 -15
View File
@@ -115,14 +115,14 @@ class UserUpdateSerializer(CustomModelSerializer):
], ],
) )
# password = serializers.CharField(required=False, allow_blank=True) def validate_is_active(self, value):
# mobile = serializers.CharField( """
# max_length=50, 更改激活状态
# validators=[ """
# CustomUniqueValidator(queryset=Users.objects.all(), message="手机号必须唯一") print(111, value)
# ], if value:
# allow_blank=True self.initial_data["login_error_count"] = 0
# ) return value
def save(self, **kwargs): def save(self, **kwargs):
data = super().save(**kwargs) data = super().save(**kwargs)
@@ -315,33 +315,39 @@ class UserViewSet(CustomModelViewSet):
serializer.save() serializer.save()
return DetailResponse(data=None, msg="修改成功") return DetailResponse(data=None, msg="修改成功")
@action(methods=["PUT"], detail=True, permission_classes=[IsAuthenticated]) @action(methods=["PUT"], detail=False, permission_classes=[IsAuthenticated])
def change_password(self, request, *args, **kwargs): def change_password(self, request, *args, **kwargs):
"""密码修改""" """密码修改"""
data = request.data data = request.data
old_pwd = data.get("oldPassword") old_pwd = data.get("oldPassword")
print(old_pwd)
new_pwd = data.get("newPassword") new_pwd = data.get("newPassword")
new_pwd2 = data.get("newPassword2") new_pwd2 = data.get("newPassword2")
if old_pwd is None or new_pwd is None or new_pwd2 is None: if old_pwd is None or new_pwd is None or new_pwd2 is None:
return ErrorResponse(msg="参数不能为空") return ErrorResponse(msg="参数不能为空")
if new_pwd != new_pwd2: if new_pwd != new_pwd2:
return ErrorResponse(msg="两次密码不匹配") return ErrorResponse(msg="两次密码不匹配")
verify_password = check_password(old_pwd, self.request.user.password) verify_password = check_password(old_pwd, request.user.password)
if not verify_password: if not verify_password:
verify_password = check_password(hashlib.md5(old_pwd.encode(encoding='UTF-8')).hexdigest(), self.request.user.password) old_pwd_md5 = hashlib.md5(old_pwd.encode(encoding='UTF-8')).hexdigest()
verify_password = check_password(str(old_pwd_md5), request.user.password)
if verify_password: if verify_password:
request.user.password = make_password(new_pwd) request.user.password = make_password(hashlib.md5(new_pwd.encode(encoding='UTF-8')).hexdigest())
request.user.save() request.user.save()
return DetailResponse(data=None, msg="修改成功") return DetailResponse(data=None, msg="修改成功")
else: else:
return ErrorResponse(msg="旧密码不正确") return ErrorResponse(msg="旧密码不正确")
@action(methods=["PUT"], detail=True, permission_classes=[IsAuthenticated]) @action(methods=["PUT"], detail=True, permission_classes=[IsAuthenticated])
def reset_to_default_password(self, request, *args, **kwargs): def reset_to_default_password(self, request,pk):
"""恢复默认密码""" """恢复默认密码"""
instance = Users.objects.filter(id=kwargs.get("pk")).first() if not self.request.user.is_superuser:
return ErrorResponse(msg="只允许超级管理员对其进行密码重置")
instance = Users.objects.filter(id=pk).first()
if instance: if instance:
instance.set_password(dispatch.get_system_config_values("base.default_password")) default_password = dispatch.get_system_config_values("base.default_password")
md5_pwd = hashlib.md5(default_password.encode(encoding='UTF-8')).hexdigest()
instance.password = make_password(md5_pwd)
instance.save() instance.save()
return DetailResponse(data=None, msg="密码重置成功") return DetailResponse(data=None, msg="密码重置成功")
else: else:
View File
+133 -37
View File
@@ -12,16 +12,49 @@ from collections import OrderedDict
from functools import reduce from functools import reduce
import six import six
from django.db import models
from django.db.models import Q, F from django.db.models import Q, F
from django.db.models.constants import LOOKUP_SEP from django.db.models.constants import LOOKUP_SEP
from django_filters import utils from django_filters import utils, FilterSet
from django_filters.filters import CharFilter from django_filters.constants import ALL_FIELDS
from django_filters.filters import CharFilter, DateTimeFromToRangeFilter
from django_filters.rest_framework import DjangoFilterBackend from django_filters.rest_framework import DjangoFilterBackend
from django_filters.utils import get_model_field from django_filters.utils import get_model_field
from rest_framework.filters import BaseFilterBackend from rest_framework.filters import BaseFilterBackend
from django_filters.conf import settings
from dvadmin.system.models import Dept, ApiWhiteList, RoleMenuButtonPermission from dvadmin.system.models import Dept, ApiWhiteList, RoleMenuButtonPermission
from dvadmin.utils.models import CoreModel
class CoreModelFilterBankend(BaseFilterBackend):
"""
自定义时间范围过滤器
"""
def filter_queryset(self, request, queryset, view):
create_datetime_after = request.query_params.get('create_datetime_after', None)
create_datetime_before = request.query_params.get('create_datetime_before', None)
update_datetime_after = request.query_params.get('update_datetime_after', None)
update_datetime_before = request.query_params.get('update_datetime_after', None)
if any([create_datetime_after, create_datetime_before, update_datetime_after, update_datetime_before]):
create_filter = Q()
if create_datetime_after and create_datetime_before:
create_filter &= Q(create_datetime__gte=create_datetime_after) & Q(create_datetime__lte=create_datetime_before)
elif create_datetime_after:
create_filter &= Q(create_datetime__gte=create_datetime_after)
elif create_datetime_before:
create_filter &= Q(create_datetime__lte=create_datetime_before)
# 更新时间范围过滤条件
update_filter = Q()
if update_datetime_after and update_datetime_before:
update_filter &= Q(update_datetime__gte=update_datetime_after) & Q(update_datetime__lte=update_datetime_before)
elif update_datetime_after:
update_filter &= Q(update_datetime__gte=update_datetime_after)
elif update_datetime_before:
update_filter &= Q(update_datetime__lte=update_datetime_before)
# 结合两个时间范围过滤条件
queryset = queryset.filter(create_filter & update_filter)
return queryset
return queryset
def get_dept(dept_id: int, dept_all_list=None, dept_list=None): def get_dept(dept_id: int, dept_all_list=None, dept_list=None):
""" """
@@ -150,10 +183,14 @@ class DataLevelPermissionsFilter(BaseFilterBackend):
elif ele == 2: elif ele == 2:
dept_list.append(user_dept_id) dept_list.append(user_dept_id)
elif ele == 4: elif ele == 4:
dept_ids = RoleMenuButtonPermission.objects.filter(
role__in=role_id_list,
role__status=1,
data_range=4).values_list(
'dept__id',flat=True
)
dept_list.extend( dept_list.extend(
request.user.role.filter(status=1).values_list( dept_ids
"dept__id", flat=True
)
) )
if queryset.model._meta.model_name == 'dept': if queryset.model._meta.model_name == 'dept':
return queryset.filter(id__in=list(set(dept_list))) return queryset.filter(id__in=list(set(dept_list)))
@@ -168,6 +205,7 @@ class CustomDjangoFilterBackend(DjangoFilterBackend):
"$": "iregex", "$": "iregex",
"~": "icontains", "~": "icontains",
} }
filter_fields = "__all__"
def construct_search(self, field_name, lookup_expr=None): def construct_search(self, field_name, lookup_expr=None):
lookup = self.lookup_prefixes.get(field_name[0]) lookup = self.lookup_prefixes.get(field_name[0])
@@ -175,14 +213,16 @@ class CustomDjangoFilterBackend(DjangoFilterBackend):
field_name = field_name[1:] field_name = field_name[1:]
else: else:
lookup = lookup_expr lookup = lookup_expr
if field_name.endswith(lookup): if lookup:
return field_name if field_name.endswith(lookup):
return LOOKUP_SEP.join([field_name, lookup]) return field_name
return LOOKUP_SEP.join([field_name, lookup])
return field_name
def find_filter_lookups(self, orm_lookups, search_term_key): def find_filter_lookups(self, orm_lookups, search_term_key):
for lookup in orm_lookups: for lookup in orm_lookups:
# if lookup.find(search_term_key) >= 0: # if lookup.find(search_term_key) >= 0:
new_lookup = lookup.split("__")[0] new_lookup = LOOKUP_SEP.join(lookup.split(LOOKUP_SEP)[:-1]) if len(lookup.split(LOOKUP_SEP)) > 1 else lookup
# 修复条件搜索错误 bug # 修复条件搜索错误 bug
if new_lookup == search_term_key: if new_lookup == search_term_key:
return lookup return lookup
@@ -198,18 +238,22 @@ class CustomDjangoFilterBackend(DjangoFilterBackend):
# TODO: remove assertion in 2.1 # TODO: remove assertion in 2.1
if filterset_class is None and hasattr(view, "filter_class"): if filterset_class is None and hasattr(view, "filter_class"):
utils.deprecate( utils.deprecate(
"`%s.filter_class` attribute should be renamed `filterset_class`." "`%s.filter_class` attribute should be renamed `filterset_class`." % view.__class__.__name__
% view.__class__.__name__
) )
filterset_class = getattr(view, "filter_class", None) filterset_class = getattr(view, "filter_class", None)
# TODO: remove assertion in 2.1 # TODO: remove assertion in 2.1
if filterset_fields is None and hasattr(view, "filter_fields"): if filterset_fields is None and hasattr(view, "filter_fields"):
utils.deprecate( utils.deprecate(
"`%s.filter_fields` attribute should be renamed `filterset_fields`." "`%s.filter_fields` attribute should be renamed `filterset_fields`." % view.__class__.__name__
% view.__class__.__name__
) )
filterset_fields = getattr(view, "filter_fields", None) self.filter_fields = getattr(view, "filter_fields", None)
if isinstance(self.filter_fields, (list, tuple)):
filterset_fields = [
field[1:] if field[0] in self.lookup_prefixes.keys() else field for field in self.filter_fields
]
else:
filterset_fields = self.filter_fields
if filterset_class: if filterset_class:
filterset_model = filterset_class._meta.model filterset_model = filterset_class._meta.model
@@ -229,6 +273,51 @@ class CustomDjangoFilterBackend(DjangoFilterBackend):
MetaBase = getattr(self.filterset_base, "Meta", object) MetaBase = getattr(self.filterset_base, "Meta", object)
class AutoFilterSet(self.filterset_base): class AutoFilterSet(self.filterset_base):
@classmethod
def get_all_model_fields(cls, model):
opts = model._meta
return [
f.name
for f in sorted(opts.fields + opts.many_to_many)
if (f.name == "id")
or not isinstance(f, models.AutoField)
and not (getattr(f.remote_field, "parent_link", False))
]
@classmethod
def get_fields(cls):
"""
Resolve the 'fields' argument that should be used for generating filters on the
filterset. This is 'Meta.fields' sans the fields in 'Meta.exclude'.
"""
model = cls._meta.model
fields = cls._meta.fields
exclude = cls._meta.exclude
assert not (fields is None and exclude is None), (
"Setting 'Meta.model' without either 'Meta.fields' or 'Meta.exclude' "
"has been deprecated since 0.15.0 and is now disallowed. Add an explicit "
"'Meta.fields' or 'Meta.exclude' to the %s class." % cls.__name__
)
# Setting exclude with no fields implies all other fields.
if exclude is not None and fields is None:
fields = ALL_FIELDS
# Resolve ALL_FIELDS into all fields for the filterset's model.
if fields == ALL_FIELDS:
fields = cls.get_all_model_fields(model)
# Remove excluded fields
exclude = exclude or []
if not isinstance(fields, dict):
fields = [(f, [settings.DEFAULT_LOOKUP_EXPR]) for f in fields if f not in exclude]
else:
fields = [(f, lookups) for f, lookups in fields.items() if f not in exclude]
return OrderedDict(fields)
@classmethod @classmethod
def get_filters(cls): def get_filters(cls):
""" """
@@ -257,9 +346,12 @@ class CustomDjangoFilterBackend(DjangoFilterBackend):
if field is None: if field is None:
undefined.append(field_name) undefined.append(field_name)
# 更新默认字符串搜索为模糊搜索 # 更新默认字符串搜索为模糊搜索
if isinstance(field, (models.CharField)) and filterset_fields == '__all__' and lookups == [ if (
'exact']: isinstance(field, (models.CharField))
lookups = ['icontains'] and filterset_fields == "__all__"
and lookups == ["exact"]
):
lookups = ["icontains"]
for lookup_expr in lookups: for lookup_expr in lookups:
filter_name = cls.get_filter_name(field_name, lookup_expr) filter_name = cls.get_filter_name(field_name, lookup_expr)
@@ -269,20 +361,15 @@ class CustomDjangoFilterBackend(DjangoFilterBackend):
continue continue
if field is not None: if field is not None:
filters[filter_name] = cls.filter_for_field( filters[filter_name] = cls.filter_for_field(field, field_name, lookup_expr)
field, field_name, lookup_expr
)
# Allow Meta.fields to contain declared filters *only* when a list/tuple # Allow Meta.fields to contain declared filters *only* when a list/tuple
if isinstance(cls._meta.fields, (list, tuple)): if isinstance(cls._meta.fields, (list, tuple)):
undefined = [ undefined = [f for f in undefined if f not in cls.declared_filters]
f for f in undefined if f not in cls.declared_filters
]
if undefined: if undefined:
raise TypeError( raise TypeError(
"'Meta.fields' must not contain non-model field names: %s" "'Meta.fields' must not contain non-model field names: %s" % ", ".join(undefined)
% ", ".join(undefined)
) )
# Add in declared filters. This is necessary since we don't enforce adding # Add in declared filters. This is necessary since we don't enforce adding
@@ -304,22 +391,31 @@ class CustomDjangoFilterBackend(DjangoFilterBackend):
return queryset return queryset
if filterset.__class__.__name__ == "AutoFilterSet": if filterset.__class__.__name__ == "AutoFilterSet":
queryset = filterset.queryset queryset = filterset.queryset
orm_lookups = [] filter_fields = filterset.filters if self.filter_fields == "__all__" else self.filter_fields
for search_field in filterset.filters: orm_lookup_dict = dict(
if isinstance(filterset.filters[search_field], CharFilter): zip(
orm_lookups.append( [field for field in filter_fields],
self.construct_search(six.text_type(search_field), filterset.filters[search_field].lookup_expr) [filterset.filters[lookup].lookup_expr for lookup in filterset.filters.keys()],
) )
else: )
orm_lookups.append(search_field) orm_lookups = [
self.construct_search(lookup, lookup_expr) for lookup, lookup_expr in orm_lookup_dict.items()
]
# print(orm_lookups)
conditions = [] conditions = []
queries = [] queries = []
for search_term_key in filterset.data.keys(): for search_term_key in filterset.data.keys():
orm_lookup = self.find_filter_lookups(orm_lookups, search_term_key) orm_lookup = self.find_filter_lookups(orm_lookups, search_term_key)
if not orm_lookup: if not orm_lookup or filterset.data.get(search_term_key) == '':
continue continue
query = Q(**{orm_lookup: filterset.data[search_term_key]}) filterset_data_len = len(filterset.data.getlist(search_term_key))
queries.append(query) if filterset_data_len == 1:
query = Q(**{orm_lookup: filterset.data[search_term_key]})
queries.append(query)
elif filterset_data_len == 2:
orm_lookup += '__range'
query = Q(**{orm_lookup: filterset.data.getlist(search_term_key)})
queries.append(query)
if len(queries) > 0: if len(queries) > 0:
conditions.append(reduce(operator.and_, queries)) conditions.append(reduce(operator.and_, queries))
queryset = queryset.filter(reduce(operator.and_, conditions)) queryset = queryset.filter(reduce(operator.and_, conditions))
+57
View File
@@ -2,9 +2,11 @@
日志 django中间件 日志 django中间件
""" """
import json import json
import logging
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import AnonymousUser from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse, HttpResponseServerError
from django.utils.deprecation import MiddlewareMixin from django.utils.deprecation import MiddlewareMixin
from dvadmin.system.models import OperationLog from dvadmin.system.models import OperationLog
@@ -87,3 +89,58 @@ class ApiLoggingMiddleware(MiddlewareMixin):
if self.methods == 'ALL' or request.method in self.methods: if self.methods == 'ALL' or request.method in self.methods:
self.__handle_response(request, response) self.__handle_response(request, response)
return response return response
logger = logging.getLogger("healthz")
class HealthCheckMiddleware(object):
"""
存活检查中间件
"""
def __init__(self, get_response):
self.get_response = get_response
# One-time configuration and initialization.
def __call__(self, request):
if request.method == "GET":
if request.path == "/readiness":
return self.readiness(request)
elif request.path == "/healthz":
return self.healthz(request)
return self.get_response(request)
def healthz(self, request):
"""
Returns that the server is alive.
"""
return HttpResponse("OK")
def readiness(self, request):
# Connect to each database and do a generic standard SQL query
# that doesn't write any data and doesn't depend on any tables
# being present.
try:
from django.db import connections
for name in connections:
cursor = connections[name].cursor()
cursor.execute("SELECT 1;")
row = cursor.fetchone()
if row is None:
return HttpResponseServerError("db: invalid response")
except Exception as e:
logger.exception(e)
return HttpResponseServerError("db: cannot connect to database.")
# Call get_stats() to connect to each memcached instance and get it's stats.
# This can effectively check if each is online.
try:
from django.core.cache import caches
from django.core.cache.backends.memcached import BaseMemcachedCache
for cache in caches.all():
if isinstance(cache, BaseMemcachedCache):
stats = cache._cache.get_stats()
if len(stats) != len(cache._servers):
return HttpResponseServerError("cache: cannot connect to cache.")
except Exception as e:
logger.exception(e)
return HttpResponseServerError("cache: cannot connect to cache.")
return HttpResponse("OK")
+1
View File
@@ -26,6 +26,7 @@ class CustomModelSerializer(DynamicFieldsMixin, ModelSerializer):
# 修改人的审计字段名称, 默认modifier, 继承使用时可自定义覆盖 # 修改人的审计字段名称, 默认modifier, 继承使用时可自定义覆盖
modifier_field_id = "modifier" modifier_field_id = "modifier"
modifier_name = serializers.SerializerMethodField(read_only=True) modifier_name = serializers.SerializerMethodField(read_only=True)
dept_belong_id = serializers.IntegerField(required=False, allow_null=True)
def get_modifier_name(self, instance): def get_modifier_name(self, instance):
if not hasattr(instance, "modifier"): if not hasattr(instance, "modifier"):
+5 -3
View File
@@ -7,16 +7,18 @@
@Remark: 自定义视图集 @Remark: 自定义视图集
""" """
from django.db import transaction from django.db import transaction
from django_filters import DateTimeFromToRangeFilter
from django_filters.rest_framework import FilterSet
from drf_yasg import openapi from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema from drf_yasg.utils import swagger_auto_schema
from rest_framework.decorators import action from rest_framework.decorators import action
from rest_framework.viewsets import ModelViewSet from rest_framework.viewsets import ModelViewSet
from dvadmin.utils.filters import DataLevelPermissionsFilter from dvadmin.utils.filters import DataLevelPermissionsFilter, CoreModelFilterBankend
from dvadmin.utils.import_export_mixin import ExportSerializerMixin, ImportSerializerMixin from dvadmin.utils.import_export_mixin import ExportSerializerMixin, ImportSerializerMixin
from dvadmin.utils.json_response import SuccessResponse, ErrorResponse, DetailResponse from dvadmin.utils.json_response import SuccessResponse, ErrorResponse, DetailResponse
from dvadmin.utils.permission import CustomPermission from dvadmin.utils.permission import CustomPermission
from dvadmin.utils.models import get_custom_app_models from dvadmin.utils.models import get_custom_app_models, CoreModel
from dvadmin.system.models import FieldPermission, MenuField from dvadmin.system.models import FieldPermission, MenuField
from django_restql.mixins import QueryArgumentsMixin from django_restql.mixins import QueryArgumentsMixin
@@ -37,7 +39,7 @@ class CustomModelViewSet(ModelViewSet, ImportSerializerMixin, ExportSerializerMi
update_serializer_class = None update_serializer_class = None
filter_fields = '__all__' filter_fields = '__all__'
search_fields = () search_fields = ()
extra_filter_class = [DataLevelPermissionsFilter] extra_filter_class = [CoreModelFilterBankend,DataLevelPermissionsFilter]
permission_classes = [CustomPermission] permission_classes = [CustomPermission]
import_field_dict = {} import_field_dict = {}
export_field_label = {} export_field_label = {}
View File
+13
View File
@@ -0,0 +1,13 @@
import multiprocessing
import os
import sys
root_path = os.getcwd()
sys.path.append(root_path)
import uvicorn
from application.settings import LOGGING
if __name__ == '__main__':
multiprocessing.freeze_support()
uvicorn.run("application.asgi:application", reload=False, host="0.0.0.0", port=8000, workers=4,
log_config=LOGGING)
+3 -1
View File
@@ -17,7 +17,7 @@ openpyxl==3.1.2
requests==2.31.0 requests==2.31.0
typing-extensions==4.8.0 typing-extensions==4.8.0
tzlocal==5.1 tzlocal==5.1
channels==4.0.0 channels==3.0.5
channels-redis==4.1.0 channels-redis==4.1.0
websockets==11.0.3 websockets==11.0.3
user-agents==2.2.0 user-agents==2.2.0
@@ -28,3 +28,5 @@ uvicorn==0.23.2
gunicorn==21.2.0 gunicorn==21.2.0
gevent==23.9.1 gevent==23.9.1
Pillow==10.1.0 Pillow==10.1.0
dvadmin-celery==1.0.5
pyinstaller==6.8.0
+123
View File
@@ -0,0 +1,123 @@
Bitstream Vera Fonts Copyright
The fonts have a generous copyright, allowing derivative works (as
long as "Bitstream" or "Vera" are not in the names), and full
redistribution (so long as they are not *sold* by themselves). They
can be be bundled, redistributed and sold with any software.
The fonts are distributed under the following copyright:
Copyright
=========
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream
Vera is a trademark of Bitstream, Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute
the Font Software, including without limitation the rights to use,
copy, merge, publish, distribute, and/or sell copies of the Font
Software, and to permit persons to whom the Font Software is furnished
to do so, subject to the following conditions:
The above copyright and trademark notices and this permission notice
shall be included in all copies of one or more of the Font Software
typefaces.
The Font Software may be modified, altered, or added to, and in
particular the designs of glyphs or characters in the Fonts may be
modified and additional glyphs or characters may be added to the
Fonts, only if the fonts are renamed to names not containing either
the words "Bitstream" or the word "Vera".
This License becomes null and void to the extent applicable to Fonts
or Font Software that has been modified and is distributed under the
"Bitstream Vera" names.
The Font Software may be sold as part of a larger software package but
no copy of one or more of the Font Software typefaces may be sold by
itself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT
SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font
Software without prior written authorization from the Gnome Foundation
or Bitstream Inc., respectively. For further information, contact:
fonts at gnome dot org.
Copyright FAQ
=============
1. I don't understand the resale restriction... What gives?
Bitstream is giving away these fonts, but wishes to ensure its
competitors can't just drop the fonts as is into a font sale system
and sell them as is. It seems fair that if Bitstream can't make money
from the Bitstream Vera fonts, their competitors should not be able to
do so either. You can sell the fonts as part of any software package,
however.
2. I want to package these fonts separately for distribution and
sale as part of a larger software package or system. Can I do so?
Yes. A RPM or Debian package is a "larger software package" to begin
with, and you aren't selling them independently by themselves.
See 1. above.
3. Are derivative works allowed?
Yes!
4. Can I change or add to the font(s)?
Yes, but you must change the name(s) of the font(s).
5. Under what terms are derivative works allowed?
You must change the name(s) of the fonts. This is to ensure the
quality of the fonts, both to protect Bitstream and Gnome. We want to
ensure that if an application has opened a font specifically of these
names, it gets what it expects (though of course, using fontconfig,
substitutions could still could have occurred during font
opening). You must include the Bitstream copyright. Additional
copyrights can be added, as per copyright law. Happy Font Hacking!
6. If I have improvements for Bitstream Vera, is it possible they might get
adopted in future versions?
Yes. The contract between the Gnome Foundation and Bitstream has
provisions for working with Bitstream to ensure quality additions to
the Bitstream Vera font family. Please contact us if you have such
additions. Note, that in general, we will want such additions for the
entire family, not just a single font, and that you'll have to keep
both Gnome and Jim Lyles, Vera's designer, happy! To make sense to add
glyphs to the font, they must be stylistically in keeping with Vera's
design. Vera cannot become a "ransom note" font. Jim Lyles will be
providing a document describing the design elements used in Vera, as a
guide and aid for people interested in contributing to Vera.
7. I want to sell a software package that uses these fonts: Can I do so?
Sure. Bundle the fonts with your software and sell your software
with the fonts. That is the intent of the copyright.
8. If applications have built the names "Bitstream Vera" into them,
can I override this somehow to use fonts of my choosing?
This depends on exact details of the software. Most open source
systems and software (e.g., Gnome, KDE, etc.) are now converting to
use fontconfig (see www.fontconfig.org) to handle font configuration,
selection and substitution; it has provisions for overriding font
names and substituting alternatives. An example is provided by the
supplied local.conf file, which chooses the family Bitstream Vera for
"sans", "serif" and "monospace". Other software (e.g., the XFree86
core server) has other mechanisms for font substitution.
+11
View File
@@ -0,0 +1,11 @@
Contained herin is the Bitstream Vera font family.
The Copyright information is found in the COPYRIGHT.TXT file (along
with being incorporated into the fonts themselves).
The releases notes are found in the file "RELEASENOTES.TXT".
We hope you enjoy Vera!
Bitstream, Inc.
The Gnome Project
Binary file not shown.
+34
View File
@@ -0,0 +1,34 @@
html,body{width:100%;overflow-x: hidden;margin: 0;padding: 0;font-size:1rem;font-family: "PingFang SC","SF Pro SC","SF Pro Text","SF Pro Icons","Helvetica Neue","Helvetica","Arial",sans-serif;
-webkit-font-smoothing: antialiased;}
a{text-decoration:none;}
ul,li{list-style:none;padding:0;margin:0;}
.bg{background-repeat:no-repeat;background-position:center center;background-size:100%;}
.center{margin:0 auto;position:relative;}
.abs_center{position:absolute;left: 50%;transform: translateX(-50%);-webkit-transform:translateX(-50%);}
/*滚动条统一样式*/
.scrollbar{overflow-x:hidden;scrollbar-track-color:none;}
.scrollbar::-webkit-scrollbar{width:8px;background-color:transparent;} /*滚动条整体部分*/
.scrollbar::-webkit-scrollbar-track{border-radius:4px;-webkit-box-shadow: inset 0 0 0 rgba(0,0,0,0);background-color:transparent;display:none;} /* 滚动条的轨道*/
.scrollbar::-webkit-scrollbar-track-piece{background-color:transparent;display:none;}/* 滚动条的内层轨道*/
.scrollbar::-webkit-scrollbar-thumb{border-radius:4px;background: #313131;}/*滚动条里面的小方块,能向上向下移动(或往左往右移动,取决于是垂直滚动条还是水平滚动条)*/
h3,h4,h5{ font-weight: bold;}
h3{ font-size: .4rem; color:#000;}
h4{ font-size: .35rem; color: #000; margin:.2rem 0 0 0;}
p{ line-height: .5rem; margin:.2rem 0;word-break: break-all;text-align:justify;}
.app .main{width:90%;overflow:hidden;font-size:.30rem;box-sizing: border-box; margin: 0 auto; color: #484d57;}
.app ul { padding-left: .1rem; font-size: .26rem;}
.app ul p{ line-height: .4rem;}
.app .mainbg{position:absolute;left:50%;transform:translateX(-50%);background-repeat:no-repeat;background-size:100%;}
.app .poster{width:100%;height:31.85rem;background-image:url(../images/poster_bg.jpg);}
.pc .main{font-size:.16rem;}
+18
View File
@@ -0,0 +1,18 @@
Information about external resources
The following files are taken from external resources or trees.
Files: insQ.js
insQ.min.js
License: MIT
Copyright: Zbyszek Tenerowicz
Eryk Napierała <eryk.piast@gmail.com>
Askar Yusupov <devex.soft@gmail.com>
Dan Dascalescu <ddascalescu+github@gmail.com>
Source: https://github.com/naugtur/insertionQuery v1.0.3
Files: immutable.js
immutable.min.js
License: MIT
Copyright: 2014-present, Facebook, Inc
Source: https://github.com/immutable-js/immutable-js/releases/tag/v3.8.2
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
+163
View File
@@ -0,0 +1,163 @@
var insertionQ = (function () {
"use strict";
var sequence = 100,
isAnimationSupported = false,
animation_string = 'animationName',
keyframeprefix = '',
domPrefixes = 'Webkit Moz O ms Khtml'.split(' '),
pfx = '',
elm = document.createElement('div'),
options = {
strictlyNew: true,
timeout: 20
};
if (elm.style.animationName) {
isAnimationSupported = true;
}
if (isAnimationSupported === false) {
for (var i = 0; i < domPrefixes.length; i++) {
if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) {
pfx = domPrefixes[i];
animation_string = pfx + 'AnimationName';
keyframeprefix = '-' + pfx.toLowerCase() + '-';
isAnimationSupported = true;
break;
}
}
}
function listen(selector, callback) {
var styleAnimation, animationName = 'insQ_' + (sequence++);
var eventHandler = function (event) {
if (event.animationName === animationName || event[animation_string] === animationName) {
if (!isTagged(event.target)) {
callback(event.target);
}
}
};
styleAnimation = document.createElement('style');
styleAnimation.innerHTML = '@' + keyframeprefix + 'keyframes ' + animationName + ' { from { outline: 1px solid transparent } to { outline: 0px solid transparent } }' +
"\n" + selector + ' { animation-duration: 0.001s; animation-name: ' + animationName + '; ' +
keyframeprefix + 'animation-duration: 0.001s; ' + keyframeprefix + 'animation-name: ' + animationName + '; ' +
' } ';
document.head.appendChild(styleAnimation);
var bindAnimationLater = setTimeout(function () {
document.addEventListener('animationstart', eventHandler, false);
document.addEventListener('MSAnimationStart', eventHandler, false);
document.addEventListener('webkitAnimationStart', eventHandler, false);
//event support is not consistent with DOM prefixes
}, options.timeout); //starts listening later to skip elements found on startup. this might need tweaking
return {
destroy: function () {
clearTimeout(bindAnimationLater);
if (styleAnimation) {
document.head.removeChild(styleAnimation);
styleAnimation = null;
}
document.removeEventListener('animationstart', eventHandler);
document.removeEventListener('MSAnimationStart', eventHandler);
document.removeEventListener('webkitAnimationStart', eventHandler);
}
};
}
function tag(el) {
el.QinsQ = true; //bug in V8 causes memory leaks when weird characters are used as field names. I don't want to risk leaking DOM trees so the key is not '-+-' anymore
}
function isTagged(el) {
return (options.strictlyNew && (el.QinsQ === true));
}
function topmostUntaggedParent(el) {
if (isTagged(el.parentNode)) {
return el;
} else {
return topmostUntaggedParent(el.parentNode);
}
}
function tagAll(e) {
tag(e);
e = e.firstChild;
for (; e; e = e.nextSibling) {
if (e !== undefined && e.nodeType === 1) {
tagAll(e);
}
}
}
//aggregates multiple insertion events into a common parent
function catchInsertions(selector, callback) {
var insertions = [];
//throttle summary
var sumUp = (function () {
var to;
return function () {
clearTimeout(to);
to = setTimeout(function () {
insertions.forEach(tagAll);
callback(insertions);
insertions = [];
}, 10);
};
})();
return listen(selector, function (el) {
if (isTagged(el)) {
return;
}
tag(el);
var myparent = topmostUntaggedParent(el);
if (insertions.indexOf(myparent) < 0) {
insertions.push(myparent);
}
sumUp();
});
}
//insQ function
var exports = function (selector) {
if (isAnimationSupported && selector.match(/[^{}]/)) {
if (options.strictlyNew) {
tagAll(document.body); //prevents from catching things on show
}
return {
every: function (callback) {
return listen(selector, callback);
},
summary: function (callback) {
return catchInsertions(selector, callback);
}
};
} else {
return false;
}
};
//allows overriding defaults
exports.config = function (opt) {
for (var o in opt) {
if (opt.hasOwnProperty(o)) {
options[o] = opt[o];
}
}
};
return exports;
})();
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = insertionQ;
}
Binary file not shown.
Binary file not shown.
+6
View File
@@ -1,3 +1,9 @@
// redoc-init.js
// https://github.com/axnsan12/drf-yasg
// Copyright 2017 - 2021, Cristian V. <cristi@cvjd.me>
// This file is licensed under the BSD 3-Clause License.
// License text available at https://opensource.org/licenses/BSD-3-Clause
"use strict"; "use strict";
var currentPath = window.location.protocol + "//" + window.location.host + window.location.pathname; var currentPath = window.location.protocol + "//" + window.location.host + window.location.pathname;
Binary file not shown.
+22
View File
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015, Rebilly, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -0,0 +1,23 @@
<html>
<head>
<script type="text/javascript" charset="utf-8">
// Map of projects that support handling 404s.
var supportedProjects = {
'ReDoc': 'https://redocly.github.io/redoc'
};
var project = window.location.pathname.split('/')[1];
// Always fallback to rebilly.com redirect.
var loc = 'https://www.rebilly.com/';
if (supportedProjects.hasOwnProperty(project)) {
if (typeof supportedProjects[project] === 'string') {
loc = supportedProjects[project];
}
}
window.location.href = loc;
</script>
</head>
<body></body>
</html>
+22
View File
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015-present, Rebilly, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Binary file not shown.
@@ -0,0 +1,2 @@
swagger-ui
Copyright 2020-2021 SmartBear Software Inc.
@@ -0,0 +1,16 @@
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
margin: 0;
background: #fafafa;
}
Binary file not shown.
Binary file not shown.
@@ -4,8 +4,6 @@
<title>Swagger UI: OAuth2 Redirect</title> <title>Swagger UI: OAuth2 Redirect</title>
</head> </head>
<body> <body>
</body>
</html>
<script> <script>
'use strict'; 'use strict';
function run () { function run () {
@@ -15,31 +13,32 @@
var isValid, qp, arr; var isValid, qp, arr;
if (/code|token|error/.test(window.location.hash)) { if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1); qp = window.location.hash.substring(1).replace('?', '&');
} else { } else {
qp = location.search.substring(1); qp = location.search.substring(1);
} }
arr = qp.split("&") arr = qp.split("&");
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';}) arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
qp = qp ? JSON.parse('{' + arr.join() + '}', qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) { function (key, value) {
return key === "" ? value : decodeURIComponent(value) return key === "" ? value : decodeURIComponent(value);
} }
) : {} ) : {};
isValid = qp.state === sentState isValid = qp.state === sentState;
if (( if ((
oauth2.auth.schema.get("flow") === "accessCode"|| oauth2.auth.schema.get("flow") === "accessCode" ||
oauth2.auth.schema.get("flow") === "authorizationCode" oauth2.auth.schema.get("flow") === "authorizationCode" ||
oauth2.auth.schema.get("flow") === "authorization_code"
) && !oauth2.auth.code) { ) && !oauth2.auth.code) {
if (!isValid) { if (!isValid) {
oauth2.errCb({ oauth2.errCb({
authId: oauth2.auth.name, authId: oauth2.auth.name,
source: "auth", source: "auth",
level: "warning", level: "warning",
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server" message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
}); });
} }
@@ -48,7 +47,7 @@
oauth2.auth.code = qp.code; oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl}); oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else { } else {
let oauthErrorMsg let oauthErrorMsg;
if (qp.error) { if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " + oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") + (qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
@@ -59,7 +58,7 @@
authId: oauth2.auth.name, authId: oauth2.auth.name,
source: "auth", source: "auth",
level: "error", level: "error",
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server" message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
}); });
} }
} else { } else {
@@ -68,7 +67,13 @@
window.close(); window.close();
} }
window.addEventListener('DOMContentLoaded', function () { if (document.readyState !== 'loading') {
run(); run();
}); } else {
document.addEventListener('DOMContentLoaded', function () {
run();
});
}
</script> </script>
</body>
</html>
@@ -0,0 +1,20 @@
window.onload = function() {
//<editor-fold desc="Changeable Configuration Block">
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
window.ui = SwaggerUIBundle({
url: "https://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});
//</editor-fold>
};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,3 +1,9 @@
// swagger-ui-init.js
// https://github.com/axnsan12/drf-yasg
// Copyright 2017 - 2021, Cristian V. <cristi@cvjd.me>
// This file is licensed under the BSD 3-Clause License.
// License text available at https://opensource.org/licenses/BSD-3-Clause
"use strict"; "use strict";
var currentPath = window.location.protocol + "//" + window.location.host + window.location.pathname; var currentPath = window.location.protocol + "//" + window.location.host + window.location.pathname;
var defaultSpecUrl = currentPath + '?format=openapi'; var defaultSpecUrl = currentPath + '?format=openapi';
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long

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