search.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  1. <template>
  2. <view>
  3. <u-navbar back-text="搜索" back-icon-size="28" back-icon-color="#ffffff"
  4. :background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
  5. <!-- 搜索框 -->
  6. <view class="search">
  7. <view class="search-box">
  8. <view class="option">
  9. <nxsearch :selectList="selectList"
  10. :defaultSelectIndex="defaultSelectIndex"
  11. button="inside" @search="doSearch" @confirm="doSearch"
  12. @selectItem="selectItem"
  13. v-model="searchQuery.keyword" :placeholder="'输入关键字'+selectList[searchQuery.selectIndex].name" />
  14. </view>
  15. </view>
  16. </view>
  17. <!-- 搜索历史 -->
  18. <view class="search-history" v-show="step" >
  19. <view class="top">
  20. <view class="title">
  21. 搜索历史
  22. </view>
  23. <view class="clear" @click="clear()">
  24. 清空历史
  25. </view>
  26. </view>
  27. <view class="history">
  28. <view class="tag" v-for="(mod,index) in searchHistory" :key="index" v-text="mod"
  29. @click="searchQuery.keyword=mod,submit()">
  30. 打杂
  31. </view>
  32. </view>
  33. </view>
  34. <!-- 搜索结果 -->
  35. <view class="result" v-if="!step&&searchQuery.selectIndex==0" >
  36. <view class="tabs">
  37. <view class="left" style=" width: 33%;">
  38. <u-tabs bg-color="#F0F0F2" :list="tabList" :is-scroll="false" :current="current"
  39. @change="change"></u-tabs>
  40. </view>
  41. <view class="screen" @click="popupShowtrue">
  42. <view class="icon">
  43. <img src="@/assets/img/riLine-filter-line@1x.png" alt="">
  44. </view>
  45. <view>筛选</view>
  46. </view>
  47. </view>
  48. <view class="result-item result-item1" v-for="(item,i) in tabList[current].list" :key="i"
  49. @click="gotoUrl('pages/packages/choreInformation/jobSearchDetails?id='+item.id)" >
  50. <!-- 照片 -->
  51. <view class="photo">
  52. <u-avatar :src="item.photo"></u-avatar>
  53. </view>
  54. <view class="content">
  55. <!-- 职位薪水 -->
  56. <view class="top">
  57. <view class="position">
  58. {{item.intendedIndustriesN}}
  59. </view>
  60. <view class="salary">
  61. {{item.hopeSalary}}{{getUnit(item)}}
  62. </view>
  63. </view>
  64. <view class="issuer">
  65. {{item.personName}}
  66. </view>
  67. <view class="bottom">
  68. <view class="tags">
  69. <view class="tag-item">
  70. {{item.gender==1?'男':'女'}}
  71. </view>
  72. <view class="tag-item">
  73. {{item.age}}岁
  74. </view>
  75. <view class="tag-item" v-if="item.educationN" >
  76. {{item.educationN}}
  77. </view>
  78. </view>
  79. <view class="date">
  80. {{getTime(item)}}
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <u-divider bgNoneColor="#ffffff" style="background: #F0F0F2;" v-if="tabList[current].recordsTotal==tabList[current].list.length"
  86. :isnone="tabList[current].recordsTotal==0" nonetext="没有找到相关内容"
  87. border-color="#CFD2D5">已经到底了</u-divider>
  88. </view>
  89. <!-- 搜索结果 -->
  90. <view class="result" v-if="!step&&searchQuery.selectIndex==1" >
  91. <view class="tabs">
  92. <view class="left">
  93. <u-tabs bg-color="#F0F0F2" :list="tabList" :is-scroll="false" :current="current"
  94. @change="change"></u-tabs>
  95. </view>
  96. <view class="screen" @click="popupShowtrue">
  97. <view class="icon">
  98. <img src="@/assets/img/riLine-filter-line@1x.png" alt="">
  99. </view>
  100. <view>筛选</view>
  101. </view>
  102. </view>
  103. <view class="result-item" v-for="(item,i) in tabList[current].list" :key="i"
  104. @click="gotoUrl('pages/packages/jobInformation/jobDetails?id='+item.id)">
  105. <view class="content-1">
  106. <!-- 职位 -->
  107. <view class="position">
  108. {{item.positionName}}
  109. </view>
  110. <!-- 薪水 -->
  111. <view class="salary">
  112. {{item.salary}}{{getUnit(item)}}
  113. </view>
  114. </view>
  115. <view class="content-2">
  116. <!-- 标签 -->
  117. <view class="tag">
  118. <view class="tag-item">
  119. {{item.workArea}}
  120. </view>
  121. <view class="tag-item">
  122. {{item.settlementMethodN}}
  123. </view>
  124. <view class="tag-item">
  125. {{item.industryN}}
  126. </view>
  127. </view>
  128. <!-- 日期 -->
  129. <view class="date">
  130. {{getTime(item)}}
  131. </view>
  132. </view>
  133. <view class="content-3">
  134. <view class="issuer">
  135. {{item.contacts}}
  136. </view>
  137. <view class="address">
  138. {{item.address}}
  139. </view>
  140. </view>
  141. </view>
  142. <u-divider bgNoneColor="#ffffff" v-if="tabList[current].recordsTotal==tabList[current].list.length"
  143. :isnone="tabList[current].recordsTotal==0" nonetext="没有找到相关内容"
  144. border-color="#CFD2D5">已经到底了</u-divider>
  145. </view>
  146. <jkpop ref="pop" @reset="reset" @queryBtn="queryBtn" ></jkpop>
  147. </view>
  148. </template>
  149. <script>
  150. import jkpop from "@/pages/packages/as-components/jk-popup.vue"
  151. import * as API from '@/apis/pagejs/packages.js'
  152. import nxsearch from "@/components/nx-search.vue"
  153. import * as API_weixin from '@/apis/weixin.js'
  154. export default {
  155. components: {
  156. jkpop,nxsearch
  157. },
  158. data() {
  159. return {
  160. step: true, //步骤 ,true第一步查询,false第二步显示结果
  161. searchQuery: {
  162. keyword: '',
  163. selectIndex: 0
  164. },
  165. selectList: [{
  166. id: 1,
  167. name: '找零工'
  168. },
  169. {
  170. id: 0,
  171. name: '找工作'
  172. }
  173. ],
  174. recordsTotal: 0,
  175. listForm: {
  176. typeId: "",
  177. title: "",
  178. pageIndex: 1,
  179. pageSize: 4,
  180. totalPage: 1,
  181. },
  182. current: 0,
  183. list: [],
  184. searchHistory: [],
  185. tabList:[],
  186. tabList2: [{
  187. name: '最新',
  188. pageIndex: 1,
  189. pageSize: 20,
  190. statusType:"",
  191. list:[],
  192. recordsTotal:0
  193. }, {
  194. name: '日结',
  195. unit:"日",
  196. statusType:"1",
  197. pageIndex: 1,
  198. pageSize: 20,
  199. list:[],
  200. recordsTotal:0
  201. }, {
  202. name: '周结',
  203. unit:"周",
  204. pageIndex: 1,
  205. pageSize: 20,
  206. statusType:"2",
  207. list:[],
  208. recordsTotal:0
  209. }, {
  210. name: '月结',
  211. unit:"月",
  212. pageIndex: 1,
  213. pageSize: 20,
  214. statusType:"3",
  215. list:[],
  216. recordsTotal:0
  217. }],
  218. tabList1: [{
  219. name: '最新',
  220. pageIndex: 1,
  221. pageSize: 20,
  222. statusType:"1",
  223. list:[],
  224. recordsTotal:0
  225. }, {
  226. name: '最热',
  227. pageIndex: 1,
  228. pageSize: 20,
  229. statusType:"2",
  230. list:[],
  231. recordsTotal:0
  232. }],
  233. workList: [
  234. ],
  235. defaultSelectIndex:0,
  236. queryForm:{
  237. }
  238. }
  239. },
  240. onLoad(op) {
  241. if (op.type) {
  242. this.searchQuery.selectIndex = op.type
  243. this.defaultSelectIndex=op.type
  244. //this.$refs.nxsearch.selectItem(op.type)
  245. }
  246. console.log(this.searchQuery,op)
  247. var sz = this.carhelp.get("setSearchHistory");
  248. if (sz) {
  249. this.searchHistory = sz
  250. } else {
  251. this.searchHistory = []
  252. }
  253. },
  254. onReady() {
  255. },
  256. onReachBottom() {
  257. if (this.list.length < this.recordsTotal) {
  258. this.myLoadmore();
  259. }
  260. },
  261. methods: {
  262. ckInfo(id) {
  263. var url = "/pages/news/articleDetails?id=" + id;
  264. uni.navigateTo({
  265. url: url
  266. })
  267. },
  268. clear() {
  269. this.setSearchHistory([]);
  270. },
  271. setHistory() {
  272. //搜索记录保存
  273. var key = this.searchQuery.keyword;
  274. var sz = this.searchHistory;
  275. if (!sz) {
  276. sz = [];
  277. }
  278. var temp = [];
  279. //去重 ,后插入的,排队到最前面
  280. if (sz.length) {
  281. for (var i in sz) {
  282. if (i == 0) {
  283. temp.push(key);
  284. }
  285. if (sz[i] == key) {
  286. continue;
  287. }
  288. temp.push(sz[i]);
  289. if (temp.length == 10) {
  290. break
  291. }
  292. }
  293. } else {
  294. temp.push(key);
  295. }
  296. this.setSearchHistory(temp);
  297. },
  298. setSearchHistory(obj) {
  299. this.searchHistory = obj
  300. this.carhelp.set("setSearchHistory", obj)
  301. },
  302. blur() {
  303. },
  304. focus() {
  305. this.step = true;
  306. },
  307. submit() {
  308. if (!this.searchQuery.keyword) {
  309. uni.showToast({
  310. title:"请输入内容",
  311. icon:"none"
  312. })
  313. return
  314. }
  315. this.setHistory()
  316. this.listForm.pageIndex = 1
  317. // var ref =this.$refs.searchinput.getRef()
  318. // ref.blur()
  319. this.query();
  320. },
  321. myLoadmore() {
  322. this.listForm.pageIndex += 1;
  323. this.query();
  324. },
  325. query() {
  326. if(this.searchQuery.selectIndex==0){
  327. this.tabList=[
  328. ...this.tabList1
  329. ]
  330. }
  331. if(this.searchQuery.selectIndex==1){
  332. this.tabList=[
  333. ...this.tabList2
  334. ]
  335. }
  336. this.step = false;
  337. uni.showLoading({
  338. title: "加载中",
  339. mask: true,
  340. })
  341. var list = this.tabList[this.current].list
  342. var obj = this.tabList[this.current]
  343. var listForm = {
  344. ...obj,
  345. ...this.queryForm
  346. }
  347. listForm.status= this.selectList[this.searchQuery.selectIndex].id,
  348. listForm.content= this.searchQuery.keyword
  349. delete listForm.list
  350. API.findRecruitSearch(listForm).then((res) => {
  351. uni.hideLoading();
  352. if (listForm.pageIndex == 1) {
  353. list = res.data.data;
  354. } else {
  355. list = [
  356. ...list,
  357. ...res.data.data
  358. ];
  359. }
  360. this.tabList[this.current].list = list
  361. this.tabList[this.current].recordsTotal = res.data.recordsTotal;
  362. }).catch(error => {
  363. uni.showToast({icon: 'none',
  364. title: error
  365. })
  366. //this.getPhone()
  367. })
  368. },
  369. // 执行搜索
  370. doSearch(searchQuery) {
  371. //.log('searchQuery', searchQuery);
  372. this.searchQuery=searchQuery;
  373. this.submit()
  374. },
  375. change(index) {
  376. this.current = index;
  377. var list = this.tabList[this.current].list
  378. if (list.length == 0) {
  379. this.query();
  380. }
  381. },
  382. close(){},
  383. popupShowtrue(){
  384. this.$refs.pop.show();
  385. },
  386. queryBtn(queryForm){
  387. this.$refs.pop.hide();
  388. this.current = 0;
  389. this.tabList[this.current].list=[]
  390. this.tabList[this.current].pageIndex = 1;
  391. // this.saralyChecked = -1;
  392. // this.workChecked = -1;
  393. // this.queryForm.salaryStart=""
  394. // this.queryForm.salaryEnd=""
  395. // this.queryForm.workExp=""
  396. this.queryForm=queryForm
  397. this.query();
  398. },
  399. reset(queryForm) {
  400. this.queryBtn(queryForm)
  401. }
  402. }
  403. }
  404. </script>
  405. <style lang="scss" scoped>
  406. // 搜索框
  407. .search {
  408. padding: 16rpx 32rpx;
  409. .search-box {
  410. border-radius: 50px;
  411. // background-color: rgba(243, 246, 249, 1);
  412. height: 72rpx;
  413. line-height: 72rpx;
  414. }
  415. }
  416. // 搜索历史
  417. .search-history {
  418. padding: 0 32rpx;
  419. margin-top: 40rpx;
  420. .top {
  421. display: flex;
  422. justify-content: space-between;
  423. align-items: center;
  424. .title {
  425. color: #101010;
  426. }
  427. .clear {
  428. color: rgba(169, 169, 169, 1);
  429. font-size: 24rpx;
  430. }
  431. }
  432. .history {
  433. display: flex;
  434. margin-top: 16rpx;
  435. .tag {
  436. width: 144rpx;
  437. height: 56rpx;
  438. line-height: 56rpx;
  439. border-radius: 4px;
  440. background-color: rgba(241, 244, 247, 1);
  441. color: rgba(88, 88, 88, 1);
  442. font-size: 12px;
  443. text-align: center;
  444. font-family: Arial;
  445. margin-right: 16rpx;
  446. }
  447. }
  448. }
  449. // 搜索结果
  450. .result {
  451. background-color: #fff;
  452. .tabs {
  453. padding-right: 32rpx;
  454. display: flex;
  455. justify-content: space-between;
  456. align-items: center;
  457. border-bottom: 1px solid #f1f1f1;
  458. .left {
  459. width: 68%;
  460. /deep/.u-tabs {
  461. background-color: #fff !important;
  462. }
  463. }
  464. .screen {
  465. display: flex;
  466. align-items: center;
  467. color: rgba(39, 149, 253, 1);
  468. font-size: 16px;
  469. img {
  470. width: 16px;
  471. height: 16px;
  472. vertical-align: middle;
  473. margin-right: 4rpx;
  474. }
  475. }
  476. }
  477. .result-item1{
  478. display: flex;
  479. }
  480. .result-item {
  481. padding: 24rpx 0;
  482. margin: 0 32rpx;
  483. border-bottom: 1px solid #F0F0F2;
  484. // 照片
  485. .photo {
  486. width: 96rpx;
  487. height: 96rpx;
  488. overflow: hidden;
  489. border-radius: 50px;
  490. border: 1px solid rgba(255, 255, 255, 1);
  491. img {
  492. width: 100%;
  493. height: 100%;
  494. }
  495. }
  496. .content {
  497. margin-left: 24rpx;
  498. flex: 1;
  499. // 职位薪水
  500. .top {
  501. display: flex;
  502. justify-content: space-between;
  503. align-items: center;
  504. font-size: 36rpx;
  505. .position {
  506. color: rgba(16, 16, 16, 1);
  507. font-family: 'PingFangSC-medium';
  508. }
  509. .salary {
  510. color: rgba(255, 61, 0, 1);
  511. font-size: 32rpx;
  512. }
  513. }
  514. // 发布人
  515. .issuer {
  516. margin-top: 16rpx;
  517. }
  518. // 标签和时间
  519. .bottom {
  520. display: flex;
  521. justify-content: space-between;
  522. align-items: center;
  523. margin-top: 24rpx;
  524. .tags {
  525. display: flex;
  526. .tag-item {
  527. padding: 0 8rpx;
  528. height: 36rpx;
  529. line-height: 36rpx;
  530. border-radius: 4px;
  531. background-color: rgba(241, 241, 247, 1);
  532. color: rgba(129, 127, 153, 1);
  533. font-size: 24rpx;
  534. text-align: center;
  535. margin-right: 8rpx;
  536. }
  537. }
  538. .date {
  539. color: rgba(153, 153, 153, 1);
  540. font-size: 24rpx;
  541. }
  542. }
  543. }
  544. .content-1 {
  545. display: flex;
  546. justify-content: space-between;
  547. align-items: center;
  548. // 职位
  549. .position {
  550. color: rgba(16, 16, 16, 1);
  551. font-size: 36rpx;
  552. font-family: 'PingFang Medium';
  553. }
  554. // 薪水
  555. .salary {
  556. color: rgba(255, 61, 0, 1);
  557. font-size: 32rpx;
  558. font-family: 'PingFang Medium';
  559. }
  560. }
  561. .content-2 {
  562. margin-top: 12rpx;
  563. display: flex;
  564. justify-content: space-between;
  565. // 标签
  566. .tag {
  567. display: flex;
  568. .tag-item {
  569. min-width: 64rpx;
  570. height: 36rpx;
  571. line-height: 36rpx;
  572. border-radius: 8rpx;
  573. background-color: rgba(241, 241, 247, 1);
  574. color: rgba(129, 127, 153, 1);
  575. font-size: 24rpx;
  576. text-align: center;
  577. margin-right: 12rpx;
  578. padding: 0 8rpx;
  579. }
  580. }
  581. // 日期
  582. .date {
  583. color: rgba(153, 153, 153, 1);
  584. font-size: 24rpx;
  585. }
  586. }
  587. .content-3 {
  588. margin-top: 20rpx;
  589. display: flex;
  590. justify-content: space-between;
  591. align-items: center;
  592. .issuer {
  593. color: rgba(51, 51, 51, 1);
  594. font-size: 24rpx;
  595. }
  596. .address {
  597. color: rgba(51, 51, 51, 1);
  598. font-size: 24rpx;
  599. }
  600. }
  601. }
  602. }
  603. // 筛选框
  604. .popup-content {
  605. padding: 32rpx;
  606. .headline {
  607. color: #101010;
  608. font-size: 40rpx;
  609. text-align: center;
  610. }
  611. //行业
  612. .industry,.salary-package,.work-experience,
  613. .clearing-form,
  614. .salary-form {
  615. margin-top: 16rpx;
  616. margin-bottom: 76rpx;
  617. .title {
  618. font-size: 32rpx;
  619. color: #111111;
  620. }
  621. // 选项
  622. .options {
  623. display: flex;
  624. justify-content: space-between;
  625. flex-wrap: wrap;
  626. margin-top: 24rpx;
  627. .item {
  628. height: 56rpx;
  629. line-height: 56rpx;
  630. padding: 0 32rpx;
  631. margin-bottom: 16rpx;
  632. color: #999999;
  633. background-color: #F3F3F4;
  634. border-radius: 4px;
  635. }
  636. .checked {
  637. background-color: #2795FD;
  638. color: #fff;
  639. }
  640. }
  641. }
  642. .button {
  643. display: flex;
  644. margin-top: 8rpx;
  645. .reset:after{
  646. border:0
  647. }
  648. .reset {
  649. color: #999999;
  650. background-color: #F3F3F4;
  651. width: 200rpx;
  652. height: 72rpx;
  653. line-height: 72rpx;
  654. border-radius: 8px;
  655. }
  656. .confirm {
  657. width: 440rpx;
  658. background-color: #2795FD;
  659. color: #fff;
  660. height: 72rpx;
  661. line-height: 72rpx;
  662. border-radius: 8px;
  663. }
  664. }
  665. }
  666. .salary-form,.salary-package,.work-experience,
  667. .clearing-form {
  668. .options {
  669. justify-content: start !important;
  670. }
  671. .item {
  672. margin-right: 24rpx;
  673. }
  674. }
  675. /deep/.u-close--top-right {
  676. top: 44rpx;
  677. }
  678. </style>