cloudroam
2025-08-12 8dd9360a0e4cfd22ea9e261bec3821eff3f57fe8
sub-pages/film-list/film-list.vue
@@ -38,6 +38,7 @@
const { navigateTo } = useNavigator()
import { getTabList,getFilmWorksBase } from '@/sub-pages/utils/api'
import { useUserStore } from '@/store/user'
const theme = ref('light')
const search = ref('')
@@ -63,12 +64,41 @@
  getfilms()                     // 重新加载数据
}
const handleDetailClick = (item: FilmCategoryTree) => {
    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 handleDetailClick = async (item: FilmCategoryTree) => {
  // 直接跳转到详情页,无需登录检查
  const url= `/sub-pages/film-list/film-detail?id=${item.id}`
  navigateTo(url)
}
const showLoginModal = () => {
  uni.showModal({
    title: '登录提示',
    content: '查看详情需要登录,是否前往登录?',
    confirmText: '去登录',
    success: (res) => {
      if(res.confirm) uni.navigateTo({ url: '/pages/login/login' })
    }
  })
}
const showToast = (msg: string) => {
  uni.showToast({ title: msg, icon: 'none' })
}
@@ -112,13 +142,14 @@
  if (filmStatus.value === 'nomore') return
  filmStatus.value = 'loading'
  // TODO 暂时使用光影社区的类别
  // TODO 暂时使用光影的类别
  const query: FilmWorksQueryDTO = {
   category: currentCategory.value, // 将当前分类ID加入查询参数
    classify: '',
    type: '',
    current: filmPage.value,
    size: filmSize,
   status: 'published',
   keywords: keywords.value // 关键修改
  };
  const records = await getFilmWorksBase(query)
@@ -140,7 +171,25 @@
    filmStatus.value = 'noMore'
  }
}
defineExpose({
  onShareAppMessage() {
    return {
      title: '影视地标推荐',
      path: '/pages/home/home',
      imageUrl: '', // 可以设置默认分享图片
      desc: '发现全球影视拍摄地,探索电影背后的故事'
    }
  },
  // 分享到朋友圈
  onShareTimeline() {
    return {
      title: '影视地标推荐',
      query: '',
      imageUrl: '', // 可以设置默认分享图片
      desc: '发现全球影视拍摄地,探索电影背后的故事'
    }
  }
})