update
This commit is contained in:
+1
-1
@@ -59,7 +59,7 @@ class CooperationMindShare(AbstractModel):
|
|||||||
"""
|
"""
|
||||||
分享记录表
|
分享记录表
|
||||||
"""
|
"""
|
||||||
coop_mind = models.ForeignKey(to="CooperationMind", to_field="id", verbose_name="脑图ID", on_delete=models.CASCADE)
|
coop_mind = models.OneToOneField(to="CooperationMind", to_field="id", verbose_name="脑图ID", on_delete=models.CASCADE)
|
||||||
coop_mind_name = models.CharField(verbose_name='脑图名称', max_length=128, null=False, blank=False)
|
coop_mind_name = models.CharField(verbose_name='脑图名称', max_length=128, null=False, blank=False)
|
||||||
share_uuid = models.CharField(verbose_name='分享uuid', max_length=128, null=False, blank=False)
|
share_uuid = models.CharField(verbose_name='分享uuid', max_length=128, null=False, blank=False)
|
||||||
share_uuid_hash = models.BigIntegerField(verbose_name='分享uuid_hash', null=False, blank=False)
|
share_uuid_hash = models.BigIntegerField(verbose_name='分享uuid_hash', null=False, blank=False)
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ urlpatterns = [
|
|||||||
path('d', JsMindView.as_view()), # 获得导图详情
|
path('d', JsMindView.as_view()), # 获得导图详情
|
||||||
path('s_d', JsMindShareView.as_view()), # 获得导图详情
|
path('s_d', JsMindShareView.as_view()), # 获得导图详情
|
||||||
path('delete', JsMindView.as_view()), # 删除思维导图
|
path('delete', JsMindView.as_view()), # 删除思维导图
|
||||||
path('share', JsMindShareView.as_view()), # 分享思维导图
|
path('share', JsMindShareView.as_view()), # 分享思维导图,查询等
|
||||||
|
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
path('register', MindUserView.as_view()), # 用户注册
|
path('register', MindUserView.as_view()), # 用户注册
|
||||||
|
|||||||
@@ -127,6 +127,9 @@ class JsMindShareView(LoginRequiredJSONMixin, ListAPIView):
|
|||||||
"""
|
"""
|
||||||
share_uuid_hash = request.GET.get('h')
|
share_uuid_hash = request.GET.get('h')
|
||||||
share_uuid = request.GET.get('u')
|
share_uuid = request.GET.get('u')
|
||||||
|
coop_mind_id = request.GET.get('coop_mind_id')
|
||||||
|
user = request.user
|
||||||
|
#
|
||||||
if share_uuid_hash is not None and share_uuid is not None:
|
if share_uuid_hash is not None and share_uuid is not None:
|
||||||
share = CooperationMindShare.objects.filter(share_uuid_hash=share_uuid_hash, share_uuid=share_uuid).first()
|
share = CooperationMindShare.objects.filter(share_uuid_hash=share_uuid_hash, share_uuid=share_uuid).first()
|
||||||
if share is None:
|
if share is None:
|
||||||
@@ -136,8 +139,15 @@ class JsMindShareView(LoginRequiredJSONMixin, ListAPIView):
|
|||||||
mind = CooperationMind.objects.filter(id=share.coop_mind_id).first()
|
mind = CooperationMind.objects.filter(id=share.coop_mind_id).first()
|
||||||
serializer = CooperationMindSerializer(mind)
|
serializer = CooperationMindSerializer(mind)
|
||||||
return build_response(data=serializer.data)
|
return build_response(data=serializer.data)
|
||||||
|
elif coop_mind_id is not None:
|
||||||
|
# 查询分享信息
|
||||||
|
share = CooperationMindShare.objects.filter(operator_user_id=user.id, coop_mind_id=coop_mind_id).first()
|
||||||
|
if share is None:
|
||||||
|
return build_response(code=CODE_FAILED, msg='分享不存在')
|
||||||
|
serializer = CooperationMindShareSerializer(share)
|
||||||
|
return build_response(data=serializer.data)
|
||||||
else:
|
else:
|
||||||
user = request.user
|
# 查询列表
|
||||||
self.queryset = CooperationMindShare.objects.filter(operator_user_id=user.id).all()
|
self.queryset = CooperationMindShare.objects.filter(operator_user_id=user.id).all()
|
||||||
return self.list(request, *args, **kwargs)
|
return self.list(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.share_mind(${item.id})">分享</a>`
|
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.share_mind(${item.id})">分享</a>`
|
||||||
} else if (src_page === 'share') {
|
} else if (src_page === 'share') {
|
||||||
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.share_cancel(${item.id})">取消分享</a>
|
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.share_cancel(${item.id})">取消分享</a>
|
||||||
<a class="dropdown-item" href="javascript:void(0);" onclick="">查看分享链接</a>`
|
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.fetch_share_info(${item.id})">查看分享链接</a>`
|
||||||
}
|
}
|
||||||
|
|
||||||
const content = `<div class="card col-2" style="margin: 6px; margin-left: 20px;" id='card_${uuid}'>
|
const content = `<div class="card col-2" style="margin: 6px; margin-left: 20px;" id='card_${uuid}'>
|
||||||
@@ -230,6 +230,26 @@
|
|||||||
async: false
|
async: false
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/**获得分享信息*/
|
||||||
|
fetch_share_info: function (mind_id) {
|
||||||
|
const me = this
|
||||||
|
$.ajax({
|
||||||
|
type: "get",
|
||||||
|
url: "share",
|
||||||
|
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||||
|
data: {'coop_mind_id': mind_id},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (resp) {
|
||||||
|
if (me.is_success_resp(resp)) {
|
||||||
|
const data = resp.data
|
||||||
|
me.show_share_url(data.share_uuid, data.share_uuid_hash)
|
||||||
|
} else {
|
||||||
|
common_alert(resp.msg)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async: false
|
||||||
|
});
|
||||||
|
},
|
||||||
is_success_resp(resp) {
|
is_success_resp(resp) {
|
||||||
return resp.code === 0
|
return resp.code === 0
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user