recruitment.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. <!--
  2. * @title 招聘就业
  3. * @author Rockery(1113269755@qq.com)
  4. -->
  5. <template>
  6. <view class="recruitment">
  7. <u-navbar back-text="" title="" back-icon-color="#FFFFFF" :background="{ background: '#3D5D4C' }" :border-bottom="false"></u-navbar>
  8. <!-- ###################################-- 轮播图 -- ################################### -->
  9. <view class="recruitment-banner">
  10. <u-swiper
  11. :list="bannerList"
  12. name="bannerUrl"
  13. border-radius="0"
  14. height="300"
  15. img-mode="scaleToFill"
  16. @click="swiperClick"
  17. :mode="bannerList.length > 1 ? 'round' : 'none'"
  18. >
  19. </u-swiper>
  20. </view>
  21. <!-- ###################################-- 请输入您关键词 -- ################################### -->
  22. <view class="recruitment-usearch">
  23. <u-search
  24. placeholder="请输入您关键词"
  25. v-model="headerTopKeyword"
  26. :show-action="false"
  27. bg-color="#FFFFFF"
  28. @search="searchKeyword"
  29. @clear="searchKeyword"
  30. ></u-search>
  31. </view>
  32. <!-- ###################################-- 企业推荐 -- ################################### -->
  33. <view class="u-card-wrap recruitment-recommend">
  34. <u-card :show-foot="false" class="recruitment-recommend-card">
  35. <view slot="head">
  36. <view class="recommend-card-head">
  37. <view class="recommend-card-head-title">{{ recommendConfigData.title }}</view>
  38. <view class="recommend-card-head-subtitle" @tap="recommendCardMoreClick">
  39. {{ recommendConfigData.titlemore }}
  40. <u-icon name="arrow-right" color="#A3A3A3" size="28"></u-icon>
  41. </view>
  42. </view>
  43. </view>
  44. <view slot="body">
  45. <view class="recommend-card-body">
  46. <swiper v-if="recommendList && recommendList.length > 0" class="recommend-card-content" :display-multiple-items="4" :autoplay="true">
  47. <swiper-item v-for="(recommendItem, index) in recommendList" :key="'recommendList' + index">
  48. <view class="swiper-item" @tap="tapRecommendSwiperItem(recommendItem)" :data-id="recommendItem.id" :data-index="index">
  49. <view class="img">
  50. <u-image :src="recommendItem.logoUrl" width="140" height="140" border-radius="10" mode="aspectFill">
  51. <view slot="error">
  52. <u-image src="../../static/img/default-company.png" width="140" height="140" border-radius="10" mode="aspectFill" />
  53. </view>
  54. </u-image>
  55. </view>
  56. <view class="subject">{{ recommendItem.companyName }}</view>
  57. <view class="post u-text-center">
  58. 岗位
  59. <text class="postlink">{{ recommendItem.postCount }}</text
  60. >个
  61. </view>
  62. </view>
  63. </swiper-item>
  64. <swiper-item v-if="recommendConfigData.listmore">
  65. <view class="swiper-item lookmore" @tap="recommendCardMoreClick">
  66. <view class="moretext">查看更多</view>
  67. </view>
  68. </swiper-item>
  69. </swiper>
  70. <u-empty v-else text="列表为空" mode="list"></u-empty>
  71. </view>
  72. </view>
  73. </u-card>
  74. </view>
  75. <!-- ###################################-- tabs页签 -- ################################### -->
  76. <view class="recruitment-tabs">
  77. <u-tabs bg-color="#f2f2f2" :list="dataAreaTabsList" @change="dataAreaTabsChange" :current="dataAreaTabsCurrent" />
  78. </view>
  79. <!-- ###################################-- 招聘就业岗位 -- ################################### -->
  80. <view class="recruitment-dataarea" v-if="recruitmentJobList.length">
  81. <view
  82. class="recruitment-dataarea-card"
  83. v-for="(item, index) in recruitmentJobList"
  84. :key="'recruitmentJobList' + index"
  85. @tap="tapDataAreaCard(item)"
  86. >
  87. <view class="dataarea-card-left">
  88. <u-image :src="item.companyLogoUrl" width="120" height="120" border-radius="10" mode="aspectFill">
  89. <view slot="error">
  90. <u-image src="../../static/img/default-company.png" width="120" height="120" border-radius="10" mode="aspectFill" />
  91. </view>
  92. </u-image>
  93. </view>
  94. <view class="dataarea-card-content">
  95. <view class="dataarea-content-left">
  96. <view>{{ item.postName }}</view>
  97. <view class="content">
  98. {{ item.areaName }}| {{ getDictsLabel(workYearList, item.workYear) }}|{{ getEducationBg(item.educationBg) }}
  99. </view>
  100. <view>{{ item.companyName }}</view>
  101. </view>
  102. <view class="dataarea-content-right">
  103. <view>{{ item.lowestSalary }}K~{{ item.highestSalary }}K</view>
  104. <view>&nbsp;</view>
  105. <view>{{ $u.timeFormat(new Date(item.createTime).getTime(), 'yyyy-mm-dd') }}</view>
  106. </view>
  107. </view>
  108. </view>
  109. <u-loadmore :status="loadStatus" @loadmore="getList()" />
  110. </view>
  111. <u-empty v-else text="列表为空" mode="list"></u-empty>
  112. </view>
  113. </template>
  114. <script>
  115. export default {
  116. data() {
  117. return {
  118. headerTopKeyword: '',
  119. bannerList: [],
  120. // 企业推荐列表
  121. recommendList: [],
  122. recruitmentJobList: [],
  123. recommendListData: [],
  124. recommendConfigData: {
  125. title: '企业推荐',
  126. titlemore: '更多',
  127. listmore: false
  128. },
  129. dataAreaTabsCurrent: 0,
  130. dataAreaTabsList: [
  131. {
  132. name: '最新',
  133. text: '1'
  134. }
  135. ],
  136. degrEducList: [],
  137. workYearList: [],
  138. queryParams: {
  139. pageNum: 1,
  140. pageSize: 10,
  141. postName: undefined,
  142. newest: undefined
  143. },
  144. loadStatus: 'loadmore',
  145. totalPage: 0
  146. };
  147. },
  148. onLoad() {
  149. // 获取企业推荐列表
  150. this.getRecommendList();
  151. this.getRecruitmentJobList();
  152. },
  153. onShow() {
  154. this.getBannerList();
  155. this.getVeteDegrEduc();
  156. },
  157. onPullDownRefresh() {
  158. uni.startPullDownRefresh();
  159. this.recruitmentJobList = [];
  160. this.recommendList = [];
  161. this.recommendListData = [];
  162. this.bannerList = [];
  163. this.queryParams = {
  164. pageNum: 1,
  165. pageSize: 10,
  166. postName: undefined,
  167. newest: undefined
  168. };
  169. this.getRecommendList();
  170. this.getRecruitmentJobList();
  171. this.getBannerList();
  172. this.getVeteDegrEduc();
  173. setTimeout(() => {
  174. uni.stopPullDownRefresh();
  175. }, 1500);
  176. },
  177. onReachBottom() {
  178. this.loadStatus = 'loading';
  179. setTimeout(() => {
  180. this.queryParams.pageNum = ++this.queryParams.pageNum;
  181. this.getRecruitmentJobList();
  182. }, 1000);
  183. },
  184. methods: {
  185. getList() {
  186. this.loadStatus = 'loading';
  187. setTimeout(() => {
  188. this.queryParams.pageNum = ++this.queryParams.pageNum;
  189. this.getRecruitmentJobList();
  190. }, 1000);
  191. },
  192. /**
  193. * 获取文化程度类别
  194. */
  195. getVeteDegrEduc() {
  196. this.$u.api
  197. .getDictdataUrl({
  198. key: 'degr_educ'
  199. })
  200. .then((res) => {
  201. if (res.code == 200) {
  202. this.degrEducList = res.data.map((item) => {
  203. return {
  204. ...item,
  205. value: item.text
  206. };
  207. });
  208. }
  209. });
  210. this.$u.api
  211. .getDictdataUrl({
  212. key: 'work_year'
  213. })
  214. .then((res) => {
  215. if (res.code == 200) {
  216. this.workYearList = res.data.map((item) => {
  217. return {
  218. ...item,
  219. value: item.text
  220. };
  221. });
  222. }
  223. });
  224. },
  225. /**
  226. * 获取教育等级名称
  227. * @param {Object} value
  228. */
  229. getEducationBg(value) {
  230. let name;
  231. this.degrEducList.forEach((item) => {
  232. if (item.value == value) {
  233. name = item.label;
  234. }
  235. });
  236. return name;
  237. },
  238. /**
  239. * 导航栏返回事件
  240. */
  241. navbarCustomBack() {
  242. this.$u.route({
  243. type: 'switchTab',
  244. url: 'pages/index/index'
  245. });
  246. },
  247. getBannerList() {
  248. this.$u.api.indexApi
  249. .indexBannerListApi({
  250. type: 1
  251. })
  252. .then((res) => {
  253. if (res?.code === 200) {
  254. this.bannerList = res.data;
  255. }
  256. });
  257. },
  258. // 轮播图点击
  259. swiperClick(index) {
  260. if (this.bannerList[index].jumpUrl) {
  261. let url = this.bannerList[index].jumpUrl.split('#')[1];
  262. this.$u.route({
  263. url: url
  264. });
  265. } else {
  266. this.$u.route({
  267. url: 'pages/bannerDetails/bannerDetails',
  268. params: {
  269. id: this.bannerList[index].id,
  270. type: 1
  271. }
  272. });
  273. }
  274. },
  275. /**
  276. * 获取企业推荐列表
  277. */
  278. getRecommendList() {
  279. this.$u.api.recruitment
  280. .getRecommendList()
  281. .then((res) => {
  282. if (res.code === 200) {
  283. this.recommendList = res.data || [];
  284. } else {
  285. uni.showToast({
  286. icon: 'none',
  287. title: res.msg
  288. });
  289. }
  290. })
  291. .catch((err) => {
  292. uni.showToast({
  293. title: '系统异常!',
  294. type: 'error'
  295. });
  296. });
  297. },
  298. /**
  299. * 获取招聘就业岗位列表
  300. */
  301. getRecruitmentJobList() {
  302. const queryParams = { ...this.queryParams };
  303. queryParams.newest = this.dataAreaTabsList[this.dataAreaTabsCurrent]?.text;
  304. queryParams.postName = this.headerTopKeyword;
  305. this.$u.api.recruitment
  306. .getRecruitmentJobList(queryParams)
  307. .then((res) => {
  308. if (res.code === 200) {
  309. this.totalPage = parseInt(Number(res.total) / this.queryParams.pageSize) + 1;
  310. let list = res?.rows ?? [];
  311. list.length && (this.recruitmentJobList = this.recruitmentJobList.concat(list));
  312. if (this.queryParams.pageNum >= this.totalPage) {
  313. this.loadStatus = 'nomore';
  314. } else {
  315. this.loadStatus = 'loadmore';
  316. }
  317. } else {
  318. this.loadStatus = 'nomore';
  319. uni.showToast({
  320. icon: 'none',
  321. title: res.msg
  322. });
  323. }
  324. })
  325. .catch((err) => {
  326. this.loadStatus = 'nomore';
  327. uni.showToast({
  328. title: '系统异常!',
  329. type: 'error'
  330. });
  331. });
  332. },
  333. /**
  334. * @param { String } value
  335. */
  336. searchKeyword() {
  337. this.recruitmentJobList = [];
  338. this.queryParams.pageNum = 1;
  339. this.getRecruitmentJobList();
  340. },
  341. // tab栏切换
  342. dataAreaTabsChange(index) {
  343. this.dataAreaTabsCurrent = index;
  344. this.recruitmentJobList = [];
  345. this.queryParams.pageNum = 1;
  346. this.getRecruitmentJobList();
  347. },
  348. recommendCardMoreClick(index) {
  349. this.$u.route({
  350. url: 'pages/cooperativeEnterprise/cooperativeEnterprise',
  351. params: {
  352. flag: 'recruitment'
  353. }
  354. });
  355. },
  356. tapRecommendSwiperItem(param) {
  357. this.$u.route({
  358. url: 'pages/businessDetails/businessDetails',
  359. params: {
  360. id: param?.id,
  361. flag: 'recruitment'
  362. }
  363. });
  364. },
  365. tapDataAreaCard(param) {
  366. this.$u.route({
  367. url: 'pages/jobDetails/jobDetails',
  368. params: {
  369. id: param?.id
  370. }
  371. });
  372. },
  373. /**
  374. * 通过value获取label
  375. * @param {Object} list
  376. * @param {Object} value
  377. */
  378. getDictsLabel(list, value) {
  379. let label = '-';
  380. try {
  381. list.forEach((item) => {
  382. if (Number(item.text) === Number(value)) {
  383. throw item;
  384. }
  385. });
  386. } catch (e) {
  387. label = e.label;
  388. }
  389. return label;
  390. }
  391. }
  392. };
  393. </script>
  394. <style lang="scss" scoped>
  395. @import './scss/recruitment.scss';
  396. </style>