Merge branch 'master' of 10.7.100.160:/job/safesite
This commit is contained in:
commit
a6e67b8106
|
@ -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/<int:jyid>/', views.edulessondetail),#观看历史
|
||||
]
|
||||
|
|
|
@ -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")
|
||||
|
|
@ -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;
|
||||
|
|
|
@ -155,7 +155,7 @@ b{color:red;font-size:20px}
|
|||
text-rendering: auto;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
color:#6699cc;
|
||||
color: #167abf;
|
||||
text-align: center;
|
||||
}
|
||||
.tabs-icon {
|
||||
|
|
|
@ -1,60 +1,30 @@
|
|||
|
||||
<div class="easyui-layout" style="width:100%;height:100%;">
|
||||
<div id="content" data-options="region:'center'" style="padding:15px 15px;">
|
||||
|
||||
|
||||
|
||||
<div title="作业" style="height:100%;">
|
||||
<table id="zytable" style="width:100%;height:100%"></table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "edu/api?a=detail",
|
||||
dateType: "json",
|
||||
success: function (data) {
|
||||
|
||||
json = eval(data.rows)
|
||||
|
||||
for (var i = 0; i < json.length; i++) {
|
||||
|
||||
var divHtml = '<div style="">文件名称:' + data.rows[i].title ;
|
||||
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "edu/api?a=detailw",
|
||||
data: { 'id': json[i].id },
|
||||
dateType: "json",
|
||||
async: false,
|
||||
success: function (data) {
|
||||
jsons = eval(data.rows)
|
||||
divHtml += '<ul style="list-style-type:none">';
|
||||
for (var j = 0; j < jsons.length; j++) {
|
||||
divHtml += '<li style="line-height:30px;border: 1px solid red;"> 观看人:' + data.rows[j].user__name + ' |观看时间:' + data.rows[j].submittime + '</li>';
|
||||
|
||||
}
|
||||
divHtml += '</ul>';
|
||||
|
||||
},
|
||||
error: function () {
|
||||
return false;
|
||||
},
|
||||
<script>
|
||||
|
||||
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 }
|
||||
]]
|
||||
});
|
||||
divHtml += '</div>'
|
||||
$("#content").append(divHtml);
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
error: function () {
|
||||
return false;
|
||||
},
|
||||
async: false
|
||||
});
|
||||
|
||||
</script>
|
|
@ -6,7 +6,9 @@
|
|||
<a id="deledu" class="easyui-linkbutton" onclick="deledu()" data-options="iconCls: 'fa-trash',plain:true">删除文件</a>
|
||||
|
||||
<a id="tzdetail" onclick="tzdetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">点击学习</a>
|
||||
<a id="edulook" class="easyui-linkbutton" onclick="javascript:opendg('观看历史','edu/detail')" data-options="iconCls: 'fa-plus',plain:true">观看历史</a>
|
||||
<a id="edulook" class="easyui-linkbutton" onclick="jydetail()" data-options="iconCls: 'fa-plus',plain:true">观看历史</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div style="padding: 5px;float: left;width: 400px;">
|
||||
<label>查询</label>
|
||||
|
@ -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('提示', '请选择一行数据!'); }
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue