Commit 1e04794d authored by liwei's avatar liwei

新增了会员列表搜索功能和页面

parent 57b7cf25
......@@ -92,6 +92,20 @@ export const options = {
{ label: '拉祜族', value: 54 },
{ label: '仫佬', value: 55 }
],
height: [
{ label: '不限', value: '不限' },
{ label: '150-160', value: '150-160' },
{ label: '160-170', value: '160-170' },
{ label: '170-180', value: '170-180' },
{ label: '180以上', value: '180以上' }
],
weight: [
{ label: '不限', value: '不限' },
{ label: '30-40', value: '30-40' },
{ label: '50-60', value: '50-60' },
{ label: '70-80', value: '70-80' },
{ label: '80以上', value: '80以上' }
],
residence: [
{
label: '北京',
......@@ -1852,7 +1866,7 @@ export const options = {
]
}
// 获取整个options [{label: a,value: b }]
const opList = ['sex', 'education', 'marriage', 'constellation', 'nation', 'residence','realAuthen']
const opList = ['sex', 'education', 'marriage', 'constellation', 'nation', 'residence','realAuthen','height','weight']
export function getOptions(optionName) {
if (!opList.includes(optionName)) {
return []
......
......@@ -298,7 +298,7 @@
"pages": [{
"path": "preference/preference",
"style": {
"navigationBarTitleText": "推荐设置",
"navigationBarTitleText": "筛选设置",
"backgroundColor": "#ffffff",
"backgroundColorTop": "#ffffff",
"navigationBarBackgroundColor": "#ffffff"
......
......@@ -4,10 +4,7 @@
<view class="content">
<!-- 左上角搜索-->
<u-navbar bgColor="white" :placeholder="true">
<view class="u-nav-slot" slot="left" @click="screen">
<!-- <image :src="baseUrl+'/index/screen.png'" class="img" mode="aspectFill"></image>-->
<!-- <view class="text">搜索</view>-->
</view>
<view class="u-nav-slot" slot="left"></view>
</u-navbar>
<view>
......@@ -179,13 +176,6 @@
url: '/pagesUser/userInfo?memberId='+item.businessId
})
},
//左上角的搜索
async screen() {
//判断当前是否已登录
uni.navigateTo({
url: '/pagespreference/preference/preference'
});
},
},
};
</script>
......
<template>
<view style="background-color: #F4F5F9;min-height: 100vh;">
<!-- 页头-->
<u-navbar @leftClick="backbar" bgColor="#F4F5F9" title="会员信息"></u-navbar>
<u-navbar bgColor="white" :placeholder="true" title="会员信息">
<view class="u-nav-slot" slot="left">
<u-icon name="arrow-left" color="black" size="20" @click="backbar"/>
<view @click="search" style="display: flex;align-items: center;justify-content: center">
<image :src="baseUrl+'/index/screen.png'" class="img" mode="aspectFill"></image>
<view class="text">筛选</view>
</view>
</view>
</u-navbar>
<view class="recommendation" :style="{'top':navHeight+'px'}">
<view v-if="isdata" class="nodatacard">
<view class="text">暂无数据</view>
......@@ -36,6 +44,7 @@
import {userList} from "../api/user";
import {getCity, getValue} from "../common/options";
import {calculateAge, parseDate} from "../common";
import {getOssUrl} from "../api/article";
export default {
data() {
return {
......@@ -52,9 +61,8 @@ export default {
isdata: false,
//页面数据的数量
num:'',
//距离表头
//距离表头高度
navHeight:'',
share: false,
menuButtonInfo: '',
};
},
......@@ -73,44 +81,86 @@ export default {
statusBarHeight
} = res;
const margin = top - statusBarHeight
this.navHeight = (height + statusBarHeight + (margin * 3)) //导航栏总高
this.navHeight = (height + statusBarHeight + (margin * 5)) //导航栏总高
}
})
//获取用户信息
this.getUserList()
},
methods: {
filterSearch(value) {
let minHeight = ''
let maxHeight = ''
let minWeight = ''
let maxWeight = ''
if (value.memHeight != ''){
minHeight = value.memHeight.split('-')[0]
maxHeight = value.memHeight.split('-')[1]
}
if (value.memWeight != ''){
minWeight = value.memWeight.split('-')[0]
maxWeight = value.memWeight.split('-')[1]
}
console.log('======params======', value)
this.queryParam = {
page: 1,
rows: 10,
memCareer:value.memCareer,
memCollege:value.memCollege,
memSex: value.memSex,
minHeight: minHeight,
maxHeight: maxHeight,
minWeight: minWeight,
maxWeight: maxWeight,
memResidenceProvince: value.memResidenceProvince,
memResidenceCity: value.memResidenceCity
}
this.getUserList()
},
//左上角的搜索
search() {
//判断当前是否已登录
uni.navigateTo({
url: '/pagespreference/preference/preference'
});
},
//跳转用户详情
gotoDetail(item){
uni.navigateTo({
url: '/pagesUser/userInfo?id='+item.userId
})
},
//获取用户列表数据
getUserList() {
const query = {
page: this.queryParam.page,
rows: this.queryParam.rows
}
userList(query).then(res =>{
userList(this.queryParam).then(res =>{
this.userList = res.data.data
//遍历this.userList
this.userList.forEach(item => {
//处理头像
item.avatarUrl = item.avatarUrl.replace(/\\/g, '/') // 替换 avatarUrl 中的所有 \ 为 /
if (item.avatar != null && item.avatar != ''){
getOssUrl(item.avatar).then(res => {
item.avatarUrl = res.data.data
})
}
//处理性别
item.memSex = getValue('sex',item.memSex)
if (item.memSex != null && item.memSex != ''){
item.memSex = getValue('sex',item.memSex)
}
//处理年龄
const birthdayItem = parseDate(item.memBirthday)
item.memAge = calculateAge(birthdayItem.year,birthdayItem.month,birthdayItem.day)
if (item.memBirthday != null && item.memBirthday != ''){
const birthdayItem = parseDate(item.memBirthday)
item.memAge = calculateAge(birthdayItem.year,birthdayItem.month,birthdayItem.day)
}
//处理地址
item.city = getCity(item.memResidenceProvince,item.memResidenceCity)
if (item.memResidenceProvince != null && item.memResidenceProvince != '' && item.memResidenceCity != null && item.memResidenceCity != ''){
item.city = getCity(item.memResidenceProvince,item.memResidenceCity)
}
});
}).catch(e => {
console.log(e)
})
},
//返回按钮
backbar() {
uni.navigateBack({
delta: 1, //返回层数,2则上上页
......@@ -121,9 +171,29 @@ export default {
</script>
<style lang="scss" scoped>
.u-nav-slot {
display: flex;
align-items: center;
.text {
height: 44rpx;
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #000000;
margin-left: 14rpx;
line-height: 44rpx;
}
.img {
width: 22rpx;
height: 28rpx;
margin-left: 32rpx;
}
}
.recommendation {
background-color: #F4F5F9;
position: relative;
position: absolute;
padding: 0 34rpx;
.nodatacard{
height: 100vh;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment