| | |
| | | <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('') |
| | | const keywords = ref('') // 新增关键词状态 |
| | | const tabList = ref<FilmCategoryTree[]>([]) |
| | | const onSearch = (value: string) => { |
| | | uni.showToast({ |
| | | title: `搜索:${value}`, |
| | | icon: 'none' |
| | | }) |
| | | const searchValue = typeof value === 'string' ? value : search.value |
| | | keywords.value = searchValue |
| | | filmPage.value = 1 |
| | | films.value = [] |
| | | filmStatus.value = 'loadmore' |
| | | getfilms() |
| | | |
| | | } |
| | | |
| | | const handleDetailClick = (item: FilmCategoryTree) => { |
| | |
| | | |
| | | |
| | | onMounted(() => { |
| | | flowList.value = items |
| | | |
| | | }) |
| | | |
| | | onShow(() => { |
| | |
| | | filmStatus.value = 'loading' |
| | | |
| | | // TODO 暂时使用光影社区的类别 |
| | | const records = await getFilmWorksBase('', filmSize, filmPage.value) |
| | | const query: FilmWorksQueryDTO = { |
| | | classify: '', |
| | | type: '', |
| | | current: filmPage.value, |
| | | size: filmSize, |
| | | keywords: keywords.value // 关键修改 |
| | | }; |
| | | const records = await getFilmWorksBase(query) |
| | | |
| | | if (records && records.length > 0) { |
| | | // 使用 Set 进行去重 |
| | |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |