search.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  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. {{getPersonName(item.realName,item)}}
  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" :ptype="searchQuery.selectIndex==0?'per':'job'" @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. selectItem(e){
  263. //this.searchQuery.selectIndex = e
  264. },
  265. ckInfo(id) {
  266. var url = "/pages/news/articleDetails?id=" + id;
  267. uni.navigateTo({
  268. url: url
  269. })
  270. },
  271. clear() {
  272. this.setSearchHistory([]);
  273. },
  274. setHistory() {
  275. //搜索记录保存
  276. var key = this.searchQuery.keyword;
  277. var sz = this.searchHistory;
  278. if (!sz) {
  279. sz = [];
  280. }
  281. var temp = [];
  282. //去重 ,后插入的,排队到最前面
  283. if (sz.length) {
  284. for (var i in sz) {
  285. if (i == 0) {
  286. temp.push(key);
  287. }
  288. if (sz[i] == key) {
  289. continue;
  290. }
  291. temp.push(sz[i]);
  292. if (temp.length == 10) {
  293. break
  294. }
  295. }
  296. } else {
  297. temp.push(key);
  298. }
  299. this.setSearchHistory(temp);
  300. },
  301. setSearchHistory(obj) {
  302. this.searchHistory = obj
  303. this.carhelp.set("setSearchHistory", obj)
  304. },
  305. blur() {
  306. },
  307. focus() {
  308. this.step = true;
  309. },
  310. submit() {
  311. if (!this.searchQuery.keyword) {
  312. uni.showToast({
  313. title:"请输入内容",
  314. icon:"none"
  315. })
  316. return
  317. }
  318. this.setHistory()
  319. this.listForm.pageIndex = 1
  320. // var ref =this.$refs.searchinput.getRef()
  321. // ref.blur()
  322. this.query();
  323. },
  324. myLoadmore() {
  325. this.listForm.pageIndex += 1;
  326. this.query();
  327. },
  328. query() {
  329. if(this.searchQuery.selectIndex==0){
  330. this.tabList=[
  331. ...this.tabList1
  332. ]
  333. }
  334. if(this.searchQuery.selectIndex==1){
  335. this.tabList=[
  336. ...this.tabList2
  337. ]
  338. }
  339. this.step = false;
  340. uni.showLoading({
  341. title: "加载中",
  342. mask: true,
  343. })
  344. var list = this.tabList[this.current].list
  345. var obj = this.tabList[this.current]
  346. var queryForm={
  347. ...this.queryForm
  348. }
  349. var listForm = {
  350. ...obj,
  351. ...queryForm
  352. }
  353. listForm.status= this.selectList[this.searchQuery.selectIndex].id,
  354. listForm.content= this.searchQuery.keyword
  355. if(listForm.status==0){
  356. listForm.salaryStart=""
  357. listForm.salaryEnd=""
  358. }
  359. delete listForm.list
  360. API.findRecruitSearch(listForm).then((res) => {
  361. uni.hideLoading();
  362. if (listForm.pageIndex == 1) {
  363. list = res.data.data;
  364. } else {
  365. list = [
  366. ...list,
  367. ...res.data.data
  368. ];
  369. }
  370. this.tabList[this.current].list = list
  371. this.tabList[this.current].recordsTotal = res.data.recordsTotal;
  372. }).catch(error => {
  373. uni.showToast({icon: 'none',
  374. title: error
  375. })
  376. //this.getPhone()
  377. })
  378. },
  379. // 执行搜索
  380. doSearch(searchQuery) {
  381. //.log('searchQuery', searchQuery);
  382. this.searchQuery=searchQuery;
  383. this.submit()
  384. },
  385. change(index) {
  386. this.current = index;
  387. var list = this.tabList[this.current].list
  388. if (list.length == 0) {
  389. this.query();
  390. }
  391. },
  392. close(){},
  393. popupShowtrue(){
  394. this.$refs.pop.show();
  395. },
  396. queryBtn(queryForm){
  397. this.$refs.pop.hide();
  398. this.current = 0;
  399. this.tabList[this.current].list=[]
  400. this.tabList[this.current].pageIndex = 1;
  401. // this.saralyChecked = -1;
  402. // this.workChecked = -1;
  403. // this.queryForm.salaryStart=""
  404. // this.queryForm.salaryEnd=""
  405. // this.queryForm.workExp=""
  406. this.queryForm=queryForm
  407. this.query();
  408. },
  409. reset(queryForm) {
  410. this.queryBtn(queryForm)
  411. }
  412. }
  413. }
  414. </script>
  415. <style lang="scss" scoped>
  416. // 搜索框
  417. .search {
  418. padding: 16rpx 32rpx;
  419. .search-box {
  420. border-radius: 50px;
  421. // background-color: rgba(243, 246, 249, 1);
  422. height: 72rpx;
  423. line-height: 72rpx;
  424. }
  425. }
  426. // 搜索历史
  427. .search-history {
  428. padding: 0 32rpx;
  429. margin-top: 40rpx;
  430. .top {
  431. display: flex;
  432. justify-content: space-between;
  433. align-items: center;
  434. .title {
  435. color: #101010;
  436. }
  437. .clear {
  438. color: rgba(169, 169, 169, 1);
  439. font-size: 24rpx;
  440. }
  441. }
  442. .history {
  443. display: flex;
  444. margin-top: 16rpx;
  445. .tag {
  446. width: 144rpx;
  447. height: 56rpx;
  448. line-height: 56rpx;
  449. border-radius: 4px;
  450. background-color: rgba(241, 244, 247, 1);
  451. color: rgba(88, 88, 88, 1);
  452. font-size: 12px;
  453. text-align: center;
  454. font-family: Arial;
  455. margin-right: 16rpx;
  456. }
  457. }
  458. }
  459. // 搜索结果
  460. .result {
  461. background-color: #fff;
  462. .tabs {
  463. padding-right: 32rpx;
  464. display: flex;
  465. justify-content: space-between;
  466. align-items: center;
  467. border-bottom: 1px solid #f1f1f1;
  468. .left {
  469. width: 68%;
  470. /deep/.u-tabs {
  471. background-color: #fff !important;
  472. }
  473. }
  474. .screen {
  475. display: flex;
  476. align-items: center;
  477. color: rgba(39, 149, 253, 1);
  478. font-size: 16px;
  479. img {
  480. width: 16px;
  481. height: 16px;
  482. vertical-align: middle;
  483. margin-right: 4rpx;
  484. }
  485. }
  486. }
  487. .result-item1{
  488. display: flex;
  489. }
  490. .result-item {
  491. padding: 24rpx 0;
  492. margin: 0 32rpx;
  493. border-bottom: 1px solid #F0F0F2;
  494. // 照片
  495. .photo {
  496. width: 96rpx;
  497. height: 96rpx;
  498. overflow: hidden;
  499. border-radius: 50px;
  500. border: 1px solid rgba(255, 255, 255, 1);
  501. img {
  502. width: 100%;
  503. height: 100%;
  504. }
  505. }
  506. .content {
  507. margin-left: 24rpx;
  508. flex: 1;
  509. // 职位薪水
  510. .top {
  511. display: flex;
  512. justify-content: space-between;
  513. align-items: center;
  514. font-size: 36rpx;
  515. .position {
  516. color: rgba(16, 16, 16, 1);
  517. font-family: 'PingFangSC-medium';
  518. }
  519. .salary {
  520. color: rgba(255, 61, 0, 1);
  521. font-size: 32rpx;
  522. min-width: 260rpx;
  523. text-align: end;
  524. }
  525. }
  526. // 发布人
  527. .issuer {
  528. margin-top: 16rpx;
  529. }
  530. // 标签和时间
  531. .bottom {
  532. display: flex;
  533. justify-content: space-between;
  534. align-items: center;
  535. margin-top: 24rpx;
  536. .tags {
  537. display: flex;
  538. .tag-item {
  539. padding: 0 8rpx;
  540. height: 36rpx;
  541. line-height: 36rpx;
  542. border-radius: 4px;
  543. background-color: rgba(241, 241, 247, 1);
  544. color: rgba(129, 127, 153, 1);
  545. font-size: 24rpx;
  546. text-align: center;
  547. margin-right: 8rpx;
  548. }
  549. }
  550. .date {
  551. color: rgba(153, 153, 153, 1);
  552. font-size: 24rpx;
  553. }
  554. }
  555. }
  556. .content-1 {
  557. display: flex;
  558. justify-content: space-between;
  559. align-items: center;
  560. // 职位
  561. .position {
  562. color: rgba(16, 16, 16, 1);
  563. font-size: 36rpx;
  564. font-family: 'PingFang Medium';
  565. }
  566. // 薪水
  567. .salary {
  568. color: rgba(255, 61, 0, 1);
  569. font-size: 32rpx;
  570. font-family: 'PingFang Medium';
  571. }
  572. }
  573. .content-2 {
  574. margin-top: 12rpx;
  575. display: flex;
  576. justify-content: space-between;
  577. // 标签
  578. .tag {
  579. display: flex;
  580. .tag-item {
  581. min-width: 64rpx;
  582. height: 36rpx;
  583. line-height: 36rpx;
  584. border-radius: 8rpx;
  585. background-color: rgba(241, 241, 247, 1);
  586. color: rgba(129, 127, 153, 1);
  587. font-size: 24rpx;
  588. text-align: center;
  589. margin-right: 12rpx;
  590. padding: 0 8rpx;
  591. }
  592. }
  593. // 日期
  594. .date {
  595. color: rgba(153, 153, 153, 1);
  596. font-size: 24rpx;
  597. }
  598. }
  599. .content-3 {
  600. margin-top: 20rpx;
  601. display: flex;
  602. justify-content: space-between;
  603. align-items: center;
  604. .issuer {
  605. color: rgba(51, 51, 51, 1);
  606. font-size: 24rpx;
  607. }
  608. .address {
  609. color: rgba(51, 51, 51, 1);
  610. font-size: 24rpx;
  611. }
  612. }
  613. }
  614. }
  615. // 筛选框
  616. .popup-content {
  617. padding: 32rpx;
  618. .headline {
  619. color: #101010;
  620. font-size: 40rpx;
  621. text-align: center;
  622. }
  623. //行业
  624. .industry,.salary-package,.work-experience,
  625. .clearing-form,
  626. .salary-form {
  627. margin-top: 16rpx;
  628. margin-bottom: 76rpx;
  629. .title {
  630. font-size: 32rpx;
  631. color: #111111;
  632. }
  633. // 选项
  634. .options {
  635. display: flex;
  636. justify-content: space-between;
  637. flex-wrap: wrap;
  638. margin-top: 24rpx;
  639. .item {
  640. height: 56rpx;
  641. line-height: 56rpx;
  642. padding: 0 32rpx;
  643. margin-bottom: 16rpx;
  644. color: #999999;
  645. background-color: #F3F3F4;
  646. border-radius: 4px;
  647. }
  648. .checked {
  649. background-color: #2795FD;
  650. color: #fff;
  651. }
  652. }
  653. }
  654. .button {
  655. display: flex;
  656. margin-top: 8rpx;
  657. .reset:after{
  658. border:0
  659. }
  660. .reset {
  661. color: #999999;
  662. background-color: #F3F3F4;
  663. width: 200rpx;
  664. height: 72rpx;
  665. line-height: 72rpx;
  666. border-radius: 8px;
  667. }
  668. .confirm {
  669. width: 440rpx;
  670. background-color: #2795FD;
  671. color: #fff;
  672. height: 72rpx;
  673. line-height: 72rpx;
  674. border-radius: 8px;
  675. }
  676. }
  677. }
  678. .salary-form,.salary-package,.work-experience,
  679. .clearing-form {
  680. .options {
  681. justify-content: start !important;
  682. }
  683. .item {
  684. margin-right: 24rpx;
  685. }
  686. }
  687. /deep/.u-close--top-right {
  688. top: 44rpx;
  689. }
  690. </style>