wkyy 3 gadi atpakaļ
vecāks
revīzija
c5bbaebd7d
1 mainītis faili ar 107 papildinājumiem un 75 dzēšanām
  1. 107 75
      pages/friend/index.vue

+ 107 - 75
pages/friend/index.vue

@@ -10,9 +10,9 @@
 				<u-icon custom-prefix="custom-icon" name="filter-2-fill"></u-icon>
 				<span>筛选</span>
 			</view>
-			<view class="homeAdd" v-if="current == '1'">
+			<view class="homeAdd" v-if="current == '1'" @click="refreshClick">
 				<u-icon custom-prefix="custom-icon" name="refresh-line"></u-icon>
-				<span @click="refreshClick">刷新</span>
+				<span>刷新</span>
 			</view>
 		</view>
 		<u-popup v-model="show" mode="bottom" :closeable="true" border-radius="20" close-icon-pos="top-left">
@@ -182,32 +182,32 @@
 				rangeValues2: [170, 180],
 				step:1,
 				
-				data: {
-					type: '', //全部0,猜你喜欢1(不传默认查全部)
-					memberId: '', //未登录不传,登陆了传当前用户ID
-					oppositeSex: '', //只看异性1,不传值为查看所有
-					ageStart: '', //年龄起
-					ageEnd: '', //年龄止
-					heightStart: '', //身高起
-					heightEnd: '', //身高止
-					qy: '', //籍贯(单位所属区域)
-					xl: '', //学历
-					hyqk: '', //婚姻情况
-					znqk: '', //子女情况
-					pageIndex: 1,
-					pageSize: 20
-				},				
+				type: '', //全部0,猜你喜欢1(不传默认查全部)
+				memberId: '', //未登录不传,登陆了传当前用户ID
+				pageIndex: 1,
+				pageSize: 20,
 				recordsTotal: 0,
 				list: [],
 				friendList: [],
 				qyList: [], //所属区域
 				xlList: [], //学历
 				hyqkList: [], //婚姻情况
-				znqkLis: [], //子女情况
+				znqkList: [], //子女情况
 				qyActiveClass: 0,
 				xlActiveClass: 0,
 				hyqkActiveClass: 0,
-				znqkActiveClass: 0,
+				znqkActiveClass: 0,
+				form: {
+					oppositeSex: '', //只看异性1,不传值为查看所有
+					ageStart: '', //年龄起
+					ageEnd: '', //年龄止
+					heightStart: '', //身高起
+					heightEnd: '', //身高止
+					qy: '', //籍贯(单位所属区域)
+					xl: '', //学历
+					hyqk: '', //婚姻情况
+					znqk: '' //子女情况
+				},
 				tabList: [{
 					name: '全部'
 				}, {
@@ -228,7 +228,8 @@
 		},
 		onLoad(op) {
 			if(this.carhelp.getPersonInfo().id != null) {
-				this.data.memberId = this.carhelp.getPersonInfo().id;
+				this.memberId = this.carhelp.getPersonInfo().id;
+				this.form.memberId = this.carhelp.getPersonInfo().id;
 			}
 			this.getFriendList();
 			this.getConditionList();
@@ -262,91 +263,122 @@
 			},
 			qyClick(item,index) {
 				this.qyActiveClass = index;
-				this.data.qy = item.value;
+				this.form.qy = item.value;
 			},
 			xlClick(item,index) {
 				this.xlActiveClass = index;
-				this.data.xl = item.value;
+				this.form.xl = item.value;
 			},
 			hyqkClick(item,index) {
 				this.hyqkActiveClass = index;
-				this.data.hyqk = item.value;
+				this.form.hyqk = item.value;
 			},
 			znqkClick(item,index) {
 				this.znqkActiveClass = index;
-				this.data.znqk = item.value;
+				this.form.znqk = item.value;
 			},
 			sure() {
 				this.friendList = [];
 				if(this.checked) {
-					this.data.oppositeSex = '1';
+					this.form.oppositeSex = '1';
 				}
-				this.data.ageStart = this.rangeValues[0];
-				this.data.ageEnd = this.rangeValues[1];	
-				this.data.heightStart = this.rangeValues2[0];
-				this.data.heightEnd = this.rangeValues2[1];
-				if(this.data.qy == ''){
-					this.data.qy = this.qyList[0].value;
+				this.form.ageStart = this.rangeValues[0];
+				this.form.ageEnd = this.rangeValues[1];	
+				this.form.heightStart = this.rangeValues2[0];
+				this.form.heightEnd = this.rangeValues2[1];
+				if(this.form.qy == ''){
+					this.form.qy = this.qyList[0].value;
 				}
-				if(this.data.xl == ''){
-					this.data.xl = this.xlList[0].value;
+				if(this.form.xl == ''){
+					this.form.xl = this.xlList[0].value;
 				}
-				if(this.data.hyqk == ''){
-					this.data.hyqk = this.hyqkList[0].value;
+				if(this.form.hyqk == ''){
+					this.form.hyqk = this.hyqkList[0].value;
 				}
-				if(this.data.znqk == ''){
-					this.data.znqk = this.znqkList[0].value;
+				if(this.form.znqk == ''){
+					this.form.znqk = this.znqkList[0].value;
 				}
 				
-				this.getFriendList();
+				this.list = this.form;
+				
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				friendApi.findFriendsList(this.form,{memberId: this.memberId}).then((res) => {
+					this.friendList = [
+						...this.friendList,
+						...res.data.data
+					];
+					this.recordsTotal = res.data.recordsTotal;
+					uni.hideLoading();
+				}).catch(error => {
+					uni.showToast({
+						title: error
+					})
+				})
 				this.show = false;
 			},
 			change(index) {
 				this.current = index;
-				this.data.type = index;
-				this.getFriendList();
+				this.type = index;
+				if(this.type == '1') {
+					this.refreshClick();
+				} else {
+					this.getFriendList(true);
+				}
+			},
+			refreshClick() {
+				let formList = [];
+				for(var item in this.list) {
+					var sgd = {};
+					sgd[item] = this.list[item]
+					formList.push(sgd);
+				}
+				
+				var num1=Math.floor(Math.random()*8+0);
+				var num2=Math.floor(Math.random()*8+0);
+				var num3=Math.floor(Math.random()*8+0);
+				console.log(formList[num1]);
+				console.log(formList[num2]);
+				console.log(formList[num3]);
+				
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				friendApi.findFriendsList({memberId: this.memberId},formList[num1],formList[num2],formList[num3]).then((res) => {
+					this.friendList = res.data.data;
+					uni.hideLoading();
+				}).catch(error => {
+					uni.showToast({
+						title: error
+					})
+				})	
 			},
 			myLoadmore() {
-				this.data.pageIndex += 1;
+				this.pageIndex += 1;
 				this.getFriendList()
 			},
-			refreshClick() {
-				var data = {
-					type: 'typedssdf',
-					memberId: 'memberId',
-					oppositeSex: 'oppositeSex',
-					ageStart: 'ageStart',
-					ageEnd: 'ageEnd',
-					heightStart: 'heightStart',
-					heightEnd: 'heightEnd',
-					qy: 'qy',
-					xl: 'xl',
-					hyqk: 'hyqk',
-					znqk: 'znqk'
-				};
-				let list = [];
-				for(var item in data) {
-					var sgd = {};
-					sgd[item] = data[item]
-					list.push(sgd);
-				}
-				console.log(list)
-				
-				for(var i = 0; i < 3; i++) {
-					var num=Math.floor(Math.random()*10+0);
-					console.log(list[num])
-				}
-			},
-			getFriendList() {
+			getFriendList(bl) {
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
-				})
-				friendApi.findFriendsList(this.data).then((res) => {
-					this.friendList = [
-						...this.friendList,
-						...res.data.data
-					];
+				})
+				if (bl) {
+					this.friendList = [];
+					this.pageIndex = 1;
+				}
+				friendApi.findFriendsList({
+					type: this.type,
+					memberId: this.memberId,
+					pageIndex: 1,
+					pageSize: 20
+				}).then((res) => {
+					this.friendList = [
+						...this.friendList,
+						...res.data.data
+					];
 					this.recordsTotal = res.data.recordsTotal;
 					uni.hideLoading();
 				}).catch(error => {