screen-item.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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. setFilter(){
  154. this.fromData.ageMin=this.fromData.age[0]+''
  155. this.fromData.ageMax=this.fromData.age[1]+''
  156. setFilter(this.fromData).then((res)=>{
  157. if(res.code===0){
  158. tools.success('保存成功')
  159. setTimeout(()=>{
  160. tools.leftClick()
  161. },1000)
  162. }else {
  163. tools.error(res.msg)
  164. }
  165. })
  166. },
  167. setPicker(pickerType){
  168. this.pickerType=pickerType
  169. if(pickerType===1){
  170. this.localData =this.purposeArr
  171. }else if(pickerType===2){
  172. this.localData =this.constellationArr
  173. }else {
  174. this.localData =this.hobbyArr
  175. }
  176. this.$refs.pickerObj.show();
  177. this.showPicker = true;
  178. },
  179. pickerChange(data) {
  180. if(data.detail.value.length>0){
  181. if(this.pickerType===1){
  182. this.purposeName =data.detail.value[0].text;
  183. this.fromData.prefer =data.detail.value[0].value;
  184. }else if(this.pickerType===2){
  185. this.constellationName =data.detail.value[0].text;
  186. this.fromData.constellation =data.detail.value[0].value;
  187. }else {
  188. this.hobbyName =data.detail.value[0].text;
  189. this.fromData.interest =data.detail.value[0].value;
  190. }
  191. }
  192. this.$refs.pickerObj.clear();
  193. this.showPicker = false;
  194. },
  195. getScreenDict(){
  196. getScreenDict('app_user_filter_hobby,app_user_filter_constellation,app_user_filter_purpose').then((res)=>{
  197. console.log(res)
  198. if(res.code===0){
  199. if(res.data.app_user_filter_purpose){
  200. res.data.app_user_filter_purpose.forEach((item)=>{
  201. this.purposeArr.push({'text':item.label,'value':item.value})
  202. })
  203. }
  204. if(res.data.app_user_filter_constellation){
  205. res.data.app_user_filter_constellation.forEach((item)=>{
  206. this.constellationArr.push({'text':item.label,'value':item.value})
  207. })
  208. }
  209. if(res.data.app_user_filter_hobby){
  210. res.data.app_user_filter_hobby.forEach((item)=>{
  211. this.hobbyArr.push({'text':item.label,'value':item.value})
  212. })
  213. }
  214. }else {
  215. tools.leftClick()
  216. }
  217. })
  218. },
  219. getFilter() {
  220. getFilter().then((res) => {
  221. if(res.code===0){
  222. this.fromData.distance=res.data.distance
  223. this.fromData.id=res.data.id
  224. this.fromData.userId=res.data.userId
  225. this.fromData.ageMax=res.data.ageMax
  226. this.fromData.ageMin=res.data.ageMin
  227. this.fromData.gender=res.data.gender
  228. this.fromData.prefer=res.data.prefer
  229. this.fromData.constellation=res.data.constellation
  230. this.fromData.interest=res.data.interest
  231. this.fromData.age=[res.data.ageMin*1,res.data.ageMax*1]
  232. }else {
  233. tools.leftClick()
  234. }
  235. })
  236. },
  237. scroll() {},
  238. scrolltolower() {},
  239. blockMoving(e) {
  240. console.log('正在滑动中', e)
  241. },
  242. sliderChange(e) {
  243. this.fromData.distance = e.detail.value
  244. },
  245. selsectSex(id) {
  246. //点击没反应
  247. this.sexId = id
  248. console.log(id);
  249. },
  250. },
  251. }
  252. </script>
  253. <style lang="scss" scoped>
  254. ::v-deep uni-slider {
  255. margin: 0;
  256. }
  257. .screen-item {
  258. width: 100%;
  259. flex: 1;
  260. .sys-selected-but{
  261. margin-top: 100rpx;
  262. }
  263. .list-scroll {
  264. width: 100%;
  265. flex: 1;
  266. overflow: auto;
  267. padding: 24rpx 32rpx 0 32rpx;
  268. box-sizing: border-box;
  269. display: flex;
  270. flex-direction: column;
  271. .screen-box {
  272. .age-name {
  273. margin: 0 0 20rpx 0;
  274. }
  275. .num-section {
  276. padding: 8rpx 0 0 0;
  277. width: 100%;
  278. display: flex;
  279. align-items: center;
  280. justify-content: space-between;
  281. margin: 0 0 40rpx 0;
  282. }
  283. .sex {
  284. display: flex;
  285. align-items: center;
  286. justify-content: space-between;
  287. margin: 0 0 40rpx 0;
  288. .sex-list {
  289. width: 212rpx;
  290. padding: 10rpx 0;
  291. display: flex;
  292. align-items: center;
  293. justify-content: center;
  294. }
  295. }
  296. .view-user {
  297. width: 100%;
  298. display: flex;
  299. align-items: center;
  300. justify-content: space-between;
  301. margin: 0 0 40rpx 0;
  302. .view-user-left {}
  303. .view-user-right {
  304. display: flex;
  305. align-items: center;
  306. .view-user-right-mame {
  307. margin: 0 4rpx 0 0;
  308. }
  309. }
  310. }
  311. .placeholder-box {
  312. width: 100%;
  313. height: 1rpx;
  314. border-bottom: 2rpx dashed #383838;
  315. margin: 0 0 40rpx 0;
  316. }
  317. .aim-box {
  318. width: 100%;
  319. display: flex;
  320. flex-direction: column;
  321. .aim-title {
  322. display: flex;
  323. align-items: center;
  324. margin: 0 0 4rpx 0;
  325. .title-box {
  326. width: 4rpx;
  327. height: 32rpx;
  328. margin: 0 8rpx 0 0;
  329. }
  330. }
  331. .aim-list {
  332. display: flex;
  333. align-items: center;
  334. flex-wrap: wrap;
  335. .list-box {
  336. width: 25%;
  337. display: flex;
  338. flex-direction: column;
  339. align-items: center;
  340. // margin: 0 60rpx 0 0;
  341. padding: 32rpx 0 0 0;
  342. .list-box-img {
  343. width: 120rpx;
  344. height: 120rpx;
  345. margin: 0 0 16rpx 0;
  346. flex-shrink: 0;
  347. }
  348. .list-box-name {
  349. white-space: nowrap;
  350. }
  351. }
  352. .list-box:last-child {
  353. margin: 0;
  354. }
  355. }
  356. }
  357. }
  358. }
  359. }
  360. </style>