添加协同编辑模块
This commit is contained in:
@@ -38,6 +38,7 @@ urlpatterns = [
|
||||
path('share', JsMindShareView.as_view()), # 分享思维导图,查询等
|
||||
path('star', JsMindStarView.as_view()), # 收藏思维导图
|
||||
|
||||
path('bianji', JsMindbianjiView.as_view()), # 跳转到协同编辑页面
|
||||
# ---------------------------------------------------
|
||||
path('register', MindUserView.as_view()), # 用户注册
|
||||
path('login', LoginView.as_view()), # 用户登录
|
||||
|
||||
@@ -11,8 +11,9 @@ def to_baiban(request):
|
||||
"""
|
||||
协作白板
|
||||
"""
|
||||
test_date = request.GET.get('test')
|
||||
param = {"page": "share",
|
||||
"path":"test"}
|
||||
"path": test_date}
|
||||
return render(request, "html/baiban.html", param)
|
||||
|
||||
def to_share(request):
|
||||
|
||||
@@ -241,6 +241,31 @@ class JsMindShareView(LoginRequiredJSONMixin, ListAPIView):
|
||||
res = CooperationMindShare.objects.filter(coop_mind_id=id, operator_user_id=user.id).delete()
|
||||
return build_response(msg="操作成功", data=res[0])
|
||||
|
||||
class JsMindbianjiView(LoginRequiredJSONMixin, ListAPIView):
|
||||
"""
|
||||
思维导图分享view
|
||||
"""
|
||||
serializer_class = CooperationMindShareSerializer
|
||||
filter_backends = [DjangoFilterBackend]
|
||||
filter_class = CooperationMindShareFilter
|
||||
pagination_class = DefaultNumberPagination
|
||||
|
||||
def post(self, request):
|
||||
"""
|
||||
点击协同编辑
|
||||
"""
|
||||
post_body = request.POST
|
||||
id = post_body.get('id')
|
||||
user = request.user
|
||||
if id is None:
|
||||
return build_response(code=CODE_FAILED, msg='参数错误')
|
||||
if user.id is None:
|
||||
return build_response(code=CODE_FAILED, msg='用户未登录')
|
||||
|
||||
res = f"http://106.54.50.78/2_baiban?test={id}"
|
||||
return build_response(msg="操作成功", data=res)
|
||||
|
||||
|
||||
|
||||
class JsMindStarView(LoginRequiredJSONMixin, ListAPIView):
|
||||
"""
|
||||
|
||||
@@ -106,7 +106,8 @@
|
||||
if (page_tag === 'b9b101e') {
|
||||
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="window.open('2_d?id=${item.id}&s_p=b9b101e')">编辑</a>
|
||||
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_mind(${item.id},'card_${uuid}')">删除</a>
|
||||
<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>
|
||||
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.open_bianji(${item.id})">协同编辑</a>`
|
||||
} else if (page_tag === 'share') {
|
||||
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="mind.fetch_share_info(${item.id})">查看分享链接</a>`
|
||||
@@ -215,6 +216,22 @@
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/**分享脑图*/
|
||||
open_bianji: function (mind_id) {
|
||||
const me = this
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "bianji",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {'id': mind_id},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
window.location.href = resp.data;
|
||||
console.log(resp)
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/**取消分享*/
|
||||
share_cancel: function (mind_id) {
|
||||
const me = this
|
||||
|
||||
@@ -215,6 +215,22 @@
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/**分享脑图*/
|
||||
open_bianji: function (mind_id) {
|
||||
const me = this
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "bianji",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {'id': mind_id},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
me.show_share_url(`${resp.data.u}`, `${resp.data.h}`)
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
|
||||
/**取消分享*/
|
||||
share_cancel: function (mind_id) {
|
||||
const me = this
|
||||
|
||||
Reference in New Issue
Block a user