star function
This commit is contained in:
+13
-12
@@ -22,7 +22,7 @@
|
||||
this.uuid = (new Date().getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16)
|
||||
this.current_page_num = 1
|
||||
this.default_page_size = 15
|
||||
this.title_map = new Map([["main", "全部文件"], ["share", "我的分享"]]);// k-v 的形式
|
||||
this.title_map = new Map([["main", "全部文件"], ["share", "我的分享"], ["star", "我的收藏"]]);// k-v 的形式
|
||||
}
|
||||
|
||||
DefaultView.prototype = {
|
||||
@@ -43,8 +43,8 @@
|
||||
}
|
||||
|
||||
// 判断页面
|
||||
const src_page = this.get_src_page()
|
||||
$('#main h5').html(this.title_map.get(src_page))
|
||||
const page_tag = this.get_page_tag()
|
||||
$('#main h5').html(this.title_map.get(page_tag))
|
||||
},
|
||||
get_uu_id: function () {
|
||||
return (new Date().getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16)
|
||||
@@ -67,7 +67,7 @@
|
||||
});
|
||||
},
|
||||
/**获得源页面*/
|
||||
get_src_page: function () {
|
||||
get_page_tag: function () {
|
||||
return $('#src_page').html()
|
||||
},
|
||||
/**获得导图*/
|
||||
@@ -82,11 +82,10 @@
|
||||
me.current_page_num = current_page
|
||||
|
||||
// 获得跳转源页面
|
||||
const src_page = me.get_src_page()
|
||||
|
||||
const page_tag = me.get_page_tag()
|
||||
$.ajax({
|
||||
type: `get`,
|
||||
url: `list?page=${current_page}&page_size=${page_size}&s_p=${src_page}`,
|
||||
url: `list?page=${current_page}&page_size=${page_size}&s_p=${page_tag}`,
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
@@ -106,14 +105,16 @@
|
||||
const uuid = me.get_uu_id()
|
||||
|
||||
// 添加按钮组
|
||||
let sub_btn;
|
||||
if (src_page === 'b9b101e') {
|
||||
let sub_btn = '';
|
||||
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>`
|
||||
} else if (src_page === 'share') {
|
||||
} 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>`
|
||||
} else if (page_tag === 'star') {
|
||||
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="">取消收藏</a>`
|
||||
}
|
||||
|
||||
const content = `<div class="card col-2" style="margin: 6px; margin-left: 20px;" id='card_${uuid}'>
|
||||
@@ -490,13 +491,13 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/2_s">
|
||||
<a class="nav-link" href="/2_share">
|
||||
<span data-feather="share-2"></span>
|
||||
我的分享
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="javascript:void(0);">
|
||||
<a class="nav-link" href="/2_star">
|
||||
<span data-feather="star"></span>
|
||||
我的收藏
|
||||
</a>
|
||||
|
||||
@@ -144,8 +144,7 @@
|
||||
/**收藏或者取消收藏*/
|
||||
star: function () {
|
||||
const coop_mind_id = this.coop_mind_id
|
||||
console.log(coop_mind_id)
|
||||
console.log(this.from_share)
|
||||
console.log(`this.from_share:${this.from_share}`)
|
||||
|
||||
// ajax start
|
||||
$.ajax({
|
||||
@@ -155,11 +154,7 @@
|
||||
data: {'coop_mind_id': coop_mind_id},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
if (resp.code === 0) {
|
||||
console.log(resp)
|
||||
} else {
|
||||
common_alert(resp.msg)
|
||||
}
|
||||
common_alert(resp.msg)
|
||||
},
|
||||
async: false
|
||||
});
|
||||
|
||||
@@ -15,11 +15,13 @@ function common_alert(text, class_str) {
|
||||
// append
|
||||
$('body').append(content)
|
||||
// clean
|
||||
if (bundle_alert) {
|
||||
setTimeout(function () {
|
||||
setTimeout(function () {
|
||||
if (bundle_alert) {
|
||||
$('.alert').alert('close')
|
||||
}, 1500)
|
||||
}
|
||||
} else {
|
||||
$('.alert').fadeOut('slow')
|
||||
}
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
function primary_alert(text) {
|
||||
|
||||
Reference in New Issue
Block a user