更新最新代码
This commit is contained in:
@@ -0,0 +1,345 @@
|
||||
const { itemsOf, totalOf } = require('../../utils/list-pagination');
|
||||
let lastLocationReport = 0;
|
||||
let locationReportUser = null;
|
||||
const { withDataCache } = require('../../utils/page-cache');
|
||||
const { getLayout } = require('../../utils/layout');
|
||||
// pages/index/index.js
|
||||
const { api, getImageUrl } = require('../../utils/request');
|
||||
const { diaryEntry } = require('../../utils/journal');
|
||||
const { saveScrollPosition, resetScrollOnTabShow } = require('../../utils/scroll-pos');
|
||||
|
||||
Page(withDataCache({
|
||||
onResize: function() { this.setData(getLayout()); },
|
||||
data: {
|
||||
userId: null,
|
||||
coupleId: null,
|
||||
|
||||
partnerName: '和TA',
|
||||
loveStartDate: '',
|
||||
daysCount: '?',
|
||||
daysLabel: '已注册',
|
||||
datePrefix: '注册于',
|
||||
partner1AvatarUrl: '',
|
||||
partner2AvatarUrl: '',
|
||||
partner1Initial: '',
|
||||
partner2Initial: '',
|
||||
partner1Birthday: '',
|
||||
partner2Birthday: '',
|
||||
partner1Name: '?',
|
||||
partner2Name: '?',
|
||||
partner1Location: '',
|
||||
partner2Location: '',
|
||||
coupleDistance: '',
|
||||
|
||||
stats: {
|
||||
timeline: 0, album: 0, diary: 0,
|
||||
songs: 0, checkin: 0, pet: 0
|
||||
},
|
||||
bgImage: '',
|
||||
scrollTop: 0,
|
||||
refreshing: false,
|
||||
relationshipKnown: false, homeError: false, statsLoading: true, statsError: false, recentDiary: [], recentAlbums: [], upcomingMemory: null
|
||||
},
|
||||
|
||||
onLoad: function() {
|
||||
this.setData(getLayout());
|
||||
this.setData({
|
||||
userId: wx.getStorageSync('userId'),
|
||||
coupleId: wx.getStorageSync('coupleId'),
|
||||
scrollTop: 0
|
||||
});
|
||||
this.loadBg();
|
||||
this.loadData();
|
||||
},
|
||||
|
||||
onShow: function() {
|
||||
resetScrollOnTabShow(this, 'index');
|
||||
const tabBar = this.getTabBar && this.getTabBar();
|
||||
if (tabBar) tabBar.syncActive();
|
||||
var prevCoupleId = this.data.coupleId;
|
||||
var curCoupleId = wx.getStorageSync('coupleId');
|
||||
this.setData({
|
||||
userId: wx.getStorageSync('userId'),
|
||||
coupleId: curCoupleId
|
||||
});
|
||||
// 检查是否已被解绑(之前有 coupleId 但被清除了)
|
||||
if (prevCoupleId && !curCoupleId) {
|
||||
wx.reLaunch({ url: '/pages/index/index' });
|
||||
return;
|
||||
}
|
||||
this.loadBg();
|
||||
this.loadData();
|
||||
this.fetchIpLocation();
|
||||
},
|
||||
|
||||
// 保存滚动位置
|
||||
onScroll: function(e) {
|
||||
this._scrollTop = e.detail.scrollTop;
|
||||
saveScrollPosition('index', e.detail.scrollTop);
|
||||
},
|
||||
|
||||
_loadingData: false,
|
||||
_daysSince: function(dateStr) {
|
||||
if (!dateStr) return '?';
|
||||
var parts = dateStr.substring(0, 10).split('-').map(Number);
|
||||
if (parts.length !== 3 || parts.some(isNaN) || parts[0] < 1970 ||
|
||||
parts[1] < 1 || parts[1] > 12 || parts[2] < 1 || parts[2] > 31) return '?';
|
||||
var start = new Date(parts[0], parts[1] - 1, parts[2]);
|
||||
if (start.getFullYear() !== parts[0] || start.getMonth() !== parts[1] - 1 ||
|
||||
start.getDate() !== parts[2]) return '?';
|
||||
var now = new Date();
|
||||
var today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
return Math.max(0, Math.round((today - start) / 86400000));
|
||||
},
|
||||
loadData: async function() {
|
||||
var self = this;
|
||||
// 防止并发重复加载
|
||||
if (this._loadingData) return;
|
||||
this._loadingData = true;
|
||||
this.setData({ homeError: false });
|
||||
try {
|
||||
const info = await api.coupleInfo();
|
||||
this.setData({userId: wx.getStorageSync('userId')});
|
||||
this.setData({ relationshipKnown: true });
|
||||
// 未绑定情侣时显示用户注册时间和默认信息
|
||||
if (info.not_bound) {
|
||||
wx.removeStorageSync('coupleId');
|
||||
var p1 = info.partner1 || {};
|
||||
let daysCount = '?';
|
||||
let loveStartDate = '';
|
||||
if (info.love_start_date) {
|
||||
daysCount = this._daysSince(info.love_start_date);
|
||||
var parts = info.love_start_date.split('-');
|
||||
loveStartDate = parseInt(parts[0]) + '年' + parseInt(parts[1]) + '月' + parseInt(parts[2]) + '日';
|
||||
}
|
||||
this.setData({
|
||||
coupleId: null,
|
||||
partner1AvatarUrl: getImageUrl(p1.avatar),
|
||||
partner1Name: p1.nickname || '未命名',
|
||||
partner1Initial: (p1.nickname || '未命名')[0],
|
||||
partner1Birthday: '',
|
||||
partner1Location: p1.location || '',
|
||||
partner2AvatarUrl: '',
|
||||
partner2Name: '未绑定',
|
||||
partner2Initial: '?',
|
||||
partner2Birthday: '',
|
||||
partner2Location: '',
|
||||
daysCount: daysCount,
|
||||
daysLabel: '已注册',
|
||||
datePrefix: '注册于',
|
||||
loveStartDate: loveStartDate,
|
||||
coupleDistance: '',
|
||||
stats: { timeline: 0, album: 0, diary: 0, songs: 0, checkin: 0, pet: 0 }
|
||||
});
|
||||
await this.loadStats();
|
||||
return;
|
||||
}
|
||||
// 同步情侣ID:红包/邀请创建后分享人刷新即可识别
|
||||
if (info.id) {
|
||||
var prevCid = wx.getStorageSync('coupleId');
|
||||
if (prevCid != info.id) {
|
||||
wx.setStorageSync('coupleId', info.id);
|
||||
}
|
||||
}
|
||||
const myUid = this.data.userId;
|
||||
var p1 = info.partner1 || {};
|
||||
var p2 = info.partner2 || {};
|
||||
|
||||
if (p2.id == myUid) {
|
||||
var tmp = p1; p1 = p2; p2 = tmp;
|
||||
}
|
||||
|
||||
let daysCount = '?';
|
||||
let loveStartDate = '';
|
||||
var togetherStart = info.love_start_date || (info.created_at || '').substring(0, 10);
|
||||
if (togetherStart) {
|
||||
daysCount = this._daysSince(togetherStart);
|
||||
var parts = togetherStart.split('-');
|
||||
loveStartDate = parseInt(parts[0]) + '年' + parseInt(parts[1]) + '月' + parseInt(parts[2]) + '日';
|
||||
}
|
||||
|
||||
function getBirthdayText(birthday) {
|
||||
if (!birthday) return '';
|
||||
var t = new Date(); t.setHours(0,0,0,0);
|
||||
var p = birthday.split('-');
|
||||
if (p.length !== 3) return '';
|
||||
var nb = new Date(t.getFullYear(), parseInt(p[1])-1, parseInt(p[2]));
|
||||
if (nb < t) nb.setFullYear(nb.getFullYear()+1);
|
||||
var c = Math.ceil((nb - t) / 86400000);
|
||||
if (c === 0) return '今天!';
|
||||
if (c === 1) return '1天';
|
||||
if (!Number.isFinite(c)) return '';
|
||||
return c + '天';
|
||||
}
|
||||
|
||||
// 双方相距距离(后端基于双方经纬度用 Haversine 公式计算,单位:公里)
|
||||
var coupleDistance = '';
|
||||
if (info.distance !== null && info.distance !== undefined && info.distance !== '') {
|
||||
var d = parseFloat(info.distance);
|
||||
if (!isNaN(d)) {
|
||||
coupleDistance = d < 1
|
||||
? '相距 ' + Math.round(d * 1000) + ' 米'
|
||||
: '相距 ' + d.toFixed(1) + ' 公里';
|
||||
}
|
||||
}
|
||||
|
||||
var dn = {
|
||||
coupleId: info.id,
|
||||
daysCount: daysCount,
|
||||
daysLabel: '我们在一起',
|
||||
datePrefix: '始于',
|
||||
loveStartDate: loveStartDate,
|
||||
partner1AvatarUrl: getImageUrl(p1.avatar),
|
||||
partner2AvatarUrl: getImageUrl(p2.avatar),
|
||||
partner1Name: p1.nickname || p1.username || '?',
|
||||
partner2Name: p2.nickname || p2.username || '?',
|
||||
partner1Initial: (p1.nickname || p1.username || '?')[0],
|
||||
partner2Initial: (p2.nickname || p2.username || '?')[0],
|
||||
partner1Birthday: getBirthdayText(p1.birthday),
|
||||
partner2Birthday: getBirthdayText(p2.birthday),
|
||||
partner1Location: (p1.location && !/^-?\d+(\.\d+)?,-?\d+(\.\d+)?$/.test(p1.location)) ? p1.location : '',
|
||||
partner2Location: (p2.location && !/^-?\d+(\.\d+)?,-?\d+(\.\d+)?$/.test(p2.location)) ? p2.location : '',
|
||||
coupleDistance: coupleDistance
|
||||
};
|
||||
|
||||
this.setData(dn);
|
||||
await this.loadStats();
|
||||
|
||||
} catch (e) {
|
||||
this.setData({ homeError: true, relationshipKnown: !!this._hasCachedData, statsLoading: false, statsError: true });
|
||||
console.error(e);
|
||||
|
||||
} finally {
|
||||
this._loadingData = false;
|
||||
}
|
||||
},
|
||||
|
||||
loadStats: async function() {
|
||||
this.setData({ statsLoading: !this._hasCachedData, statsError: false });
|
||||
try {
|
||||
const [timeline, album, diary, songs, checkin, pet] = await Promise.all([
|
||||
api.timelineList(), api.albumList(), api.diaryList(),
|
||||
api.songsList(), api.checkinList(),
|
||||
this.data.coupleId ? api.petInfo() : Promise.resolve({ has_pet: false })
|
||||
]);
|
||||
var photoCount = album && album.photo_total != null ? Number(album.photo_total) : itemsOf(album).reduce((sum,item)=>sum+(Number(item.photo_count)||0),0);
|
||||
var petLevel = 0;
|
||||
if (pet && pet.has_pet && pet.pet) {
|
||||
petLevel = parseInt(pet.pet.level || 0);
|
||||
}
|
||||
var recentDiary = ((diary && diary.items) || []).slice(0, 1).map(diaryEntry);
|
||||
var today = new Date(); today.setHours(0,0,0,0);
|
||||
var future = itemsOf(timeline).filter(function(item) { return item.event_date && new Date(item.event_date.replace(/-/g, '/')) >= today; }).sort(function(a,b) { return a.event_date.localeCompare(b.event_date); });
|
||||
var next = timeline && !Array.isArray(timeline) && 'upcoming' in timeline ? timeline.upcoming : future[0];
|
||||
this.setData({
|
||||
recentDiary: recentDiary,
|
||||
recentAlbums: itemsOf(album).filter(function(item) { return !!item.cover; }).slice(0,3).map(function(item) { return { id:item.id, title:item.title || '我们的相册', cover:getImageUrl(item.cover) }; }),
|
||||
upcomingMemory: next ? { title: next.title || '下一个记忆日', date: next.event_date, dateMonth: next.event_date.slice(5,7), dateDay: next.event_date.slice(8,10), days: Math.ceil((new Date(next.event_date.replace(/-/g, '/')) - today) / 86400000) } : null,
|
||||
stats: {
|
||||
timeline: totalOf(timeline),
|
||||
album: photoCount,
|
||||
diary: (diary && diary.total) ? diary.total : 0,
|
||||
songs: totalOf(songs),
|
||||
checkin: (checkin && checkin.checkin_log_total !== undefined) ? checkin.checkin_log_total : ((checkin && checkin.items) ? checkin.items.length : (Array.isArray(checkin) ? checkin.length : 0)),
|
||||
pet: petLevel
|
||||
}
|
||||
});
|
||||
} catch (e) { console.error(e); this.setData({ statsError: true }); } finally { this.setData({ statsLoading: false }); }
|
||||
},
|
||||
|
||||
// 获取本机经纬度并上报后端解析地址(后端按距离判断是否重新解析,超过5km才更新),并刷新首页双方地址显示
|
||||
fetchIpLocation: function() {
|
||||
const locationUser = wx.getStorageSync('userId');
|
||||
if (locationReportUser === locationUser && Date.now() - lastLocationReport < 300000) return;
|
||||
locationReportUser = locationUser;
|
||||
lastLocationReport = Date.now();
|
||||
var self = this;
|
||||
var report = function(lat, lng) {
|
||||
var data = {};
|
||||
if (lat && lng) { data.lat = lat; data.lng = lng; }
|
||||
api.updateIpLocation(data).then(function(resp) {
|
||||
if (resp && resp.location) {
|
||||
self.loadData();
|
||||
}
|
||||
}).catch(function() { lastLocationReport = 0; });
|
||||
};
|
||||
// 优先用模糊定位获取经纬度(getFuzzyLocation 与 getLocation 互斥,统一用模糊定位)
|
||||
if (wx.getFuzzyLocation) {
|
||||
wx.getFuzzyLocation({
|
||||
type: 'gcj02',
|
||||
success: function(res) {
|
||||
report(res.latitude, res.longitude);
|
||||
},
|
||||
fail: function() {
|
||||
report(0, 0);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
report(0, 0);
|
||||
}
|
||||
},
|
||||
|
||||
// 背景图以接口返回为准
|
||||
loadBg: function() {
|
||||
var self = this;
|
||||
return api.getBgConfig().then(function(cfg) {
|
||||
self.setData({ bgImage: cfg && cfg.image ? getImageUrl(cfg.image) : '' });
|
||||
}).catch(function(e){ console.warn('loadBg error:', e && (e.error || e._statusCode || e)); });
|
||||
},
|
||||
|
||||
// 跳转前保存当前滚动位置
|
||||
_savePosBeforeLeave: function() {
|
||||
saveScrollPosition('index', this._scrollTop == null ? this.data.scrollTop : this._scrollTop);
|
||||
},
|
||||
|
||||
// 页面跳转
|
||||
goToDiary: function() { this._savePosBeforeLeave(); wx.navigateTo({ url: '/pages/diary/diary' }); },
|
||||
goToProfile: function() { this._savePosBeforeLeave(); wx.switchTab({ url: '/pages/profile/profile' }); },
|
||||
goToTimeline: function() { this._savePosBeforeLeave(); wx.navigateTo({ url: '/pages/timeline/timeline' }); },
|
||||
goToAlbum: function() { this._savePosBeforeLeave(); wx.navigateTo({ url: '/pages/albums/albums' }); },
|
||||
goToSongs: function() { this._savePosBeforeLeave(); wx.navigateTo({ url: '/pages/lovewords/lovewords' }); },
|
||||
goToCheckin: function() { this._savePosBeforeLeave(); wx.navigateTo({ url: '/pages/punch/punch' }); },
|
||||
goToPet: function() { this._savePosBeforeLeave(); wx.navigateTo({ url: '/pages/pet/pet' }); },
|
||||
goToPeriod: function() { this._savePosBeforeLeave(); wx.navigateTo({ url: '/pages/period/period' }); },
|
||||
bindPartner: function() { getApp().globalData.openProfileBind = true; wx.switchTab({ url: '/pages/profile/profile' }); },
|
||||
openJournalEntry: function(e) { wx.navigateTo({ url: '/pages/diary_detail/diary_detail?id=' + e.currentTarget.dataset.id }); },
|
||||
writeDiary: function() { wx.navigateTo({ url: '/pages/publish/publish?type=diary' }); },
|
||||
openAlbumPreview: function(e) { wx.navigateTo({ url: '/pages/album/album?album_id=' + e.currentTarget.dataset.id }); },
|
||||
openRecentDiary: function(e) { wx.navigateTo({ url: '/pages/diary_detail/diary_detail?id=' + e.currentTarget.dataset.id }); },
|
||||
showMore: function() {
|
||||
wx.switchTab({ url: '/pages/discover/discover' });
|
||||
},
|
||||
onPullDownRefresh: async function() {
|
||||
await this.loadData();
|
||||
this.loadBg();
|
||||
wx.stopPullDownRefresh();
|
||||
},
|
||||
onRefresh: async function() {
|
||||
this.setData({ refreshing: true });
|
||||
try {
|
||||
await this.loadData();
|
||||
this.loadBg();
|
||||
} catch (e) {
|
||||
console.error('下拉刷新失败', e);
|
||||
} finally {
|
||||
this.setData({ refreshing: false });
|
||||
}
|
||||
},
|
||||
|
||||
// 分享到好友
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: '让所有的爱有迹可循',
|
||||
path: '/pages/index/index',
|
||||
imageUrl: '/images/share.png'
|
||||
};
|
||||
},
|
||||
// 分享到朋友圈
|
||||
onShareTimeline: function() {
|
||||
return {
|
||||
title: '让所有的爱有迹可循',
|
||||
query: '',
|
||||
imageUrl: '/images/share.png'
|
||||
};
|
||||
}
|
||||
}, {"loadData": ["coupleInfo", "timelineList", "albumList", "diaryList", "songsList", "checkinList", "petInfo", "getBgConfig"]}));
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"page-state": "/components/page-state/page-state"
|
||||
},
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<import src="../../templates/journal.wxml" />
|
||||
<launch-transition />
|
||||
<view class="app-shell {{bgImage ? 'home-has-background' : ''}}" style="{{layoutStyle}}">
|
||||
<view wx:if="{{bgImage}}" class="j-background"><image src="{{bgImage}}" mode="aspectFill" /><view class="j-background-wash" /></view>
|
||||
<view class="home-fixed-header"><view class="home-fixed-heading" style="height:{{barHeight}}px;padding-right:{{navSide}}px;"><text class="j-eyebrow">OUR LITTLE WORLD</text><view class="home-handwritten-title"><text class="j-page-title">让所有的爱有迹可循</text></view></view></view>
|
||||
<scroll-view class="page-bg home-scroll" scroll-y show-scrollbar="{{false}}" refresher-enabled="{{true}}" refresher-triggered="{{refreshing}}" bindrefresherrefresh="onRefresh" bindscroll="onScroll" scroll-top="{{scrollTop}}">
|
||||
<view class="j-body home-body">
|
||||
<page-state wx:if="{{homeError}}" kind="error" title="首页加载失败" description="请检查网络后重新加载" action="重试" bind:action="loadData" />
|
||||
<page-state wx:elif="{{!relationshipKnown}}" kind="loading" title="正在打开你的空间" />
|
||||
<view wx:else class="j-cover">
|
||||
<view class="j-tape" /><view class="j-row"><text class="j-eyebrow">{{daysLabel}}</text><image class="j-cover-heart" src="/images/home-cover-heart.svg" /></view>
|
||||
<view class="j-days"><text class="j-days-number">{{daysCount}}</text><text class="j-days-unit">天</text></view><text class="j-cover-date" wx:if="{{loveStartDate}}">{{datePrefix}} {{loveStartDate}}</text>
|
||||
<view class="home-couple-panel">
|
||||
<view class="home-couple-identity">
|
||||
<view class="home-couple-avatars">
|
||||
<view class="j-avatar"><image wx:if="{{partner1AvatarUrl}}" src="{{partner1AvatarUrl}}" mode="aspectFill" /><text wx:else>{{partner1Initial}}</text></view>
|
||||
<view class="j-avatar j-avatar-partner" wx:if="{{coupleId}}"><image wx:if="{{partner2AvatarUrl}}" src="{{partner2AvatarUrl}}" mode="aspectFill" /><text wx:else>{{partner2Initial}}</text></view>
|
||||
</view>
|
||||
<text class="home-couple-names">{{partner1Name}}{{coupleId ? ' & ' + partner2Name : ''}}</text>
|
||||
<text wx:if="{{coupleDistance}}" class="home-distance-pill">{{coupleDistance}}</text>
|
||||
</view>
|
||||
<view class="home-couple-locations" wx:if="{{partner1Location || partner2Location}}">
|
||||
<view class="home-location-row" wx:if="{{partner1Location}}"><text class="home-location-label">我</text><text class="home-location-text">{{partner1Location}}</text></view>
|
||||
<view class="home-location-row" wx:if="{{partner2Location && coupleId}}"><text class="home-location-label home-location-partner">TA</text><text class="home-location-text">{{partner2Location}}</text></view>
|
||||
</view>
|
||||
<view class="home-birthday-row" wx:if="{{partner1Birthday || partner2Birthday}}">
|
||||
<text class="home-birthday-item" wx:if="{{partner1Birthday}}">🎂 我的生日{{partner1Birthday === '今天!' ? '今天' : partner1Birthday}}</text>
|
||||
<text class="home-birthday-item" wx:if="{{partner2Birthday}}">🎂 TA的生日{{partner2Birthday === '今天!' ? '今天' : partner2Birthday}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="j-invite" wx:if="{{relationshipKnown && !coupleId}}" bindtap="bindPartner"><view><text class="j-small-title">邀请另一半,共写这本手账</text><text class="j-caption">绑定后,一起收藏日常</text></view><text class="j-outline-label">邀请</text></view>
|
||||
<view class="j-memory" wx:if="{{upcomingMemory && !homeError}}" bindtap="goToTimeline"><view class="j-stamp"><text>{{upcomingMemory.dateMonth}}月</text><text>{{upcomingMemory.dateDay}}</text></view><view class="j-memory-info"><text class="j-small-title">下一次值得期待</text><text class="j-caption">{{upcomingMemory.title}}</text></view><view class="j-countdown"><text>{{upcomingMemory.days}}</text><text>{{upcomingMemory.days === 0 ? '今天' : '天后'}}</text></view></view>
|
||||
<view class="j-section"><view class="j-section-head"><text>最近的一页</text><view class="j-link" bindtap="showMore">翻翻手账 →</view></view>
|
||||
<page-state wx:if="{{statsLoading}}" kind="loading" title="正在加载记录" /><page-state wx:elif="{{statsError}}" kind="error" title="记录暂时没有加载成功" action="重新加载" bind:action="loadStats" />
|
||||
<block wx:elif="{{recentDiary.length}}"><block wx:for="{{recentDiary}}" wx:key="id"><template is="journal-entry" data="{{entry:item}}" /></block></block>
|
||||
<page-state wx:else title="故事,从今天开始" description="一句心情、一张照片,都可以成为第一页" action="留下第一篇" bind:action="writeDiary" />
|
||||
</view>
|
||||
<view class="j-section" wx:if="{{recentAlbums.length && !statsError}}"><view class="j-section-head"><text>相册里的片段</text><view class="j-link" bindtap="goToAlbum">全部相册 →</view></view><view class="j-photo-strip"><view class="j-photo-print" wx:for="{{recentAlbums}}" wx:key="id" data-id="{{item.id}}" bindtap="openAlbumPreview"><image src="{{item.cover}}" mode="aspectFill" /><text>{{item.title}}</text></view></view></view>
|
||||
</view></scroll-view>
|
||||
</view>
|
||||
@@ -0,0 +1,57 @@
|
||||
@import '../../styles/common.wxss';
|
||||
@import '../../styles/design.wxss';
|
||||
@import '../../styles/journal.wxss';
|
||||
|
||||
/* 首页标题与系统胶囊位于同一行,状态栏和右侧空间按设备计算。 */
|
||||
.home-fixed-header { position:fixed; top:0; left:0; right:0; z-index:900; padding:var(--status-height,20px) 0 0; margin:0; text-align:left; box-sizing:border-box; }
|
||||
.home-scroll { position:fixed; top:var(--nav-height,64px); left:0; right:0; height:calc(100vh - var(--nav-height,64px)); padding-top:0!important; }
|
||||
.home-body { padding-top:48rpx; }
|
||||
.home-fixed-heading { display:flex; flex-direction:column; align-items:flex-start; justify-content:center; box-sizing:border-box; padding-left:44rpx; }
|
||||
.home-fixed-heading .j-eyebrow { font-size:20rpx; line-height:1.2; letter-spacing:2rpx; white-space:nowrap; }
|
||||
/* 用楷体的自然笔画呈现手写感,不对文字做倾斜或旋转。 */
|
||||
.home-handwritten-title { position:relative; flex-shrink:0; margin-top:5rpx; }
|
||||
.home-handwritten-title::before { content:''; position:absolute; left:-4rpx; right:-5rpx; bottom:2rpx; height:12rpx; background:rgba(225,133,159,.22); border-radius:8rpx 3rpx 10rpx 5rpx; }
|
||||
.home-fixed-heading .home-handwritten-title .j-page-title { position:relative; font-family:'Kaiti SC','STKaiti','KaiTi',cursive; font-size:34rpx; font-weight:400; font-style:normal; line-height:1.35; letter-spacing:1rpx; margin:0; white-space:nowrap; color:#64424D; }
|
||||
|
||||
@media (max-width:350px) { .home-fixed-heading { padding-left:32rpx; } }
|
||||
|
||||
/* 在一起天数使用参考图中的亮粉色。 */
|
||||
.home-body .j-days-number { color:#F47FA5; }
|
||||
|
||||
/* 身份、地址、距离与生日分层呈现,长地址允许完整换行。 */
|
||||
.home-couple-panel { margin-top:40rpx; padding-top:28rpx; border-top:1rpx dashed #E9DDD0; }
|
||||
.home-couple-identity { display:flex; align-items:center; gap:12rpx; }
|
||||
.home-couple-avatars { display:flex; align-items:center; flex-shrink:0; }
|
||||
.home-couple-avatars .j-avatar { width:64rpx; height:64rpx; }
|
||||
.home-couple-avatars .j-avatar-partner { margin-left:-16rpx; }
|
||||
.home-couple-names { flex:1; min-width:0; font-size:26rpx; line-height:1.5; color:#64424D; overflow-wrap:break-word; }
|
||||
.home-couple-locations { margin-top:22rpx; }
|
||||
.home-location-row { display:flex; align-items:flex-start; gap:14rpx; margin-top:12rpx; }
|
||||
.home-location-label { flex-shrink:0; width:42rpx; padding:3rpx 0; border-radius:10rpx; text-align:center; font-size:19rpx; line-height:1.5; color:#B74768; background:#F8E6ED; }
|
||||
.home-location-partner { color:#526B57; background:#E4EBE3; }
|
||||
.home-location-text { flex:1; min-width:0; padding-top:2rpx; font-size:23rpx; line-height:1.6; color:#85776D; overflow-wrap:break-word; word-break:break-all; }
|
||||
.home-distance-pill { display:inline-block; flex-shrink:0; white-space:nowrap; padding:8rpx 14rpx; border-radius:24rpx; background:#FBE4ED; color:#B74768; font-size:22rpx; line-height:1.5; }
|
||||
.home-birthday-row { display:flex; flex-wrap:wrap; align-items:center; gap:8rpx 28rpx; margin-top:18rpx; color:#A65A73; font-size:22rpx; line-height:1.6; }
|
||||
|
||||
@import '../../styles/button-theme.wxss';
|
||||
|
||||
@import '../../styles/typography.wxss';
|
||||
|
||||
/* 自定义照片铺满首页,降低洗白遮罩;卡片透出照片且保留阅读底色。 */
|
||||
.home-has-background .j-background { z-index:0; pointer-events:none; }
|
||||
.home-has-background .j-background > image { display:block; }
|
||||
.home-has-background .j-background-wash {
|
||||
background:linear-gradient(180deg,rgba(253,228,236,.24) 0%,rgba(255,240,245,.32) 48%,rgba(255,247,250,.42) 100%);
|
||||
}
|
||||
.home-has-background .home-scroll { z-index:1; }
|
||||
.home-has-background .home-fixed-header { background:rgba(253,228,236,.72); }
|
||||
.home-has-background .j-cover {
|
||||
background:rgba(255,253,248,.78);
|
||||
border-color:rgba(255,253,248,.7);
|
||||
}
|
||||
.home-has-background .j-story,
|
||||
.home-has-background .j-memory,
|
||||
.home-has-background .j-invite { background:rgba(255,253,248,.9); }
|
||||
.home-has-background .j-section-head { text-shadow:0 1rpx 5rpx rgba(255,253,248,.85); }
|
||||
|
||||
.home-has-background .home-couple-panel { padding:24rpx; border:1rpx solid rgba(233,221,208,.65); border-radius:24rpx; background:rgba(255,253,248,.82); }
|
||||
Reference in New Issue
Block a user