From 2e45c2a332eab93006824fb19044ef0a6e5341b5 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sun, 17 Apr 2022 22:12:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E8=B5=84=E6=96=99=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=A7=82=E7=9C=8B=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- safesite/edu/views.py | 20 ++++++++++++-------- safesite/templates/edulessondetail.html | 9 +++++---- safesite/templates/edulessonindex.html | 8 ++++---- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/safesite/edu/views.py b/safesite/edu/views.py index 506eb3ba..73f4c662 100644 --- a/safesite/edu/views.py +++ b/safesite/edu/views.py @@ -80,10 +80,10 @@ def api(req): startnum,endnum=fenye(req) a = a.order_by('-downnum','-modifytime')[startnum:endnum].values('id','num','title','user__name','user__ubelongpart__partname','desciption','submittime','type','cate__name','url','downnum','modifytime') return HttpResponse(transjson(total,a),content_type="application/json") - elif a == 'detail': - id = req.GET.get('id') - obj = Edulesson.objects.filter(id=id).values('id','num','title','user__name','user__ubelongpart__partname','desciption','submittime','type','cate__name','url','downnum','modifytime') - return JsonResponse(list(obj)[0]) + # elif a == 'detail': + # id = req.GET.get('eduid') + # obj = Edulesson.objects.filter(id=id).values('id','num','title','user__name','user__ubelongpart__partname','desciption','submittime','type','cate__name','url','downnum','modifytime') + # return JsonResponse(list(obj)[0]) #视频 elif a=='add': userid = req.session['userid']#用户ID @@ -168,7 +168,11 @@ def api(req): return JsonResponse({"code":1,"url": a.url}) #观看详情 elif a=='detail': - id=req.GET.get('zrid') - a = EdulessonWatch.objects.filter(edulesson=id).values('id','user__name','submittime') - total = a.count() - return HttpResponse(transjson(total,a),content_type="application/json") \ No newline at end of file + id=req.GET.get('eduid') + userid = req.session['userid'] + companyid = getcompany(userid)#公司ID + objs = EdulessonWatch.objects.filter(edulesson=id, user__usecomp=companyid) + total = objs.count() + startnum, endnum = fenye(req) + objs_data = objs.order_by('-submittime')[startnum:endnum].values('id','user__name','submittime') + return HttpResponse(transjson(total, objs_data), content_type="application/json") \ No newline at end of file diff --git a/safesite/templates/edulessondetail.html b/safesite/templates/edulessondetail.html index 9a2382d5..d6de5d5b 100644 --- a/safesite/templates/edulessondetail.html +++ b/safesite/templates/edulessondetail.html @@ -1,6 +1,6 @@ -
-
+
+
@@ -9,7 +9,7 @@ var eduid = {{ jyid }}; var html; - $('#zytable').datagrid({ + $('#eduwatchtable').datagrid({ url: 'edu/api?a=detail&eduid=' + eduid, rownumbers: true, singleSelect: true, @@ -17,7 +17,8 @@ fitColumns: true, method: 'get', pageSize: 20, - toolbar: '#zytablebar', + pagination: 'true', + toolbar: '#eduwatchtablebar', columns: [[ { field: 'id', title: 'ID', hidden: true }, { field: 'user__name', title: '观看人', width: 80 }, diff --git a/safesite/templates/edulessonindex.html b/safesite/templates/edulessonindex.html index ec8e37d7..d4a174a0 100644 --- a/safesite/templates/edulessonindex.html +++ b/safesite/templates/edulessonindex.html @@ -30,9 +30,9 @@ {% if request|has_permission:'b_edu_study' %} 下载/查看 {% endif %} - + {% if request|has_permission:'b_edu_addfile' %} + 观看历史 + {% endif %}
@@ -159,7 +159,7 @@ $.messager.alert('提示', '请选择一行数据!'); } } - function jydetail() { + function edudetail() { var row = $('#edutab').datagrid('getSelected'); if (row) { var url = 'edu/html/edulessondetail/detail/' + row.id