update
This commit is contained in:
+19
-26
@@ -15,6 +15,7 @@
|
||||
<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/user/c_m_m.js"></script>
|
||||
<script>
|
||||
const qr_websocket = {
|
||||
websocket: null,
|
||||
@@ -124,30 +125,12 @@
|
||||
|
||||
/** 注册提示 */
|
||||
function reg_alert(text, class_str) {
|
||||
common_alert('register_button', text, class_str)
|
||||
common_alert_(text, class_str)
|
||||
}
|
||||
|
||||
/** 登录提示 */
|
||||
function login_alert(text, class_str) {
|
||||
common_alert('login_button', text, class_str)
|
||||
}
|
||||
|
||||
function common_alert(button_id, text, class_str) {
|
||||
// 清除之前的弹窗
|
||||
$('.alert').alert('close')
|
||||
//
|
||||
const uuid = '' + (new Date().getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16)
|
||||
const class_name = class_str ? class_str : 'alert-danger'
|
||||
|
||||
const alert_component = `
|
||||
<div class="alert ${class_name} .alert-dismissible fade show" role="alert" id="${uuid}" style="clear: both;margin-top: 3px;margin-bottom: 3px;height: 30px;padding-top: 2px;padding-bottom: 2px;">
|
||||
${text}
|
||||
</div>
|
||||
`
|
||||
$('#' + button_id).parent().after(alert_component)
|
||||
setTimeout(function () {
|
||||
$('#' + uuid).fadeOut(1200)
|
||||
}, 1000)
|
||||
common_alert_(text, class_str)
|
||||
}
|
||||
|
||||
/**登录按钮*/
|
||||
@@ -229,6 +212,14 @@
|
||||
});
|
||||
}
|
||||
|
||||
/**新建导图*/
|
||||
$('#new_mind_btn').click(function () {
|
||||
const mind_name = $('#mindName').val()
|
||||
if (!mind_name) {
|
||||
common_alert_('请输入导图名称')
|
||||
}
|
||||
})
|
||||
|
||||
/**如果已经登录则查询列表*/
|
||||
fetch_mind()
|
||||
// js end
|
||||
@@ -238,7 +229,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Modal start-->
|
||||
<!-- login Modal start-->
|
||||
<div class="modal fade" id="exampleModal" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
@@ -309,7 +300,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- login Modal end-->
|
||||
|
||||
<!-- new Modal start-->
|
||||
<div class="modal fade" id="newMindModal" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
@@ -322,11 +315,11 @@
|
||||
|
||||
<!--start-->
|
||||
<form>
|
||||
<div class="modal-body register_group">
|
||||
<label for="userName" class="sr-only"></label>
|
||||
<input type="text" id="userName" class="form-control" placeholder="思维导图名称" autocomplete="off" required autofocus>
|
||||
<div class="modal-body">
|
||||
<label for="mindName" class="sr-only"></label>
|
||||
<input type="text" id="mindName" class="form-control" placeholder="思维导图名称" autocomplete="off" required autofocus>
|
||||
<div style="text-align:right;">
|
||||
<button type="button" class="btn btn-info">确认创建</button>
|
||||
<button type="button" class="btn btn-info" id="new_mind_btn">确认创建</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -334,7 +327,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Modal end-->
|
||||
<!-- new Modal end-->
|
||||
|
||||
|
||||
<!-- 页眉 start-->
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
function common_alert_(text, class_str) {
|
||||
if (!class_str) {
|
||||
class_str = 'alert-warning'
|
||||
}
|
||||
// reset
|
||||
$('.alert').alert('close')
|
||||
// content
|
||||
const content = `
|
||||
<div class="alert ${class_str} fade show" role="alert" style="z-index: 2000;position: absolute;top: 0;width: calc(100%);">
|
||||
${text}
|
||||
</div>`
|
||||
// append
|
||||
$('body').append(content)
|
||||
// clean
|
||||
setTimeout(function () {
|
||||
$('.alert').alert('close')
|
||||
}, 1500)
|
||||
}
|
||||
Reference in New Issue
Block a user