You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

909 lines
24 KiB
Vue

4 years ago
<template>
<div class="joblist-container">
<!-- 筛选导航 -->
<div class="navigation">
<div class="w">
<!-- 特色筛选的列表盒子 -->
<div v-if="isspecialboxshow" class="specialbox" @click.stop="">
<div class="w">
<ul>
<li
4 years ago
v-for="(item, index) in specialList"
4 years ago
:key="index"
4 years ago
@click.stop="specialclick(index, item)"
4 years ago
:class="{ 'special-active': specialactive.indexOf(index) > -1 }"
>
4 years ago
{{ item.name }}
4 years ago
</li>
</ul>
</div>
</div>
<ul>
<li>
<i class="iconfont icon-dingwei"></i
><a-cascader
4 years ago
:options="cityoption"
4 years ago
change-on-select
@change="onChange"
placeholder="选择城市"
4 years ago
v-model="formvalue.district"
4 years ago
id="city"
/>
</li>
<li>
<a-cascader
:options="options.price"
placeholder="工价"
@change="onChange"
4 years ago
v-model="formvalue.monthlyPayStr"
4 years ago
id="price"
/>
</li>
<li>
<a-cascader
:options="options.age"
placeholder="年龄"
@change="onChange"
4 years ago
v-model="formvalue.ageStr"
4 years ago
id="age"
/>
</li>
<li class="special">
<div
@click.stop="isspecialboxshowclick"
:style="isspecialboxshow ? 'color:#ff6a00' : ''"
>
<span :style="specialactive.length != 0 ? 'color:#ff6a00' : ''"
>特色</span
><i
class="iconfont icon-xiala"
:class="isspecialboxshow ? 'turn' : ''"
:style="isspecialboxshow ? 'color:#ff6a00' : ''"
></i>
</div>
</li>
<li @click="claerfilter"><a href="javascript:;">清空筛选</a></li>
</ul>
</div>
</div>
<!-- 主体部分 -->
<div class="maincontent w">
<div class="maincontentleft">
4 years ago
<div style="text-align: center">
<a-spin tip="加载中..." :spinning="isspinning"> </a-spin>
</div>
<div
class="nodata"
v-if="jobMainList.length === 0 && isspinning === false"
>
<p>没有符合条件的岗位</p>
</div>
<div v-if="!isspinning">
<div class="subset" v-for="(item, index) in jobMainList" :key="index">
<router-link :to="'/detail/' + item.id">
<div class="subsetleft">
<div class="imgbox">
<img
:src="item.logo || 'require(../../assets/美特科技.png)'"
/>
</div>
<div class="jobinfobox">
<div class="jobname">{{ item.aliasName }}</div>
<div class="jobinfo">
<span>{{ item.district }}</span>
<span>{{ item.gender }}</span>
<span>{{ item.age }}</span>
</div>
<div class="jobtag">
<span>返费</span>
<span
v-for="(item1, index) in item.jobSpecialLabelNames"
:key="index"
>{{ item1 }}</span
>
</div>
<div
class="jobpricemonth"
:style="{ opacity: item.minMonthlyPay ? '1' : '0' }"
>
<span>{{ item.minMonthlyPay }}</span
>-<span>{{ item.maxMonthlyPay }}</span
>/
</div>
<div class="jobpricehour">
<template v-if="item.hourlyPay"
><span>{{ item.hourlyPayTemp / 100 }}</span
>/小时</template
>
<template v-else-if="item.dayPay"
><span>{{ item.hourlyPayTemp / 100 }}</span
>/</template
>
</div>
</div>
4 years ago
</div>
4 years ago
</router-link>
<div class="subsetright">
<div class="topbox">
<div>服务费</div>
<div><span>1.5</span>/小时</div>
</div>
<div class="bottombox">
<router-link :to="'/detail/' + item.id">
<button>更多</button>
</router-link>
<button>录单</button>
4 years ago
</div>
</div>
</div>
</div>
<div class="pagecontainer">
<a-pagination
4 years ago
:current="+formvalue.pageNum"
4 years ago
:default-current="1"
4 years ago
:defaultPageSize="2"
:total="formvalue.total"
@change="pageChange"
4 years ago
/>
4 years ago
<div class="ant-pagination-options-quick-jumper">
跳至<input
ref="pageinput"
type="text"
@keyup.enter="inputpageChange"
/>
</div>
4 years ago
</div>
</div>
<div class="maincontentright">
<div class="hotphone">
<h1>服务热线</h1>
<p>0371-666666666</p>
</div>
<div class="relationme">
<p>一手单合作</p>
<button>发布一手单</button>
</div>
4 years ago
<recommend />
4 years ago
</div>
</div>
</div>
</template>
<script>
4 years ago
import {
JobListApi,
getJobSpecialApi,
getProvinceApi,
// getCityApi,
} from "../../api/job";
import { disposeJobListData } from "../../utils/commonUtil";
import recommend from "@/components/FirstJob/components/recommend.vue";
4 years ago
export default {
// 组件名称
name: "",
// 局部注册的组件
4 years ago
components: {
recommend,
},
4 years ago
// 组件参数 接收来自父组件的数据
props: {
isspecialboxshow: {
require: true,
},
},
// 组件状态值
data() {
return {
4 years ago
isspinning: false, // 加载中显示
jobMainList: [], // 职位列表
specialList: [], // 获取的特色列表
4 years ago
formvalue: {
4 years ago
// 筛选的上传参数
district: [],
monthlyPayStr: [],
ageStr: [],
jobSpecialLabelIds: [],
pageNum: 1,
pageSize: 2,
total: null, //分页配置
4 years ago
},
4 years ago
specialactive: [], // 点中的特色标签索引
specialvalue: [], // 点中的特色标签
cityoption: [], // 城市列表
4 years ago
options: {
4 years ago
//
4 years ago
price: [
{
4 years ago
value: "3000-4000",
4 years ago
label: "3000-4000元",
4 years ago
uid: 1,
4 years ago
},
{
4 years ago
value: "4000-5000",
4 years ago
label: "4000-5000元",
4 years ago
uid: 1,
4 years ago
},
{
4 years ago
value: "5000-6000",
4 years ago
label: "5000-6000元",
4 years ago
uid: 1,
4 years ago
},
{
4 years ago
value: "6000-7000",
4 years ago
label: "6000-7000元",
4 years ago
uid: 1,
4 years ago
},
],
age: [
{
4 years ago
value: "16-45",
4 years ago
label: "16-45岁",
4 years ago
uid: 2,
4 years ago
},
{
4 years ago
value: "18-35",
4 years ago
label: "18-35岁",
4 years ago
uid: 2,
4 years ago
},
{
4 years ago
value: "45-58",
4 years ago
label: "45-58岁",
4 years ago
uid: 2,
4 years ago
},
{
4 years ago
value: "58",
4 years ago
label: "58岁以上",
4 years ago
uid: 2,
4 years ago
},
],
},
4 years ago
relationList: [],
4 years ago
};
},
// 计算属性
computed: {},
// 侦听器
watch: {
formvalue: {
handler(e) {
console.log(e);
4 years ago
// 筛选列表数据处理
// if(e.city !== undefined){
if (e.district.length === 0) {
4 years ago
document.getElementById("city").style.width = 105 + "px";
} else {
4 years ago
const data = e.district.join("");
console.log(data);
if (data.length > 6) {
4 years ago
document.getElementById("city").style.width =
(data.length + 4) * 18 + "px";
document.querySelector("#city").nextElementSibling.style.width = // 获取下一个兄弟元素s
(data.length + 4) * 18 + "px";
4 years ago
} else if (data.length > 4) {
4 years ago
document.getElementById("city").style.width =
4 years ago
(data.length + 2.6) * 18 + "px";
4 years ago
document.querySelector("#city").nextElementSibling.style.width =
4 years ago
(data.length + 2.6) * 18 + "px";
4 years ago
} else {
document.getElementById("city").style.width =
4 years ago
(data.length + 2) * 18 + "px";
4 years ago
document.getElementById("city").style.minWidth = 72 + "px";
document.querySelector("#city").nextElementSibling.style.width =
(data.length + 2) * 18 + "px";
}
}
4 years ago
// }
4 years ago
// 工价的判断
4 years ago
if (e.monthlyPayStr.length === 0) {
4 years ago
document.getElementById("price").style.width = 70 + "px";
} else {
4 years ago
const data = e.monthlyPayStr.join("");
4 years ago
if (data.length >= 0) {
document.getElementById("price").style.width = "150px";
document.getElementById("price").nextElementSibling.style.width =
"150px";
// document.querySelector(".ant-cascader-picker-label").style.width =
// "150px";
}
}
// 年龄筛选长度的判断
4 years ago
if (e.ageStr.length === 0) {
4 years ago
document.getElementById("age").style.width = 70 + "px";
} else {
4 years ago
const data = e.ageStr.join("");
4 years ago
if (data.length >= 0) {
document.getElementById("age").style.width = "100px";
document.getElementById("age").nextElementSibling.style.width =
"100px";
// document.querySelector(".ant-cascader-picker-label").style.width =
// "150px";
}
}
},
deep: true,
},
},
4 years ago
// 组件
4 years ago
// 生命周期钩子 注:没用到的钩子请自行删除
/**
* 组件实例创建完成属性已绑定但DOM还未生成$ el属性还不存在
*/
4 years ago
created() {
this.getJobList();
this.getJobSpecial();
this.getProvince();
},
4 years ago
/**
* el 被新创建的 vm.el 替换并挂载到实例上去之后调用该钩子
* 如果 root 实例挂载了一个文档内元素 mounted 被调用时 vm.el 也在文档内
*/
mounted() {
// this.$nextTick(() => {
// console.log(this.isspecialboxshow);
// });
4 years ago
// document.querySelector(".ant-pagination-options-quick-jumper").innerHTML =
// "跳至<input type='text'>页";
4 years ago
},
// 组件方法
methods: {
4 years ago
/**
* 处理后台返回的职位列表
*/
// 获取工作列表
async getJobList() {
this.isspinning = true;
console.log(this.formvalue);
try {
var newdata = {
district: "",
monthlyPayStr: "",
ageStr: "",
jobSpecialLabelIds: "",
pageNum: 1,
pageSize: 2,
total: null, //分页配置
};
for (var k in this.formvalue) {
console.log(this.formvalue[k]);
if (Array.isArray(this.formvalue[k])) {
newdata[k] =
this.formvalue[k].length > 0 ? this.formvalue[k].join() : "";
} else {
newdata[k] = this.formvalue[k];
}
}
console.log(newdata);
// debugger;
const { data } = await JobListApi(newdata);
if (data.status === 200) {
this.jobMainList = disposeJobListData(data.data.recordList);
this.formvalue.total = data.data.recordCount;
console.log(this.jobMainList);
} else {
this.$message.info("数据获取失败");
}
console.log(data);
// = data.data.recordList;
this.isspinning = false;
console.log(this.formvalue);
} catch (error) {
console.log(error);
}
},
4 years ago
onSearch() {},
4 years ago
// 获取职位特色
async getJobSpecial() {
try {
const { data } = await getJobSpecialApi();
console.log(data);
this.specialList = data.data;
} catch (error) {
console.log(error);
}
},
// 获取省份列表
async getProvince() {
// const that = this;
try {
const { data } = await getProvinceApi();
data.data.pop();
this.cityoption = data.data;
// console.log(this.cityoption);
// console.log(data);
} catch (error) {
console.log(error);
}
},
// 筛选职位
onChange(e, item) {
console.log(e);
console.log(item);
if (item) {
if (item.uid === 1) {
console.log(1);
console.log(item[0]);
this.formvalue.monthlyPayStr = item[0];
} else if (item.uid === 2) {
this.formvalue.ageStr = item[0];
} else if (item[0].id) {
console.log(e.join());
this.formvalue.district = e;
}
}
this.getJobList();
},
pageChange(e) {
console.log(e);
this.formvalue.pageNum = e;
this.$refs.pageinput.value = "";
this.getJobList();
},
inputpageChange(e) {
this.formvalue.pageNum = e.target.value;
this.getJobList();
console.log(e);
4 years ago
},
handleChange() {},
claerfilter() {
4 years ago
const { pageNum, pageSize, total } = this.formvalue;
4 years ago
this.formvalue = {
4 years ago
district: [],
monthlyPayStr: [],
ageStr: [],
jobSpecialLabelIds: [],
pageNum,
pageSize,
total, //分页配置
4 years ago
};
4 years ago
console.log(this.formvalue);
4 years ago
this.specialactive = [];
4 years ago
this.specialvalue = [];
this.getJobList();
4 years ago
},
4 years ago
specialclick(index, item) {
console.log(item);
4 years ago
let arrIndex = this.specialactive.indexOf(index);
if (arrIndex > -1) {
this.specialactive.splice(arrIndex, 1);
4 years ago
this.specialvalue.splice(arrIndex, 1);
4 years ago
} else {
this.specialactive.push(index);
4 years ago
this.specialvalue.push(item.id);
4 years ago
}
4 years ago
this.formvalue.jobSpecialLabelIds = this.specialvalue;
// console.log(this.specialactive);
this.getJobList();
console.log(this.specialvalue);
console.log(this.formvalue);
// console.log(index);
4 years ago
},
isspecialboxshowclick() {
this.$emit("update:isspecialboxshow", !this.isspecialboxshow);
},
},
};
</script>
<style scoped lang="less">
/deep/ .navigation {
4 years ago
margin-top: -1px;
4 years ago
background-color: #fff;
border: 1px solid #f6f6f6;
height: 50px;
line-height: 50px;
position: relative;
4 years ago
4 years ago
.special-active {
color: rgb(254, 97, 0) !important;
background-color: rgba(255, 106, 0, 0.1) !important;
}
.ant-cascader-picker-focused {
input {
transition: all 0.3s;
}
input::placeholder {
color: rgb(255, 106, 0) !important;
}
i {
color: rgb(255, 106, 0) !important;
}
}
> .w {
display: flex;
justify-content: start;
.specialbox {
position: absolute;
// display: ;
transition: all 0.4s;
left: 0;
4 years ago
top: 49px;
4 years ago
width: 100vw;
background-color: #fff;
z-index: 999;
ul {
overflow: hidden;
4 years ago
padding: 12px 0 0 0;
4 years ago
li {
padding: 5px 12px;
4 years ago
margin: 0px 24px 10px 0;
4 years ago
cursor: pointer;
float: left;
background: rgba(216, 216, 216, 0.3);
border-radius: 15px;
font-size: 16px;
color: #4d575e;
line-height: 22px;
}
}
}
> ul {
display: flex;
justify-content: start;
li {
// margin-right: 30px;
font-size: 18px;
color: #4d575e;
.ant-cascader-picker {
width: auto;
position: relative;
transform: translateY(-2px);
.ant-cascader-input {
width: 70px;
// margin-top: -5px;
// max-width: 150px !important;
border: none;
padding: 0;
// margin-bottom: 6px;
box-shadow: none;
}
.ant-cascader-input::placeholder {
// width: auto;
// text-indent: 20px;
color: #4d575ecc;
line-height: 20px;
font-size: 18px;
}
span {
// width: 110px;
// max-width: 150px;
color: rgb(255, 106, 0) !important;
font-size: 18px;
padding: 0 20px 0 0;
text-align: left;
line-height: 18px !important;
}
}
}
li:first-child {
> i {
position: relative;
display: inline-block;
width: 18px;
height: 18px;
margin-right: 8px;
font-size: 18px;
color: #4d575ecc;
// margin-top: -9px;
&::before {
position: absolute;
left: 0;
top: -15px;
}
}
.ant-cascader-picker {
width: auto;
position: relative;
.ant-cascader-input {
min-width: 105px;
}
.ant-cascader-input::placeholder {
// width: auto;
color: #4d575ecc;
text-indent: 0;
line-height: 20px;
font-size: 18px;
}
span {
// width: auto;
// max-width: 150px;
// min-width: 140px;
text-align: left;
}
}
}
.special {
position: relative;
div:first-child {
height: 32px;
margin-top: 7px;
line-height: 32px;
color: #4d575ecc;
cursor: pointer;
i {
transition: all 0.2s;
position: relative;
color: #c5c5c5;
margin-left: 5px;
display: inline-block;
font-size: 12px;
transform: translateY(-1px) scale(0.7);
}
.turn {
transform: translateY(-1px) scale(0.7) rotate(180deg);
}
}
}
li:last-child {
position: relative;
color: #8c8d8f;
font-size: 16px;
// color: rgba(78, 88, 95, 0.8);
transform: translateY(-2px);
margin-left: 30px;
4 years ago
a {
transition: all 0.5s;
&:active {
color: rgb(255, 106, 0);
transition: none;
}
}
4 years ago
}
}
}
}
/deep/ .maincontent {
display: flex;
justify-content: space-between;
margin-top: 16px;
.maincontentleft {
width: 914px;
margin-right: 16px;
text-align: left;
4 years ago
.nodata {
overflow: hidden;
height: 100px;
text-align: center;
background-color: #fff;
border-radius: 5px;
margin: 0 auto;
color: #00000066;
margin-bottom: 20px;
p {
position: relative;
transform: translateY(35px);
}
}
4 years ago
.subset {
display: flex;
justify-content: space-between;
width: 914px;
height: 212px;
padding: 20px;
margin-bottom: 16px;
background: #ffffff;
border-radius: 4px;
.subsetleft {
display: flex;
.imgbox {
width: 230px;
height: 172px;
margin-right: 20px;
img {
width: 100%;
height: 100%;
}
}
.jobinfobox {
.jobname {
// margin: 12px 0;
font-size: 20px;
font-weight: 600;
text-align: left;
color: #4d575e;
line-height: 28px;
}
.jobinfo {
margin-top: 16px;
opacity: 0.5;
font-size: 16px;
font-weight: 400;
text-align: left;
color: #4d575e;
line-height: 20px;
}
.jobtag {
margin-top: 12px;
text-align: left;
span:first-child {
4 years ago
color: #ff6a00;
4 years ago
background: rgba(254, 97, 0, 0.1);
}
span {
margin-right: 8px;
font-size: 14px;
padding: 4px 8px;
background: rgba(51, 51, 51, 0.06);
border-radius: 4px;
}
}
.jobpricemonth {
margin-top: 12px;
font-size: 18px;
font-weight: 400;
text-align: left;
color: #4d575e;
line-height: 22px;
}
.jobpricehour {
margin-top: 12px;
font-size: 16px;
font-weight: bold;
text-align: left;
4 years ago
color: #ff6a00;
4 years ago
// line-height: 24px;
span {
vertical-align: baseline;
font-size: 20px;
line-height: 24px;
}
}
}
}
.subsetright {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-end;
.topbox {
width: 116px;
height: 62px;
text-align: center;
background: rgba(255, 106, 0, 0.1);
border-radius: 4px;
4 years ago
color: #ff6a00;
4 years ago
line-height: 30px;
div {
font-weight: bold;
span {
font-size: 20px;
// font-weight: bold;
}
}
div:first-child {
height: 28px;
background: #ff6a00;
line-height: 28px;
font-size: 18px;
color: #ffffff;
border: 1px solid #ff6a00;
border-radius: 4px 4px 0px 0px;
}
}
.bottombox {
button {
width: 72px;
height: 32px;
border: 1px solid rgba(77, 87, 94, 0.3);
border-radius: 4px;
}
4 years ago
a {
button:first-child {
width: 72px;
height: 32px;
border: 1px solid rgba(77, 87, 94, 0.3);
border-radius: 4px;
color: #4d575e;
background-color: #fff;
cursor: pointer;
}
4 years ago
}
button:last-child {
margin-left: 16px;
border: 1px solid #ff6a00;
background-color: #fff;
color: rgba(255, 106, 0, 1);
}
}
}
}
.pagecontainer {
4 years ago
display: flex;
justify-content: center;
4 years ago
text-align: center;
margin-bottom: 30px;
4 years ago
.ant-pagination-options-quick-jumper {
margin-left: 10px;
font-size: 16px;
}
4 years ago
.ant-pagination-disabled {
a:hover {
color: #c5c5c5 !important;
}
}
.ant-pagination-next,
.ant-pagination-prev {
a:hover {
4 years ago
color: #ff6a00;
4 years ago
}
}
input[type="text"] {
box-shadow: none;
&:focus {
4 years ago
border: 1px solid #ff6a006a;
4 years ago
}
&:hover {
4 years ago
border: 1px solid #ff6a006a;
4 years ago
}
}
.ant-pagination-item {
border: none;
a:hover {
4 years ago
color: #ff6a00;
4 years ago
}
}
.ant-pagination-item-active {
4 years ago
background: #ff6a00;
4 years ago
a {
color: white;
}
a:hover {
color: white;
}
}
.ant-pagination-item-link {
border: none;
}
}
}
.maincontentright {
> div {
margin-bottom: 16px;
}
.hotphone {
width: 270px;
height: 106px;
padding: 20px 32px;
border-radius: 4px;
background-color: #fff;
p {
font-size: 24px;
color: #ff6a00;
font-weight: bold;
margin-top: 12px;
}
}
.relationme {
width: 270px;
padding: 20px 40px;
background: #ffffff;
border-radius: 4px;
button {
width: 150px;
height: 32px;
margin-top: 16px;
font-size: 16px;
line-height: 20px;
border-radius: 4px;
border: 0;
background-color: #ff6a00;
color: #fff;
}
}
}
}
</style>