微信小程序页面迁移校验之前 P5任务处理之前

This commit is contained in:
Neo
2026-03-09 01:19:21 +08:00
parent 263bf96035
commit 6e20987d2f
1112 changed files with 153824 additions and 219694 deletions

View File

@@ -0,0 +1,45 @@
import { mockNotes } from '../../utils/mock-data'
import type { Note } from '../../utils/mock-data'
Page({
data: {
loading: true,
error: false,
notes: [] as Note[],
/** 系统状态栏高度px用于自定义导航栏顶部偏移 */
statusBarHeight: 20,
},
onLoad() {
// 获取真实状态栏高度兼容所有机型iPhone 刘海屏、安卓异形屏等)
const sysInfo = wx.getSystemInfoSync()
this.setData({ statusBarHeight: sysInfo.statusBarHeight || 20 })
this.loadData()
},
loadData() {
this.setData({ loading: true, error: false })
setTimeout(() => {
// TODO: 替换为真实 API 调用 GET /api/xcx/notes
try {
this.setData({
loading: false,
notes: mockNotes,
})
} catch {
this.setData({ loading: false, error: true })
}
}, 400)
},
/** 返回上一页 */
onBack() {
wx.navigateBack()
},
/** 错误态重试 */
onRetry() {
this.loadData()
},
})