+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{item.title}}
+
+
+
主讲人:
+
{{item.speaker}}
+
{{item.applynumber}}
+
+
+
直播时间:
+
{{item.playdate}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{item.title}}
+
+
+
+ ¥{{item.it618_saleprice}}
+
+ ¥{{item.it618_price}}
+
+
+
+
+ {{ item.playtitle }}
+ {{ item.playdate }}
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,12 +265,19 @@
import { reactive, toRefs } from "vue";
import { getLiveList, getLiveFocus } from "@/api/live";
import store from '@/store';
+ import { Button, List, Cell } from 'vant';
export default {
name: "live",
+ components: {
+ [Button.name]: Button,
+ [List.name]: List,
+ [Cell.name]: Cell,
+ },
setup() {
const state = reactive({
liveList: [],
liveFocusList: [],
+ liveFocusListWap: [],
activeIndex: 0,
obj: {},
total: 0,
@@ -148,7 +285,13 @@
page: 1,
perpage: 8
},
- lvie_cur: 0
+ lvie_cur: 0,
+ loading: true,
+ loading_m: false,
+ live_total: 0,
+ max_total: false,
+ start_perpage: 16,
+ onresize: '',
})
const fetchLiveFocus = async () => {
@@ -158,6 +301,7 @@
const res = await getLiveFocus(params)
if (res.code === 200) {
state.liveFocusList = res.data;
+ state.liveFocusListWap = res.data.filter(t => t.playstate > 0);
state.liveFocusList.forEach((item) => {
if (item.playstate > '0') {
state.obj = state.liveFocusList[1]
@@ -191,35 +335,531 @@
// },500);
- const fetchLiveList = async () => {
+ const fetchLiveList = async (query) => {
const params = {
- ...state.query
+ ...query
}
const res = await getLiveList(params)
if (res.code === 200) {
state.liveList = res.data.data
state.total = res.data.total
+
+ state.loading = false;
+ state.live_total = res.data.total;
+
+ // 没有更多了
+ if (state.start_perpage > res.data.total) {
+ state.max_total = true;
+ } else {
+ state.max_total = false;
+ }
}
}
const fetchAllData = () => {
return Promise.all([
fetchLiveFocus(),
- fetchLiveList(),
+ fetchLiveList(state.query),
])
}
+ fetchAllData();
+
- fetchAllData()
+ // 滚动加载
+ const loadVlist = () => {
+ setTimeout(() => {
+ state.start_perpage += 8
+ const params = {
+ ...state.query,
+ perpage: state.start_perpage
+ };
+ // if (state.onresize < 1200) {
+ state.liveList.push(fetchLiveList(params));
+ // }
+
+ state.loading_m = false;
+
+ }, 800);
+ }
return {
...toRefs(state),
changeLiveFocus,
- handleCurrentChange
+ handleCurrentChange,
+ loadVlist,
};
},
};
+
+
+
+
+