fix(fe): 修社区图片撑破网格;发帖限 3 张;上传偶发失败自动重试 #5

Merged
Blizzard merged 33 commits from feat/dev into main 2026-07-31 10:43:15 +00:00
2 changed files with 10 additions and 11 deletions
Showing only changes of commit 282306b919 - Show all commits
+8 -8
View File
@@ -23,7 +23,8 @@ function fmtWhen(iso) {
return d.getMonth() + 1 + '月' + d.getDate() + '日'; return d.getMonth() + 1 + '月' + d.getDate() + '日';
} }
const TL_PAGE = 10; // 首页最近记录只是速览,固定最新几条,翻全量去「全部记录」页,避免首页无限滚
const TL_LIMIT = 6;
Page({ Page({
data: { data: {
@@ -38,7 +39,6 @@ Page({
needNextPlan: false, needNextPlan: false,
monthCost: 0, monthCost: 0,
timeline: [], timeline: [],
tlPage: 1,
hasMore: false, hasMore: false,
}, },
onLoad() { onLoad() {
@@ -127,11 +127,11 @@ Page({
.then((b) => this.setData({ monthCost: (b && b.total) || 0 })) .then((b) => this.setData({ monthCost: (b && b.total) || 0 }))
.catch(() => this.setData({ monthCost: 0 })); .catch(() => this.setData({ monthCost: 0 }));
}, },
loadTimeline(page) { loadTimeline() {
const id = store.currentPetId(); const id = store.currentPetId();
if (!id) return; if (!id) return;
api api
.getRecords(id, { page, pageSize: TL_PAGE }) .getRecords(id, { page: 1, pageSize: TL_LIMIT })
.then((res) => { .then((res) => {
const list = (res.list || []).map((r) => ({ const list = (res.list || []).map((r) => ({
id: r.id, id: r.id,
@@ -142,13 +142,13 @@ Page({
image: r.image_url || '', image: r.image_url || '',
timeText: fmtWhen(r.occurred_at), timeText: fmtWhen(r.occurred_at),
})); }));
const merged = page === 1 ? list : this.data.timeline.concat(list); // 有更多就露出「查看全部」入口,跳到能分页筛选的全部记录页
this.setData({ timeline: merged, tlPage: page, hasMore: merged.length < (res.total || 0) }); this.setData({ timeline: list, hasMore: (res.total || 0) > list.length });
}) })
.catch(() => {}); .catch(() => {});
}, },
loadMore() { goHistory() {
if (this.data.hasMore) this.loadTimeline(this.data.tlPage + 1); wx.navigateTo({ url: '/pages/history/history' });
}, },
previewImage(e) { previewImage(e) {
const url = e.currentTarget.dataset.url; const url = e.currentTarget.dataset.url;
+2 -3
View File
@@ -2,8 +2,7 @@
<view class="top-bar on-band"><pet-switch bind:add="onAddPet"></pet-switch></view> <view class="top-bar on-band"><pet-switch bind:add="onAddPet"></pet-switch></view>
<scroll-view class="page-scroll" scroll-y="{{true}}" enhanced="{{true}}" show-scrollbar="{{false}}" <scroll-view class="page-scroll" scroll-y="{{true}}" enhanced="{{true}}" show-scrollbar="{{false}}">
bindscrolltolower="loadMore">
<view class="page-body"> <view class="page-body">
<!-- 门面:宠物名片。点进去编辑档案 --> <!-- 门面:宠物名片。点进去编辑档案 -->
<view class="card hero-card" bindtap="onHeroTap"> <view class="card hero-card" bindtap="onHeroTap">
@@ -110,7 +109,7 @@
<view class="empty lg">还没有记录。点上面的「记一笔」开始, <view class="empty lg">还没有记录。点上面的「记一笔」开始,
体重趋势和健康洞察都会从这些记录里长出来。</view> 体重趋势和健康洞察都会从这些记录里长出来。</view>
</view> </view>
<view wx:if="{{hasMore}}" class="tl-more" bindtap="loadMore">加载更多</view> <view wx:if="{{hasMore}}" class="tl-more" bindtap="goHistory">查看全部记录 </view>
</view> </view>
</scroll-view> </scroll-view>