update
This commit is contained in:
@@ -154,3 +154,7 @@ AUTH_USER_MODEL = "server_auth.MindUser"
|
|||||||
AUTHENTICATION_BACKENDS = [
|
AUTHENTICATION_BACKENDS = [
|
||||||
'server_auth.lib.auth.AuthBackend',
|
'server_auth.lib.auth.AuthBackend',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# session 设置
|
||||||
|
SESSION_COOKIE_AGE = 60 * 30 # 设置过期时间10分钟,默认为两周
|
||||||
|
SESSION_SAVE_EVERY_REQUEST = True
|
||||||
|
|||||||
@@ -53,8 +53,10 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
|
|||||||
def delete(self, request):
|
def delete(self, request):
|
||||||
# 删除
|
# 删除
|
||||||
pk = request.POST.get('id')
|
pk = request.POST.get('id')
|
||||||
res = CooperationMind.objects.filter(id=pk).delete()
|
user = request.user
|
||||||
return build_response()
|
res = CooperationMind.objects.filter(id=pk, creator=user.id).delete()
|
||||||
|
print(res)
|
||||||
|
return build_response(msg='删除成功')
|
||||||
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|||||||
@@ -35,6 +35,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_uu_id() {
|
||||||
|
return (new Date().getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16)
|
||||||
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
/**界面初始化*/
|
/**界面初始化*/
|
||||||
view_init()
|
view_init()
|
||||||
@@ -259,12 +263,16 @@
|
|||||||
let idx = 0
|
let idx = 0
|
||||||
let row = $(`<div class="row"></row>`)
|
let row = $(`<div class="row"></row>`)
|
||||||
results.forEach(function (item) {
|
results.forEach(function (item) {
|
||||||
|
const uuid = get_uu_id()
|
||||||
const content = `
|
const content = `
|
||||||
<div class="card col-3" style="width: 18rem;margin: 8px;">
|
<div class="card col-3" style="margin: 6px;" id='card_${uuid}'>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">${item.coop_mind_name}</h5>
|
<h5 class="card-title">${item.coop_mind_name}</h5>
|
||||||
<img src="https://img0.baidu.com/it/u=218959243,558802769&fm=253&fmt=auto&app=138&f=JPEG?w=1377&h=500" class="card-img-top" alt="...">
|
<img src="https://img0.baidu.com/it/u=218959243,558802769&fm=253&fmt=auto&app=138&f=JPEG" class="card-img-top" style="height: 100px;">
|
||||||
|
<div style="text-align:right;">
|
||||||
<a href="#" class="btn btn-info" onclick="window.open('detail?id=${item.id}')">编辑</a>
|
<a href="#" class="btn btn-info" onclick="window.open('detail?id=${item.id}')">编辑</a>
|
||||||
|
<a href="#" class="btn btn-info" onclick="del_mind(${item.id},'card_${uuid}')">删除</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
@@ -286,6 +294,21 @@
|
|||||||
async: false
|
async: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**删除导图*/
|
||||||
|
function del_mind(mind_id, card_id) {
|
||||||
|
$.ajax({
|
||||||
|
type: "delete",
|
||||||
|
url: "delete",
|
||||||
|
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||||
|
data: {'id': mind_id},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
console.log(data)
|
||||||
|
},
|
||||||
|
async: false
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<!--script end-->
|
<!--script end-->
|
||||||
</head>
|
</head>
|
||||||
@@ -363,6 +386,22 @@
|
|||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- navigation start-->
|
||||||
|
<nav aria-label="Page navigation example">
|
||||||
|
<ul class="pagination justify-content-center">
|
||||||
|
<li class="page-item disabled">
|
||||||
|
<a class="page-link">Previous</a>
|
||||||
|
</li>
|
||||||
|
<li class="page-item"><a class="page-link" href="#">1</a></li>
|
||||||
|
<li class="page-item"><a class="page-link" href="#">2</a></li>
|
||||||
|
<li class="page-item"><a class="page-link" href="#">3</a></li>
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="page-link" href="#">Next</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<!-- navigation end-->
|
||||||
</main>
|
</main>
|
||||||
<!-- 右侧内容 end-->
|
<!-- 右侧内容 end-->
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="/static/js/jsmind.css">
|
<link rel="stylesheet" type="text/css" href="/static/js/jsmind.css">
|
||||||
<style>
|
<style>
|
||||||
#jsmind_container {
|
#jsmind_container {
|
||||||
width: 100%;
|
width: calc(100%);
|
||||||
height: 800px;
|
height: calc(100%);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script src="/static/js/jquery-1.11.3.min.js"></script>
|
<script src="/static/js/jquery-1.11.3.min.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user