fix: daily page

This commit is contained in:
zzc
2026-03-03 21:32:04 +08:00
parent ab70f7e78f
commit fee3b05c9e
2 changed files with 71 additions and 324 deletions

View File

@@ -23,8 +23,7 @@
<!-- Main Card --> <!-- Main Card -->
<view class="main-card-container"> <view class="main-card-container">
<view <view
class="greeting-card" class="quote-card"
id="shareCard"
:style=" :style="
backgroundUrl backgroundUrl
? { ? {
@@ -35,86 +34,29 @@
: {} : {}
" "
> >
<view class="card-icon"> <view class="quote-icon"></view>
<uni-icons type="star-filled" size="32" color="#e6b800" /> <view class="quote-content">
<view class="sparkle s1"></view> <text class="quote-text">{{ content }}</text>
<view class="sparkle s2"></view> <text class="quote-highlight" v-if="highlight">{{ highlight }}</text>
</view> </view>
<view class="quote-divider"></view>
<view class="card-content"> <view class="quote-author">
<text class="card-text">{{ content }}</text> <text> {{ author ? ` ${author} 的专属问候` : "专属问候" }}</text>
<text class="card-highlight" v-if="highlight">{{ highlight }}</text>
</view>
<view class="card-divider"></view>
<view class="card-footer">
<text class="footer-label">SIGNATURE</text>
<text class="footer-name"> {{ author || "专属问候" }}</text>
</view> </view>
</view> </view>
</view> </view>
<!-- Action Buttons --> <!-- Action Buttons -->
<view class="action-buttons"> <view class="action-buttons">
<button class="btn secondary" @tap="navToMake"> <button class="btn primary-btn" @tap="navToMake">
<view class="btn-icon red-icon"> <uni-icons type="paperplane-filled" size="20" color="#fff" />
<uni-icons type="paperplane-filled" size="18" color="#d81e06" />
</view>
<text>我也要送问候</text> <text>我也要送问候</text>
</button> </button>
<button class="btn secondary" @tap="savePoster">
<view class="btn-icon">
<uni-icons type="camera-filled" size="18" color="#666" />
</view>
<text>保存为海报</text>
</button>
</view> </view>
<!-- Hot List --> <view class="footer-tip safe-area-bottom">
<view class="hot-list-section"> <text>愿每一天都充满阳光与希望</text>
<view class="section-header">
<view class="title-bar"></view>
<text class="section-title">大家都在送的温暖</text>
</view>
<view class="hot-list">
<view
v-for="(item, index) in hotList"
:key="index"
class="hot-item"
@tap="useHotItem(item)"
>
<view class="item-icon-box" :style="{ background: item.bg }">
<text class="item-emoji">{{ item.emoji }}</text>
</view>
<view class="item-content">
<text class="item-text">{{ item.text }}</text>
<text class="item-count">{{ item.count }} 人已收藏</text>
</view>
<uni-icons type="right" size="14" color="#ccc" />
</view>
</view>
</view> </view>
<!-- Floating Lucky Button -->
<view class="lucky-btn-container safe-area-bottom">
<button class="lucky-btn" @tap="navToDaily">
<view class="btn-content">
<view class="stars"></view>
<text>抽一句我的今日好运</text>
<view class="badge">LUCKY</view>
</view>
</button>
</view>
<!-- Canvas for Poster -->
<canvas
type="2d"
id="posterCanvas"
class="hidden-canvas"
style="width: 375px; height: 600px"
/>
</view> </view>
</template> </template>
@@ -136,21 +78,6 @@ const author = ref("陈小明");
const highlight = ref(""); const highlight = ref("");
const backgroundUrl = ref(""); const backgroundUrl = ref("");
const hotList = ref([
{
text: "新的一年,愿灵马带走烦恼,留下...",
count: "3.2k",
emoji: "🌅",
bg: "#fff8e1",
},
{
text: "星光不问赶路人,时光不负有心人。",
count: "1.8k",
emoji: "✨",
bg: "#e8f5e9",
},
]);
onLoad(async (options) => { onLoad(async (options) => {
if (options.shareToken) { if (options.shareToken) {
const detail = await getPageDetail(options.shareToken); const detail = await getPageDetail(options.shareToken);
@@ -172,39 +99,15 @@ onLoad(async (options) => {
author.value = detail.signature || "专属问候"; author.value = detail.signature || "专属问候";
backgroundUrl.value = detail.imageUrl || ""; backgroundUrl.value = detail.imageUrl || "";
} }
} else {
// Fallback to query params if no shareToken (legacy support or direct link)
if (options.content) content.value = decodeURIComponent(options.content);
if (options.author) author.value = decodeURIComponent(options.author);
if (options.fromUser) fromUser.value = decodeURIComponent(options.fromUser);
if (options.fromAvatar)
fromAvatar.value = decodeURIComponent(options.fromAvatar);
} }
}); });
const navToMake = () => { const navToMake = () => {
uni.navigateTo({
url: "/pages/make/index?scene=daily",
});
};
const navToDaily = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/greeting/daily", url: "/pages/greeting/daily",
}); });
}; };
const useHotItem = (item) => {
uni.navigateTo({
url: `/pages/make/index?scene=daily&content=${encodeURIComponent(item.text)}`,
});
};
const savePoster = () => {
uni.showToast({ title: "海报生成功能开发中", icon: "none" });
// Implementation for poster generation would go here
};
onShareAppMessage(() => { onShareAppMessage(() => {
return { return {
title: `${fromUser.value || "好友"}给你发来了一份今日问候`, title: `${fromUser.value || "好友"}给你发来了一份今日问候`,
@@ -258,281 +161,125 @@ onShareAppMessage(() => {
color: #999; color: #999;
} }
/* Greeting Card */ /* Greeting Card - Adapted from daily.vue quote-card */
.main-card-container { .main-card-container {
padding: 0 40rpx; padding: 0 40rpx;
margin-bottom: 60rpx; margin-bottom: 80rpx;
} }
.greeting-card { .quote-card {
background: #fff; background: #fff;
border-radius: 40rpx; border-radius: 40rpx;
padding: 60rpx 40rpx; padding: 60rpx 40rpx 40rpx;
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.08);
border: 4rpx solid #f5e6d3; /* Gold-ish border */
position: relative;
min-height: 700rpx; min-height: 700rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.06);
border: 2rpx solid #fff;
position: relative;
}
.card-icon { /* Inner Border Effect */
position: relative; &::after {
margin-bottom: 60rpx; content: "";
.sparkle {
position: absolute; position: absolute;
font-size: 24rpx; inset: 12rpx;
} border: 2rpx solid #f9f3e8;
border-radius: 32rpx;
.s1 { pointer-events: none;
top: -10rpx;
right: -20rpx;
opacity: 0.8;
}
.s2 {
bottom: -10rpx;
left: -20rpx;
opacity: 0.6;
font-size: 20rpx;
} }
} }
.card-content { .quote-icon {
margin-bottom: 60rpx; font-size: 80rpx;
color: #f5e6d3;
margin-bottom: 40rpx;
line-height: 1;
}
.quote-content {
text-align: center; text-align: center;
margin-bottom: 60rpx;
} }
.card-text { .quote-text {
font-size: 44rpx; font-size: 40rpx;
color: #333; color: #333;
font-weight: bold; font-weight: bold;
line-height: 1.8; line-height: 1.6;
font-family: "Songti SC", serif; font-family: "Songti SC", serif;
display: block;
white-space: pre-wrap; white-space: pre-wrap;
} }
.card-highlight { .quote-highlight {
display: block; display: block;
font-size: 48rpx; font-size: 44rpx;
color: #d81e06; color: #d81e06;
font-weight: 800; font-weight: 800;
margin-top: 20rpx; margin-top: 20rpx;
font-family: "Songti SC", serif; font-family: "Songti SC", serif;
} }
.card-divider { .quote-divider {
width: 60rpx; width: 80rpx;
height: 2rpx; height: 2rpx;
background: #f0f0f0; background: #eee;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
.card-footer { .quote-author {
display: flex;
flex-direction: column;
align-items: center;
gap: 12rpx;
}
.footer-label {
font-size: 20rpx;
color: #d4a017;
letter-spacing: 2rpx;
font-weight: bold;
text-transform: uppercase;
}
.footer-name {
font-size: 28rpx; font-size: 28rpx;
color: #666; color: #999;
font-style: italic; font-style: italic;
font-family: "Songti SC", serif; font-family: "Songti SC", serif;
} }
/* Action Buttons */
.action-buttons { .action-buttons {
padding: 0 40rpx; padding: 0 60rpx;
display: flex;
flex-direction: column;
gap: 24rpx;
margin-bottom: 60rpx;
}
.btn {
height: 100rpx;
border-radius: 50rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 30rpx;
font-weight: bold;
border: none;
position: relative;
&::after {
border: none;
}
&:active {
transform: scale(0.98);
}
}
.btn.secondary {
background: #fff;
color: #333;
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.03);
.btn-icon {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
background: #f5f5f5;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20rpx;
&.red-icon {
background: #ffebee;
}
}
}
/* Hot List */
.hot-list-section {
padding: 0 40rpx;
margin-bottom: 40rpx; margin-bottom: 40rpx;
} }
.section-header { .btn {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 30rpx; justify-content: center;
} gap: 12rpx;
height: 96rpx;
.title-bar { border-radius: 48rpx;
width: 8rpx; font-size: 32rpx;
height: 28rpx;
background: #d4a017;
border-radius: 4rpx;
margin-right: 16rpx;
}
.section-title {
font-size: 30rpx;
font-weight: bold; font-weight: bold;
color: #333;
}
.hot-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.hot-item {
background: #fff;
padding: 24rpx;
border-radius: 24rpx;
display: flex;
align-items: center;
gap: 20rpx;
&:active {
background: #f9f9f9;
}
}
.item-icon-box {
width: 80rpx;
height: 80rpx;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: center;
}
.item-emoji {
font-size: 40rpx;
}
.item-content {
flex: 1;
display: flex;
flex-direction: column;
gap: 8rpx;
overflow: hidden;
}
.item-text {
font-size: 26rpx;
color: #333;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.item-count {
font-size: 22rpx;
color: #999;
}
/* Lucky Button */
.lucky-btn-container {
position: fixed;
bottom: 40rpx;
left: 40rpx;
right: 40rpx;
z-index: 100;
}
.lucky-btn {
background: linear-gradient(135deg, #a33b3b 0%, #8e0000 100%);
color: #fff;
height: 110rpx;
border-radius: 55rpx;
border: none; border: none;
box-shadow: 0 10rpx 30rpx rgba(142, 0, 0, 0.3); transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
&::after { &::after {
border: none; border: none;
} }
&:active { &:active {
transform: scale(0.98); transform: scale(0.98);
} }
} }
.btn-content { .primary-btn {
display: flex; background: linear-gradient(135deg, #8e0000 0%, #600000 100%);
align-items: center; color: #fff;
gap: 16rpx; box-shadow: 0 8rpx 24rpx rgba(142, 0, 0, 0.3);
font-size: 32rpx;
font-weight: bold;
.stars { &:active {
font-size: 36rpx; box-shadow: 0 4rpx 12rpx rgba(142, 0, 0, 0.2);
}
.badge {
background: #ffd700;
color: #8e0000;
font-size: 20rpx;
padding: 4rpx 12rpx;
border-radius: 20rpx;
font-weight: 800;
margin-left: 8rpx;
} }
} }
.hidden-canvas { .footer-tip {
position: fixed; text-align: center;
left: 9999px; padding: 40rpx 0;
top: 0;
text {
font-size: 24rpx;
color: #ccc;
letter-spacing: 4rpx;
}
} }
</style> </style>

View File

@@ -131,7 +131,7 @@
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import { ref, onMounted } from "vue";
import NavBar from "@/components/NavBar/NavBar.vue"; import NavBar from "@/components/NavBar/NavBar.vue";
import { trackRecord } from "@/utils/common.js"; import { trackRecord } from "@/utils/common.js";