Kaynağa Gözat

Signed-off-by: liuboyan <632697560@qq.com>

liuboyan 4 yıl önce
ebeveyn
işleme
5d4378ba6b
5 değiştirilmiş dosya ile 218 ekleme ve 3 silme
  1. 2 0
      config/api.js
  2. 5 0
      pages.json
  3. 8 2
      pages/index/index.vue
  4. 1 1
      pagesGood/goodDetails.vue
  5. 202 0
      pagesGood/videoList.vue

+ 2 - 0
config/api.js

@@ -11,6 +11,8 @@ module.exports = {
 	getPreferGoods: WX_API_BASE + 'app/product/user/homePage/guessLike/getProductList',
 	//  获取直播列表
 	getLiveTelecast: WX_API_BASE + 'app/liveAndVideo/user/homePage/liveList',
+	//  获取直播列表过滤
+	getLiveTelecastList: WX_API_BASE + 'app/liveAndVideo/user/homePage/searchLiveList',
 	//  获取短视频列表
 	getShortVideo: WX_API_BASE + 'app/liveAndVideo/user/homePage/videoList',
 	

+ 5 - 0
pages.json

@@ -46,6 +46,11 @@
 			"style": {
 				"navigationBarTitleText": "填写订单"
 			}
+		}, {
+			"path": "videoList",
+			"style": {
+				"navigationBarTitleText": "直播大厅"
+			}
 		}]
 	},{
		"root": "pagesOrder",
		"pages": [{
			"path": "index",
			"style": {
				"navigationBarTitleText": "我的订单"
			}
		}]
	}],
 	"globalStyle": {

+ 8 - 2
pages/index/index.vue

@@ -26,7 +26,7 @@
 			<view class="title-tip">直播带货,视频推荐</view>
 		</view>
 		<view class="content-box video-box">
-			<view class="video-col" style="margin-right: 11px;" v-if="liveTelecast">
+			<view class="video-col" style="margin-right: 11px;" v-if="liveTelecast" @click="goToLiveList(1)">
 				<view class="video-title">直播大厅
 					<view class="circular">
 						<text class="iconfont iconfangxiang"></text>
@@ -35,7 +35,7 @@
 				<cover-image class="video-img" :src="liveTelecast.imgUrl"></cover-image>
 				<view class="video-name">{{liveTelecast.liveName}}</view>
 			</view>
-			<view class="video-col" style="margin-left: 11px;" v-if="shortVideo">
+			<view class="video-col" style="margin-left: 11px;" v-if="shortVideo" @click="goToLiveList(2)">
 				<view class="video-title">短视频推荐
 					<view class="circular">
 						<text class="iconfont iconfangxiang"></text>
@@ -240,6 +240,12 @@
 					url: '/pagesGood/goodList?goodType=' + (type ? type : (1 + '&goodName=' + data.value))
 				});
 			},
+			//  跳转直播大厅
+			goToLiveList(type) {
+				uni.navigateTo({
+					url: '/pagesGood/videoList?videoType='+type
+				});
+			},
 			//  跳转商品详情
 			goToGoodDetails(item) {
 				uni.navigateTo({

+ 1 - 1
pagesGood/goodDetails.vue

@@ -320,7 +320,7 @@
 			.tab-col-active {
 				font-size: 15px;
 				color: #343434;
-				border-bottom: 1px solid #10C06E;
+				border-bottom: 1px solid #52A63A;
 			}
 		}
 

+ 202 - 0
pagesGood/videoList.vue

@@ -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>