From e04d6a8904fd0c93b931551d8feea0943bae8eac Mon Sep 17 00:00:00 2001 From: cloudroam <cloudroam> Date: 星期四, 12 六月 2025 18:11:06 +0800 Subject: [PATCH] add: 评论回复 --- sub-pages/utils/api.ts | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 46 insertions(+), 1 deletions(-) diff --git a/sub-pages/utils/api.ts b/sub-pages/utils/api.ts index 1eed362..4dcc8a9 100644 --- a/sub-pages/utils/api.ts +++ b/sub-pages/utils/api.ts @@ -4,7 +4,39 @@ import { FilmCategoryTree, FilmWorks } from '@/types/index' import http from '@/plugins/http.js' import message from '@/plugins/message' +import {FilmWorksQueryDTO} from '@/types/index' +export const getParentTabList = async ( + targetList: Ref<FilmCategoryTree[]>, + isShowDefault: boolean = true +) => { + const { code, data } = await http.request('get', '/api/film/category/parentList', { + params: { } + }) + + if (code === 0) { + const defaultOption: FilmCategoryTree = { + id: '', + name: '全部', + imageUrl: '', + color: '', + sortBy: 0, + shown: true, + levelLimit: '', + childrenCount: 0, + children: [] + } + if (isShowDefault) { + targetList.value = [defaultOption, ...data] + } else { + targetList.value = data + } + + } else { + message.showToast('系统异常,无法获取数据') // 或者用 uni.showToast() + return null + } +} export const getTabList = async ( parentId: string, targetList: Ref<FilmCategoryTree[]>, @@ -33,9 +65,22 @@ targetList.value = data } - console.log('tabList', targetList.value) } else { message.showToast('系统异常,无法获取数据') // 或者用 uni.showToast() return null } } + + +export const getFilmWorksBase = async (query: FilmWorksQueryDTO) => { + const { code, data } = await http.request('get', '/api/filmWorks/list', { + params: query + }); + + if (code === 0) { + return data.records; + } else { + message.showToast('系统异常,无法获取数据'); + return null; + } + } \ No newline at end of file -- Gitblit v1.9.3