diff --git a/src/api/index.ts b/src/api/index.ts index c4b94f8..ba33c97 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,6 +1,6 @@ import router from '@/router'; import store from '@/store'; -import { LiveList, LoginData, UserInfo, VideoInfo } from '@/types'; +import { LiveList, LivelistInfo, LoginData, UserInfo, VideoInfo } from '@/types'; import { saveValue } from '@/utils/common'; import { message } from 'ant-design-vue'; import { del, get, post, put, setToken } from './base' @@ -135,10 +135,10 @@ export async function getvideolist(): Promise { -export async function getlivelist(data?:any):Promise { +export async function getlivelist(data?:any):Promise { const res = await get>('live',data); - // console.log(res); - return res.data + console.log(res); + return res; } /** diff --git a/src/types/index.d.ts b/src/types/index.d.ts index 0f48506..805d22e 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -10,6 +10,7 @@ declare module 'axios' { code: number; msg: string; data: T; + total: number; [keys: string]: any; } } @@ -87,4 +88,11 @@ export interface LiveList { statusname: string; starttime: string; begin: number; +} + +export interface LivelistInfo { + data: LiveList[]; + code: number; + msg: string; + total: number; } \ No newline at end of file diff --git a/src/views/mine/ReleaseWebcast.vue b/src/views/mine/ReleaseWebcast.vue index c657ee0..e638dc0 100644 --- a/src/views/mine/ReleaseWebcast.vue +++ b/src/views/mine/ReleaseWebcast.vue @@ -41,7 +41,7 @@ :width="80" v-else /> - +
- +
- +
@@ -156,7 +156,7 @@ import { defineComponent, onMounted, ref } from "vue"; import LiveItem from "@/components/LiveItem.vue"; import { getlivelist } from "@/api"; -import { LiveList } from "@/types"; +import { LivelistInfo } from "@/types"; export default defineComponent({ components: { LiveItem, @@ -164,18 +164,30 @@ export default defineComponent({ setup() { const page = ref(1); const tabindex = ref(1); - const livelist = ref(); + const livelist = ref({ + code: 0, + total: 0, + msg: "", + data: [] + }); + const input = ref("") onMounted(async () => { livelist.value = await getlivelist(); }); function tabchange(e: number): void { tabindex.value = e; } + async function sel(){ + console.log(input.value) + livelist.value = await getlivelist({title: input.value}); + } return { page, tabindex, tabchange, livelist, + input, + sel }; }, });