直播一部分
This commit is contained in:
parent
ad1c54fdc9
commit
bfcf22b479
@ -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<VideoList[]> {
|
||||
|
||||
|
||||
|
||||
export async function getlivelist(data?:any):Promise<LiveList[]> {
|
||||
export async function getlivelist(data?:any):Promise<LivelistInfo> {
|
||||
const res = await get<Array<LiveList>>('live',data);
|
||||
// console.log(res);
|
||||
return res.data
|
||||
console.log(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
8
src/types/index.d.ts
vendored
8
src/types/index.d.ts
vendored
@ -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;
|
||||
}
|
@ -41,7 +41,7 @@
|
||||
:width="80"
|
||||
v-else
|
||||
/>
|
||||
<video style="display: none" :src="videofile"></video>
|
||||
<!-- <video style="display: none" :src="videofile"></video> -->
|
||||
</div>
|
||||
<div
|
||||
class="upload-image upload"
|
||||
|
@ -14,13 +14,13 @@
|
||||
</div>
|
||||
<div class="sel">
|
||||
<img src="@/static/images/sousuo.png" alt="" class="icon" />
|
||||
<input type="text" />
|
||||
<input placeholder="请输入想要搜索的直播标题" type="text" @keyup.enter="sel()" v-model="input" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="list" v-if="tabindex == 1">
|
||||
<LiveItem
|
||||
:type="2"
|
||||
v-for="(i, j) in livelist"
|
||||
v-for="(i, j) in livelist.data"
|
||||
:key="j"
|
||||
:img="i.img"
|
||||
:title="i.title"
|
||||
@ -48,7 +48,7 @@
|
||||
<LiveItem :type="2"></LiveItem>
|
||||
</div>
|
||||
<div class="pages">
|
||||
<a-pagination v-model:current="page" :total="500" :showLessItems="true" />
|
||||
<a-pagination v-model:current="page" :total="livelist.total" :showLessItems="true" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -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<LiveList[]>();
|
||||
const livelist = ref<LivelistInfo>({
|
||||
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
|
||||
};
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user