123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- <template>
- <view class="screen-item flex-common-css sys-background-black">
- <Nav :bgckgroundBox="'#141414'" :title="'筛选'"></Nav>
- <scroll-view :scroll-y="true" class="list-scroll" @scroll="scroll" @scrolltolower="scrolltolower">
- <view class="screen-box">
- <view class="age-name sys-size-32 sys-color-white">
- 距离 {{fromData.distance}}
- </view>
- <slider :value="fromData.distance" @changing="sliderChange" min="0" max="500" activeColor="#727272"
- backgroundColor="#727272" block-size="6" block-color="#FFC107" />
- <view class="num-section sys-size-28 sys-color-5B ">
- <view class="">
- okm
- </view>
- <view class="">
- ∞
- </view>
- </view>
- <view class="age-name sys-size-32 sys-color-white">
- 年龄 {{`${fromData.age[0]} - ${fromData.age[1]}`}}
- </view>
- <cjSliderTwo v-model="fromData.age" :min="18" :max="35" :step="1" :blockWidth="18" @moving="blockMoving"
- activeColor="#727272" inactiveColor="#727272" blockColor="#FFC107" />
- <view class="num-section sys-size-28 sys-color-5B">
- <view class="">
- 18
- </view>
- <view class="">
- 35+
- </view>
- </view>
- <view class="sex">
- <view v-for="(item,index) in sex" :key="index" class="sex-list sys-size-28 sys-radius-12"
- @click="selsectSex(item.id)"
- :class="sexId == item.id?'sys-background-FFC107 sys-color-black':'sys-color-gray-646464 sys-background-222'">
- {{item.name}}
- </view>
- </view>
- <view class="view-user" @click="setPicker(1)">
- <view class="view-user-left sys-color-white sys-size-32">
- 优先查看用户
- </view>
- <view class="view-user-right">
- <view class="view-user-right-name sys-color-5B sys-size-28">
- {{purposeName?purposeName:'未设置'}}
- </view>
- <uni-icons type="forward" size="20" color="#5B5B5B"></uni-icons>
- </view>
- </view>
- <view class="view-user" @click="setPicker(2)">
- <view class="view-user-left sys-color-white sys-size-32">
- 速配星座
- </view>
- <view class="view-user-right">
- <view class="view-user-right-name sys-color-5B sys-size-28">
- {{constellationName?constellationName:'未设置'}}
- </view>
- <uni-icons type="forward" size="20" color="#5B5B5B"></uni-icons>
- </view>
- </view>
- <view class="view-user" @click="setPicker(3)">
- <view class="view-user-left sys-color-white sys-size-32">
- 兴趣爱好
- </view>
- <view class="view-user-right">
- <view class="view-user-right-name sys-color-5B sys-size-28">
- {{hobbyName?hobbyName:'未设置'}}
- </view>
- <uni-icons type="forward" size="20" color="#5B5B5B"></uni-icons>
- </view>
- </view>
- <view class="placeholder-box" v-if="false"></view>
- <view class="aim-box" v-if="false">
- <view class="aim-title">
- <view class="title-box sys-radius-200 sys-background-FFC107"></view>
- <view class="title-name sys-size-32 sys-color-white">
- 交友目的
- </view>
- </view>
- <view class="aim-text sys-color-5B sys-size-24">
- 人数不足时,将自动扬大范围
- </view>
- <view class="aim-list">
- <view class="list-box" v-for="(item,index) in 10">
- <image class="list-box-img sys-radius-40" src="../../../static/img/circle/1.png" mode="">
- </image>
- <view class="list-box-name sys-color-5B sys-size-26">
- 认识的朋友
- </view>
- </view>
- </view>
- </view>
- <view class="sys-selected-but sys-background-FFC107 sys-color-black" @click="setFilter">保存</view>
- </view>
- </scroll-view>
- <uni-data-picker :popup-title="'选择'+label" :localdata="localData" ref="pickerObj" v-show="showPicker"
- @change="pickerChange" :border="false" :clear-icon="false" @popupclosed="setPopupClosed">
- </uni-data-picker>
- </view>
- </template>
- <script>
- import cjSliderTwo from '@/components/jxs-slider/jxs-slider.vue'
- import {
- getFilter, setFilter
- } from "@/api/discovery";
- import {getScreenDict} from "@/api/utility";
- import tools from "@/service/tools";
- export default {
- components: {
- cjSliderTwo
- },
- data() {
- return {
- fromData:{
- distance: 50,
- id: '',
- userId: '',
- ageMax: '',
- ageMin: '',
- gender: '',
- prefer: '',
- constellation: '',
- interest: '',
- age: [18, 30],
- },
- sex: [{
- 'name': '男生',
- 'id': 0
- }, {
- 'name': '女生',
- 'id': 1
- }, {
- 'name': '不限',
- 'id': 2
- }],
- sexId: 0,
- label: 0,
- localData: [],
- showPicker: false,
- pickerType: 1,
- purposeArr: [],
- purposeName:'',
- constellationArr: [],
- constellationName:'',
- hobbyArr: [],
- hobbyName:'',
- };
- },
- mounted() {
- this.getFilter()
- this.getScreenDict()
- },
- methods: {
- setFilter(){
- this.fromData.ageMin=this.fromData.age[0]+''
- this.fromData.ageMax=this.fromData.age[1]+''
- setFilter(this.fromData).then((res)=>{
- if(res.code===0){
- tools.success('保存成功')
- setTimeout(()=>{
- tools.leftClick()
- },1000)
- }else {
- tools.error(res.msg)
- }
- })
- },
- setPicker(pickerType){
- this.pickerType=pickerType
- if(pickerType===1){
- this.localData =this.purposeArr
- }else if(pickerType===2){
- this.localData =this.constellationArr
- }else {
- this.localData =this.hobbyArr
- }
- this.$refs.pickerObj.show();
- this.showPicker = true;
- },
- pickerChange(data) {
- if(data.detail.value.length>0){
- if(this.pickerType===1){
- this.purposeName =data.detail.value[0].text;
- this.fromData.prefer =data.detail.value[0].value;
- }else if(this.pickerType===2){
- this.constellationName =data.detail.value[0].text;
- this.fromData.constellation =data.detail.value[0].value;
- }else {
- this.hobbyName =data.detail.value[0].text;
- this.fromData.interest =data.detail.value[0].value;
- }
- }
- this.$refs.pickerObj.clear();
- this.showPicker = false;
- },
- getScreenDict(){
- getScreenDict('app_user_filter_hobby,app_user_filter_constellation,app_user_filter_purpose').then((res)=>{
- console.log(res)
- if(res.code===0){
- if(res.data.app_user_filter_purpose){
- res.data.app_user_filter_purpose.forEach((item)=>{
- this.purposeArr.push({'text':item.label,'value':item.value})
- })
- }
- if(res.data.app_user_filter_constellation){
- res.data.app_user_filter_constellation.forEach((item)=>{
- this.constellationArr.push({'text':item.label,'value':item.value})
- })
- }
- if(res.data.app_user_filter_hobby){
- res.data.app_user_filter_hobby.forEach((item)=>{
- this.hobbyArr.push({'text':item.label,'value':item.value})
- })
- }
- }else {
- tools.leftClick()
- }
- })
- },
- getFilter() {
- getFilter().then((res) => {
- if(res.code===0){
- this.fromData.distance=res.data.distance
- this.fromData.id=res.data.id
- this.fromData.userId=res.data.userId
- this.fromData.ageMax=res.data.ageMax
- this.fromData.ageMin=res.data.ageMin
- this.fromData.gender=res.data.gender
- this.fromData.prefer=res.data.prefer
- this.fromData.constellation=res.data.constellation
- this.fromData.interest=res.data.interest
- this.fromData.age=[res.data.ageMin*1,res.data.ageMax*1]
- }else {
- tools.leftClick()
- }
- })
- },
- scroll() {},
- scrolltolower() {},
- blockMoving(e) {
- console.log('正在滑动中', e)
- },
- sliderChange(e) {
- this.fromData.distance = e.detail.value
- },
- selsectSex(id) {
- //点击没反应
- this.sexId = id
- console.log(id);
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep uni-slider {
- margin: 0;
- }
- .screen-item {
- width: 100%;
- flex: 1;
- .sys-selected-but{
- margin-top: 100rpx;
- }
- .list-scroll {
- width: 100%;
- flex: 1;
- overflow: auto;
- padding: 24rpx 32rpx 0 32rpx;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- .screen-box {
- .age-name {
- margin: 0 0 20rpx 0;
- }
- .num-section {
- padding: 8rpx 0 0 0;
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin: 0 0 40rpx 0;
- }
- .sex {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin: 0 0 40rpx 0;
- .sex-list {
- width: 212rpx;
- padding: 10rpx 0;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- }
- .view-user {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin: 0 0 40rpx 0;
- .view-user-left {}
- .view-user-right {
- display: flex;
- align-items: center;
- .view-user-right-mame {
- margin: 0 4rpx 0 0;
- }
- }
- }
- .placeholder-box {
- width: 100%;
- height: 1rpx;
- border-bottom: 2rpx dashed #383838;
- margin: 0 0 40rpx 0;
- }
- .aim-box {
- width: 100%;
- display: flex;
- flex-direction: column;
- .aim-title {
- display: flex;
- align-items: center;
- margin: 0 0 4rpx 0;
- .title-box {
- width: 4rpx;
- height: 32rpx;
- margin: 0 8rpx 0 0;
- }
- }
- .aim-list {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- .list-box {
- width: 25%;
- display: flex;
- flex-direction: column;
- align-items: center;
- // margin: 0 60rpx 0 0;
- padding: 32rpx 0 0 0;
- .list-box-img {
- width: 120rpx;
- height: 120rpx;
- margin: 0 0 16rpx 0;
- flex-shrink: 0;
- }
- .list-box-name {
- white-space: nowrap;
- }
- }
- .list-box:last-child {
- margin: 0;
- }
- }
- }
- }
- }
- }
- </style>
|