diff --git a/safesite/edu/urls.py b/safesite/edu/urls.py index 449cb41b..241ae9e1 100644 --- a/safesite/edu/urls.py +++ b/safesite/edu/urls.py @@ -5,8 +5,9 @@ urlpatterns = [ path('', views.index), path('add',views.add), path('addwj',views.addwj), - path('detail',views.detail), path('api',views.api), - path('api/upload',views.upload), + path('selectDate',views.selectDate),#查询 + path('api/upload',views.upload),#上传 path('eduvideoshow',views.showvideo), + path('html/edulessondetail/detail//', views.edulessondetail),#观看历史 ] diff --git a/safesite/edu/views.py b/safesite/edu/views.py index 10ab530f..7e9ad472 100644 --- a/safesite/edu/views.py +++ b/safesite/edu/views.py @@ -32,8 +32,9 @@ def add(req): return render(req,'edulessonadd.html') def addwj(req): return render(req,'edulessonaddwj.html') -def detail(req): - return render(req,'edulessondetail.html') +#观看历史 +def edulessondetail(req,jyid): + return render(req,'edulessondetail.html',{'jyid':jyid}) #上传视频,文件,返回地址和名称 def upload(req): @@ -47,19 +48,32 @@ def upload(req): with open( filepath, 'wb') as f: f.write(req.FILES['mf'].read()) return JsonResponse({"code":1,"filename":file_name,"filepath":filepath}) - +#查询 +def selectDate(req): + a = req.GET.get('a') + userid = req.session['userid'] + userobj = User.objects.get(userid=userid) + companyid = getcompany(userid) + a = Edulesson.objects.filter(usecomp=Partment.objects.get(partid=companyid),deletemark=1) + if req.GET.get('type',None): + a = a.filter(type=req.GET.get('type')) + total = a.count() + startnum,endnum=fenye(req) + a = a.order_by('-submittime')[startnum:endnum].values('id','num','title','user__name','desciption','submittime','type','cate__name','url','watchnum') + return HttpResponse(transjson(total,a),content_type="application/json") def api(req): a = req.GET.get('a') - + #首页列表 if a=='listall': userid = req.session['userid'] companyid = getcompany(userid) startnum,endnum=fenye(req) - a = Edulesson.objects.filter(usecomp=Partment.objects.get(partid=companyid),deletemark=1).order_by('id')#无deletemark + a = Edulesson.objects.filter(usecomp__partid__in= [1,Partment.objects.get(partid=companyid).partid] ,deletemark=1).order_by('id')#无deletemark total = a.count() startnum,endnum=fenye(req) a = a[startnum:endnum].values('id','num','title','user__name','desciption','submittime','type','cate__name','url','watchnum') return HttpResponse(transjson(total,a),content_type="application/json") + #视频 elif a=='add': userid = req.session['userid']#用户ID companyid = getcompany(userid)#公司ID @@ -80,6 +94,7 @@ def api(req): obj.save() return JsonResponse({"code":1}) + #文件 elif a=='addwj': userid = req.session['userid']#用户ID companyid = getcompany(userid)#公司ID @@ -100,7 +115,7 @@ def api(req): obj.save() return JsonResponse({"code":1}) - + #删除 elif a == 'del': id =req.GET.get('id') userid = req.session['userid'] @@ -111,6 +126,7 @@ def api(req): return JsonResponse({"code":1}) else: return JsonResponse({"code":0}) + #点击阅读 elif a=='readnumber': id =req.GET.get('id') userid = req.session['userid'] @@ -122,65 +138,10 @@ def api(req): obj.user=User.objects.get(userid=userid) obj.save() return JsonResponse({"code":1,"url": a.url}) + #观看详情 elif a=='detail': - userid = req.session['userid'] - userobj = User.objects.get(userid=userid) - companyid = getcompany(userid) - a = Edulesson.objects.filter(usecomp=Partment.objects.get(partid=companyid),deletemark=1) + id =req.GET.get('eduid') + a = EdulessonWatch.objects.filter(edulesson=id).values('id','user__name','submittime') total = a.count() - a = a.values('id','title','user__name','submittime') return HttpResponse(transjson(total,a),content_type="application/json") - elif a=='detailw': - userid = req.session['userid'] - userobj = User.objects.get(userid=userid) - id =req.GET.get('id') - companyid = getcompany(userid) - a = EdulessonWatch.objects.filter(edulesson=id).order_by('-submittime') - total = a.count() - a = a.values('id','user__name','submittime') - return HttpResponse(transjson(total,a),content_type="application/json") - elif a == '1': - userid = req.session['userid'] - userobj = User.objects.get(userid=userid) - companyid = getcompany(userid) - a = Edulesson.objects.filter(usecomp=Partment.objects.get(partid=companyid),type=1,deletemark=1).order_by('-submittime') - total = a.count() - startnum,endnum=fenye(req) - a = a[startnum:endnum].values('id','num','title','user__name','desciption','submittime','type','cate__name','url','watchnum') - return HttpResponse(transjson(total,a),content_type="application/json") - elif a == '2': - userid = req.session['userid'] - userobj = User.objects.get(userid=userid) - companyid = getcompany(userid) - a = Edulesson.objects.filter(usecomp=Partment.objects.get(partid=companyid),type=2,deletemark=1).order_by('-submittime') - total = a.count() - startnum,endnum=fenye(req) - a = a[startnum:endnum].values('id','num','title','user__name','desciption','submittime','type','cate__name','url','watchnum') - return HttpResponse(transjson(total,a),content_type="application/json") - elif a == '3': - userid = req.session['userid'] - userobj = User.objects.get(userid=userid) - companyid = getcompany(userid) - a = Edulesson.objects.filter(usecomp=Partment.objects.get(partid=companyid),type=3,deletemark=1).order_by('-submittime') - total = a.count() - startnum,endnum=fenye(req) - a = a[startnum:endnum].values('id','num','title','user__name','desciption','submittime','type','cate__name','url','watchnum') - return HttpResponse(transjson(total,a),content_type="application/json") - elif a == '4': - userid = req.session['userid'] - userobj = User.objects.get(userid=userid) - companyid = getcompany(userid) - a = Edulesson.objects.filter(usecomp=Partment.objects.get(partid=companyid),type=4,deletemark=1).order_by('-submittime') - total = a.count() - startnum,endnum=fenye(req) - a = a[startnum:endnum].values('id','num','title','user__name','desciption','submittime','type','cate__name','url','watchnum') - return HttpResponse(transjson(total,a),content_type="application/json") - elif a == 'all': - userid = req.session['userid'] - userobj = User.objects.get(userid=userid) - companyid = getcompany(userid) - a = Edulesson.objects.filter(usecomp=Partment.objects.get(partid=companyid),deletemark=1).order_by('-submittime') - total = a.count() - startnum,endnum=fenye(req) - a = a[startnum:endnum].values('id','num','title','user__name','desciption','submittime','type','cate__name','url','watchnum') - return HttpResponse(transjson(total,a),content_type="application/json") \ No newline at end of file + \ No newline at end of file diff --git a/safesite/static/safesite/easyui/themes/default/easyui.css b/safesite/static/safesite/easyui/themes/default/easyui.css index 281da698..579bac75 100644 --- a/safesite/static/safesite/easyui/themes/default/easyui.css +++ b/safesite/static/safesite/easyui/themes/default/easyui.css @@ -305,7 +305,7 @@ filter: none; } .accordion .accordion-header-selected { - background: #06c; + background: #749ec8; } .accordion .accordion-header-selected .panel-title { color: white; @@ -3408,24 +3408,10 @@ width: 138px; } .sidemenu .accordion-header .panel-title { -<<<<<<< HEAD - - height: 30px; - line-height: 45px; height: 40px; line-height: 30px; -======= -<<<<<<< HEAD - height: 30px; - line-height: 45px; color: #313030; -======= - height: 40px; - line-height: 30px; - /*color: #313030;*/ ->>>>>>> 4f67aca6509b38165cec90787005dbc762a66188 ->>>>>>> 0ed848ff177ad9c427f58c714cb22f8012e2c913 - margin-left: 12px; + margin-left: 25px; } .sidemenu .accordion-header:hover { background: #0066cc; diff --git a/safesite/static/safesite/mystatic/css/mystyle.css b/safesite/static/safesite/mystatic/css/mystyle.css index 48acc4f5..c109d839 100644 --- a/safesite/static/safesite/mystatic/css/mystyle.css +++ b/safesite/static/safesite/mystatic/css/mystyle.css @@ -148,15 +148,15 @@ b{color:red;font-size:20px} { font-size: 18px;margin-bottom:5px;margin-top:5px;color:blue; } -.l-btn-icon,.panel-icon,.menu-icon,.tabs-icon { - font-family:FontAwesome; - font-size:14px !important; - line-height:normal !important; - text-rendering:auto; - -webkit-font-smoothing:antialiased; - -moz-osx-font-smoothing:grayscale; - color:#6699cc; - text-align:center; +.l-btn-icon, .panel-icon, .menu-icon, .tabs-icon { + font-family: FontAwesome; + font-size: 14px !important; + line-height: normal !important; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + color: #167abf; + text-align: center; } .tabs-icon { font-size:16px !important; diff --git a/safesite/templates/edulessondetail.html b/safesite/templates/edulessondetail.html index a26c71c5..9a2382d5 100644 --- a/safesite/templates/edulessondetail.html +++ b/safesite/templates/edulessondetail.html @@ -1,60 +1,30 @@ -
-
+
+
+
+ - - -
- - -
- + var eduid = {{ jyid }}; + var html; + + $('#zytable').datagrid({ + url: 'edu/api?a=detail&eduid=' + eduid, + rownumbers: true, + singleSelect: true, + striped: true, + fitColumns: true, + method: 'get', + pageSize: 20, + toolbar: '#zytablebar', + columns: [[ + { field: 'id', title: 'ID', hidden: true }, + { field: 'user__name', title: '观看人', width: 80 }, + { field: 'submittime', title: '观看时间', width: 80 } + ]] + }); + + + + \ No newline at end of file diff --git a/safesite/templates/edulessonindex.html b/safesite/templates/edulessonindex.html index c6f70aea..27bf0401 100644 --- a/safesite/templates/edulessonindex.html +++ b/safesite/templates/edulessonindex.html @@ -6,7 +6,9 @@ 删除文件 点击学习 - 观看历史 + 观看历史 + +
@@ -57,7 +59,7 @@ editable: false, onSelect: function (node) { if (node.value != 0) { - $('#edutab').datagrid({ url: 'edu/api', queryParams: { a: node.value } }); + $('#edutab').datagrid({ url: 'edu/selectDate', queryParams: { type: node.value } }); } } }); @@ -139,5 +141,13 @@ $.messager.alert('提示', '请选择一行数据!'); } } + function jydetail() { + var row = $('#edutab').datagrid('getSelected'); + if (row) { + var url = 'edu/html/edulessondetail/detail/' + row.id + opendg('观看详情', url) + } + else { $.messager.alert('提示', '请选择一行数据!'); } + } \ No newline at end of file