添加剩余所有功能

This commit is contained in:
2024-05-08 03:53:12 +08:00
parent e48d34c52c
commit 47b1820760
17 changed files with 2929 additions and 26 deletions
+13
View File
@@ -132,3 +132,16 @@ class Comment(models.Model): # 定义评论模型
db_table = 'comment_tb' db_table = 'comment_tb'
verbose_name = '评论' verbose_name = '评论'
verbose_name_plural = verbose_name verbose_name_plural = verbose_name
class Liuyan(models.Model): # 定义留言板模型
# article = models.ForeignKey(to=Article, on_delete=models.DO_NOTHING, verbose_name='评论文章')
liuyan_id = models.IntegerField(verbose_name='留言给谁了')
liuyan_content = models.TextField(verbose_name='留言内容')
user = models.ForeignKey(MindUser, on_delete=models.CASCADE) #留言人id
liuyan_time = models.DateTimeField(auto_now_add=True, verbose_name='留言时间')
class Meta:
db_table = 'liuyan_tb'
verbose_name = '留言'
verbose_name_plural = verbose_name
+8 -2
View File
@@ -24,11 +24,15 @@ urlpatterns = [
path('ke_cheng',to_kecheng), # 到课程界面 path('ke_cheng',to_kecheng), # 到课程界面
path('2_write',to_write), # 到协同边界页面 path('2_write',to_write), # 到协同边界页面
path('2_pinglun',to_pinglun), # 评论 path('2_pinglun',to_pinglun), # 评论
path('2_admin',to_admin), # 跳转到管理员页面
path('2_star', to_star), # 到收藏界面 path('2_star', to_star), # 到收藏界面
path('2_recycle', to_recycle), # 回收站 path('2_recycle', to_recycle), # 回收站
path(r'jsmind_op', JsMindLogView.as_view()), # 更新快照,get日志操作 path('2_information', to_information), # 个人信息
path('2_liuyan', to_liuyan), # 留言
path(r'jsmind_op', JsMindLogView.as_view()), # 更新快照,get日志操作
# --------------------------------------------------- # ---------------------------------------------------
path('create', JsMindView.as_view()), # 创建思维导图 path('create', JsMindView.as_view()), # 创建思维导图
path('list', JsMindView.as_view()), # 查询思维导图 path('list', JsMindView.as_view()), # 查询思维导图
@@ -55,6 +59,8 @@ urlpatterns = [
path('post_kecheng/', post_kecheng, name='post_kecheng'), path('post_kecheng/', post_kecheng, name='post_kecheng'),
path('come_kecheng/',come_kecheng, name='come_kecheng'), path('come_kecheng/',come_kecheng, name='come_kecheng'),
path('comment_control/',comment_control,name='comment_control') #提交评论处理的路由 path('comment_control/',comment_control,name='comment_control'), #提交评论处理的路由
path('admin_fun/',admin_fun,name='admin_fun'),
path('liuyan_fun/',liuyan_fun,name='liuyan_fun')
] ]
+36 -1
View File
@@ -1,7 +1,7 @@
import json import json
from django.shortcuts import render from django.shortcuts import render
from server.models import Task,StudentandTercher,Comment from server.models import Task,StudentandTercher,Comment,Liuyan
from server_auth.models import MindUser from server_auth.models import MindUser
@@ -29,6 +29,14 @@ def to_pinglun(request):
print(test_date) print(test_date)
return render(request, "html/commont.html", param) return render(request, "html/commont.html", param)
def to_admin(request):
username = request.user
# supper = MindUser.objects.filter(username=username).type_t_or_s
if username.type_t_or_s == 3:
datas = MindUser.objects.filter(type_t_or_s=2)
return render(request, "html/admin.html",{"datas":datas})
else:
return render(request, "html/dashboard.html")
def to_share(request): def to_share(request):
""" """
分享页面 分享页面
@@ -116,3 +124,30 @@ def teacher_login(request):
""" """
param = {'id': request.GET.get('id')} param = {'id': request.GET.get('id')}
return render(request, "html/login.html", param) return render(request, "html/login.html", param)
def to_information(request):
"""
个人信息页面
"""
param = {"page": "recycle"}
username = request.user
datas = MindUser.objects.filter(username=username)
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) + "小组")
return render(request, "html/informations.html", {"datas":datas,"it3":it3})
def to_liuyan(request):
"""
留言板页面
"""
# param = {"page": "recycle"}
datas = MindUser.objects.all()
liuyans = Liuyan.objects.filter(liuyan_id=request.user.id)
return render(request, "html/liuyan.html", {"datas":datas,"liuyans":liuyans})
+39 -12
View File
@@ -13,7 +13,7 @@ from django.shortcuts import render
from server.taskform import TaskForm from server.taskform import TaskForm
from django.utils import timezone from django.utils import timezone
from server.models import Task,StudentandTercher,MindUser from server.models import Task,StudentandTercher,MindUser,Liuyan
from server.serializers import * from server.serializers import *
import json import json
@@ -59,6 +59,11 @@ class LoginView(APIView):
# 记住登录状态 # 记住登录状态
login(request, user) login(request, user)
return build_response(msg='学生端登录成功') return build_response(msg='学生端登录成功')
elif user.is_active and user.type_t_or_s == 3:
# 记住登录状态
# 记住登录状态
login(request, user)
return build_response(msg='管理员登录成功')
else: else:
return build_response(code=CODE_FAILED, msg='登录失败') return build_response(code=CODE_FAILED, msg='登录失败')
else: else:
@@ -134,10 +139,8 @@ class TeacherView(LoginRequiredJSONMixin,APIView):
def post_task(request): def post_task(request):
if request.method == 'POST': if request.user.type_t_or_s == 1:
if request.user.type_t_or_s == 2: if request.method == 'POST':
return render(request, 'html/error.html')
else:
start_time = timezone.now() start_time = timezone.now()
title = request.POST.get("title") title = request.POST.get("title")
description = request.POST.get("description") description = request.POST.get("description")
@@ -145,26 +148,29 @@ def post_task(request):
rengwu = Task(title=title, description=description, publish_time=start_time, deadline=end_time,publisher=request.user) rengwu = Task(title=title, description=description, publish_time=start_time, deadline=end_time,publisher=request.user)
rengwu.save() rengwu.save()
return http.JsonResponse({'code': CODE_SUCCESS, 'msg': '发布成功'}) return http.JsonResponse({'code': CODE_SUCCESS, 'msg': '发布成功'})
else:
return render(request, 'html/post_task.html')
else: else:
return render(request, 'html/post_task.html') return render(request, 'html/dashboard.html')
def post_kecheng(request): def post_kecheng(request):
if request.method == 'POST': if request.user.type_t_or_s == 1:
if request.user.type_t_or_s == 2: if request.method == 'POST':
return render(request, 'html/error.html')
else:
add_time = timezone.now() add_time = timezone.now()
class_id = request.POST.get("class_id") class_id = request.POST.get("class_id")
class_name = request.POST.get("class_name") class_name = request.POST.get("class_name")
tercher_name = request.POST.get("tercher_name") tercher_name = request.POST.get("tercher_name")
class_info = request.POST.get("class_info") class_info = request.POST.get("class_info")
class_status = request.POST.get("class_status") class_status = request.POST.get("class_status")
rengwu = StudentandTercher(add_time=add_time,class_id=class_id, class_name=class_name, rengwu = StudentandTercher(add_time=add_time, class_id=class_id, class_name=class_name,
tercher_name=tercher_name, class_info=class_info, class_status=class_status) tercher_name=tercher_name, class_info=class_info, class_status=class_status)
rengwu.save() rengwu.save()
return http.JsonResponse({'code': CODE_SUCCESS, 'msg': '发布成功'}) return http.JsonResponse({'code': CODE_SUCCESS, 'msg': '发布成功'})
else:
return render(request, 'html/post_kecheng.html')
else: else:
return render(request, 'html/post_kecheng.html') return render(request, 'html/dashboard.html')
def come_kecheng(request): def come_kecheng(request):
if request.method == 'POST': if request.method == 'POST':
@@ -206,4 +212,25 @@ def comment_control(request): # 提交评论的处理函数
return JsonResponse(article, safe=False) # JsonResponse返回JSON字符串,自动序列化,如果不是字典类型,则需要添加safe参数为False return JsonResponse(article, safe=False) # JsonResponse返回JSON字符串,自动序列化,如果不是字典类型,则需要添加safe参数为False
def admin_fun(request): # 提交评论的处理函数
if request.method == 'POST':
id = request.POST.get('user_id')
MindUser.objects.filter(id=id).update(type_t_or_s=1)
print(id)
return http.JsonResponse({'code': CODE_SUCCESS, 'msg': '修改成功'})
else:
return http.JsonResponse({'code': CODE_FAILED, 'msg': '修改失败'})
def liuyan_fun(request): # 提交留言的处理函数
if request.method == 'POST':
username = request.user.username
userid = MindUser.objects.get(username=username).id
print("-----------------")
print(userid)
id = request.POST.get('user_id')
liuyan = request.POST.get('liuyan_con')
Liuyan.objects.create(liuyan_id=id,user_id=userid,liuyan_content=liuyan,liuyan_time=timezone.now())
return http.JsonResponse({'code': CODE_SUCCESS, 'msg': '留言成功'})
else:
return http.JsonResponse({'code': CODE_FAILED, 'msg': '修改失败'})
+1
View File
@@ -11,6 +11,7 @@ class MindUser(AbstractUser):
sex_type = ( sex_type = (
(1, "老师"), (1, "老师"),
(2, "学生"), (2, "学生"),
(3, "管理员")
) )
type_t_or_s = models.SmallIntegerField(verbose_name="学生身份还是老师身份", choices=sex_type, default="2") type_t_or_s = models.SmallIntegerField(verbose_name="学生身份还是老师身份", choices=sex_type, default="2")
class_id = models.IntegerField(verbose_name='课程ID', null=True, blank=True) class_id = models.IntegerField(verbose_name='课程ID', null=True, blank=True)
+658
View File
@@ -0,0 +1,658 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>协作学习投入智能干预平台(学生端)</title>
<link rel="shortcut icon" href="/static/abl1b-qks1b-001.ico"/>
<link rel="stylesheet" type="text/css" href="/static/css/dashboard.css">
<link rel="stylesheet" type="text/css" href="/static/bootstrap-4.6.1-dist/css/bootstrap.css">
<!--script start-->
<script src="/static/js/jquery-1.11.3.min.js"></script>
<script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="/static/bootstrap-4.6.1-dist/js/bootstrap.bundle.js"></script> <!-- bootstrap.bundle.min.js,还包含了 Popper,用于支持工具提示(tooltip)和弹出框(popover)功能,但是不包含 jQuery。-->
<script src="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.js"></script> <!-- 图标相关-->
<script src="/static/js/mind/c_m_m.js"></script>
<script>
const DefaultView = function () {
this.websocket = null
this.uuid = (new Date().getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16)
this.current_page_num = 1
this.default_page_size = 15
this.title_map = new Map([["main", "我的文件"], ["share", "我的分享"], ["star", "我的收藏"], ["recycle", "回收站"]]);// k-v 的形式
}
DefaultView.prototype = {
/**界面初始化*/
init_view: function () {
const uid = $('#uid').html()
// 未登录
if (!uid || isNaN(uid)) {
$('#login_register').show()
setTimeout(function () {
$('#login_register').click()
}, 500)
$('#logout_a').hide()
$('#newMindModal_btn').hide()
} else {
$('#login_register').hide()
$('#logout_a').show()
}
// 判断页面
const page_tag = this.get_page_tag()
$('#main h5').html(this.title_map.get(page_tag))
},
get_uu_id: function () {
return (new Date().getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16)
},
/**注销登录*/
logout_: function () {
$.ajax({
type: "post",
url: "logout",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'xx': 'xx'},
dataType: "json",
success: function (data) {
common_alert(data.msg)
setTimeout(function () {
location.reload();
}, 1000)
},
async: false
});
},
/**获得源页面*/
get_page_tag: function () {
return $('#src_page').html()
},
/**获得导图*/
fetch_mind: function (current_page, page_size) {
const me = this
if (!current_page) {
current_page = me.current_page_num
}
if (!page_size) {
page_size = me.default_page_size
}
me.current_page_num = current_page
// 获得跳转源页面
const page_tag = me.get_page_tag()
$.ajax({
type: `get`,
url: `list?page=${current_page}&page_size=${page_size}&s_p=${page_tag}`,
headers: {"X-CSRFToken": $.cookie("csrftoken")},
dataType: "json",
success: function (resp) {
if (resp.code !== 0) {
return
}
// clear container-fluid
$('main .container-fluid').empty()
// 解析结果
const results = resp.results
let idx = 0
let row = $(`<div class="row"></row>`)
results.forEach(function (item) {
const uuid = me.get_uu_id()
// 添加按钮组
let sub_btn = '';
if (page_tag === 'b9b101e') {
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="window.open('2_d?id=${item.id}&s_p=b9b101e')">编辑</a>
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_mind(${item.id},'card_${uuid}')">删除</a>
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.share_mind(${item.id})">分享</a>`
} else if (page_tag === 'share') {
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.share_cancel(${item.id})">取消分享</a>
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.fetch_share_info(${item.id})">查看分享链接</a>`
} else if (page_tag === 'star') {
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.un_star(${item.id})">取消收藏</a>`
} else if (page_tag === 'recycle') {
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_cancel(${item.id})">恢复</a>
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_final(${item.id})">彻底删除</a>`
}
const content = `<div class="card col-2" style="margin: 6px; margin-left: 20px;" id='card_${uuid}'>
<div class="card-body">
<div class="card-title" style="margin-bottom: 0px;font-weight:bold;text-overflow:ellipsis;white-space:nowrap;overflow: hidden;">${item.coop_mind_name}</div>
<hr style="margin: 0">
<img src="/static/pic/demo_icon.png" class="card-img-top" style="margin-top: 8px;cursor: pointer;" onclick="window.open('2_d?id=${item.id}&s_p=b9b101e')">
<div style="text-align:right;font-size: 0.8rem;margin-top: 5px;font-family: inherit;">
<div class="btn-group btn-group-sm" role="group">
<button id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">操作</button>
<div class="dropdown-menu" aria-labelledby="btnGroupDrop1">${sub_btn}</div>
</div>
</div>
</div>
</div>`
row.append(content)
})
// 如果不是3的整数倍,将剩余的添加
$('main .container-fluid').append(row)
me.init_pagination(resp.count, me.default_page_size)
// success end
},
async: false
});
},
/**显示分享链接*/
show_share_url: function (u, h) {
const url = `s_2_d?u=${u}&h=${h}`
$('#share_mind_modal .modal-body').html(`分享成功,请复制以下链接进行分享:<div>${window.location.protocol}//${window.location.host}/${url}</div>`)
$('#share_mind_modal_a').click()
},
/**分页组件*/
init_pagination: function (count, page_size) {
const container = $('#pagination_div')
/**计算页数*/
if (count <= 0) {
container.html(`<p class="text-center">无数据</p>`)
return
}
const all_page = (count <= page_size) ? 1 : (count % page_size > 0) ? Math.floor(count / page_size) + 1 : Math.floor(count / page_size)
const navigation = $(`<nav aria-label="Page navigation example"></nav>`)
const navigation_ul = $(`<ul class="pagination justify-content-center"></ul>`)
if (this.current_page_num > 1) {
navigation_ul.append(`<li class="page-item"><a class="page-link" href="javascript:void(0)" onclick="mind.fetch_mind(mind.current_page_num-1)">上一页</a></li>`)
}
for (let i = 0; i < all_page; i++) {
const ctt = $(`<li class="page-item"><a class="page-link" href="javascript:void(0)" onclick="mind.fetch_mind(${i + 1})">${i + 1}</a></li>`)
if (i + 1 === this.current_page_num) {
ctt.addClass('active')
}
navigation_ul.append(ctt)
}
if (this.current_page_num < all_page) {
navigation_ul.append(`<li class="page-item"><a class="page-link" href="javascript:void(0)" onclick="mind.fetch_mind(mind.current_page_num+1)">下一页</a></li>`)
}
navigation.append(navigation_ul)
container.empty()
container.append(navigation)
},
/**删除导图*/
del_mind: function (mind_id, card_id) {
const me = this
$.ajax({
type: "delete",
url: "delete",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'coop_mind_id': mind_id, 'source': 'dashboard'},
dataType: "json",
success: function (data) {
if (data.code === 0) {
primary_alert(data.msg)
// $('#' + card_id).remove()
setTimeout(function () {
me.fetch_mind()
}, 1000)
} else {
common_alert(data.msg)
}
},
async: false
});
},
/**分享脑图*/
share_mind: function (mind_id) {
const me = this
$.ajax({
type: "post",
url: "share",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'id': mind_id},
dataType: "json",
success: function (resp) {
me.show_share_url(`${resp.data.u}`, `${resp.data.h}`)
},
async: false
});
},
/**取消分享*/
share_cancel: function (mind_id) {
const me = this
$.ajax({
type: "delete",
url: "share",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'id': mind_id},
dataType: "json",
success: function (resp) {
if (me.is_success_resp(resp)) {
location.reload()
} else {
common_alert(resp.msg)
}
},
async: false
});
},
/** 删除恢复*/
del_cancel: function (mind_id) {
const me = this
$.ajax({
type: "post",
url: "delete_cancel",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'coop_mind_id': mind_id, 'op_type': 'delete_cancel'},
dataType: "json",
success: function (resp) {
common_alert(resp.msg)
if (me.is_success_resp(resp)) {
me.fetch_mind()
}
},
async: false
});
},
/**彻底删除*/
del_final: function (mind_id) {
const me = this
$.ajax({
type: "delete",
url: "delete",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'coop_mind_id': mind_id, 'source': 'recycle'},
dataType: "json",
success: function (resp) {
common_alert(resp.msg)
if (me.is_success_resp(resp)) {
me.fetch_mind()
}
},
async: false
});
},
/** 取消收藏 */
un_star: function (mind_id) {
const me = this
$.ajax({
type: "delete",
url: "star",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'coop_mind_id': mind_id},
dataType: "json",
success: function (resp) {
common_alert(resp.msg)
if (me.is_success_resp(resp)) {
me.fetch_mind()
}
},
async: false
});
},
/**获得分享信息*/
fetch_share_info: function (mind_id) {
const me = this
$.ajax({
type: "get",
url: "share",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'coop_mind_id': mind_id},
dataType: "json",
success: function (resp) {
if (me.is_success_resp(resp)) {
const data = resp.data
me.show_share_url(data.share_uuid, data.share_uuid_hash)
} else {
common_alert(resp.msg)
}
},
async: false
});
},
is_success_resp(resp) {
return resp.code === 0
},
/** 清除注册时输入内容 */
clear_reg_info: function () {
$('#userName').val('');
$('#inputPassword').val('');
$('#inputPassword_').val('');
},
/**校验密码是否输入一致*/
validate_pw_eq: function (obj, inputPassword, inputPassword_) {
if (inputPassword !== inputPassword_) {
common_alert('两次密码输入不一样,请确认!')
return false
}
return true
},
/** 设置窗口名称 */
set_modal_title: function (title) {
$('#exampleModal .modal-title').html(title);
},
/************************************************************************************************/
/**初始化jquery监听*/
jq_listener_init: function () {
const me = this
/**监听modal窗口事件*/
$('#exampleModal').on('show.bs.modal', function (event) {
const ws = new WebSocket(`ws://${window.location.host}/ws/qr/?${me.uuid}`)
ws.onmessage = function (e) {
console.log('接收到websocket消息:' + e.data)
}
me.websocket = ws
});
$('#exampleModal').on('hidden.bs.modal', function (event) {
// console.log('关闭');
if (me.websocket) {
me.websocket.close()
}
});
/**点击 扫码登录 */
$('#s_login_a').click(function () {
$('.modal-body').hide();
$('.qr_login_group').show();
me.set_modal_title('登录');
})
// 点击注册控件
$('#register_a').click(function () {
$('.modal-body').hide();
$('.register_group').show();
me.set_modal_title('注册');
})
// 用户名密码登录
$('#p_login_a').click(function () {
$('.modal-body').hide();
$('.pw_login_group').show();
me.set_modal_title('登录');
})
/** 注册按钮 */
$('#register_button').click(function () {
const userName = $('#userName').val();
const inputPassword = $('#inputPassword').val();
const inputPassword_ = $('#inputPassword_').val();
if (!userName) {
common_alert('请输入用户名')
return
}
if (!inputPassword) {
common_alert('请输入密码')
return
}
// 校验输入是否一致
const validate = me.validate_pw_eq(this, inputPassword, inputPassword_)
if (validate) {
$.ajax({
type: "post",
url: "register",
data: {userName: userName, inputPassword: inputPassword},
dataType: "json",
success: function (data) {
// 注册成功
if (data.code === 0) {
me.clear_reg_info()
common_alert(data.msg, 'alert-primary')
setTimeout(function () {
$('#p_login_a').click()
}, 1500)
} else {
// 注册失败
common_alert(data.msg)
}
},
async: false
});
}
// validate end
});
/**登录按钮*/
$('#login_button').click(function () {
const userName_login = $('#userName_login').val();
const inputPassword_login = $('#inputPassword_login').val();
if (!userName_login || !inputPassword_login) {
common_alert('请输入用户名和密码')
return
}
$.ajax({
type: "post",
url: "login",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {username: userName_login, password: inputPassword_login},
dataType: "json",
success: function (data) {
// 登录成功
if (data.code === 0) {
common_alert(data.msg, 'alert-primary')
$('#exampleModal').modal('hide')
setTimeout(function () {
location.reload();
}, 500)
} else {
// 登录失败
common_alert(data.msg)
}
},
async: false
});
})
/**新建导图*/
$('#new_mind_btn').click(function () {
const mind_name = $('#mindName').val()
if (!mind_name) {
common_alert('请输入导图名称')
return
}
const post_data = {'mind_name': mind_name}
$.ajax({
type: "post",
url: "create",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: post_data,
dataType: "json",
success: function (resp) {
if (resp.code === 0) {
me.fetch_mind()
$('#newMindModal').modal('hide')
if ($('#exampleCheck1').prop("checked")) {
/**新页面打开*/
setTimeout(function () {
const id = resp.data
window.open('2_d?id=' + id + `&s_p=b9b101e`)
}, 500)
}
} else {
common_alert(resp.msg)
}
},
async: false
});
})
/** 新建后打开复选框勾选事件*/
$('#exampleCheck1').change(function () {
const checked = $(this).prop("checked")
$.cookie('open_aft_create', checked, {expires: 7, path: '/'});
})
/** 创建导图modal 显示完毕后事件*/
$('#newMindModal').on('shown.bs.modal', function () {
const cookie_checked_ = $.cookie('open_aft_create')
$('#mindName').val('')
// 从cookie中获得的是字符串
if (cookie_checked_ === 'true') {
$('#exampleCheck1').attr('checked', 'checked')
} else {
$('#exampleCheck1').removeAttr('checked');
}
})
/************************************* jq_listener_init end *******************************************/
}
/** prototype end **/
}
$(function () {
const view = new DefaultView()
/**初始化*/
view.init_view()
view.jq_listener_init()
/**如果已经登录则查询列表*/
view.fetch_mind()
window.mind = view
// js end
})
</script>
<!--script end-->
</head>
<body>
<div style="display: none;">
<span id="uid">{{ user.id }}</span>
<span id="src_page">{{ page }}</span>
</div>
<!-- 页眉 start-->
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
<a class="navbar-brand col-md-2 col-lg-2 mr-0 px-3" href="#">协作学习投入智能干预平台(学生端)</a>
<ul class="navbar-nav px-3">
<li class="nav-item text-nowrap">
<a id="login_register" class="nav-link" href="#" data-toggle="modal" data-target="#exampleModal">登录/注册</a>
<a id="logout_a" class="nav-link" href="javascript:void(0)" onclick="mind.logout_()" style="display: none;">注销</a>
<a id="share_mind_modal_a" class="nav-link" href="#" data-toggle="modal" data-target="#share_mind_modal" style="display: none;"></a>
</li>
</ul>
</nav>
<!-- 页眉 end-->
<!--菜单 和 内容 start-->
<div class="container-fluid">
<div class="row">
<!-- 左侧菜单 start-->
<nav id="sidebarMenu" class="col-md-2 col-lg-2 d-md-block bg-light">
<div class="sidebar-sticky pt-3">
<hr/>
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link active" href="/">
<span data-feather="file-text"></span>
课程/小组信息
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_star">
<span data-feather="star"></span>
协作收藏
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_echart">
<span data-feather="star"></span>
学习分析图
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/chat_room">
<span data-feather="star"></span>
聊天室
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/reng_wu">
<span data-feather="star"></span>
任务详情
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/ke_cheng">
<span data-feather="star"></span>
课程页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/post_task/">
<span data-feather="star"></span>
任务发布页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/post_kecheng/">
<span data-feather="star"></span>
课程发布页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_information">
<span data-feather="star"></span>
个人信息
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_admin">
<span data-feather="star"></span>
管理员页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_liuyan">
<span data-feather="star"></span>
留言板
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_recycle">
<span data-feather="trash-2"></span>
回收站
</a>
</li>
</ul>
</div>
</nav>
<!-- 左侧菜单 end-->
<main class="col-md-10 ml-sm-auto col-lg-10 px-md-4">
<h1 style="margin-left: 500px">admin管理员界面</h1>
<table class="table" style="margin-left: 50px; width: 1100px">
<tr style="text-align: center;" >
<td><h6>用户名</h6></td>
<td><h6>加入时间</h6></td>
<td><h6>操作</h6></td>
</tr>
{% for data in datas %}
<tbody>
<tr style="text-align: center;" >
<td>{{data.username}}</td>
<td>{{data.date_joined}}</td>
<td><form method="post" action="{% url 'admin_fun' %}" >
{% csrf_token %}
<input style = "display:none" name="user_id" value="{{data.id}}">
<button type="submit">修改此用户为教师</button></form>
</td>
</form>
</tr>
</tbody>
{% endfor %}
</table>
</main>
<!-- 右侧内容 start-->
<!-- 右侧内容 end-->
</div>
</div>
<!--导航 和 内容 end-->
</body>
<script src="/static/js/mind/modal.js"></script>
<script src="/static/js/echarts.js"></script>
<script>
if (window.feather) {
window.feather.replace();
}
</script>
</html>
+19 -1
View File
@@ -588,9 +588,27 @@
<span data-feather="star"></span> <span data-feather="star"></span>
课程发布页面 课程发布页面
</a> </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_information">
<span data-feather="star"></span>
个人信息
</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#"> <a class="nav-link" href="/2_admin">
<span data-feather="star"></span>
管理员页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_liuyan">
<span data-feather="star"></span>
留言板
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_recycle">
<span data-feather="trash-2"></span> <span data-feather="trash-2"></span>
回收站 回收站
</a> </a>
+38 -1
View File
@@ -647,6 +647,24 @@
<span data-feather="star"></span> <span data-feather="star"></span>
课程发布页面 课程发布页面
</a> </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_information">
<span data-feather="star"></span>
个人信息
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_admin">
<span data-feather="star"></span>
管理员页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_liuyan">
<span data-feather="star"></span>
留言板
</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/2_recycle"> <a class="nav-link" href="/2_recycle">
@@ -658,7 +676,6 @@
</div> </div>
</nav> </nav>
<!-- 左侧菜单 end--> <!-- 左侧菜单 end-->
<!-- 右侧内容 start--> <!-- 右侧内容 start-->
<main role="main" class="col-md-10 ml-sm-auto col-lg-10 px-md-4" id="main"> <main role="main" class="col-md-10 ml-sm-auto col-lg-10 px-md-4" id="main">
<div style="margin-bottom: 0px;" class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom"> <div style="margin-bottom: 0px;" class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
@@ -695,4 +712,24 @@
window.feather.replace(); window.feather.replace();
} }
</script> </script>
<script>
var timer; // 定义一个变量来存储setTimeout返回的计时器ID
// 检测用户操作函数
function resetTimer() {
clearTimeout(timer); // 清除之前的计时器
timer = setTimeout(function() {
// 当用户无操作30秒后执行的代码,比如显示弹窗
alert('您已经30秒没有操作了!');
}, 30000); // 设置30秒后执行上面的函数
}
// 页面加载完成后开始计时
$(document).ready(function() {
resetTimer(); // 初始化计时器
// 绑定各种事件来重置计时器
$(document).on('mousemove keydown click', resetTimer);
});
</script>
</html> </html>
+19 -1
View File
@@ -588,9 +588,27 @@
<span data-feather="star"></span> <span data-feather="star"></span>
课程发布页面 课程发布页面
</a> </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_information">
<span data-feather="star"></span>
个人信息
</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#"> <a class="nav-link" href="/2_admin">
<span data-feather="star"></span>
管理员页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_liuyan">
<span data-feather="star"></span>
留言板
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_recycle">
<span data-feather="trash-2"></span> <span data-feather="trash-2"></span>
回收站 回收站
</a> </a>
File diff suppressed because it is too large Load Diff
+19 -1
View File
@@ -595,9 +595,27 @@
<span data-feather="star"></span> <span data-feather="star"></span>
课程发布页面 课程发布页面
</a> </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_information">
<span data-feather="star"></span>
个人信息
</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#"> <a class="nav-link" href="/2_admin">
<span data-feather="star"></span>
管理员页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_liuyan">
<span data-feather="star"></span>
留言板
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_recycle">
<span data-feather="trash-2"></span> <span data-feather="trash-2"></span>
回收站 回收站
</a> </a>
+686
View File
@@ -0,0 +1,686 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>协作学习投入智能干预平台(学生端)</title>
<link rel="shortcut icon" href="/static/abl1b-qks1b-001.ico"/>
<link rel="stylesheet" type="text/css" href="/static/css/dashboard.css">
<link rel="stylesheet" type="text/css" href="/static/bootstrap-4.6.1-dist/css/bootstrap.css">
<!--script start-->
<script src="/static/js/jquery-1.11.3.min.js"></script>
<script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="/static/bootstrap-4.6.1-dist/js/bootstrap.bundle.js"></script> <!-- bootstrap.bundle.min.js,还包含了 Popper,用于支持工具提示(tooltip)和弹出框(popover)功能,但是不包含 jQuery。-->
<script src="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.js"></script> <!-- 图标相关-->
<script src="/static/js/mind/c_m_m.js"></script>
<script>
const DefaultView = function () {
this.websocket = null
this.uuid = (new Date().getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16)
this.current_page_num = 1
this.default_page_size = 15
this.title_map = new Map([["main", "我的文件"], ["share", "我的分享"], ["star", "我的收藏"], ["recycle", "回收站"]]);// k-v 的形式
}
DefaultView.prototype = {
/**界面初始化*/
init_view: function () {
const uid = $('#uid').html()
// 未登录
if (!uid || isNaN(uid)) {
$('#login_register').show()
setTimeout(function () {
$('#login_register').click()
}, 500)
$('#logout_a').hide()
$('#newMindModal_btn').hide()
} else {
$('#login_register').hide()
$('#logout_a').show()
}
// 判断页面
const page_tag = this.get_page_tag()
$('#main h5').html(this.title_map.get(page_tag))
},
get_uu_id: function () {
return (new Date().getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16)
},
/**注销登录*/
logout_: function () {
$.ajax({
type: "post",
url: "logout",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'xx': 'xx'},
dataType: "json",
success: function (data) {
common_alert(data.msg)
setTimeout(function () {
location.reload();
}, 1000)
},
async: false
});
},
/**获得源页面*/
get_page_tag: function () {
return $('#src_page').html()
},
/**获得导图*/
fetch_mind: function (current_page, page_size) {
const me = this
if (!current_page) {
current_page = me.current_page_num
}
if (!page_size) {
page_size = me.default_page_size
}
me.current_page_num = current_page
// 获得跳转源页面
const page_tag = me.get_page_tag()
$.ajax({
type: `get`,
url: `list?page=${current_page}&page_size=${page_size}&s_p=${page_tag}`,
headers: {"X-CSRFToken": $.cookie("csrftoken")},
dataType: "json",
success: function (resp) {
if (resp.code !== 0) {
return
}
// clear container-fluid
$('main .container-fluid').empty()
// 解析结果
const results = resp.results
let idx = 0
let row = $(`<div class="row"></row>`)
results.forEach(function (item) {
const uuid = me.get_uu_id()
// 添加按钮组
let sub_btn = '';
if (page_tag === 'b9b101e') {
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="window.open('2_d?id=${item.id}&s_p=b9b101e')">编辑</a>
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_mind(${item.id},'card_${uuid}')">删除</a>
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.share_mind(${item.id})">分享</a>`
} else if (page_tag === 'share') {
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.share_cancel(${item.id})">取消分享</a>
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.fetch_share_info(${item.id})">查看分享链接</a>`
} else if (page_tag === 'star') {
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.un_star(${item.id})">取消收藏</a>`
} else if (page_tag === 'recycle') {
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_cancel(${item.id})">恢复</a>
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_final(${item.id})">彻底删除</a>`
}
const content = `<div class="card col-2" style="margin: 6px; margin-left: 20px;" id='card_${uuid}'>
<div class="card-body">
<div class="card-title" style="margin-bottom: 0px;font-weight:bold;text-overflow:ellipsis;white-space:nowrap;overflow: hidden;">${item.coop_mind_name}</div>
<hr style="margin: 0">
<img src="/static/pic/demo_icon.png" class="card-img-top" style="margin-top: 8px;cursor: pointer;" onclick="window.open('2_d?id=${item.id}&s_p=b9b101e')">
<div style="text-align:right;font-size: 0.8rem;margin-top: 5px;font-family: inherit;">
<div class="btn-group btn-group-sm" role="group">
<button id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">操作</button>
<div class="dropdown-menu" aria-labelledby="btnGroupDrop1">${sub_btn}</div>
</div>
</div>
</div>
</div>`
row.append(content)
})
// 如果不是3的整数倍,将剩余的添加
$('main .container-fluid').append(row)
me.init_pagination(resp.count, me.default_page_size)
// success end
},
async: false
});
},
/**显示分享链接*/
show_share_url: function (u, h) {
const url = `s_2_d?u=${u}&h=${h}`
$('#share_mind_modal .modal-body').html(`分享成功,请复制以下链接进行分享:<div>${window.location.protocol}//${window.location.host}/${url}</div>`)
$('#share_mind_modal_a').click()
},
/**分页组件*/
init_pagination: function (count, page_size) {
const container = $('#pagination_div')
/**计算页数*/
if (count <= 0) {
container.html(`<p class="text-center">无数据</p>`)
return
}
const all_page = (count <= page_size) ? 1 : (count % page_size > 0) ? Math.floor(count / page_size) + 1 : Math.floor(count / page_size)
const navigation = $(`<nav aria-label="Page navigation example"></nav>`)
const navigation_ul = $(`<ul class="pagination justify-content-center"></ul>`)
if (this.current_page_num > 1) {
navigation_ul.append(`<li class="page-item"><a class="page-link" href="javascript:void(0)" onclick="mind.fetch_mind(mind.current_page_num-1)">上一页</a></li>`)
}
for (let i = 0; i < all_page; i++) {
const ctt = $(`<li class="page-item"><a class="page-link" href="javascript:void(0)" onclick="mind.fetch_mind(${i + 1})">${i + 1}</a></li>`)
if (i + 1 === this.current_page_num) {
ctt.addClass('active')
}
navigation_ul.append(ctt)
}
if (this.current_page_num < all_page) {
navigation_ul.append(`<li class="page-item"><a class="page-link" href="javascript:void(0)" onclick="mind.fetch_mind(mind.current_page_num+1)">下一页</a></li>`)
}
navigation.append(navigation_ul)
container.empty()
container.append(navigation)
},
/**删除导图*/
del_mind: function (mind_id, card_id) {
const me = this
$.ajax({
type: "delete",
url: "delete",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'coop_mind_id': mind_id, 'source': 'dashboard'},
dataType: "json",
success: function (data) {
if (data.code === 0) {
primary_alert(data.msg)
// $('#' + card_id).remove()
setTimeout(function () {
me.fetch_mind()
}, 1000)
} else {
common_alert(data.msg)
}
},
async: false
});
},
/**分享脑图*/
share_mind: function (mind_id) {
const me = this
$.ajax({
type: "post",
url: "share",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'id': mind_id},
dataType: "json",
success: function (resp) {
me.show_share_url(`${resp.data.u}`, `${resp.data.h}`)
},
async: false
});
},
/**取消分享*/
share_cancel: function (mind_id) {
const me = this
$.ajax({
type: "delete",
url: "share",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'id': mind_id},
dataType: "json",
success: function (resp) {
if (me.is_success_resp(resp)) {
location.reload()
} else {
common_alert(resp.msg)
}
},
async: false
});
},
/** 删除恢复*/
del_cancel: function (mind_id) {
const me = this
$.ajax({
type: "post",
url: "delete_cancel",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'coop_mind_id': mind_id, 'op_type': 'delete_cancel'},
dataType: "json",
success: function (resp) {
common_alert(resp.msg)
if (me.is_success_resp(resp)) {
me.fetch_mind()
}
},
async: false
});
},
/**彻底删除*/
del_final: function (mind_id) {
const me = this
$.ajax({
type: "delete",
url: "delete",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'coop_mind_id': mind_id, 'source': 'recycle'},
dataType: "json",
success: function (resp) {
common_alert(resp.msg)
if (me.is_success_resp(resp)) {
me.fetch_mind()
}
},
async: false
});
},
/** 取消收藏 */
un_star: function (mind_id) {
const me = this
$.ajax({
type: "delete",
url: "star",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'coop_mind_id': mind_id},
dataType: "json",
success: function (resp) {
common_alert(resp.msg)
if (me.is_success_resp(resp)) {
me.fetch_mind()
}
},
async: false
});
},
/**获得分享信息*/
fetch_share_info: function (mind_id) {
const me = this
$.ajax({
type: "get",
url: "share",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {'coop_mind_id': mind_id},
dataType: "json",
success: function (resp) {
if (me.is_success_resp(resp)) {
const data = resp.data
me.show_share_url(data.share_uuid, data.share_uuid_hash)
} else {
common_alert(resp.msg)
}
},
async: false
});
},
is_success_resp(resp) {
return resp.code === 0
},
/** 清除注册时输入内容 */
clear_reg_info: function () {
$('#userName').val('');
$('#inputPassword').val('');
$('#inputPassword_').val('');
},
/**校验密码是否输入一致*/
validate_pw_eq: function (obj, inputPassword, inputPassword_) {
if (inputPassword !== inputPassword_) {
common_alert('两次密码输入不一样,请确认!')
return false
}
return true
},
/** 设置窗口名称 */
set_modal_title: function (title) {
$('#exampleModal .modal-title').html(title);
},
/************************************************************************************************/
/**初始化jquery监听*/
jq_listener_init: function () {
const me = this
/**监听modal窗口事件*/
$('#exampleModal').on('show.bs.modal', function (event) {
const ws = new WebSocket(`ws://${window.location.host}/ws/qr/?${me.uuid}`)
ws.onmessage = function (e) {
console.log('接收到websocket消息:' + e.data)
}
me.websocket = ws
});
$('#exampleModal').on('hidden.bs.modal', function (event) {
// console.log('关闭');
if (me.websocket) {
me.websocket.close()
}
});
/**点击 扫码登录 */
$('#s_login_a').click(function () {
$('.modal-body').hide();
$('.qr_login_group').show();
me.set_modal_title('登录');
})
// 点击注册控件
$('#register_a').click(function () {
$('.modal-body').hide();
$('.register_group').show();
me.set_modal_title('注册');
})
// 用户名密码登录
$('#p_login_a').click(function () {
$('.modal-body').hide();
$('.pw_login_group').show();
me.set_modal_title('登录');
})
/** 注册按钮 */
$('#register_button').click(function () {
const userName = $('#userName').val();
const inputPassword = $('#inputPassword').val();
const inputPassword_ = $('#inputPassword_').val();
if (!userName) {
common_alert('请输入用户名')
return
}
if (!inputPassword) {
common_alert('请输入密码')
return
}
// 校验输入是否一致
const validate = me.validate_pw_eq(this, inputPassword, inputPassword_)
if (validate) {
$.ajax({
type: "post",
url: "register",
data: {userName: userName, inputPassword: inputPassword},
dataType: "json",
success: function (data) {
// 注册成功
if (data.code === 0) {
me.clear_reg_info()
common_alert(data.msg, 'alert-primary')
setTimeout(function () {
$('#p_login_a').click()
}, 1500)
} else {
// 注册失败
common_alert(data.msg)
}
},
async: false
});
}
// validate end
});
/**登录按钮*/
$('#login_button').click(function () {
const userName_login = $('#userName_login').val();
const inputPassword_login = $('#inputPassword_login').val();
if (!userName_login || !inputPassword_login) {
common_alert('请输入用户名和密码')
return
}
$.ajax({
type: "post",
url: "login",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: {username: userName_login, password: inputPassword_login},
dataType: "json",
success: function (data) {
// 登录成功
if (data.code === 0) {
common_alert(data.msg, 'alert-primary')
$('#exampleModal').modal('hide')
setTimeout(function () {
location.reload();
}, 500)
} else {
// 登录失败
common_alert(data.msg)
}
},
async: false
});
})
/**新建导图*/
$('#new_mind_btn').click(function () {
const mind_name = $('#mindName').val()
if (!mind_name) {
common_alert('请输入导图名称')
return
}
const post_data = {'mind_name': mind_name}
$.ajax({
type: "post",
url: "create",
headers: {"X-CSRFToken": $.cookie("csrftoken")},
data: post_data,
dataType: "json",
success: function (resp) {
if (resp.code === 0) {
me.fetch_mind()
$('#newMindModal').modal('hide')
if ($('#exampleCheck1').prop("checked")) {
/**新页面打开*/
setTimeout(function () {
const id = resp.data
window.open('2_d?id=' + id + `&s_p=b9b101e`)
}, 500)
}
} else {
common_alert(resp.msg)
}
},
async: false
});
})
/** 新建后打开复选框勾选事件*/
$('#exampleCheck1').change(function () {
const checked = $(this).prop("checked")
$.cookie('open_aft_create', checked, {expires: 7, path: '/'});
})
/** 创建导图modal 显示完毕后事件*/
$('#newMindModal').on('shown.bs.modal', function () {
const cookie_checked_ = $.cookie('open_aft_create')
$('#mindName').val('')
// 从cookie中获得的是字符串
if (cookie_checked_ === 'true') {
$('#exampleCheck1').attr('checked', 'checked')
} else {
$('#exampleCheck1').removeAttr('checked');
}
})
/************************************* jq_listener_init end *******************************************/
}
/** prototype end **/
}
$(function () {
const view = new DefaultView()
/**初始化*/
view.init_view()
view.jq_listener_init()
/**如果已经登录则查询列表*/
view.fetch_mind()
window.mind = view
// js end
})
</script>
<!--script end-->
</head>
<body>
<div style="display: none;">
<span id="uid">{{ user.id }}</span>
<span id="src_page">{{ page }}</span>
</div>
<!-- 页眉 start-->
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
<a class="navbar-brand col-md-2 col-lg-2 mr-0 px-3" href="#">协作学习投入智能干预平台(学生端)</a>
<ul class="navbar-nav px-3">
<li class="nav-item text-nowrap">
<a id="login_register" class="nav-link" href="#" data-toggle="modal" data-target="#exampleModal">登录/注册</a>
<a id="logout_a" class="nav-link" href="javascript:void(0)" onclick="mind.logout_()" style="display: none;">注销</a>
<a id="share_mind_modal_a" class="nav-link" href="#" data-toggle="modal" data-target="#share_mind_modal" style="display: none;"></a>
</li>
</ul>
</nav>
<!-- 页眉 end-->
<!--菜单 和 内容 start-->
<div class="container-fluid">
<div class="row">
<!-- 左侧菜单 start-->
<nav id="sidebarMenu" class="col-md-2 col-lg-2 d-md-block bg-light">
<div class="sidebar-sticky pt-3">
<hr/>
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link active" href="/">
<span data-feather="file-text"></span>
课程/小组信息
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_star">
<span data-feather="star"></span>
协作收藏
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_echart">
<span data-feather="star"></span>
学习分析图
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/chat_room">
<span data-feather="star"></span>
聊天室
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/reng_wu">
<span data-feather="star"></span>
任务详情
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/ke_cheng">
<span data-feather="star"></span>
课程页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/post_task/">
<span data-feather="star"></span>
任务发布页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/post_kecheng/">
<span data-feather="star"></span>
课程发布页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_information">
<span data-feather="star"></span>
个人信息
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_admin">
<span data-feather="star"></span>
管理员页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_liuyan">
<span data-feather="star"></span>
留言板
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_recycle">
<span data-feather="trash-2"></span>
回收站
</a>
</li>
</ul>
</div>
</nav>
<!-- 左侧菜单 end-->
<main class="col-md-10 ml-sm-auto col-lg-10 px-md-4">
<h1 style="margin-left: 500px">留言板</h1>
<table class="table" style="margin-left: 50px; width: 1100px">
<tr style="text-align: center;" >
<td><h6>用户名</h6></td>
<td><h6>给他留言</h6></td>
<td><h6>操作</h6></td>
</tr>
{% for data in datas %}
<tbody>
<td style="text-align: center;">{{data.username}}</td>
<form method="post" action="{% url 'liuyan_fun' %}">
{% csrf_token %}
<td style="text-align: center;">
<input name="liuyan_con" value="">
<input style = "display:none" name="user_id" value="{{data.id}}">
</td>
<td style="text-align: center;">
<button type="submit">提交留言</button></form>
</td>
</form></td>
</tr>
</tbody>
{# {% for it in it3 %}#}
{# <td>{{it}}</td>#}
{# {% endfor %}#}
{% endfor %}
</table>
<h1 style="margin-left: 500px">我的留言版本</h1>
<table class="table" style="margin-left: 50px; width: 1100px">
<tr style="text-align: center;" >
<td><h6>留言人</h6></td>
<td><h6>留言内容</h6></td>
<td><h6>留言时间</h6></td>
</tr>
{% for liuyan in liuyans %}
<tbody>
<td style="text-align: center;">{{liuyan.user.username}}</td>
<td style="text-align: center;">
{{ liuyan.liuyan_content }}
</td>
<td style="text-align: center;">
{{ liuyan.liuyan_time }}
</td>
</tr>
</tbody>
{# {% for it in it3 %}#}
{# <td>{{it}}</td>#}
{# {% endfor %}#}
{% endfor %}
</table>
</main>
<!-- 右侧内容 start-->
<!-- 右侧内容 end-->
</div>
</div>
<!--导航 和 内容 end-->
</body>
<script src="/static/js/mind/modal.js"></script>
<script src="/static/js/echarts.js"></script>
<script>
if (window.feather) {
window.feather.replace();
}
</script>
</html>
+19 -1
View File
@@ -595,9 +595,27 @@
<span data-feather="star"></span> <span data-feather="star"></span>
课程发布页面 课程发布页面
</a> </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_information">
<span data-feather="star"></span>
个人信息
</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#"> <a class="nav-link" href="/2_admin">
<span data-feather="star"></span>
管理员页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_liuyan">
<span data-feather="star"></span>
留言板
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_recycle">
<span data-feather="trash-2"></span> <span data-feather="trash-2"></span>
回收站 回收站
</a> </a>
+19 -1
View File
@@ -595,9 +595,27 @@
<span data-feather="star"></span> <span data-feather="star"></span>
课程发布页面 课程发布页面
</a> </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_information">
<span data-feather="star"></span>
个人信息
</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#"> <a class="nav-link" href="/2_admin">
<span data-feather="star"></span>
管理员页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_liuyan">
<span data-feather="star"></span>
留言板
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_recycle">
<span data-feather="trash-2"></span> <span data-feather="trash-2"></span>
回收站 回收站
</a> </a>
+20 -2
View File
@@ -541,7 +541,7 @@
<div class="sidebar-sticky pt-3"> <div class="sidebar-sticky pt-3">
<hr/> <hr/>
<ul class="nav flex-column"> <ul class="nav flex-column">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" href="/"> <a class="nav-link active" href="/">
<span data-feather="file-text"></span> <span data-feather="file-text"></span>
课程/小组信息 课程/小组信息
@@ -588,9 +588,27 @@
<span data-feather="star"></span> <span data-feather="star"></span>
课程发布页面 课程发布页面
</a> </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_information">
<span data-feather="star"></span>
个人信息
</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#"> <a class="nav-link" href="/2_admin">
<span data-feather="star"></span>
管理员页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_liuyan">
<span data-feather="star"></span>
留言板
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_recycle">
<span data-feather="trash-2"></span> <span data-feather="trash-2"></span>
回收站 回收站
</a> </a>
+19 -1
View File
@@ -588,9 +588,27 @@
<span data-feather="star"></span> <span data-feather="star"></span>
课程发布页面 课程发布页面
</a> </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_information">
<span data-feather="star"></span>
个人信息
</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#"> <a class="nav-link" href="/2_admin">
<span data-feather="star"></span>
管理员页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_liuyan">
<span data-feather="star"></span>
留言板
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_recycle">
<span data-feather="trash-2"></span> <span data-feather="trash-2"></span>
回收站 回收站
</a> </a>
+19 -1
View File
@@ -598,9 +598,27 @@
<span data-feather="star"></span> <span data-feather="star"></span>
课程发布页面 课程发布页面
</a> </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_information">
<span data-feather="star"></span>
个人信息
</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#"> <a class="nav-link" href="/2_admin">
<span data-feather="star"></span>
管理员页面
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_liuyan">
<span data-feather="star"></span>
留言板
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/2_recycle">
<span data-feather="trash-2"></span> <span data-feather="trash-2"></span>
回收站 回收站
</a> </a>