Files
sundynix-pets/pets-fe/pages/home/home.wxml
T
Blizzard b8b3ba99b4 fix(fe): 顶部固定条去掉补丁感 + 社区分类吸顶 + 切分类回顶部
## 那条 banner 为什么丑

我给它加了不透明底色 + 分隔线,而页面本身是渐变背景——等于在渐变上
贴了块补丁,屏幕上出现三条颜色不搭的横带。

但它根本不需要背景:它在文档流里而不是浮层,内容永远不会滚到它下面。
去掉 background / backdrop-filter / border 之后自然融进页面渐变。
顺手把 .pet-bar 改名 .top-bar,因为社区也要用它。

## 社区

- 分类标签移出滚动区吸顶。原来一滚就没了,想换分类还得先滚回顶部
- 「发布图文」那个大黑按钮独占 124rpx,而发帖是低频操作,不该在每屏
  都占着首屏。压成右侧的小胶囊,收进同一条,始终可点
- 切分类回到顶部:不然从「推荐」滚到一半切到「关注」,看到的是新列表
  的中间,会以为内容错乱了

回顶用 scroll-into-view + 锚点,并在 bindscroll 里清掉锚点值——
不清的话下次再设同一个值不会触发,第二次切分类就不动了。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-29 17:05:17 +08:00

102 lines
4.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<nav-bar title="肉垫计划"></nav-bar>
<view class="top-bar"><pet-switch bind:add="onAddPet"></pet-switch></view>
<scroll-view class="page-scroll" scroll-y="{{true}}" enhanced="{{true}}" show-scrollbar="{{false}}">
<view class="page-body">
<view class="top-row">
<view class="greeting">
<view class="greet-h2">{{summary.greeting || '你好'}}</view>
<view class="greet-p">今天也要照顾好 {{pet.name}}</view>
</view>
<view class="icon-stack">
<view class="icon-btn" data-type="reminders" bindtap="openSheet"><pt-icon name="bell" size="{{36}}"></pt-icon></view>
<view class="icon-btn" bindtap="goProfile"><pt-icon name="settings" size="{{36}}"></pt-icon></view>
</view>
</view>
<!-- 门面:完成度环 + 当下状态。点进去编辑档案 -->
<view class="card hero-card" bindtap="onHeroTap">
<view class="hero-row">
<stat-ring percent="{{summary.health_pct}}" size="{{168}}">
<view class="ring-num">{{summary.health_pct}}<text class="ring-unit">%</text></view>
<view class="ring-cap">完成度</view>
</stat-ring>
<view class="hero-main">
<view class="hero-title">{{pet.name || '还没有毛孩子'}}</view>
<view class="hero-sub">{{pet.id ? undoneText : '点这里建一份档案,任务和提醒会自动排好'}}</view>
<view class="chip-row">
<view wx:for="{{heroChips}}" wx:key="text" class="chip {{item.tone}}">
<pt-icon name="{{item.icon}}" size="{{22}}"></pt-icon>{{item.text}}
</view>
</view>
</view>
</view>
<view class="hero-meta">{{pet.age}}{{pet.weight}}{{pet.stage}}</view>
</view>
<view class="date-strip">
<view wx:for="{{summary.week}}" wx:key="date"
class="day {{item.active ? 'active' : ''}} {{item.date === selectedDate ? 'sel' : ''}} {{item.has_dot ? 'has-dot' : ''}}"
data-date="{{item.date}}" data-active="{{item.active}}" bindtap="onTapDay">
<text>{{item.weekday}}</text><text class="day-b">{{item.day}}</text>
</view>
</view>
<view class="card">
<view class="section-head">
<view class="sh-title">{{taskLabel}}</view>
<view class="head-links">
<view class="link" data-type="manageTasks" bindtap="openSheet">管理</view>
<view wx:if="{{selectedDate && selectedDate !== todayDate}}" class="link" bindtap="backToToday">回今天</view>
<view wx:else class="link" bindtap="completeTasks">全部完成</view>
</view>
</view>
<view class="task-list">
<view wx:for="{{tasks}}" wx:key="title" class="task {{item.done ? 'done' : ''}}" data-index="{{index}}" bindtap="onTapTask">
<view class="circle"><pt-icon wx:if="{{item.done}}" name="check" size="{{22}}"></pt-icon></view>
<view class="task-text"><text class="tt-b">{{item.title}}</text><view wx:if="{{item.sub}}" class="tt-p">{{item.sub}}</view></view>
<view wx:if="{{item.priority}}" class="priority">{{item.priority}}</view>
</view>
<view wx:if="{{tasks.length === 0}}" class="empty">这天没有任务记录</view>
</view>
</view>
<view class="card">
<view class="section-head">
<view class="sh-title">快速记录</view>
<view class="link" bindtap="goRecord">更多</view>
</view>
<view class="quick-grid">
<view wx:for="{{quickItems}}" wx:key="type" class="quick {{item.tone}}" data-type="{{item.type}}" bindtap="openSheet">
<pt-icon name="{{item.icon}}" size="{{44}}"></pt-icon>{{item.label}}
</view>
</view>
</view>
<view class="card">
<view class="section-head">
<view class="sh-title">AI 今日建议</view>
</view>
<view class="ai-text">{{summary.advice || '正在生成今日建议…'}}</view>
<view class="btn btn-dark btn-block ai-cta" bindtap="onFab">
<pt-icon name="ai" size="{{32}}"></pt-icon>问问 AI 养宠助手
</view>
</view>
<view class="card">
<view class="section-head">
<view class="sh-title">新手内容</view>
<view class="link" bindtap="goLearn">查看</view>
</view>
<view wx:if="{{firstArticle}}" class="article-card no-shadow" style="margin-bottom:0" bindtap="openFirstArticle">
<view class="article-icon"><pt-icon name="{{firstArticle.icon}}" size="{{48}}" fallback="book"></pt-icon></view>
<view><text class="ac-b">{{firstArticle.title}}</text><view class="ac-p">{{firstArticle.desc}}</view></view>
</view>
</view>
</view>
</scroll-view>
<fab bind:tap="onFab"></fab>
<bottom-sheet show="{{sheetShow}}" type="{{sheetType}}" bind:close="closeSheet" bind:saved="onSheetSave"></bottom-sheet>