添加教师端控制评价标准的功能
This commit is contained in:
+4
-1
@@ -25,6 +25,7 @@ class CooperationMind(AbstractModel):
|
||||
deleted = models.BooleanField(verbose_name='是否标记为软删除', default=False)
|
||||
class_id = models.IntegerField(verbose_name='脑图所属课程id', null=False, blank=False, default=1)
|
||||
belong_to = models.TextField(verbose_name='所属课程-小组', default=json.dumps({'belong': []}))
|
||||
comment_type = models.TextField(verbose_name='评论分类', default=json.dumps({'type': []}))
|
||||
|
||||
class Meta:
|
||||
db_table = 'cooperation_mind'
|
||||
@@ -106,6 +107,7 @@ class StudentandTercher(AbstractModel):
|
||||
add_time = models.DateTimeField(verbose_name='添加时间', auto_now_add=True)
|
||||
class_info = models.CharField(verbose_name='课程信息', max_length=128, null=False, blank=False)
|
||||
class_status = models.CharField(verbose_name='课程状态', max_length=128, null=False, blank=False)
|
||||
comment_type = models.TextField(verbose_name='评论分类', default=json.dumps({'type': []}))
|
||||
|
||||
#
|
||||
class Task(AbstractModel):
|
||||
@@ -127,7 +129,8 @@ class Comment(models.Model): # 定义评论模型
|
||||
comment_time = models.DateTimeField(auto_now_add=True, verbose_name='评论时间')
|
||||
pre_comment = models.ForeignKey('self', on_delete=models.DO_NOTHING, null=True,
|
||||
verbose_name='父评论id') # 父级评论,如果没有父级则为空NULL, "self"表示外键关联自己
|
||||
|
||||
# comment_type = models.CharField(verbose_name='评论类型', max_length=1024, null=False, blank=False)
|
||||
# comment_type = models.TextField(verbose_name='评论类型', default=json.dumps({"type": []}))
|
||||
class Meta:
|
||||
db_table = 'comment_tb'
|
||||
verbose_name = '评论'
|
||||
|
||||
+12
-13
@@ -17,14 +17,14 @@ urlpatterns = [
|
||||
path('2_d', to_detail), # 跳转详情界面
|
||||
path('s_2_d', share_to_detail), # 从分享链接跳转详细界面
|
||||
path('2_share', to_share), # 到分享界面
|
||||
path('2_baiban',to_baiban), # 到协作白板
|
||||
path('2_echart',to_echarts), # 到图标界面
|
||||
path('chat_room',to_chat_room), # 到聊天室界面
|
||||
path('reng_wu',to_rengwu), # 到任务界面
|
||||
path('ke_cheng',to_kecheng), # 到课程界面
|
||||
path('2_write',to_write), # 到协同边界页面
|
||||
path('2_pinglun',to_pinglun), # 评论
|
||||
path('2_admin',to_admin), # 跳转到管理员页面
|
||||
path('2_baiban', to_baiban), # 到协作白板
|
||||
path('2_echart', to_echarts), # 到图标界面
|
||||
path('chat_room', to_chat_room), # 到聊天室界面
|
||||
path('reng_wu', to_rengwu), # 到任务界面
|
||||
path('ke_cheng', to_kecheng), # 到课程界面
|
||||
path('2_write', to_write), # 到协同边界页面
|
||||
path('2_pinglun', to_pinglun), # 评论
|
||||
path('2_admin', to_admin), # 跳转到管理员页面
|
||||
|
||||
|
||||
path('2_star', to_star), # 到收藏界面
|
||||
@@ -51,16 +51,15 @@ urlpatterns = [
|
||||
path('logout', LogoutView.as_view()), # 用户登出
|
||||
|
||||
# ---------------------------------------------------
|
||||
|
||||
path('tercher_upload_somthings',TeacherView.as_view()), # 老师端上传一些文件
|
||||
|
||||
# ---------------------------------------------------
|
||||
path('post_task/', post_task, name='post_task'),
|
||||
|
||||
path('post_kecheng/', post_kecheng, name='post_kecheng'),
|
||||
path('come_kecheng/',come_kecheng, name='come_kecheng'),
|
||||
path('comment_control/',comment_control,name='comment_control'), #提交评论处理的路由
|
||||
path('admin_fun/',admin_fun,name='admin_fun'),
|
||||
path('liuyan_fun/',liuyan_fun,name='liuyan_fun')
|
||||
path('come_kecheng/', come_kecheng, name='come_kecheng'),
|
||||
path('comment_control/', comment_control,name='comment_control'), #提交评论处理的路由
|
||||
path('admin_fun/', admin_fun,name='admin_fun'),
|
||||
path('liuyan_fun/', liuyan_fun,name='liuyan_fun')
|
||||
|
||||
]
|
||||
|
||||
+27
-3
@@ -1,10 +1,30 @@
|
||||
import json
|
||||
|
||||
from django.shortcuts import render
|
||||
from server.models import Task,StudentandTercher,Comment,Liuyan
|
||||
from server.models import Task,StudentandTercher,Comment,Liuyan,CooperationMind
|
||||
from server_auth.models import MindUser
|
||||
|
||||
|
||||
def front_comment(type):
|
||||
front_datas = []
|
||||
if len(type) == 0:
|
||||
return front_datas
|
||||
for i in range(len(type)):
|
||||
front_data = f"""
|
||||
<div class="rating">
|
||||
<h1>{type[i]}</h1>
|
||||
<input type="radio" name="rating{i}" id="5{i}" value="5" />
|
||||
<label for="5{i}"><i class="icon ion-md-star-outline"></i></label>
|
||||
<input type="radio" name="ratin{i}" id="4{i}" value="4" />
|
||||
<label for="4{i}"><i class="icon ion-md-star-outline"></i></label>
|
||||
<input type="radio" name="rating{i}" id="3{i}" value="3" />
|
||||
<label for="3{i}"><i class="icon ion-md-star-outline"></i></label>
|
||||
<input type="radio" name="rating{i}" id="2{i}" value="2" />
|
||||
<label for="2{i}"><i class="icon ion-md-star-outline"></i></label>
|
||||
<input type="radio" name="rating{i}" id="1{i}" value="1" />
|
||||
<label for="1{i}"><i class="icon ion-md-star-outline"></i></label>
|
||||
</div>"""
|
||||
front_datas.append(front_data)
|
||||
return front_datas
|
||||
def to_dashboard(request):
|
||||
"""
|
||||
主界面
|
||||
@@ -22,10 +42,14 @@ def to_baiban(request):
|
||||
return render(request, "html/baiban.html", param)
|
||||
|
||||
def to_pinglun(request):
|
||||
user = request.user
|
||||
test_date = request.GET.get('id')
|
||||
comment_list = Comment.objects.filter(pinglun_id=test_date) # 从数据库找出该文章的评论数据对象
|
||||
comment_type = CooperationMind.objects.get(id=test_date).comment_type # 找出对应的comment_type字段
|
||||
front_code = front_comment((json.loads(comment_type))['type'])
|
||||
param = {"path": test_date,
|
||||
"comment_list": comment_list}
|
||||
"comment_list": comment_list,
|
||||
"front_code": front_code}
|
||||
print(test_date)
|
||||
return render(request, "html/commont.html", param)
|
||||
|
||||
|
||||
@@ -131,6 +131,7 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
|
||||
data_format = 'node_tree'
|
||||
test_id = 0
|
||||
for item1, item2 in zipped_lists:
|
||||
comment_type = StudentandTercher.objects.get(class_name=item1).comment_type
|
||||
if (CooperationMind.objects.filter(coop_mind_name=str(item1 + "第" + str(item2) + "小组")).exists()):
|
||||
print("==========================================================")
|
||||
continue
|
||||
@@ -142,7 +143,7 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
|
||||
mind = CooperationMind(coop_mind_name=str(item1 + "第" + str(item2) + "小组"), client_uuid='',
|
||||
mind_log_id=-1,
|
||||
creator_user_id=user.id, snapshot_data=SNAPSHOT_JSON_DATA,
|
||||
data_format=data_format,belong_to=json.dumps({'belong':test}))
|
||||
data_format=data_format,belong_to=json.dumps({'belong':test}),comment_type=comment_type)
|
||||
mind.save()
|
||||
test_id = mind.id
|
||||
return build_response(data=test_id)
|
||||
|
||||
Reference in New Issue
Block a user