feat(fe): 宠物照片替代默认头像,身份卡移到首页门面卡
- 首页/我的/切换条:上传过照片就用照片,没有才退回 emoji - 报告页分享海报:先异步加载头像再开画,画成圆形头像 - 一起生活的天数改成从到家日期算,没填就显示「-」并可点去补 - 身份卡入口从「我的」页移到首页门面卡右上角 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,13 +23,16 @@ function zodiac(birthday) {
|
||||
|
||||
// 一起生活了多少天。优先用到家日期——「我们一起生活的第 N 天」说的是
|
||||
// 它到你家之后的日子,不是它出生之后的日子。没填到家日就退回建档日。
|
||||
// 一起生活了多少天,只从「到家日期」算 —— 没填到家日就返回 null(首页显示「-」)。
|
||||
// 原来会退回建档日兜底,但那是「在这个 App 上建档的日子」,不是「它到你家的日子」,
|
||||
// 领养多年后才装 App 的会算出个很小的数,反而误导
|
||||
function daysTogether(pet) {
|
||||
const from = (pet && (pet.arrived_at || pet.created_at)) || '';
|
||||
if (!from) return 0;
|
||||
const from = (pet && pet.arrived_at) || '';
|
||||
if (!from) return null;
|
||||
const d = new Date(String(from).slice(0, 10) + 'T00:00:00');
|
||||
if (isNaN(d.getTime())) return 0;
|
||||
if (isNaN(d.getTime())) return null;
|
||||
const days = Math.floor((Date.now() - d.getTime()) / 86400000) + 1;
|
||||
return days > 0 ? days : 0;
|
||||
return days > 0 ? days : null;
|
||||
}
|
||||
|
||||
// 性别徽章。后端存的是「男孩 / 女孩 / 不确定」
|
||||
|
||||
Reference in New Issue
Block a user