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.
147 lines
4.4 KiB
JavaScript
147 lines
4.4 KiB
JavaScript
|
|
const app = getApp();
|
|
|
|
const commonUtil = require("../../utils/commonUtil.js");
|
|
|
|
Page({
|
|
data: {
|
|
searchForm: {
|
|
brandId: "",
|
|
jobLabelId: "",
|
|
classify: 99,
|
|
pageSize: 100,
|
|
lat: "",
|
|
lng: ""
|
|
},
|
|
jobList: [],
|
|
loading: true,
|
|
noData: false,
|
|
distance: "",
|
|
brandName: ""
|
|
},
|
|
|
|
onLoad(query) {
|
|
var that = this;
|
|
this.data.searchForm.brandId = query.brandId;
|
|
this.data.searchForm.jobLabelId = query.jobLabelId;
|
|
|
|
wx.setStorageSync({
|
|
key: "storeJobId",
|
|
data: -1
|
|
});
|
|
|
|
console.log("相似职位form ↓↓↓↓↓");
|
|
console.log(this.data.searchForm);
|
|
|
|
wx.getSetting({
|
|
success: res => {
|
|
console.log(res); // res.authSetting.location
|
|
|
|
if (res.authSetting.location) {
|
|
wx.getLocation({
|
|
success(res1) {
|
|
console.log("获取位置");
|
|
console.log(res1);
|
|
|
|
if (
|
|
app.isNotEmptyCheck(res1.latitude) &&
|
|
app.isNotEmptyCheck(res1.longitude)
|
|
) {
|
|
that.data.searchForm.lat = res1.latitude;
|
|
that.data.searchForm.lng = res1.longitude;
|
|
}
|
|
|
|
that.getJobList();
|
|
},
|
|
|
|
fail() {
|
|
that.getJobList();
|
|
}
|
|
});
|
|
} else {
|
|
that.getJobList();
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
onShow() {
|
|
// let res = my.getStorageSync({ key: 'storeJobId' }); //详情页返回
|
|
// if (app.isEmptyCheck(res.data)) {
|
|
// this.setData({
|
|
// jobList:[],
|
|
// })
|
|
// }else{
|
|
// my.removeStorageSync({
|
|
// key: 'storeJobId',
|
|
// });
|
|
// }
|
|
},
|
|
|
|
getJobList() {
|
|
var that = this;
|
|
|
|
wx.request({
|
|
url: app.globalData.ip + "/store/job/list",
|
|
method: "POST",
|
|
header: app.globalData.headers,
|
|
data: that.data.searchForm,
|
|
success: function(res) {
|
|
console.log(res);
|
|
|
|
if (app.isNotEmptyCheck(res.data.data)) {
|
|
that.data.brandName = res.data.data.brandName;
|
|
that.data.jobList = res.data.data.jobList;
|
|
that.data.jobList.forEach(item => {
|
|
item["workType"] = commonUtil.getWorkTypeById(
|
|
item.workTypeMulti
|
|
);
|
|
|
|
if (app.isNotEmptyCheck(item.distance)) {
|
|
item["distanceKm"] = commonUtil.getDistanceName(
|
|
item.distance
|
|
);
|
|
}
|
|
|
|
if (app.isNotEmptyCheck(item.district)) {
|
|
var tempArr = item.district.split(",");
|
|
|
|
if (tempArr.length == 1) {
|
|
item.district = tempArr[0];
|
|
} else if (tempArr.length == 2) {
|
|
item.district = tempArr[0] + "" + tempArr[1];
|
|
} else if (tempArr.length > 2) {
|
|
item.district = tempArr[1] + "" + tempArr[2];
|
|
}
|
|
}
|
|
});
|
|
var borderBottomColor = "#eeeeee";
|
|
var title =
|
|
that.data.brandName +
|
|
" " +
|
|
that.data.jobList[0].jobName;
|
|
|
|
wx.setNavigationBarTitle({
|
|
title
|
|
});
|
|
|
|
that.setData({
|
|
jobList: that.data.jobList,
|
|
loading: false
|
|
});
|
|
} else {
|
|
that.setData({
|
|
noData: true
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
goDetail(event) {
|
|
wx.navigateTo({
|
|
url: "../detail/index?storeJobId=" + event.target.dataset.id
|
|
});
|
|
}
|
|
});
|