screen-item.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <view class="screen-item flex-common-css sys-background-black">
  3. <Nav :bgckgroundBox="'#141414'" :title="'筛选'"></Nav>
  4. <scroll-view :scroll-y="true" class="list-scroll" @scroll="scroll" @scrolltolower="scrolltolower">
  5. <view class="screen-box">
  6. <view class="age-name sys-size-32 sys-color-white">
  7. 距离 {{fromData.distance}}
  8. </view>
  9. <slider :value="fromData.distance" @changing="sliderChange" min="0" max="500" activeColor="#727272"
  10. backgroundColor="#727272" block-size="6" block-color="#FFC107" />
  11. <view class="num-section sys-size-28 sys-color-5B ">
  12. <view class="">
  13. okm
  14. </view>
  15. <view class="">
  16. </view>
  17. </view>
  18. <view class="age-name sys-size-32 sys-color-white">
  19. 年龄 {{`${fromData.age[0]} - ${fromData.age[1]}`}}
  20. </view>
  21. <cjSliderTwo v-model="fromData.age" :min="18" :max="35" :step="1" :blockWidth="18" @moving="blockMoving"
  22. activeColor="#727272" inactiveColor="#727272" blockColor="#FFC107" />
  23. <view class="num-section sys-size-28 sys-color-5B">
  24. <view class="">
  25. 18
  26. </view>
  27. <view class="">
  28. 35+
  29. </view>
  30. </view>
  31. <view class="sex">
  32. <view v-for="(item,index) in sex" :key="index" class="sex-list sys-size-28 sys-radius-12"
  33. @click="selsectSex(item.id)"
  34. :class="sexId == item.id?'sys-background-FFC107 sys-color-black':'sys-color-gray-646464 sys-background-222'">
  35. {{item.name}}
  36. </view>
  37. </view>
  38. <view class="view-user" @click="setPicker(1)">
  39. <view class="view-user-left sys-color-white sys-size-32">
  40. 优先查看用户
  41. </view>
  42. <view class="view-user-right">
  43. <view class="view-user-right-name sys-color-5B sys-size-28">
  44. {{purposeName?purposeName:'未设置'}}
  45. </view>
  46. <uni-icons type="forward" size="20" color="#5B5B5B"></uni-icons>
  47. </view>
  48. </view>
  49. <view class="view-user" @click="setPicker(2)">
  50. <view class="view-user-left sys-color-white sys-size-32">
  51. 速配星座
  52. </view>
  53. <view class="view-user-right">
  54. <view class="view-user-right-name sys-color-5B sys-size-28">
  55. {{constellationName?constellationName:'未设置'}}
  56. </view>
  57. <uni-icons type="forward" size="20" color="#5B5B5B"></uni-icons>
  58. </view>
  59. </view>
  60. <view class="view-user" @click="setPicker(3)">
  61. <view class="view-user-left sys-color-white sys-size-32">
  62. 兴趣爱好
  63. </view>
  64. <view class="view-user-right">
  65. <view class="view-user-right-name sys-color-5B sys-size-28">
  66. {{hobbyName?hobbyName:'未设置'}}
  67. </view>
  68. <uni-icons type="forward" size="20" color="#5B5B5B"></uni-icons>
  69. </view>
  70. </view>
  71. <view class="placeholder-box" v-if="false"></view>
  72. <view class="aim-box" v-if="false">
  73. <view class="aim-title">
  74. <view class="title-box sys-radius-200 sys-background-FFC107"></view>
  75. <view class="title-name sys-size-32 sys-color-white">
  76. 交友目的
  77. </view>
  78. </view>
  79. <view class="aim-text sys-color-5B sys-size-24">
  80. 人数不足时,将自动扬大范围
  81. </view>
  82. <view class="aim-list">
  83. <view class="list-box" v-for="(item,index) in 10">
  84. <image class="list-box-img sys-radius-40" src="../../../static/img/circle/1.png" mode="">
  85. </image>
  86. <view class="list-box-name sys-color-5B sys-size-26">
  87. 认识的朋友
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="sys-selected-but sys-background-FFC107 sys-color-black" @click="setFilter">保存</view>
  93. </view>
  94. </scroll-view>
  95. <uni-data-picker :popup-title="'选择'+label" :localdata="localData" ref="pickerObj" v-show="showPicker"
  96. @change="pickerChange" :border="false" :clear-icon="false" @popupclosed="setPopupClosed">
  97. </uni-data-picker>
  98. </view>
  99. </template>
  100. <script>
  101. import cjSliderTwo from '@/components/jxs-slider/jxs-slider.vue'
  102. import {
  103. getFilter, setFilter
  104. } from "@/api/discovery";
  105. import {getScreenDict} from "@/api/utility";
  106. import tools from "@/service/tools";
  107. export default {
  108. components: {
  109. cjSliderTwo
  110. },
  111. data() {
  112. return {
  113. fromData:{
  114. distance: 50,
  115. id: '',
  116. userId: '',
  117. ageMax: '',
  118. ageMin: '',
  119. gender: '',
  120. prefer: '',
  121. constellation: '',
  122. interest: '',
  123. age: [18, 30],
  124. },
  125. sex: [{
  126. 'name': '男生',
  127. 'id': 0
  128. }, {
  129. 'name': '女生',
  130. 'id': 1
  131. }, {
  132. 'name': '不限',
  133. 'id': 2
  134. }],
  135. sexId: 0,
  136. label: 0,
  137. localData: [],
  138. showPicker: false,
  139. pickerType: 1,
  140. purposeArr: [],
  141. purposeName:'',
  142. constellationArr: [],
  143. constellationName:'',
  144. hobbyArr: [],
  145. hobbyName:'',
  146. };
  147. },
  148. mounted() {
  149. this.getFilter()
  150. this.getScreenDict()
  151. },
  152. methods: {
  153. setPopupClosed(){
  154. this.$refs.pickerObj.clear();
  155. this.showPicker = false;
  156. },
  157. setFilter(){
  158. this.fromData.ageMin=this.fromData.age[0]+''
  159. this.fromData.ageMax=this.fromData.age[1]+''
  160. setFilter(this.fromData).then((res)=>{
  161. if(res.code===0){
  162. tools.success('保存成功')
  163. setTimeout(()=>{
  164. tools.leftClick()
  165. },1000)
  166. }else {
  167. tools.error(res.msg)
  168. }
  169. })
  170. },
  171. setPicker(pickerType){
  172. this.pickerType=pickerType
  173. if(pickerType===1){
  174. this.label='用户类型'
  175. this.localData =this.purposeArr
  176. }else if(pickerType===2){
  177. this.label='速配星座'
  178. this.localData =this.constellationArr
  179. }else {
  180. this.label='兴趣爱好'
  181. this.localData =this.hobbyArr
  182. }
  183. this.$refs.pickerObj.show();
  184. this.showPicker = true;
  185. },
  186. pickerChange(data) {
  187. if(data.detail.value.length>0){
  188. if(this.pickerType===1){
  189. this.purposeName =data.detail.value[0].text;
  190. this.fromData.prefer =data.detail.value[0].value;
  191. }else if(this.pickerType===2){
  192. this.constellationName =data.detail.value[0].text;
  193. this.fromData.constellation =data.detail.value[0].value;
  194. }else {
  195. this.hobbyName =data.detail.value[0].text;
  196. this.fromData.interest =data.detail.value[0].value;
  197. }
  198. }
  199. this.$refs.pickerObj.clear();
  200. this.showPicker = false;
  201. },
  202. getScreenDict(){
  203. getFilter('app_user_filter_hobby,app_user_filter_constellation,app_user_filter_purpose').then((res)=>{
  204. console.log(res)
  205. if(res.code===0){
  206. if(res.data.app_user_filter_purpose){
  207. res.data.app_user_filter_purpose.forEach((item)=>{
  208. this.purposeArr.push({'text':item.label,'value':item.value})
  209. })
  210. }
  211. if(res.data.app_user_filter_constellation){
  212. res.data.app_user_filter_constellation.forEach((item)=>{
  213. this.constellationArr.push({'text':item.label,'value':item.value})
  214. })
  215. }
  216. if(res.data.app_user_filter_hobby){
  217. res.data.app_user_filter_hobby.forEach((item)=>{
  218. this.hobbyArr.push({'text':item.label,'value':item.value})
  219. })
  220. }
  221. }else {
  222. tools.leftClick()
  223. }
  224. })
  225. },
  226. getFilter() {
  227. getFilter().then((res) => {
  228. if(res.code===0){
  229. this.fromData.distance=res.data.distance
  230. this.fromData.id=res.data.id
  231. this.fromData.userId=res.data.userId
  232. this.fromData.ageMax=res.data.ageMax
  233. this.fromData.ageMin=res.data.ageMin
  234. this.fromData.gender=res.data.gender
  235. this.fromData.prefer=res.data.prefer
  236. this.fromData.constellation=res.data.constellation
  237. this.fromData.interest=res.data.interest
  238. this.fromData.age=[res.data.ageMin*1,res.data.ageMax*1]
  239. }else {
  240. tools.leftClick()
  241. }
  242. })
  243. },
  244. scroll() {},
  245. scrolltolower() {},
  246. blockMoving(e) {
  247. console.log('正在滑动中', e)
  248. },
  249. sliderChange(e) {
  250. this.fromData.distance = e.detail.value
  251. },
  252. selsectSex(id) {
  253. //点击没反应
  254. this.sexId = id
  255. console.log(id);
  256. },
  257. },
  258. }
  259. </script>
  260. <style lang="scss" scoped>
  261. ::v-deep uni-slider {
  262. margin: 0;
  263. }
  264. .screen-item {
  265. width: 100%;
  266. flex: 1;
  267. .sys-selected-but{
  268. margin-top: 100rpx;
  269. }
  270. .list-scroll {
  271. width: 100%;
  272. flex: 1;
  273. overflow: auto;
  274. padding: 24rpx 32rpx 0 32rpx;
  275. box-sizing: border-box;
  276. display: flex;
  277. flex-direction: column;
  278. .screen-box {
  279. .age-name {
  280. margin: 0 0 20rpx 0;
  281. }
  282. .num-section {
  283. padding: 8rpx 0 0 0;
  284. width: 100%;
  285. display: flex;
  286. align-items: center;
  287. justify-content: space-between;
  288. margin: 0 0 40rpx 0;
  289. }
  290. .sex {
  291. display: flex;
  292. align-items: center;
  293. justify-content: space-between;
  294. margin: 0 0 40rpx 0;
  295. .sex-list {
  296. width: 212rpx;
  297. padding: 10rpx 0;
  298. display: flex;
  299. align-items: center;
  300. justify-content: center;
  301. }
  302. }
  303. .view-user {
  304. width: 100%;
  305. display: flex;
  306. align-items: center;
  307. justify-content: space-between;
  308. margin: 0 0 40rpx 0;
  309. .view-user-left {}
  310. .view-user-right {
  311. display: flex;
  312. align-items: center;
  313. .view-user-right-mame {
  314. margin: 0 4rpx 0 0;
  315. }
  316. }
  317. }
  318. .placeholder-box {
  319. width: 100%;
  320. height: 1rpx;
  321. border-bottom: 2rpx dashed #383838;
  322. margin: 0 0 40rpx 0;
  323. }
  324. .aim-box {
  325. width: 100%;
  326. display: flex;
  327. flex-direction: column;
  328. .aim-title {
  329. display: flex;
  330. align-items: center;
  331. margin: 0 0 4rpx 0;
  332. .title-box {
  333. width: 4rpx;
  334. height: 32rpx;
  335. margin: 0 8rpx 0 0;
  336. }
  337. }
  338. .aim-list {
  339. display: flex;
  340. align-items: center;
  341. flex-wrap: wrap;
  342. .list-box {
  343. width: 25%;
  344. display: flex;
  345. flex-direction: column;
  346. align-items: center;
  347. // margin: 0 60rpx 0 0;
  348. padding: 32rpx 0 0 0;
  349. .list-box-img {
  350. width: 120rpx;
  351. height: 120rpx;
  352. margin: 0 0 16rpx 0;
  353. flex-shrink: 0;
  354. }
  355. .list-box-name {
  356. white-space: nowrap;
  357. }
  358. }
  359. .list-box:last-child {
  360. margin: 0;
  361. }
  362. }
  363. }
  364. }
  365. }
  366. }
  367. </style>