feat: rebuild pet app and backend around core care flows
This commit is contained in:
+53
-221
@@ -1,236 +1,68 @@
|
||||
const store = require('../../utils/store.js');
|
||||
const api = require('../../utils/api.js');
|
||||
const { toastErr } = require('../../utils/ui.js');
|
||||
const { syncTabBar } = require('../../utils/tabbar.js');
|
||||
const recordTypes = require('../../utils/recordTypes.js');
|
||||
const petmeta = require('../../utils/petmeta.js');
|
||||
|
||||
function mapTask(t) {
|
||||
return { id: t.id, title: t.title, sub: t.description, priority: t.priority, done: t.done, sheet: t.sheet_type };
|
||||
}
|
||||
|
||||
// 时间轴上的相对时间。首页关心的是「什么时候记的」,精确到分只在今天有意义
|
||||
function fmtWhen(iso) {
|
||||
if (!iso) return '';
|
||||
const d = new Date(iso);
|
||||
if (isNaN(d.getTime())) return '';
|
||||
const p = (n) => (n < 10 ? '0' + n : '' + n);
|
||||
const now = new Date();
|
||||
const sameDay = d.toDateString() === now.toDateString();
|
||||
if (sameDay) return '今天 ' + p(d.getHours()) + ':' + p(d.getMinutes());
|
||||
const y = new Date(now.getTime() - 86400000);
|
||||
if (d.toDateString() === y.toDateString()) return '昨天 ' + p(d.getHours()) + ':' + p(d.getMinutes());
|
||||
return d.getMonth() + 1 + '月' + d.getDate() + '日';
|
||||
}
|
||||
|
||||
// 首页最近记录只是速览,固定最新几条,翻全量去「全部记录」页,避免首页无限滚
|
||||
const TL_LIMIT = 6;
|
||||
|
||||
const { secure, toast } = require("../../utils/api");
|
||||
Page({
|
||||
data: {
|
||||
pet: {},
|
||||
zodiac: '',
|
||||
daysTogether: 0,
|
||||
sexIcon: '',
|
||||
sexTone: '',
|
||||
pets: [],
|
||||
selected: [],
|
||||
tasks: [],
|
||||
planHint: '',
|
||||
drift: {},
|
||||
needNextPlan: false,
|
||||
monthCost: 0,
|
||||
timeline: [],
|
||||
hasMore: false,
|
||||
},
|
||||
onLoad() {
|
||||
this._unsub = store.subscribe((pet) => {
|
||||
this.applyPet(pet);
|
||||
if (!this._inited) return;
|
||||
this.loadAll();
|
||||
});
|
||||
},
|
||||
onUnload() {
|
||||
if (this._unsub) this._unsub();
|
||||
walkCount: 0,
|
||||
name: "铲屎官",
|
||||
loading: true,
|
||||
},
|
||||
onShow() {
|
||||
syncTabBar(this);
|
||||
recordTypes.load().catch(() => {});
|
||||
store
|
||||
.ready()
|
||||
.then(() => {
|
||||
this._inited = true;
|
||||
this.applyPet(store.getPet());
|
||||
this.loadAll();
|
||||
})
|
||||
.catch((e) => wx.showToast({ title: e.message || '加载失败', icon: 'none' }));
|
||||
this.load();
|
||||
},
|
||||
// 门面上那几样都是本地算的,不用等接口
|
||||
applyPet(pet) {
|
||||
const p = pet || {};
|
||||
const badge = petmeta.genderBadge(p.gender);
|
||||
this.setData({
|
||||
pet: p,
|
||||
zodiac: petmeta.zodiac(p.birthday),
|
||||
daysTogether: petmeta.daysTogether(p),
|
||||
sexIcon: badge.icon,
|
||||
sexTone: badge.tone,
|
||||
});
|
||||
async load() {
|
||||
try {
|
||||
const [pets, tasks, walks, me] = await Promise.all([
|
||||
secure("/pets"),
|
||||
secure("/tasks"),
|
||||
secure("/walks"),
|
||||
secure("/me"),
|
||||
]);
|
||||
const chosen = wx.getStorageSync("walk_pet_ids") || [],
|
||||
month = new Date().toISOString().slice(0, 7);
|
||||
this.setData({
|
||||
pets,
|
||||
selected: chosen.filter((id) => pets.some((p) => p.id === id)),
|
||||
tasks: tasks.items,
|
||||
walkCount: walks.filter((w) => w.started_at.slice(0, 7) === month)
|
||||
.length,
|
||||
name: me.nickname || "铲屎官",
|
||||
loading: false,
|
||||
});
|
||||
} catch (e) {
|
||||
this.setData({ loading: false });
|
||||
toast(e);
|
||||
}
|
||||
},
|
||||
loadAll() {
|
||||
this.loadTasks();
|
||||
this.loadTimeline(1);
|
||||
this.loadEntries();
|
||||
this.loadDrift();
|
||||
pick(e) {
|
||||
this.setData({ selected: e.detail.selected });
|
||||
wx.setStorageSync("walk_pet_ids", e.detail.selected);
|
||||
},
|
||||
loadTasks() {
|
||||
const id = store.currentPetId();
|
||||
if (!id) return;
|
||||
api
|
||||
.getTasks(id)
|
||||
.then((tasks) => this.setData({ tasks: (tasks || []).map(mapTask) }))
|
||||
.catch((e) => toastErr(e));
|
||||
},
|
||||
// 两个入口上的副标题:计划还剩几件、本月花了多少。
|
||||
// 空着的话入口就是两个没有信息量的图标
|
||||
// 阶段漂移检查。放在 loadEntries 里而不是单独一次 —— 它和「计划还剩几件」
|
||||
// 都是首页那一屏要的,一起拉省一个来回
|
||||
loadDrift() {
|
||||
const id = store.currentPetId();
|
||||
if (!id) return;
|
||||
api
|
||||
.petStageDrift(id)
|
||||
.then((d) => this.setData({ drift: d || {} }))
|
||||
.catch(() => this.setData({ drift: {} }));
|
||||
},
|
||||
loadEntries() {
|
||||
const id = store.currentPetId();
|
||||
if (!id) return;
|
||||
// 副标题优先说「该排下月计划了」——那是有时效的事;
|
||||
// 本月还剩几件是随时能看的,让位给它
|
||||
api
|
||||
.planMonthStatus(id)
|
||||
.then((st) => {
|
||||
const s = st || {};
|
||||
this.setData({
|
||||
needNextPlan: !!s.need_next,
|
||||
planHint: s.need_next
|
||||
? (s.next_label || '下月') + '计划还没排'
|
||||
: s.this_undone > 0
|
||||
? '本月还有 ' + s.this_undone + ' 件'
|
||||
: s.this_month > 0
|
||||
? '本月都做完了'
|
||||
: '还没有安排',
|
||||
});
|
||||
})
|
||||
.catch(() => this.setData({ needNextPlan: false, planHint: '' }));
|
||||
api
|
||||
.getBill(id, 'month')
|
||||
.then((b) => this.setData({ monthCost: (b && b.total) || 0 }))
|
||||
.catch(() => this.setData({ monthCost: 0 }));
|
||||
},
|
||||
loadTimeline() {
|
||||
const id = store.currentPetId();
|
||||
if (!id) return;
|
||||
api
|
||||
.getRecords(id, { page: 1, pageSize: TL_LIMIT })
|
||||
.then((res) => {
|
||||
const list = (res.list || []).map((r) => ({
|
||||
id: r.id,
|
||||
type: r.type,
|
||||
tone: (recordTypes.get(r.type) || {}).tone || 'tone-1',
|
||||
title: r.title,
|
||||
description: r.description,
|
||||
image: r.image_url || '',
|
||||
timeText: fmtWhen(r.occurred_at),
|
||||
}));
|
||||
// 有更多就露出「查看全部」入口,跳到能分页筛选的全部记录页
|
||||
this.setData({ timeline: list, hasMore: (res.total || 0) > list.length });
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
goHistory() {
|
||||
wx.navigateTo({ url: '/pages/history/history' });
|
||||
},
|
||||
previewImage(e) {
|
||||
const url = e.currentTarget.dataset.url;
|
||||
if (url) wx.previewImage({ urls: [url], current: url });
|
||||
},
|
||||
onDeleteRecord(e) {
|
||||
const id = e.currentTarget.dataset.id;
|
||||
wx.showModal({
|
||||
title: '删掉这条记录?',
|
||||
content: '趋势和统计会跟着变。',
|
||||
confirmColor: '#EE7D73',
|
||||
success: (r) => {
|
||||
if (!r.confirm) return;
|
||||
api
|
||||
.deleteRecord(id)
|
||||
.then(() => this.loadTimeline(1))
|
||||
.catch((err) => toastErr(err, '删除失败'));
|
||||
},
|
||||
});
|
||||
},
|
||||
onTapTask(e) {
|
||||
const i = e.currentTarget.dataset.index;
|
||||
const t = this.data.tasks[i];
|
||||
// 任务关联了记录类型:去记那一笔。未完成的带上 taskId,
|
||||
// 在记录页保存成功后才回填这条任务完成(onShow 回来自动刷新任务+最近记录)
|
||||
if (t.sheet) {
|
||||
let url = '/pages/addrecord/addrecord?type=' + t.sheet;
|
||||
if (!t.done) url += '&taskId=' + t.id;
|
||||
wx.navigateTo({ url });
|
||||
start() {
|
||||
if (!this.data.selected.length) {
|
||||
wx.showToast({ title: "先选择一起出门的狗狗", icon: "none" });
|
||||
return;
|
||||
}
|
||||
// 没有关联记录类型的任务(自定义/无 sheet_type):直接切换完成。
|
||||
// 后端 toggle 会在完成时补一条 note 记录,这里完成后刷新最近记录即可
|
||||
api
|
||||
.toggleTask(t.id)
|
||||
.then((res) => {
|
||||
const tasks = this.data.tasks.slice();
|
||||
tasks[i] = Object.assign({}, tasks[i], { done: res.done });
|
||||
this.setData({ tasks });
|
||||
if (res.done) this.loadTimeline(1);
|
||||
})
|
||||
.catch((err) => toastErr(err, '操作失败'));
|
||||
wx.redirectTo({ url: "/pages/walk/walk" });
|
||||
},
|
||||
goPlan() {
|
||||
wx.navigateTo({ url: '/pages/plan/plan' });
|
||||
goTasks() {
|
||||
wx.redirectTo({ url: "/pages/tasks/tasks" });
|
||||
},
|
||||
// 去建档页改阶段。改完回来 onShow 会重新拉一次漂移状态,提示自然消失。
|
||||
// 不在首页直接改:改阶段之后要不要套新方案是同一件事,放在一起做才连贯
|
||||
// 点「一起生活的天数」空态,去建档页补到家日期
|
||||
onDaysTap() {
|
||||
const id = this.data.pet && this.data.pet.id;
|
||||
if (!this.data.daysTogether && id) wx.navigateTo({ url: '/pages/petform/petform?id=' + id });
|
||||
goWalks() {
|
||||
wx.redirectTo({ url: "/pages/walk/walk" });
|
||||
},
|
||||
// 身份卡:门面卡右上角进,用当前宠物
|
||||
goIDCard() {
|
||||
const id = this.data.pet && this.data.pet.id;
|
||||
if (id) wx.navigateTo({ url: '/pages/idcard/idcard?id=' + id });
|
||||
},
|
||||
goStageUpdate() {
|
||||
const id = this.data.pet && this.data.pet.id;
|
||||
if (id) wx.navigateTo({ url: '/pages/petform/petform?id=' + id });
|
||||
},
|
||||
goExpense() {
|
||||
wx.navigateTo({ url: '/pages/expense/expense' });
|
||||
},
|
||||
goRecord() {
|
||||
wx.navigateTo({ url: '/pages/record/record' });
|
||||
},
|
||||
onQuickRecord() {
|
||||
wx.navigateTo({ url: '/pages/record/record' });
|
||||
},
|
||||
onAddPet() {
|
||||
wx.navigateTo({ url: '/pages/petform/petform' });
|
||||
},
|
||||
onHeroTap() {
|
||||
const id = this.data.pet && this.data.pet.id;
|
||||
wx.navigateTo({ url: '/pages/petform/petform' + (id ? '?id=' + id : '') });
|
||||
},
|
||||
onShareAppMessage() {
|
||||
return { title: '肉垫计划 · 每天照顾好毛孩子', path: '/pages/home/home' };
|
||||
},
|
||||
onShareTimeline() {
|
||||
return { title: '肉垫计划 · 每天照顾好毛孩子' };
|
||||
async complete(e) {
|
||||
const id = e.currentTarget.dataset.id,
|
||||
task = this.data.tasks.find((t) => t.id === id);
|
||||
try {
|
||||
await secure("/tasks/" + id + "/completion", "PUT", {
|
||||
date: new Date().toLocaleDateString("sv-SE"),
|
||||
completed: !task.completed,
|
||||
});
|
||||
await this.load();
|
||||
} catch (err) {
|
||||
toast(err);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,8 +1 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"nav-bar": "/components/nav-bar/nav-bar",
|
||||
"pet-switch": "/components/pet-switch/pet-switch",
|
||||
"fab": "/components/fab/fab",
|
||||
"pt-icon": "/components/pt-icon/index"
|
||||
}
|
||||
}
|
||||
{ "usingComponents": { "tab-bar": "/components/tab-bar/index", "pet-picker": "/components/pet-picker/index" } }
|
||||
|
||||
+72
-105
@@ -1,116 +1,83 @@
|
||||
<nav-bar title="肉垫计划"></nav-bar>
|
||||
|
||||
<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}}">
|
||||
<view class="page-body">
|
||||
<!-- 门面:宠物名片。点进去编辑档案 -->
|
||||
<view class="card hero-card" bindtap="onHeroTap">
|
||||
<view class="hero-row">
|
||||
<view class="hero-av">
|
||||
<image wx:if="{{pet.avatar_url}}" class="hero-av-img" src="{{pet.avatar_url}}" mode="aspectFill"></image>
|
||||
<block wx:else>{{pet.emoji || '🐾'}}</block>
|
||||
<view wx:if="{{sexIcon}}" class="hero-sex {{sexTone}}">{{sexIcon}}</view>
|
||||
</view>
|
||||
<view class="hero-main">
|
||||
<view class="hero-title">{{pet.name || '还没有毛孩子'}}</view>
|
||||
<view class="hero-meta">
|
||||
<text wx:if="{{pet.breed}}">{{pet.breed}}</text>
|
||||
<text wx:if="{{pet.age}}">{{pet.age}}</text>
|
||||
<text wx:if="{{zodiac}}">{{zodiac}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{pet.id}}" class="hero-idcard" catchtap="goIDCard">
|
||||
<pt-icon name="user" size="{{30}}"></pt-icon>身份卡
|
||||
<view class="screen">
|
||||
<view class="eyebrow">你好,今天也一起好好生活</view>
|
||||
<view class="row top">
|
||||
<view class="title">早安,{{name}} ☀️</view>
|
||||
<image src="/assets/logo-corgi-v2.png" class="avatar" />
|
||||
</view>
|
||||
<view class="hero">
|
||||
<view class="hero-copy">
|
||||
<text class="hero-small">今日的主角</text>
|
||||
<text class="hero-title">小短腿,出发吧!</text>
|
||||
<text class="hero-meta">多只狗狗 · 每一天都是好日子</text>
|
||||
<view class="hero-caption">● 陪伴它们的每一天,都值得记录</view>
|
||||
</view>
|
||||
<image src="/assets/corgi-family-five.png" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="row heading">
|
||||
<text class="section-title">带它们出去走走</text>
|
||||
<text class="link" bindtap="goWalks">遛狗记录 ›</text>
|
||||
</view>
|
||||
<view class="card walk-card">
|
||||
<view class="walk-intro">
|
||||
<view class="dog-emoji">🐕</view>
|
||||
<view>
|
||||
<view class="walk-title">今天的风刚刚好</view>
|
||||
<view class="muted">选择同行的狗狗,一起出门转转。</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 一起生活的天数从到家日算。没填到家日就显示「-」,点一下去补 -->
|
||||
<view wx:if="{{pet.id}}" class="hero-days {{daysTogether ? '' : 'hero-days-empty'}}" catchtap="onDaysTap">
|
||||
<block wx:if="{{daysTogether}}">我们一起生活的第 <text class="hd-n">{{daysTogether}}</text> 天</block>
|
||||
<block wx:else>还没填到家日期,一起生活的天数显示 <text class="hd-n">-</text></block>
|
||||
<view class="picker-label">这次带谁?可以多选</view>
|
||||
<pet-picker pets="{{pets}}" selected="{{selected}}" bind:change="pick" />
|
||||
<button class="primary start" bindtap="start">开始遛狗 →</button>
|
||||
</view>
|
||||
<view class="stats">
|
||||
<view>
|
||||
<text>本月遛狗</text>
|
||||
<strong>
|
||||
{{walkCount}}
|
||||
<small>次</small>
|
||||
</strong>
|
||||
</view>
|
||||
<view>
|
||||
<text>一起出发</text>
|
||||
<strong>
|
||||
{{selected.length}}
|
||||
<small>只</small>
|
||||
</strong>
|
||||
</view>
|
||||
<view>
|
||||
<text>今日任务</text>
|
||||
<strong>
|
||||
{{tasks.length}}
|
||||
<small>项</small>
|
||||
</strong>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 阶段漂移。系统只负责发现,换不换由用户点 —— 偷偷换会让他莫名发现
|
||||
计划变了却找不到原因,而且已经排好的这个月不该被推翻 -->
|
||||
<view wx:if="{{drift.drifted}}" class="card drift-card" bindtap="goStageUpdate">
|
||||
<view class="drift-top">
|
||||
<pt-icon name="trend" size="{{32}}"></pt-icon>
|
||||
<view class="drift-b">{{pet.name}}已经 {{drift.age_label}},从{{drift.stored}}进入{{drift.computed}}了</view>
|
||||
</view>
|
||||
<view class="drift-p">{{drift.basis}}</view>
|
||||
<view class="drift-focus">这个阶段的重点:{{drift.focus}}</view>
|
||||
<view wx:if="{{drift.size}}" class="drift-size">{{drift.size}}</view>
|
||||
<view class="btn btn-primary btn-block drift-cta">去更新阶段和方案</view>
|
||||
<view class="row heading">
|
||||
<text class="section-title">今天要做的事</text>
|
||||
<text class="link" bindtap="goTasks">全部任务 ›</text>
|
||||
</view>
|
||||
|
||||
<!-- 两个入口。竞品那一排是买商品/上豪车/领猫砂盆,是电商和广告位,去掉 -->
|
||||
<view class="card entry-card">
|
||||
<view class="entry" bindtap="goPlan">
|
||||
<view class="entry-ic tone-1">
|
||||
<pt-icon name="plan" size="{{48}}"></pt-icon>
|
||||
<!-- 月底还没排下月计划时提醒。角标做在图标上而不是弹 toast:
|
||||
每次进首页弹一下会很烦,而这件事不紧急、看见就行 -->
|
||||
<view wx:if="{{needNextPlan}}" class="entry-dot"></view>
|
||||
<view class="card tasks">
|
||||
<view
|
||||
wx:for="{{tasks}}"
|
||||
wx:key="id"
|
||||
class="task"
|
||||
data-id="{{item.id}}"
|
||||
bindtap="complete"
|
||||
>
|
||||
<view class="check {{item.completed?'done':''}}">
|
||||
{{item.completed?'✓':''}}
|
||||
</view>
|
||||
<view class="entry-b">管理计划</view>
|
||||
<view class="entry-p {{needNextPlan ? 'warn' : ''}}">{{planHint}}</view>
|
||||
</view>
|
||||
<view class="entry" bindtap="goExpense">
|
||||
<view class="entry-ic tone-2"><pt-icon name="cost" size="{{48}}"></pt-icon></view>
|
||||
<view class="entry-b">记花销</view>
|
||||
<view class="entry-p">{{monthCost > 0 ? '本月 ¥' + monthCost : '还没记过'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 今日任务 -->
|
||||
<view wx:if="{{tasks.length}}" class="card">
|
||||
<view class="section-head">
|
||||
<view class="sh-title">今日任务</view>
|
||||
<!-- 任务的增删改都在计划页 —— 合并之后首页这个「管理」不该再开一个弹层 -->
|
||||
<view class="head-links">
|
||||
<view class="link" bindtap="goPlan">管理</view>
|
||||
<view class="task-icon">
|
||||
{{item.category==='water'?'💧':item.category==='food'?'🥣':'🐾'}}
|
||||
</view>
|
||||
<view class="task-main">
|
||||
<text class="task-name">{{item.title}}</text>
|
||||
<text class="muted">{{item.time_of_day}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="task-list">
|
||||
<view wx:for="{{tasks}}" wx:key="id" 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}}" class="empty">
|
||||
今天还没有任务,给狗狗安排一件小事吧 🐾
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 记录时间轴。首页原来是任务/日历/接下来的堆叠,看不到「我记了什么」;
|
||||
日历挪回计划页了(它本来就属于那儿),这里换成时间轴 —— 首页应该是
|
||||
一条能往下翻的流水,而不是一屏聚合卡 -->
|
||||
<view class="tl-head">
|
||||
<view class="sh-title">最近记录</view>
|
||||
<view class="link" bindtap="goRecord">+ 记一笔</view>
|
||||
</view>
|
||||
|
||||
<view wx:for="{{timeline}}" wx:key="id" class="tl-item">
|
||||
<view class="tl-rail">
|
||||
<view class="tl-dot {{item.tone}}"><pt-icon name="{{item.type}}" size="{{28}}" fallback="note"></pt-icon></view>
|
||||
<view class="tl-line"></view>
|
||||
</view>
|
||||
<view class="tl-body">
|
||||
<view class="tl-when">{{item.timeText}}</view>
|
||||
<view class="tl-card" data-id="{{item.id}}" bindlongpress="onDeleteRecord">
|
||||
<view class="tl-title">{{item.title}}</view>
|
||||
<view wx:if="{{item.description}}" class="tl-desc">{{item.description}}</view>
|
||||
<image wx:if="{{item.image}}" class="tl-img" src="{{item.image}}" mode="aspectFill"
|
||||
data-url="{{item.image}}" catchtap="previewImage"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!timeline.length}}" class="card">
|
||||
<view class="empty lg">还没有记录。点上面的「记一笔」开始,
|
||||
体重趋势和健康洞察都会从这些记录里长出来。</view>
|
||||
</view>
|
||||
<view wx:if="{{hasMore}}" class="tl-more" bindtap="goHistory">查看全部记录 ›</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<fab paw bind:tap="onQuickRecord"></fab>
|
||||
<tab-bar current="/pages/home/home" />
|
||||
|
||||
+165
-94
@@ -1,102 +1,173 @@
|
||||
|
||||
/* 门面卡 */
|
||||
.hero-card{
|
||||
background:
|
||||
radial-gradient(circle at 95% 16%, rgba(245,169,71,.22), transparent 32%),
|
||||
linear-gradient(135deg,#FFFFFF,#FFF6E9);
|
||||
.top {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
/* 一周日期条 */
|
||||
|
||||
|
||||
/* ===== 日期带(原计划页「日历」tab 并过来) ===== */
|
||||
/* 某天的安排 */
|
||||
.dd-title{font-weight:var(--fw-b);font-size:var(--fs-md);margin-bottom:var(--sp-3)}
|
||||
|
||||
/* ===== 接下来 ===== */
|
||||
|
||||
/* ===== 门面:宠物名片 ===== */
|
||||
.hero-card{padding:var(--sp-5)}
|
||||
.hero-row{display:flex;align-items:center;gap:var(--sp-4)}
|
||||
.hero-av{
|
||||
position:relative;flex:none;width:128rpx;height:128rpx;border-radius:50%;
|
||||
background:var(--primary-soft);display:flex;align-items:center;justify-content:center;
|
||||
font-size:60rpx;overflow:visible;
|
||||
.avatar {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
border-radius: 50%;
|
||||
border: 6rpx solid white;
|
||||
box-shadow: 0 5rpx 22rpx #174b3520;
|
||||
}
|
||||
.hero-av-img{width:100%;height:100%;border-radius:50%}
|
||||
/* 性别徽章叠在头像右下:一个很省事但很出效果的细节 */
|
||||
.hero-sex{
|
||||
position:absolute;right:-4rpx;bottom:-4rpx;width:42rpx;height:42rpx;border-radius:50%;
|
||||
border:4rpx solid #fff;color:#fff;font-size:22rpx;line-height:1;
|
||||
display:flex;align-items:center;justify-content:center;
|
||||
.hero {
|
||||
height: 330rpx;
|
||||
background: #194f42;
|
||||
border-radius: 38rpx;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 35rpx;
|
||||
color: white;
|
||||
}
|
||||
.hero-sex.male{background:#5B9BE8}
|
||||
.hero-sex.female{background:#EE85A8}
|
||||
.hero-main{flex:1;min-width:0}
|
||||
.hero-title{font-size:var(--fs-xl);font-weight:var(--fw-b);color:var(--text)}
|
||||
.hero-meta{display:flex;flex-wrap:wrap;gap:var(--sp-3);font-size:var(--fs-sm);color:var(--muted);margin-top:6rpx}
|
||||
.hero-arrow{flex:none;color:var(--muted2);display:flex;align-items:center}
|
||||
.hero-days{
|
||||
margin-top:var(--sp-4);background:var(--primary-soft);color:var(--primary-ink);
|
||||
border-radius:var(--r-md);text-align:center;padding:var(--sp-3);
|
||||
font-size:var(--fs-md);font-weight:var(--fw-b);
|
||||
.hero-copy {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 62%;
|
||||
}
|
||||
.hd-n{font-size:var(--fs-lg);margin:0 4rpx}
|
||||
|
||||
/* ===== 两个入口 ===== */
|
||||
.entry-card{display:flex;padding:var(--sp-4) var(--sp-3)}
|
||||
.entry{flex:1;display:flex;flex-direction:column;align-items:center;gap:4rpx}
|
||||
.entry-ic{
|
||||
width:76rpx;height:76rpx;border-radius:var(--r-md);
|
||||
display:flex;align-items:center;justify-content:center;margin-bottom:2rpx;
|
||||
.hero-small {
|
||||
color: #abd9b8;
|
||||
font-size: 23rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.entry-b{font-size:var(--fs-md);font-weight:var(--fw-b);color:var(--text)}
|
||||
.entry-p{font-size:var(--fs-cap);color:var(--muted)}
|
||||
|
||||
/* ===== 记录时间轴 ===== */
|
||||
.tl-head{display:flex;align-items:center;justify-content:space-between;margin:var(--sp-5) 0 var(--sp-3)}
|
||||
.tl-item{display:flex;gap:var(--sp-3)}
|
||||
.tl-rail{flex:none;width:56rpx;display:flex;flex-direction:column;align-items:center}
|
||||
.tl-dot{
|
||||
width:56rpx;height:56rpx;border-radius:50%;flex:none;
|
||||
display:flex;align-items:center;justify-content:center;
|
||||
.hero-title {
|
||||
font-size: 43rpx;
|
||||
font-weight: 800;
|
||||
margin: 16rpx 0;
|
||||
}
|
||||
/* 竖线连起来才像一条时间轴;最后一条的线会被 body 的高度自然截断 */
|
||||
.tl-line{flex:1;width:2rpx;background:var(--line);margin:6rpx 0}
|
||||
.tl-item:last-of-type .tl-line{display:none}
|
||||
.tl-body{flex:1;min-width:0;padding-bottom:var(--sp-4)}
|
||||
.tl-when{font-size:var(--fs-cap);color:var(--muted);margin-bottom:6rpx}
|
||||
.tl-card{background:#fff;border-radius:var(--r-md);box-shadow:var(--sd-1);padding:var(--sp-4)}
|
||||
.tl-title{font-size:var(--fs-md);font-weight:var(--fw-b);color:var(--text)}
|
||||
.tl-desc{font-size:var(--fs-sm);color:var(--text-2);margin-top:6rpx;line-height:1.5}
|
||||
.tl-img{width:100%;height:320rpx;border-radius:var(--r-sm);margin-top:var(--sp-3);display:block}
|
||||
.tl-more{text-align:center;padding:var(--sp-4);font-size:var(--fs-sm);color:var(--muted)}
|
||||
|
||||
.entry-ic{position:relative}
|
||||
.entry-dot{
|
||||
position:absolute;top:-2rpx;right:-2rpx;width:18rpx;height:18rpx;
|
||||
border-radius:50%;background:var(--red);border:3rpx solid #fff;
|
||||
.hero-meta {
|
||||
font-size: 23rpx;
|
||||
color: #d9eadd;
|
||||
}
|
||||
.entry-p.warn{color:var(--red-ink);font-weight:var(--fw-b)}
|
||||
|
||||
/* 阶段漂移提示。用主色不用红色:这是「可以做一下」不是「出问题了」 */
|
||||
.drift-card{border:2rpx solid var(--primary-line);background:var(--primary-soft)}
|
||||
.drift-top{display:flex;align-items:flex-start;gap:var(--sp-2);color:var(--primary-dark)}
|
||||
.drift-b{flex:1;min-width:0;font-size:var(--fs-md);font-weight:var(--fw-b);line-height:1.5}
|
||||
.drift-p{font-size:var(--fs-sm);color:var(--primary-ink);line-height:1.6;margin-top:var(--sp-2)}
|
||||
.drift-focus{font-size:var(--fs-sm);color:var(--primary-ink);line-height:1.6;margin-top:6rpx}
|
||||
.drift-size{font-size:var(--fs-cap);color:var(--primary-dark);opacity:.8;margin-top:6rpx}
|
||||
.drift-cta{margin-top:var(--sp-4)}
|
||||
|
||||
/* 没填到家日期时的天数空态:压成灰、可点去补 */
|
||||
.hero-days-empty{background:var(--surface-2);color:var(--muted)}
|
||||
.hero-days-empty .hd-n{color:var(--muted)}
|
||||
|
||||
/* 门面卡右上角的身份卡入口。原来那里是个 next 箭头(点整卡进编辑),
|
||||
身份卡做成小胶囊,和整卡点击分开 */
|
||||
.hero-idcard{
|
||||
flex:none;align-self:flex-start;display:flex;align-items:center;gap:4rpx;
|
||||
padding:8rpx var(--sp-3);border-radius:var(--r-full);
|
||||
background:var(--primary-soft);color:var(--primary-dark);
|
||||
font-size:var(--fs-cap);font-weight:var(--fw-b);
|
||||
.hero-caption {
|
||||
font-size: 20rpx;
|
||||
color: #b5e2be;
|
||||
margin-top: 36rpx;
|
||||
}
|
||||
.hero image {
|
||||
position: absolute;
|
||||
width: 310rpx;
|
||||
height: 290rpx;
|
||||
right: -24rpx;
|
||||
bottom: 8rpx;
|
||||
}
|
||||
.heading {
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
.link {
|
||||
font-size: 24rpx;
|
||||
color: #398668;
|
||||
font-weight: 700;
|
||||
}
|
||||
.walk-card {
|
||||
padding: 26rpx;
|
||||
}
|
||||
.walk-intro {
|
||||
display: flex;
|
||||
gap: 22rpx;
|
||||
align-items: center;
|
||||
}
|
||||
.dog-emoji {
|
||||
width: 145rpx;
|
||||
height: 145rpx;
|
||||
border-radius: 26rpx;
|
||||
background: #dfeedd;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-size: 72rpx;
|
||||
}
|
||||
.walk-title {
|
||||
font-size: 31rpx;
|
||||
font-weight: 800;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.walk-intro .muted {
|
||||
font-size: 23rpx;
|
||||
}
|
||||
.picker-label {
|
||||
font-size: 23rpx;
|
||||
color: #7d9989;
|
||||
margin: 27rpx 0 16rpx;
|
||||
}
|
||||
.start {
|
||||
margin: 24rpx 0 0;
|
||||
width: 100%;
|
||||
}
|
||||
.stats {
|
||||
display: flex;
|
||||
gap: 14rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.stats > view {
|
||||
flex: 1;
|
||||
background: white;
|
||||
border-radius: 28rpx;
|
||||
padding: 25rpx 18rpx;
|
||||
}
|
||||
.stats > view:nth-child(2) {
|
||||
background: #f7eadc;
|
||||
}
|
||||
.stats > view:nth-child(3) {
|
||||
background: #e8efea;
|
||||
}
|
||||
.stats text {
|
||||
display: block;
|
||||
color: #8da49a;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
.stats strong {
|
||||
display: block;
|
||||
font-size: 40rpx;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
.stats small {
|
||||
font-size: 22rpx;
|
||||
color: #94a69d;
|
||||
}
|
||||
.tasks {
|
||||
padding: 12rpx 25rpx;
|
||||
}
|
||||
.task {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 17rpx;
|
||||
padding: 22rpx 0;
|
||||
border-bottom: 1rpx solid #edf1ed;
|
||||
}
|
||||
.task:last-child {
|
||||
border: 0;
|
||||
}
|
||||
.check {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border: 3rpx solid #cfdfd2;
|
||||
border-radius: 13rpx;
|
||||
text-align: center;
|
||||
line-height: 37rpx;
|
||||
color: white;
|
||||
}
|
||||
.check.done {
|
||||
background: #3b9164;
|
||||
border-color: #3b9164;
|
||||
}
|
||||
.task-icon {
|
||||
width: 65rpx;
|
||||
height: 65rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #f0f5ee;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
.task-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
.task-name {
|
||||
font-weight: 700;
|
||||
}
|
||||
.task-main .muted {
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user