refactor(frontend): replace toast system with zibll notyf

This commit is contained in:
2026-08-18 02:38:43 +08:00
parent fb11a7ed0c
commit 86614c4905
33 changed files with 603 additions and 802 deletions
+5 -9
View File
@@ -8,10 +8,6 @@
var instances = new WeakMap();
function toast(message, type) {
window.AksrtToast(message, type || "info");
}
function request(path, body, method) {
var options = { method: method || "POST" };
if (body !== undefined) options.body = JSON.stringify(body || {});
@@ -243,7 +239,7 @@
renderView(state, result.data);
return result.data;
}).catch(function (error) {
toast(errorMessage(error, "订单状态已变更,请刷新后查看"));
notyf(errorMessage(error, "订单状态已变更,请刷新后查看"), "danger");
return null;
});
}
@@ -260,12 +256,12 @@
window.location.assign(data.payment_url);
return;
}
toast(data.message || "支付成功", "success");
notyf(data.message || "支付成功", "success");
refreshView(state);
if (activeDetail(state, number)) openDetail(state, number);
}).catch(function (error) {
button.disabled = false;
toast(errorMessage(error, "网络错误,请稍后重试"), "error");
notyf(errorMessage(error, "网络错误,请稍后重试"), "danger");
});
}
@@ -281,14 +277,14 @@
request(orderPath(number, "/cancel"), {}, "POST").then(function (result) {
var data = result.data || {};
invalidateOrder(number, data.order);
toast("订单已关闭", "success");
notyf("订单已关闭", "success");
refreshView(state);
if (activeDetail(state, number)) openDetail(state, number);
}).catch(function (error) {
button.disabled = false;
button.removeAttribute("data-aksrt-confirm");
button.textContent = "关闭订单";
toast(errorMessage(error, "网络错误,请稍后重试"), "error");
notyf(errorMessage(error, "网络错误,请稍后重试"), "danger");
});
}