Commit 1e04794d authored by liwei's avatar liwei

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

parent 57b7cf25
...@@ -92,6 +92,20 @@ export const options = { ...@@ -92,6 +92,20 @@ export const options = {
{ label: '拉祜族', value: 54 }, { label: '拉祜族', value: 54 },
{ label: '仫佬', value: 55 } { 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: [ residence: [
{ {
label: '北京', label: '北京',
...@@ -1852,7 +1866,7 @@ export const options = { ...@@ -1852,7 +1866,7 @@ export const options = {
] ]
} }
// 获取整个options [{label: a,value: b }] // 获取整个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) { export function getOptions(optionName) {
if (!opList.includes(optionName)) { if (!opList.includes(optionName)) {
return [] return []
......
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
"pages": [{ "pages": [{
"path": "preference/preference", "path": "preference/preference",
"style": { "style": {
"navigationBarTitleText": "推荐设置", "navigationBarTitleText": "筛选设置",
"backgroundColor": "#ffffff", "backgroundColor": "#ffffff",
"backgroundColorTop": "#ffffff", "backgroundColorTop": "#ffffff",
"navigationBarBackgroundColor": "#ffffff" "navigationBarBackgroundColor": "#ffffff"
......
...@@ -4,10 +4,7 @@ ...@@ -4,10 +4,7 @@
<view class="content"> <view class="content">
<!-- 左上角搜索--> <!-- 左上角搜索-->
<u-navbar bgColor="white" :placeholder="true"> <u-navbar bgColor="white" :placeholder="true">
<view class="u-nav-slot" slot="left" @click="screen"> <view class="u-nav-slot" slot="left"></view>
<!-- <image :src="baseUrl+'/index/screen.png'" class="img" mode="aspectFill"></image>-->
<!-- <view class="text">搜索</view>-->
</view>
</u-navbar> </u-navbar>
<view> <view>
...@@ -179,13 +176,6 @@ ...@@ -179,13 +176,6 @@
url: '/pagesUser/userInfo?memberId='+item.businessId url: '/pagesUser/userInfo?memberId='+item.businessId
}) })
}, },
//左上角的搜索
async screen() {
//判断当前是否已登录
uni.navigateTo({
url: '/pagespreference/preference/preference'
});
},
}, },
}; };
</script> </script>
......
<template> <template>
<view style="background-color: #F4F5F9;min-height: 100vh;"> <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 class="recommendation" :style="{'top':navHeight+'px'}">
<view v-if="isdata" class="nodatacard"> <view v-if="isdata" class="nodatacard">
<view class="text">暂无数据</view> <view class="text">暂无数据</view>
...@@ -36,6 +44,7 @@ ...@@ -36,6 +44,7 @@
import {userList} from "../api/user"; import {userList} from "../api/user";
import {getCity, getValue} from "../common/options"; import {getCity, getValue} from "../common/options";
import {calculateAge, parseDate} from "../common"; import {calculateAge, parseDate} from "../common";
import {getOssUrl} from "../api/article";
export default { export default {
data() { data() {
return { return {
...@@ -52,9 +61,8 @@ export default { ...@@ -52,9 +61,8 @@ export default {
isdata: false, isdata: false,
//页面数据的数量 //页面数据的数量
num:'', num:'',
//距离表头 //距离表头高度
navHeight:'', navHeight:'',
share: false,
menuButtonInfo: '', menuButtonInfo: '',
}; };
}, },
...@@ -73,44 +81,86 @@ export default { ...@@ -73,44 +81,86 @@ export default {
statusBarHeight statusBarHeight
} = res; } = res;
const margin = top - statusBarHeight const margin = top - statusBarHeight
this.navHeight = (height + statusBarHeight + (margin * 3)) //导航栏总高 this.navHeight = (height + statusBarHeight + (margin * 5)) //导航栏总高
} }
}) })
//获取用户信息 //获取用户信息
this.getUserList() this.getUserList()
}, },
methods: { 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){ gotoDetail(item){
uni.navigateTo({ uni.navigateTo({
url: '/pagesUser/userInfo?id='+item.userId url: '/pagesUser/userInfo?id='+item.userId
}) })
}, },
//获取用户列表数据
getUserList() { getUserList() {
const query = { userList(this.queryParam).then(res =>{
page: this.queryParam.page,
rows: this.queryParam.rows
}
userList(query).then(res =>{
this.userList = res.data.data this.userList = res.data.data
//遍历this.userList //遍历this.userList
this.userList.forEach(item => { 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) if (item.memBirthday != null && item.memBirthday != ''){
item.memAge = calculateAge(birthdayItem.year,birthdayItem.month,birthdayItem.day) 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 => { }).catch(e => {
console.log(e) console.log(e)
}) })
}, },
//返回按钮
backbar() { backbar() {
uni.navigateBack({ uni.navigateBack({
delta: 1, //返回层数,2则上上页 delta: 1, //返回层数,2则上上页
...@@ -121,9 +171,29 @@ export default { ...@@ -121,9 +171,29 @@ export default {
</script> </script>
<style lang="scss" scoped> <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 { .recommendation {
background-color: #F4F5F9; background-color: #F4F5F9;
position: relative; position: absolute;
padding: 0 34rpx; padding: 0 34rpx;
.nodatacard{ .nodatacard{
height: 100vh; height: 100vh;
......
<template> <template>
<view class="" @touchmove.stop.prevent="() => {}"> <view class="form">
<view class="" style="height: 56rpx;"></view> <view>
<view class="" v-if="falg"> <u--form
<view class="boot"> labelPosition="left"
<view class="xuan"> :model="queryParams"
<view class="div" v-for="(item, index) in list" :key="index" @click="clicks(index)"> labelWidth="90"
<view class="name">{{ item.regionName2 }}</view> ref="uForm"
<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> <u-form-item
<image :src="baseUrl+'/common/select.png'" v-if="index == 0" class="img" mode="aspectFill"></image> label="性别"
</view> prop="memSexText"
borderBottom
<view class="div" @click="add"><view class="name" style="margin-left: 0rpx;">添加</view></view> @click="showSex = true; hideKeyboard()"
</view> >
</view> <u--input
<view class="tabs"> v-model="queryParams.memSexText"
<view class="ewrew"> disabled
年龄: disabledColor="#ffffff"
<view>{{ minValue }} - {{ maxValue }}</view> placeholder="请选择性别"
</view> border="none"
></u--input>
<s-region-slider <u-icon
:minValue="minValue" slot="right"
:maxValue="maxValue" name="arrow-right"
:fillMinValue="16" ></u-icon>
:fillValue="60" </u-form-item>
:step="1" <u-form-item
@up="up" label="身高"
@down="down" prop="memHeight"
@move="move" borderBottom
:parentCode="parentCode" @click="showHeight = true; hideKeyboard()"
:regionCode="regionCode" >
:regionName="regionName" <u--input
/> v-model="queryParams.memHeight"
</view> disabled
</view> disabledColor="#ffffff"
<view class="adding" @click="addcity">确定</view> placeholder="请选择身高"
<level-linkage ref="levelLinkage" :pickerValueDefault="pickerValueDefault" :allData="treeData" @take="take" themeColor="#007AFF"></level-linkage> border="none"
<ELM ref="elm" :msg="tipMsg" :isConfirm="isConfirm" @confirm="confirm"></ELM> ></u--input>
</view> <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> </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 { <script>
width: 686rpx; import UFormItem from "../../uni_modules/uview-ui/components/u-form-item/u-form-item";
border-bottom: 2rpx solid #ececec; import {getOptions} from "../../common/options";
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;
}
}
.tabs { export default {
// position: fixed; components: {UFormItem },
width: 686rpx; data() {
margin: 0 auto; return {
height: 300px; 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 { <style lang="scss" scoped>
margin: 10px 0; .form{
background-color: #f0ad4e; padding-top: 20rpx;
width: 200px; padding-left: 20rpx;
padding-right: 20rpx;
} }
</style> </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