Browse Source

直播带货

bihuisong 1 year ago
parent
commit
bab27c02bb

+ 15 - 0
api/liveBroadcast/liveBroadcast.js

@@ -0,0 +1,15 @@
+import request from '@/utils/request'
+
+export function list(query) {
+  return request({
+    url: '/high/server/liveBroadcastList',
+    method: 'get',
+	params:query
+  })
+}
+export function getDetails(id) {
+  return request({
+    url: '/high/server/liveBroadcastDetails/' + id,
+    method: 'get',
+  })
+}

+ 1 - 3
config.js

@@ -3,12 +3,10 @@ module.exports = {
 
 	// baseUrl: 'https://www.xcx.cczdsz.cn/prod-api',
 	// baseUrl: 'http://192.168.4.6:8080',
-	baseUrl: 'http://192.168.4.28:8080',
+	baseUrl: 'http://localhost:8080',
 	// baseUrl: 'http://192.168.4.11:8080',
 	// baseUrl: 'http://192.168.4.14:8089',
-	baseUrl: 'http://192.168.4.88:8080',
 	baseIconUrl: 'http://119.3.201.155:9000',
-	// baseIconUrl: 'http://192.168.4.14:8080',
 	// 应用信息
 	appInfo: {
 		// 应用名称

+ 10 - 9
pages.json

@@ -170,17 +170,18 @@
 
 			}
 		},
-		{
-			"path": "pages/quotations/quotations",
-			"style": {
-				"usingComponents": {},
-				"navigationBarBackgroundColor": "#07c160",
-				"navigationBarTextStyle": "white",
-				"navigationBarTitleText": "行情"
+		// {
+		// 	"path": "pages/quotations/quotations",
+		// 	"style": {
+		// 		"usingComponents": {},
+		// 		"navigationBarBackgroundColor": "#07c160",
+		// 		"navigationBarTextStyle": "white",
+		// 		"navigationBarTitleText": "行情"
 
 
-			}
-		},{
+		// 	}
+		// },
+		{
 			"path": "pages/toGovernmentList/toGovernmentList",
 			"style": {
 				"usingComponents": {},

+ 50 - 17
pages/liveBroadcast/liveBroadcast.css

@@ -48,12 +48,12 @@
 /* 列表 */
 .rnwdList {
     width: 100%;
-    display: flex;
-    justify-content: space-between;
-    margin: 20rpx 0;
+    height: 100%;
 }
 .list {
-    width: 79%;
+    border-bottom: solid 2rpx #f6f6f6;
+    padding: 10rpx 0;
+    width: 100%;
 }
 .lb {
     background: #0d9970;
@@ -71,24 +71,11 @@
     color: #333;
     line-height: 40rpx;
 }
-.jlSj {
-    height: 40rpx;
-    display: flex;
-    justify-content: space-between;
-    font-size: 24rpx;
-    margin: 20rpx 0 0 0;
-}
-.jf {
-    color: #07c160;
-}
 .icon-jifen {
     font-size: 28rpx;
     color: #07c160;
     margin: 0 0 0 6rpx;
 }
-.ck {
-    color: #c4c4c4;
-}
 .icon-pinglun,
 .icon-chakan,
 .icon-shoucang {
@@ -101,3 +88,49 @@
     color: #c4c4c4;
     line-height: 60rpx;
 }
+.onePic {
+    width: 100%;
+    height: 360rpx;
+    border-radius: 20rpx;
+    overflow: hidden;
+    margin: 20rpx 0;
+}
+.onePic image {
+    width: 100%;
+    height: 100%;
+}
+.twoPic {
+    width: 100%;
+    height: 220rpx;
+    margin: 20rpx 0;
+    display: flex;
+    justify-content: space-between;
+}
+.twoPic image {
+    width: 49%;
+    height: auto;
+    border-radius: 20rpx;
+}
+.threePic {
+    width: 100%;
+    height: 160rpx;
+    margin: 20rpx 0;
+    display: flex;
+    justify-content: space-between;
+}
+.threePic image {
+    width: 32%;
+    height: auto;
+    border-radius: 20rpx;
+}
+.jlSj {
+    height: 40rpx;
+    display: flex;
+    justify-content: space-between;
+    font-size: 24rpx;
+    margin: 20rpx 0 0 0;
+}
+.ck {
+    color: #c4c4c4;
+	margin-left:240px;
+}

+ 60 - 50
pages/liveBroadcast/liveBroadcast.vue

@@ -1,81 +1,91 @@
 <template>
 	<!-- 直播带货列表 -->
-	<view>
-		<view class="rnwdList" @tap="goDetails" v-for="(item, index) in dataSource" :key="index">
-			<span class="lb">{{ item.type }}</span>
+	<view class="container">
+		<view class="rnwdList">
+			<view class="list" @tap="goDetails(item.id)" v-for="(item, index1) in dataSource" :key="index1">
+				<span class="listTitle">{{ item.titleName }}</span>
+
+				<view class="onePic" v-if="item.pictureList.length == 1">
+					<image :src="loadImgSrcLocalhost(item2)" v-for="(item2, index2) in item.pictureList" :key="index2">
+					</image>
+				</view>
+				<view class="twoPic" v-if="item.pictureList.length == 2">
+					<image :src="loadImgSrcLocalhost(item2)" v-for="(item2, index2) in item.pictureList" :key="index2">
+					</image>
+				</view>
+				<view class="threePic" v-if="item.pictureList.length == 3">
+					<image :src="loadImgSrcLocalhost(item2)" v-for="(item2, index2) in item.pictureList" :key="index2">
+					</image>
+				</view>
+				<view class="threePic" v-if="item.pictureList.length > 3">
+					<image :src="loadImgSrcLocalhost(item2)" v-for="(item2, index2) in item.pictureList"
+						v-if="index2 < 3" :key="index2"></image>
+				</view>
 
-			<view class="list">
-				<span class="listTitle">{{ item.title }}</span>
 				<view class="jlSj">
-					<span class="jf">
-						{{ item.jf }}
-						<em class="iconfont icon-jifen"></em>
-					</span>
 					<view class="ck">
 						<span>
-							<em class="iconfont icon-pinglun"></em>
-							{{ item.pl }}
-						</span>
-						<span>
 							<em class="iconfont icon-chakan"></em>
-							{{ item.ck }}
+							{{ item.likeNum }}
 						</span>
 						<span>
 							<em class="iconfont icon-shoucang"></em>
-							{{ item.dz }}
+							{{ item.watchNum }}
 						</span>
 					</view>
 				</view>
 			</view>
-
-			<em class="iconfont icon-xiangyoujiantou"></em>
 		</view>
 	</view>
 </template>
 
 <script>
+	import {
+		list
+	} from '@/api/liveBroadcast/liveBroadcast.js';
 	export default {
 		data() {
 			return {
-				dataSource: [{
-						ck: '10',
-						dz: '120',
-						id: 1,
-						jf: '100',
-						pl: '10',
-						title: '探索乡村能源供给新模式',
-						type: '三农'
-					},
-					{
-						ck: '20',
-						dz: '220',
-						id: 2,
-						jf: '200',
-						pl: '20',
-						title: '探索乡村能源供给新模式 美丽新画卷',
-						type: '三农'
-					},
-					{
-						ck: '30',
-						dz: '30',
-						id: 3,
-						jf: '300',
-						pl: '30',
-						title: '探索乡村能源供给新模式 绘就乡村振兴美丽新画卷',
-						type: '三农'
-					}
-				]
+				dataSource: [],
+				// 数据总量
+				total: 0,
+				queryParams: {
+					// 当前页
+					pageNum: 1,
+					// 每页数据量
+					pageSize: 10,
+				},
+				loading: false,
 			}
 		},
 		/**
 		 * 生命周期函数--监听页面加载
 		 */
-		onLoad(options) {},
+		onLoad(options) {
+			this.getList(1)
+		},
 		methods: {
-			goDetails() {
-			    uni.navigateTo({
-			        url: '/pages/liveBroadcastDetails/liveBroadcastDetails'
-			    });
+			goDetails(id) {
+				uni.navigateTo({
+					url: '/pages/liveBroadcastDetails/liveBroadcastDetails?id=' + id,
+				});
+			},
+			// 分页触发
+			change(e) {
+				this.getList(e.current);
+			},
+			// 获取数据
+			getList(pageNum) {
+				let params = {
+					pageSize: this.queryParams.pageSize,
+					pageNum: pageNum,
+				}
+				list(params).then(res => {
+					if (res.code == 200) {
+						this.dataSource = res.rows
+						this.total = res.total
+					}
+				})
 			},
 		}
 	}

File diff suppressed because it is too large
+ 209 - 239
pages/liveBroadcastDetails/liveBroadcastDetails.vue