screen-item.vue 10 KB

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