update
This commit is contained in:
@@ -158,3 +158,22 @@ AUTHENTICATION_BACKENDS = [
|
||||
# session 设置
|
||||
SESSION_COOKIE_AGE = 60 * 30 # 设置过期时间10分钟,默认为两周
|
||||
SESSION_SAVE_EVERY_REQUEST = True
|
||||
|
||||
# 日志
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'console': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.StreamHandler',
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'django.db.backends': {
|
||||
'handlers': ['console'],
|
||||
'propagate': True,
|
||||
'level': 'DEBUG',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ from server.serializers import *
|
||||
from server.util.constant_util import *
|
||||
from server.util.mix_util import build_response
|
||||
from server_auth.lib.auth import LoginRequiredJSONMixin
|
||||
from django.db.models import Exists, OuterRef
|
||||
|
||||
|
||||
class JsMindView(LoginRequiredJSONMixin, ListAPIView):
|
||||
@@ -28,7 +29,11 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
|
||||
查询思维导图
|
||||
"""
|
||||
pk = request.GET.get('id')
|
||||
src_page = request.GET.get('src_page')
|
||||
user = request.user
|
||||
if src_page is None or user.id is None:
|
||||
return build_response(code=CODE_FAILED, msg="参数错误")
|
||||
|
||||
print('list current user: %s' % user)
|
||||
if pk is not None:
|
||||
# 查询导图详细 查看用户是否有权限(创建者)
|
||||
@@ -40,8 +45,14 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
|
||||
return build_response(data=serializer.data)
|
||||
|
||||
# 查询列表
|
||||
if 'main' == src_page:
|
||||
self.queryset = CooperationMind.objects.filter(creator_user_id=user.id, deleted=0).values('id', 'coop_mind_name', "client_uuid", "data_format")
|
||||
# self.queryset = CooperationMind.objects.filter(creator_user_id=user.id).all()
|
||||
elif 'share' == src_page:
|
||||
share = CooperationMindShare.objects.filter(coop_mind_id=OuterRef('id'))
|
||||
self.queryset = CooperationMind.objects.annotate(share_new=Exists(share), ).filter(share_new=1)
|
||||
else:
|
||||
# 不返回数据
|
||||
self.queryset = CooperationMind.objects.filter(creator_user_id=-100).values('id', 'coop_mind_name', "client_uuid", "data_format")
|
||||
return self.list(request, *args, **kwargs)
|
||||
|
||||
def post(self, request):
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
$.ajax({
|
||||
type: `get`,
|
||||
url: `list?page=${current_page}&page_size=${page_size}`,
|
||||
url: `list?page=${current_page}&page_size=${page_size}&src_page=${src_page}`,
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
@@ -106,9 +106,7 @@
|
||||
<img src="/static/pic/demo_icon.png" class="card-img-top" style="margin-top: 8px;cursor: pointer;" onclick="window.open('2_d?id=${item.id}')">
|
||||
<div style="text-align:right;font-size: 0.8rem;margin-top: 5px;font-family: inherit;">
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
<button id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
操作
|
||||
</button>
|
||||
<button id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">操作</button>
|
||||
<div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
|
||||
<a class="dropdown-item" href="javascript:void(0);" onclick="window.open('2_d?id=${item.id}')">编辑</a>
|
||||
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_mind(${item.id},'card_${uuid}')">删除</a>
|
||||
|
||||
Reference in New Issue
Block a user