add 后台管理页面
This commit is contained in:
@@ -8,5 +8,31 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
|
||||
<script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
|
||||
<script>
|
||||
//注销
|
||||
function logout_() {
|
||||
$.ajax({
|
||||
url: '/api/account/logout', // 后端接口地址
|
||||
type: "POST",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
alert(data.msg); // 使用 alert 替换 common_alert
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 1000);
|
||||
},
|
||||
async: false
|
||||
});
|
||||
}
|
||||
$(document).ready(function() {
|
||||
// 绑定注销操作到某个按钮点击事件
|
||||
$('#logout-button').click(function(event) {
|
||||
event.preventDefault(); // 阻止默认行为
|
||||
logout_();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user