From 926fbf187f0413b63e2fd9af304d84ecfe7f83fc Mon Sep 17 00:00:00 2001 From: xiaoan <419177984@qq.com> Date: Tue, 18 Jun 2024 17:13:14 +0800 Subject: [PATCH] fix bug and add chatroom --- server/views/jump.py | 7 ++- server/views/mind_map.py | 106 +++++++++++++++++----------------- static/html/admin.html | 12 ---- static/html/baiban.html | 12 ---- static/html/dashboard.html | 16 +---- static/html/echats.html | 12 ---- static/html/informations.html | 12 ---- static/html/kecheng.html | 12 ---- static/html/liuyan.html | 12 ---- static/html/post_task.html | 12 ---- static/html/post_task2.html | 12 ---- static/html/rengwu.html | 12 ---- static/html/teacher_3.html | 13 +---- static/html/wechat_2.html | 18 +----- static/html/write_2.html | 12 ---- 15 files changed, 67 insertions(+), 213 deletions(-) diff --git a/server/views/jump.py b/server/views/jump.py index 207333f..28f3f87 100644 --- a/server/views/jump.py +++ b/server/views/jump.py @@ -83,8 +83,13 @@ def to_chat_room(request): """ 聊天室页面 """ + test_date = request.GET.get('id') + name = CooperationMind.objects.get(id=test_date).coop_mind_name + room_id = int(test_date) + 10000 param = {"page": "chat_room", - "username":request.user.username} + "username":request.user.username, + "name":name, + "room_id":room_id} return render(request, "html/wechat_2.html", param) def to_rengwu(request): """ diff --git a/server/views/mind_map.py b/server/views/mind_map.py index 7e7b4c3..062779c 100644 --- a/server/views/mind_map.py +++ b/server/views/mind_map.py @@ -54,59 +54,61 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView): # 序列化 serializer = CooperationMindSerializer(mind[0]) return build_response(data=serializer.data) - - # 查询列表 - if 'b9b101e' == page_tag: - # belong_to = [] - old_class = json.loads(user.select_class)['class'] - old_xiaozu = json.loads(user.select_xiaozu)['xiaozu'] - # for select_class,select_xiaozu in (old_class,old_xiaozu): - # belong_to = ["class1","class2"] - # ["class1"] - # new_belong = json.dumps({'belong': belong_to}) - # 我的文件 - aa = [] - zipped_lists = zip(old_class, old_xiaozu) - for select_class,select_xiaozu in zipped_lists: - belong_to = [] - belong_to.append(str(select_class + str(select_xiaozu))) - new_belong = json.dumps({'belong': belong_to}) - print(new_belong) - aa.append(CooperationMind.objects.filter(belong_to=new_belong, deleted=0).values('id', 'coop_mind_name', - "client_uuid", - "data_format")) - # queryset.save() - - # for i in range(len(aa) - 1): - # if i == 0: - # bb = str(aa[i]) - # bb = bb + "|" + str(aa[i + 1]) - if len(aa) -1 == 0: - self.queryset = aa[0] - elif len(aa) == 0: - self.queryset = 0 - else: - for i in range(len(aa) -1): - if i == 0: - self.queryset = aa[i] - self.queryset = self.queryset | aa[i + 1] - print("=============================") - print(self.queryset) - print("=============================") - elif 'share' == page_tag: - # 我的分享 - share = CooperationMindShare.objects.filter(coop_mind_id=OuterRef('id'), operator_user_id=user.id) - self.queryset = CooperationMind.objects.annotate(share_col=Exists(share), ).filter(share_col=1, deleted=0).values('id', 'coop_mind_name', "client_uuid", "data_format") - elif 'star' == page_tag: - # 我的收藏 - star = CooperationMindStar.objects.filter(coop_mind_id=OuterRef('id'), operator_user_id=user.id) - self.queryset = CooperationMind.objects.annotate(star_col=Exists(star), ).filter(star_col=1, deleted=0).values('id', 'coop_mind_name', "client_uuid", "data_format") - elif 'recycle' == page_tag: - # 回收站 - self.queryset = CooperationMind.objects.filter(creator_user_id=user.id, deleted=1).values('id', 'coop_mind_name', "client_uuid", "data_format") + if user.type_t_or_s == 1: + self.queryset = CooperationMind.objects.all() else: - # 不返回数据 - self.queryset = CooperationMind.objects.filter(creator_user_id=-100).values('id', 'coop_mind_name', "client_uuid", "data_format") + # 查询列表 + if 'b9b101e' == page_tag: + # belong_to = [] + old_class = json.loads(user.select_class)['class'] + old_xiaozu = json.loads(user.select_xiaozu)['xiaozu'] + # for select_class,select_xiaozu in (old_class,old_xiaozu): + # belong_to = ["class1","class2"] + # ["class1"] + # new_belong = json.dumps({'belong': belong_to}) + # 我的文件 + aa = [] + zipped_lists = zip(old_class, old_xiaozu) + for select_class,select_xiaozu in zipped_lists: + belong_to = [] + belong_to.append(str(select_class + str(select_xiaozu))) + new_belong = json.dumps({'belong': belong_to}) + print(new_belong) + aa.append(CooperationMind.objects.filter(belong_to=new_belong, deleted=0).values('id', 'coop_mind_name', + "client_uuid", + "data_format")) + # queryset.save() + + # for i in range(len(aa) - 1): + # if i == 0: + # bb = str(aa[i]) + # bb = bb + "|" + str(aa[i + 1]) + if len(aa) -1 == 0: + self.queryset = aa[0] + elif len(aa) == 0: + self.queryset = 0 + else: + for i in range(len(aa) -1): + if i == 0: + self.queryset = aa[i] + self.queryset = self.queryset | aa[i + 1] + print("=============================") + print(self.queryset) + print("=============================") + elif 'share' == page_tag: + # 我的分享 + share = CooperationMindShare.objects.filter(coop_mind_id=OuterRef('id'), operator_user_id=user.id) + self.queryset = CooperationMind.objects.annotate(share_col=Exists(share), ).filter(share_col=1, deleted=0).values('id', 'coop_mind_name', "client_uuid", "data_format") + elif 'star' == page_tag: + # 我的收藏 + star = CooperationMindStar.objects.filter(coop_mind_id=OuterRef('id'), operator_user_id=user.id) + self.queryset = CooperationMind.objects.annotate(star_col=Exists(star), ).filter(star_col=1, deleted=0).values('id', 'coop_mind_name', "client_uuid", "data_format") + elif 'recycle' == page_tag: + # 回收站 + self.queryset = CooperationMind.objects.filter(creator_user_id=user.id, deleted=1).values('id', 'coop_mind_name', "client_uuid", "data_format") + 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): diff --git a/static/html/admin.html b/static/html/admin.html index de622c6..fa65e75 100644 --- a/static/html/admin.html +++ b/static/html/admin.html @@ -553,18 +553,6 @@ 协作收藏 - - - - - - - - - - - - - - - - - - - - - - + - - - -