tj
2025-05-28 6ef1b14f735acdc3ff77a50da1bb09a5bb983dcc
pages/home/home.vue
@@ -43,11 +43,7 @@
      <Community v-for="(item, index) in communitys" :key="index" :avatar="item.avatar" :nickname="item.nickname"
        :time="formatRelativeTime(item.createTime)" :image="item.coverUrl" :content="item.coverAlt"
        :likeCount="item.likeCount" :commentCount="item.commentCount" />
      <view class="more">
        <!-- <view v-if="loadingCommunity">加载中...</view>
        <view v-if="noMoreCommunity">没有更多了</view> -->
        <up-loadmore :status="communityStatus" />
      </view>
      <up-loadmore :status="communityStatus" :line="true" />
      <view style="height: 300rpx;"></view>
    </view>
@@ -57,7 +53,7 @@
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue'
import { onShow, onPullDownRefresh,onReachBottom } from '@dcloudio/uni-app'
import { onShow, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
import HomeMain from './home-main.vue'
import TripCard from './trip-card.vue'
@@ -146,18 +142,18 @@
  // 内容精选
  getContentSelected()
  // 光影社区
  communityPage.value=1
  communityPage.value = 1
  getCommunitys()
  uni.stopPullDownRefresh() // 停止下拉刷新动画
})
onReachBottom(()=>{
onReachBottom(() => {
  console.log('用户触底了')
  getCommunitys()
})
const getContentSelected = async () => {
  tripCardList.value = await getFilmWorks(FilmWorksCategory.CONTENT_SELECTED, 20,1);
  tripCardList.value = await getFilmWorks(FilmWorksCategory.CONTENT_SELECTED, 20, 1);
}
@@ -167,7 +163,7 @@
const getCommunitys = async () => {
  if (communityStatus.value==='nomore') return
  if (communityStatus.value === 'nomore') return
  communityStatus.value = 'loading'
@@ -191,10 +187,10 @@
  }
}
const getCommunitys_bak = async () => {
  communitys.value = await getFilmWorks(FilmWorksCategory.COMMUNITY, 10,1);
  communitys.value = await getFilmWorks(FilmWorksCategory.COMMUNITY, 10, 1);
}
// 内容精选
const getFilmWorks = async (type: String, pageSize: Number,currentPage: Number) => {
const getFilmWorks = async (type: String, pageSize: Number, currentPage: Number) => {
  const {
    code, data
  } = await $http.request('get', '/api/filmWorks/list', {