updata new code
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import time
|
||||
|
||||
from django.shortcuts import render
|
||||
from server.models import Task,StudentandTercher,Comment,Liuyan,CooperationMind
|
||||
@@ -137,6 +138,79 @@ def to_detail(request):
|
||||
param = {'id': request.GET.get('id')}
|
||||
return render(request, "html/detail.html", param)
|
||||
|
||||
def to_qunti(request):
|
||||
"""
|
||||
详情页面
|
||||
"""
|
||||
import re
|
||||
import random
|
||||
def remove_digits(s):
|
||||
return re.sub(r'\d+', '', s)
|
||||
param = {'id': request.GET.get('id')}
|
||||
name = CooperationMind.objects.get(id=request.GET.get('id')).coop_mind_name
|
||||
kecheng = json.loads(CooperationMind.objects.get(id=request.GET.get('id')).belong_to)
|
||||
# 获取Student的所有记录
|
||||
student = []
|
||||
data = []
|
||||
xyz = []
|
||||
xyz2 = []
|
||||
all_student = MindUser.objects.all()
|
||||
# 遍历所有记录
|
||||
for stu in all_student:
|
||||
class_name = json.loads(stu.select_class)['class']
|
||||
xiaozu = json.loads(stu.select_xiaozu)['xiaozu']
|
||||
test = zip(class_name, xiaozu)
|
||||
# xiaozu = MindUser.objects.get(username=username).select_xiaozu
|
||||
# kz = MindUser.objects.get(username=username).select_class
|
||||
# xiaozu = json.loads(xiaozu)['xiaozu']
|
||||
# kc = json.loads(kz)['class']
|
||||
# test = zip(kc, xiaozu)
|
||||
# it3 = []
|
||||
# for it1, it2 in test:
|
||||
# it3.append(str(it1) + "课程" + str(it2) + "小组")
|
||||
it3 = []
|
||||
for it1, it2 in test:
|
||||
it3.append(str(it1) + "第" + str(it2) + "小组")
|
||||
if name in it3:
|
||||
student.append(stu.username)
|
||||
data.append([random.uniform(110,150),random.uniform(100,150),random.uniform(100,150),random.uniform(90,150),random.uniform(90,150)])
|
||||
xyz.append(random.uniform(300,800))
|
||||
xyz2.append(random.uniform(200,600))
|
||||
sui1 = []
|
||||
sui2 = []
|
||||
sui3 = []
|
||||
sui4 = []
|
||||
sui5 = []
|
||||
sui6 = []
|
||||
sui7 = []
|
||||
sui8 = []
|
||||
sui9 = []
|
||||
for i in range(len(student)):
|
||||
sui1.append(random.uniform(200, 600))
|
||||
sui2.append(random.uniform(100, 400))
|
||||
sui3.append(random.uniform(300, 700))
|
||||
sui4.append(random.uniform(200, 600))
|
||||
sui5.append(random.uniform(500, 900))
|
||||
sui6.append(random.uniform(700, 600))
|
||||
sui7.append(random.uniform(200, 300))
|
||||
sui8.append(random.uniform(600, 900))
|
||||
sui9.append(random.uniform(100, 200))
|
||||
|
||||
|
||||
print(remove_digits(kecheng['belong'][0]))
|
||||
datas = zip(student,data)
|
||||
datas2 = zip(student,data)
|
||||
datas3 = zip(student,xyz,xyz2)
|
||||
student2 = student[:]
|
||||
student3 = student[:]
|
||||
random.shuffle(student2)
|
||||
random.shuffle(student3)
|
||||
|
||||
student4 = zip(student,student3)
|
||||
|
||||
return render(request, "html/echats.html", {"param":param,"name":name,"student":student,"datas":datas,"datas2":datas2,"datas3":datas3,"student4"
|
||||
:student4,"sui1":sui1,"sui2":sui2,"sui3":sui3,"sui4":sui4,"sui5":sui5,"sui6":sui6,"sui7":sui7,"sui8":sui8,"sui9":sui9})
|
||||
|
||||
|
||||
def share_to_detail(request):
|
||||
"""
|
||||
|
||||
@@ -83,6 +83,8 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
|
||||
# bb = bb + "|" + str(aa[i + 1])
|
||||
if len(aa) -1 == 0:
|
||||
self.queryset = aa[0]
|
||||
elif len(aa) == 0:
|
||||
self.queryset = 0
|
||||
else:
|
||||
for i in range(len(aa) -1):
|
||||
if i == 0:
|
||||
@@ -301,8 +303,29 @@ class JsMindbianjiView(LoginRequiredJSONMixin, ListAPIView):
|
||||
|
||||
res = f"http://106.54.50.78/2_baiban?test={id}"
|
||||
return build_response(msg="操作成功", data=res)
|
||||
class JsMindquntiView(LoginRequiredJSONMixin, ListAPIView):
|
||||
"""
|
||||
思维导图分享view
|
||||
"""
|
||||
serializer_class = CooperationMindShareSerializer
|
||||
filter_backends = [DjangoFilterBackend]
|
||||
filter_class = CooperationMindShareFilter
|
||||
pagination_class = DefaultNumberPagination
|
||||
|
||||
def post(self, request):
|
||||
"""
|
||||
点击协同编辑
|
||||
"""
|
||||
post_body = request.POST
|
||||
id = post_body.get('id')
|
||||
user = request.user
|
||||
if id is None:
|
||||
return build_response(code=CODE_FAILED, msg='参数错误')
|
||||
if user.id is None:
|
||||
return build_response(code=CODE_FAILED, msg='用户未登录')
|
||||
|
||||
res = f"http://106.54.50.78/2_baiban?test={id}"
|
||||
return build_response(msg="操作成功", data=res)
|
||||
class JsMindpinglunView(LoginRequiredJSONMixin, ListAPIView):
|
||||
"""
|
||||
思维导图分享view
|
||||
|
||||
Reference in New Issue
Block a user