【操盘手端】自动点赞提交

This commit is contained in:
Ghost
2025-04-10 16:40:30 +08:00
parent c7062445ab
commit e3d29f0935
29 changed files with 2863 additions and 1684 deletions

31
Cunkebao/lib/toast.ts Normal file
View File

@@ -0,0 +1,31 @@
export const showToast = (message: string, type: 'success' | 'error' = 'success') => {
// 创建提示元素
const toast = document.createElement('div');
toast.className = `fixed inset-0 flex items-center justify-center z-50`;
// 创建遮罩层
const overlay = document.createElement('div');
overlay.className = 'fixed inset-0';
// 创建内容框
const content = document.createElement('div');
content.className = `relative bg-black/50 p-4 rounded-lg shadow-lg text-white z-50 min-w-[300px] max-w-[80%]`;
// 创建消息
const messageElement = document.createElement('p');
messageElement.className = 'text-base text-center';
messageElement.textContent = message;
// 组装元素
content.appendChild(messageElement);
toast.appendChild(overlay);
toast.appendChild(content);
// 添加到页面
document.body.appendChild(toast);
// 3秒后自动移除
setTimeout(() => {
toast.remove();
}, 1500);
};