同步小程序与管理端更新,完善抽烟记录和解绑冷静期
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
const { withDataCache } = require('../../utils/page-cache');
|
||||
const { getLayout } = require('../../utils/layout');
|
||||
// pages/timeline-detail/timeline-detail.js
|
||||
const { api, getImageUrl } = require('../../utils/request');
|
||||
@@ -57,7 +58,7 @@ function calcNearestRepeatDate(eventDate, today, interval, unit) {
|
||||
return new Date(eventDate);
|
||||
}
|
||||
|
||||
Page({
|
||||
Page(withDataCache({
|
||||
onResize: function() { this.setData(getLayout()); },
|
||||
data: { loading: true, loadError: false,
|
||||
item: null,
|
||||
@@ -84,15 +85,26 @@ Page({
|
||||
|
||||
retryDetail: function() { this.loadDetail(this.data.detailId); },
|
||||
onShow: function() {
|
||||
this._syncNavigationColor();
|
||||
if (this.data.detailId) {
|
||||
this.loadDetail(this.data.detailId);
|
||||
}
|
||||
},
|
||||
|
||||
onHide: function() {
|
||||
if (wx.setNavigationBarColor) wx.setNavigationBarColor({frontColor:'#000000',backgroundColor:'#FDE4EC'});
|
||||
},
|
||||
_syncNavigationColor: function() {
|
||||
if (wx.setNavigationBarColor) wx.setNavigationBarColor({frontColor:this.data.bgImageUrl?'#ffffff':'#000000',backgroundColor:this.data.bgImageUrl?'#000000':'#FDE4EC'});
|
||||
},
|
||||
goBack: function() {
|
||||
wx.navigateBack({fail:function(){wx.switchTab({url:'/pages/discover/discover'});}});
|
||||
},
|
||||
|
||||
loadDetail: async function(id) {
|
||||
if (this._pageLoading) return;
|
||||
this._pageLoading = true;
|
||||
this.setData({loading:true, loadError:false});
|
||||
this.setData({loading: !this._hasCachedData, loadError:false});
|
||||
try {
|
||||
var item = await api.timelineDetail(id);
|
||||
var myUid = wx.getStorageSync('userId');
|
||||
@@ -176,6 +188,7 @@ Page({
|
||||
} else {
|
||||
this.setData({ bgImageUrl: '' });
|
||||
}
|
||||
this._syncNavigationColor();
|
||||
},
|
||||
|
||||
// ===== 编辑 =====
|
||||
@@ -190,6 +203,6 @@ Page({
|
||||
|
||||
// ===== 导航 =====
|
||||
goBack: function() { wx.navigateBack(); },
|
||||
goHome: function() { wx.redirectTo({ url: '/pages/index/index' }); },
|
||||
goProfile: function() { wx.redirectTo({ url: '/pages/profile/profile' }); }
|
||||
});
|
||||
goHome: function() { wx.switchTab({ url: '/pages/index/index' }); },
|
||||
goProfile: function() { wx.switchTab({ url: '/pages/profile/profile' }); }
|
||||
}, {"loadDetail": ["timelineDetail", "coupleInfo"]}));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<view class="app-shell app-shell--secondary" style="{{layoutStyle}}">
|
||||
<view class="app-shell app-shell--secondary {{bgImageUrl ? 'detail-immersive' : ''}}" style="{{layoutStyle}}">
|
||||
<launch-transition />
|
||||
<!-- pages/timeline-detail/timeline-detail.wxml -->
|
||||
<page-meta page-style="{{bgImageUrl ? 'background: transparent;' : ''}}"></page-meta>
|
||||
@@ -6,7 +6,8 @@
|
||||
<image wx:if="{{bgImageUrl}}" src="{{bgImageUrl}}" mode="aspectFill" class="detail-bg-custom" />
|
||||
<view class="detail-bg-overlay" wx:if="{{bgImageUrl}}"></view>
|
||||
|
||||
<app-nav title="记忆日详情" back="{{true}}" />
|
||||
<app-nav wx:if="{{!bgImageUrl}}" title="记忆日详情" back="{{true}}" />
|
||||
<view wx:else class="detail-photo-nav" style="height:{{barHeight}}px;" bindtap="goBack" aria-label="返回"><image src="/images/back-white.svg" mode="aspectFit" /></view>
|
||||
|
||||
<scroll-view class="page-bg {{bgImageUrl ? 'page-bg-has-bg' : ''}}" scroll-y show-scrollbar="{{false}}" bounces="{{true}}" style="height:100vh;"
|
||||
bindtouchstart="onTouchStart" bindtouchend="onTouchEnd">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* pages/timeline-detail/timeline-detail.wxss */
|
||||
@import '../../styles/common.wxss';
|
||||
page { background: linear-gradient(180deg, #F4E2E3 0%, #FAF5EE 55%, #FAF5EE 100%); height: 100vh; }
|
||||
page { background: linear-gradient(180deg, #FDE4EC 0%, #FFF0F5 48%, #FFF7FA 100%); height: 100vh; }
|
||||
|
||||
.container { padding: 380rpx 24rpx 180rpx; position: relative; z-index: 1; }
|
||||
.page-bg-has-bg .container { padding-top: 400rpx; }
|
||||
@@ -62,7 +62,7 @@ scroll-view.page-bg { height: 100vh; overflow-y: scroll; -webkit-overflow-scroll
|
||||
|
||||
/* 无背景图时,top-nav-card 背景与 page 背景融合 */
|
||||
.top-nav-card:not(.top-nav-card-transparent) {
|
||||
background: linear-gradient(180deg, #F4E2E3 0%, #FAF5EE 55%, #FAF5EE 100%);
|
||||
background: linear-gradient(180deg, #FDE4EC 0%, #FFF0F5 48%, #FFF7FA 100%);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,3 +163,26 @@ scroll-view.page-bg { height: 100vh; overflow-y: scroll; -webkit-overflow-scroll
|
||||
@import '../../styles/design.wxss';
|
||||
|
||||
@import '../../styles/journal.wxss';
|
||||
|
||||
@import '../../styles/button-theme.wxss';
|
||||
|
||||
@import '../../styles/typography.wxss';
|
||||
|
||||
/* 有背景图时采用全屏照片布局,顶部不再显示色块与标题。 */
|
||||
.detail-immersive { background:transparent!important; }
|
||||
.detail-photo-nav { position:fixed; top:var(--status-height,20px); left:16rpx; width:80rpx; display:flex; align-items:center; justify-content:center; z-index:900; }
|
||||
.detail-photo-nav image { width:36rpx; height:36rpx; }
|
||||
.detail-immersive .page-bg { padding-top:0!important; }
|
||||
.detail-immersive .page-bg > .container {
|
||||
padding:25vh 48rpx calc(56rpx + env(safe-area-inset-bottom))!important;
|
||||
min-height:100vh;
|
||||
box-sizing:border-box;
|
||||
}
|
||||
.detail-immersive .detail-bg-overlay { background:rgba(0,0,0,.42); }
|
||||
.detail-immersive .detail-hero { margin-bottom:36rpx; }
|
||||
.detail-immersive .detail-hero-bar { margin-top:40rpx; }
|
||||
.detail-immersive .detail-title-wrap { margin-bottom:24rpx; }
|
||||
.detail-immersive .detail-info-line { margin-bottom:12rpx; }
|
||||
.detail-immersive .detail-title,
|
||||
.detail-immersive .detail-info-line,
|
||||
.detail-immersive .detail-meta-line { max-width:100%; overflow-wrap:break-word; text-shadow:0 2rpx 8rpx rgba(0,0,0,.2); }
|
||||
|
||||
Reference in New Issue
Block a user