diff --git a/page/routes/migration/index.css b/page/routes/migration/index.css index 8ad3f08..a372d70 100644 --- a/page/routes/migration/index.css +++ b/page/routes/migration/index.css @@ -5,3 +5,34 @@ .typecho-access-migration-summary { margin: 20px 0; } + +.typecho-access-migration-btn { + border: none; + background-color: #b94a48; + cursor: pointer; + border-radius: 2px; + color: #fff; + display: inline-block; + padding: 0 12px; + height: 32px; + vertical-align: middle; + zoom: 1; +} + +.typecho-access-migration-btn:focus { + outline: 0; +} + +.typecho-access-migration-btn:hover { + transition-duration: 0.4s; + background-color: #a4403f; +} + +.typecho-access-migration-btn:active { + background-color: #9c3e3c; +} + +.typecho-access-migration-btn:disabled { + background-color: #c1605e; + cursor: default; +} diff --git a/page/routes/migration/index.js b/page/routes/migration/index.js index 00c44cc..5026a14 100644 --- a/page/routes/migration/index.js +++ b/page/routes/migration/index.js @@ -9,6 +9,11 @@ $(document).ready(function () { success: function (res) { if (res.code === 0) { if (res.data.remain === 0) { + swal({ + icon: "success", + title: "完成", + text: "旧版数据迁移完成!", + }); $('body').loadingModal('hide'); } else { $('body').loadingModal('text', '迁移中,剩余' + res.data.remain + '条等待迁移...'); @@ -17,11 +22,33 @@ $(document).ready(function () { $('#ancient-logs-count').text(res.data.remain); } }, + error: function (xhr, status, error) { + if (!silent) { + $('.typecho-access-logs-main').loadingModal('hide'); + } + swal({ + icon: "error", + title: "错误", + text: "请求错误 code: " + xhr.status, + }); + }, }); } $('[data-action="migrate"]').click(function() { - start(); + swal({ + title: "确定进行旧版数据迁移?", + text: "\n1. 每次迁移1000条,自动重复直到完全迁移完成。\n2. 可随时通过关闭页面中断迁移。\n3. 迁移中断后下次将从中断处继续迁移。\n4. 请勿同时打开多个页面点击迁移,否则会导致数据重复。", + icon: "warning", + buttons: { + cancel: "算啦", + confirm: "是的", + }, + }).then((value) => { + if (value === true) { + start(); + } + }); }); $.ajax({ diff --git a/page/routes/migration/index.php b/page/routes/migration/index.php index 9982f4a..1d52a75 100644 --- a/page/routes/migration/index.php +++ b/page/routes/migration/index.php @@ -4,14 +4,12 @@ -
-
-
- 存在历史数据: - loading - -
- - +
+
+ 存在历史数据: + loading +
+ +