diff --git a/safesite/datashowview.py b/safesite/datashowview.py index ad133865..5e1ee4f2 100644 --- a/safesite/datashowview.py +++ b/safesite/datashowview.py @@ -22,6 +22,7 @@ from django.core.serializers.json import DjangoJSONEncoder from io import StringIO import operator import jwt + def area(req): userid = req.session['userid'] companyid = getcompany(userid) diff --git a/safesite/edu/views.py b/safesite/edu/views.py index 45b269f5..bb435930 100644 --- a/safesite/edu/views.py +++ b/safesite/edu/views.py @@ -22,7 +22,7 @@ from django.core.serializers.json import DjangoJSONEncoder from io import StringIO import operator import jwt -from ..views import getcompany,fenye,transjson,upfile +from ..views import apicheck_login, getcompany,fenye,transjson,upfile def index(req): return render(req,'edulessonindex.html') @@ -63,6 +63,8 @@ def selectDate(req): startnum,endnum=fenye(req) a = a.order_by('-submittime')[startnum:endnum].values('id','num','title','user__name','desciption','submittime','type','cate__name','url','downnum') return HttpResponse(transjson(total,a),content_type="application/json") + +@apicheck_login def api(req): a = req.GET.get('a') #首页列表 @@ -165,8 +167,12 @@ def api(req): obj.save() 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 + elif a=='watch_detail': + 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/export.py b/safesite/export.py index d562c156..0a109152 100644 --- a/safesite/export.py +++ b/safesite/export.py @@ -619,7 +619,7 @@ def exportxlsx(a,objs,pic=1): sheet.write(x,8,i['otherunsafe']) sheet.write(x,9,i['safecontent']) sheet.write(x,10,i['submittime'].strftime("%Y-%m-%d %H:%M:%S")) - i['lookimg']=i['lookimg'].split('?') + i['lookimg']=i['lookimg'].split('?') if i['lookimg'] else [] n = i['lookimg'] for m in n: if m: diff --git a/safesite/mgt/views.py b/safesite/mgt/views.py index e80a9a7e..321a1ea2 100644 --- a/safesite/mgt/views.py +++ b/safesite/mgt/views.py @@ -63,18 +63,19 @@ def api(req): userid = req.session['userid'] companyid = getcompany(userid) if a == 'add': - obj = Mgtsystem() - data = json.loads(req.body.decode('utf-8')) - obj.mgtname = data['mgtname'] - obj.mgtpath = data['filepath'] - obj.type= Dickey.objects.get(dickeyid=data['type']) - obj.publisdate=data['publisdate'] - obj.usecomp=Partment.objects.get(partid=companyid) - obj.createuser=User.objects.get(userid=userid) - obj.qrcode = makeqr_( - 'https://safeyun.ctcshe.com/miniprogram/mgt?id='+str(obj.id)) - obj.save() - return JsonResponse({"code":1}) + obj = Mgtsystem() + data = json.loads(req.body.decode('utf-8')) + obj.mgtname = data['mgtname'] + obj.mgtpath = data['filepath'] + obj.type= Dickey.objects.get(dickeyid=data['type']) + obj.publisdate=data['publisdate'] + obj.usecomp=Partment.objects.get(partid=companyid) + obj.createuser=User.objects.get(userid=userid) + obj.save() + obj.qrcode = makeqr_( + 'https://safeyun.ctcshe.com/miniprogram/mgt?id='+str(obj.id)) + obj.save() + return JsonResponse({"code":1}) elif a=='listall': startnum,endnum=fenye(req) diff --git a/safesite/templates/edulessonadd.html b/safesite/templates/edulessonadd.html index 1ea4a5c3..3071bc3b 100644 --- a/safesite/templates/edulessonadd.html +++ b/safesite/templates/edulessonadd.html @@ -251,8 +251,8 @@ var imagSize = fileObj.size; - if (imagSize > 1024 * 1024 * 10) { - alert("视频大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M,超出了上传大小," + "请选择10M以内的视频!"); + if (imagSize > 1024 * 1024 * 100) { + alert("视频大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M,超出了上传大小," + "请选择100M以内的视频!"); $("#videoName").text('文件太大了超出范围!'); return false; } diff --git a/safesite/templates/edulessondetail.html b/safesite/templates/edulessondetail.html index 9a2382d5..bd01cfa1 100644 --- a/safesite/templates/edulessondetail.html +++ b/safesite/templates/edulessondetail.html @@ -1,6 +1,6 @@ -