search.vue 16 KB

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