完成移动端Suno页面功能

This commit is contained in:
RockYang
2025-08-06 17:58:39 +08:00
parent bb6e90d50a
commit ec00f156f0
5 changed files with 791 additions and 349 deletions

View File

@@ -56,3 +56,24 @@ export function showLoading(message = '正在处理...') {
export function closeLoading() {
closeToast()
}
// 自定义 Toast 消息系统
export function showToastMessage(message, type = 'info', duration = 3000) {
const toast = document.createElement('div')
toast.className = `fixed top-20 left-1/2 transform -translate-x-1/2 z-50 px-4 py-2 rounded-lg text-white font-medium ${
type === 'error' ? 'bg-red-500' : type === 'success' ? 'bg-green-500' : 'bg-blue-500'
} animate-fade-in`
toast.textContent = message
document.body.appendChild(toast)
if (duration > 0) {
setTimeout(() => {
toast.classList.add('animate-fade-out')
setTimeout(() => {
if (document.body.contains(toast)) {
document.body.removeChild(toast)
}
}, 300)
}, duration)
}
}