This commit is contained in:
chenyang
2022-07-10 06:22:34 +08:00
parent bd3fae8bb7
commit 2c41394b67
3 changed files with 34 additions and 6 deletions
+19
View File
@@ -158,3 +158,22 @@ AUTHENTICATION_BACKENDS = [
# session 设置 # session 设置
SESSION_COOKIE_AGE = 60 * 30 # 设置过期时间10分钟,默认为两周 SESSION_COOKIE_AGE = 60 * 30 # 设置过期时间10分钟,默认为两周
SESSION_SAVE_EVERY_REQUEST = True 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',
},
}
}
+12 -1
View File
@@ -11,6 +11,7 @@ from server.serializers import *
from server.util.constant_util import * from server.util.constant_util import *
from server.util.mix_util import build_response from server.util.mix_util import build_response
from server_auth.lib.auth import LoginRequiredJSONMixin from server_auth.lib.auth import LoginRequiredJSONMixin
from django.db.models import Exists, OuterRef
class JsMindView(LoginRequiredJSONMixin, ListAPIView): class JsMindView(LoginRequiredJSONMixin, ListAPIView):
@@ -28,7 +29,11 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
查询思维导图 查询思维导图
""" """
pk = request.GET.get('id') pk = request.GET.get('id')
src_page = request.GET.get('src_page')
user = request.user 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) print('list current user: %s' % user)
if pk is not None: if pk is not None:
# 查询导图详细 查看用户是否有权限(创建者) # 查询导图详细 查看用户是否有权限(创建者)
@@ -40,8 +45,14 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
return build_response(data=serializer.data) 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, 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) return self.list(request, *args, **kwargs)
def post(self, request): def post(self, request):
+2 -4
View File
@@ -82,7 +82,7 @@
$.ajax({ $.ajax({
type: `get`, 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")}, headers: {"X-CSRFToken": $.cookie("csrftoken")},
dataType: "json", dataType: "json",
success: function (resp) { 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}')"> <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 style="text-align:right;font-size: 0.8rem;margin-top: 5px;font-family: inherit;">
<div class="btn-group btn-group-sm" role="group"> <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 id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">操作</button>
操作
</button>
<div class="dropdown-menu" aria-labelledby="btnGroupDrop1"> <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="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> <a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_mind(${item.id},'card_${uuid}')">删除</a>