From 47b1820760de8f1519ba80e08ad2c6f75b4c17e1 Mon Sep 17 00:00:00 2001 From: xiaoan <419177984@qq.com> Date: Wed, 8 May 2024 03:53:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=89=A9=E4=BD=99=E6=89=80?= =?UTF-8?q?=E6=9C=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/models.py | 13 + server/urls.py | 10 +- server/views/jump.py | 39 +- server_auth/lib/auth.py | 51 +- server_auth/models.py | 1 + static/html/admin.html | 658 +++++++++++++++++ static/html/baiban.html | 20 +- static/html/dashboard.html | 39 +- static/html/echats.html | 20 +- static/html/informations.html | 1296 +++++++++++++++++++++++++++++++++ static/html/kecheng.html | 20 +- static/html/liuyan.html | 686 +++++++++++++++++ static/html/post_kecheng.html | 20 +- static/html/post_task.html | 20 +- static/html/rengwu.html | 22 +- static/html/wechat_2.html | 20 +- static/html/write_2.html | 20 +- 17 files changed, 2929 insertions(+), 26 deletions(-) create mode 100644 static/html/admin.html create mode 100644 static/html/informations.html create mode 100644 static/html/liuyan.html diff --git a/server/models.py b/server/models.py index 0b4223c..8408e6d 100644 --- a/server/models.py +++ b/server/models.py @@ -132,3 +132,16 @@ class Comment(models.Model): # 定义评论模型 db_table = 'comment_tb' verbose_name = '评论' verbose_name_plural = verbose_name + +class Liuyan(models.Model): # 定义留言板模型 + # article = models.ForeignKey(to=Article, on_delete=models.DO_NOTHING, verbose_name='评论文章') + liuyan_id = models.IntegerField(verbose_name='留言给谁了') + liuyan_content = models.TextField(verbose_name='留言内容') + user = models.ForeignKey(MindUser, on_delete=models.CASCADE) #留言人id + liuyan_time = models.DateTimeField(auto_now_add=True, verbose_name='留言时间') + + class Meta: + db_table = 'liuyan_tb' + verbose_name = '留言' + verbose_name_plural = verbose_name + diff --git a/server/urls.py b/server/urls.py index e6b174b..629e046 100644 --- a/server/urls.py +++ b/server/urls.py @@ -24,11 +24,15 @@ urlpatterns = [ path('ke_cheng',to_kecheng), # 到课程界面 path('2_write',to_write), # 到协同边界页面 path('2_pinglun',to_pinglun), # 评论 + path('2_admin',to_admin), # 跳转到管理员页面 + path('2_star', to_star), # 到收藏界面 path('2_recycle', to_recycle), # 回收站 - path(r'jsmind_op', JsMindLogView.as_view()), # 更新快照,get日志操作 + path('2_information', to_information), # 个人信息 + path('2_liuyan', to_liuyan), # 留言 + path(r'jsmind_op', JsMindLogView.as_view()), # 更新快照,get日志操作 # --------------------------------------------------- path('create', JsMindView.as_view()), # 创建思维导图 path('list', JsMindView.as_view()), # 查询思维导图 @@ -55,6 +59,8 @@ urlpatterns = [ path('post_kecheng/', post_kecheng, name='post_kecheng'), path('come_kecheng/',come_kecheng, name='come_kecheng'), - path('comment_control/',comment_control,name='comment_control') #提交评论处理的路由 + path('comment_control/',comment_control,name='comment_control'), #提交评论处理的路由 + path('admin_fun/',admin_fun,name='admin_fun'), + path('liuyan_fun/',liuyan_fun,name='liuyan_fun') ] diff --git a/server/views/jump.py b/server/views/jump.py index 6d651bd..27d5907 100644 --- a/server/views/jump.py +++ b/server/views/jump.py @@ -1,7 +1,7 @@ import json from django.shortcuts import render -from server.models import Task,StudentandTercher,Comment +from server.models import Task,StudentandTercher,Comment,Liuyan from server_auth.models import MindUser @@ -29,6 +29,14 @@ def to_pinglun(request): print(test_date) return render(request, "html/commont.html", param) +def to_admin(request): + username = request.user + # supper = MindUser.objects.filter(username=username).type_t_or_s + if username.type_t_or_s == 3: + datas = MindUser.objects.filter(type_t_or_s=2) + return render(request, "html/admin.html",{"datas":datas}) + else: + return render(request, "html/dashboard.html") def to_share(request): """ 分享页面 @@ -115,4 +123,31 @@ def teacher_login(request): 详情页面 """ param = {'id': request.GET.get('id')} - return render(request, "html/login.html", param) \ No newline at end of file + return render(request, "html/login.html", param) + +def to_information(request): + """ + 个人信息页面 + """ + param = {"page": "recycle"} + username = request.user + datas = MindUser.objects.filter(username=username) + xiaozu = MindUser.objects.get(username=username).select_xiaozu + kz = MindUser.objects.get(username=username).select_class + xiaozu = json.loads(xiaozu)['xiaozu'] + kc = json.loads(kz)['class'] + test = zip(kc, xiaozu) + it3 = [] + for it1, it2 in test: + it3.append(str(it1) + "课程" + str(it2) + "小组") + + return render(request, "html/informations.html", {"datas":datas,"it3":it3}) + +def to_liuyan(request): + """ + 留言板页面 + """ + # param = {"page": "recycle"} + datas = MindUser.objects.all() + liuyans = Liuyan.objects.filter(liuyan_id=request.user.id) + return render(request, "html/liuyan.html", {"datas":datas,"liuyans":liuyans}) diff --git a/server_auth/lib/auth.py b/server_auth/lib/auth.py index cc8bd14..f0f359b 100644 --- a/server_auth/lib/auth.py +++ b/server_auth/lib/auth.py @@ -13,7 +13,7 @@ from django.shortcuts import render from server.taskform import TaskForm from django.utils import timezone -from server.models import Task,StudentandTercher,MindUser +from server.models import Task,StudentandTercher,MindUser,Liuyan from server.serializers import * import json @@ -59,6 +59,11 @@ class LoginView(APIView): # 记住登录状态 login(request, user) return build_response(msg='学生端登录成功') + elif user.is_active and user.type_t_or_s == 3: + # 记住登录状态 + # 记住登录状态 + login(request, user) + return build_response(msg='管理员登录成功') else: return build_response(code=CODE_FAILED, msg='登录失败') else: @@ -134,10 +139,8 @@ class TeacherView(LoginRequiredJSONMixin,APIView): def post_task(request): - if request.method == 'POST': - if request.user.type_t_or_s == 2: - return render(request, 'html/error.html') - else: + if request.user.type_t_or_s == 1: + if request.method == 'POST': start_time = timezone.now() title = request.POST.get("title") description = request.POST.get("description") @@ -145,26 +148,29 @@ def post_task(request): rengwu = Task(title=title, description=description, publish_time=start_time, deadline=end_time,publisher=request.user) rengwu.save() return http.JsonResponse({'code': CODE_SUCCESS, 'msg': '发布成功'}) + else: + return render(request, 'html/post_task.html') else: - return render(request, 'html/post_task.html') + return render(request, 'html/dashboard.html') def post_kecheng(request): - if request.method == 'POST': - if request.user.type_t_or_s == 2: - return render(request, 'html/error.html') - else: + if request.user.type_t_or_s == 1: + if request.method == 'POST': add_time = timezone.now() class_id = request.POST.get("class_id") class_name = request.POST.get("class_name") tercher_name = request.POST.get("tercher_name") class_info = request.POST.get("class_info") class_status = request.POST.get("class_status") - rengwu = StudentandTercher(add_time=add_time,class_id=class_id, class_name=class_name, + rengwu = StudentandTercher(add_time=add_time, class_id=class_id, class_name=class_name, tercher_name=tercher_name, class_info=class_info, class_status=class_status) rengwu.save() return http.JsonResponse({'code': CODE_SUCCESS, 'msg': '发布成功'}) + else: + return render(request, 'html/post_kecheng.html') else: - return render(request, 'html/post_kecheng.html') + return render(request, 'html/dashboard.html') + def come_kecheng(request): if request.method == 'POST': @@ -206,4 +212,25 @@ def comment_control(request): # 提交评论的处理函数 return JsonResponse(article, safe=False) # JsonResponse返回JSON字符串,自动序列化,如果不是字典类型,则需要添加safe参数为False +def admin_fun(request): # 提交评论的处理函数 + if request.method == 'POST': + id = request.POST.get('user_id') + MindUser.objects.filter(id=id).update(type_t_or_s=1) + print(id) + return http.JsonResponse({'code': CODE_SUCCESS, 'msg': '修改成功'}) + else: + return http.JsonResponse({'code': CODE_FAILED, 'msg': '修改失败'}) + +def liuyan_fun(request): # 提交留言的处理函数 + if request.method == 'POST': + username = request.user.username + userid = MindUser.objects.get(username=username).id + print("-----------------") + print(userid) + id = request.POST.get('user_id') + liuyan = request.POST.get('liuyan_con') + Liuyan.objects.create(liuyan_id=id,user_id=userid,liuyan_content=liuyan,liuyan_time=timezone.now()) + return http.JsonResponse({'code': CODE_SUCCESS, 'msg': '留言成功'}) + else: + return http.JsonResponse({'code': CODE_FAILED, 'msg': '修改失败'}) diff --git a/server_auth/models.py b/server_auth/models.py index ff539fa..d111f2c 100644 --- a/server_auth/models.py +++ b/server_auth/models.py @@ -11,6 +11,7 @@ class MindUser(AbstractUser): sex_type = ( (1, "老师"), (2, "学生"), + (3, "管理员") ) type_t_or_s = models.SmallIntegerField(verbose_name="学生身份还是老师身份", choices=sex_type, default="2") class_id = models.IntegerField(verbose_name='课程ID', null=True, blank=True) diff --git a/static/html/admin.html b/static/html/admin.html new file mode 100644 index 0000000..de622c6 --- /dev/null +++ b/static/html/admin.html @@ -0,0 +1,658 @@ + + + + + + 协作学习投入智能干预平台(学生端) + + + + + + + + + + + + + + +
+ {{ user.id }} + {{ page }} +
+ + +
+ 协作学习投入智能干预平台(学生端) +
    +
  • + 登录/注册 + 注销 + +
  • +
+
+ + + +
+
+ +
+
+
+
    +
  • + + + 课程/小组信息 + +
  • +
  • + + + 协作收藏 + +
  • +
  • + + + 学习分析图 + +
  • +
  • + + + 聊天室 + +
  • +
  • + + + 任务详情 + +
  • +
  • + + + 课程页面 + +
  • +
  • + + + 任务发布页面 + +
  • +
  • + + + 课程发布页面 + +
  • +
  • + + + 个人信息 + +
  • +
  • + + + 管理员页面 + +
  • +
  • + + + 留言板 + +
  • +
  • + + + 回收站 + +
  • +
+
+
+ +
+

admin管理员界面

+ + + + + + + {% for data in datas %} + + + + + + + + + + {% endfor %} +
用户名
加入时间
操作
{{data.username}}{{data.date_joined}}
+ {% csrf_token %} + +
+
+
+ + +
+
+ + + + + + diff --git a/static/html/baiban.html b/static/html/baiban.html index 063e91b..73f77ef 100644 --- a/static/html/baiban.html +++ b/static/html/baiban.html @@ -588,9 +588,27 @@ 课程发布页面 + +
  • + + + 个人信息 +
  • - + + + 管理员页面 + +
  • +
  • + + + 留言板 + +
  • +
  • + 回收站 diff --git a/static/html/dashboard.html b/static/html/dashboard.html index fe0e630..e80dba3 100644 --- a/static/html/dashboard.html +++ b/static/html/dashboard.html @@ -647,6 +647,24 @@ 课程发布页面 +
  • +
  • + + + 个人信息 + +
  • +
  • + + + 管理员页面 + +
  • +
  • + + + 留言板 +
  • @@ -658,7 +676,6 @@ -
    @@ -695,4 +712,24 @@ window.feather.replace(); } + diff --git a/static/html/echats.html b/static/html/echats.html index cb4b763..f317375 100644 --- a/static/html/echats.html +++ b/static/html/echats.html @@ -588,9 +588,27 @@ 课程发布页面 +
  • +
  • + + + 个人信息 +
  • - + + + 管理员页面 + +
  • +
  • + + + 留言板 + +
  • +
  • + 回收站 diff --git a/static/html/informations.html b/static/html/informations.html new file mode 100644 index 0000000..5949c5b --- /dev/null +++ b/static/html/informations.html @@ -0,0 +1,1296 @@ + + + + + + 协作学习投入智能干预平台(学生端) + + + + + + + + + + + + + + +
    + {{ user.id }} + {{ page }} +
    + + +
    + 协作学习投入智能干预平台(学生端) +
      +
    • + 登录/注册 + 注销 + +
    • +
    +
    + + + +
    +
    + +
    +
    +
    +
      +
    • + + + 课程/小组信息 + +
    • +
    • + + + 协作收藏 + +
    • +
    • + + + 学习分析图 + +
    • +
    • + + + 聊天室 + +
    • +
    • + + + 任务详情 + +
    • +
    • + + + 课程页面 + +
    • +
    • + + + 任务发布页面 + +
    • +
    • + + + 课程发布页面 + +
    • +
    • + + + 回收站 + +
    • +
    +
    +
    + +
    +

    个人信息

    + + + + + + + + {% for data in datas %} + + + + + + {% for it in it3 %} + + {% endfor %} + + + + {% endfor %} +
    用户名
    加入时间
    职位
    选择的课程及其小组情况
    {{data.username}}{{data.date_joined}}{{data.get_type_t_or_s_display}}{{it}}
    +
    + + +
    +
    + + + + + + + + + + + + 协作学习投入智能干预平台(学生端) + + + + + + + + + + + + + + +
    + {{ user.id }} + {{ page }} +
    + + +
    + 协作学习投入智能干预平台(学生端) +
      +
    • + 登录/注册 + 注销 + +
    • +
    +
    + + + +
    +
    + +
    +
    +
    +
      +
    • + + + 课程/小组信息 + +
    • +
    • + + + 协作收藏 + +
    • +
    • + + + 学习分析图 + +
    • +
    • + + + 聊天室 + +
    • +
    • + + + 任务详情 + +
    • +
    • + + + 课程页面 + +
    • +
    • + + + 任务发布页面 + +
    • +
    • + + + 课程发布页面 + +
    • +
    • + + + 个人信息 + +
    • +
    • + + + 管理员页面 + +
    • +
    • + + + 留言板 + +
    • +
    • + + + 回收站 + +
    • +
    +
    +
    + +
    +

    个人信息

    + + + + + + + + {% for data in datas %} + + + + + + {% for it in it3 %} + + {% endfor %} + + + + {% endfor %} +
    用户名
    加入时间
    职位
    选择的课程及其小组情况
    {{data.username}}{{data.date_joined}}{{data.get_type_t_or_s_display}}{{it}}
    +
    + + +
    +
    + + + + + + diff --git a/static/html/kecheng.html b/static/html/kecheng.html index 0620206..79a4738 100644 --- a/static/html/kecheng.html +++ b/static/html/kecheng.html @@ -595,9 +595,27 @@ 课程发布页面 +
  • +
  • + + + 个人信息 +
  • - + + + 管理员页面 + +
  • +
  • + + + 留言板 + +
  • +
  • + 回收站 diff --git a/static/html/liuyan.html b/static/html/liuyan.html new file mode 100644 index 0000000..2e34441 --- /dev/null +++ b/static/html/liuyan.html @@ -0,0 +1,686 @@ + + + + + + 协作学习投入智能干预平台(学生端) + + + + + + + + + + + + + + +
    + {{ user.id }} + {{ page }} +
    + + +
    + 协作学习投入智能干预平台(学生端) +
      +
    • + 登录/注册 + 注销 + +
    • +
    +
    + + + +
    +
    + +
    +
    +
    +
      +
    • + + + 课程/小组信息 + +
    • +
    • + + + 协作收藏 + +
    • +
    • + + + 学习分析图 + +
    • +
    • + + + 聊天室 + +
    • +
    • + + + 任务详情 + +
    • +
    • + + + 课程页面 + +
    • +
    • + + + 任务发布页面 + +
    • +
    • + + + 课程发布页面 + +
    • +
    • + + + 个人信息 + +
    • +
    • + + + 管理员页面 + +
    • +
    • + + + 留言板 + +
    • +
    • + + + 回收站 + +
    • +
    +
    +
    + +
    +

    留言板

    + + + + + + + {% for data in datas %} + + + + + {% csrf_token %} + + + + + +{# {% for it in it3 %}#} +{# #} +{# {% endfor %}#} + {% endfor %} +
    用户名
    给他留言
    操作
    {{data.username}}
    + + + + +
    {{it}}
    +

    我的留言版本

    + + + + + + + {% for liuyan in liuyans %} + + + + + + +{# {% for it in it3 %}#} +{# #} +{# {% endfor %}#} + {% endfor %} +
    留言人
    留言内容
    留言时间
    {{liuyan.user.username}} + {{ liuyan.liuyan_content }} + + {{ liuyan.liuyan_time }} +
    {{it}}
    +
    + + +
    +
    + + + + + + diff --git a/static/html/post_kecheng.html b/static/html/post_kecheng.html index e70d190..d3cb4ed 100644 --- a/static/html/post_kecheng.html +++ b/static/html/post_kecheng.html @@ -595,9 +595,27 @@ 课程发布页面 +
  • +
  • + + + 个人信息 +
  • - + + + 管理员页面 + +
  • +
  • + + + 留言板 + +
  • +
  • + 回收站 diff --git a/static/html/post_task.html b/static/html/post_task.html index 58c5aa2..15bc108 100644 --- a/static/html/post_task.html +++ b/static/html/post_task.html @@ -595,9 +595,27 @@ 课程发布页面 +
  • +
  • + + + 个人信息 +
  • - + + + 管理员页面 + +
  • +
  • + + + 留言板 + +
  • +
  • + 回收站 diff --git a/static/html/rengwu.html b/static/html/rengwu.html index fd56e2a..f53e7f7 100644 --- a/static/html/rengwu.html +++ b/static/html/rengwu.html @@ -541,7 +541,7 @@

      -
    • +
    • 课程/小组信息 @@ -588,9 +588,27 @@ 课程发布页面 +
    • +
    • + + + 个人信息 +
    • - + + + 管理员页面 + +
    • +
    • + + + 留言板 + +
    • +
    • + 回收站 diff --git a/static/html/wechat_2.html b/static/html/wechat_2.html index 3b6a87b..b7a60cb 100644 --- a/static/html/wechat_2.html +++ b/static/html/wechat_2.html @@ -588,9 +588,27 @@ 课程发布页面 +
    • +
    • + + + 个人信息 +
    • - + + + 管理员页面 + +
    • +
    • + + + 留言板 + +
    • +
    • + 回收站 diff --git a/static/html/write_2.html b/static/html/write_2.html index 1120a6b..c78070c 100644 --- a/static/html/write_2.html +++ b/static/html/write_2.html @@ -598,9 +598,27 @@ 课程发布页面 +
    • +
    • + + + 个人信息 +
    • - + + + 管理员页面 + +
    • +
    • + + + 留言板 + +
    • +
    • + 回收站