screen.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <template>
  2. <view>
  3. <!-- 列表 -->
  4. <view class="list flex justify-between">
  5. <!-- 左侧分类 -->
  6. <view class="list-l">
  7. <scroll-view scroll-y="true" style="width: 100%;height: 100%;padding-bottom: 20rpx;">
  8. <block v-if="type">
  9. <view class="list-l-item flex align-center " v-if="index!=3" @click="change_click_index(index)"
  10. :class="current==index?'active':''" v-for="(item,index) in list" :key="index">
  11. {{item.name}}
  12. </view>
  13. </block>
  14. <block v-else>
  15. <view class="list-l-item flex align-center " @click="change_click_index(index)"
  16. :class="current==index?'active':''" v-for="(item,index) in list" :key="index">
  17. {{item.name}}
  18. </view>
  19. </block>
  20. </scroll-view>
  21. </view>
  22. <!-- 右侧列表 -->
  23. <view class="list-r">
  24. <scroll-view scroll-y="true" @scroll="e=>{scrolls(e)}" scroll-with-animation="true"
  25. :scroll-into-view="'bottomView'+current" style="width: 100%;height: 100%;padding-bottom: 20rpx;">
  26. <block v-if="type">
  27. <view class="list-r-item" :id="'bottomView'+index" v-if="list.length>0 && index!=3"
  28. v-for="(item,index) in list" :key="index">
  29. <view class="list-r-item-title">
  30. {{item.name}}
  31. </view>
  32. <view class="list-r-item-childs flex justify-around align-center flex-wrap">
  33. <view class="list-r-item-childs-i flex justify-center align-center"
  34. v-for="(ite,ind) in item.list" :class="ite.select==true?'activeRight':''"
  35. @click="selectHyList(index,item.name,ite,ind)" :key="ind">
  36. {{ite.value}}
  37. </view>
  38. <view class="list-r-item-childs-i flex justify-center align-center"
  39. style="height: 0;padding: 0;">
  40. </view>
  41. </view>
  42. </view>
  43. </block>
  44. <block v-else>
  45. <view class="list-r-item" :id="'bottomView'+index" v-if="list.length>0"
  46. v-for="(item,index) in list" :key="index">
  47. <view class="list-r-item-title">
  48. {{item.name}}
  49. </view>
  50. <view class="list-r-item-childs flex justify-around align-center flex-wrap">
  51. <view class="list-r-item-childs-i flex justify-center align-center"
  52. v-for="(ite,ind) in item.list" :class="ite.select==true?'activeRight':''"
  53. @click="selectHyList(index,item.name,ite,ind)" :key="ind">
  54. {{ite.value}}
  55. </view>
  56. <view class="list-r-item-childs-i flex justify-center align-center"
  57. style="height: 0;padding: 0;">
  58. </view>
  59. </view>
  60. </view>
  61. </block>
  62. <empty v-if="list.length==0" />
  63. </scroll-view>
  64. </view>
  65. </view>
  66. <!-- 底部按钮 -->
  67. <view class="bottom flex justify-center">
  68. <view class="bottom-box flex justify-between">
  69. <view @click="cleanSe()" class="bottom-box-left flex justify-center align-center">
  70. 清除
  71. </view>
  72. <view @click="submitSe()" class="bottom-box-right flex justify-center align-center">
  73. 确定
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. import empty from '../../components/empty.vue'
  81. export default {
  82. components: {
  83. empty
  84. },
  85. data() {
  86. return {
  87. current: 0,
  88. currents: 0,
  89. list: [],
  90. top_list: [],
  91. selectArr: [],
  92. type: '',
  93. isBrowse: false, //是否是从用户浏览记录里过来的
  94. isCompyBrowse: false, //是否是从企业浏览记录过来的
  95. isCompyHistory: false, //是否是从企业的投递记录过来的
  96. };
  97. },
  98. onLoad(option) {
  99. if (option.type) {
  100. this.type = option.type
  101. }
  102. if (option.isBrowse) {
  103. this.isBrowse = true
  104. } else {
  105. this.isBrowse = false
  106. }
  107. if (option.isCompyBrowse) {
  108. this.isCompyBrowse = true
  109. } else {
  110. this.isCompyBrowse = false
  111. }
  112. if (option.isCompyHistory) {
  113. this.isCompyHistory = true
  114. } else {
  115. this.isCompyHistory = false
  116. }
  117. this.getSchools()
  118. },
  119. methods: {
  120. /**
  121. * 清空筛选条件并清空缓存
  122. */
  123. cleanSe() {
  124. this.list.map(item => {
  125. item.list.map(ite => {
  126. ite.select = false
  127. })
  128. })
  129. if (this.isBrowse) {
  130. uni.removeStorageSync('browse')
  131. } else if (this.isCompyBrowse) {
  132. uni.removeStorageSync('isCompyBrowse')
  133. } else if (this.isCompyHistory) {
  134. uni.removeStorageSync('isCompyHistory')
  135. } else {
  136. uni.removeStorageSync('filter')
  137. }
  138. },
  139. /**
  140. * 处理选中的条件
  141. */
  142. submitSe() {
  143. let arr = JSON.parse(JSON.stringify(this.list))
  144. arr = arr && arr.map(item => {
  145. item.list = item.list && item.list.filter(val => {
  146. if (val.select) return val
  147. })
  148. if (item.list.length > 0) {
  149. return item
  150. }
  151. })
  152. arr = arr.filter(val => {
  153. if (val) return val
  154. })
  155. if (this.isBrowse) {
  156. //把选中的条件存到本地然后返回首页进行筛选
  157. uni.setStorageSync('browse', arr)
  158. } else if (this.isCompyBrowse) {
  159. uni.setStorageSync('isCompyBrowse', arr)
  160. } else if (this.isCompyHistory) {
  161. uni.setStorageSync('isCompyHistory', arr)
  162. } else {
  163. uni.setStorageSync('filter', arr) //把选中的条件存到本地然后返回首页进行筛选
  164. }
  165. uni.navigateBack()
  166. },
  167. /**
  168. * @param {Object} index 外层下标
  169. * @param {Object} name 外层名称
  170. * @param {Object} info 内层对象
  171. * @param {Object} ind 内层下标
  172. * 选择右侧的筛选
  173. * 薪资单选,其余可以多选
  174. */
  175. selectHyList(index, name, info, ind) {
  176. //选中
  177. if (name == '薪资') { // 薪资单选
  178. this.list[1].list.map((item, index) => {
  179. item.select = false
  180. info.select = true
  181. })
  182. } else { //其余多选
  183. if (info.value == '不限') {
  184. this.list[index].list.map((item, index) => {
  185. item.select = false
  186. info.select = true
  187. })
  188. } else {
  189. this.list[index].list.map((item, ind) => {
  190. if (item.value == '不限') {
  191. item.select = false
  192. }
  193. })
  194. info.select = !info.select;
  195. }
  196. }
  197. this.$forceUpdate()
  198. },
  199. /**
  200. * @param {Object} index
  201. * 点击切换分类
  202. */
  203. change_click_index(index) {
  204. this.current = index;
  205. //解决最后一个 ***来回*** 问题 (由于点击左侧导航,右侧锚点位置信息变化,此时滚动事件也随之滚动。)
  206. uni.setStorageSync("resolve", "last");
  207. setTimeout(() => {
  208. uni.removeStorageSync("resolve")
  209. }, 400);
  210. },
  211. scrolls(e) {
  212. if (!uni.getStorageSync("resolve")) {
  213. // this.get_node_details(e);
  214. };
  215. },
  216. /**
  217. * @param {Object} options
  218. * 获取节点信息
  219. */
  220. get_node_details(options) {
  221. const query = uni.createSelectorQuery().in(this); //获得实例
  222. //获取多个节点方式
  223. query.selectAll(".list-r-item").boundingClientRect(data => {
  224. this.top_list = data.map(item => {
  225. return Math.ceil(item.top);
  226. });
  227. this.async_detail_msg(options);
  228. }).exec();
  229. },
  230. /**
  231. * @param {Object} options
  232. * 设置滚动的位置
  233. */
  234. async_detail_msg(options) {
  235. //options 为滚动信息。 options.detail.scrollTop 值为相对于scroll-view。
  236. let top_page = options.detail.scrollTop + this.top_list[0];
  237. for (let i = 0; i < this.top_list.length; i++) {
  238. let node1 = this.top_list[i];
  239. let node2 = this.top_list[i + 1];
  240. if (node2 && top_page >= node1 && top_page < node2) {
  241. this.current = i;
  242. break;
  243. } else if (node2 && top_page === node2) {
  244. this.current = i + 1;
  245. break;
  246. }
  247. }
  248. },
  249. /**
  250. * 获取学历列表
  251. */
  252. getSchools() {
  253. this.$Request.get("/app/dict/list", {
  254. type: '学历'
  255. }).then(res => {
  256. if (res.code == 0) {
  257. let list = [{
  258. value: '不限'
  259. }]
  260. let obj = {
  261. name: '学历',
  262. list: [...list, ...res.data]
  263. }
  264. console.log(obj, '学历')
  265. this.getMoney(obj)
  266. }
  267. })
  268. },
  269. /**
  270. * 获取薪资 列表
  271. */
  272. getMoney(obj1) {
  273. this.$Request.get("/app/dict/list", {
  274. type: '薪资 '
  275. }).then(res => {
  276. if (res.code == 0) {
  277. let list = [{
  278. value: '不限'
  279. }]
  280. let obj = {
  281. name: '薪资',
  282. list: [...list, ...res.data]
  283. }
  284. this.getJy(obj1, obj)
  285. }
  286. })
  287. },
  288. /**
  289. * 获取工作经验列表
  290. */
  291. getJy(obj1, obj2) {
  292. this.$Request.get("/app/dict/list", {
  293. type: '工作经验 '
  294. }).then(res => {
  295. if (res.code == 0) {
  296. let list = [{
  297. value: '不限'
  298. }]
  299. let obj = {
  300. name: '经验',
  301. list: [...list, ...res.data]
  302. }
  303. this.getGm(obj1, obj2, obj)
  304. }
  305. })
  306. },
  307. /**
  308. * 获取公司规模列表
  309. */
  310. getGm(obj1, obj2, obj3) {
  311. this.$Request.get("/app/dict/list", {
  312. type: '公司规模 '
  313. }).then(res => {
  314. if (res.code == 0) {
  315. let list = [{
  316. value: '不限'
  317. }]
  318. let obj = {
  319. name: '公司规模',
  320. list: [...list, ...res.data]
  321. }
  322. this.getIndustryList(obj1, obj2, obj3, obj)
  323. }
  324. })
  325. },
  326. /**
  327. * 获取行业列表
  328. */
  329. getIndustryList(obj1, obj2, obj3, obj4) {
  330. this.$Request.get("/app/industry/getIndustryList").then(res => {
  331. if (res.code == 0) {
  332. let list = [{
  333. value: '不限'
  334. }]
  335. let arrAy = []
  336. res.data.map(item => {
  337. arrAy = [...arrAy, ...item.childrenList]
  338. })
  339. let arrs = JSON.parse(JSON.stringify(arrAy).replace(/industryName/g, "value"))
  340. let obj = {
  341. name: '行业',
  342. list: [...list, ...arrs]
  343. }
  344. let arr = []
  345. arr[0] = obj1
  346. arr[1] = obj2
  347. arr[2] = obj3
  348. arr[3] = obj4
  349. arr[4] = obj
  350. arr.map(item => {
  351. item.list.map(ite => {
  352. ite.select = false
  353. })
  354. })
  355. this.list = arr
  356. if (uni.getStorageSync('filter')) {
  357. let filter = uni.getStorageSync('filter')
  358. let arrs = []
  359. filter.map(item => {
  360. item.list.map(ite => {
  361. arrs.push(ite.value)
  362. })
  363. })
  364. console.log(this.list, 'list')
  365. console.log(arrs, 'list')
  366. this.list.map((item, index) => {
  367. item.list.map((ite, ind) => {
  368. arrs.map((it, ins) => {
  369. if (ite.value == it) {
  370. ite.select = true
  371. }
  372. })
  373. })
  374. })
  375. }
  376. if (uni.getStorageSync('browse')) {
  377. let browse = uni.getStorageSync('browse')
  378. let arrs = []
  379. browse.map(item => {
  380. item.list.map(ite => {
  381. arrs.push(ite.value)
  382. })
  383. })
  384. this.list.map((item, index) => {
  385. item.list.map((ite, ind) => {
  386. arrs.map((it, ins) => {
  387. if (ite.value == it) {
  388. ite.select = true
  389. }
  390. })
  391. })
  392. })
  393. }
  394. if (uni.getStorageSync('isCompyBrowse')) {
  395. let isCompyBrowse = uni.getStorageSync('isCompyBrowse')
  396. let arrs = []
  397. isCompyBrowse.map(item => {
  398. item.list.map(ite => {
  399. arrs.push(ite.value)
  400. })
  401. })
  402. this.list.map((item, index) => {
  403. item.list.map((ite, ind) => {
  404. arrs.map((it, ins) => {
  405. if (ite.value == it) {
  406. ite.select = true
  407. }
  408. })
  409. })
  410. })
  411. }
  412. if (uni.getStorageSync('isCompyHistory')) {
  413. let isCompyHistory = uni.getStorageSync('isCompyHistory')
  414. let arrs = []
  415. isCompyHistory.map(item => {
  416. item.list.map(ite => {
  417. arrs.push(ite.value)
  418. })
  419. })
  420. this.list.map((item, index) => {
  421. item.list.map((ite, ind) => {
  422. arrs.map((it, ins) => {
  423. if (ite.value == it) {
  424. ite.select = true
  425. }
  426. })
  427. })
  428. })
  429. }
  430. }
  431. })
  432. },
  433. }
  434. }
  435. </script>
  436. <style lang="scss">
  437. page {
  438. background-color: #ffffff;
  439. }
  440. .activeRight {
  441. color: #00B88F !important;
  442. background-color: #DDFFF7 !important;
  443. }
  444. .active {
  445. border-left: 8rpx solid #00B88F !important;
  446. color: #00B88F !important;
  447. }
  448. .list {
  449. width: 100%;
  450. /* #ifdef H5 */
  451. height: calc(100vh - 200rpx);
  452. /* #endif */
  453. /* #ifndef H5 */
  454. height: calc(100vh - 120rpx);
  455. /* #endif */
  456. .list-l {
  457. width: 30%;
  458. height: 100%;
  459. .list-l-item {
  460. margin-top: 40rpx;
  461. font-size: 28rpx;
  462. color: #121212;
  463. padding-left: 20rpx;
  464. border-left: 8rpx solid #ffffff;
  465. }
  466. }
  467. .list-r {
  468. width: 70%;
  469. height: 100%;
  470. border-left: 1rpx solid #F2F2F7;
  471. box-sizing: border-box;
  472. .list-r-item {
  473. width: 100%;
  474. margin-top: 40rpx;
  475. .list-r-item-title {
  476. width: 100%;
  477. color: #121212;
  478. font-size: 32rpx;
  479. font-weight: bold;
  480. padding-left: 30rpx;
  481. }
  482. .list-r-item-childs {
  483. width: 100%;
  484. .list-r-item-childs-i {
  485. width: 200rpx;
  486. margin-top: 20rpx;
  487. padding-top: 16rpx;
  488. padding-bottom: 16rpx;
  489. padding-left: 16rpx;
  490. padding-right: 16rpx;
  491. font-size: 26rpx;
  492. color: #121212;
  493. background-color: #F2F2F7;
  494. }
  495. }
  496. }
  497. }
  498. }
  499. .bottom {
  500. width: 100%;
  501. height: 120rpx;
  502. position: fixed;
  503. bottom: 0;
  504. border-top: 1rpx solid #F2F2F7;
  505. background-color: #ffffff;
  506. .bottom-box {
  507. width: 686rpx;
  508. height: 70rpx;
  509. margin-top: 20rpx;
  510. .bottom-box-left {
  511. width: 32%;
  512. height: 100%;
  513. border-radius: 8rpx;
  514. background-color: #F2F2F7;
  515. }
  516. .bottom-box-right {
  517. width: 65%;
  518. height: 100%;
  519. border-radius: 8rpx;
  520. background-color: #00B88F;
  521. color: #ffffff;
  522. }
  523. }
  524. }
  525. </style>