const app = getApp(); const commonUtil = require("../../utils/commonUtil.js"); Page({ data: { currentInfo:{}, recordShow: false, 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: [], wannaList: ["电子厂", "大龄工", "日结", "保底", "返费", "短期工", "新能源", "富士康", "暑假工", "焊工", "食品", "学生"], storeJobListSearchForm: { pageNum: 1, pageSize: 20, classify: 1, sex: -1, workTypeStr: "", lat: "", lng: "", jobClassify: "", sortTag: 0, jobSpecialLabelIds: "", cityName: "", brandIds: "", ujc: 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: "all", sexid: "-1", // 性别筛选的id dialog1: false, dialog2: false, jobSpecialLabelList: [], brandList: [], firstMenu: "排序", // 工价筛选tab显示 secondMenu: "性别", // 性别筛选tab显示 selectBrandList: [], // 选中的品牌标签 selectJobList: [], // 选中的特色标签 tagArray0: [], tagArray1: [], tagArray2: [], tagArray3: [], recordBillType: "", // 报名类型(拍照或者直接报名) signType: 0, // 职位类型(自营 三方) recordCount: 0, totalPage: 0, currPage: 0, currentJobDrawer: {}, // 当前简版职位抽屉信息 drawerShow: false, // 简版职位抽屉显隐 choiceCollect: 0, //收藏的筛选 corpUserFlag: app.globalData.loginUserInfo.corpUserFlag, // 内部成员的判断 agencyStatus: app.globalData.loginUserInfo.agencyStatus, // 是否是代理的判断 serviceInfo: {}, // 代理信息 navigatorBarHeight: 0, // 头部整体高度信息 iosDialog: false, // 成为代理弹窗 isLoading: true, // 成为代理图片加载loading效果 isScrollTop: false, // 控制职位列表的滚动 isWannaShow: false, // 猜你想搜是否显示 historyList: [], // 最近搜索列表 from: "", // 来自哪个页面 placeholderText: "请输入关键词", isFilterPage: false, }, // onPullDownRefresh:function(){ // this.getJobList(); // console.log(123); // wx.stopPullDownRefresh({ // success() { // app.refreshSuccess(); // } // }); // }, goLogin() { wx.setStorageSync("comeFromPage", "index"); 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; console.log(id); that.setData({ toped: id, // isScrollTop: false, }); // 切换标准 简版 重新查询列表 // 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", }); } }, 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() {}, choosen: function (e) { var str = e.currentTarget.dataset.id; // var ageStr = e.currentTarget.dataset.str; this.setData({ sexid: str, }); }, choiceSex(e) { var that = this; // let str = that.data.sexid console.log(e); let str = e.currentTarget.dataset.id; console.log(str); if (str == "1") { this.data.secondMenu = "男生"; } else if (str == "2") { this.data.secondMenu = "女生"; } else if (str == "-1") { this.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: [], }); 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) { console.log(e); if (this.data.inputVal.trim() == "" && this.data.placeholderText == "请输入关键词") { wx.showToast({ title: "请输入内容", icon: "none", }); } else { this.setData({ isWannaShow: false, recordList: [], }); console.log(this.data.placeholderText); this.data.storeJobListSearchForm.pageNum = 1; this.data.storeJobListSearchForm.keys = this.data.inputVal || this.data.placeholderText; this.setData({ inputVal: this.data.inputVal || this.data.placeholderText, }); this.getJobList(); this.setHistoryList(); } }, setHistoryList() { let that = this; if (app.isNotEmptyCheck(wx.getStorageSync("projectSearch"))) { that.data.historyList = wx.getStorageSync("projectSearch"); } if (that.data.historyList.indexOf(that.data.inputVal) > -1) { that.data.historyList.splice(that.data.historyList.indexOf(that.data.inputVal), 1); that.data.historyList.unshift(that.data.inputVal); } else { that.data.historyList.unshift(that.data.inputVal); } if (that.data.historyList.length > 10) { that.data.historyList = that.data.historyList.splice(0, 10); } that.setData({ historyList: that.data.historyList, }); wx.setStorageSync("projectSearch", that.funQC(that.data.historyList)); }, showInput: function () { this.setData({ inputShowed: true, }); }, hideInput: function () { this.setData({ inputVal: "", inputShowed: false, }); }, onShareAppMessage1: function () { var path = commonUtil.getCurrentPageUrlWithArgs(); if (app.globalData.isLogin && app.globalData.agencyStatus - 0 != 0) { //当前用户是代理人 path += (path.indexOf("?") >= 0 ? "&" : "?") + "agencyUserId=" + app.globalData.loginUserInfo.id; } console.log(path); return { title: "伯才", path: path, }; }, clearInput: function () { this.setData({ inputVal: "", chaShowed: false, inputShowed: false, hasMoreData: true, recordList: [], isWannaShow: true, placeholderText: "请输入关键词", }); this.inputBlur(); this.clearFilter(); this.data.storeJobListSearchForm.pageNum = 1; this.data.storeJobListSearchForm.keys = ""; }, inputTyping: function (e) { this.setData({ inputVal: e.detail.value, }); console.log(this.data.inputVal == ""); if (this.data.inputVal == "") { this.setData({ recordList: [], isWannaShow: true, }); this.data.storeJobListSearchForm.pageNum = 1; this.data.storeJobListSearchForm.keys = ""; // this.getJobList(); } }, clear() { wx.clearStorage(); console.log("清除成功"); }, inputBlur() {}, getListByTypeAndIndustry: function () { var that = this; wx.request({ url: app.globalData.ip + "/labels/getListByTypeAndIndustry", data: { type: 90, industry: 2, }, header: app.globalData.header, method: "GET", success: function (res) { console.log(res.data.data); // that.setData({ // tagArray0: [], // tagArray1: [], // tagArray2: [], // tagArray3: [], // }); 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); } }); that.setData({ tagArray0: that.data.tagArray0, tagArray1: that.data.tagArray1, tagArray2: that.data.tagArray2, tagArray3: that.data.tagArray3, }); 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; wx.request({ url: app.globalData.ip + "/labels/type/95", // 分类列表获取接口 header: app.globalData.header, 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); 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 + "/brand/getBrandNameAllList", // data: {}, // header: app.globalData.header, // method: "GET", // success: function (res) { // console.log(res); // var brandIdArray = that.data.storeJobListSearchForm.brandIds.split(","); // res.data.data.pageBean.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, }); } 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; var index = e.currentTarget.dataset.index; if (that.data.brandList[index].checked) { that.data.brandList[index].checked = false; // let index1 = that.data.selectBrandList.indexOf(that.data.brandList[index]) // that.data.selectBrandList.splice(index1,1) } else { that.data.brandList[index].checked = true; } console.log(that.data.selectBrandList); this.setData({ brandList: that.data.brandList, }); }, 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: [], }); that.getJobList(); }, loginOut: function () { var that = this; var jobSpecialLabelIdArray = []; that.data.jobSpecialLabelList.forEach((item) => { if (item.checked) { jobSpecialLabelIdArray.push(item.id); } }); if (jobSpecialLabelIdArray.length > 0) { that.data.storeJobListSearchForm.jobSpecialLabelIds = jobSpecialLabelIdArray.join(","); } else { that.data.storeJobListSearchForm.jobSpecialLabelIds = ""; } var brandIdArray = []; that.data.selectBrandList = []; that.data.brandList.forEach((item) => { if (item.checked) { if (that.data.selectBrandList.indexOf(item) == -1) { that.data.selectBrandList.push(item); } brandIdArray.push(item.id); } }); that.data.selectJobList = []; let jobList = that.data.tagArray0.concat(that.data.tagArray1, that.data.tagArray2, that.data.tagArray3); jobList.forEach((item) => { if (item.checked) { 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, }); that.getJobList(); }, onLoad(options) { var that = this; console.log(options); console.log(that.data.menuButton); // let query = wx.createSelectorQuery() // console.log(query.select('#searchBar')); console.log(app.globalData.isLogin); console.log(app.globalData.loginUserInfo.agencyStatus); 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); }, }); } }, }); // 检查从哪个页面进来的 console.log(options); if (options.from) { if (options.from != "filter") { this.setData({ isWannaShow: true, }); if (options.listtype) { this.setData({ toped: options.listtype, }); } } this.setData({ from: options.from, }); } if (options.data) { console.log(JSON.parse(options.data)); that.data.storeJobListSearchForm = JSON.parse(options.data); } if (options.key) { this.setData({ placeholderText: options.key, }); } if (app.isNotEmptyCheck(options.fromSearchPage) && options.fromSearchPage == 1) { // try { // var searchCityParamStorage = wx.getStorageSync("searchCityParamStorage"); // var searchValue = wx.getStorageSync("SEARCH_VAL"); // console.log(searchValue); // if (searchCityParamStorage) { // console.log("searchCityParamStorage======", searchCityParamStorage); // that.data.storeJobListSearchForm.cityName = searchCityParamStorage.name; // if (app.isEmptyCheck(searchCityParamStorage.name)) { // that.data.storeJobListSearchForm.cityName = "全国"; // } // console.log(that.data.storeJobListSearchForm); // console.log(searchValue); // if (searchValue) { // that.data.storeJobListSearchForm.keys = searchValue; // that.data.inputVal = searchValue; // } // that.setData({ // searchCityParamStorage: searchCityParamStorage, // storeJobListSearchForm: that.data.storeJobListSearchForm, // inputVal: that.data.inputVal, // }); // this.getJobList(); // } // } catch (e) { // console.log("获取缓存设置的查询职位列表参数错误:", e); // } } else { try { wx.removeStorageSync("searchJobListParamStorage"); } catch (e) { console.log("删除缓存设置的查询职位列表参数错误:", e); } try { wx.removeStorageSync("searchCityParamStorage"); } catch (e) { console.log("删除缓存设置的查询职位列表参数错误:", e); } } try { if (app.globalData.isScanQRCodes - 1 == 0) { wx.showToast({ title: "欢迎查看好工作", icon: "success", duration: 2000, }); if (!getApp().globalData.isLogin) { setTimeout(function () { if (!getApp().globalData.isLogin) { that.openIOS2(); } }, 5000); } } } 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; } }, onReady() { let that = this; }, 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; console.log(that.data.from); 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{ // that.setData({ // recordList: [], // }); // that.getJobList(); } if (app.isNotEmptyCheck(wx.getStorageSync("projectSearch")) && that.data.from == "project") { console.log(wx.getStorageSync("projectSearch")); that.setData({ historyList: wx.getStorageSync("projectSearch"), }); } if (that.data.from == "filter") { console.log(123); that.data.storeJobListSearchForm.keys = "1"; that.setData({ isFilterPage: true, recordList: [], }); that.getJobList(); wx.setNavigationBarTitle({ title: "职位匹配", }); } 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; wx.request({ url: app.globalData.ip + "/store/job/collected/list?ujc=1", method: "GET", data: {}, header: app.globalData.headers, success: function (res) { console.log(res); let collectList = res.data.data.pageBean.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; 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; console.log("search"); if (!that.data.isLogin) { wx.navigateTo({ url: "/pages/login/index", }); return; } wx.navigateTo({ url: "../city/index?from=search", }); wx.setStorageSync("SEARCH_VAL", that.data.storeJobListSearchForm.keys); }, 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(e) { console.log(e); var that = this; // debugger 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.inputVal); console.log(that.data.searchCityParamStorage); that.data.storeJobListSearchForm.cityName = that.data.searchCityParamStorage.name; 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); 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); that.setData({ totalPage: res.data.data.pageBean.pageCount, currPage: res.data.data.pageBean.currentPage, }); 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); 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); that.setData({ recordList: that.data.recordList, hasMoreData: true, isTrigger: false, }); } wx.hideLoading({ success: (res) => {}, }); that.setData({ loading: false, pageShow: true, storeJobListSearchForm: that.data.storeJobListSearchForm, }); resolve(); that.getTag(); that.data.recordList.forEach((item, index) => { 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, isWannaShow: that.data.searchCityParamStorage ? false : true, }); setTimeout(() => { var query = wx.createSelectorQuery(); query.select(".navigator").boundingClientRect(); query.exec(function (res) { //res就是 所有标签为v1的元素的信息 的数组 console.log(res); //取高度 console.log(res[0].height); that.setData({ navigatorBarHeight: res[0].height, }); console.log(that.data.navigatorBarHeight); }); }, 300); // if (that.data.recordList.length < res.data.data.pageBean.recordCount) { // that.setData({ // hasMoreData: true, // }); // } else { // that.setData({ // hasMoreData: false, // }); // } }, }); }); }, 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 + "&wxCode=" + that.data.wxCode, }); } else { wx.navigateTo({ url: "../login/index", }); } }, backIndex() { console.log(123); wx.reLaunch({ url: "/pages/firstBill/index", success: (result) => {}, fail: () => {}, complete: () => {}, }); }, /** * 简版抽屉 * * */ 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("[红包]", ""); that.setData({ currentJobDrawer: { ...event.currentTarget.dataset.item, index: event.currentTarget.dataset.index }, drawerShow: true, }); console.log(this.data.currentJobDrawer); }, 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, }); 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, }); }, 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 未过期,并且在本生命周期一直有效 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.pageBean.openId; let promise = app.setLoginUserTokenInfo(res.data.data.pageBean.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); //发起网络请求 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.pageBean.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.pageBean.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 未过期,并且在本生命周期一直有效 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.pageBean.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); //发起网络请求 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.pageBean.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; wx.request({ url: app.globalData.ip + "/channel/contact/getAgencyUserId", method: "GET", header: app.globalData.header, 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.navigateTo({ 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 = "/yishoudan/custom/job/collect/" + storeJobId; // if (collected - 1 == 0) { // url = "/user/collect/job/remove"; // } // console.log(app.globalData.headers); //发起网络请求 wx.request({ url: app.globalData.ip + url, // data: { // jobId: storeJobId, // classify:0 // }, 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 = 0; break; } } txt = "取消收藏"; } 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, 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); //发起网络请求 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.ujc = 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", }); }); }, fail() { console.log("获取位置失败,打开位置设置界面"); }, }); } } 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", }); }); } 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.ujc = // that.data.storeJobListSearchForm.brandIds = ""; that.data.storeJobListSearchForm.jobCategoryLabelIds = ""; that.data.storeJobListSearchForm.pageNum = 1; that.data.storeJobListSearchForm.sortTag = 0; that.data.storeJobListSearchForm.sex = -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: "all", }); if (!that.data.isWannaShow) { // that.choiceFilter({ // currentTarget: { // dataset: { // id: "all", // }, // }, // }); // that.choiceSex({ // currentTarget: { // dataset: { // id: "-1", // }, // }, // }); that.getJobList("isWannaShow"); } }, scroll(e) { e.preventDefault(); e.stopPropagation(); }, stoptap(e) { e.preventDefault(); e.stopPropagation(); }, changeContact() { console.log(2123); wx.navigateTo({ url: `/pages/configAnnunciate/index`, }); }, /** * 简版报名 * * */ hidedrawershow (e) { console.log(e); this.setData({ [e.detail.type]: false }) wx.showTabBar({ animation: false, success: (result) => { }, fail: () => { }, complete: () => { } }); }, hideDrawer () { let that = this; this.getTabBar().setData({ isShow: true, }); that.setData({ drawerShow: false, }); // this.getJobList(); // setTimeout(() => { // wx.showTabBar({ // success(e) {}, // }); // }, 300); }, recordBill (e) { // if (!this.data.isLogin) { // wx.navigateTo({ // url: "/pages/login/index", // }); // return; // } 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 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}`, // }); }, imageLoad() { this.setData({ isLoading: false, }); }, setKey(e) { console.log(e); let data = e.currentTarget.dataset.key; this.data.storeJobListSearchForm.keys = data; this.setData({ inputVal: data, isWannaShow: false, }); this.setHistoryList(); this.getJobList(); }, /** * 存最近搜索调用的函数 * * */ funQC(arr) { let newsArr = []; for (let i = 0; i < arr.length; i++) { if (app.isEmptyCheck(arr[i])) { continue; } if (newsArr.indexOf(arr[i]) === -1) { newsArr.push(arr[i]); } } return newsArr; }, /** * 删除最近搜索 * * */ closeDialog() { this.setData({ iosDialog: false, }); }, /** * 阻止滑动穿透 * * */ clearNearSearch() { let that = this; wx.showModal({ title: "删除最近搜索", content: "确定删除所有的最近搜索吗?", contentColor: "#ccc", confirmColor: "#ff4400", confirmText: "确定", cancelText: "取消", success(res) { console.log(res); if (res.confirm) { that.setData({ historyList: [], }); wx.removeStorageSync("projectSearch"); wx.showToast({ title: "已删除", icon: "none", }); } }, }); }, modalMove() { return false; }, onHide() { console.log("hide"); wx.removeStorageSync("searchJobListParamStorage"); wx.removeStorageSync("searchCityParamStorage"); this.setData({ whichOneShow: "", }); }, onUnload() { console.log("destory"); }, });