From 38b9fbfa863c3cd2b09e04a6d634c2228e91bec7 Mon Sep 17 00:00:00 2001 From: chenyang Date: Sun, 3 Jul 2022 22:14:26 +0800 Subject: [PATCH] update --- static/html/dashboard.html | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/static/html/dashboard.html b/static/html/dashboard.html index ada7ca8..3e0f684 100644 --- a/static/html/dashboard.html +++ b/static/html/dashboard.html @@ -23,8 +23,8 @@ this.current_page_num = 1 this.default_page_size = 12 } - DefaultView.prototype = { + DefaultView.prototype = { /**界面初始化*/ view_init: function () { const uid = $('#uid').html() @@ -111,18 +111,20 @@ /**分页组件*/ init_pagination: function (count, page_size) { /**计算页数*/ - console.log(Math.floor(count / page_size)) - 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 = $(``) const navigation_ul = $(``) if (this.current_page_num > 1) { - navigation_ul.append(`
  • 上一页
  • `) + navigation_ul.append(`
  • 上一页
  • `) } for (let i = 0; i < all_page; i++) { - navigation_ul.append(`
  • ${i + 1}
  • `) + const ctt = $(`
  • ${i + 1}
  • `) + if (i + 1 === this.current_page_num) { + ctt.addClass('active') + } + navigation_ul.append(ctt) } if (this.current_page_num < all_page) { navigation_ul.append(`
  • 下一页
  • `) @@ -133,6 +135,7 @@ }, /**删除导图*/ del_mind: function (mind_id, card_id) { + const me = this $.ajax({ type: "delete", url: "delete", @@ -142,7 +145,10 @@ success: function (data) { if (data.code === 0) { primary_alert(data.msg) - $('#' + card_id).remove() + // $('#' + card_id).remove() + setTimeout(function () { + me.fetch_mind() + }, 1000) } else { common_alert(data.msg) } @@ -323,7 +329,8 @@ /** modal 显示完毕后事件*/ $('#newMindModal').on('shown.bs.modal', function () { const cookie_checked_ = $.cookie('open_aft_create') - if (cookie_checked_) { + // 从cookie中获得的是字符串 + if (cookie_checked_ === 'true') { $('#exampleCheck1').attr('checked', 'checked') } else { $('#exampleCheck1').removeAttr('checked'); @@ -372,25 +379,25 @@