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