This commit is contained in:
chenyang
2022-07-02 08:52:08 +08:00
parent 0a244b34cc
commit 43e1402c74
6 changed files with 132 additions and 52 deletions
+85 -33
View File
@@ -10,9 +10,9 @@
<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="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>-->
<!--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>
@@ -37,8 +37,7 @@
qr_websocket.websocket.close()
});
// 扫码登录
/**点击 扫码登录 */
$('#s_login_a').click(function () {
$('.modal-body').hide();
$('.qr_login_group').show();
@@ -162,12 +161,15 @@
$.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) {
login_alert(data.msg, 'alert-primary')
$('#exampleModal').modal('hide')
fetch_mind()
} else {
// 注册失败
login_alert(data.msg)
@@ -177,6 +179,58 @@
});
})
/**获得导图*/
function fetch_mind(page, page_size) {
if (!page) {
page = 1
}
if (!page_size) {
page_size = 10
}
$.ajax({
type: `get`,
url: `list?page=${page}&page_size=${page_size}`,
headers: {"X-CSRFToken": $.cookie("csrftoken")},
dataType: "json",
success: function (resp) {
if (resp.code !== 0) {
return
}
// 解析结果
const results = resp.results
let idx = 0
let row = $(`<div class="row"></row>`)
results.forEach(function (item) {
const content = `
<div class="card col-3" style="width: 18rem;margin: 8px;">
<div class="card-body">
<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="...">
<a href="#" class="btn btn-info">编辑</a>
</div>
</div>
`
row.append(content)
idx++
if (idx % 3 === 0) {
// 3个一行
$('main .container-fluid').append(row)
// 重置row
row = $(`<div class="row"></row>`)
}
})
// 如果不是3的整数倍,将剩余的添加
if (idx % 3 !== 0) {
$('main .container-fluid').append(row)
}
},
async: false
});
}
/**如果已经登录则查询列表*/
fetch_mind()
// js end
})
</script>
@@ -202,36 +256,40 @@
<!--qr_login end-->
<!--register start-->
<div class="modal-body register_group" style="display: none;height: 360px;">
<h1 class="h3 mb-3 font-weight-normal">请输入用户名和密码</h1>
<label for="userName" class="sr-only"></label>
<input type="text" id="userName" class="form-control" placeholder="用户名" autocomplete="off" required autofocus>
<form>
<div class="modal-body register_group" style="display: none;height: 360px;">
<h1 class="h3 mb-3 font-weight-normal">请输入用户名和密码</h1>
<label for="userName" class="sr-only"></label>
<input type="text" id="userName" class="form-control" placeholder="用户名" autocomplete="off" required autofocus>
<label for="inputPassword" class="sr-only"></label>
<input type="password" id="inputPassword" class="form-control" placeholder="密码" required>
<label for="inputPassword" class="sr-only"></label>
<input type="password" id="inputPassword" class="form-control" placeholder="密码" autocomplete="new-password" required>
<label for="inputPassword_" class="sr-only"></label>
<input type="password" id="inputPassword_" class="form-control" placeholder="密码" required>
<label for="inputPassword_" class="sr-only"></label>
<input type="password" id="inputPassword_" class="form-control" placeholder="密码" autocomplete="new-password" required>
<div style="margin-bottom: 10px; text-align:right;">
<button class="btn btn-sm btn-primary" type="submit" id="register_button">注册</button>
<div style="margin-bottom: 10px; text-align:right;">
<button class="btn btn-sm btn-primary" type="submit" id="register_button">注册</button>
</div>
</div>
</div>
</form>
<!--register end-->
<!--pw_login start-->
<div class="modal-body pw_login_group" style="display: none;height: 360px;">
<h1 class="h3 mb-3 font-weight-normal">请输入用户名和密码</h1>
<label for="userName_login" class="sr-only">用户名</label>
<input type="text" id="userName_login" name="userName_login" class="form-control" placeholder="用户名" required autofocus>
<form>
<div class="modal-body pw_login_group" style="display: none;height: 360px;">
<h1 class="h3 mb-3 font-weight-normal">请输入用户名和密码</h1>
<label for="userName_login" class="sr-only">用户名</label>
<input type="text" id="userName_login" name="userName_login" class="form-control" placeholder="用户名" autocomplete="username" required autofocus>
<label for="inputPassword_login" class="sr-only">密码</label>
<input type="password" id="inputPassword_login" name="inputPassword_login" class="form-control" placeholder="密码" required>
<label for="inputPassword_login" class="sr-only">密码</label>
<input type="password" id="inputPassword_login" name="inputPassword_login" class="form-control" placeholder="密码" autocomplete="current-password" required>
<div style="margin-bottom: 10px; text-align:right;">
<button class="btn btn-sm btn-primary" id="login_button">登录</button>
<div style="margin-bottom: 10px; text-align:right;">
<button class="btn btn-sm btn-primary" id="login_button" type="button">登录</button>
</div>
</div>
</div>
</form>
<!--pw_login end-->
<div class="modal-footer">
@@ -302,13 +360,14 @@
<!-- 左侧菜单 end-->
<!-- 右侧内容 start-->
<main role="main" class="col-md-10 ml-sm-auto col-lg-10 px-md-4">
<main role="main" class="col-md-10 ml-sm-auto col-lg-10 px-md-4" id="main">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">全部文件</h1>
</div>
<div class="container-fluid">
<!--
<div class="row">
<div class="card col-3" style="width: 18rem;margin: 8px;">
<div class="card-body">
@@ -317,15 +376,8 @@
<a href="#" class="btn btn-info">编辑</a>
</div>
</div>
<div class="card col-3" style="width: 18rem;margin: 8px;">
<div class="card-body">
<h5 class="card-title">开发计划</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="...">
<a href="#" class="btn btn-info">编辑</a>
</div>
</div>
</div>
-->
</div>
</main>
<!-- 右侧内容 end-->