ccj 3 лет назад
Родитель
Сommit
3e75c175c5
3 измененных файлов с 79 добавлено и 26 удалено
  1. 2 2
      config/index.js
  2. 61 2
      pages/grain_pulse/home.vue
  3. 16 22
      pages/grain_pulse/position/position.vue

+ 2 - 2
config/index.js

@@ -1,8 +1,8 @@
 const dev = {
 	baseUrl: 'https://www.zthymaoyi.com',
 	// baseUrlNew: 'http://192.168.1.120:8090/',
-	// baseUrlNew: 'http://192.168.1.109:9100/',
-	baseUrlNew: 'http://api1.eliangeyun.com/',
+	baseUrlNew: 'http://192.168.1.103:9100/',
+	// baseUrlNew: 'http://api1.eliangeyun.com/',
 	h5Appid: 'wxb66b599f7f61b46f',
 	debug: false
 }

+ 61 - 2
pages/grain_pulse/home.vue

@@ -59,6 +59,9 @@
 					<view v-if='position.name!="未设置"' class='distance Regular'>{{item._metre}}</view>
 				</view>
 			</view>
+			<view v-show="isLoadMore">
+				<uni-load-more :status="loadStatus"></uni-load-more>
+			</view>
 			<view style='padding:10px;text-align:center;' v-if='datalist.length==0'>
 				当前暂无数据
 			</view>
@@ -90,6 +93,8 @@
 				pageSize: 10,
 				releaseInfo:[],
 				currentPage: 1,
+				isLoadMore: false, //是否加载中
+				loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
 				searchTypes: [{
 						name: '全部',
 						value: '0'
@@ -127,10 +132,19 @@
 		},
 		onPullDownRefresh() {
 		    this.getList()
+			this.isLoadMore = false
+			this.loadStatus = 'loading'
 		     setTimeout(function () {
 		         uni.stopPullDownRefresh();  //关闭下拉刷新
 		     }, 1000);
 		 },
+		 onReachBottom() { //上拉触底函数
+			if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
+				this.isLoadMore = true
+				this.currentPage += 1
+				this.getData()
+			}
+		 },
 		onShow(val) {
 			this.getList()
 			uni.hideKeyboard()
@@ -149,7 +163,6 @@
 		onLoad(option) {
 			if (option.position){
 				this.position = option.position
-				
 			}
 		},
 		methods: {
@@ -167,7 +180,8 @@
 					})
 				this.getInfo()
 			},
-			getInfo(){
+			getData(){
+				var that = this
 				uni.showLoading({
 					title:"正在加载"
 				})
@@ -177,6 +191,51 @@
 					currentPage: this.currentPage,
 					pcFlag: 2,
 					searchType: 2
+				}).then(res => {
+					if (res.data.code == 200) {
+						var data = res.data.data.records
+						if(data.length > 0){
+							this.datalist = this.datalist.concat(data)
+							console.log(this.position)
+							let lat2 =this.position.location.split(',')[1];
+							let lng2 = this.position.location.split(',')[0];
+							for(var i=0;i<this.datalist.length;i++){
+								this.datalist[i]._metre=this.utils.getDistance(this.datalist[i].latitude,this.datalist[i].longitude,lat2,lng2)
+							}
+							if(this.currentPage==1&&this.datalist.length==0){
+								this.notlist=true
+							}else{
+								this.notlist=false
+							}
+							console.log(this.datalist)
+							that.isLoadMore=false
+						}
+						else{
+							if(that.currentPage>1){that.currentPage-=1}						
+							that.isLoadMore=true
+							that.loadStatus = 'nomore'
+						}
+						
+						// let _metre = this.utils.getDistance(lat1,lng1,lat2,lng2) +"千米"
+					}
+					uni.hideLoading()
+				}).catch(res => {
+					that.isLoadMore=false
+					that.loadStatus = 'nomore'
+					if(that.currentPage>1){that.currentPage=1}
+					uni.hideLoading()
+				})
+			},
+			getInfo(){
+				uni.showLoading({
+					title:"正在加载"
+				})
+				this.$api.doRequest('get', '/settledCompanyInfo/selectSettledCompanyInfo', {
+					mainBusinessType: this.mainBusinessType,
+					pageSize: this.pageSize,
+					currentPage: 1,
+					pcFlag: 2,
+					searchType: 2
 				}).then(res => {
 					if (res.data.code == 200) {
 						this.datalist = res.data.data.records

+ 16 - 22
pages/grain_pulse/position/position.vue

@@ -129,27 +129,21 @@
 						data: this.list
 					});
 				}
-				if (this.positionType.type == 1) {
-					uni.setStorage({
-						key: 'setPosition',
-						data: item,
-						success: (res) => {
-							uni.navigateBack({
-								
-							})
-						}
-					})
-				} else {
-					uni.setStorage({
-						key: 'setLocaltion',
-						data: item,
-						success: (res) => {
-							uni.switchTab({
-								url: '../home'
-							})
-						},
-					})
-				}
+				uni.setStorage({
+					key: 'setPosition',
+					data: item,
+					success: (res) => {
+						uni.setStorage({
+							key: 'setLocaltion',
+							data: item,
+							success: (res) => {
+								uni.navigateBack({
+									
+								})
+							},
+						})
+					}
+				})
 			},
 			// 排序
 			compare(property) {
@@ -196,7 +190,7 @@
 						// #ifdef APP-PLUS
 						that.location = res
 						let _address = res.address
-						// that.city = _address.city
+						that.city = _address.city
 						that.seach.longitude = res.longitude
 						that.seach.latitude = res.latitude
 						that.address = _address.province + _address.city + _address.district + _address