文件分享优化
This commit is contained in:
parent
d11c44e062
commit
79a025904d
|
@ -71,10 +71,10 @@ def api(req):
|
|||
a = Edulesson.objects.filter(usecomp__partid__in= [1,Partment.objects.get(partid=companyid).partid] ,deletemark=1)#无deletemark
|
||||
if req.GET.get('search',None):
|
||||
search = req.GET.get('search')
|
||||
a = a.filter(Q(title__contains=search)|Q(desciption__contains=search))
|
||||
a = a.filter(Q(title__contains=search)|Q(desciption__contains=search)|Q(cate__name__contains=search))
|
||||
total = a.count()
|
||||
startnum,endnum=fenye(req)
|
||||
a = a.order_by('modifytime','downnum')[startnum:endnum].values('id','num','title','user__name','user__ubelongpart__partname','desciption','submittime','type','cate__name','url','downnum','modifytime')
|
||||
a = a.order_by('-modifytime','-downnum')[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')
|
||||
|
@ -118,7 +118,9 @@ def api(req):
|
|||
obj.deletemark=1
|
||||
obj.url=data['url']
|
||||
fileurl = data['url']
|
||||
if fileurl.endswith('.doc') or fileurl.endswith('.docx'):
|
||||
if fileurl.endswith('.mp4'):
|
||||
obj.type = 1
|
||||
elif fileurl.endswith('.doc') or fileurl.endswith('.docx'):
|
||||
obj.type = 2
|
||||
elif fileurl.endswith('.ppt') or fileurl.endswith('.pptx'):
|
||||
obj.type = 3
|
||||
|
|
|
@ -185,7 +185,7 @@
|
|||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'edu/api?a=addwj',
|
||||
url: 'edu/api?a=add',
|
||||
data: JSON.stringify(edudata),
|
||||
datatype: "json",
|
||||
processData: false,
|
||||
|
@ -200,7 +200,6 @@
|
|||
},
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
alert("数据保存!");
|
||||
$('#edutab').datagrid('reload');
|
||||
$("#dd").dialog("close");
|
||||
} else { $.messager.alert('提示', '失败!'); }
|
||||
|
|
|
@ -205,7 +205,6 @@
|
|||
},
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
alert("数据保存!");
|
||||
$('#edutab').datagrid('reload');
|
||||
$("#dd").dialog("close");
|
||||
} else { $.messager.alert('提示', '失败!'); }
|
||||
|
|
Loading…
Reference in New Issue