|
@@ -0,0 +1,202 @@
|
|
|
+<template>
|
|
|
+ <view class="container">
|
|
|
+ <view class="search-box">
|
|
|
+ <uni-search-bar ref="searchBar" radius="5" placeholder="搜索" clearButton="auto" cancelButton="none" bgColor="#F8F8F8"
|
|
|
+ @confirm="search" class="search-bar" />
|
|
|
+ </view>
|
|
|
+ <k-scroll-view @onPullDown="handlePullDown" @onPullUp="handleLoadMore" class="video-box">
|
|
|
+ <view class="video-col" v-for="item in videoList" @click="goToVideoDtails(item)">
|
|
|
+ <cover-image class="video-img" :src="item.imgUrl"></cover-image>
|
|
|
+ <view class="video-title">{{item.liveName}}</view>
|
|
|
+ <view class="video-date" v-if="videoType == 1">直播时间:{{item.liveStartTime}}-{{item.liveEndTime}}</view>
|
|
|
+ <view class="video-mask" v-if="videoType == 1 && item.liveStatus == 2">
|
|
|
+ <view class="video-mask-horn"></view>
|
|
|
+ <view class="video-mask-text">未开播</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </k-scroll-view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ const NET = require('@/utils/request')
|
|
|
+ const API = require('@/config/api')
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ videoType: 1,
|
|
|
+ pageIndex: 1,
|
|
|
+ isOver: false,
|
|
|
+ videoName: '',
|
|
|
+ videoList: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.videoType = options.videoType
|
|
|
+ this.getVideoList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 搜索商品
|
|
|
+ search(data) {
|
|
|
+ this.videoName = data.value
|
|
|
+ this.videoList = []
|
|
|
+ this.pageIndex = 1
|
|
|
+ this.getVideoList()
|
|
|
+ },
|
|
|
+ // 下拉刷新
|
|
|
+ handlePullDown(stopLoad) {
|
|
|
+ this.pageIndex = 1
|
|
|
+ this.videoList = []
|
|
|
+ this.getVideoList(stopLoad)
|
|
|
+ stopLoad ? stopLoad() : '';
|
|
|
+ },
|
|
|
+ // 懒加载
|
|
|
+ handleLoadMore(stopLoad) {
|
|
|
+ if (!this.isOver) {
|
|
|
+ this.pageIndex++
|
|
|
+ this.getVideoList()
|
|
|
+ } else {
|
|
|
+ stopLoad ? stopLoad({
|
|
|
+ isEnd: true
|
|
|
+ }) : '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取商品
|
|
|
+ getVideoList(stopLoad) {
|
|
|
+ NET.request((this.videoType == 1 ? API.getLiveTelecastList : API.WX_API_BASE) + '/' + this.pageIndex + '/10', {
|
|
|
+ liveName: this.videoName,
|
|
|
+ videoName: this.videoName,
|
|
|
+ }, 'GET').then(res => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ this.isOver = res.data.list.length != 10
|
|
|
+ this.videoList = this.videoList.concat(res.data.list)
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: "获取直播列表失败",
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(res => {})
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+ page {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .container {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+
|
|
|
+ .search-box {
|
|
|
+ width: 100%;
|
|
|
+ height: 58px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 2px 12px 1px 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .video-box {
|
|
|
+
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100% - 58px) !important;
|
|
|
+ overflow-y: auto;
|
|
|
+
|
|
|
+ .video-col {
|
|
|
+ float: left;
|
|
|
+ background: #FFFFFF;
|
|
|
+ box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.15);
|
|
|
+ border-radius: 5px;
|
|
|
+ width: calc(50% - 18px);
|
|
|
+ margin-top: 4px;
|
|
|
+ margin-bottom: 6px;
|
|
|
+ padding-bottom: 10px;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ .video-img {
|
|
|
+ width: 100%;
|
|
|
+ height: 170px;
|
|
|
+ object-fit: cover;
|
|
|
+ float: left;
|
|
|
+ }
|
|
|
+
|
|
|
+ .video-title {
|
|
|
+ width: 100%;
|
|
|
+ height: 18px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding-left: 8px;
|
|
|
+ float: left;
|
|
|
+ font-size: 15px;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ color: #333333;
|
|
|
+ line-height: 18px;
|
|
|
+ overflow: hidden;
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ margin: 6px 0 2px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .video-date {
|
|
|
+ width: 100%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding-left: 8px;
|
|
|
+ height: 16px;
|
|
|
+ float: left;
|
|
|
+ font-size: 12px;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ color: #52A63A;
|
|
|
+ line-height: 16px;
|
|
|
+ overflow: hidden;
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ }
|
|
|
+
|
|
|
+ .video-mask {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ position: absolute;
|
|
|
+ background-color: rgba(0, 0, 0, 0.3);
|
|
|
+ border-radius: 5px;
|
|
|
+
|
|
|
+ .video-mask-horn {
|
|
|
+ width: 0;
|
|
|
+ height: 0;
|
|
|
+ border-bottom: 4px solid #52A63A;
|
|
|
+ border-right: 4px solid transparent;
|
|
|
+ position: absolute;
|
|
|
+ right: -4px;
|
|
|
+ top: 8px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .video-mask-text {
|
|
|
+ position: absolute;
|
|
|
+ right: -4px;
|
|
|
+ top: 12px;
|
|
|
+ width: 52px;
|
|
|
+ height: 18px;
|
|
|
+ border-radius: 9px 0 0 9px;
|
|
|
+ background: #52A63A;
|
|
|
+ line-height: 18px;
|
|
|
+ font-size: 10px;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ color: #FFFFFF;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .video-col:nth-child(odd) {
|
|
|
+ margin-left: 15px;
|
|
|
+ margin-right: 3px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .video-col:nth-child(even) {
|
|
|
+ margin-left: 3px;
|
|
|
+ margin-right: 15px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|