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