列表搜索优化

cyl/dev
wangxia 4 years ago
parent a26759f349
commit 0f2185bfb2

@ -76,3 +76,22 @@ export function getPolicyByJobIdApi(data) {
url: `/yishoudan/store/job/getPolicyByStoreJobId?storeJobId=${data}`, url: `/yishoudan/store/job/getPolicyByStoreJobId?storeJobId=${data}`,
}); });
} }
// 获取热门职位城市
export function getHotCityApi() {
return request({
url: `/yishoudan/city/getHotCity`,
});
}
// 获取热门职位城市
export function getCityWhichHasJobApi() {
return request({
url: `/yishoudan/city/getCityHasOnlineJob`,
});
}
// 获取热门企业
export function getHotStoreApi() {
return request({
url: `/yishoudan/store/getHotStore`,
});
}

@ -6,17 +6,9 @@
</div> </div>
</div> --> </div> -->
<!-- 录单弹出框 --> <!-- 录单弹出框 -->
<a-drawer <!-- <a-drawer title="报名" placement="right" :closable="true" :visible="visible" labelAlign="right" width="480" @close="onClose"> -->
title="报名" <!-- <recordbill :visible.sync="visible" :firminfo="apply"></recordbill> -->
placement="right" <!-- </a-drawer> -->
:closable="true"
:visible="visible"
labelAlign="right"
width="480"
@close="onClose"
>
<!-- <recordbill :visible.sync="visible" :firminfo="apply"></recordbill> -->
</a-drawer>
<!-- <a-modal <!-- <a-modal
title="报名" title="报名"
:visible="visible" :visible="visible"
@ -30,6 +22,43 @@
:destroyOnClose="true" :destroyOnClose="true"
> >
</a-modal> --> </a-modal> -->
<!-- 城市的弹出框 -->
<a-modal
class="cityModal"
v-model="visible"
width="680px"
title="请选择城市"
:footer="null"
>
<div class="inputBox">
<a-input
placeholder="请输入城市名称"
allow-clear
width="300px"
v-model="cityValue"
></a-input
><a-button @click="searchCity"></a-button>
</div>
<ul class="firstList">
<li @click="[(currentCity = hotCityList), (activeInd = -1)]">
<div :class="activeInd == -1 ? 'active' : ''">热门地区</div>
</li>
<li
v-for="(item, index) in hasJobCityList.firstList"
:key="index"
@click="[changeCurrentCity(index), (activeInd = index)]"
>
<div :class="activeInd == index ? 'active' : ''">
<span v-for="i in item" :key="i">{{ i }}</span>
</div>
</li>
</ul>
<ul class="currentCity">
<li v-for="(item, index) in currentCity" :key="index">
<div>{{ item.name }}</div>
</li>
</ul>
</a-modal>
<!-- 筛选导航 --> <!-- 筛选导航 -->
<div class="navigation" id="navigation"> <div class="navigation" id="navigation">
<div class="w"> <div class="w">
@ -52,6 +81,8 @@
</div> </div>
<ul class="filterbox"> <ul class="filterbox">
<li> <li>
<!-- @click="visible = true" -->
<i class="iconfont icon-dingwei"></i <i class="iconfont icon-dingwei"></i
><a-cascader ><a-cascader
:options="cityoption" :options="cityoption"
@ -337,11 +368,15 @@ import {
// JobListApi, // JobListApi,
getJobSpecialApi, getJobSpecialApi,
getProvinceApi, getProvinceApi,
getHotCityApi,
getCityWhichHasJobApi,
getHotStoreApi,
// getCityApi, // getCityApi,
} from "../../api/job"; } from "../../api/job";
import { moneyToFixed, getSalaryClassifyValue } from "../../utils/commonUtil"; import { moneyToFixed, getSalaryClassifyValue } from "../../utils/commonUtil";
import recommend from "@/components/FirstJob/components/recommend.vue"; import recommend from "@/components/FirstJob/components/recommend.vue";
import { nationlist } from "../../utils/datalist"; import { nationlist } from "../../utils/datalist";
// import PinYin from '../../utils/ChinesePY'
// import recordbill from "@/components/FirstJob/components/recordbill.vue"; // import recordbill from "@/components/FirstJob/components/recordbill.vue";
export default { export default {
// //
@ -380,6 +415,12 @@ export default {
visible: false, // visible: false, //
confirmLoading: false, // loading confirmLoading: false, // loading
cityoption: [], // cityoption: [], //
hotCityList: [], //
hasJobCityList: {}, //
currentCity: {}, //
cityValue: "", //
activeInd: -1,
hotStoreList: [],
newFormValue: [], newFormValue: [],
apply: "", // id apply: "", // id
proxyinfo: JSON.parse(sessionStorage.getItem("LOGIN_DATA")), proxyinfo: JSON.parse(sessionStorage.getItem("LOGIN_DATA")),
@ -459,8 +500,8 @@ export default {
document.getElementById("city").style.width = document.getElementById("city").style.width =
(result.length + 3) * 14 + "px"; (result.length + 3) * 14 + "px";
document.getElementById("city").style.maxWidth = "210px"; document.getElementById("city").style.maxWidth = "210px";
document.querySelector("#city").nextElementSibling.style.width = // s document.querySelector("#city").nextElementSibling.style.width =
(result.length + 3) * 14 + "px"; (result.length + 3) * 14 + "px"; // s
document.getElementById("city").nextElementSibling.style.maxWidth = document.getElementById("city").nextElementSibling.style.maxWidth =
"210px"; "210px";
} else if (result.length > 5) { } else if (result.length > 5) {
@ -533,6 +574,9 @@ export default {
this.getJobSpecial(); this.getJobSpecial();
this.getProvince(); this.getProvince();
this.getdateinfo(); this.getdateinfo();
this.getHotCity();
this.getCityWhichHasJob();
this.getHotStore();
}, },
/** /**
* el 被新创建的 vm.el 替换并挂载到实例上去之后调用该钩子 * el 被新创建的 vm.el 替换并挂载到实例上去之后调用该钩子
@ -556,6 +600,7 @@ export default {
// // return document.body; // // return document.body;
// }; // };
// }, // },
// //
onSearch(e) { onSearch(e) {
console.log(e); console.log(e);
@ -712,50 +757,50 @@ export default {
// }); // });
}, },
// //
handleCancel() { // handleCancel() {
this.visible = false; // this.visible = false;
this.form = { // this.form = {
// // //
name: "", // name: "",
peoplecard: "", // peoplecard: "",
gender: "", // gender: "",
nation: "", // nation: "",
location: "", // location: "",
firm: "", // firm: "",
post: "", // post: "",
pattern: "", // pattern: "",
policy: "", // policy: "",
proxy: "", // proxy: "",
facedate: "", // facedate: "",
}; // };
}, // },
// //
// //
showmodal(item) { // showmodal(item) {
this.visible = true; // this.visible = true;
this.apply = item; // this.apply = item;
console.log(this.apply); // console.log(this.apply);
// console.log(id); // // console.log(id);
}, // },
onClose() { // onClose() {
console.log(123); // console.log(123);
this.visible = false; // this.visible = false;
this.form = { // this.form = {
// // //
name: "", // name: "",
peoplecard: "", // peoplecard: "",
gender: "", // // gender: "", //
nation: "", // // nation: "", //
location: "", // // location: "", //
firm: "", // // firm: "", //
post: "", // // post: "", //
pattern: "", // // pattern: "", //
policy: "", // // policy: "", //
proxy: "", // // proxy: "", //
facedate: "", // // facedate: "", //
}; // };
}, // },
// //
getdateinfo() { getdateinfo() {
const date = new Date(); const date = new Date();
@ -807,6 +852,89 @@ export default {
getSalaryClassifyValue(salaryClassify, salaryClassifyValue) { getSalaryClassifyValue(salaryClassify, salaryClassifyValue) {
return getSalaryClassifyValue(salaryClassify, salaryClassifyValue); return getSalaryClassifyValue(salaryClassify, salaryClassifyValue);
}, },
async getHotCity() {
try {
const { data } = await getHotCityApi();
console.log(data);
if (data.status == 200) {
this.hotCityList = data.data;
this.currentCity = this.hotCityList;
}
} catch (error) {
console.log(error);
}
},
async getCityWhichHasJob() {
try {
const { data } = await getCityWhichHasJobApi();
console.log(data);
if (data.status == 200) {
let pinyinList = [];
data.data.forEach((item) => {
if (pinyinList.indexOf(item.firstLetter) == -1) {
pinyinList.push(item.firstLetter);
}
});
pinyinList.sort(); //
let firstList = [];
let cityList = [];
let num = -1;
pinyinList.forEach((item, i) => {
if (i % 5 == 0) {
num++;
firstList[num] = [];
}
firstList[num].push(item);
});
firstList.forEach((item, i) => {
cityList[i] = [];
item.forEach((item1) => {
data.data.forEach((item2) => {
if (item2.firstLetter == item1) {
cityList[i].push(item2);
}
});
});
});
this.hasJobCityList.firstList = firstList;
this.hasJobCityList.cityList = cityList;
}
} catch (error) {
console.log(error);
}
},
async getHotStore() {
try {
const { data } = await getHotStoreApi();
console.log(data);
if (data.status == 200) {
this.hotStoreList = data.data;
console.log(this.hotStoreList);
}
} catch (error) {
console.log(error);
}
},
changeCurrentCity(index) {
this.currentCity = this.hasJobCityList.cityList[index];
console.log(index);
},
searchCity() {
if (this.cityValue) {
this.currentCity = [];
this.hotCityList.forEach((item) => {
console.log(item);
console.log(item.name.indexOf(this.cityValue));
if (item.name.indexOf(this.cityValue) > -1) {
console.log(123);
this.currentCity.push(item);
}
});
console.log(this.currentCity);
}
},
// todetail(item) { // todetail(item) {
// const routeURL = this.$router.resolve({ // const routeURL = this.$router.resolve({
// name: "Detail", // name: "Detail",
@ -1569,4 +1697,57 @@ export default {
} }
} }
} }
.cityModal {
.inputBox {
display: flex;
}
.ant-input-affix-wrapper {
flex: 1;
margin-right: 30px;
}
button {
width: 60px;
height: 32px;
}
.firstList {
display: flex;
justify-content: start;
margin: 30px 0;
li {
width: 16.6%;
text-align: center;
div {
width: 60%;
padding-bottom: 5px;
}
.active {
color: #ff6a00;
// position: relative;
// &::after {
// content:'';
// display: block;
// position: absolute;
// height: 2px;
// width: 50px;
// bottom: 0;
// left: 0;
// background-color: #ff6a00;
// }
border-bottom: 2px solid #ff6a00;
}
}
}
.currentCity {
display: flex;
flex-wrap: wrap;
li {
width: 16.6%;
margin-bottom: 20px;
text-align: center;
div {
width: 60%;
}
}
}
}
</style> </style>

File diff suppressed because it is too large Load Diff

@ -25,6 +25,11 @@ const routes = [
name: "JobList", name: "JobList",
component: () => import("../components/FirstJob/joblist.vue"), component: () => import("../components/FirstJob/joblist.vue"),
}, },
{
path: "/list1",
name: "JobList",
component: () => import("../components/FirstJob/joblist1.vue"),
},
{ {
path: "/detail/:id", path: "/detail/:id",
name: "Detail", name: "Detail",

Loading…
Cancel
Save