fix: comply with F2E Spec — filename naming, any types, JSDoc
- Rename PascalCase component files to kebab-case (AnnouncementModal → announcement-modal, McGlass → mc-glass) - Replace any types with proper uni-app/WeChat callback types (RequestSuccessCallbackResult, LoginRes, ShowModalRes, etc.) - Add JSDoc documentation comments to all exported/important functions Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
77c177bfa9
commit
f10a1896e7
@@ -1,8 +1,10 @@
|
||||
/** 数字补零(用于日期格式化) */
|
||||
const formatNumber = (n: number): string => {
|
||||
const str = n.toString()
|
||||
return str[1] ? str : '0' + str
|
||||
}
|
||||
|
||||
/** 格式化日期时间为 `YYYY/M/D HH:mm:ss` */
|
||||
function formatTime(date: Date | number | string): string {
|
||||
const d = new Date(date)
|
||||
const year = d.getFullYear()
|
||||
@@ -14,6 +16,7 @@ function formatTime(date: Date | number | string): string {
|
||||
return `${year}/${month}/${day} ${[hour, minute, second].map(formatNumber).join(':')}`
|
||||
}
|
||||
|
||||
/** 显示 Toast 提示 */
|
||||
function showToast(title: string, icon: 'success' | 'loading' | 'error' | 'none' = 'none'): void {
|
||||
uni.showToast({
|
||||
title,
|
||||
@@ -22,14 +25,17 @@ function showToast(title: string, icon: 'success' | 'loading' | 'error' | 'none'
|
||||
})
|
||||
}
|
||||
|
||||
/** 跳转到指定页面 */
|
||||
function navigateTo(url: string): void {
|
||||
uni.navigateTo({ url })
|
||||
}
|
||||
|
||||
/** 重定向到指定页面 */
|
||||
function redirectTo(url: string): void {
|
||||
uni.redirectTo({ url })
|
||||
}
|
||||
|
||||
/** 切换到 tabBar 页面 */
|
||||
function switchTab(url: string): void {
|
||||
uni.switchTab({ url })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user