修改直播列表页面分页不生效的问题,吸怪直播模块报错的问题
This commit is contained in:
@ -1,27 +1,21 @@
|
||||
<template>
|
||||
<view
|
||||
class="Loads acea-row row-center-wrapper"
|
||||
v-if="loading || !loaded"
|
||||
style="margin-top: 20rpx;"
|
||||
>
|
||||
<view class="Loads acea-row row-center-wrapper" v-if="loading || !loaded" style="margin-top: 20rpx;">
|
||||
<template v-if="loading">
|
||||
<view
|
||||
class="iconfont icon-jiazai loading acea-row row-center-wrapper"
|
||||
></view>
|
||||
<view class="iconfont icon-jiazai loading acea-row row-center-wrapper"></view>
|
||||
正在加载中
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="!loading">
|
||||
上拉加载更多
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
export default {
|
||||
name: "Loading",
|
||||
props: {
|
||||
loaded: Boolean,
|
||||
loading: Boolean
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
@ -19,7 +19,8 @@
|
||||
</view>
|
||||
<slot name="liveGoods">
|
||||
<view class="live-goods" v-if="detail.product.length">
|
||||
<view class="live-goods__item" v-for="(goods, index) in detail.product" :key="goods.goodsId" v-if="index < 3">
|
||||
<view class="live-goods__item" v-for="(goods, index) in detail.product" :key="goods.goodsId"
|
||||
v-if="index < 3">
|
||||
<image class="live-goods__img" :src="goods.coverImgeUrl" mode=""></image>
|
||||
<view class="live-goods__price" v-if="index < 2">¥{{ goods.price }}</view>
|
||||
<view class="live-goods__mark" v-else>
|
||||
@ -33,7 +34,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { dataFormatL } from "@/utils";
|
||||
import {
|
||||
dataFormatL
|
||||
} from "@/utils";
|
||||
let HAS_LIVE = false
|
||||
// #ifdef MP-WEIXIN
|
||||
HAS_LIVE = true
|
||||
@ -111,27 +114,45 @@
|
||||
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${that.detail.roomId}`
|
||||
});
|
||||
},
|
||||
dateFormat(fmt, date) {
|
||||
let ret;
|
||||
const opt = {
|
||||
"Y+": date.getFullYear().toString(), // 年
|
||||
"m+": (date.getMonth() + 1).toString(), // 月
|
||||
"d+": date.getDate().toString(), // 日
|
||||
"H+": date.getHours().toString(), // 时
|
||||
"M+": date.getMinutes().toString(), // 分
|
||||
"S+": date.getSeconds().toString() // 秒
|
||||
// 有其他格式化字符需求可以继续添加,必须转化成字符串
|
||||
};
|
||||
for (let k in opt) {
|
||||
ret = new RegExp("(" + k + ")").exec(fmt);
|
||||
if (ret) {
|
||||
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
|
||||
};
|
||||
};
|
||||
return fmt;
|
||||
},
|
||||
// 轮询liveStatus
|
||||
getLiveStatus() {
|
||||
if (HAS_LIVE) {
|
||||
let that = this;
|
||||
let date = '';
|
||||
if (that.detail.liveStatus == 102) {
|
||||
date = dataFormatL('mm-dd HH:MM', new Date(that.detail.starttime * 1000)).replace('-',
|
||||
'/');
|
||||
date = this.dateFormat('mm-dd HH:MM', new Date(that.detail.startTime * 1000)).replace('-','/');
|
||||
that.liveStatus['102'].title = '预告 ' + date;
|
||||
}
|
||||
livePlayer
|
||||
.getLiveStatus({
|
||||
room_id: that.detail.roomId
|
||||
})
|
||||
.then(res => {
|
||||
// 101: 直播中, 102: 未开始, 103: 已结束, 104: 禁播, 105: 暂停中, 106: 异常,107:已过期
|
||||
that.detail.liveStatus = res.liveStatus;
|
||||
})
|
||||
.catch(err => {
|
||||
console.log('get live status', err);
|
||||
});
|
||||
// livePlayer
|
||||
// .getLiveStatus({
|
||||
// room_id: that.detail.roomId
|
||||
// })
|
||||
// .then(res => {
|
||||
// // 101: 直播中, 102: 未开始, 103: 已结束, 104: 禁播, 105: 暂停中, 106: 异常,107:已过期
|
||||
// that.detail.liveStatus = res.liveStatus;
|
||||
// })
|
||||
// .catch(err => {
|
||||
// console.log('get live status', err);
|
||||
// });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -244,11 +244,12 @@
|
||||
}, 500);
|
||||
},
|
||||
methods: {
|
||||
onShareAppMessage: function() {
|
||||
onShareAppMessage: function () {
|
||||
return {
|
||||
title: this.storeInfo.title,
|
||||
imageUrl: this.storeInfo.image,
|
||||
path: "pages/activity/DargainDetails/index?id="+this.storeInfo.id+"&spread=" + uni.getStorageSync("uid"),
|
||||
path: "pages/activity/DargainDetails/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync(
|
||||
"uid"),
|
||||
success(res) {
|
||||
uni.showToast({
|
||||
title: '分享成功'
|
||||
|
@ -18,6 +18,7 @@
|
||||
<view v-if="liveList.length" class="cu-load text-gray" :class="loadStatus"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<Loading :loaded="loaded" :loading="loading"></Loading>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -26,15 +27,19 @@
|
||||
yxWechatLive
|
||||
} from "@/api/live";
|
||||
import ShopLiveCard from '@/components/ShopLiveCard.vue'
|
||||
import Loading from "@/components/Loading";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ShopLiveCard
|
||||
ShopLiveCard,
|
||||
Loading
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabCur: 'all',
|
||||
liveStatus: '',
|
||||
loaded: false,
|
||||
loading: false,
|
||||
liveTab: [{
|
||||
title: 'all',
|
||||
name: '全部',
|
||||
@ -79,30 +84,31 @@
|
||||
this.liveList = [];
|
||||
this.getLiveList();
|
||||
},
|
||||
// 加载更多
|
||||
loadMore() {
|
||||
if (this.currentPage < this.lastPage) {
|
||||
this.currentPage += 1;
|
||||
this.getLiveList();
|
||||
}
|
||||
},
|
||||
// 直播列表
|
||||
getLiveList() {
|
||||
let that = this;
|
||||
if (this.loading || this.loaded) return;
|
||||
this.loading = true;
|
||||
yxWechatLive({
|
||||
liveStatus: that.liveStatus,
|
||||
page: that.currentPage,
|
||||
size: that.size
|
||||
}).then(res => {
|
||||
that.liveList = [...that.liveList, ...res.data.content];
|
||||
that.lastPage = res.data.lastPage;
|
||||
if (that.currentPage < res.data.lastPage) {
|
||||
that.loadStatus = '';
|
||||
} else {
|
||||
that.loadStatus = 'over';
|
||||
}
|
||||
this.currentPage++;
|
||||
this.loaded = res.data.content.length < that.size;
|
||||
this.loading = false;
|
||||
|
||||
// if (that.currentPage < res.data.lastPage) {
|
||||
// that.loadStatus = '';
|
||||
// } else {
|
||||
// that.loadStatus = 'over';
|
||||
// }
|
||||
});
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
!this.loading && this.getLiveList();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user