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>
<view class="list-grid"> <view class="list-grid">
<view <view v-for="item in list" :key="item.id" class="card-item">
v-for="item in list"
:key="item.id"
class="card-item"
@tap="onPreview(item)"
>
<view class="card-image-wrap"> <view class="card-image-wrap">
<image :src="item.imageUrl" mode="aspectFill" class="card-img" /> <image :src="item.imageUrl" mode="aspectFill" class="card-img" />
<view class="year-badge" v-if="item.year">{{ item.year }}</view> <view class="year-badge" v-if="item.year">{{ item.year }}</view>
@@ -53,9 +48,9 @@
getTagText(item) getTagText(item)
}}</view> }}</view>
<view class="actions"> <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> <text class="action-emoji">🔗</text>
</view> </button>
<!-- <view class="action-btn" @tap.stop="onMore(item)"> <!-- <view class="action-btn" @tap.stop="onMore(item)">
<text class="action-emoji"></text> <text class="action-emoji"></text>
</view> --> </view> -->
@@ -90,9 +85,14 @@
<script setup> <script setup>
import { ref, onMounted } from "vue"; 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 { getMyCard } from "@/api/mine.js";
import NavBar from "@/components/NavBar/NavBar.vue"; import NavBar from "@/components/NavBar/NavBar.vue";
import { getShareToken } from "@/utils/common.js";
const list = ref([]); const list = ref([]);
const page = ref(1); 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) => { const fetchList = async (reset = false) => {
if (loading.value) return; if (loading.value) return;
if (reset) { if (reset) {
@@ -195,9 +218,9 @@ const onMake = () => {
}); });
}; };
const onShare = (item) => { // const onShare = (item) => {
uni.showToast({ title: "分享功能开发中", icon: "none" }); // uni.showToast({ title: "分享功能开发中", icon: "none" });
}; // };
const onMore = (item) => { const onMore = (item) => {
uni.showActionSheet({ uni.showActionSheet({

View File

@@ -80,7 +80,6 @@
<script setup> <script setup>
import { ref, onMounted, computed } from "vue"; import { ref, onMounted, computed } from "vue";
import { getBavBarHeight } from "@/utils/system";
import { getWallpaperList, getWallpaperCategoryList } from "@/api/wallpaper.js"; import { getWallpaperList, getWallpaperCategoryList } from "@/api/wallpaper.js";
import { import {
saveRemoteImageToLocal, saveRemoteImageToLocal,