bihuisong 1 rok temu
rodzic
commit
417eab1c4c

+ 19 - 5
pages/liveBroadcast/liveBroadcast.vue

@@ -5,19 +5,19 @@
 			<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">
+				<view class="onePic" v-if="item.pictureList != null && 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">
+				<view class="twoPic" v-if="item.pictureList != null && 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">
+				<view class="threePic" v-if="item.pictureList != null && 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">
+				<view class="threePic" v-if="item.pictureList != null && item.pictureList.length > 3">
 					<image :src="loadImgSrcLocalhost(item2)" v-for="(item2, index2) in item.pictureList"
 						v-if="index2 < 3" :key="index2"></image>
 				</view>
@@ -64,6 +64,20 @@
 		onLoad(options) {
 			this.getList(1)
 		},
+		onReachBottom(){
+			let pageNum = this.queryParams.pageNum
+			let pageSize = this.queryParams.pageSize
+			let total = this.total
+			if(pageNum * pageSize >= total){
+				uni.showToast({
+					title:'暂无更多数据'
+				})
+				return
+			} else {
+				this.queryParams.pageNum += 1;
+				this.getList()
+			}
+		},
 		methods: {
 			goDetails(id) {
 				uni.navigateTo({
@@ -82,7 +96,7 @@
 				}
 				list(params).then(res => {
 					if (res.code == 200) {
-						this.dataSource = res.rows
+						this.dataSource = [...this.dataSource,...res.rows]
 						this.total = res.total
 					}
 				})

+ 23 - 3
pages/liveBroadcastDetails/liveBroadcastDetails.vue

@@ -6,9 +6,10 @@
 			<view class="wenzhangLy">
 				<!-- 头像昵称 -->
 				<view class="txTime">
-					<image :src="loadImgSrc('/moren.png')"></image>
+					<img class="uni-header-image"
+						:src="initInfo.headImg == null || initInfo.headImg == '' ? 'http://116.142.80.12:9000/10_03.png' : initInfo.headImg" />
 					<view class="time">
-						<p>{{fromData.createBy}}</p>
+						<p>{{initInfo.wechatName}}</p>
 						<span>{{fromData.createTime}}</span>
 					</view>
 				</view>
@@ -28,12 +29,22 @@
 	import {
 		getDetails
 	} from '@/api/liveBroadcast/liveBroadcast.js';
+	import {
+		getUserInfo
+	} from '@/api/me/me.js'
 	export default {
 		data() {
 			return {
 				parentId: "",
 				fromData: {},
 				content: "",
+				initInfo: {
+					userId: null,
+					scoreNum: 0,
+					wechatName: "微信用户",
+					name: null,
+					headImg: null,
+				},
 			};
 		},
 		methods: {
@@ -45,6 +56,12 @@
 					}
 				})
 			},
+			getUserInfoByUserId(userId) {
+				getUserInfo(userId).then(res => {
+					this.initInfo = res.data;
+					console.log("this.initInfo", this.initInfo)
+				})
+			},
 		}
 		/**
 		 * 生命周期函数--监听页面加载
@@ -57,7 +74,10 @@
 		/**
 		 * 生命周期函数--监听页面初次渲染完成
 		 */
-		onReady(e) {},
+		onReady() {
+			this.userId = getApp().globalData.userId
+			this.getUserInfoByUserId(this.userId)
+		},
 		/**
 		 * 生命周期函数--监听页面显示
 		 */