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.

269 lines
6.8 KiB
JavaScript

2 years ago
const app = getApp();
const commonUtil = require("../../utils/commonUtil.js");
Page({
2 years ago
data: {
2 years ago
recordShow: false,
2 years ago
toped: "1",
recordList: [],
storeJobListSearchForm: {
pageNum: 1,
pageSize: 20,
classify: 1,
sex: -1,
workTypeStr: "",
lat: "",
lng: "",
jobClassify: "",
sortTag: 0,
jobSpecialLabelIds: "",
cityName: "",
brandIds: "",
jobCategoryLabelIds: "",
2 years ago
ujc: 1,
2 years ago
},
loading: true,
hasMoreData: false, //下拉是否还有更多数据
inputShowed: false,
2 years ago
inputVal: "搜索工作",
wxCode: "",
isCollect: false,
collectTxt: "收藏",
searchCityParamStorage: {
name: "",
shortName: "",
},
pageShow: false,
whichOneShow: "",
},
goBack(){
wx.navigateBack({
delta: -1,
})
},
onShow(){
var that = this;
2 years ago
that.setData({
recordList: [],
});
that.getJobList();
2 years ago
},
goDetail(e){
console.log(e);
var that = this;
wx.navigateTo({
url: "../detail/index?storeJobId=" + e.currentTarget.dataset.id + "&wxCode=" + that.data.wxCode,
2 years ago
});
2 years ago
},
2 years ago
getJobList() {
2 years ago
var that = this;
2 years ago
// debugger
2 years ago
that.setData({
2 years ago
pageShow: false,
2 years ago
});
return new Promise(function (resolve, reject) {
wx.showLoading({
title: "加载中...",
});
console.log(that.data.storeJobListSearchForm);
wx.request({
url: app.globalData.ip + "/yishoudan/custom/job/listApp",
method: "POST",
header: app.globalData.headers,
data: that.data.storeJobListSearchForm,
success: function (res) {
console.log("职位列表↓↓↓↓");
console.log(res);
2 years ago
2 years ago
that.setData({
totalPage: res.data.data.pageBean.pageCount,
currPage: res.data.data.pageBean.currentPage,
});
2 years ago
2 years ago
setTimeout(function () {
that.setData({
triggered: false,
});
}, 1000);
if (res.data.data.pageBean.recordList == null || res.data.data.pageBean.recordList.length == 0 || res.data.data.pageBean.recordList.length < that.data.storeJobListSearchForm.pageSize) {
var jobListTemp = commonUtil.disposeJobListData(res.data.data.pageBean.recordList);
that.data.recordList = that.data.recordList.concat(jobListTemp);
2 years ago
2 years ago
that.setData({
recordList: that.data.recordList,
hasMoreData: false,
isTrigger: false,
});
} else {
var jobListTemp = commonUtil.disposeJobListData(res.data.data.pageBean.recordList);
that.data.recordList = that.data.recordList.concat(jobListTemp);
2 years ago
2 years ago
that.setData({
recordList: that.data.recordList,
hasMoreData: true,
isTrigger: false,
});
}
2 years ago
2 years ago
wx.hideLoading({
success: (res) => { },
});
that.setData({
loading: false,
pageShow: true,
storeJobListSearchForm: that.data.storeJobListSearchForm,
});
resolve();
// that.getTag();
2 years ago
2 years ago
that.data.recordList.forEach((item, index) => {
console.log(item.storeDistrict);
item['citys'] = commonUtil.setJobInfoPosition(item.storeDistrict)
// console.log(item);
if (app.isNotEmptyCheck(item.returnFeeType) || item.returnFeeType == "0" || item.returnFee == "0") {
item["fuWuFei"] = commonUtil.getReturnFeeTypeName1ById(item.returnFeeType, item.returnFee);
} else {
item["fuWuFei"] = "";
}
});
that.setData({
recordList: that.data.recordList,
currentJobDrawer: that.data.currentJobDrawer,
});
console.log(that.data.recordList)
// if (that.data.recordList.length < res.data.data.pageBean.recordCount) {
// that.setData({
// hasMoreData: true,
// });
// } else {
// that.setData({
// hasMoreData: false,
// });
// }
},
});
});
2 years ago
},
collectPaste(e) {
2 years ago
var txt;
var that = this;
var collected = e.currentTarget.dataset.collected;
var storeJobId = e.currentTarget.dataset.jobid;
that.doCollected(collected, storeJobId);
},
doCollected(collected, storeJobId) {
var that = this;
2 years ago
var url = "/yishoudan/custom/job/collect/" + storeJobId;
2 years ago
console.log(app.globalData.headers);
//发起网络请求
wx.request({
url: app.globalData.ip + url,
data: {
storeJobId: storeJobId,
},
header: app.globalData.headers,
method: "GET",
success: function (res) {
var txt;
if (collected - 1 == 0) {
//取消收藏
for (var i = 0; i != that.data.recordList.length; ++i) {
if (that.data.recordList[i].id - storeJobId == 0) {
that.data.recordList[i].collected = 2;
break;
}
}
txt = "取消收藏";
if (that.data.choiceCollect == 1) {
that.data.storeJobListSearchForm.pageNum = 1;
that.setData({
recordList: [],
storeJobListSearchForm: that.data.storeJobListSearchForm,
});
that.getJobList();
}
} else {
//收藏
for (var i = 0; i != that.data.recordList.length; ++i) {
if (that.data.recordList[i].id - storeJobId == 0) {
that.data.recordList[i].collected = 1;
break;
}
}
txt = "收藏成功";
}
that.setData({
recordList: that.data.recordList,
});
wx.showToast({
icon: "none",
title: txt,
});
},
fail: function (res) {
console.log("操作失败");
},
});
2 years ago
},
hidedrawershow (e) {
console.log(e);
this.setData({
[e.detail.type]: false
})
wx.showTabBar({
animation: false,
success: (result) => {
},
fail: () => { },
complete: () => { }
});
},
recordBill (e) {
console.log(e.currentTarget.dataset.job);
this.setData({
recordShow: true,
currentInfo: e.currentTarget.dataset.job,
})
console.log(this.data.recordShow);
wx.hideTabBar({
animation: false,
success: (result) => {
},
fail: () => { },
complete: () => { }
});
return
if (!this.data.isLogin) {
wx.navigateTo({
url: "/pages/login/index",
});
return;
}
console.log(e.currentTarget.dataset.job);
console.log(123);
let middleInfo = e.currentTarget.dataset.job;
let info = JSON.stringify({
id: middleInfo.id,
jobName: middleInfo.jobName,
storeName: middleInfo.storeName,
aliasName: middleInfo.aliasName,
storeId: middleInfo.storeId,
});
console.log(info);
wx.navigateTo({
url: `../newEnroll/enroll/index?applyType=1&info=${info}`,
});
// wx.navigateTo({
// url: `../newEnroll/enroll/index?applyType=1&info=${info}`,
// });
},
2 years ago
});