ccjgmwz 3 éve
szülő
commit
582097d830
2 módosított fájl, 41 hozzáadás és 63 törlés
  1. 40 62
      pages/sale/information.vue
  2. 1 1
      pages/sale/newsinfo.vue

+ 40 - 62
pages/sale/information.vue

@@ -300,11 +300,11 @@
 			this.scrollTop = e.scrollTop;
 		},
 		onReachBottom() { //上拉触底函数
-			// if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
-			// 	this.isLoadMore = true
-			// 	this.pages += 1
-			// 	this.getIndexSaleData()
-			// }
+			if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
+				this.isLoadMore = true
+				this.pages += 1
+				this.getMoreData()
+			}
 		},
 		onPullDownRefresh() {
 			this.pages = 1
@@ -486,6 +486,13 @@
 					uni.hideLoading()
 				}).then(res => {
 					let data = res.data
+					for(var k =0;k<data.length;k++){
+						if(data[k].title.length > 20){
+							data[k].title = data[k].title.substring(0,20) + "..."
+						}
+						let _date = new Date(data[k].gmtUpdate)
+						data[k].gmtUpdate = this.$u.timeFormat(_date.getTime(), 'mm-dd hh:MM');
+					}
 					that.newsInfo = data
 					uni.hideLoading()
 				})
@@ -569,71 +576,42 @@
 					}
 				})
 			},
-			getIndexSaleData() {
-				// const that = this
-				// var pages = that.pages
-				// var limit = that.limit
-				// uni.showLoading({
-				// 	title: '正在加载'
-				// })
-				// that.$api.request('integral', 'getIndexSaleData', {
-				// 	page: pages,
-				// 	limit: limit
-				// }, failres => {
-				// 	that.$api.msg(failres.errmsg)
-				// 	that.isLoadMore = false
-				// 	that.loadStatus = 'nomore'
-				// 	if (that.pages > 1) {
-				// 		that.pages -= 1
-				// 	}
-				// 	uni.hideLoading()
-				// }).then(res => {
-				// 	let data = res.data
-				// 	//销售信息
-				// 	if (data.saleInfo.length > 0 ) {
-				// 		that.saleInfo = that.saleInfo.concat(data.saleInfo)
-				// 		that.isLoadMore = false
-				// 	} else {
-				// 		if (that.pages > 1) {
-				// 			that.pages -= 1
-				// 		}
-				// 		that.isLoadMore = true
-				// 		that.loadStatus = 'nomore'
-				// 	}
-				// 	if(data.saleInfo.length < that.limit){
-				// 		if (that.pages > 1) {
-				// 			that.pages -= 1
-				// 		}
-				// 		that.isLoadMore = true
-				// 		that.loadStatus = 'nomore'
-				// 	}
-				// 	uni.hideLoading()
-				// })
+			getMoreData() {
 				const that = this
-				var pages = that.pages
-				var limit = that.limit
-
+				var pages=that.pages
+				var limit=that.limit
+							   
 				uni.showLoading({
-					title: '正在加载',
+					title: '正在加载'
 				})
-				var pages = that.pages
-				var limit = that.limit
 				that.$api.request('news', 'getNewsInfo', {
-					category: 2,
-					page: 1,
-					limit: 10
-				}, failres => {
+					category:2,
+					page: pages,
+					limit:limit
+				},failres => {
 					that.$api.msg(failres.errmsg)
-					that.isLoadMore = false
+					that.isLoadMore=false
 					that.loadStatus = 'nomore'
-					if (that.pages > 1) {
-						that.pages -= 1
-					}
+					if(that.pages>1){that.pages-=1}
 					uni.hideLoading()
 				}).then(res => {
 					let data = res.data
-					that.newsInfo = data
-					that.isLoadMore = false
+					if(data.length > 0){
+						for(var k =0;k<data.length;k++){
+							if(data[k].title.length > 20){
+								data[k].title = data[k].title.substring(0,20) + "..."
+							}
+							let _date = new Date(data[k].gmtUpdate)
+							data[k].gmtUpdate = this.$u.timeFormat(_date.getTime(), 'mm-dd hh:MM');
+						}
+						that.newsInfo = that.newsInfo.concat(data)
+						that.isLoadMore=false
+					}
+					else{
+						if(that.pages>1){that.pages-=1}						
+						that.isLoadMore=true
+						that.loadStatus = 'nomore'
+					}
 					uni.hideLoading()
 				})
 			}
@@ -881,7 +859,7 @@
 		border-radius: 5px;
 		background: #fff;
 		overflow: hidden;
-		height: 366px;
+		// height: 366px;
 	}
 
 	.guess-section-wrap-content {

+ 1 - 1
pages/sale/newsinfo.vue

@@ -229,7 +229,7 @@
 						that.loadStatus = 'nomore'
 						if(that.pages>1){that.pages-=1}
 						uni.hideLoading()
-					}).then(res => {debugger
+					}).then(res => {
 						let data = res.data
 						if(data.length > 0){
 							for(var k =0;k<data.length;k++){