Browse Source

交友筛选

wkyy 3 years ago
parent
commit
3d79e0ffbc
1 changed files with 104 additions and 72 deletions
  1. 104 72
      pages/friend/index.vue

+ 104 - 72
pages/friend/index.vue

@@ -82,30 +82,18 @@
 						<span>会员所属工会所在地</span>
 						<span>会员所属工会所在地</span>
 					</view>
 					</view>
 					<view class="screenCon-con">
 					<view class="screenCon-con">
-						<view class="screenCon-choice">
-							<view class="choice-item active">荆州市</view>
-							<view class="choice-item">荆州区</view>
-							<view class="choice-item">沙市区</view>
-							<view class="choice-item">江陵县</view>
-							<view class="choice-item">公安县</view>
-							<view class="choice-item">松滋市</view>
-							<view class="choice-item">石首市</view>
-							<view class="choice-item">监利市</view>
-							<view class="choice-item">洪湖市</view>
+						<view class="screenCon-choice" v-for="(item ,index) in qyList" :key="item.id" @click="qyClick(item,index)">
+							<view :class="activeClass == index ? 'choice-item active':'choice-item'">{{item.name}}</view>
 						</view>
 						</view>
 					</view>
 					</view>
 				</view>
 				</view>
 				<view class="screenCon-item">
 				<view class="screenCon-item">
 					<view class="screenCon-tit">
 					<view class="screenCon-tit">
-						<span>会员所属工会所在地</span>
+						<span>学历</span>
 					</view>
 					</view>
 					<view class="screenCon-con">
 					<view class="screenCon-con">
-						<view class="screenCon-choice">
-							<view class="choice-item active">不限</view>
-							<view class="choice-item">高中及以上</view>
-							<view class="choice-item">大专及以上</view>
-							<view class="choice-item">本科及以上</view>
-							<view class="choice-item">其他</view>
+						<view class="screenCon-choice" v-for="(item ,index) in xlList" :key="item.id" @click="xlClick(item,index)">
+							<view :class="activeClass == index ? 'choice-item active':'choice-item'">{{item.name}}</view>
 						</view>
 						</view>
 					</view>
 					</view>
 				</view>
 				</view>
@@ -114,11 +102,8 @@
 						<span>婚姻状况</span>
 						<span>婚姻状况</span>
 					</view>
 					</view>
 					<view class="screenCon-con">
 					<view class="screenCon-con">
-						<view class="screenCon-choice">
-							<view class="choice-item active">不限</view>
-							<view class="choice-item">未婚</view>
-							<view class="choice-item">离异</view>
-							<view class="choice-item">丧偶</view>
+						<view class="screenCon-choice" v-for="(item ,index) in hyqkList" :key="item.id" @click="hyqkClick(item,index)">
+							<view :class="activeClass == index ? 'choice-item active':'choice-item'">{{item.name}}</view>
 						</view>
 						</view>
 					</view>
 					</view>
 				</view>
 				</view>
@@ -127,15 +112,13 @@
 						<span>子女状况</span>
 						<span>子女状况</span>
 					</view>
 					</view>
 					<view class="screenCon-con">
 					<view class="screenCon-con">
-						<view class="screenCon-choice">
-							<view class="choice-item active">不限</view>
-							<view class="choice-item">无</view>
-							<view class="choice-item">有</view>
+						<view class="screenCon-choice" v-for="(item ,index) in znqkList" :key="item.id" @click="znqkClick(item,index)">
+							<view :class="activeClass == index ? 'choice-item active':'choice-item'">{{item.name}}</view>
 						</view>
 						</view>
 					</view>
 					</view>
 				</view>
 				</view>
 				<view class="screenCon-btn">
 				<view class="screenCon-btn">
-					<u-button type="error" shape="circle" :custom-style="customStyle">确定</u-button>
+					<u-button type="error" shape="circle" :custom-style="customStyle" @click="sure">确定</u-button>
 				</view>
 				</view>
 			</view>
 			</view>
 		</u-popup>
 		</u-popup>
@@ -172,7 +155,8 @@
 </template>
 </template>
 
 
 <script>
 <script>
-	import * as friendApi from '@/apis/friend.js'
+	import * as friendApi from '@/apis/friend.js'
+	import * as loginApi from '@/apis/login.js'
 	import RangeSlider from '../../components/range-slider/range-slider.vue';
 	import RangeSlider from '../../components/range-slider/range-slider.vue';
  
  
 	export default {
 	export default {
@@ -192,28 +176,31 @@
 				slideMax2: 220,
 				slideMax2: 220,
 				isLiveMode: true,
 				isLiveMode: true,
 				rangeValues2: [170, 180],
 				rangeValues2: [170, 180],
-				step:1,
-			 
-				
-				
-			
-				
-				type: '', //全部0,猜你喜欢1(不传默认查全部)
-				memberId: '', //未登录不传,登陆了传当前用户ID
-				oppositeSex: '', //只看异性1,不传值为查看所有
-				ageStart: '', //年龄起
-				ageEnd: '', //年龄止
-				heightStart: '', //身高起
-				heightEnd: '', //身高止
-				qy: '', //籍贯(单位所属区域)
-				xl: '', //学历
-				hyqk: '', //婚姻情况
-				znqk: '', //子女情况
-				pageIndex: 1,
-				pageSize: 20,
+				step:1,
+				
+				data: {
+					type: '', //全部0,猜你喜欢1(不传默认查全部)
+					memberId: '', //未登录不传,登陆了传当前用户ID
+					oppositeSex: '', //只看异性1,不传值为查看所有
+					ageStart: '', //年龄起
+					ageEnd: '', //年龄止
+					heightStart: '', //身高起
+					heightEnd: '', //身高止
+					qy: '', //籍贯(单位所属区域)
+					xl: '', //学历
+					hyqk: '', //婚姻情况
+					znqk: '', //子女情况
+					pageIndex: 1,
+					pageSize: 20,
+				},
 				recordsTotal: 0,
 				recordsTotal: 0,
 				list: [],
 				list: [],
-				friendList: [],
+				friendList: [],
+				qyList: [], //所属区域
+				xlList: [], //学历
+				hyqkList: [], //婚姻情况
+				znqkLis: [], //子女情况
+				activeClass: 0,
 				tabList: [{
 				tabList: [{
 					name: '全部'
 					name: '全部'
 				}, {
 				}, {
@@ -234,9 +221,10 @@
 		},
 		},
 		onLoad(op) {
 		onLoad(op) {
 			if(this.carhelp.getPersonInfo().id != null) {
 			if(this.carhelp.getPersonInfo().id != null) {
-				this.memberId = this.carhelp.getPersonInfo().id;
+				this.data.memberId = this.carhelp.getPersonInfo().id;
 			}
 			}
-			this.getFriendList();
+			this.getFriendList();
+			this.getConditionList();
 		},
 		},
 		onReachBottom() {
 		onReachBottom() {
 			if (this.friendList.length < this.recordsTotal) {	
 			if (this.friendList.length < this.recordsTotal) {	
@@ -250,7 +238,7 @@
 			},
 			},
 		
 		
 			onRangeChange: function(e) {
 			onRangeChange: function(e) {
-				this.rangeValues = [e.minValue, e.maxValue];
+				this.rangeValues = [e.minValue, e.maxValue];			
 			},
 			},
 			onRangeChange2: function(e) {
 			onRangeChange2: function(e) {
 				this.rangeValues2 = [e.minValue, e.maxValue];
 				this.rangeValues2 = [e.minValue, e.maxValue];
@@ -264,11 +252,57 @@
 				//剩余分钟数
 				//剩余分钟数
 				let minutes_min = parseInt(minutes % 60);
 				let minutes_min = parseInt(minutes % 60);
 				return '' + this.pad(hours, 2) + ':' + this.pad(minutes_min, 2) + ':' + '00';
 				return '' + this.pad(hours, 2) + ':' + this.pad(minutes_min, 2) + ':' + '00';
+			},
+			qyClick(item,index) {
+				this.activeClass = index;
+				this.data.qy = item.name;
+			},
+			xlClick(item,index) {
+				this.activeClass = index;
+				this.data.xl = item.name;
+			},
+			hyqkClick(item,index) {
+				this.activeClass = index;
+				this.data.hyqk = item.name;
+			},
+			znqkClick(item,index) {
+				this.activeClass = index;
+				this.data.znqk = item.name;
+			},
+			sure() {
+				this.show = false;
+				
+				if(this.checked) {
+					this.data.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];
+				console.log(this.qyList[0].name)
+				if(this.data.qy == ''){
+					this.data.qy = this.qyList[0].name;
+				}
+				if(this.data.xl == ''){
+					this.data.xl = this.qyList[0].name;
+				}
+				if(this.data.hyqk == ''){
+					this.data.hyqk = this.qyList[0].name;
+				}
+				if(this.data.znqk == ''){
+					this.data.znqk = this.qyList[0].name;
+				}
+				
+				this.getFriendList();
 			},
 			},
 			change(index) {
 			change(index) {
 				this.current = index;
 				this.current = index;
-				this.type = index;
+				this.data.type = index;
 				this.getFriendList();
 				this.getFriendList();
+			},
+			myLoadmore() {
+				this.data.pageIndex += 1;
+				this.getFriendList()
 			},
 			},
 			refreshClick() {
 			refreshClick() {
 				var data = {
 				var data = {
@@ -302,22 +336,7 @@
 					title: "加载中",
 					title: "加载中",
 					mask: true,
 					mask: true,
 				})
 				})
-				var data = {
-					type: this.type,
-					memberId: this.memberId,
-					oppositeSex: this.oppositeSex,
-					ageStart: this.ageStart,
-					ageEnd: this.ageEnd,
-					heightStart: this.heightStart,
-					heightEnd: this.heightEnd,
-					qy: this.qy,
-					xl: this.xl,
-					hyqk: this.hyqk,
-					znqk: this.znqk,
-					pageIndex: this.pageIndex,
-					pageSize: this.pageSize
-				};
-				friendApi.findFriendsList(data).then((res) => {
+				friendApi.findFriendsList(this.data).then((res) => {
 					this.friendList = [
 					this.friendList = [
 						...this.friendList,
 						...this.friendList,
 						...res.data.data
 						...res.data.data
@@ -329,10 +348,23 @@
 						title: error
 						title: error
 					})
 					})
 				})
 				})
-			},
-			myLoadmore() {			
-				this.pageIndex += 1;
-				this.getFriendList()
+			},
+			getConditionList() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				loginApi.getBaseDictionary().then((res) => {
+					this.qyList = res.data.qyList;
+					this.xlList = res.data.xlList;
+					this.hyqkList = res.data.hyqkList;
+					this.znqkList = res.data.znqkList;
+					uni.hideLoading();
+				}).catch(error => {
+					uni.showToast({
+						title: error
+					})
+				})
 			},
 			},
 		}
 		}
 	}
 	}