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;
......
<template>
<view class="" @touchmove.stop.prevent="() => {}">
<view class="" style="height: 56rpx;"></view>
<view class="" v-if="falg">
<view class="boot">
<view class="xuan">
<view class="div" v-for="(item, index) in list" :key="index" @click="clicks(index)">
<view class="name">{{ item.regionName2 }}</view>
<view class="" v-if="index == 0"><u-icon name="arrow-down" color="#434343" size="16"></u-icon></view>
<view class="" v-else><u-icon name="close" color="#434343" size="16"></u-icon></view>
<image :src="baseUrl+'/common/select.png'" v-if="index == 0" class="img" mode="aspectFill"></image>
</view>
<view class="div" @click="add"><view class="name" style="margin-left: 0rpx;">添加</view></view>
</view>
</view>
<view class="tabs">
<view class="ewrew">
年龄:
<view>{{ minValue }} - {{ maxValue }}</view>
</view>
<s-region-slider
:minValue="minValue"
:maxValue="maxValue"
:fillMinValue="16"
:fillValue="60"
:step="1"
@up="up"
@down="down"
@move="move"
:parentCode="parentCode"
:regionCode="regionCode"
:regionName="regionName"
/>
</view>
</view>
<view class="adding" @click="addcity">确定</view>
<level-linkage ref="levelLinkage" :pickerValueDefault="pickerValueDefault" :allData="treeData" @take="take" themeColor="#007AFF"></level-linkage>
<ELM ref="elm" :msg="tipMsg" :isConfirm="isConfirm" @confirm="confirm"></ELM>
</view>
<view class="form">
<view>
<u--form
labelPosition="left"
:model="queryParams"
labelWidth="90"
ref="uForm"
>
<u-form-item
label="性别"
prop="memSexText"
borderBottom
@click="showSex = true; hideKeyboard()"
>
<u--input
v-model="queryParams.memSexText"
disabled
disabledColor="#ffffff"
placeholder="请选择性别"
border="none"
></u--input>
<u-icon
slot="right"
name="arrow-right"
></u-icon>
</u-form-item>
<u-form-item
label="身高"
prop="memHeight"
borderBottom
@click="showHeight = true; hideKeyboard()"
>
<u--input
v-model="queryParams.memHeight"
disabled
disabledColor="#ffffff"
placeholder="请选择身高"
border="none"
></u--input>
<span slot="right">cm</span>
</u-form-item>
<u-form-item
label="体重"
prop="memWeight"
borderBottom
@click="showWeight = true; hideKeyboard()"
>
<u--input
v-model="queryParams.memWeight"
disabled
disabledColor="#ffffff"
placeholder="请选择体重"
border="none"
></u--input>
<span slot="right">kg</span>
</u-form-item>
<u-form-item
label="居住地"
prop="memResidence"
borderBottom
@click="showResidence = true; hideKeyboard()"
>
<u--input
v-model="queryParams.memResidence"
disabled
disabledColor="#ffffff"
placeholder="请选择居住地"
border="none"
></u--input>
<u-icon
slot="right"
name="arrow-right"
></u-icon>
</u-form-item>
</u--form>
<u-button
type="primary"
text="提交"
customStyle="margin-top: 50px"
@click="submit"
></u-button>
<u-button
type="error"
text="重置"
customStyle="margin-top: 10px;margin-bottom:50px"
@click="reset"
></u-button>
<!-- 性别-->
<u-picker
:show="showSex"
:columns="sexActions"
keyName="label"
@cancel="showSex=false"
@confirm="confirmSex"
></u-picker>
<!-- 身高-->
<u-picker
:show="showHeight"
:columns="heightActions"
keyName="label"
@cancel="showHeight=false"
@confirm="confirmHeight"
></u-picker>
<!-- 体重-->
<u-picker
:show="showWeight"
:columns="weightActions"
keyName="label"
@cancel="showWeight=false"
@confirm="confirmWeight"
></u-picker>
<!-- 居住地-->
<u-picker
:show="showResidence"
:columns="residenceActions"
keyName="label"
@cancel="showResidence=false"
@change="changeResidence"
@confirm="confirmResidence"
></u-picker>
</view>
</view>
</template>
<script>
import levelLinkage from '../components/three-level-linkage/linkage.vue';
import sRegionSlider from '../components/s-region-slider/s-region-slider.vue';
import ELM from '@/components/elm-toast/index.vue';
export default {
components: {
sRegionSlider,
levelLinkage,
ELM
},
data() {
return {
//图片路径
baseUrl: this.$IMG_URL,
falg: false,
minValue: 1,
maxValue: 100,
pickerValueDefault: [0, 0],
pickerText: '',
list: [],
parentCode: '',
regionCode: '',
regionName2: '',
tipMsg: '',
isConfirm: false
};
},
onShow() {
this.configInfo();
},
onLoad() {},
methods: {
async configInfo() {
const res = await this.$myRequest({
url: '/nostalgia/fruser/user/configInfo',
withToken: true,
method: 'GET'
});
console.log(res, 'delshoucang');
if (res.data.code == 200) {
this.maxValue = res.data.data.maxAge;
this.minValue = res.data.data.minAge;
this.list = [];
if (res.data.data.city) {
res.data.data.city.forEach((item, index) => {
var obj = {
regionName2: item
};
this.list.push(obj);
});
}
} else {
this.tipMsg = res.data.msg;
this.$refs.elm.showDialog();
}
this.falg = true;
},
async addcity() {
uni.showLoading({
title: '设置中...'
});
let citydata = [];
this.list.forEach((item, index) => {
citydata.push(item.regionName2);
});
console.log(citydata);
const res = await this.$myRequest({
url: '/nostalgia/fruser/update/configInfo',
data: {
city: citydata,
maxAge: this.maxValue,
minAge: this.minValue
},
withToken: true,
method: 'PUT'
});
console.log(res, 'delshoucang');
uni.hideLoading();
if (res.data.code == 200) {
this.isConfirm = true;
this.tipMsg = "设置成功";
this.$refs.elm.showDialog();
} else {
this.tipMsg = res.data.msg;
this.$refs.elm.showDialog();
}
},
clicks(e) {
if (e == 0) {
this.$refs.levelLinkage.open(1);
} else {
this.list.splice(e, 1);
}
},
take(e) {
console.log(e, '[[[[]]]]');
if (e.num == 1) {
this.list.forEach((item, index) => {
if (item.regionName2 == e.regionName2) {
this.list.splice(index, 1);
}
});
this.list.splice(e.index, 1);
this.list.unshift(e);
} else {
const index = this.list.findIndex(function(val) {
return val.regionName2 === e.regionName2;
});
// 如果有多个满足,返回第一个的index
console.log(index, '[[[[[[[[[[[]]]]]]]]]]]');
if (index == 0) {
this.tipMsg = "您已添加过该城市";
this.$refs.elm.showDialog();
} else {
this.list.push(e);
}
}
},
chage(minValue, maxValue) {
this.minValue = minValue;
this.maxValue = maxValue;
},
add() {
this.$refs.levelLinkage.open(2);
},
up(e) {
console.log(e); //// e中包含了原有的e信息, 并添加了custom对象
this.minValue = e.custom.minValue;
this.maxValue = e.custom.maxValue;
},
left() {
uni.navigateBack();
},
down(e) {},
move(e) {},
confirm() {
this.isConfirm = false;
uni.navigateBack();
}
}
};
</script>
<style lang="scss">
.adding {
width: 614rpx;
height: 84rpx;
background: linear-gradient(86deg, #c2d2f9 0%, #c5c2f3 100%);
border-radius: 42rpx 42rpx 42rpx 42rpx;
font-size: 28rpx;
font-family: 'PingFang SC-Regular, PingFang SC';
font-weight: 400;
color: #415c9e;
line-height: 84rpx;
position: fixed;
bottom: 54rpx;
left: 68rpx;
text-align: center;
}
.xuan {
width: 100%;
display: flex;
align-items: center;
flex-wrap: wrap;
.div {
// width: 170rpx;
height: 72rpx;
background: rgba(81, 81, 81, 0.08);
border-radius: 16rpx;
margin-bottom: 40rpx;
margin-right: 20rpx;
position: relative;
display: flex;
align-items: center;
justify-content: center;
padding: 0 32rpx;
.name {
font-size: 28rpx;
font-family: 'PingFang SC-Medium, PingFang SC';
font-weight: 500;
color: #434343;
line-height: 28rpx;
margin-right: 10rpx;
}
.img {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 0rpx;
top: 0rpx;
}
}
}
.boot {
width: 686rpx;
border-bottom: 2rpx solid #ececec;
margin: 0 auto;
}
.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: 12rpx;
}
}
page {
width: 100%;
height: 100%;
}
.ewrew {
display: flex;
height: 50rpx;
font-size: 36rpx;
font-family: 'PingFang SC-Regular, PingFang SC';
font-weight: 400;
color: #333333;
line-height: 50rpx;
align-items: center;
margin-top: 50rpx;
margin-bottom: 42rpx;
view {
height: 50rpx;
font-size: 32rpx;
font-family: 'PingFang SC-Bold, PingFang SC';
font-weight: bold;
color: #446cd2;
line-height: 50rpx;
margin-left: 24rpx;
}
}
<script>
import UFormItem from "../../uni_modules/uview-ui/components/u-form-item/u-form-item";
import {getOptions} from "../../common/options";
.tabs {
// position: fixed;
width: 686rpx;
margin: 0 auto;
height: 300px;
export default {
components: {UFormItem },
data() {
return {
index:0,
//数据选项
sexActions:[
getOptions('sex')
],
heightActions:[
getOptions('height')
],
weightActions:[
getOptions('weight')
],
residenceActions: [
getOptions('residence'),
[{
label: '北京',
value: '0101'
}]
],
//选择器
showSex: false,
showEducation: false,
showResidence: false,
showHeight:false,
showWeight:false,
queryParams: {
memSex: '',//性别
memHeight:'',//身高
memWeight:'',//体重
memResidenceProvince:'',//居住地省份
memResidenceCity:'',//居住城市
},
tipMsg: '',
isConfirm: false
}
},
onReady() {
},
onShow() {
},
methods: {
//性别确认
confirmSex(e){
console.log('======e======', e)
this.showSex = false
this.queryParams.memSex = e.value[0].value
this.queryParams.memSexText = e.value[0].label
},
//身高确认
confirmHeight(e){
this.showHeight = false
this.queryParams.memHeight = e.value[0].value
this.queryParams.memHeightText = e.value[0].label
},
//体重确认
confirmWeight(e){
this.showWeight = false
this.queryParams.memWeight = e.value[0].value
this.queryParams.memWeightText = e.value[0].label
},
//地址确认
confirmResidence(e){
this.showResidence = false
this.queryParams.memResidence = e.value[0].label + '/' + e.value[1].label
this.queryParams.memResidenceProvince = e.value[0].value
this.queryParams.memResidenceCity = e.value[1].value
},
//地址改变
changeResidence(e) {
// 更新城市列表为当前选中省份的城市列表
this.$set(this.residenceActions, 1, e.value[0].children);
},
//点击提交
submit() {
let pages = getCurrentPages() // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
let prevPage = pages[pages.length - 2] //上一页页面实例
uni.navigateBack({
delta:1,
success:() => {
prevPage.$vm.filterSearch(this.queryParams) // 给上一页绑定方法filterSearch
this.queryParams = {}
}
})
},
//点击重置
reset() {
this.queryParams = {
memSex: '',//性别
memHeight:'',//身高
memWeight:'',//体重
memResidenceProvince:'',//居住地省份
memResidenceCity:'',//居住城市
}
},
//阻止键盘
hideKeyboard() {
uni.hideKeyboard()
},
},
}
</script>
.btn {
margin: 10px 0;
background-color: #f0ad4e;
width: 200px;
<style lang="scss" scoped>
.form{
padding-top: 20rpx;
padding-left: 20rpx;
padding-right: 20rpx;
}
</style>
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