286 lines
6.2 KiB
Vue
286 lines
6.2 KiB
Vue
<template>
|
|
<view class="share-page">
|
|
<NavBar title="今日问候" :transparent="true" color="#333" />
|
|
|
|
<!-- Top User Info -->
|
|
<view class="user-header" :style="{ paddingTop: navBarHeight + 'px' }">
|
|
<image
|
|
class="user-avatar"
|
|
:src="fromAvatar || defaultAvatar"
|
|
mode="aspectFill"
|
|
/>
|
|
<view class="user-info">
|
|
<view class="user-name">
|
|
<text>你的好友</text>
|
|
<text class="highlight-name">{{
|
|
author || fromUser || "神秘好友"
|
|
}}</text>
|
|
</view>
|
|
<text class="user-desc">给你发来了一份今日问候</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- Main Card -->
|
|
<view class="main-card-container">
|
|
<view
|
|
class="quote-card"
|
|
:style="
|
|
backgroundUrl
|
|
? {
|
|
backgroundImage: `url(${backgroundUrl})`,
|
|
backgroundSize: 'cover',
|
|
backgroundPosition: 'center',
|
|
}
|
|
: {}
|
|
"
|
|
>
|
|
<view class="quote-icon">❝</view>
|
|
<view class="quote-content">
|
|
<text class="quote-text">{{ content }}</text>
|
|
<text class="quote-highlight" v-if="highlight">{{ highlight }}</text>
|
|
</view>
|
|
<view class="quote-divider"></view>
|
|
<view class="quote-author">
|
|
<text>—— {{ author ? ` ${author} 的专属问候` : "专属问候" }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- Action Buttons -->
|
|
<view class="action-buttons">
|
|
<button class="btn primary-btn" @tap="navToMake">
|
|
<uni-icons type="paperplane-filled" size="20" color="#fff" />
|
|
<text>我也要送问候</text>
|
|
</button>
|
|
</view>
|
|
|
|
<view class="footer-tip safe-area-bottom">
|
|
<text>愿每一天都充满阳光与希望</text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref } from "vue";
|
|
import { onLoad, onShareAppMessage } from "@dcloudio/uni-app";
|
|
import { getBavBarHeight } from "@/utils/system";
|
|
import NavBar from "@/components/NavBar/NavBar.vue";
|
|
import { getPageDetail } from "@/api/system";
|
|
|
|
const navBarHeight = getBavBarHeight();
|
|
const defaultAvatar =
|
|
"https://file.lihailezzc.com/resource/96023631c6ab9c3496b7620097af3d6f.png";
|
|
|
|
const fromUser = ref("");
|
|
const fromAvatar = ref("");
|
|
const content = ref("万事顺遂\n岁岁平安\n愿你的生活\n日日有小确幸");
|
|
const author = ref("陈小明");
|
|
const highlight = ref("");
|
|
const backgroundUrl = ref("");
|
|
|
|
onLoad(async (options) => {
|
|
if (options.shareToken) {
|
|
const detail = await getPageDetail(options.shareToken);
|
|
if (detail) {
|
|
if (detail.from) {
|
|
fromUser.value = detail.from.nickname;
|
|
fromAvatar.value = detail.from.avatar;
|
|
}
|
|
if (detail.content) {
|
|
const parts = detail.content.split(" ");
|
|
if (parts.length > 1) {
|
|
highlight.value = parts.pop();
|
|
content.value = parts.join("\n");
|
|
} else {
|
|
content.value = detail.content;
|
|
highlight.value = "";
|
|
}
|
|
}
|
|
author.value = detail.signature || "专属问候";
|
|
backgroundUrl.value = detail.imageUrl || "";
|
|
}
|
|
}
|
|
});
|
|
|
|
const navToMake = () => {
|
|
uni.navigateTo({
|
|
url: "/pages/greeting/daily",
|
|
});
|
|
};
|
|
|
|
onShareAppMessage(() => {
|
|
return {
|
|
title: `${fromUser.value || "好友"}给你发来了一份今日问候`,
|
|
path: `/pages/greeting/share?content=${encodeURIComponent(content.value)}&author=${encodeURIComponent(author.value)}&fromUser=${encodeURIComponent(fromUser.value)}&fromAvatar=${encodeURIComponent(fromAvatar.value)}`,
|
|
};
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.share-page {
|
|
min-height: 100vh;
|
|
background: #fbfbf9;
|
|
padding-bottom: 200rpx;
|
|
}
|
|
|
|
.user-header {
|
|
padding: 20rpx 40rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 20rpx;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
|
|
.user-avatar {
|
|
width: 80rpx;
|
|
height: 80rpx;
|
|
border-radius: 50%;
|
|
border: 2rpx solid #fff;
|
|
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.user-info {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.user-name {
|
|
font-size: 28rpx;
|
|
color: #333;
|
|
margin-bottom: 4rpx;
|
|
|
|
.highlight-name {
|
|
color: #d81e06;
|
|
font-weight: bold;
|
|
margin-left: 8rpx;
|
|
}
|
|
}
|
|
|
|
.user-desc {
|
|
font-size: 24rpx;
|
|
color: #999;
|
|
}
|
|
|
|
/* Greeting Card - Adapted from daily.vue quote-card */
|
|
.main-card-container {
|
|
padding: 0 40rpx;
|
|
margin-bottom: 80rpx;
|
|
}
|
|
|
|
.quote-card {
|
|
background: #fff;
|
|
border-radius: 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;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
/* Inner Border Effect */
|
|
&::after {
|
|
content: "";
|
|
position: absolute;
|
|
inset: 12rpx;
|
|
border: 2rpx solid #f9f3e8;
|
|
border-radius: 32rpx;
|
|
pointer-events: none;
|
|
}
|
|
}
|
|
|
|
.quote-icon {
|
|
font-size: 80rpx;
|
|
color: #f5e6d3;
|
|
margin-bottom: 40rpx;
|
|
line-height: 1;
|
|
}
|
|
|
|
.quote-content {
|
|
text-align: center;
|
|
margin-bottom: 60rpx;
|
|
}
|
|
|
|
.quote-text {
|
|
font-size: 40rpx;
|
|
color: #333;
|
|
font-weight: bold;
|
|
line-height: 1.6;
|
|
font-family: "Songti SC", serif;
|
|
display: block;
|
|
white-space: pre-wrap;
|
|
}
|
|
|
|
.quote-highlight {
|
|
display: block;
|
|
font-size: 44rpx;
|
|
color: #d81e06;
|
|
font-weight: 800;
|
|
margin-top: 20rpx;
|
|
font-family: "Songti SC", serif;
|
|
}
|
|
|
|
.quote-divider {
|
|
width: 80rpx;
|
|
height: 2rpx;
|
|
background: #eee;
|
|
margin-bottom: 30rpx;
|
|
}
|
|
|
|
.quote-author {
|
|
font-size: 28rpx;
|
|
color: #999;
|
|
font-style: italic;
|
|
font-family: "Songti SC", serif;
|
|
}
|
|
|
|
.action-buttons {
|
|
padding: 0 60rpx;
|
|
margin-bottom: 40rpx;
|
|
}
|
|
|
|
.btn {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 12rpx;
|
|
height: 96rpx;
|
|
border-radius: 48rpx;
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
border: none;
|
|
transition: all 0.2s;
|
|
|
|
&::after {
|
|
border: none;
|
|
}
|
|
|
|
&:active {
|
|
transform: scale(0.98);
|
|
}
|
|
}
|
|
|
|
.primary-btn {
|
|
background: linear-gradient(135deg, #8e0000 0%, #600000 100%);
|
|
color: #fff;
|
|
box-shadow: 0 8rpx 24rpx rgba(142, 0, 0, 0.3);
|
|
|
|
&:active {
|
|
box-shadow: 0 4rpx 12rpx rgba(142, 0, 0, 0.2);
|
|
}
|
|
}
|
|
|
|
.footer-tip {
|
|
text-align: center;
|
|
padding: 40rpx 0;
|
|
|
|
text {
|
|
font-size: 24rpx;
|
|
color: #ccc;
|
|
letter-spacing: 4rpx;
|
|
}
|
|
}
|
|
</style>
|