This commit is contained in:
chenyang
2022-07-16 11:13:26 +08:00
parent 1c9fa3a938
commit 5766bdd3fb
4 changed files with 55 additions and 49 deletions
+1
View File
@@ -24,6 +24,7 @@ urlpatterns = [
path('s_d', JsMindShareView.as_view()), # 获得导图详情
path('delete', JsMindView.as_view()), # 删除思维导图
path('share', JsMindShareView.as_view()), # 分享思维导图,查询等
path('star', JsMindStarView.as_view()), # 收藏思维导图
# ---------------------------------------------------
path('register', MindUserView.as_view()), # 用户注册
+40 -44
View File
@@ -2,47 +2,43 @@ CODE_SUCCESS = 0
CODE_FAILED = -1
DUPLICATE = 1
snapshot_json_data = """{
"id": "root",
"topic": "MindMap",
"children": [
{
"id": "easy",
"topic": "Easy",
"direction": "left",
"expanded": false,
"children": [
{"id": "easy1", "topic": "Easy to show"},
{"id": "easy2", "topic": "Easy to edit"},
{"id": "easy3", "topic": "Easy to store"},
{"id": "easy4", "topic": "Easy to embed"}
]
},
{
"id": "open",
"topic": "Open Source",
"direction": "left",
"expanded": false,
"children": [
{"id": "open1", "topic": "on GitHub"},
{"id": "open2", "topic": "BSD License"}
]
},
{
"id": "powerful",
"topic": "Powerful",
"direction": "right",
"expanded": false,
"children": [
{"id": "powerful1", "topic": "Base on Javascript"},
{"id": "powerful2", "topic": "Base on HTML5"},
{"id": "powerful3", "topic": "Depends on you"}
]
},
{
"id": "other",
"topic": "多人协作",
"direction": "right"
}
]
}"""
SNAPSHOT_JSON_DATA = """{
"id": "root",
"topic": "MindMap",
"children": [{"id": "easy",
"topic": "Easy",
"direction": "left",
"expanded": false,
"children": [
{"id": "easy1", "topic": "Easy to show"},
{"id": "easy2", "topic": "Easy to edit"},
{"id": "easy3", "topic": "Easy to store"},
{"id": "easy4", "topic": "Easy to embed"}
]
},
{
"id": "open",
"topic": "Open Source",
"direction": "left",
"expanded": false,
"children": [
{"id": "open1", "topic": "on GitHub"},
{"id": "open2", "topic": "BSD License"}
]
},
{
"id": "powerful",
"topic": "Powerful",
"direction": "right",
"expanded": false,
"children": [
{"id": "powerful1", "topic": "Base on Javascript"},
{"id": "powerful2", "topic": "Base on HTML5"},
{"id": "powerful3", "topic": "Depends on you"}
]
},
{
"id": "other",
"topic": "多人协作",
"direction": "right"
}]}"""
+10 -1
View File
@@ -62,7 +62,7 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
"""
coop_mind_name = request.data.get('mind_name')
user = request.user
snapshot_data = snapshot_json_data
snapshot_data = SNAPSHOT_JSON_DATA
data_format = 'node_tree'
mind = CooperationMind(coop_mind_name=coop_mind_name, client_uuid='', mind_log_id=-1, creator_user_id=user.id, snapshot_data=snapshot_data, data_format=data_format)
mind.save()
@@ -190,3 +190,12 @@ class JsMindShareView(LoginRequiredJSONMixin, ListAPIView):
return build_response(code=CODE_FAILED, msg='用户未登录')
res = CooperationMindShare.objects.filter(coop_mind_id=id, operator_user_id=user.id).delete()
return build_response(msg="操作成功", data=res[0])
class JsMindStarView(LoginRequiredJSONMixin, ListAPIView):
"""
收藏
"""
def get(self, request, *args, **kwargs):
pass
+4 -4
View File
@@ -95,7 +95,7 @@
this.jm.coop.clear_timer()
}
},
show_mind: function (name, data_format, data) {
show_mind: function (name, data_format, data_resp) {
// options
const options = {
container: 'jsmind_container',
@@ -134,8 +134,8 @@
// eslint-disable-next-line new-cap
let jsMind = window.jsMind
this.jm = new jsMind(options)
if (data) {
mind.data = data
if (data_resp) {
mind.data = data_resp
}
this.jm.show(mind)
},
@@ -156,7 +156,7 @@
<!-- -->
<div style="position: absolute;top: 0px;z-index: 1000;cursor: pointer;" onclick="xxObj.collapse_all()"><span data-feather="folder-minus"></span><span class="un_selected">折叠</span></div>
<div style="position: absolute;top: 0px;left:80px;z-index: 1000;cursor: pointer;" onclick="xxObj.expand_all()"><span data-feather="folder-plus"></span><span class="un_selected">展开</span></div>
<div style="position: absolute;top: 0px;left:160px;z-index: 1000;cursor: pointer;" onclick="xxObj.star()"><span data-feather="star"></span><span class="un_selected">收藏</span></div>
<div style="position: absolute;top: 0px;left:160px;z-index: 1000;cursor: pointer;" onclick="xxObj.star()"><span data-feather="star"></span><span class="selected">收藏</span></div>
<h3 id="h1" style="text-align: center;max-height: 40px;"></h3>
<div id="jsmind_container"></div>
</body>