fix: gretting page

This commit is contained in:
zzc
2026-02-03 11:26:47 +08:00
parent e664356a5f
commit 9c1382c503
2 changed files with 35 additions and 13 deletions

View File

@@ -32,12 +32,7 @@
</view>
<view class="list-grid">
<view
v-for="item in list"
:key="item.id"
class="card-item"
@tap="onPreview(item)"
>
<view v-for="item in list" :key="item.id" class="card-item">
<view class="card-image-wrap">
<image :src="item.imageUrl" mode="aspectFill" class="card-img" />
<view class="year-badge" v-if="item.year">{{ item.year }}</view>
@@ -53,9 +48,9 @@
getTagText(item)
}}</view>
<view class="actions">
<view class="action-btn" @tap.stop="onShare(item)">
<button class="action-btn" open-type="share" :data-item="item">
<text class="action-emoji">🔗</text>
</view>
</button>
<!-- <view class="action-btn" @tap.stop="onMore(item)">
<text class="action-emoji"></text>
</view> -->
@@ -90,9 +85,14 @@
<script setup>
import { ref, onMounted } from "vue";
import { onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
import {
onPullDownRefresh,
onReachBottom,
onShareAppMessage,
} from "@dcloudio/uni-app";
import { getMyCard } from "@/api/mine.js";
import NavBar from "@/components/NavBar/NavBar.vue";
import { getShareToken } from "@/utils/common.js";
const list = ref([]);
const page = ref(1);
@@ -114,6 +114,29 @@ onReachBottom(() => {
}
});
onShareAppMessage(async (options) => {
if (options.from === "button") {
const shareTokenRes = await getShareToken(
"card_generate",
options?.target?.dataset?.item?.id,
);
return {
title: "我刚做了一张祝福卡片,送给你",
path: "/pages/detail/index?shareToken=" + shareTokenRes.shareToken,
imageUrl:
"https://file.lihailezzc.com/resource/13ec1134e6614feadeeaaa9ef21ea96e.png",
};
} else {
const shareTokenRes = await getShareToken("greeting_page", "");
return {
title: "新春祝福",
path: `/pages/index/index?shareToken=${shareTokenRes.shareToken}`,
imageUrl:
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
};
}
});
const fetchList = async (reset = false) => {
if (loading.value) return;
if (reset) {
@@ -195,9 +218,9 @@ const onMake = () => {
});
};
const onShare = (item) => {
uni.showToast({ title: "分享功能开发中", icon: "none" });
};
// const onShare = (item) => {
// uni.showToast({ title: "分享功能开发中", icon: "none" });
// };
const onMore = (item) => {
uni.showActionSheet({