删除恢复功能
This commit is contained in:
@@ -100,7 +100,6 @@
|
||||
let idx = 0
|
||||
let row = $(`<div class="row"></row>`)
|
||||
|
||||
|
||||
results.forEach(function (item) {
|
||||
const uuid = me.get_uu_id()
|
||||
|
||||
@@ -114,7 +113,9 @@
|
||||
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>`
|
||||
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.un_star(${item.id})">取消收藏</a>`
|
||||
} else if (page_tag === 'recycle') {
|
||||
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_cancel(${item.id})">恢复</a>`
|
||||
}
|
||||
|
||||
const content = `<div class="card col-2" style="margin: 6px; margin-left: 20px;" id='card_${uuid}'>
|
||||
@@ -149,11 +150,14 @@
|
||||
},
|
||||
/**分页组件*/
|
||||
init_pagination: function (count, page_size) {
|
||||
const container = $('#pagination_div')
|
||||
/**计算页数*/
|
||||
if (count <= 0) return
|
||||
if (count <= 0) {
|
||||
container.empty()
|
||||
return
|
||||
}
|
||||
|
||||
const all_page = (count <= page_size) ? 1 : (count % page_size > 0) ? Math.floor(count / page_size) + 1 : Math.floor(count / page_size)
|
||||
const container = $('#pagination_div')
|
||||
const navigation = $(`<nav aria-label="Page navigation example"></nav>`)
|
||||
const navigation_ul = $(`<ul class="pagination justify-content-center"></ul>`)
|
||||
|
||||
@@ -231,6 +235,42 @@
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/** 删除恢复*/
|
||||
del_cancel: function (mind_id) {
|
||||
const me = this
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "delete_cancel",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {'coop_mind_id': mind_id, 'op_type': 'delete_cancel'},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
common_alert(resp.msg)
|
||||
if (me.is_success_resp(resp)) {
|
||||
me.fetch_mind()
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/** 取消收藏 */
|
||||
un_star: function (mind_id) {
|
||||
const me = this
|
||||
$.ajax({
|
||||
type: "delete",
|
||||
url: "star",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {'coop_mind_id': mind_id},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
common_alert(resp.msg)
|
||||
if (me.is_success_resp(resp)) {
|
||||
me.fetch_mind()
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/**获得分享信息*/
|
||||
fetch_share_info: function (mind_id) {
|
||||
const me = this
|
||||
|
||||
Reference in New Issue
Block a user