diff --git a/miniprogram/pages/upload/upload.ts b/miniprogram/pages/upload/upload.ts
index e31a0b4..2c061c3 100755
--- a/miniprogram/pages/upload/upload.ts
+++ b/miniprogram/pages/upload/upload.ts
@@ -65,6 +65,8 @@ Page({
stripCentered: true,
todayKey: '',
animateWaterfall: true,
+ dateStripScrollLeft: 0,
+ dateStripTransform: '',
},
onLoad() {
@@ -933,8 +935,10 @@ Page({
const weekday = weekdays[today.getDay()];
strip.push({ type: 'day', key: todayKey, weekday, day: today.getDate(), year: today.getFullYear(), month: today.getMonth() + 1 });
}
- const stripCentered = strip.length <= 5;
- this.setData({ dateStripItems: strip, imagesByDate, selectedDateKey: selectedKey, selectedDateImages: selectedImages, gridCols, selectedMonthTitle: monthTitle, useWaterfall, waterfallLeft, waterfallRight, stripCentered, todayKey, animateWaterfall: false });
+ const stripCentered = strip.length <= 3;
+ this.setData({ dateStripItems: strip, imagesByDate, selectedDateKey: selectedKey, selectedDateImages: selectedImages, gridCols, selectedMonthTitle: monthTitle, useWaterfall, waterfallLeft, waterfallRight, stripCentered, todayKey, animateWaterfall: false }, () => {
+ this.centerDateStrip();
+ });
if (useWaterfall) {
this.balanceWaterfall(selectedImages).then(() => {
wx.nextTick(() => { this.setData({ animateWaterfall: true }); });
@@ -968,6 +972,7 @@ Page({
waterfallLeft,
waterfallRight
}, () => {
+ this.centerDateStrip();
// 在setData回调中处理瀑布流平衡
if (useWaterfall && images.length > 0) {
this.balanceWaterfall(images).then(() => {
@@ -1038,5 +1043,32 @@ Page({
} catch (e) {}
},
+ centerDateStrip() {
+ try {
+ const items = this.data.dateStripItems || [];
+ if (!items || items.length < 2) return;
+ const idx = items.findIndex((it: any) => it && it.key === this.data.selectedDateKey);
+ if (idx < 0) return;
+ const si = wx.getSystemInfoSync();
+ const ww = si.windowWidth;
+ const rpx = ww / 750;
+ const itemW = Math.floor(120 * rpx);
+ const gap = Math.floor(24 * rpx);
+ const n = items.length;
+ const contentW = n * itemW + (n - 1) * gap;
+ const containerW = ww;
+ if (contentW > containerW) {
+ let target = Math.floor(idx * (itemW + gap) - (containerW - itemW) / 2);
+ target = Math.max(0, Math.min(contentW - containerW, target));
+ this.setData({ dateStripScrollLeft: target, dateStripTransform: '' });
+ } else {
+ const selectedX = Math.floor(idx * (itemW + gap));
+ const centerX = Math.floor((containerW - itemW) / 2);
+ const shift = centerX - selectedX;
+ this.setData({ dateStripTransform: `transform: translateX(${shift}px);` });
+ }
+ } catch (e) {}
+ },
+
})
diff --git a/miniprogram/pages/upload/upload.wxml b/miniprogram/pages/upload/upload.wxml
index c687311..a405d01 100755
--- a/miniprogram/pages/upload/upload.wxml
+++ b/miniprogram/pages/upload/upload.wxml
@@ -63,14 +63,14 @@
{{selectedMonthTitle}}
-
-
+
+
-
+
{{item.weekday}}
{{item.day}}
-
+
{{item.year}}
{{item.month}}
@@ -78,12 +78,12 @@
-
+
-
+
@@ -110,7 +110,7 @@
-
+
diff --git a/miniprogram/pages/upload/upload.wxss b/miniprogram/pages/upload/upload.wxss
index d1f970d..26d322f 100755
--- a/miniprogram/pages/upload/upload.wxss
+++ b/miniprogram/pages/upload/upload.wxss
@@ -370,7 +370,7 @@
}
.month-title { font-size: 36rpx; }
.date-strip { white-space: nowrap; height: 100rpx;}
-.date-strip-inner { display: flex; gap: 24rpx; }
+.date-strip-inner { display: flex; gap: 24rpx; transition: transform 0.3s ease; will-change: transform; }
.strip-center { justify-content: center; min-width: 100%; }
.strip-default { justify-content: flex-start; }
.date-strip::-webkit-scrollbar { display: none; }
@@ -1271,8 +1271,13 @@
border-width: 24rpx 24rpx 64rpx 24rpx;
box-shadow: 0 8rpx 12rpx rgba(0, 0, 0, 0.2);
overflow: hidden;
+ opacity: 0;
}
+.blank-content.hidden { opacity: 0; }
+.blank-content.visible { animation: blankFadeIn 300ms ease forwards; }
+@keyframes blankFadeIn { from { opacity: 0 } to { opacity: 1 } }
+
.blank-image {
width: 100%;
height: 100%;