From 8dd9360a0e4cfd22ea9e261bec3821eff3f57fe8 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期二, 12 八月 2025 10:10:07 +0800
Subject: [PATCH] add:分享功能
---
sub-pages/film-list/film-list.vue | 58 +++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 41 insertions(+), 17 deletions(-)
diff --git a/sub-pages/film-list/film-list.vue b/sub-pages/film-list/film-list.vue
index 4a4e54d..3d06b07 100644
--- a/sub-pages/film-list/film-list.vue
+++ b/sub-pages/film-list/film-list.vue
@@ -64,23 +64,29 @@
getfilms() // 重新加载数据
}
+// const handleDetailClick = async (item: FilmCategoryTree) => {
+// const userStore = useUserStore()
+// // 尝试获取最新用户信息验证登录状态
+// try {
+// await userStore.getCurrentInfo()
+// if (userStore.hasLogin) {
+// navigateTo(`/sub-pages/film-list/film-detail?id=${item.id}`)
+// } else {
+// showLoginModal()
+// }
+// } catch (err) {
+// console.error('验证登录状态失败:', err)
+// showLoginModal()
+// }
+// // const urlOfficicl=`/sub-pages/film-list/film-official-detail?id=${item.id}`;
+// // const url= `/sub-pages/film-list/film-detail?id=${item.id}`
+// // navigateTo(url)
+// }
+
const handleDetailClick = async (item: FilmCategoryTree) => {
- const userStore = useUserStore()
- // 尝试获取最新用户信息验证登录状态
- try {
- await userStore.getCurrentInfo()
- if (userStore.hasLogin) {
- navigateTo(`/sub-pages/film-list/film-detail?id=${item.id}`)
- } else {
- showLoginModal()
- }
- } catch (err) {
- console.error('验证登录状态失败:', err)
- showLoginModal()
- }
- // const urlOfficicl=`/sub-pages/film-list/film-official-detail?id=${item.id}`;
- // const url= `/sub-pages/film-list/film-detail?id=${item.id}`
- // navigateTo(url)
+ // 直接跳转到详情页,无需登录检查
+ const url= `/sub-pages/film-list/film-detail?id=${item.id}`
+ navigateTo(url)
}
const showLoginModal = () => {
@@ -165,7 +171,25 @@
filmStatus.value = 'noMore'
}
}
-
+defineExpose({
+ onShareAppMessage() {
+ return {
+ title: '影视地标推荐',
+ path: '/pages/home/home',
+ imageUrl: '', // 可以设置默认分享图片
+ desc: '发现全球影视拍摄地,探索电影背后的故事'
+ }
+ },
+ // 分享到朋友圈
+ onShareTimeline() {
+ return {
+ title: '影视地标推荐',
+ query: '',
+ imageUrl: '', // 可以设置默认分享图片
+ desc: '发现全球影视拍摄地,探索电影背后的故事'
+ }
+ }
+})
--
Gitblit v1.9.3