This commit is contained in:
chenyang
2022-07-09 07:16:00 +08:00
parent e56e321d5b
commit 20df0416db
4 changed files with 24 additions and 7 deletions
+2
View File
@@ -34,6 +34,8 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
if pk is not None: if pk is not None:
# 查询导图详细 查看用户是否有权限(创建者) # 查询导图详细 查看用户是否有权限(创建者)
mind = CooperationMind.objects.filter(id=pk, creator_user_id=user.id).first() mind = CooperationMind.objects.filter(id=pk, creator_user_id=user.id).first()
if mind is None:
return build_response(code=CODE_FAILED, msg="无权限")
# 序列化 # 序列化
serializer = CooperationMindSerializer(mind) serializer = CooperationMindSerializer(mind)
return build_response(data=serializer.data) return build_response(data=serializer.data)
+4
View File
@@ -31,7 +31,9 @@
// 未登录 // 未登录
if (!uid || isNaN(uid)) { if (!uid || isNaN(uid)) {
$('#login_register').show() $('#login_register').show()
setTimeout(function () {
$('#login_register').click() $('#login_register').click()
}, 500)
$('#logout_a').hide() $('#logout_a').hide()
$('#newMindModal_btn').hide() $('#newMindModal_btn').hide()
} else { } else {
@@ -217,7 +219,9 @@
}); });
$('#exampleModal').on('hidden.bs.modal', function (event) { $('#exampleModal').on('hidden.bs.modal', function (event) {
// console.log('关闭'); // console.log('关闭');
if (me.websocket) {
me.websocket.close() me.websocket.close()
}
}); });
/**点击 扫码登录 */ /**点击 扫码登录 */
+6
View File
@@ -5,6 +5,7 @@
<title>Jsmind</title> <title>Jsmind</title>
<link rel="shortcut icon" href="/static/abl1b-qks1b-001.ico"/> <link rel="shortcut icon" href="/static/abl1b-qks1b-001.ico"/>
<link rel="stylesheet" type="text/css" href="/static/js/jsmind.css"> <link rel="stylesheet" type="text/css" href="/static/js/jsmind.css">
<link rel="stylesheet" type="text/css" href="/static/bootstrap-4.6.1-dist/css/bootstrap.css">
<style> <style>
#jsmind_container { #jsmind_container {
width: calc(100rem); width: calc(100rem);
@@ -18,6 +19,7 @@
<script src="/static/js/jsmind.menu.js"></script> <script src="/static/js/jsmind.menu.js"></script>
<script src="/static/js/jsmind.coop.js?d="></script> <script src="/static/js/jsmind.coop.js?d="></script>
<script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script> <script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="/static/js/mind/c_m_m.js"></script>
<script> <script>
const fetch = function () { const fetch = function () {
this.jm = null this.jm = null
@@ -51,6 +53,10 @@
const from_share = id.length === 0; const from_share = id.length === 0;
const url = from_share ? `4cbcb74630898f41fd0a?u=${u}&h=${h}` : 'list?id=' + id; const url = from_share ? `4cbcb74630898f41fd0a?u=${u}&h=${h}` : 'list?id=' + id;
$.get(url, function (resp) { $.get(url, function (resp) {
if (resp.code === -1) {
common_alert(resp.msg)
return
}
// reset // reset
me.close_coop_timer_if_necessary() me.close_coop_timer_if_necessary()
+6 -1
View File
@@ -2,8 +2,11 @@ function common_alert(text, class_str) {
if (!class_str) { if (!class_str) {
class_str = 'alert-warning' class_str = 'alert-warning'
} }
// reset // reset bootstrap.bundle.js 里的方法
const bundle_alert = typeof ($('.alert').alert) === 'function'
if (bundle_alert) {
$('.alert').alert('close') $('.alert').alert('close')
}
// content // content
const content = ` const content = `
<div class="alert ${class_str} fade show" role="alert" style="z-index: 2000;position: absolute;top: 0;width: calc(100%);"> <div class="alert ${class_str} fade show" role="alert" style="z-index: 2000;position: absolute;top: 0;width: calc(100%);">
@@ -12,10 +15,12 @@ function common_alert(text, class_str) {
// append // append
$('body').append(content) $('body').append(content)
// clean // clean
if (bundle_alert) {
setTimeout(function () { setTimeout(function () {
$('.alert').alert('close') $('.alert').alert('close')
}, 1500) }, 1500)
} }
}
function primary_alert(text) { function primary_alert(text) {
common_alert(text, 'alert-primary') common_alert(text, 'alert-primary')