From d9a780fa538cb7a83aefa04e75cb53185d690d7d Mon Sep 17 00:00:00 2001
From: tj <1378534974@qq.com>
Date: 星期五, 30 五月 2025 16:39:07 +0800
Subject: [PATCH] 微封装
---
sub-pages/film-list/film-list.vue | 33 ++++++++++++---------------------
1 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/sub-pages/film-list/film-list.vue b/sub-pages/film-list/film-list.vue
index f069e46..acdf69c 100644
--- a/sub-pages/film-list/film-list.vue
+++ b/sub-pages/film-list/film-list.vue
@@ -30,14 +30,14 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { onLoad, onShow, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
-import { FilmCategoryTree,FilmWorks } from '@/types/index'
+import { FilmCategoryTree,FilmWorks,FilmWorksQueryDTO } from '@/types/index'
import { useGlobal } from '@/composables/useGlobal'
const { $http, $message, $store } = useGlobal()
import { FilmTabCategory,FilmWorksCategory } from '@/enums/dict'
import { useNavigator } from '@/composables/useNavigator'
const { navigateTo } = useNavigator()
-import { getTabList } from '@/sub-pages/utils/api'
+import { getTabList,getFilmWorksBase } from '@/sub-pages/utils/api'
const theme = ref('light')
const search = ref('')
@@ -66,7 +66,7 @@
onMounted(() => {
- flowList.value = items
+
})
onShow(() => {
@@ -100,7 +100,13 @@
filmStatus.value = 'loading'
// TODO 暂时使用光影社区的类别
- const records = await getFilmWorksBase('', filmSize, filmPage.value)
+ const query: FilmWorksQueryDTO = {
+ classify: '',
+ type: '',
+ current: filmPage.value,
+ size: filmSize,
+ };
+ const records = await getFilmWorksBase(query)
if (records && records.length > 0) {
// 使用 Set 进行去重
@@ -120,23 +126,8 @@
}
}
-const getFilmWorksBase = async (type: String, pageSize: Number, currentPage: Number) => {
- const {
- code, data
- } = await $http.request('get', '/api/filmWorks/list', {
- params: {
- classify: type,
- size: pageSize,
- current: currentPage
- }
- })
- if (code == 0) {
- return data.records
- } else {
- $message.showToast('系统异常,无法获取数据')
- return null;
- }
-}
+
+
--
Gitblit v1.9.3