const app = getApp();
const commonUtil = require("../../utils/commonUtil.js");
import { customRequest } from '../../utils/request.js';
Page({
data: {
currCode: '',
toped: "1",
chaShowed: false,
isTrigger: false,
// background: ["../../assets/images/banner1.jpg", "../../assets/images/banner2.jpg", "../../assets/images/banner3.jpg", "../../assets/images/banner4.jpg"],
pullNum: 0, //下拉次数
tabs: [],
activeTab: 0,
systemInfo: {},
getMenuButtonBoundingClientRect: {},
// 手机基础信息
tabs2: [],
loadMore: "",
loadContent: ["马不停蹄加载更多数据中...", "-- 已经到底了,加不了咯 --"],
statusBarHeight: wx.getStorageSync("statusBarHeight"), // 状态栏高度
navigationBarHeight: wx.getStorageSync("navigationBarHeight"), // 导航栏高度
menuButtonHeight: wx.getStorageSync("menuButtonHeight"), // 胶囊按钮高度
menuButton: wx.getStorageSync("menuButtonInfo"), // 胶囊信息
navigatorHeight: 60,
activeTab2: 0,
contentIndex: 0,
latestClass: 0,
zoneClass: 0,
recordList: [],
jobSpecialLabelNames: [],
storeJobListSearchForm: {
pageNum: 1,
pageSize: 20,
classify: 1,
sex: -1,
workTypeStr: "",
lat: "",
lng: "",
jobClassify: "",
sortTag: 0,
jobSpecialLabelIds: "",
cityName: "",
brandIds: "",
jobCategoryLabelIds: "",
ucj: 0,
},
loading: true,
topJobList: [],
hasLocation: false,
chooseActive: false, //筛选是否高亮
labelItems: [],
checkedlabelItems: [],
hasMoreData: true, //下拉是否还有更多数据
inputShowed: false,
inputVal: "",
wxCode: "",
isCollect: false,
collectTxt: "收藏",
isLogin: app.globalData.isLogin,
hasUserInfo: 0,
searchCityParamStorage: {
name: "",
shortName: "",
},
iosDialog1: false,
iosDialog2: false,
phoneDialog: false,
triggered: false,
pageShow: false,
whichOneShow: "",
siv: "",
activez: "zuigao",
sexid: "-1", // 性别筛选的id
dialog1: false,
dialog2: false,
jobSpecialLabelList: [],
brandList: [],
firstMenu: "工价", // 工价筛选tab显示
secondMenu: "性别", // 性别筛选tab显示
selectBrandList: [], // 选中的品牌标签
selectJobList: [], // 选中的特色标签
tagArray0: [],
tagArray1: [],
tagArray2: [],
tagArray3: [],
tagArray4: [],
recordBillType: "", // 报名类型(拍照或者直接报名)
signType: 0, // 职位类型(自营 三方)
recordCount: 0,
totalPage: 0,
currPage: 0,
currentJobDrawer: {}, // 当前简版职位抽屉信息
drawerShow: false, // 简版职位抽屉显隐
posterShow: false, // 海报分享抽屉的显隐
choiceCollect: 0, //收藏的筛选
corpUserFlag: app.globalData.loginUserInfo.corpUserFlag, // 内部成员的判断
agencyStatus: app.globalData.loginUserInfo.agencyStatus, // 是否是代理的判断
serviceInfo: {}, // 代理信息
navigatorBarHeight: 0, // 头部整体高度信息
iosDialog: false, // 成为代理弹窗
isLoading: true, // 成为代理图片加载loading效果
isScrollTop: false, // 控制职位列表的滚动
swiperTextList: ["日结工", "18岁", "电子厂", "短期工", "47岁", "保底", "小时工"], // 关键词轮播的关键词列表
placeholderText: "输入关键词搜索", // 当前关键词
leftShow: false, // 左侧智能匹配抽屉显示
/**
* 滑动相关变量
*/
lastX: 0, //滑动开始x轴位置
lastY: 0, //滑动开始y轴位置
text: "没有滑动",
currentGesture: 0, //标识手势
listPosition: null, // 存储列表当前位置
halfHide: true, // 智能匹配显示一半控制
topNum: 0,
scrollTo: "", // 列表滚动的控制
checkedList: [],
navList: [
{ img: "http://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/ztrt.png", url: "/pages/hotList/index", title: "主推/热推" },
// { img: "http://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/dtld.png",url:'/pages/hotList/index', title: "伯才亮点" },
// { img: "http://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/zjzp.png",url:'/pages/hotList/index', title: "职教职培" },
{ img: "http://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/cwdl.png", url: "/pages/hotList/index", title: "成为代理" },
// { img: "http://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/dzkf.png",url:'/pages/hotList/index', title: "定制开发" },
{ img: "http://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/xmhz.png", url: "/pages/hotList/index", title: "项目合作" },
{ img: "http://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/xtxx.png", url: "/pages/hotList/index", title: "系统消息" },
{ img: "http://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/lxwm.png", url: "/pages/hotList/index", title: "联系我们" },
// { img: "http://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/jqqd.png",url:'/pages/hotList/index', title: "敬请期待" },
],
/**
* 筛选的相关变量
*
*
*/
filterData: {
yanba: [
{
name: "无",
id: 1,
active: 0,
},
{
name: "小面积",
id: 2,
active: 0,
},
{
name: "大面积",
id: 3,
active: 0,
},
],
area: [
{
name: "江浙沪",
id: 1,
active: 0,
},
{
name: "鄂豫皖",
id: 2,
active: 0,
},
{
name: "京津冀",
id: 3,
active: 0,
},
{
name: "晋西北",
id: 4,
active: 0,
},
{
name: "粤桂闽",
id: 5,
active: 0,
},
{
name: "鲁东南",
id: 6,
active: 0,
},
{
name: "黑吉辽",
id: 7,
active: 0,
},
{
name: "疆藏青",
id: 8,
active: 0,
},
{
name: "渝湘赣",
id: 9,
active: 0,
},
{
name: "陕甘宁",
id: 10,
active: 0,
},
{
name: "云贵川",
id: 11,
active: 0,
},
{
name: "港澳台",
id: 12,
active: 0,
},
],
price: [
{
name: "3000-4000",
id: 1,
active: 0,
},
{
name: "4000-5000",
id: 2,
active: 0,
},
{
name: "5000-6000",
id: 3,
active: 0,
},
{
name: "6000-7000",
id: 4,
active: 0,
},
{
name: "7000-8000",
id: 5,
active: 0,
},
{
name: "8000以上",
id: 6,
active: 0,
},
],
sex: [
{
name: "男",
id: 1,
active: 0,
},
{
name: "女",
id: 2,
active: 0,
},
{
name: "男女不限",
id: -1,
active: -1,
},
],
jobFilter: {
tagArray0: [],
tagArray1: [],
tagArray2: [],
tagArray3: [],
tagArray4: [],
},
classifyList: [],
},
copyList: {},
innerFilter: false,
// shareListImg: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/posterbg1.png",
sharelImg: "", // 分享海报基础图片
posterImg: "", // 分享海报生成的图片
shareJobBaseImg: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/poster0106.png", // 分享职位基础图片
shareJobImg: "", // 分享职位生成的图片
userAge: 0,
fangdou: true,
rangeValues: [16, 60],
maxAge: 60,
minAge: 16,
},
// onPullDownRefresh:function(){
// this.getJobList();
// console.log(123);
// wx.stopPullDownRefresh({
// success() {
// app.refreshSuccess();
// }
// });
// },
goLogin () {
wx.setStorageSync("comeFromPage", "firstBill");
wx.navigateTo({
url: "/pages/login/index",
});
},
close () {
let that = this;
let brandList = that.data.brandList;
let selectBrandList = that.data.selectBrandList;
if (selectBrandList.length > 0) {
for (let i = 0; i < brandList.length; i++) {
console.log("level1");
for (let j = 0; j < selectBrandList.length; j++) {
console.log("level2");
if (brandList[i].id == selectBrandList[j].id) {
return (brandList[i].checked = true);
} else {
brandList[i].checked = false;
}
}
}
} else {
brandList.forEach((item) => {
item.checked = false;
});
}
return brandList;
},
closeFix: function () {
var that = this;
// let brandList = that.close()
// that.data.brandList.forEach((item) => {
// if (that.data.selectBrandList.length > 0) {
// that.data.selectBrandList.forEach((item1) => {
// if (item.id != item1.id) {
// console.log("isSame");
// item.checked = false;
// console.log(item.checked);
// } else {
// item.checked = true;
// }
// });
// } else {
// item.checked = false;
// }
// });
// console.log(that.data.brandList);
// console.log(that.data.selectBrandList);
console.log("isout");
},
touchStart (e) {
// console.log("滚起来", e);
// this.setData({
// scrollStop: false
// })
this.setData({
// whichOneShow: mark,
siv: "",
});
},
choosenTop (e) {
var that = this;
// that.data.storeJobListSearchForm.pageNum = 1;
let id = e.currentTarget.dataset.id;
setTimeout(() => {
that.setData({
toped: id,
// isScrollTop: false,
});
}, 0);
// 切换标准 简版 重新查询列表
// that.data.storeJobListSearchForm.pageNum = 1;
// that.setData({
// toped: id,
// recordList: [],
// });
// that.getJobList();
},
chooseNl: function (e) {
var that = this;
console.log(e);
let mark = "";
let type = e.target.dataset.type;
let whichOneShow = that.data.whichOneShow;
if (!that.data.isLogin) {
wx.navigateTo({
url: "/pages/login/index",
});
return;
}
if (type == "gj") {
if (whichOneShow == "gj") {
mark = "";
} else {
mark = "gj";
}
} else if (type == "sex") {
if (whichOneShow == "sex") {
mark = "";
} else {
mark = "sex";
}
} else if (type == "brand") {
if (whichOneShow == "brand") {
mark = "";
} else {
mark = "brand";
}
} else if (type == "special") {
if (whichOneShow == "special") {
mark = "";
} else {
mark = "special";
}
}
if (that.data.siv != "menu") {
setTimeout(() => {
that.setData({
whichOneShow: mark,
// siv:'menu'
});
console.log(this.data.whichOneShow);
}, 0);
that.setData({
siv: "menu",
scrollTo: "sticky",
});
}
this.hideLeft();
},
toSpecialArea: function (e) {
var id = e.currentTarget.dataset.id;
wx.navigateTo({
url: "../specialArea/index?id=" + id,
});
},
chooseM: function (e) {
var str = e.currentTarget.dataset.id;
console.log(str);
this.setData({
activez: str,
});
},
watch () { },
choiceSex (e) {
var that = this;
let data = e.currentTarget.dataset;
that.data.filterData[data.type].forEach((item) => {
item.active = 0;
});
let index = that.data.filterData[data.type].findIndex((item) => {
return item.id == data.id;
});
that.data.filterData[data.type][index].active = data.id;
// let str = that.data.sexid
console.log(e);
let str = e.currentTarget.dataset.id;
console.log(str);
if (str == "1") {
that.data.secondMenu = "男生";
} else if (str == "2") {
that.data.secondMenu = "女生";
} else if (str == "-1") {
that.data.secondMenu = "不限";
}
that.setData({
sexid: str,
secondMenu: this.data.secondMenu,
});
that.data.storeJobListSearchForm.pageNum = 1;
that.data.storeJobListSearchForm.sex = str;
that.setData({
storeJobListSearchForm: that.data.storeJobListSearchForm,
recordList: [],
filterData: that.data.filterData,
innerFilter: true,
});
that.getJobList().then(() => {
that.setData({
siv: "menu",
whichOneShow: "",
});
});
},
onScrollRefresh: function () {
var that = this;
that.data.storeJobListSearchForm.pageNum = 1;
that.setData({
recordList: [],
});
that.getJobList();
// setTimeout(function(){
// that.setData({
// recordList: [],: false,
// })
// },2000);
},
cc: function () { },
close: function () {
this.setData({
dialog1: false,
dialog2: false,
iosDialog1: false,
iosDialog2: false,
phoneDialog: false,
});
},
openIOS1: function () {
this.setData({
iosDialog1: true,
});
},
openIOS2: function () {
this.setData({
iosDialog2: true,
});
},
showphone: function () {
this.setData({
phoneDialog: true,
});
},
searchKey: function (e) {
if (!this.data.isLogin) {
wx.navigateTo({
url: "../login/index",
});
return;
}
console.log(e);
this.data.recordList = [];
this.data.storeJobListSearchForm.pageNum = 1;
this.data.storeJobListSearchForm.keys = this.data.inputVal;
this.getJobList();
},
showInput: function () {
this.setData({
inputShowed: true,
});
},
hideInput: function () {
this.setData({
inputVal: "",
inputShowed: false,
});
},
onShareAppMessage: function () {
// `1231`
// var path = commonUtil.getCurrentPageUrlWithArgs();
// if (app.globalData.isLogin && app.globalData.agencyStatus - 0 != 0) {
// //当前用户是代理人
// path += (path.indexOf("?") >= 0 ? "&" : "?") + "agencyUserId=" + app.globalData.loginUserInfo.id;
// }
if (this.data.checkedList.length == 0) {
throw Error;
} else {
return {
promise: new Promise((resolve, reject) => {
var arr = []
this.data.checkedList.forEach((item) => {
arr.push(item.id)
})
this.getCanvas(this.data.shareJobBaseImg, 'setJob').then((res) => {
console.log(res);
wx.hideLoading();
resolve({
title: '你想找的厂都有,立即查看👇',
imageUrl: res.tempFilePath,
path: '/pages/shareList/index?scene=ids=' + arr.join('_'),
// path: '/pages/shareList/index'
})
// return
});
})
};
}
},
goSearch () {
if (!this.data.isLogin) {
wx.navigateTo({
url: "../login/index",
});
return;
}
wx.navigateTo({
url: `../jobListSearch/index?from=project&listtype=${this.data.toped}&key=${this.data.placeholderText}`,
});
},
clearInput: function () {
this.setData({
inputVal: "",
chaShowed: false,
inputShowed: false,
hasMoreData: true,
recordList: [],
isWannaShow: true,
placeholderText: "请输入关键词",
});
this.inputBlur();
this.data.recordList = [];
this.data.storeJobListSearchForm.pageNum = 1;
this.data.storeJobListSearchForm.keys = "";
this.getJobList();
},
inputTyping: function (e) {
this.setData({
inputVal: e.detail.value,
});
console.log(this.data.inputVal == "");
if (this.data.inputVal == "") {
this.data.recordList = [];
this.data.storeJobListSearchForm.pageNum = 1;
this.data.storeJobListSearchForm.keys = "";
this.getJobList();
}
},
clear () {
wx.clearStorage();
console.log("清除成功");
},
inputBlur () { },
getListByTypeAndIndustry: function () {
var that = this;
customRequest("/labels/getListByTypeAndIndustry", {
header: 'headers', method: 'GET', data: {
type: 90,
industry: 2,
}
}).then((res) => {
wx.setStorageSync("FILTER_LIST", res.data.data);
res.data.data.forEach((item) => {
if (item.typeClassify == "0") {
that.data.tagArray0.push(item);
} else if (item.typeClassify == "1") {
that.data.tagArray1.push(item);
} else if (item.typeClassify == "2") {
that.data.tagArray2.push(item);
} else if (item.typeClassify == "3") {
that.data.tagArray3.push(item);
} else if (item.typeClassify == "4") {
that.data.tagArray4.push(item);
}
});
that.setData({
tagArray0: that.data.tagArray0,
tagArray1: that.data.tagArray1,
tagArray2: that.data.tagArray2,
tagArray3: that.data.tagArray3,
tagArray4: that.data.tagArray4,
});
var jobSpecialLabelIdArray = that.data.storeJobListSearchForm.jobSpecialLabelIds.split(",");
res.data.data.forEach((item) => {
item["checked"] = false;
jobSpecialLabelIdArray.forEach((item1) => {
if (item.id == item1) {
item["checked"] = true;
}
});
});
that.setData({
jobSpecialLabelList: res.data.data,
});
})
// wx.request({
// url: app.globalData.ip + "/labels/getListByTypeAndIndustry",
// data: {
// type: 90,
// industry: 2,
// },
// header: app.globalData.headers,
// method: "GET",
// success: function (res) {
// console.log(res.data.data);
// wx.setStorageSync("FILTER_LIST", res.data.data);
// res.data.data.forEach((item) => {
// if (item.typeClassify == "0") {
// that.data.tagArray0.push(item);
// } else if (item.typeClassify == "1") {
// that.data.tagArray1.push(item);
// } else if (item.typeClassify == "2") {
// that.data.tagArray2.push(item);
// } else if (item.typeClassify == "3") {
// that.data.tagArray3.push(item);
// } else if (item.typeClassify == "4") {
// that.data.tagArray4.push(item);
// }
// });
// that.setData({
// tagArray0: that.data.tagArray0,
// tagArray1: that.data.tagArray1,
// tagArray2: that.data.tagArray2,
// tagArray3: that.data.tagArray3,
// tagArray4: that.data.tagArray4,
// });
// var jobSpecialLabelIdArray = that.data.storeJobListSearchForm.jobSpecialLabelIds.split(",");
// res.data.data.forEach((item) => {
// item["checked"] = false;
// jobSpecialLabelIdArray.forEach((item1) => {
// if (item.id == item1) {
// item["checked"] = true;
// }
// });
// });
// that.setData({
// jobSpecialLabelList: res.data.data,
// });
// },
// });
},
getBrandNameAllList: function () {
var that = this;
customRequest("/labels/type/95", { header: 'headers', method: 'GET', data: {} }).then((res) => {
if (res.data.status == 200) {
if (that.data.storeJobListSearchForm.brandIds) {
var brandIdArray = that.data.storeJobListSearchForm.brandIds.split(",");
}
console.log(res.data.data.labels);
wx.setStorageSync("CLASSIFY_LIST", res.data.data.labels);
res.data.data.labels.forEach((item) => {
item["checked"] = false;
if (brandIdArray) {
brandIdArray.forEach((item1) => {
if (item.id == item1) {
item["checked"] = true;
}
});
}
});
that.setData({
brandList: res.data.data.labels,
});
}
})
// wx.request({
// url: app.globalData.ip + "/labels/type/95", // 分类列表获取接口
// header: app.globalData.headers,
// method: "GET",
// success: function (res) {
// console.log(res);
// if (res.data.status == 200) {
// if (that.data.storeJobListSearchForm.brandIds) {
// var brandIdArray = that.data.storeJobListSearchForm.brandIds.split(",");
// }
// console.log(res.data.data.labels);
// wx.setStorageSync("CLASSIFY_LIST", res.data.data.labels);
// res.data.data.labels.forEach((item) => {
// item["checked"] = false;
// if (brandIdArray) {
// brandIdArray.forEach((item1) => {
// if (item.id == item1) {
// item["checked"] = true;
// }
// });
// }
// });
// that.setData({
// brandList: res.data.data.labels,
// });
// }
// },
// });
// wx.request({x
// url: app.globalData.ip + "/brand/getBrandNameAllList", // 品牌列表获取接口
// data: {},
// header: app.globalData.headers,
// method: "GET",
// success: function (res) {
// console.log(res);
// var brandIdArray = that.data.storeJobListSearchForm.brandIds.split(",");
// res.data.data.forEach((item) => {
// item["checked"] = false;
// brandIdArray.forEach((item1) => {
// if (item.id == item1) {
// item["checked"] = true;
// }
// });
// });
// that.setData({
// brandList: res.data.data,
// });
// },
// });
},
selectJobSpecialLabel: function (e) {
var that = this;
var index = e.currentTarget.dataset.index;
var indexTag = e.currentTarget.dataset.indexTag;
let index1 = "";
console.log(e);
console.log(indexTag);
// debugger;
if (indexTag == "0") {
if (that.data.tagArray0[index].checked) {
that.data.tagArray0[index].checked = false;
// index1 = that.data.selectJobList.indexOf(that.data.tagArray0[index]);
// that.data.selectJobList.splice(index1, 1);
} else {
that.data.tagArray0[index].checked = true;
// that.data.selectJobList.push(that.data.tagArray0[index]);
}
this.setData({
tagArray0: that.data.tagArray0,
});
} else if (indexTag == "1") {
console.log('indexTag == "1"');
if (that.data.tagArray1[index].checked) {
that.data.tagArray1[index].checked = false;
// index1 = that.data.selectJobList.indexOf(that.data.tagArray1[index]);
// that.data.selectJobList.splice(index1, 1);
} else {
that.data.tagArray1[index].checked = true;
// that.data.selectJobList.push(that.data.tagArray1[index]);
}
this.setData({
tagArray1: that.data.tagArray1,
});
} else if (indexTag == "2") {
if (that.data.tagArray2[index].checked) {
that.data.tagArray2[index].checked = false;
// index1 = that.data.selectJobList.indexOf(that.data.tagArray2[index]);
// that.data.selectJobList.splice(index1, 1);
} else {
that.data.tagArray2[index].checked = true;
// that.data.selectJobList.push(that.data.tagArray2[index]);
}
this.setData({
tagArray2: that.data.tagArray2,
});
} else if (indexTag == "3") {
if (that.data.tagArray3[index].checked) {
that.data.tagArray3[index].checked = false;
// index1 = that.data.selectJobList.indexOf(that.data.tagArray3[index]);
// that.data.selectJobList.splice(index1, 1);
} else {
that.data.tagArray3[index].checked = true;
// that.data.selectJobList.push(that.data.tagArray3[index]);
}
this.setData({
tagArray3: that.data.tagArray3,
});
} else if (indexTag == "4") {
if (that.data.tagArray4[index].checked) {
that.data.tagArray4[index].checked = false;
// index1 = that.data.selectJobList.indexOf(that.data.tagArray3[index]);
// that.data.selectJobList.splice(index1, 1);
} else {
that.data.tagArray4[index].checked = true;
// that.data.selectJobList.push(that.data.tagArray3[index]);
}
this.setData({
tagArray4: that.data.tagArray4,
});
}
this.setData({
selectJobList: that.data.selectJobList,
});
// jobSpecialLabelList
// if(that.data.jobSpecialLabelList[index].checked) {
// that.data.jobSpecialLabelList[index].checked = false;
// } else {
// that.data.jobSpecialLabelList[index].checked = true;
// }
// this.setData({
// jobSpecialLabelList: that.data.jobSpecialLabelList
// });
},
selectBrand: function (e) {
var that = this;
let data = e.currentTarget.dataset;
let index = that.data.filterData[data.type].findIndex((item) => {
return item.id == data.id;
});
that.data.filterData[data.type][index].active = data.id;
if (that.data.brandList[data.index].checked) {
that.data.brandList[data.index].checked = false;
// let index1 = that.data.selectBrandList.indexOf(that.data.brandList[index])
// that.data.selectBrandList.splice(index1,1)
} else {
that.data.brandList[data.index].checked = true;
}
console.log(that.data.selectBrandList);
this.setData({
brandList: that.data.brandList,
filterData: that.data.filterData,
});
},
reset: function (e) {
var that = this;
console.log(e);
if (e.target.dataset.type == 1) {
//特色
that.data.jobSpecialLabelList.forEach((item) => {
// console.log(item);
if (item.checked) {
item.checked = false;
}
});
that.setData({
jobSpecialLabelList: that.data.jobSpecialLabelList,
tagArray0: that.data.tagArray0,
tagArray1: that.data.tagArray1,
tagArray2: that.data.tagArray2,
tagArray3: that.data.tagArray3,
selectJobList: [],
whichOneShow: "",
});
that.data.storeJobListSearchForm.jobSpecialLabelIds = "";
} else if (e.target.dataset.type == 2) {
//品牌
that.data.brandList.forEach((item) => {
if (item.checked) {
item.checked = false;
}
});
that.setData({
brandList: that.data.brandList,
selectBrandList: [],
whichOneShow: "",
});
that.data.storeJobListSearchForm.jobCategoryLabelIds = "";
// that.data.storeJobListSearchForm.brandIds = "";
} else if (e.target.dataset.type == 4) {
that.setData({
activez: "",
});
}
that.data.storeJobListSearchForm.pageNum = 1;
that.setData({
recordList: [],
innerFilter: false,
});
that.getJobList();
},
loginOut: function () {
var that = this;
var jobSpecialLabelIdArray = [];
// var brandIdArray = [];
that.data.selectBrandList = [];
that.data.filterData.classifyList.forEach((item) => {
if (item.active) {
if (that.data.selectBrandList.indexOf(item) == -1) {
that.data.selectBrandList.push(item);
}
// brandIdArray.push(item.id);
}
});
that.data.selectJobList = [];
let subArr = that.data.filterData.jobFilter;
let jobList = subArr.tagArray0.concat(subArr.tagArray1, subArr.tagArray2, subArr.tagArray3, subArr.tagArray4);
jobList.forEach((item) => {
if (item.active) {
if (that.data.selectJobList.indexOf(item) == -1) {
that.data.selectJobList.push(item);
}
}
});
// if (brandIdArray.length > 0) {
// // that.data.storeJobListSearchForm.brandIds = brandIdArray.join(",");
// that.data.storeJobListSearchForm.jobCategoryLabelIds = brandIdArray.join(",");
// } else {
// // that.data.storeJobListSearchForm.brandIds = "";
// that.data.storeJobListSearchForm.jobCategoryLabelIds = "";
// }
// that.data.storeJobListSearchForm.pageNum = 1;
that.setData({
// recordList: [],
// siv: "",
// whichOneShow: "",
selectBrandList: that.data.selectBrandList,
selectJobList: that.data.selectJobList,
// innerFilter:true
});
// that.getJobList();
},
onLoad (options) {
var that = this;
console.log(options);
console.log(wx.getSystemInfoSync());
// Array.prototype.logResult = function(){
// console.log('Array');
// }
// this.setData({
// placeholderText: this.data.swiperTextList[0],
// });
// if (options.listtype) {
// this.setData({
// toped: options.listtype,
// });
// }
let arr = [];
arr.logResult();
console.log(arr.logResult(123));
console.log(Array.__proty__);
console.log(options);
console.log(that.data.menuButton);
// let query = wx.createSelectorQuery()
// console.log(query.select('#searchBar'));
console.log(app.globalData.isLogin);
console.log();
this.getListByTypeAndIndustry();
this.getBrandNameAllList();
// 查看是否授权
wx.getSetting({
success (res) {
if (res.authSetting["scope.userInfo"]) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称
wx.getUserInfo({
success: function (res) {
console.log(res.userInfo);
},
});
}
},
});
// if (app.isNotEmptyCheck(options.fromSearchPage) && options.fromSearchPage == 1) {
// try {
// var searchCityParamStorage = wx.getStorageSync("searchCityParamStorage");
// if (searchCityParamStorage) {
// console.log("searchCityParamStorage======", searchCityParamStorage);
// that.data.storeJobListSearchForm.cityName = searchCityParamStorage.name;
// if (app.isEmptyCheck(searchCityParamStorage.name)) {
// that.data.storeJobListSearchForm.cityName = "全国";
// }
// that.setData({
// searchCityParamStorage: searchCityParamStorage,
// });
// }
// } catch (e) {
// console.log("获取缓存设置的查询职位列表参数错误:", e);
// }
// } else {
// try {
// wx.removeStorageSync("searchJobListParamStorage");
// } catch (e) {
// console.log("删除缓存设置的查询职位列表参数错误:", e);
// }
// try {
// wx.removeStorageSync("searchCityParamStorage");
// } catch (e) {
// console.log("删除缓存设置的查询职位列表参数错误:", e);
// }
// }
console.log("options==============================1");
console.log(options);
console.log("options==============================2");
if (app.isNotEmptyCheck(options.scene)) {
//扫小程序码携带参数
var sceneStr = decodeURIComponent(options.scene);
var sceneJson = commonUtil.sceneToJson(sceneStr);
console.log("sceneJson===", sceneJson);
if (sceneJson.fromType == 1) {
app.globalData.isCommission = 1;
wx.setStorageSync("storageSyncAgencyUserId", sceneJson.userId);
}
//先设置代理人缓存人再登录
app.getLoginUserTokenInfo();
} else if (app.isNotEmptyCheck(options.fromType)) {
//扫小程序普通二维码携带参数-来源ID
console.log("options.fromType========" + options.fromType);
if (options.fromType == 0) {
console.log("options.id========" + options.id);
console.log("options.userId========" + options.userId);
try {
app.globalData.isCommission = 1;
wx.setStorageSync("fromQrCodeChannelContactId", options.id);
that.getAgencyUserId(options.id);
} catch (e) {
console.log("0-扫描微信二维码,设置参数错误:", e);
}
} else if (options.fromType.indexOf("0&id=") >= 0) {
//兼容2021-9-9之前的二维码
var paramsTempId = options.fromType.replace("0&id=", "");
console.log("¶msTempId========" + paramsTempId);
try {
app.globalData.isCommission = 1;
wx.setStorageSync("fromQrCodeChannelContactId", paramsTempId);
that.getAgencyUserId(paramsTempId);
} catch (e) {
console.log("0-扫描微信二维码,设置参数错误:", e);
}
} else {
//兼容2021-9-9之前的二维码
var paramsTempId = options.fromType.replace("0,id=", "");
console.log("=paramsTempId========" + paramsTempId);
try {
app.globalData.isCommission = 1;
wx.setStorageSync("fromQrCodeChannelContactId", paramsTempId);
that.getAgencyUserId(paramsTempId);
} catch (e) {
console.log("0-扫描微信二维码,设置参数错误:", e);
}
}
} else {
console.log("options.fromType===else=====" + options);
}
//this.wxLogin();
let res = wx.getStorageSync("storeJobId"); //详情页返回
console.log(res);
if (app.isEmptyCheck(res.data)) {
this.setData({
recordList: [],
});
} else {
wx.removeStorageSync({
key: "storeJobId",
});
}
console.log("on show");
//登录=================================start
if (app.globalData.isLogin) {
this.setData({
isLogin: app.globalData.isLogin,
hasUserInfo: app.globalData.hasUserInfo,
agencyStatus: app.globalData.loginUserInfo.agencyStatus,
corpUserFlag: app.globalData.loginUserInfo.corpUserFlag,
userInfo: app.globalData.loginUserInfo,
serviceInfo: app.globalData.serviceInfo,
isLoading: true,
});
} else {
// 由于 userLogin 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
// app.userLoginCallback = (res) => {
// this.setData({
// isLogin: app.globalData.isLogin,
// hasUserInfo: app.globalData.hasUserInfo,
// agencyStatus: app.globalData.loginUserInfo.agencyStatus,
// corpUserFlag: app.globalData.loginUserInfo.corpUserFlag,
// userInfo: app.globalData.loginUserInfo,
// serviceInfo: app.globalData.serviceInfo,
// });
// console.log(that.data.serviceInfo);
// };
// console.log(that.data.serviceInfo);
}
//登录=================================end
this.getHopeJobLabels();
var reset = true;
let agencyUserId = options.agencyUserId;
if (agencyUserId) {
wx.setStorageSync("storageSyncAgencyUserId", agencyUserId);
console.log("agencyUserId", agencyUserId);
app.globalData.isCommission = 1;
}
app.getLoginUserTokenInfo();
// this.getJobList();
if (wx.getStorageSync("FILTER_LIST")) {
let list = wx.getStorageSync("FILTER_LIST");
list.forEach((item) => {
item.active = 0;
if (item.typeClassify == "0") {
this.data.filterData.jobFilter["tagArray0"].push(item);
} else if (item.typeClassify == "1") {
this.data.filterData.jobFilter["tagArray1"].push(item);
} else if (item.typeClassify == "2") {
this.data.filterData.jobFilter["tagArray2"].push(item);
} else if (item.typeClassify == "3") {
this.data.filterData.jobFilter["tagArray3"].push(item);
} else if (item.typeClassify == "4") {
this.data.filterData.jobFilter["tagArray4"].push(item);
}
});
let jobFilter = "filterData.jobFilter";
this.setData({
[jobFilter]: this.data.filterData.jobFilter,
});
}
if (wx.getStorageSync("CLASSIFY_LIST")) {
this.data.filterData.classifyList = wx.getStorageSync("CLASSIFY_LIST");
this.data.filterData.classifyList.forEach((item) => {
item.active = 0;
});
let classifyList = "filterData.classifyList";
this.setData({
[classifyList]: this.data.filterData.classifyList,
});
}
this.setData({
copyList: JSON.parse(JSON.stringify(this.data.filterData)),
});
that.getJobList();
// that.searchAnimate();
},
onReady () {
let that = this;
var query = wx.createSelectorQuery();
query.select(".navigator").boundingClientRect();
query.exec(function (res) {
//res就是 所有标签为v1的元素的信息 的数组
// console.log(res);
//取高度s
// console.log(res[0].height);
// that.setData({
// navigatorBarHeight: res[0].height + 15,
// });
});
},
/**
* 智能匹配结束
*
*
*
*/
/**
* 筛选标签的点击
*
*
*/
setActive (e) {
console.log(e);
let data = e.currentTarget.dataset;
if (data.type == "yanba" || data.type == "sex" || data.type == "price") {
console.log(data.id);
let index = this.data.filterData[data.type].findIndex((item) => {
return item.id == data.id;
});
if (this.data.filterData[data.type][index].active == data.id) {
this.data.filterData[data.type][index].active = 0;
} else {
this.data.filterData[data.type].forEach((item) => {
item.active = 0;
});
this.data.filterData[data.type][index].active = data.id;
}
this.setData({
filterData: this.data.filterData,
});
} else if (data.type != "jobFilter") {
this.data.filterData[data.type].forEach((item) => {
if (item.id == data.id) {
if (item.active == data.id) {
item.active = 0;
} else {
item.active = data.id;
}
}
});
console.log(this.data.filterData[data.type]);
} else {
this.data.filterData[data.type][data.arr].forEach((item) => {
if (item.id == data.id) {
if (item.active == data.id) {
item.active = 0;
} else {
item.active = data.id;
}
}
});
}
this.setData({
filterData: this.data.filterData,
});
},
/**
* 清除筛选信息
*
*
*/
clearFilter1 (e) {
let middleList = JSON.parse(JSON.stringify(this.data.copyList));
let type = e.currentTarget.dataset.type;
let filterData = this.data.filterData;
console.log(type);
if (type == 2) {
filterData = { ...filterData, classifyList: middleList.classifyList };
this.setData({
selectBrandList: [],
userAge: 0,
});
} else if (type == 1) {
filterData = { ...filterData, jobFilter: middleList.jobFilter };
this.setData({
selectJobList: [],
userAge: 0,
});
} else if (type == "outerClear") {
filterData = middleList;
this.setData({
selectJobList: [],
selectBrandList: [],
firstMenu: "工价",
secondMenu: "不限",
sexid: -1,
rangeValues: [16, 60],
maxAge: 60,
minAge: 16,
activez: "zuigao",
innerFilter: false,
});
} else if (type == "innerclear") {
filterData = middleList;
this.setData({
selectJobList: [],
selectBrandList: [],
firstMenu: "工价",
secondMenu: "不限",
sexid: -1,
rangeValues: [16, 60],
maxAge: 60,
minAge: 16,
activez: "zuigao",
innerFilter: false,
});
}
console.log(filterData);
this.setData({
filterData,
leftShow: false,
recordList: [],
whichOneShow: "",
scrollTo: "sticky",
});
if (this.data.choiceCollect == 0) {
this.data.storeJobListSearchForm.ucj = 0;
} else {
this.data.storeJobListSearchForm.ucj = 1;
}
this.toList();
// this.getJobList();
},
deleteMark (e) {
// console.log(e);
console.log(e);
let data = e.currentTarget.dataset.item;
let filter = this.data.filterData;
// if(e.currentTarget.dataset.item){
// 判断是否是标签筛选项
this.data.storeJobListSearchForm.pageNum = 1;
if (data.hasOwnProperty("typeClassify")) {
console.log(e);
this.data.selectJobList.forEach((item, index) => {
if (item.id == data.id) {
this.data.selectJobList.splice(index, 1);
let ind = filter.jobFilter["tagArray" + data.typeClassify].indexOf(item);
console.log(filter.jobFilter["tagArray" + data.typeClassify][ind]);
filter.jobFilter["tagArray" + data.typeClassify][ind].active = 0;
// let ind = filter.classifyList.indexOf(item);
// console.log(filter.classifyList[ind]);
// filter.classifyList[ind].active = false;
this.toList();
}
});
this.setData({
selectJobList: this.data.selectJobList,
filterData: this.data.filterData,
});
} else {
this.data.selectBrandList.forEach((item, index) => {
if (item.id == data.id) {
this.data.selectBrandList.splice(index, 1);
// let ind = filter.jobFilter["tagArray" + data.typeClassify].indexOf(item);
// console.log(filter.jobFilter["tagArray" + data.typeClassify][ind]);
// filter.jobFilter["tagArray" + data.typeClassify][ind].active = 0;
let ind = filter.classifyList.indexOf(item);
console.log(filter.classifyList[ind]);
filter.classifyList[ind].active = 0;
this.toList();
}
});
this.setData({
selectBrandList: this.data.selectBrandList,
filterData: this.data.filterData,
});
}
// }
},
deletePaixu (e) {
console.log(e);
let that = this;
// let data = e.currentTarget.dataset.item;
this.data.storeJobListSearchForm.sortTag = 0;
that.data.storeJobListSearchForm.pageNum = 1;
this.setData({
firstMenu: "工价",
activez: "zuigao",
});
this.toList();
},
deleteSex () {
let filter = this.data.filterData;
this.data.storeJobListSearchForm.pageNum = 1;
filter.sex[2].active = -1;
filter.sex[1].active = 0;
this.setData({
filterData: this.data.filterData,
});
this.toList();
},
/**
* 范围选择年龄的回调
*
*
*/
onRangeChange (e) {
let maxAge = Math.floor(e.detail.maxValue) + "";
let minAge = Math.floor(e.detail.minValue) + "";
console.log(maxAge, minAge);
this.setData({
rangeValues: [minAge, maxAge],
maxAge,
minAge,
});
},
sliderChange (e) {
// console.log(e);
// console.log('页面',e.detail);
this.data.userAge = e.detail.value;
if (this.data.fangdou) {
this.data.fangdou = false;
this.setData({
userAge: e.detail.value,
});
setTimeout(() => {
this.data.fangdou = true;
}, 10);
}
},
/**
* 点击确认按钮
*
*
*/
toList () {
let that = this;
let innerFilter = false;
console.log(this.data.filterData);
let formSearch = { pageNum: 1, pageSize: 20 };
let filter = this.data.filterData;
for (var k in filter) {
if (k != "jobFilter") {
let jobCategoryArr = [];
filter[k].forEach((item) => {
if (item.active != 0) {
if (k == "price") {
if (item.name == "8000以上") {
formSearch.monthlyPayStr = "8001-20000";
} else {
formSearch.monthlyPayStr = item.name;
}
} else if (k == "sex") {
formSearch.sex = item.id;
if (item.id == -1) {
this.data.secondMenu = "不限";
} else if (item.id == 1) {
this.data.secondMenu = "男生";
innerFilter = true;
} else if (item.id == 2) {
this.data.secondMenu = "女生";
innerFilter = true;
}
this.setData({
sexid: item.id,
secondMenu: this.data.secondMenu,
});
} else if (k == "classifyList") {
jobCategoryArr.push(item.id);
if (jobCategoryArr.length > 0) {
innerFilter = true;
}
}
}
});
formSearch.jobCategoryLabelIds = jobCategoryArr.join();
} else {
let totalArr = [...filter["jobFilter"].tagArray0, ...filter["jobFilter"].tagArray1, ...filter["jobFilter"].tagArray2, ...filter["jobFilter"].tagArray3, ...filter["jobFilter"].tagArray4];
let jobSpecialArr = [];
console.log(totalArr);
totalArr.forEach((item) => {
if (item.active != 0) {
jobSpecialArr.push(item.id);
}
});
console.log(jobSpecialArr);
if (jobSpecialArr.length > 0) {
innerFilter = true;
}
console.log(jobSpecialArr.join(","));
formSearch.jobSpecialLabelIds = jobSpecialArr.join(",");
}
}
console.log(formSearch);
that.data.storeJobListSearchForm = { ...that.data.storeJobListSearchForm, ...formSearch, ageRangeStr: that.data.minAge + "-" + that.data.maxAge };
if (this.data.choiceCollect == 0) {
that.data.storeJobListSearchForm.ucj = 0;
} else {
that.data.storeJobListSearchForm.ucj = 1;
}
console.log(that.data.storeJobListSearchForm);
that.setData({
recordList: [],
leftShow: false,
innerFilter,
whichOneShow: "",
storeJobListSearchForm: that.data.storeJobListSearchForm,
});
that.loginOut();
that.getJobList();
},
/**
* 智能匹配结束
*
*
*/
onTabClick (e) {
const index = e.detail.index;
this.setData({
activeTab: index,
});
},
onChange (e) {
const index = e.detail.index;
this.setData({
activeTab: index,
});
},
findLocation () {
var that = this;
wx.getLocation({
type: "gcj02",
success (res1) {
console.log("获取位置2");
console.log(res1);
app.globalData.lng = res1.longitude;
app.globalData.lat = res1.latitude;
},
fail () { },
});
},
emptyMethod (e) {
console.log(e);
},
chooseIdCard () {
var that = this;
if (that.data.agencyStatus != 1) {
this.setData({
iosDialog: true,
});
return;
}
wx.chooseImage({
count: 1,
sizeType: ["original", "compressed"],
sourceType: ["album", "camera"],
success (res) {
console.log(res);
wx.navigateTo({
url: `../newEnroll/enroll/index?applyType=1&imgUrl=${res.tempFilePaths[0]}`,
});
// that.uploadIdcardImg(res);
},
});
},
navigatorToRecord () {
if (this.data.agencyStatus != 1) {
this.setData({
iosDialog: true,
});
return;
}
wx.navigateTo({
url: `../newEnroll/enroll/index?applyType=1`,
});
},
PageScroll (e) {
let that = this;
const query = wx.createSelectorQuery().in(this);
query
.select(".sticky")
.boundingClientRect(function (res) {
// console.log(res);
if (res.top <= 5) {
that.setData({
isScrollTop: true,
});
} else if (res.top > 0 && res.top < 90) {
that.setData({
isScrollTop: false,
});
} else if (res.top >= 90) {
that.setData({
isScrollTop: false,
});
}
})
.exec();
},
onShow () {
let that = this;
that.data.storeJobListSearchForm.pageNum = 1;
// wx.showTabBar({
// success(e) {},
// });
// let index = 1;
// that.setData({
// placeholderText: that.data.swiperTextList[0],
// });
// setInterval(() => {
// that.data.placeholderText = that.data.swiperTextList[index % that.data.swiperTextList.length];
// that.setData({
// placeholderText: that.data.placeholderText,
// });
// index++;
// }, 5000);
if (app.globalData.templateList) {
app.globalData.templateList.forEach((element) => {
console.log(element);
if (element.title == "伯才小程序首页海报分享封面") {
this.setData({
sharelImg: element.img,
});
console.log(this.data.sharelImg);
}
});
}
if (wx.getStorageSync("FROMCITY")) {
try {
var searchCityParamStorage = wx.getStorageSync("searchCityParamStorage");
if (searchCityParamStorage) {
console.log("searchCityParamStorage======", searchCityParamStorage);
// that.data.storeJobListSearchForm.cityName = searchCityParamStorage.name;
// if (app.isEmptyCheck(searchCityParamStorage.name)) {
// that.data.storeJobListSearchForm.cityName = "全国";
// }
that.setData({
searchCityParamStorage: searchCityParamStorage,
storeJobListSearchForm: that.data.storeJobListSearchForm,
});
that.setData({
recordList: [],
});
this.getJobList();
}
} catch (e) {
console.log("获取缓存设置的查询职位列表参数错误:", e);
}
wx.removeStorageSync("FROMCITY");
} else {
if (that.data.choiceCollect == 1) {
that.setData({
recordList: [],
});
that.getJobList();
}
}
if (typeof this.getTabBar === "function" && this.getTabBar()) {
this.getTabBar().setData({
selected: 0,
});
}
wx.setStorageSync("comeFromPage", "index");
this.setData({
storeJobListSearchForm: that.data.storeJobListSearchForm,
isLogin: app.globalData.isLogin,
iosDialog2: app.globalData.isLogin ? false : that.data.iosDialog2,
recordBillType: "",
});
console.log(app.globalData);
setTimeout(() => {
if (app.globalData.isLogin) {
that.setData({
agencyStatus: app.globalData.loginUserInfo.agencyStatus,
corpUserFlag: app.globalData.loginUserInfo.corpUserFlag,
userInfo: app.globalData.loginUserInfo,
serviceInfo: app.globalData.serviceInfo,
});
console.log(app.globalData.loginUserInfo);
} else {
that.setData({
serviceInfo: app.globalData.serviceInfo,
});
this.wxLogin();
}
}, 100);
console.log(app.globalData.headers);
// if (that.data.inputVal != "搜索工作") {
// console.log(that.data.inputVal);
// that.setData({
// recordList: [],
// });
// that.getJobList();
// }
wx.removeStorage({
key: "townsManInfo",
});
wx.removeStorage({
key: "townsManInfoJob",
});
/*this.wxLogin();
let res = wx.getStorageSync({
key: "storeJobId"
}); //详情页返回
if (app.isEmptyCheck(res.data)) {
this.setData({
recordList: []
});
} else {
wx.removeStorageSync({
key: "storeJobId"
});
}
console.log("on show");
this.getHopeJobLabels();
var reset = true;*/
},
collectedStoreJobList () {
var that = this;
customRequest("/store/job/collected/list?ucj=1", { header: 'headers', method: 'GET', data: {} }).then((res) => {
let collectList = res.data.data.recordList;
let jobs = that.data.recordList;
if (collectList != null && collectList != "" && collectList != undefined && collectList.length != 0 && jobs != null && jobs != "" && jobs != undefined && jobs.length != 0) {
for (var j = 0; j != jobs.length; ++j) {
jobs[j].collected = 2;
}
for (var i = 0; i != collectList.length; ++i) {
for (var j = 0; j != jobs.length; ++j) {
if (collectList[i].storeJobId - jobs[j].id == 0) {
jobs[j].collected = 1;
break;
}
}
}
that.setData({
recordList: jobs,
});
}
})
// wx.request({
// url: app.globalData.ip + "/store/job/collected/list?ucj=1",
// method: "GET",
// data: {},
// header: app.globalData.headers,
// success: function (res) {
// console.log(res);
// let collectList = res.data.data.recordList;
// let jobs = that.data.recordList;
// if (collectList != null && collectList != "" && collectList != undefined && collectList.length != 0 && jobs != null && jobs != "" && jobs != undefined && jobs.length != 0) {
// for (var j = 0; j != jobs.length; ++j) {
// jobs[j].collected = 2;
// }
// for (var i = 0; i != collectList.length; ++i) {
// for (var j = 0; j != jobs.length; ++j) {
// if (collectList[i].storeJobId - jobs[j].id == 0) {
// jobs[j].collected = 1;
// break;
// }
// }
// }
// that.setData({
// recordList: jobs,
// });
// }
// },
// fail: function (res) { },
// });
},
getHopeJobLabels () {
var that = this;
customRequest("/labels/findAllHopeJobLabels", { header: 'headers', method: 'GET', data: {} }).then((res0) => {
if (res0.data.data != null) {
res0.data.data.forEach((item, index) => {
item["title"] = item.name;
item["checked"] = false;
if (index == 0 || index == 1) {
item["checked"] = true;
}
});
}
that.setData({
labelItems: res0.data.data == null ? [] : res0.data.data,
});
that.initData();
}).catch(() => {
wx.showToast({
title: "获取失败",
icon: "none",
duration: 2000,
});
})
// wx.request({
// url: app.globalData.ip + "/labels/findAllHopeJobLabels",
// // ?category=4
// method: "GET",
// data: {},
// success: function (res0) {
// console.log("感兴趣职位 ↓↓↓");
// console.log(res0);
// if (res0.data.data != null) {
// res0.data.data.forEach((item, index) => {
// item["title"] = item.name;
// item["checked"] = false;
// if (index == 0 || index == 1) {
// item["checked"] = true;
// }
// });
// }
// that.setData({
// labelItems: res0.data.data == null ? [] : res0.data.data,
// });
// that.initData();
// console.log("感兴趣职位 赋值title↓↓↓");
// console.log(res0);
// },
// fail: function (res) {
// console.log(res);
// wx.showToast({
// title: "获取失败",
// icon: "none",
// duration: 2000,
// });
// },
// });
},
makePhoneCall () {
var that = this;
wx.makePhoneCall({
phoneNumber: "13937184434",
});
},
goScreen () {
wx.navigateTo({
url: "../screen/index",
});
},
goCity () {
let that = this;
if (!that.data.isLogin) {
wx.navigateTo({
url: "/pages/login/index",
});
return;
}
wx.navigateTo({
url: "../city/index?isCity=" + that.data.isCity,
});
},
initData () {
var that = this;
try {
// 获取手机基础信息(头状态栏和标题栏高度)
let systemInfo = wx.getSystemInfoSync();
let getMenuButtonBoundingClientRect = wx.getMenuButtonBoundingClientRect();
console.log(wx.getMenuButtonBoundingClientRect());
this.setData({
systemInfo,
getMenuButtonBoundingClientRect,
});
} catch (e) {
console.log(e);
wx.alert({
title: "温馨提示",
content: "onLoad 执行异常",
});
}
let res0 = wx.getStorageSync("checkedlabelItems");
console.log(app.isNotEmptyCheck(res0.data));
that.data.tabs2 = [
{
name: "打勾推荐",
category: -1,
id: 406,
checked: true,
title: "打勾推荐",
},
];
if (app.isNotEmptyCheck(res0.data)) {
for (var i = 0; i < res0.data.length; i++) {
res0.data[i]["title"] = res0.data[i].name;
// that.data.tabs2.push(res0.data[i]);
}
console.log("获取缓存"); // res0.data.unshift();
// console.log(res.data.unshift({name: "打勾推荐", category: 3, id: 406, checked: true, title: "打勾推荐"}));
} else {
console.log("无感兴趣职位 push两个职位 ↓↓↓");
console.log(that.data.labelItems);
that.data.labelItems.forEach((item) => {
if (item.name == "理货员" || item.name == "餐饮服务员") {
// that.data.tabs2.push(item);
}
}); // that.data.tabs2.push(that.data.labelItems[0], that.data.labelItems[1])
}
that.setData({
tabs2: that.data.tabs2,
});
let res = wx.getStorageSync("sex"); //性别
if (app.isNotEmptyCheck(res.data)) {
that.data.storeJobListSearchForm.sex = res.data;
that.data.storeJobListSearchForm.pageNum = 1;
} else {
// res.data = [];
}
let res2 = wx.getStorageSync("checkedJobItems"); //筛选职位
let workTypeStrCurr = "";
if (app.isNotEmptyCheck(res2.data)) {
res2.data.forEach((item, index) => {
workTypeStrCurr += item.value + ",";
});
if (workTypeStrCurr.length > 0) {
workTypeStrCurr = workTypeStrCurr.substr(0, workTypeStrCurr.length - 1);
}
that.data.storeJobListSearchForm.workTypeStr = workTypeStrCurr;
that.data.storeJobListSearchForm.pageNum = 1;
} else {
that.data.storeJobListSearchForm.workTypeStr = "";
that.data.storeJobListSearchForm.pageNum = 1;
}
console.log(res.data + "===" + res2.data);
if (res.data == -1 && (res2.data == null || res2.data == "")) {
that.setData({
chooseActive: false,
});
} else {
that.setData({
chooseActive: true,
});
}
// this.getJobList();
},
getJobList () {
var that = this;
// debugger
that.setData({
pageShow: false,
});
return new Promise(function (resolve, reject) {
if (that.data.storeJobListSearchForm.sortTag == 2) {
//如果按照距离排序,拼接上坐标
that.data.storeJobListSearchForm.lng = app.globalData.lng;
that.data.storeJobListSearchForm.lat = app.globalData.lat;
}
console.log(that.data.searchCityParamStorage.isCity);
if (that.data.searchCityParamStorage.isCity) {
if (that.data.searchCityParamStorage.isCity == true) {
that.data.storeJobListSearchForm.cityName = that.data.searchCityParamStorage.name;
} else if (that.data.searchCityParamStorage.isCity == false) {
that.data.storeJobListSearchForm.provinceName = that.data.searchCityParamStorage.name;
}
that.setData({
isCity: that.data.searchCityParamStorage.isCity,
});
}
if (app.isEmptyCheck(that.data.searchCityParamStorage.name)) {
that.data.storeJobListSearchForm.cityName = "全国";
}
that.data.storeJobListSearchForm.keys = that.data.inputVal == "搜索工作" ? "" : that.data.inputVal;
// debugger;
wx.showLoading({
title: "加载中...",
});
console.log(that.data.storeJobListSearchForm);
// that.data.storeJobListSearchForm.jobSpecialLabelIds = that.data.storeJobListSearchForm.jobSpecialLabelIds != "" ? that.data.storeJobListSearchForm.jobSpecialLabelIds + ",608" : that.data.storeJobListSearchForm.jobSpecialLabelIds + "608";
console.log(that.data.storeJobListSearchForm);
// /yishoudan/store/job/platform/list
// /overall/store/job/list
customRequest("/yishoudan/store/job/platform/list", { header: 'headers', method: 'POST', data: that.data.storeJobListSearchForm }).then((res) => {
console.log('res',res);
let data = res.data.data.pageBean
that.setData({
totalPage: data.pageCount,
currPage: data.currentPage,
});
setTimeout(function () {
that.setData({
triggered: false,
});
}, 1000);
if (data.recordList == null || data.recordList.length == 0 || data.recordList.length < that.data.storeJobListSearchForm.pageSize) {
var jobListTemp = commonUtil.disposeJobListData(data.recordList);
that.data.recordList = that.data.recordList.concat(jobListTemp);
that.setData({
hasMoreData: false,
});
} else {
var jobListTemp = commonUtil.disposeJobListData(data.recordList);
that.data.recordList = that.data.recordList.concat(jobListTemp);
that.setData({
hasMoreData: true,
});
}
wx.hideLoading({
success: (res) => { },
});
that.setData({
loading: false,
pageShow: true,
storeJobListSearchForm: that.data.storeJobListSearchForm,
isTrigger: false,
});
resolve();
that.getTag();
that.data.recordList.forEach((item, index) => {
// console.log(item);
if (app.isNotEmptyCheck(item.logo)) {
item["logo"] = item.logo.indexOf("https") > -1 ? item.logo : item.logo.replace("http:", "https:");
}
if (app.isNotEmptyCheck(item.returnFeeType) || item.returnFeeType == "0" || item.returnFee == "0") {
item["fuWuFei"] = commonUtil.getReturnFeeTypeName1ById(item.returnFeeType, item.returnFee);
} else {
item["fuWuFei"] = "";
}
// 简版弹窗通告显示
// if (item.id == that.data.currentJobDrawer.id) {
item["jobDesp"] = item.jobDesp.replace(/\*\*\*\*\*/g, "").split("————————")[0];
// 展示用字段
item["jobDesp1"] = item.jobDesp.replace("⚠", "");
item["jobDesp1"] = item.jobDesp1.replace("[红包]", "");
that.data.currentJobDrawer = { ...item, index: that.data.currentJobDrawer.index ? that.data.currentJobDrawer.index : null };
// }
// if (index == 0 || index == 1 || index == 2) {
// that.data.checkedList.push(item);
// }
try {
that.data.checkedList.forEach((item1, index1) => {
if (item1.id == item.id) {
item.checked = true;
throw Error;
} else {
item.checked = false;
}
});
} catch (error) { }
});
that.setData({
recordList: that.data.recordList,
currentJobDrawer: that.data.currentJobDrawer,
checkedList: that.data.checkedList,
});
})
});
},
/**
* 列表选择事件
*
*
*/
checkJob (e) {
console.log(e);
// console.log(this.data.recordList);
if (e.currentTarget.dataset.item) {
let item = e.currentTarget.dataset.item;
let index = this.data.recordList.findIndex((i) => {
return i.id == item.id;
});
this.data.recordList[index].checked = !this.data.recordList[index].checked;
this.data.checkedList = [];
this.data.recordList.forEach((item) => {
if (item.checked == true) {
this.data.checkedList.push(item);
}
});
this.setData({
checkedList: this.data.checkedList,
recordList: this.data.recordList,
});
}
},
/**
* 复制转发选中职位的通告信息
*/
copyTrans () {
if (this.data.checkedList.length > 0) {
let str = "";
this.data.checkedList.forEach((item, index) => {
console.log(item.jobDesp);
str += item.jobDesp + (this.data.userInfo.agencyStatus == 1 ? (this.data.userInfo.noticeEndStr ? this.data.userInfo.noticeEndStr : "详情咨询:" + this.data.userInfo.tel) : "详情咨询:" + (this.data.serviceInfo.userName || "") + (this.data.serviceInfo.workPhone || "-")) + (index < this.data.checkedList.length - 1 ? "\n\n\n" : "");
});
wx.setClipboardData({
data: str,
success (res) {
wx.getClipboardData({
success (res) {
console.log(res.data); // data
wx.showToast({
title: "通告内容已复制",
icon: "none",
duration: 1500,
});
},
});
},
});
}
},
getCode () {
var that = this;
return new Promise((resolve, reject) => {
customRequest('/yishoudan/store/job/batchqrcode?storeJobIds=' + this.data.checkedList.map(item => item.id).join(','), { header: 'headers', method: 'GET', data: {} }).then((res) => {
that.setData({
currCode: res.data.data.qrcode
})
resolve();
})
// wx.request({
// url: app.globalData.ip + '/yishoudan/store/job/batchqrcode?storeJobIds=' + this.data.checkedList.map(item => item.id).join(','),
// header: app.globalData.headers,
// method: "GET",
// success: function (res) {
// console.log(res)
// that.setData({
// currCode: res.data.data.qrcode
// })
// resolve();
// }
// })
})
},
/**
* 分享职位列表
*/
shareJobList () {
console.log(this.data.checkedList);
if (this.data.checkedList.length == 0) {
return;
}
wx.showLoading({
title: "分享中...",
});
this.getCanvas(this.data.shareJobBaseImg, 'setJob').then((res) => {
console.log(res);
wx.hideLoading();
this.setData({
shareJobImg: res.tempFilePath,
});
});
},
/**
* 分享海报生成海报图并转发
*
*
*/
sharePoster () {
console.log(this.data.checkedList);
if (this.data.checkedList.length == 0 || this.data.checkedList.length > 3) {
return;
}
wx.showLoading({
title: "生成中...",
});
this.getCode().then((res) => {
setTimeout(() => {
this.getCanvas(this.data.sharelImg, 'setShare').then((res) => {
console.log(res);
wx.hideLoading();
this.setData({
posterImg: res.tempFilePath,
posterShow: true,
});
});
}, 10);
})
// this.setData({
// });
},
saveToalbum () {
let that = this;
wx.saveImageToPhotosAlbum({
filePath: that.data.posterImg,
success (res) {
console.log(res);
if (res.errMsg == "saveImageToPhotosAlbum:ok") {
wx.showToast({
title: "图片已保存",
icon: "none",
duration: 1500,
});
}
},
fail (res) {
console.log(res);
wx.showToast({
title: "图片保存失败",
icon: "none",
duration: 1500,
});
},
});
},
/**
* 分享职位卡片
*/
setShareJobImg (ctx, canvas, funObj) {
let that = this
return new Promise((imgres) => {
// ctx.arcTo()
let baseTop, logoLeft, titleSize, ageTop, salaryClassifyValueLeft, salaryClassifyValueTop, monthlyPaySize, roundRectHeight, fubiaotiTop;
let baseMiddle = 175;
baseTop = 204;
logoLeft = 60;
titleSize = 40;
roundRectHeight = 156;
ageTop = 62;
salaryClassifyValueLeft = 56;
salaryClassifyValueTop = 10;
monthlyPaySize = 32;
console.log(123);
that.data.checkedList.forEach((item, index) => {
if (index <= 2) {
let labelLeft = 0;
console.log(item);
funObj.roundRect1(ctx, 32, baseTop - 60 + baseMiddle * index, 776, roundRectHeight, 24, "#fff");
funObj.fillTextLineBreak(ctx, item.jobName, logoLeft, baseTop + baseMiddle * index, 500, 20, "#333", titleSize, "500"); // 岗位标题
funObj.fillTextLineBreak(ctx, item.salaryClassifyValueHaibao, salaryClassifyValueLeft + 570, baseTop - 10 + salaryClassifyValueTop + baseMiddle * index, 400, 20, "#1890ff", titleSize - 4, "600"); // 时薪
// setTimeout(() => {
// funObj.fillTextLineBreak(ctx, item.monthlyPay, salaryClassifyValueLeft + ctx.measureText(item.salaryClassifyValueHaibao + " ").width, baseTop + salaryClassifyValueTop + baseMiddle * index, 400 , 20, "#1890ff", monthlyPaySize, "400"); // 月工资
// }, 0);
funObj.fillTextLineBreak(ctx, item.district, logoLeft, baseTop + ageTop + baseMiddle * index, 500, 20, "#999", monthlyPaySize); // 省市
funObj.fillTextLineBreak(ctx, " | " + item.age, logoLeft + ctx.measureText(item.district).width, baseTop + ageTop + baseMiddle * index, 500, 20, "#999", monthlyPaySize); // 年龄
}
});
// setTimeout(() => {
// },500);
imgres(canvas);
})
},
/**
* 分享海报生成图片
*/
setShareImg (ctx, canvas, mycenter, funObj) {
let that = this
return new Promise((imgres) => {
// ctx.arcTo()
let baseTop, logoLeft, logoSize, titleSize, ageTop, salaryClassifyValueLeft, salaryClassifyValueTop, monthlyPaySize, position, markTop, roundRectHeight, fubiaotiTop, bottomSloganTop, bottomSloganTop1, bottomSloganLeft, bottomSloganLeft1, QRSize, QRLeft, QRTop;
let baseMiddle = 248 * 2;
if (that.data.checkedList.length == 1) {
baseTop = 2 * 370;
bottomSloganTop = 2 * 355;
bottomSloganTop1 = 2 * 700;
QRSize = 2 * 260;
QRTop = 770;
} else {
baseTop = 2 * 294;
bottomSloganTop = 2 * 740;
bottomSloganTop1 = 2 * 790;
bottomSloganLeft = 64;
bottomSloganLeft1 = 64;
QRSize = 2 * 110;
QRLeft = 900;
QRTop = 1400;
}
fubiaotiTop = 2 * 213;
logoLeft = 56 * 2;
logoSize = 2 * 80;
titleSize = 2 * 30;
roundRectHeight = 2 * 226;
ageTop = 2 * 92;
salaryClassifyValueLeft = 2 * 156;
salaryClassifyValueTop = 2 * 48;
monthlyPaySize = 2 * 24;
markTop = 2 * 115;
console.log(123);
wx.getImageInfo({
// src: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/qrcode.png", //网络图片,如果不行请换一个
src: app.globalData.ip + that.data.currCode,
success (res) {
// console.log(res);
const img = canvas.createImage();
img.src = res.path;
img.onload = () => {
if (that.data.checkedList.length == 1) {
funObj.roundRect1(ctx, mycenter - 580 / 2, baseTop + 740, 580, 580, 0, "#fff");
// roundRect1(ctx, mycenter - 600 / 2, baseTop + 750, 600, 560, 0, "#fff");
funObj.roundRect(ctx, img, mycenter - res.width / 2 - 120, baseTop + 770, QRSize, QRSize, 0);
} else {
funObj.roundRect1(ctx, QRLeft - 10, baseTop + QRTop - 10, QRSize + 20, QRSize + 20, 0, "#fff");
funObj.roundRect(ctx, img, QRLeft, baseTop + QRTop, QRSize, QRSize, 0);
}
// if (index == that.data.checkedList.length - 1) {
// setTimeout(() => {
// imgres();
// }, 200);
// }
};
},
fail (err) {
},
});
that.data.checkedList.forEach((item, index) => {
let labelLeft = 0;
funObj.roundRect1(ctx, 24 * 2, baseTop - 100 + baseMiddle * index, 1104, roundRectHeight, 32, "#fff");
item.jobSpecialLabelNameArray.forEach((item1) => {
funObj.fillTextLineBreak(ctx, item1, 60 * 2 + labelLeft, baseTop + markTop + 30 * 2 + baseMiddle * index, 400 * 2, 20, "#333", monthlyPaySize); // 标签字符
funObj.roundRect1(ctx, 52 * 2 + labelLeft, baseTop + markTop + baseMiddle * index, ctx.measureText(item1).width + 16 * 2, 40 * 2, 2 * 2, "#00000010"); // 标签背景色
labelLeft += ctx.measureText(item1).width + 32 * 2;
});
funObj.fillTextLineBreak(ctx, item.jobName, logoLeft, baseTop + baseMiddle * index, 500 * 2, 20, "#333", titleSize, "600"); // 岗位标题
funObj.fillTextLineBreak(ctx, item.salaryClassifyValueHaibao, salaryClassifyValueLeft, baseTop + salaryClassifyValueTop + baseMiddle * index, 400 * 2, 20, "#1890ff", titleSize - 4, "600"); // 时薪
// setTimeout(() => {
funObj.fillTextLineBreak(ctx, item.monthlyPay, salaryClassifyValueLeft + ctx.measureText(item.salaryClassifyValueHaibao + " ").width, baseTop + salaryClassifyValueTop + baseMiddle * index, 400 * 2, 20, "#1890ff", monthlyPaySize, "400"); // 月工资
// }, 0);
funObj.fillTextLineBreak(ctx, item.district, salaryClassifyValueLeft, baseTop + ageTop + baseMiddle * index, 500 * 2, 20, "#333", monthlyPaySize); // 省市
funObj.fillTextLineBreak(ctx, " | " + item.age, salaryClassifyValueLeft + ctx.measureText(item.district).width, baseTop + ageTop + baseMiddle * index, 500 * 2, 20, "#333", monthlyPaySize); // 年龄
funObj.fillTextLineBreak(ctx, that.data.userInfo.agencyName, mycenter - ctx.measureText(that.data.userInfo.agencyName).width / 2, fubiaotiTop, 400 * 2, 20, "#fff", monthlyPaySize, "600"); // 代理名称
if (that.data.checkedList.length == 1) {
// roundRect1(ctx, mycenter - 600 / 2, baseTop + 750, 600, 560, 32, "#fff");
funObj.fillTextLineBreak(ctx, "长按查看职位详情", mycenter - ctx.measureText("长按查看职位详情").width / 2, baseTop + bottomSloganTop, 300 * 2, 20, "#fff", monthlyPaySize); // 底部slogan
funObj.fillTextLineBreak(ctx, "好工作 放心干", mycenter - ctx.measureText("好工作 放心干").width / 1.45, baseTop + bottomSloganTop1, 500 * 2, 20, "#fff", titleSize); // 底部slogan
} else {
funObj.fillTextLineBreak(ctx, "长按查看职位详情", bottomSloganLeft, baseTop + bottomSloganTop, 300 * 2, 20, "#fff", monthlyPaySize + 8); // 底部slogan
funObj.fillTextLineBreak(ctx, "好工作 放心干", bottomSloganLeft1, baseTop + bottomSloganTop1, 500 * 2, 20, "#fff", titleSize); // 底部slogan
}
//生成logo图片
wx.getImageInfo({
src: item.logo, //网络图片,如果不行请换一个
success (res) {
// console.log(res);
const img = canvas.createImage();
// console.log(ctx);
img.src = res.path;
img.onload = () => {
// setTimeout(() => {
funObj.roundRect(ctx, img, logoLeft, baseTop + 40 + baseMiddle * index, logoSize, logoSize, 8);
// }, 500);
if (index == that.data.checkedList.length - 1) {
setTimeout(() => {
imgres(canvas);
}, 100);
}
};
},
fail (err) {
console.log(err);
},
});
});
// setTimeout(() => {
// },500);
})
},
getCanvas (sharelImg, type) {
const that = this;
console.log(sharelImg);
return new Promise((resolve) => {
var mycenter = 0; //文字左右居中显示
var myheight = 0; //文字高度
const query = wx.createSelectorQuery();
query
.select("#canvasId")
.fields({ node: true, size: true })
.exec((res) => {
console.log(res);
const canvas = res[0].node;
const ctx = canvas.getContext("2d");
new Promise(function (resolve) {
// 绘制背景图片
wx.getImageInfo({
src: sharelImg, // 网络图片
success (res) {
console.log(res);
var width = res.width;
var height = res.height;
mycenter = width / 2;
myheight = height;
canvas.width = width;
canvas.height = height;
const img = canvas.createImage();
console.log(ctx);
img.src = res.path;
img.onload = (info) => {
console.log(info);
ctx.drawImage(img, 0, 0, width, height);
resolve(true);
};
},
fail (err) {
console.log(err);
},
});
}).then(() => {
const fillTextLineBreak = (ctx, text, x, y, lw, lh, color = "#333", font = "32", weight = "500") => {
var i = 0;
var n = 0;
var r = -1;
var initHeight = 0;
ctx.font = weight + " " + font + "px Arial"; //字体大小
ctx.fillStyle = color; //字体颜色
while (i < text.length) {
while (ctx.measureText(text.substring(n, i)).width < lw && i < text.length) {
i++;
}
r++;
ctx.fillText(text.substring(n, i), x, y + lh * r);
n = i;
}
initHeight = lh * r;
// wx.setStorageSync("initHeight", initHeight);
};
const roundRect = (ctx, img, bg_x, bg_y, bg_w, bg_h, bg_r) => {
// 开始绘制
ctx.save();
ctx.beginPath();
ctx.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5);
ctx.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2);
ctx.arc(bg_x + bg_w - bg_r, bg_y + bg_h - bg_r, bg_r, 0, Math.PI * 0.5);
ctx.arc(bg_x + bg_r, bg_y + bg_h - bg_r, bg_r, Math.PI * 0.5, Math.PI);
ctx.clip();
ctx.drawImage(img, bg_x, bg_y, bg_w, bg_h);
// 恢复之前保存的绘图上下文
ctx.restore();
};
const roundRect_yuan = (ctx, x, y, size) => {
// 开始绘制
ctx.save(); // 保存
ctx.beginPath(); // 开始绘制
// ctx.arc(100, 75, 50, 0, 2 * Math.PI)
ctx.arc(size / 2 + x, size / 2 + y, size / 2, 0, Math.PI * 2, false);
ctx.clip();
// 恢复之前保存的绘图上下文
ctx.restore();
};
function roundRect1 (ctx, x, y, w, h, r, color) {
//绘制圆角矩形(无填充色))
ctx.save();
ctx.fillStyle = color;
ctx.strokeStyle = color;
ctx.lineJoin = "round"; //交点设置成圆角
ctx.lineWidth = r;
ctx.strokeRect(x + r / 2, y + r / 2, w - r, h - r);
ctx.fillRect(x + r, y + r, w - r * 2, h - r * 2);
ctx.stroke();
ctx.closePath();
}
//使用:
console.log(canvas);
if (type == 'setJob') {
this.setShareJobImg(ctx, canvas, { roundRect1, roundRect_yuan, roundRect, fillTextLineBreak }).then(function (canvas1) {
wx.canvasToTempFilePath({
canvas: canvas1,
success (res) {
console.log(res);
resolve(res);
},
fail (res) {
wx.hideLoading();
wx.showToast({
title: res.errMsg,
icon: "error",
});
},
});
}).catch((err) => {
console.log(err);
wx.hideLoading()
wx.showToast({
title: '生成失败,请重试',
})
});
} else if (type == 'setShare') {
this.setShareImg(ctx, canvas, mycenter, { roundRect1, roundRect_yuan, roundRect, fillTextLineBreak }).then(function (canvas1) {
wx.canvasToTempFilePath({
canvas: canvas1,
success (res) {
console.log(res);
resolve(res);
},
fail (res) {
wx.hideLoading();
wx.showToast({
title: res.errMsg,
icon: "error",
});
},
});
}).catch((err) => {
console.log(err);
wx.hideLoading()
wx.showToast({
title: '生成失败,请重试',
})
});
}
});
});
});
},
onScrollRefresh () {
this.data.recordList = [];
this.data.storeJobListSearchForm.pageNum = 1;
this.getJobList();
},
getTag () {
let that = this;
let query = that.createSelectorQuery();
query
.selectAll(".tttg")
.boundingClientRect()
.exec(function (res) {
res.forEach((item) => {
item.forEach((element, index) => {
if (element.width > 200) {
// that.data.recordList[index].isTagShow = true;
var age = "recordList[" + index + "].isTagShow";
that.setData({
[age]: true,
});
}
});
});
// if(){
// }
// console.log(res);
});
},
// 下拉加载更多
onScrollToLower () {
console.log("====================================================");
var that = this;
if (app.globalData.isLogin) {
that.data.storeJobListSearchForm.pageNum = that.data.storeJobListSearchForm.pageNum + 1;
if (that.data.hasMoreData) {
that.getJobList();
}
// 根据实际数据加载情况设定 loadMore 的值即可,分别为 load 和 over
this.setData({
loadMore: "load",
// loading:true
});
} else {
// if (that.data.pullNum == 0) {
// that.openIOS1();
// }
}
that.data.pullNum = that.data.pullNum + 1;
},
handleTabClick (e) {
var that = this;
var index = e.detail.index;
console.log(e.detail.index);
let categoryCurr = that.data.tabs2[index].category; // that.data.tabs2.forEach((item,index2) => {
// if (index == index2) {
// categoryCurr = item.category
// }
// if( index == 0){
// categoryCurr = -1
// }
// })
this.setData({
// [tabsName]: index,
contentIndex: index,
});
console.log(categoryCurr);
that.data.storeJobListSearchForm.jobClassify = categoryCurr;
that.data.storeJobListSearchForm.pageNum = 1;
that.setData({
recordList: [],
});
that.getJobList();
},
/**
* 标准详情
*
*
*/
goDetail (e) {
// 未使用组件单独配置
console.log(e);
var that = this;
if (this.data.isLogin) {
wx.navigateTo({
url: `../detail/index?storeJobId=${e.currentTarget.dataset.id}&jobClassify=${e.currentTarget.dataset.info.jobClassify}`,
});
} else {
wx.navigateTo({
url: "../login/index",
});
}
},
/**
* 简版抽屉
*
*
*/
goDrawer (event) {
let that = this;
console.log(event.currentTarget.dataset.item);
event.currentTarget.dataset.item["jobDesp"] = event.currentTarget.dataset.item.jobDesp.replace(/\*\*\*\*\*/g, "").split("————————")[0];
// 展示用字段
event.currentTarget.dataset.item["jobDesp1"] = event.currentTarget.dataset.item.jobDesp.replace("⚠", "");
event.currentTarget.dataset.item["jobDesp1"] = event.currentTarget.dataset.item.jobDesp1.replace("[红包]", "");
// wx.hideTabBar({
// success(e) {
that.setData({
currentJobDrawer: { ...event.currentTarget.dataset.item, index: event.currentTarget.dataset.index },
drawerShow: true,
});
// },
// });
console.log(this.data.currentJobDrawer);
},
hidePoster () {
this.setData({
posterShow: false,
});
},
copyClose () {
var that = this;
var contentInfo;
const query = wx.createSelectorQuery().in(this);
query
.select(".contactInfo")
.boundingClientRect(function (res) {
contentInfo = res.dataset.info;
var text = that.data.currentJobDrawer.jobDesp + contentInfo;
wx.setClipboardData({
data: text,
success (res) {
wx.getClipboardData({
success (res) {
console.log(res.data); // data
wx.showToast({
title: "内容已复制",
icon: "none",
duration: 1500,
});
},
});
},
});
})
.exec();
},
// showDrawer() {
// this.setData({
// });
// },
hideDrawer () {
let that = this;
that.setData({
drawerShow: false,
});
// this.getJobList();
setTimeout(() => {
// wx.showTabBar({
// success(e) {},
// });
}, 300);
},
goEnroll (e) {
console.log(e);
// wx.navigateTo({
// url: "../newEnroll/index?applyType=0"
// });
var that = this;
wx.removeStorageSync("townsManInfo");
wx.removeStorageSync("townsManInfoJob");
wx.removeStorageSync("storeInfoJob");
// if(app.isNotEmptyCheck(wx.getStorage('townsManInfo'))){
// wx.removeStorageSync('townsManInfo')
// }
// if(app.isNotEmptyCheck(wx.getStorage('townsManInfoJob'))){
// wx.removeStorageSync('townsManInfoJob')
// }
// if(app.isNotEmptyCheck(wx.getStorage('storeInfoJob'))){
// wx.removeStorageSync('storeInfoJob')
// }
// wx.removeStorageSync('townsManInfoJob')
console.log(app.globalData.loginUserInfo.tel);
wx.setStorageSync("jobDetailStorage", that.data.recordList[e.currentTarget.dataset.idx]);
let argument;
argument = JSON.stringify(e.currentTarget.dataset.info).replace(/\=|\&/g, "3D");
wx.navigateTo({
url: `../newEnroll/enroll/index?applyType=1&info=${argument}`,
});
},
wxLogin () {
var that = this;
wx.login({
success (res) {
if (res.code) {
that.setData({
wxCode: res.code,
});
} else {
console.log("获取code失败!" + res.errMsg);
}
},
});
},
changeRecordBillType (e) {
let that = this;
console.log(e);
that.setData({
recordBillType: e.currentTarget.dataset.type,
});
},
toSmart () {
wx.navigateTo({
url: "/pages/IDCardWithNFC/index",
});
},
getPhoneNumber (e) {
var that = this;
console.log(e);
console.log(e.detail.errMsg);
/*wx.setStorageSync({
key: "jobDetailStorage",
data: that.data.recordList[e.currentTarget.dataset.idx]
});*/
wx.setStorageSync("jobDetailStorage", that.data.recordList[e.currentTarget.dataset.idx]);
// console.log(e);
// console.log(e.detail.errMsg)
// console.log(e.detail.iv)
// console.log(e.detail.encryptedData)
if ("getPhoneNumber:ok" == e.detail.errMsg) {
//同意
var iv = e.detail.iv;
var encryptedData = e.detail.encryptedData;
console.log(iv, "=-=========", encryptedData);
wx.checkSession({
success () {
//session_key 未过期,并且在本生命周期一直有效
customRequest("/getWechatTel", {
header: 'headers', method: 'GET', data: {
code: that.data.wxCode,
iv: iv,
encryptedData: encryptedData,
type: "yishoudan",
}
}).then((res) => {
app.globalData.openId = res.data.data.openId;
let promise = app.setLoginUserTokenInfo(res.data.data.phoneNumber, null);
var collected = e.currentTarget.dataset.collected;
if (collected) {
promise.then((res) => {
that.setData({
isLogin: app.globalData.isLogin,
});
that.doCollected(collected, e.currentTarget.dataset.jobid);
// that.collectedStoreJobList();
});
} else {
if (that.data.recordBillType == "photo" || that.data.recordBillType == "record") {
promise.then((res) => {
if (that.data.recordBillType == "photo") {
that.chooseIdCard();
} else {
that.navigatorToRecord();
}
});
} else {
promise.then((res) => {
let argument;
argument = JSON.stringify(e.currentTarget.dataset.info).replace(/\=|\&/g, "3D");
wx.navigateTo({
url: `../newEnroll/enroll/index?applyType=1&info=${argument}`,
});
});
}
}
})
// wx.request({
// url: app.globalData.ip + "/getWechatTel",
// data: {
// code: that.data.wxCode,
// iv: iv,
// encryptedData: encryptedData,
// type: "yishoudan",
// },
// success: function (res) {
// console.log(res);
// app.globalData.openId = res.data.data.openId;
// let promise = app.setLoginUserTokenInfo(res.data.data.phoneNumber, null);
// var collected = e.currentTarget.dataset.collected;
// if (collected) {
// promise.then((res) => {
// that.setData({
// isLogin: app.globalData.isLogin,
// });
// that.doCollected(collected, e.currentTarget.dataset.jobid);
// // that.collectedStoreJobList();
// });
// } else {
// if (that.data.recordBillType == "photo" || that.data.recordBillType == "record") {
// promise.then((res) => {
// if (that.data.recordBillType == "photo") {
// that.chooseIdCard();
// } else {
// that.navigatorToRecord();
// }
// });
// } else {
// promise.then((res) => {
// let argument;
// argument = JSON.stringify(e.currentTarget.dataset.info).replace(/\=|\&/g, "3D");
// wx.navigateTo({
// url: `../newEnroll/enroll/index?applyType=1&info=${argument}`,
// });
// });
// }
// }
// },
// fail: function (res) {
// console.log("获取用户手机号错误");
// },
// });
},
fail () {
// session_key 已经失效,需要重新执行登录流程
wx.login({
success (res) {
if (res.code) {
console.log(res.code);
//发起网络请求
customRequest("/getWechatTel", {
header: 'headers', method: 'GET', data: {
code: res.code,
iv: iv,
encryptedData: encryptedData,
type: "yishoudan",
}
}).then((res) => {
let promise = app.setLoginUserTokenInfo(res.data.data.phoneNumber, null);
var collected = e.currentTarget.dataset.collected;
if (collected) {
promise.then((res) => {
that.setData({
isLogin: app.globalData.isLogin,
});
that.doCollected(collected, e.currentTarget.dataset.jobid);
});
} else {
promise.then((res) => {
wx.navigateTo({
url: "../enroll/index?applyType=1",
//url: "../enroll/index?applyType=1&tel=" + res.data.data.phoneNumber
});
});
}
})
// wx.request({
// url: app.globalData.ip + "/getWechatTel",
// data: {
// code: res.code,
// iv: iv,
// encryptedData: encryptedData,
// type: "yishoudan",
// },
// success: function (res) {
// console.log(res);
// let promise = app.setLoginUserTokenInfo(res.data.data.phoneNumber, null);
// var collected = e.currentTarget.dataset.collected;
// if (collected) {
// promise.then((res) => {
// that.setData({
// isLogin: app.globalData.isLogin,
// });
// that.doCollected(collected, e.currentTarget.dataset.jobid);
// });
// } else {
// promise.then((res) => {
// wx.navigateTo({
// url: "../enroll/index?applyType=1",
// //url: "../enroll/index?applyType=1&tel=" + res.data.data.phoneNumber
// });
// });
// }
// },
// fail: function (res) {
// console.log("获取用户手机号错误");
// },
// });
} else {
console.log("获取手机号失败!" + res.errMsg);
}
},
});
},
});
} else {
//拒绝
var collected = e.currentTarget.dataset.collected;
if (collected) {
try {
wx.setStorageSync("comeFromPage", "index");
} catch (e) {
console.log("index-页面跳转,设置参数错误:", e);
}
wx.navigateTo({
url: "/pages/login/index",
});
} else {
wx.navigateTo({
url: "../enroll/index?applyType=1",
});
}
}
return false;
},
getPhoneNumber1 (e) {
var that = this;
console.log(e);
console.log(e.detail.errMsg);
that.close();
// console.log(e);
// console.log(e.detail.errMsg)
// console.log(e.detail.iv)
// console.log(e.detail.encryptedData)
if ("getPhoneNumber:ok" == e.detail.errMsg) {
//同意
var iv = e.detail.iv;
var encryptedData = e.detail.encryptedData;
wx.checkSession({
success () {
//session_key 未过期,并且在本生命周期一直有效
customRequest("/getWechatTel", {
header: 'headers', method: 'GET', data: {
code: that.data.wxCode,
iv: iv,
encryptedData: encryptedData,
type: "yishoudan",
}
}).then((res) => {
let promise = app.setLoginUserTokenInfo(res.data.data.phoneNumber, null);
promise.then((res) => {
that.setData({
isLogin: app.globalData.isLogin,
});
that.onScrollToLower();
});
})
// wx.request({
// url: app.globalData.ip + "/getWechatTel",
// data: {
// code: that.data.wxCode,
// iv: iv,
// encryptedData: encryptedData,
// type: "yishoudan",
// },
// success: function (res) {
// console.log(res);
// let promise = app.setLoginUserTokenInfo(res.data.data.phoneNumber, null);
// promise.then((res) => {
// that.setData({
// isLogin: app.globalData.isLogin,
// });
// that.onScrollToLower();
// });
// },
// fail: function (res) {
// console.log("获取用户手机号错误");
// },
// });
},
fail () {
// session_key 已经失效,需要重新执行登录流程
wx.login({
success (res) {
if (res.code) {
console.log(res.code);
//发起网络请求
customRequest("/getWechatTel", {
header: 'headers', method: 'GET', data: {
code: res.code,
iv: iv,
encryptedData: encryptedData,
type: "yishoudan",
}
}).then((res) => {
let promise = app.setLoginUserTokenInfo(res.data.data.phoneNumber, null);
promise.then((res) => {
that.setData({
isLogin: app.globalData.isLogin,
});
});
})
// wx.request({
// url: app.globalData.ip + "/getWechatTel",
// data: {
// code: res.code,
// iv: iv,
// encryptedData: encryptedData,
// type: "yishoudan",
// },
// success: function (res) {
// console.log(res);
// let promise = app.setLoginUserTokenInfo(res.data.data.phoneNumber, null);
// promise.then((res) => {
// that.setData({
// isLogin: app.globalData.isLogin,
// });
// });
// },
// fail: function (res) {
// console.log("获取用户手机号错误");
// },
// });
} else {
console.log("获取手机号失败!" + res.errMsg);
}
},
});
},
});
} else {
//拒绝
if (e.currentTarget.dataset.type != "close") {
try {
wx.setStorageSync("comeFromPage", "index");
} catch (e) {
console.log("index-页面跳转,设置参数错误:", e);
}
wx.navigateTo({
url: "/pages/login/index",
});
} else {
that.close();
}
}
return false;
},
getAgencyUserId (id) {
var that = this;
customRequest("/channel/contact/getAgencyUserId", { header: 'headers', method: 'GET', data: { channelContactId: id, } }).then((res) => {
try {
if (app.isNotEmptyCheck(res.data.data)) {
wx.setStorageSync("storageSyncAgencyUserId", res.data.data);
}
//先设置代理人缓存人再登录
app.getLoginUserTokenInfo();
} catch (e) {
console.log("0-扫描微信二维码,设置参数错误:", e);
//先设置代理人缓存人再登录
app.getLoginUserTokenInfo();
}
})
// wx.request({
// url: app.globalData.ip + "/channel/contact/getAgencyUserId",
// method: "GET",
// header: app.globalData.headers,
// data: {
// channelContactId: id,
// },
// success: function (res) {
// console.log("获取来源对应的代理人,来源ID:", id);
// console.log(res);
// try {
// if (app.isNotEmptyCheck(res.data.data)) {
// wx.setStorageSync("storageSyncAgencyUserId", res.data.data);
// }
// //先设置代理人缓存人再登录
// app.getLoginUserTokenInfo();
// } catch (e) {
// console.log("0-扫描微信二维码,设置参数错误:", e);
// //先设置代理人缓存人再登录
// app.getLoginUserTokenInfo();
// }
// },
// fail: function (res0) {
// console.log("获取来源对应的代理人错误", id);
// },
// });
},
collectPaste (e) { // 未使用组件单独处理
var txt;
var that = this;
if (!this.data.isLogin) {
wx.redirectTo({
url: "/pages/login/index",
});
return;
}
var collected = e.currentTarget.dataset.collected;
var storeJobId = e.currentTarget.dataset.jobid;
that.doCollected(collected, storeJobId);
// console.log(collected);
// if(!this.data.isCollect){
// that.setData({
// isCollect: true,
// collectTxt:'已收藏'
// })
// txt = '收藏成功'
// }else{
// that.setData({
// isCollect: false,
// collectTxt:'收藏'
// })
// }
},
doCollected (collected, storeJobId) {
var that = this;
var url = "/user/collect/job/add";
if (collected - 1 == 0) {
url = "/user/collect/job/remove";
}
console.log(app.globalData.headers);
//发起网络请求
customRequest(url, { header: 'headers', method: 'GET', data: { storeJobId: storeJobId, } }).then((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 = "取消收藏";
that.data.currentJobDrawer.collected = 2;
if (that.data.choiceCollect == 1) {
if (that.data.drawerShow) {
that.data.drawerShow = false;
}
that.data.storeJobListSearchForm.pageNum = 1;
that.setData({
recordList: [],
drawerShow: that.data.drawerShow,
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;
}
}
that.data.currentJobDrawer.collected = 1;
txt = "收藏成功";
}
console.log(that.data.currentJobDrawer);
that.setData({
recordList: that.data.recordList,
currentJobDrawer: that.data.currentJobDrawer,
isLogin: app.globalData.isLogin,
});
wx.showToast({
icon: "none",
title: txt,
});
})
// 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 = "取消收藏";
// that.data.currentJobDrawer.collected = 2;
// if (that.data.choiceCollect == 1) {
// if (that.data.drawerShow) {
// that.data.drawerShow = false;
// }
// that.data.storeJobListSearchForm.pageNum = 1;
// that.setData({
// recordList: [],
// drawerShow: that.data.drawerShow,
// 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;
// }
// }
// that.data.currentJobDrawer.collected = 1;
// txt = "收藏成功";
// }
// console.log(that.data.currentJobDrawer);
// that.setData({
// recordList: that.data.recordList,
// currentJobDrawer: that.data.currentJobDrawer,
// isLogin: app.globalData.isLogin,
// });
// wx.showToast({
// icon: "none",
// title: txt,
// });
// },
// fail: function (res) {
// console.log("操作失败");
// },
// });
},
getUserInfoBtn: function (e) {
console.log(e);
let that = this;
let type = e.currentTarget.dataset.type;
var collected = e.currentTarget.dataset.collected;
var storeJobId = e.currentTarget.dataset.jobid;
let idx = e.currentTarget.dataset.idx;
console.log(type);
wx.getUserProfile({
desc: "用于完善会员资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
console.log(res);
//发起网络请求
customRequest("/updateUserWechatInfo", {
header: 'headers', method: 'POST', data: {
nickName: res.userInfo.nickName,
avatarUrl: res.userInfo.avatarUrl,
gender: res.userInfo.gender,
country: res.userInfo.country,
province: res.userInfo.province,
city: res.userInfo.city,
}
}).then((res) => {
app.globalData.hasUserInfo = 1;
that.setData({
hasUserInfo: 1,
});
that.doMenuClick(type, collected, storeJobId, idx);
}).catch(() => {
that.doMenuClick(type, collected, storeJobId, idx);
})
// wx.request({
// url: app.globalData.ip + "/updateUserWechatInfo",
// data: {
// nickName: res.userInfo.nickName,
// avatarUrl: res.userInfo.avatarUrl,
// gender: res.userInfo.gender,
// country: res.userInfo.country,
// province: res.userInfo.province,
// city: res.userInfo.city,
// },
// method: "POST",
// header: app.globalData.headers,
// success: function (res) {
// console.log(res);
// app.globalData.hasUserInfo = 1;
// that.setData({
// hasUserInfo: 1,
// });
// that.doMenuClick(type, collected, storeJobId, idx);
// },
// fail: function (res) {
// that.doMenuClick(type, collected, storeJobId, idx);
// },
// });
},
fail: (res) => {
console.log(res);
that.doMenuClick(type, collected, storeJobId, idx);
},
});
},
doMenuClick: function (_type, _collected, _storeJobId, _idx) {
let that = this;
if (_type - 1 == 0) {
//点击全国
that.goCity();
} else if (_type - 2 == 0) {
//搜索
that.showInput();
} else if (_type - 3 == 0) {
//筛选
that.goScreen();
} else if (_type - 4 == 0) {
//收藏
that.doCollected(_collected, _storeJobId);
} else if (_type - 5 == 0) {
//报名
wx.setStorageSync("jobDetailStorage", that.data.recordList[_idx]);
wx.navigateTo({
url: "../enroll/index?applyType=1&tel=" + app.globalData.loginUserInfo.tel,
});
}
},
changSign (e) {
let that = this;
console.log(e);
that.data.storeJobListSearchForm.pageNum = 1;
if (e.target.dataset.type == 0 && that.data.signType != 0) {
that.data.storeJobListSearchForm.signType = "";
that.setData({
signType: e.target.dataset.type,
recordList: [],
storeJobListSearchForm: that.data.storeJobListSearchForm,
});
that.getJobList();
} else if (e.target.dataset.type == 1 && that.data.signType != 1) {
that.data.storeJobListSearchForm.signType = 1;
that.setData({
signType: e.target.dataset.type,
recordList: [],
storeJobListSearchForm: that.data.storeJobListSearchForm,
});
that.getJobList();
} else if (e.target.dataset.type == 2 && that.data.signType != 2) {
that.data.storeJobListSearchForm.signType = 2;
that.setData({
signType: e.target.dataset.type,
recordList: [],
storeJobListSearchForm: that.data.storeJobListSearchForm,
});
that.getJobList();
}
},
/**
* 收藏的切换
*
*
*/
collectChange (e) {
let that = this;
if (that.data.isLogin || (!that.data.isLogin && e.currentTarget.dataset.id == 0)) {
if (e.currentTarget.dataset.id) {
that.data.choiceCollect = e.currentTarget.dataset.id;
that.data.storeJobListSearchForm.ucj = e.currentTarget.dataset.id;
that.data.storeJobListSearchForm.pageNum = 1;
that.setData({
choiceCollect: that.data.choiceCollect,
storeJobListSearchForm: that.data.storeJobListSearchForm,
recordList: [],
hasMoreData: true,
});
that.getJobList();
}
} else {
// if(e.currentTarget.dataset.id == 1){
that.setData({
recordList: [],
choiceCollect: 1,
});
// }
}
},
choiceFilter (e) {
var that = this;
// let str = that.data.activez
let str = e.currentTarget.dataset.id;
if (str == "all") {
that.data.storeJobListSearchForm.sortTag = 0;
that.setData({
firstMenu: "工价",
// storeJobListSearchForm: that.data.storeJobListSearchForm,
recordList: [],
});
that.getJobList().then(() => {
that.setData({
siv: "menu",
});
});
} else if (str == "zuijin") {
//距离最近
if (that.data.storeJobListSearchForm.lng && that.data.storeJobListSearchForm.lat) {
that.data.storeJobListSearchForm.sortTag = 2;
that.setData({
firstMenu: "距离",
// storeJobListSearchForm: tha t.data.storeJobListSearchForm,
recordList: [],
});
that.getJobList().then(() => {
that.setData({
siv: "menu",
});
});
} else {
wx.getLocation({
type: "gcj02",
success (res1) {
console.log("获取位置1");
app.globalData.lng = res1.longitude;
app.globalData.lat = res1.latitude;
that.data.storeJobListSearchForm.lng = res1.longitude;
that.data.storeJobListSearchForm.lat = res1.latitude;
that.data.storeJobListSearchForm.sortTag = 2;
that.data.storeJobListSearchForm.pageNum = 1;
that.setData({
firstMenu: "距离",
storeJobListSearchForm: that.data.storeJobListSearchForm,
recordList: [],
});
that.getJobList().then(() => {
that.setData({
siv: "menu",
});
});
// var promise = new Promise(function(resolve,reject){
// that.getJobList();
// });
},
fail () {
console.log("获取位置失败,打开位置设置界面");
// wx.openSetting({
// success(res) {
// console.log(res.authSetting);
// if (res.authSetting["scope.userLocation"]) {
// wx.getLocation({
// type: "gcj02",
// success(res1) {
// console.log("获取位置2");
// console.log(res1);
// app.globalData.lng = res1.longitude;
// app.globalData.lat = res1.latitude;
// that.data.storeJobListSearchForm.sortTag = 2;
// that.data.storeJobListSearchForm.lng = res1.longitude;
// that.data.storeJobListSearchForm.lat = res1.latitude;
// that.data.storeJobListSearchForm.pageNum = 1;
// that.setData({
// storeJobListSearchForm: that.data.storeJobListSearchForm,
// recordList: [],
// });
// that.getJobList().then(() => {
// that.setData({
// siv: "menu",
// });
// });
// },
// fail() {},
// });
// }
// },
// });
},
});
}
} else if (str == "zuigao") {
//工价最高
that.data.storeJobListSearchForm.sortTag = 1;
that.data.storeJobListSearchForm.pageNum = 1;
that.setData({
storeJobListSearchForm: that.data.storeJobListSearchForm,
firstMenu: "工价",
recordList: [],
});
that.getJobList().then(() => {
that.setData({
siv: "menu",
});
});
} else if (str == "fuwufei") {
console.log(str);
that.data.storeJobListSearchForm.sortTag = 3;
that.setData({
firstMenu: "佣金",
// storeJobListSearchForm: tha t.data.storeJobListSearchForm,
recordList: [],
});
that.getJobList().then(() => {
that.setData({
siv: "menu",
});
});
}
that.setData({
activez: str,
});
that.setData({
whichOneShow: "",
siv: "",
});
// setTimeout(() => {
// that.setData({
// whichOneShow: "",
// });
// console.log(this.data.whichOneShow);
// console.log("112233");
// }, 1);
},
/**
* 清除所有的筛选项
*
*
*/
clearFilter () {
let that = this;
that.data.jobSpecialLabelList.forEach((item) => {
// console.log(item);
if (item.checked) {
item.checked = false;
}
});
that.data.brandList.forEach((item) => {
if (item.checked) {
item.checked = false;
}
});
that.data.storeJobListSearchForm.jobSpecialLabelIds = "";
// that.data.storeJobListSearchForm.ucj =
// that.data.storeJobListSearchForm.brandIds = "";
that.data.storeJobListSearchForm.jobCategoryLabelIds = "";
that.data.storeJobListSearchForm.pageNum = 1;
that.setData({
jobSpecialLabelList: that.data.jobSpecialLabelList,
tagArray0: that.data.tagArray0,
tagArray1: that.data.tagArray1,
tagArray2: that.data.tagArray2,
tagArray3: that.data.tagArray3,
brandList: that.data.brandList,
selectJobList: [],
selectBrandList: [],
recordList: [],
whichOneShow: "",
firstMenu: "工价",
secondMenu: "不限",
sexid: -1,
activez: "zuigao",
});
// that.choiceFilter({
// currentTarget: {
// dataset: {
// id: "all",
// },
// },
// });
// that.choiceSex({
// currentTarget: {
// dataset: {
// id: "-1",
// },
// },
// });
that.getJobList();
},
scroll (e) {
return false;
},
stoptap (e) {
return false;
},
changeContact () {
console.log(2123);
wx.navigateTo({
url: `/pages/configAnnunciate/index`,
});
},
/**
* 简版报名
*
*
*/
recordBill (e) {
console.log(e);
if (!this.data.isLogin) {
wx.redirectTo({
url: "/pages/login/index",
});
return;
}
if (this.data.currentJobDrawer.state == 1 && this.data.currentJobDrawer.recruitment == 2) {
return;
}
if (this.data.agencyStatus != 1) {
wx.showModal({
content: "报名仅代理可使用。",
contentColor: "#ccc",
confirmColor: "#1890ff",
confirmText: "我知道了",
// cancelText:'成为代理',
showCancel: false,
success (res) {
console.log(res);
},
});
return;
}
console.log(123);
let middleInfo = this.data.currentJobDrawer;
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}`,
// });
},
imageLoad () {
this.setData({
isLoading: false,
});
},
closeDialog () {
this.setData({
iosDialog: false,
});
},
showLeft () {
this.setData({
leftShow: true,
});
},
hideLeft () {
this.setData({
leftShow: false,
whichOneShow: "",
});
console.log(this.data.innerFilter);
if (!this.data.innerFilter) {
this.setData({
filterData: JSON.parse(JSON.stringify(this.data.copyList)),
});
}
},
/**
* 阻止滑动穿透
*
*
*/
modalMove () {
return false;
},
/**
* 获取搜索轮播的关键字索引
*
*
*/
getSwiperIndex (e) {
// console.dir(e);
if (e.detail.current) {
this.setData({
placeholderText: this.data.swiperTextList[e.detail.current],
});
// console.log(this.data.swiperTextList[e.detail.current]);
// console.log(this.data.placeholderText);
}
},
onPageScroll (e) { },
drawerTouchStart (event) {
this.handletouchtart(event);
},
drawerTouchMove (event) {
let tx = this.handletouchmove(event);
console.log(tx);
if (tx.ty > 100) {
this.hideDrawer();
}
},
filterTouchMove (event) {
let tx = this.handletouchmove(event);
if (tx.tx < -100) {
this.setData({
leftShow: false,
});
}
},
filterTouchStart (event) {
this.handletouchtart(event);
},
listTouchMove (event) {
if (event.detail.scrollTop - this.data.listPosition > 15 && this.data.halfHide == false) {
this.setData({
halfHide: true,
});
} else if (event.detail.scrollTop - this.data.listPosition < -15 && this.data.halfHide == true) {
this.setData({
halfHide: false,
});
}
if (event.detail.scrollTop > 200) {
wx.setTabBarItem({
index: 0,
text: "回顶部",
iconPath: "/assets/images/ysd.png",
selectedIconPath: "/assets/images/top.png",
success: (e) => { },
fail (e) {
console.log(e);
},
});
} else if (event.detail.scrollTop <= 200) {
wx.setTabBarItem({
index: 0,
text: "首页",
iconPath: "/assets/images/ysd.png",
selectedIconPath: "/assets/images/home1.png",
success: (e) => { },
fail (e) {
console.log(e);
},
});
}
// console.log(event);
},
listTouchStart (event) {
this.data.listPosition = event.detail.scrollTop;
},
/**
* 页面滑动事件监听
*
*
*/
handletouchmove: function (event) {
let that = this;
var currentX = event.touches[0].pageX;
var currentY = event.touches[0].pageY;
var tx = currentX - this.data.lastX;
var ty = currentY - this.data.lastY;
var text = "";
//左右方向滑动
if (Math.abs(tx) > Math.abs(ty)) {
return { tx };
}
//上下方向滑动
else {
return { ty };
}
},
// 触摸开始事件
handletouchtart: function (event) {
this.data.lastX = event.touches[0].pageX;
this.data.lastY = event.touches[0].pageY;
},
searchAnimate () {
let that = this;
wx.createSelectorQuery()
.select("#listBox")
.fields(
{
scrollOffset: true,
size: true,
},
(res) => {
this.animate(
"#searchInputBox",
[
{
// paddingTop: "10px",
// paddingBottom: "10px",
top: "10px",
width: "100%",
// height: "40px",
// backgroundColor: "#f5f5f5",
},
{
// paddingTop: that.data.statusBarHeight + (that.data.navigationBarHeight - that.data.menuButtonHeight) / 2 + "px",
// paddingBottom: "30px",
top: "-48px",
width: "70%",
// height: "84px",
// backgroundColor: "#1890ff",
// paddingTop:'100px',
},
],
800,
{
scrollSource: "#listBox",
timeRange: 1000,
startScrollOffset: 0,
endScrollOffset: 60,
}
);
this.animate(
".the_city",
[
{
color: "#333",
},
{
color: "#fff",
},
],
500,
{
scrollSource: "#listBox",
timeRange: 1000,
startScrollOffset: 0,
endScrollOffset: 90,
}
);
// this.animate(
// "#navBox",
// [
// {
// marginTop: "50px",
// // top: "0px",
// },
// {
// marginTop: "50px",
// // top: "-272px",
// },
// ],
// 2000,
// {
// scrollSource: "#listBox",
// timeRange: 2000,
// startScrollOffset: 50,
// endScrollOffset: 362,
// }
// );
this.animate(
".daotian",
[
{
opacity: "1",
},
{
opacity: "0",
},
],
1000,
{
scrollSource: "#listBox",
timeRange: 1000,
startScrollOffset: 0,
endScrollOffset: 90,
}
);
}
)
.exec();
},
// tabbar点击监听
onTabItemTap (e) { },
onHide () {
wx.setStorageSync("BILLFROM", "firstBill");
this.setData({
whichOneShow: "",
// topNum: 1,
});
},
onUnload () {
console.log("destory");
},
goList () {
wx.navigateTo({
url: "/pages/filterPage/index",
});
},
});