Commit d109566c authored by wanli's avatar wanli

update

parent 2288b782
...@@ -32,7 +32,7 @@ handle_user_exception = app.handle_user_exception ...@@ -32,7 +32,7 @@ handle_user_exception = app.handle_user_exception
def expired_token_callback(jwt_header, jwt_payload): def expired_token_callback(jwt_header, jwt_payload):
logger.info(jwt_payload) logger.info(jwt_payload)
return jsonify({ return jsonify({
'code': 4011, 'code': 401,
'msg': 'token expired', 'msg': 'token expired',
'data': jwt_header 'data': jwt_header
}) })
...@@ -41,7 +41,7 @@ def expired_token_callback(jwt_header, jwt_payload): ...@@ -41,7 +41,7 @@ def expired_token_callback(jwt_header, jwt_payload):
@jwt.invalid_token_loader @jwt.invalid_token_loader
def invalid_token_callback(error): # we have to keep the argument here, since it's passed in by the caller internally def invalid_token_callback(error): # we have to keep the argument here, since it's passed in by the caller internally
return jsonify({ return jsonify({
'code': 4012, 'code': 401,
'msg': 'invalid token', 'msg': 'invalid token',
'data': error 'data': error
}) })
...@@ -50,7 +50,7 @@ def invalid_token_callback(error): # we have to keep the argument here, since i ...@@ -50,7 +50,7 @@ def invalid_token_callback(error): # we have to keep the argument here, since i
@jwt.unauthorized_loader @jwt.unauthorized_loader
def unauthorized_callback(error): def unauthorized_callback(error):
return jsonify({ return jsonify({
'code': 4013, 'code': 401,
'msg': 'unauthorized', 'msg': 'unauthorized',
'data': error 'data': error
}) })
...@@ -60,13 +60,13 @@ def _custom_abort(http_status_code, **kwargs): ...@@ -60,13 +60,13 @@ def _custom_abort(http_status_code, **kwargs):
自定义abort 400响应数据格式 自定义abort 400响应数据格式
""" """
if http_status_code == 400: if http_status_code == 400:
message = kwargs.get('message') message = kwargs.get('msg')
if isinstance(message, dict): if isinstance(message, dict):
param, info = list(message.items())[0] param, info = list(message.items())[0]
data = '{}:{}!'.format(param, info) data = '{}:{}!'.format(param, info)
return abort(jsonify(response_result(ResponseCode.PARAMETER_ERROR, data=data))) return abort(jsonify(response_result(ResponseCode.HTTP_INVAILD_REQUEST, data=data)))
else: else:
return abort(jsonify(response_result(ResponseCode.PARAMETER_ERROR, data=message))) return abort(jsonify(response_result(ResponseCode.HTTP_INVAILD_REQUEST, data=message)))
# return { 'code': http_status_code, 'msg': kwargs.get('message') } # return { 'code': http_status_code, 'msg': kwargs.get('message') }
return abort(http_status_code) return abort(http_status_code)
......
'''
Author: your name
Date: 2021-06-30 17:43:46
LastEditTime: 2021-07-12 10:45:38
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: \evm-store\tools\build_out\application\config.py
'''
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
import multiprocessing import multiprocessing
MODE = 'develop' # develop: 开发模式; production: 生产模式 MODE = 'develop' # develop: 开发模式; production: 生产模式
UPLOAD_ROOT_DIR = os.path.join(os.path.dirname(__file__), 'assets', 'upload')
EXPORT_ROOT_DIR = os.path.join(os.path.dirname(__file__), 'assets', 'export')
UPLOAD_ALLOWED = set(['doc', 'docs', 'csv', 'xls', 'xlsx'])
class ProductionConfig(object): class ProductionConfig(object):
EPK_DIR = "D:\\projects\\scriptiot\\evm_app_store_files\\epks"
UPLOAD_ROOT_DIR = "D:\\projects\\scriptiot\\evm_app_store_files"
UPLOAD_ALLOWED = set(['doc', 'docs', 'csv', 'xls', 'xlsx'])
BIND = '127.0.0.1:3000' BIND = '127.0.0.1:3000'
WORKERS = multiprocessing.cpu_count() * 2 + 1 WORKERS = multiprocessing.cpu_count() * 2 + 1
WORKER_CONNECTIONS = 10000 WORKER_CONNECTIONS = 10000
...@@ -22,7 +30,7 @@ class ProductionConfig(object): ...@@ -22,7 +30,7 @@ class ProductionConfig(object):
REDIS_PORT = 6379 REDIS_PORT = 6379
REDIS_PASSWORD = '' REDIS_PASSWORD = ''
REDIS_MAX_CONNECTIONS = 100 REDIS_MAX_CONNECTIONS = 100
JWT_HEADER_NAME = 'Auth' JWT_HEADER_NAME = 'Authorization'
JWT_HEADER_TYPE = 'Bearer' JWT_HEADER_TYPE = 'Bearer'
JWT_SECRET_KEY = '6UdxRgs2hvWpTLmj027d5vt7dXXQX' JWT_SECRET_KEY = '6UdxRgs2hvWpTLmj027d5vt7dXXQX'
JWT_ACCESS_TOKEN_EXPIRES = 7200 JWT_ACCESS_TOKEN_EXPIRES = 7200
...@@ -44,6 +52,9 @@ class ProductionConfig(object): ...@@ -44,6 +52,9 @@ class ProductionConfig(object):
class DevelopConfig(object): class DevelopConfig(object):
EPK_DIR = "D:\\projects\\scriptiot\\evm_app_store_files\\epks"
UPLOAD_ROOT_DIR = "D:\\projects\\scriptiot\\evm_app_store_files"
UPLOAD_ALLOWED = set(['doc', 'docs', 'csv', 'xls', 'xlsx'])
BIND = '127.0.0.1:3000' BIND = '127.0.0.1:3000'
WORKERS = 2 WORKERS = 2
WORKER_CONNECTIONS = 1000 WORKER_CONNECTIONS = 1000
...@@ -58,7 +69,7 @@ class DevelopConfig(object): ...@@ -58,7 +69,7 @@ class DevelopConfig(object):
REDIS_PORT = 6379 REDIS_PORT = 6379
REDIS_PASSWORD = '' REDIS_PASSWORD = ''
REDIS_MAX_CONNECTIONS = 100 REDIS_MAX_CONNECTIONS = 100
JWT_HEADER_NAME = 'Auth' JWT_HEADER_NAME = 'Authorization'
JWT_HEADER_TYPE = 'Bearer' JWT_HEADER_TYPE = 'Bearer'
JWT_SECRET_KEY = '6UdxRgs2hvWpTLmj027d5vt7dXXQX' JWT_SECRET_KEY = '6UdxRgs2hvWpTLmj027d5vt7dXXQX'
JWT_ACCESS_TOKEN_EXPIRES = 7200 JWT_ACCESS_TOKEN_EXPIRES = 7200
......
...@@ -24,6 +24,24 @@ class SignalManager(object): ...@@ -24,6 +24,24 @@ class SignalManager(object):
actionPostLogin = PySignal() actionPostLogin = PySignal()
actionGetListLogin = PySignal() actionGetListLogin = PySignal()
actionGetLogin = PySignal() actionGetLogin = PySignal()
actionPostDevice = PySignal()
actionDeleteDevice = PySignal()
actionGetListDevice = PySignal()
actionGetDevice = PySignal()
actionPutDevice = PySignal()
actionDeleteAnnex = PySignal()
actionGetListAnnex = PySignal()
actionGetAnnex = PySignal()
actionGetListMonitorWatch = PySignal()
actionGetMonitorWatch = PySignal()
actionGetListMonitorSystem = PySignal()
actionGetMonitorSystem = PySignal()
actionGetListMonitorLvgl = PySignal()
actionGetMonitorLvgl = PySignal()
actionGetListMonitorImage = PySignal()
actionGetMonitorImage = PySignal()
actionGetListMonitorEvm = PySignal()
actionGetMonitorEvm = PySignal()
# file manager api # file manager api
actionGetFileInit = PySignal() actionGetFileInit = PySignal()
actionGetFileContent = PySignal() actionGetFileContent = PySignal()
......
...@@ -21,3 +21,37 @@ ...@@ -21,3 +21,37 @@
[2021-06-30 18:25:16,742][WARNING][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger is active! [2021-06-30 18:25:16,742][WARNING][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger is active!
[2021-06-30 18:25:16,764][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger PIN: 182-666-074 [2021-06-30 18:25:16,764][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger PIN: 182-666-074
[2021-06-30 18:25:20,154][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit) [2021-06-30 18:25:20,154][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
[2021-07-14 17:51:16,692][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Restarting with stat
[2021-07-14 17:51:17,865][WARNING][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger is active!
[2021-07-14 17:51:17,886][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger PIN: 589-639-847
[2021-07-14 17:51:23,161][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
[2021-07-14 18:00:55,339][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Detected change in 'D:\\projects\\scriptiot\\evm-store\\tools\\build_out\\webcreator\\response.py', reloading
[2021-07-14 18:00:55,461][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Restarting with stat
[2021-07-14 18:00:56,719][WARNING][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger is active!
[2021-07-14 18:00:56,738][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger PIN: 589-639-847
[2021-07-14 18:01:00,332][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
[2021-07-14 18:01:24,867][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Detected change in 'D:\\projects\\scriptiot\\evm-store\\tools\\resources\\webcreator\\response.py', reloading
[2021-07-14 18:01:24,981][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Restarting with stat
[2021-07-14 18:01:26,393][WARNING][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger is active!
[2021-07-14 18:01:26,413][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger PIN: 589-639-847
[2021-07-14 18:01:30,183][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
[2021-07-14 18:02:54,384][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Detected change in 'D:\\projects\\scriptiot\\evm-store\\tools\\build_out\\application\\config.py', reloading
[2021-07-14 18:02:54,483][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Restarting with stat
[2021-07-14 18:02:55,771][WARNING][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger is active!
[2021-07-14 18:02:55,793][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger PIN: 589-639-847
[2021-07-14 18:02:59,702][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
[2021-07-14 18:03:16,082][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Detected change in 'D:\\projects\\scriptiot\\evm-store\\tools\\build_out\\application\\signal_manager.py', reloading
[2021-07-14 18:03:16,184][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Restarting with stat
[2021-07-14 18:03:17,430][WARNING][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger is active!
[2021-07-14 18:03:17,449][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger PIN: 589-639-847
[2021-07-14 18:03:21,152][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
[2021-07-14 18:03:33,842][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Detected change in 'D:\\projects\\scriptiot\\evm-store\\tools\\build_out\\application\\app.py', reloading
[2021-07-14 18:03:33,948][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Restarting with stat
[2021-07-14 18:03:35,301][WARNING][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger is active!
[2021-07-14 18:03:35,321][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger PIN: 589-639-847
[2021-07-14 18:03:39,079][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
[2021-07-14 18:04:42,078][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Detected change in 'D:\\projects\\scriptiot\\evm-store\\tools\\gen_code.py', reloading
[2021-07-14 18:04:42,178][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Restarting with stat
[2021-07-14 18:04:43,390][WARNING][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger is active!
[2021-07-14 18:04:43,411][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Debugger PIN: 589-639-847
[2021-07-14 18:04:47,567][ INFO][in D:\projects\scriptiot\evm-store\tools\venv\lib\site-packages\werkzeug\_internal.py -> _log line:225] * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
# -*- coding: utf_8 -*- # -*- coding: utf_8 -*-
############################ '''
# Response 请求方法:
# 响应 OPTION : 用于获取资源支持的所有 HTTP 方法
############################
HEAD : 用于只获取请求某个资源返回的头信息
GET : 用于从服务器获取资源信息
完成请求后返回状态码 200 OK
POST : 用于创建新资源
创建完成后返回状态码 201 Created
PUT : 用于完整的替换资源或者创建指定身份的资源
如果是创建了资源,则返回 201 Created
如果是替换了资源,则返回 200 OK
DELETE : 用于删除某个资源
完成请求后返回状态码 204 No Content
PATCH : 用于局部更新资源
完成请求后返回状态码 200 OK
================================================================================
状态码:
请求成功
200:请求执行成功并返回相应数据
201:创建成功并返回相应资源数据
202:接受请求,但无法立即完成创建行为
204:请求执行成功,不返回相应资源数据
重定向
301:被请求的资源已永久移动到新位置
302:请求的资源现在临时从不通的URI响应请求
303:对应当前请求的响应可以在另一个 URI 上被找到,客户端应该使用 GET 方法进行请求
307:对应当前请求的响应可以在另一个 URI 上被找到,客户端应该保持原有的请求方法进行请求
条件请求
304:资源自从上次请求后没有再次发生变化,主要使用场景在于实现数据缓存
409:请求操作和资源的当前状态存在冲突。主要使用场景在于实现并发控制
412:服务器在验证请求的头字段中给出先决条件时,没能满足其中的一个或多个。主要使用场景在于实现并发控制
客户端错误
400 : 请求体包含语法错误
401 : 需要验证用户身份
403 : 服务器拒绝执行
404 : 找不到目标资源
405 : 不允许执行目标方法,响应中应该带有 Allow 头,内容为对该资源有效的 HTTP 方法
406 : 服务器不支持客户端请求的内容格式
410 : 被请求的资源已被删除
413 : POST 或者 PUT 请求的消息实体过大
415 : 服务器不支持请求中提交的数据的格式
422 : 请求格式正确,但是由于含有语义错误,无法响应
428 : 要求先决条件,如果想要请求能成功必须满足一些预设的条件要求先决条件
服务端错误
500 : 服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理
502 : 作为网关或者代理工作的服务器尝试执行请求时,从上游服务器接收到无效的响应
501 : 服务器不支持当前请求所需要的某个功能
503 : 由于临时的服务器维护或者过载,服务器当前无法处理请求
'''
class ResponseCode(object): class ResponseCode(object):
OK = (200, 'ok') # 通用状态码
NO_DATA = (204, 'no data') HTTP_SUCCESS = (200, "success")
NOT_FOUND = (404, 'not found') HTTP_NO_DATA = (204, "no data")
NOTHING_CHANGE = (304, 'nothing change') HTTP_NO_CHANGE = (304, 'nothing change')
REQUEST_ERROR = (400, 'request error') HTTP_AUTH_FAIL = (401, 'authentication failed')
AUTHORIZATION_ERROR = (401, 'authentication error') HTTP_INVAILD_REQUEST = (403, 'invaild request')
INVAILD_REQUEST = (403, 'invaild request') HTTP_NOT_FOUND = (404, "not found")
PARAMETER_ERROR = (4001, 'parameter error') HTTP_SERVER_ERROR = (500, "server error")
PARAMETER_NULL = (4002, 'parameter is null')
PASSWORD_ERROR = (4003, 'password error')
EXISTS_ERROR = (4004, 'record exists') # 用户模块
INVAILD_ROLE_ERROR = (4005, 'invaild role error') USER_NOT_EXISTS = (1010001, 'user not exists')
ACCOUNT_DISABLED = (4006, 'account is disabled') USER_EXISTS = (1010002, 'user already exists')
SERVER_ERROR = (500, 'server error') USER_PASSWORD_ERROR = (1010003, 'password error')
DB_ERROR = (5001, 'database error')
UNKNOWN_ERROR = (5003, 'unknown error')
def response_result(response, msg=None, data=None, **kwargs):
def response_result(code, msg=None, data=None, **kwargs): c, m = response
if msg is None: if msg == None:
msg = code[1] msg = m
result = { 'code': code[0], 'msg': msg, 'data': data }
result = { 'code': c, 'msg': msg, 'data': data }
result.update(kwargs) result.update(kwargs)
return result return result
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"codemirror": "^5.59.2", "codemirror": "^5.59.2",
"core-js": "^3.9.0", "core-js": "^3.9.0",
"cropperjs": "^1.5.11", "cropperjs": "^1.5.11",
"eslint": "^7.30.0",
"npm-check-updates": "^11.7.1", "npm-check-updates": "^11.7.1",
"numeral": "^2.0.6", "numeral": "^2.0.6",
"plyr": "^3.6.4", "plyr": "^3.6.4",
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
"@vue/cli-plugin-eslint": "^3.0.3", "@vue/cli-plugin-eslint": "^3.0.3",
"@vue/cli-service": "^3.0.3", "@vue/cli-service": "^3.0.3",
"babel-plugin-import": "^1.9.1", "babel-plugin-import": "^1.9.1",
"eslint-plugin-vue": "^7.13.0",
"less": "^3.8.1", "less": "^3.8.1",
"less-loader": "^4.1.0", "less-loader": "^4.1.0",
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</template> </template>
<script> <script>
import { LocaleProvider, ConfigProvider } from "ant-design-vue"; import { LocaleProvider, ConfigProvider, Input } from "ant-design-vue";
export default { export default {
components: { components: {
LocaleProvider, LocaleProvider,
......
...@@ -39,6 +39,7 @@ export default { ...@@ -39,6 +39,7 @@ export default {
'menu.account.trigger': 'Trigger Error', 'menu.account.trigger': 'Trigger Error',
//--- //---
'menu.system': '系统管理', 'menu.system': '系统管理',
'menu.system.index': '系统管理',
'menu.system.setting': '系统设置', 'menu.system.setting': '系统设置',
'menu.system.setting.menu': '菜单管理', 'menu.system.setting.menu': '菜单管理',
'menu.system.setting.module': '模块管理', 'menu.system.setting.module': '模块管理',
...@@ -47,6 +48,9 @@ export default { ...@@ -47,6 +48,9 @@ export default {
'menu.system.setting.area': '行政区划', 'menu.system.setting.area': '行政区划',
'menu.system.role': '权限管理', 'menu.system.role': '权限管理',
'menu.system.admin': '系统管理员', 'menu.system.admin': '系统管理员',
'menu.application': '应用管理',
'menu.application.index': '应用列表',
'menu.application.manager': '应用打包',
//--- //---
'app.home.introduce': 'introduce', 'app.home.introduce': 'introduce',
'app.analysis.test': 'Gongzhuan No.{no} shop', 'app.analysis.test': 'Gongzhuan No.{no} shop',
......
...@@ -40,6 +40,7 @@ export default { ...@@ -40,6 +40,7 @@ export default {
'menu.account.trigger': '触发报错', 'menu.account.trigger': '触发报错',
//--- //---
'menu.system': '系统管理', 'menu.system': '系统管理',
'menu.system.index': '系统管理',
'menu.system.setting': '系统设置', 'menu.system.setting': '系统设置',
'menu.system.setting.menu': '菜单管理', 'menu.system.setting.menu': '菜单管理',
'menu.system.setting.module': '模块管理', 'menu.system.setting.module': '模块管理',
...@@ -49,6 +50,9 @@ export default { ...@@ -49,6 +50,9 @@ export default {
'menu.system.setting.file-manager': '文件管理', 'menu.system.setting.file-manager': '文件管理',
'menu.system.role': '权限管理', 'menu.system.role': '权限管理',
'menu.system.admin': '系统管理员', 'menu.system.admin': '系统管理员',
'menu.application': '应用管理',
'menu.application.index': '应用列表',
'menu.application.manager': '应用打包',
//--- //---
'app.home.introduce': '介绍', 'app.home.introduce': '介绍',
'app.analysis.test': '工专路 {no} 号店', 'app.analysis.test': '工专路 {no} 号店',
......
...@@ -37,61 +37,61 @@ const router = new Router({ ...@@ -37,61 +37,61 @@ const router = new Router({
{ path: '/dashboard/workplace', name: 'workplace', component: () => import('@/views/Dashboard/Workplace') }, { path: '/dashboard/workplace', name: 'workplace', component: () => import('@/views/Dashboard/Workplace') },
] ]
}, },
// { {
// path: '/form', path: '/form',
// name: 'form', name: 'form',
// icon: 'form', icon: 'form',
// component: BlankLayout, component: BlankLayout,
// children: [ children: [
// { path: '/form/basic-form', name: 'basicform', component: () => import('@/views/Dashboard/Analysis') }, { path: '/form/basic-form', name: 'basicform', component: () => import('@/views/Dashboard/Analysis') },
// { {
// path: '/form/step-form', path: '/form/step-form',
// name: 'stepform', name: 'stepform',
// component: BlankLayout, component: BlankLayout,
// hideChildrenInMenu: true, hideChildrenInMenu: true,
// children: [ children: [
// { {
// path: '/form/step-form/info', path: '/form/step-form/info',
// name: 'info', name: 'info',
// component: () => import('@/views/Dashboard/Analysis'), component: () => import('@/views/Dashboard/Analysis'),
// }, },
// ] ]
// }, },
// { path: '/form/advanced-form', name: 'advancedform', component: () => import('@/views/Dashboard/Analysis') }, { path: '/form/advanced-form', name: 'advancedform', component: () => import('@/views/Dashboard/Analysis') },
// ] ]
// }, },
// { {
// path: '/list', path: '/list',
// icon: 'table', icon: 'table',
// name: 'list', name: 'list',
// component: BlankLayout, component: BlankLayout,
// children: [ children: [
// { {
// path: '/list/search', path: '/list/search',
// name: 'searchlist', name: 'searchlist',
// component: BlankLayout, component: BlankLayout,
// children: [ children: [
// { {
// path: '/list/search/articles', path: '/list/search/articles',
// name: 'articles', name: 'articles',
// }, },
// { {
// path: '/list/search/projects', path: '/list/search/projects',
// name: 'projects', name: 'projects',
// }, },
// { {
// path: '/list/search/applications', path: '/list/search/applications',
// name: 'applications', name: 'applications',
// }, },
// ] ]
// } }
// ] ]
// }, },
// { {
// path: '/profile', path: '/profile',
// icon: 'profile', icon: 'profile',
// name: 'profile', name: 'profile',
// }, },
{ {
path: '/system', path: '/system',
name: 'system', name: 'system',
...@@ -148,7 +148,19 @@ const router = new Router({ ...@@ -148,7 +148,19 @@ const router = new Router({
}, },
] ]
}, },
{
path: '/application',
icon: 'table',
name: 'application',
// redirect: '/application/index',
component: BasicLayout,
children: [
{ path: '/application', redirect: '/application/index' },
{ path: '/application/index', component: () => import('@/views/Application/Index') },
{ path: '/application/manager', component: () => import('@/views/Application/Manager') },
{ path: '/application/form', component: () => import('@/views/Application/Form') },
],
}
] ]
}) })
......
import { menuNav } from '@/api/menu' import { menuNav } from "@/api/menu";
//从服务端获取 //从服务端获取
const mock = [ const mock = [
{ {
"id": "1044886626813353984", id: "1044886626813353984",
"parentId": "0", parentId: "0",
"name": "dashboard", name: "dashboard",
"path": '/dashboard', path: "/dashboard",
"icon": 'dashboard', icon: "dashboard",
"leaf": false, leaf: false,
"children": [{ children: [
"id": "1044886629921333248", {
"parentId": "1044886626813353984", id: "1044886629921333248",
"name": "analysis", parentId: "1044886626813353984",
"path": '/dashboard/analysis', name: "analysis",
"leaf": true, path: "/dashboard/analysis",
"children": [] leaf: true,
},{ children: [],
"id": "1044886629921333248", },
"parentId": "1044886626813353984", {
"name": "workplace", id: "1044886629921333248",
"path": '/dashboard/workplace', parentId: "1044886626813353984",
"leaf": true, name: "workplace",
"children": [] path: "/dashboard/workplace",
}] leaf: true,
}, children: [],
{ },
"id": "1044886626813353984", ],
"parentId": "0", },
"name": "system", {
"path": '/system', id: "1044886626813353984",
"icon": 'setting', parentId: "0",
"leaf": false, name: "system",
"children": [{ path: "/system",
"id": "1044886629921333248", icon: "setting",
"parentId": "1044886626813353984", leaf: false,
"name": "setting", children: [
"path": "/system/setting", {
"leaf": false, id: "1044886629921333248",
"children": [{ parentId: "1044886626813353984",
"id": "1044886630026190848", name: "setting",
"parentId": "1044886629921333248", path: "/system/setting",
"name": "menu", leaf: false,
"path": "/system/setting/menu", children: [
"leaf": true, {
"children": [] id: "1044886630026190848",
}, { parentId: "1044886629921333248",
"id": "1044886630122659840", name: "menu",
"parentId": "1044886629921333248", path: "/system/setting/menu",
"name": "module", leaf: true,
"path": "/system/setting/module", children: [],
"leaf": true, },
"children": [] {
}, { id: "1044886630122659840",
"id": "1044886630122659841", parentId: "1044886629921333248",
"parentId": "1044886629921333248", name: "module",
"name": "file-manager", path: "/system/setting/module",
"path": "/system/setting/file-manager", leaf: true,
"leaf": true, children: [],
"children": [] },
}] {
},{ id: "1044886630122659841",
"id": "1044886629921333248", parentId: "1044886629921333248",
"parentId": "1044886626813353984", name: "file-manager",
"name": "role", path: "/system/setting/file-manager",
"path": "/system/role", leaf: true,
"leaf": true, children: [],
},{ },
"id": "1044886629921333248", ],
"parentId": "1044886626813353984", },
"name": "admin", {
"path": "/system/admin", id: "1044886629921333248",
"leaf": true, parentId: "1044886626813353984",
}] name: "role",
}] path: "/system/role",
leaf: true,
},
{
id: "1044886629921333248",
parentId: "1044886626813353984",
name: "admin",
path: "/system/admin",
leaf: true,
},
],
},
{
id: "1044886626813353984",
icon: 'table',
parentId: "0",
name: "application",
path: "/application",
leaf: false,
children: [
{
id: "1044886629921333248",
parentId: "1044886626813353984",
name: "index",
path: "/application/index",
leaf: true,
children: [],
},
{
id: "1044886629921333248",
parentId: "1044886626813353984",
name: "manager",
path: "/application/manager",
leaf: true,
children: [],
},
],
},
];
const state = { const state = {
loading: false, loading: false,
menuNav: { menuNav: {
data: [] data: [],
} },
} };
const actions = { const actions = {
['getMenuNav']({ commit, state }, config) { ["getMenuNav"]({ commit, state }, config) {
state.loading = true state.loading = true;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
menuNav().then(response => { menuNav()
// console.log(mock); .then((response) => {
commit('setMenuNav', mock) // console.log(mock);
state.loading = false commit("setMenuNav", mock);
resolve() state.loading = false;
}).catch(error => { resolve();
state.loading = false
reject(error)
})
}) })
}, .catch((error) => {
} state.loading = false;
reject(error);
});
});
},
};
const mutations = { const mutations = {
['setMenuNav'](state, payload) { ["setMenuNav"](state, payload) {
state.menuNav = { state.menuNav = {
data: payload data: payload,
} };
} },
} };
const getters = { const getters = {
['getMenuNav'](state) { ["getMenuNav"](state) {
return state.menuNav; return state.menuNav;
}, },
['loading'](state) { ["loading"](state) {
return state.loading; return state.loading;
}, },
} };
export default { export default {
namespaced: true, namespaced: true,
state, state,
actions, actions,
mutations, mutations,
getters getters,
} };
\ No newline at end of file
<template>
<a-card :body-style="{padding: '24px 32px'}" :bordered="false">
<a-form>
<a-form-item
label="标题"
:labelCol="{span: 7}"
:wrapperCol="{span: 10}"
>
<a-input placeholder="给目标起个名字" />
</a-form-item>
<a-form-item
label="起止日期"
:labelCol="{span: 7}"
:wrapperCol="{span: 10}"
>
<a-range-picker style="width: 100%" />
</a-form-item>
<a-form-item
label="目标描述"
:labelCol="{span: 7}"
:wrapperCol="{span: 10}"
>
<a-textarea rows="4" placeholder="请输入你阶段性工作目标"/>
</a-form-item>
<a-form-item
label="衡量标准"
:labelCol="{span: 7}"
:wrapperCol="{span: 10}"
>
<a-textarea rows="4" placeholder="请输入衡量标准"/>
</a-form-item>
<a-form-item
label="客户"
:labelCol="{span: 7}"
:wrapperCol="{span: 10}"
:required="false"
>
<a-input placeholder="请描述你服务的客户,内部客户直接 @姓名/工号"/>
</a-form-item>
<a-form-item
label="邀评人"
:labelCol="{span: 7}"
:wrapperCol="{span: 10}"
:required="false"
>
<a-input placeholder="请直接 @姓名/工号,最多可邀请 5 人"/>
</a-form-item>
<a-form-item
label="权重"
:labelCol="{span: 7}"
:wrapperCol="{span: 10}"
:required="false"
>
<a-input-number :min="0" :max="100"/>
<span>%</span>
</a-form-item>
<a-form-item
label="目标公开"
:labelCol="{span: 7}"
:wrapperCol="{span: 10}"
:required="false"
help="客户、邀评人默认被分享"
>
<a-radio-group v-model="value">
<a-radio :value="1">公开</a-radio>
<a-radio :value="2">部分公开</a-radio>
<a-radio :value="3">不公开</a-radio>
</a-radio-group>
<a-select mode="multiple" v-if="value === 2">
<a-select-option value="4">同事甲</a-select-option>
<a-select-option value="5">同事乙</a-select-option>
<a-select-option value="6">同事丙</a-select-option>
</a-select>
</a-form-item>
<a-form-item style="margin-top: 24px" :wrapperCol="{span: 10, offset: 7}">
<a-button type="primary">提交</a-button>
<a-button style="margin-left: 8px">保存</a-button>
</a-form-item>
</a-form>
</a-card>
</template>
<script>
import {
Avatar,
Row,
Col,
Card,
List,
Button,
Form,
Icon,
Table,
Divider,
Dropdown,
Input,
Select,
Radio,
DatePicker,
InputNumber
} from "ant-design-vue";
import PageHeaderWrapper from "@/components/PageHeaderWrapper";
import DescriptionItem from "@/components/DescriptionItem";
export default {
name: 'BasicForm',
i18n: require('./i18n'),
data () {
return {
value: 1
}
},
components: {
Icon,
ATextarea: Input.TextArea,
ARadio: Radio,
ARadioGroup: Radio.Group,
AInputNumber: InputNumber,
AAvatar: Avatar,
ARow: Row,
ACol: Col,
ACard: Card,
ACardGrid: Card.Grid,
ACardMeta: Card.Meta,
AList: List,
AButton: Button,
AForm: Form,
AFormItem: Form.Item,
AIcon: Icon,
ATable: Table,
ADivider: Divider,
ADropdown: Dropdown,
AInput: Input,
ASelect: Select,
AOption: Select.Option,
ADescriptionItem: DescriptionItem,
APageHeaderWrapper: PageHeaderWrapper,
ARangePicker: DatePicker.RangePicker,
},
computed: {
desc() {
return this.$t('pageDesc')
}
},
}
</script>
<style scoped>
</style>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
module.exports = {
messages: {
CN: {
pageDesc:
"表单页用于向用户收集或验证信息,基础表单常见于数据项较少的表单场景。",
title: "标题",
titleInput: "给目标起个名字",
date: "起止日期",
describe: "目标描述",
describeInput: "请输入你阶段性工作目标",
metrics: "衡量标准",
metricsInput: "请输入衡量标准",
customer: "客户",
customerInput: "请描述你服务的客户,内部客户直接 @姓名/工号",
critics: "邀评人",
criticsInput: "请直接 @姓名/工号,最多可邀请 5 人",
weight: "权重",
disclosure: "目标公开",
disclosureDesc: "客户、邀评人默认被分享",
public: "公开",
partially: "部分公开",
private: "不公开",
submit: "提交",
save: "保存",
colleague1: "同事甲",
colleague2: "同事乙",
colleague3: "同事丙",
},
HK: {
pageDesc:
"表單頁用於向用戶收集或驗證信息,基礎表單常見於數據項較少的表單場景。",
title: "標題",
titleInput: "給目標起個名字",
date: "起止日期",
describe: "目標描述",
describeInput: "請輸入你階段性的工作目標",
metrics: "衡量標準",
metricsInput: "請輸入衡量標準",
customer: "客戶",
customerInput: "請描述你服務的客戶,內部客戶直接 @姓名/工號",
critics: "邀評人",
criticsInput: "請直接 @姓名/工號,最多可邀請 5 人",
weight: "圈中人",
disclosure: "目標公開",
disclosureDesc: "客戶、邀評人默認被分享",
public: "公開",
partially: "部分公開",
private: "不公開",
submit: "提交",
save: "保存",
colleague1: "同事甲",
colleague2: "同事乙",
colleague3: "同事丙",
},
US: {
pageDesc:
"Form pages are used to collect or verify information to users, and basic forms are common in scenarios where there are fewer data items.",
title: "Title",
titleInput: "Give the target a name",
date: "Start and end date",
describe: "Goal description",
describeInput: "Please enter your work goals",
metrics: "Metrics",
metricsInput: "Please enter a metric",
customer: "Customer",
customerInput:
"Please describe your customer service, internal customers directly @ Name / job number",
critics: "Inviting critics",
criticsInput:
"Please direct @ Name / job number, you can invite up to 5 people",
weight: "Weight",
disclosure: "Target disclosure",
disclosureDesc: "Customers and invitees are shared by default",
public: "Public",
partially: "Partially public",
private: "Private",
submit: "Submit",
save: "Save",
colleague1: "Colleague A",
colleague2: "Colleague B",
colleague3: "Colleague C",
},
},
};
This diff is collapsed.
from fs.copy import copy_fs
from jinja2 import Environment, FileSystemLoader
from pprint import pprint from pprint import pprint
from pathlib import Path from pathlib import Path
from difflib import Differ, HtmlDiff from difflib import Differ
import fs import fs
import json import json
import os import os
...@@ -10,6 +8,7 @@ import re ...@@ -10,6 +8,7 @@ import re
import hashlib import hashlib
import time import time
import shutil import shutil
from jinja2 import Environment, FileSystemLoader
from resources.webcreator import log from resources.webcreator import log
''' '''
...@@ -75,7 +74,37 @@ output_dir = None ...@@ -75,7 +74,37 @@ output_dir = None
events = [] events = []
def copyFiles(src_dir, dst_dir): def copyFiles(src_dir, dst_dir):
copy_fs(src_dir, dst_dir) if not os.path.exists(src_dir):
log.logger.error("%s 目录不存在" % src_dir)
return None
# 复制文件之前需要判断文件是否存在
if not os.path.exists(dst_dir):
os.makedirs(dst_dir)
# root 所指的是当前正在遍历的这个文件夹的本身的地址
# dirs 是一个 list,内容是该文件夹中所有的目录的名字(不包括子目录)
# files 同样是 list, 内容是该文件夹中所有的文件(不包括子目录)
for root, dirs, files in os.walk(src_dir):
save_path = dst_dir
if os.path.basename(root) == "__pycache__":
continue
for file in files:
if file == '__init__.py':
continue
src_file = os.path.join(root, file)
relative_path = os.path.relpath(src_file, src_dir)
if relative_path != file:
save_path = os.path.normpath(os.sep.join([dst_dir, relative_path]))
if not os.path.exists(save_path):
os.makedirs(save_path)
shutil.copy(src_file, save_path)
log.logger.info('copy files finished!')
def handleModuleConfig(config): def handleModuleConfig(config):
# 处理每一项配置文件 # 处理每一项配置文件
...@@ -111,11 +140,13 @@ def handleResources(config): ...@@ -111,11 +140,13 @@ def handleResources(config):
def handleSignal(config): def handleSignal(config):
# 生成信号槽模块 # 生成信号槽模块
target_file = os.sep.join(["application", "signal_manager.py"]) if config.get("framework").get("signal").get("regenerate"):
handleRender(config, 'signal_manager.tpl', target_file) target_file = os.sep.join(["application", "signal_manager.py"])
handleRender(config.get("apis"), 'signal_manager.tpl', target_file)
target_file = os.sep.join(["controllers", "__init__.py"]) if config.get("framework").get("controllerInit").get("regenerate"):
handleRender(config, 'signal_manager_init.tpl', target_file) target_file = os.sep.join(["controllers", "__init__.py"])
handleRender(config.get("apis"), 'signal_manager_init.tpl', target_file)
def handleModel(config, application): def handleModel(config, application):
# 判断是否有model字段,没有直接退出 # 判断是否有model字段,没有直接退出
...@@ -183,11 +214,14 @@ def handleRender(result, tpl, target_file, **kwargs): ...@@ -183,11 +214,14 @@ def handleRender(result, tpl, target_file, **kwargs):
def parseConfig(config): def parseConfig(config):
# 解析配置文件 # 解析配置文件
for cfg in config.get("apis"): for cfg in config.get("apis"):
if not cfg.get("enable"):
continue
handleModel(cfg, config.get("application")) handleModel(cfg, config.get("application"))
handleView(cfg) handleView(cfg)
handleController(cfg) handleController(cfg)
# 全局配置
handleResources(config.get("apis")) handleResources(config.get("apis"))
handleSignal(config.get("apis")) handleSignal(config)
handleModules(config.get("modules")) handleModules(config.get("modules"))
def readConfig(): def readConfig():
...@@ -232,6 +266,7 @@ def run(): ...@@ -232,6 +266,7 @@ def run():
input_dir = os.sep.join([os.getcwd(), "resources"]) input_dir = os.sep.join([os.getcwd(), "resources"])
output_dir = os.sep.join([os.getcwd(), "build_out"]) output_dir = os.sep.join([os.getcwd(), "build_out"])
backup_database() backup_database()
# 复制文件到输出目录
copyFiles(input_dir, output_dir) copyFiles(input_dir, output_dir)
config = readConfig() config = readConfig()
parseConfig(config) parseConfig(config)
......
# -*- coding: utf_8 -*- # -*- coding: utf_8 -*-
############################ '''
# Response 请求方法:
# 响应 OPTION : 用于获取资源支持的所有 HTTP 方法
############################
HEAD : 用于只获取请求某个资源返回的头信息
GET : 用于从服务器获取资源信息
完成请求后返回状态码 200 OK
POST : 用于创建新资源
创建完成后返回状态码 201 Created
PUT : 用于完整的替换资源或者创建指定身份的资源
如果是创建了资源,则返回 201 Created
如果是替换了资源,则返回 200 OK
DELETE : 用于删除某个资源
完成请求后返回状态码 204 No Content
PATCH : 用于局部更新资源
完成请求后返回状态码 200 OK
================================================================================
状态码:
请求成功
200:请求执行成功并返回相应数据
201:创建成功并返回相应资源数据
202:接受请求,但无法立即完成创建行为
204:请求执行成功,不返回相应资源数据
重定向
301:被请求的资源已永久移动到新位置
302:请求的资源现在临时从不通的URI响应请求
303:对应当前请求的响应可以在另一个 URI 上被找到,客户端应该使用 GET 方法进行请求
307:对应当前请求的响应可以在另一个 URI 上被找到,客户端应该保持原有的请求方法进行请求
条件请求
304:资源自从上次请求后没有再次发生变化,主要使用场景在于实现数据缓存
409:请求操作和资源的当前状态存在冲突。主要使用场景在于实现并发控制
412:服务器在验证请求的头字段中给出先决条件时,没能满足其中的一个或多个。主要使用场景在于实现并发控制
客户端错误
400 : 请求体包含语法错误
401 : 需要验证用户身份
403 : 服务器拒绝执行
404 : 找不到目标资源
405 : 不允许执行目标方法,响应中应该带有 Allow 头,内容为对该资源有效的 HTTP 方法
406 : 服务器不支持客户端请求的内容格式
410 : 被请求的资源已被删除
413 : POST 或者 PUT 请求的消息实体过大
415 : 服务器不支持请求中提交的数据的格式
422 : 请求格式正确,但是由于含有语义错误,无法响应
428 : 要求先决条件,如果想要请求能成功必须满足一些预设的条件要求先决条件
服务端错误
500 : 服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理
502 : 作为网关或者代理工作的服务器尝试执行请求时,从上游服务器接收到无效的响应
501 : 服务器不支持当前请求所需要的某个功能
503 : 由于临时的服务器维护或者过载,服务器当前无法处理请求
'''
class ResponseCode(object): class ResponseCode(object):
OK = (200, 'ok') # 通用状态码
NO_DATA = (204, 'no data') HTTP_SUCCESS = (200, "success")
NOT_FOUND = (404, 'not found') HTTP_NO_DATA = (204, "no data")
NOTHING_CHANGE = (304, 'nothing change') HTTP_NO_CHANGE = (304, 'nothing change')
REQUEST_ERROR = (400, 'request error') HTTP_AUTH_FAIL = (401, 'authentication failed')
AUTHORIZATION_ERROR = (401, 'authentication error') HTTP_INVAILD_REQUEST = (403, 'invaild request')
INVAILD_REQUEST = (403, 'invaild request') HTTP_NOT_FOUND = (404, "not found")
PARAMETER_ERROR = (4001, 'parameter error') HTTP_SERVER_ERROR = (500, "server error")
PARAMETER_NULL = (4002, 'parameter is null')
PASSWORD_ERROR = (4003, 'password error')
EXISTS_ERROR = (4004, 'record exists') # 用户模块
INVAILD_ROLE_ERROR = (4005, 'invaild role error') USER_NOT_EXISTS = (1010001, 'user not exists')
ACCOUNT_DISABLED = (4006, 'account is disabled') USER_EXISTS = (1010002, 'user already exists')
SERVER_ERROR = (500, 'server error') USER_PASSWORD_ERROR = (1010003, 'password error')
DB_ERROR = (5001, 'database error')
UNKNOWN_ERROR = (5003, 'unknown error')
def response_result(response, msg=None, data=None, **kwargs):
def response_result(code, msg=None, data=None, **kwargs): c, m = response
if msg is None: if msg == None:
msg = code[1] msg = m
result = { 'code': code[0], 'msg': msg, 'data': data }
result = { 'code': c, 'msg': msg, 'data': data }
result.update(kwargs) result.update(kwargs)
return result return result
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment