You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

762 lines
23 KiB
JavaScript

2 years ago
const app = getApp();
const commonUtil = require("../../utils/commonUtil");
2 years ago
const dateUtil = require("../../utils/dateUtil");
2 years ago
const { wxml, style } = require("./demo.js");
var QQMapWX = require("../../utils/qqmap-wx-jssdk.min.js");
var qqmapsdk;
Page({
2 years ago
data: {
isLogin: false,
2 years ago
statusBarHeight: wx.getStorageSync("statusBarHeight"), // 状态栏高度
2 years ago
navigationBarHeight: wx.getStorageSync("navigationBarHeight"), // 导航栏高度
menuButtonHeight: wx.getStorageSync("menuButtonHeight"), // 胶囊按钮高度
menuButton: wx.getStorageSync("menuButtonInfo"), // 胶囊信息
backHeight: wx.getMenuButtonBoundingClientRect().top + (wx.getMenuButtonBoundingClientRect().height / 2) + 'px',
storeJobId: "",
iosDialog: false,
//职位ID
searchForm: {
storeJobId: "",
},
fullScreen: false,
bclr: "",
djxx: "",
currIndex: "1",
jobDetail: {}, //详情
wxCode: "",
pbtm: 0,
shareTitle: "",
isCollect: false,
src: "",
word: "woca",
phoneDialog: false,
isImg: true,
labelColor: ["#c41d7f", "#096dd9", "#531dab", "#d46b08", "#389e0d", "#08979c", "#cf1322"],
bgColor: ["#fff0f6", "#e6f7ff", "#f9f0ff", "#fff7e6", "#f6ffed", "#e6fffb", "#fff1f0"],
wxml: {
text: "啊啊按",
},
addressNew: "",
citys: "",
showSexAgeText: "",
fuWuFei: "",
isServicePriceShow: true,
isAgency: true,
isShareShow: false,
managerRoleClassify: false, // 管理员权限
serviceInfo: app.globalData.serviceInfo,
isMaskShow: false,
onSiteRemark: "",
img: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/bg.png",
canvasImg: "",
isLoading: true,
iosDialogTobe: false, // 成为代理弹窗显示
userInfo: {},
shareListImg: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/detail830-1.png",
shareDetailImg: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/posterbg1.1.png",
2 years ago
posterImg: "",
2 years ago
safeBottom: wx.getWindowInfo().screenHeight - wx.getWindowInfo().safeArea.height + 'px',
fromScene: false,
fromShoucangOrBaoming: '',
recordBillShow: false
},
showdialog () {
this.setData({
iosDialog: true,
});
},
closeDialog () {
this.setData({
iosDialog: false,
});
},
onShow () {
2 years ago
var that = this;
console.log(that.data.safeBottom);
2 years ago
this.setData({
2 years ago
isLogin: app.globalData.isLogin,
// backHeight:wx.getMenuButtonBoundingClientRect().top,
2 years ago
isLoading: true,
// userInfo:{...app.globalData.loginUserInfo, agencyStatus:0},
});
if (app.globalData.isLogin) {
that.setData({
// agencyStatus: app.globalData.agencyStatus,
userInfo: app.globalData.loginUserInfo,
});
} else {
this.wxLogin();
2 years ago
}
that.searchAnimate();
2 years ago
console.log(that.data.userInfo);
},
showphone: function () {
2 years ago
var that = this;
2 years ago
wx.makePhoneCall({
// number: that.data.jobDetail.assistantUserTel + ""
phoneNumber: that.data.serviceInfo.workPhone || "0371-6611 3723",
});
},
close: function () {
this.setData({
phoneDialog: false,
});
},
wxLogin () {
var that = this;
wx.login({
success (res) {
if (res.code) {
that.setData({
wxCode: res.code,
});
} else {
console.log("获取code失败" + res.errMsg);
}
},
});
},
showImage (e) {
let resImg = e.currentTarget.dataset.src;
var imgArr = [];
this.data.jobDetail.storeImage.forEach((item) => {
// let regs = /\.(jpg|jpeg|png)(\?.*)?$/;
// item.isImg = regs.test(item.url.toLowerCase());
if (item.isImg) {
imgArr.push(item.url);
}
});
wx.previewImage({
current: e.currentTarget.dataset.src, // 当前显示图片的http链接
urls: imgArr,
});
},
onLoad (query) {
var that = this;
2 years ago
this.data.searchForm.storeJobId = query.storeJobId;
2 years ago
this.getStoreJobDetailById();
// that.setData({
// wxCode: that.data.wxCode
// })
wx.setStorageSync({
key: "storeJobId",
data: query.storeJobId,
});
2 years ago
2 years ago
},
2 years ago
backIndex () {
2 years ago
wx.switchTab({
url: '../index/index',
})
},
2 years ago
searchAnimate () {
let that = this;
wx.createSelectorQuery()
.select("#listBox")
.fields(
{
scrollOffset: true,
size: true,
},
(res) => {
this.animate(
".navigatorBar",
[
{
2 years ago
opacity: 0
2 years ago
},
{
2 years ago
opacity: 1
2 years ago
},
],
800,
{
scrollSource: "#listBox",
timeRange: 1000,
startScrollOffset: 0,
endScrollOffset: 120,
}
2 years ago
);
this.animate(
2 years ago
".noBack",
[
{
2 years ago
opacity: 1
2 years ago
},
{
2 years ago
opacity: 0
2 years ago
},
],
800,
{
scrollSource: "#listBox",
timeRange: 1000,
startScrollOffset: 0,
endScrollOffset: 1,
}
);
}
)
.exec();
},
goBack () {
if (this.data.fromScene) {
2 years ago
wx.switchTab({
url: '../index/index',
})
2 years ago
} else {
2 years ago
wx.navigateBack({
delta: -1,
})
}
},
2 years ago
getStoreJobDetailById () {
var that = this;
wx.showLoading({
title: "加载中...",
});
wx.request({
// url: app.globalData.ip + "/store/job/getStoreJobDetailById?storeJobId=" + that.data.searchForm.storeJobId,
2 years ago
url: app.globalData.ip + "/assistant/job/get/" + that.data.searchForm.storeJobId,
method: "get",
2 years ago
header: app.globalData.headers,
data: that.data.searchForm,
success: function (res) {
console.log(res);
if (res.data.status == 200) {
var result = res.data.data;
2 years ago
var title = result.job.jobName;
2 years ago
2 years ago
console.log(title)
2 years ago
that.setData({
shareTitle: title,
2 years ago
onSiteRemark: result.job.onSiteRemark,
2 years ago
});
2 years ago
let regs = /\.(jpg|jpeg|png)(\?.*)?$/;
2 years ago
// res.data.data.storeImage.forEach((item) => {
// item.isImg = regs.test(item.url.toLowerCase());
2 years ago
// });
// result.job.genderRestrict = commonUtil.getGenderByMinAge(result.job);
if(result.job.updateTime){
result.job.updateTime = dateUtil.timeShowXXX(result.job.updateTime)
}
2 years ago
// if (app.isNotEmptyCheck(title)) {
// title = result.storeJob.jobName;
// } else {
// title = result.store.aliasName;
// }
2 years ago
2 years ago
// // wx.setNavigationBarTitle({
// // title,
// // });
2 years ago
2 years ago
// result.storeJob.workType = commonUtil.getWorkTypeById(result.storeJob.workTypeMulti);
2 years ago
2 years ago
// if (app.isNotEmptyCheck(result.storeJob.calculationSalaryType)) {
// result.storeJob.calculationSalaryType = result.storeJob.calculationSalaryType.split("#")[0];
// }
if (app.isNotEmptyCheck(result.job.jobDesp)) {
result.job.jobDesp = result.job.jobDesp.replaceAll("*****", "").split("————————")[0].replace("⚠", "<i class='t-icon t-icon-zhuyi' style='margin-bottom:-2px;width:17px;height:17px;background-repeat:no-repeat;background-size:100% 100%'></i>").replace("[红包]", "<i class='t-icon t-icon-hongbao' style='margin-bottom:-2px;width:17px;height:17px;background-repeat:no-repeat;background-size:100% 100%'></i>");
2 years ago
}
2 years ago
// console.log(result.job)
that.disposeJobListData(result.job);
// if (app.isNotEmptyCheck(result.job.logo)) {
// result.job["logo2"] = result.job.logo.replace("http:", "https:");
// result.job.logo.indexOf("https") > -1 ? result.job.logo : result.logo.replace("http", "https")
// } else {
// result.job["logo2"] = "";
// }
2 years ago
// console.log(commonUtil.getReturnFeeTypeName1ById(result.storeJob.returnFeeType, result.storeJob.returnFee));
console.log("isout");
2 years ago
if (app.isNotEmptyCheck(result.job.returnFeeType) || result.job.returnFeeType == "0" || result.job.returnFee == "0") {
2 years ago
that.setData({
2 years ago
fuWuFei: commonUtil.getReturnFeeTypeName1ById(result.job.returnFeeType, result.job.returnFee),
2 years ago
});
}
// else if (result.storeJob.returnFeeType == 7) {
// that.setData({
// fuWuFei: commonUtil.getReturnFeeTypeNameById(result.storeJob.returnFeeType),
// });
// }
else {
that.setData({
fuWuFei: "-",
});
}
2 years ago
console.log(res.data.data.collected);
2 years ago
console.log(commonUtil);
2 years ago
result.job['collected'] = result.collected ? 1 : 2
2 years ago
that.setData({
2 years ago
jobDetail: result.job,
// isMaskShow: !(result.storeJob.recruitment == "1"),
// citys: citys || "-",
// addressNew: result.store.district.replace(/,/g, "") + result.store.detailPosition,
2 years ago
});
2 years ago
2 years ago
that.showSexAge();
console.log(that.data.jobDetail);
}
wx.hideLoading();
},
});
},
showSexAge () {
var that = this;
var manStr = "";
var womanStr = "";
2 years ago
if (app.isNotEmptyCheck(that.data.jobDetail.minAgeMan) || app.isNotEmptyCheck(that.data.jobDetail.maxAgeMan)) {
2 years ago
manStr = "男 ";
}
2 years ago
if (app.isNotEmptyCheck(that.data.jobDetail.minAgeMan)) {
manStr = manStr + that.data.jobDetail.minAgeMan;
2 years ago
}
2 years ago
if (app.isNotEmptyCheck(that.data.jobDetail.maxAgeMan)) {
manStr = manStr + "-" + that.data.jobDetail.maxAgeMan;
2 years ago
}
2 years ago
if (app.isNotEmptyCheck(that.data.jobDetail.minAgeWoman) || app.isNotEmptyCheck(that.data.jobDetail.maxAgeWoman)) {
2 years ago
womanStr = "女 ";
}
2 years ago
if (app.isNotEmptyCheck(that.data.jobDetail.minAgeWoman)) {
womanStr = womanStr + that.data.jobDetail.minAgeWoman;
2 years ago
}
2 years ago
if (app.isNotEmptyCheck(that.data.jobDetail.maxAgeWoman)) {
womanStr = womanStr + "-" + that.data.jobDetail.maxAgeWoman;
2 years ago
}
if (womanStr != "") {
manStr = manStr + `${manStr == "" ? "" : ""}` + womanStr;
}
that.setData({
showSexAgeText: manStr,
});
},
/**
* 处理后台返回的职位列表
*/
disposeJobListData (jobDetail) {
var that = this;
console.log(jobDetail);
2 years ago
// item["workType"] = commonUtil.getWorkTypeById(
// item.workTypeMulti
// );
// if (app.isNotEmptyCheck(item.distance)) {
// item["distanceKm"] = commonUtil.getDistanceName(
// item.distance
// );
// }
//年龄
var ageStr = "";
2 years ago
if (app.isNotEmptyCheck(jobDetail.minAge) && app.isNotEmptyCheck(jobDetail.maxAge)) {
ageStr = jobDetail.minAge + "-" + jobDetail.maxAge + "岁";
} else if (app.isNotEmptyCheck(jobDetail.minAge)) {
ageStr = jobDetail.minAge + "岁以上";
} else if (app.isNotEmptyCheck(jobDetail.maxAge)) {
ageStr = jobDetail.maxAge + "岁以下";
2 years ago
}
2 years ago
jobDetail["age"] = ageStr;
2 years ago
//时薪
// var hourlyPayStr = "";
var hasHourlyPay = true;
2 years ago
console.log(jobDetail);
// if (app.isNotEmptyCheck(jobDetail.hourlyPay)) {
// hourlyPayStr = jobDetail.hourlyPay + "元/小时";
2 years ago
// hasHourlyPay = true;
2 years ago
// } else if (app.isNotEmptyCheck(jobDetail.dayPay)) {
// hourlyPayStr = jobDetail.dayPay + "元/日";
2 years ago
// hasHourlyPay = true;
// } else {
2 years ago
// if (app.isNotEmptyCheck(jobDetail.minMonthlyPay) && app.isNotEmptyCheck(jobDetail.maxMonthlyPay)) {
// if (jobDetail.minMonthlyPay == jobDetail.maxMonthlyPay) {
// hourlyPayStr = jobDetail.minMonthlyPay;
2 years ago
// } else {
2 years ago
// hourlyPayStr = jobDetail.minMonthlyPay + "-" + jobDetail.maxMonthlyPay;
2 years ago
// }
2 years ago
// } else if (app.isNotEmptyCheck(jobDetail.minMonthlyPay)) {
// hourlyPayStr = jobDetail.minMonthlyPay;
// } else if (app.isNotEmptyCheck(jobDetail.maxMonthlyPay)) {
// hourlyPayStr = jobDetail.maxMonthlyPay;
2 years ago
// }
// }
2 years ago
// if (app.isNotEmptyCheck(jobDetail.dayPay)){
2 years ago
// }
2 years ago
// if (app.isNotEmptyCheck(jobDetail.salaryClassify) && app.isNotEmptyCheck(jobDetail.salaryClassifyValue)) {
2 years ago
2 years ago
jobDetail["hourlyPay"] = commonUtil.getSalaryClassifyValue(jobDetail.salaryClassify, jobDetail.salaryClassifyValue);
2 years ago
// }
//月薪
var monthlyPayStr = "";
if (hasHourlyPay) {
2 years ago
if (app.isNotEmptyCheck(jobDetail.minMonthlyPay) && app.isNotEmptyCheck(jobDetail.maxMonthlyPay)) {
if (jobDetail.minMonthlyPay == jobDetail.maxMonthlyPay) {
monthlyPayStr = jobDetail.minMonthlyPay/100;
2 years ago
} else {
2 years ago
monthlyPayStr = jobDetail.minMonthlyPay/100 + "-" + jobDetail.maxMonthlyPay/100;
2 years ago
}
2 years ago
} else if (app.isNotEmptyCheck(jobDetail.minMonthlyPay)) {
monthlyPayStr = jobDetail.minMonthlyPay/100;
} else if (app.isNotEmptyCheck(jobDetail.maxMonthlyPay)) {
monthlyPayStr = jobDetail.maxMonthlyPay/100;
2 years ago
}
}
2 years ago
jobDetail["monthlyPay"] = monthlyPayStr;
2 years ago
//地址深圳丨龙岗区丨
2 years ago
// var districtStr = "";
// if (app.isNotEmptyCheck(jobDetail.store.district)) {
// var districtArr = jobDetail.store.district.split(",");
// if (districtArr.length < 3) {
// districtStr = districtArr[districtArr.length - 1];
// } else {
// districtStr = districtArr[1] + "丨" + districtArr[2];
// }
// //districtStr = districtArr[1] + '丨' + districtArr[2];
// }
// jobDetail.store["districtStr"] = districtStr;
// jobDetail["districtDetail"] = commonUtil.getStoreAddress(jobDetail.district, jobDetail.detailPosition);
// //职位特色
if (app.isNotEmptyCheck(jobDetail.jobSpecialLabelNames)) {
jobDetail["jobSpecialLabelNames"] = that.getJobSpecialLabelNamesArray(jobDetail.jobSpecialLabelNames);
2 years ago
}
2 years ago
// if (app.isNotEmptyCheck(jobDetail.jobRequestLabelNames)) {
// jobDetail['jobRequestLabelNames'] = that.getJobRequestLabelNamesArray(jobDetail.jobRequestLabelNames);
2 years ago
// }
},
makePhoneCall () {
console.log(1);
var that = this;
wx.makePhoneCall({
// number: that.data.jobDetail.assistantUserTel + ""
phoneNumber: that.data.serviceInfo.workPhone || "0371-6611 3723",
});
// var that = this;
// let res = wx.getStorageSync({
// key: "assistantUserTel"
// });
// console.log(res);
// console.log("缓存获取电话号:" + res.data);
// if (app.isNotEmptyCheck(res.data)) {
// wx.makePhoneCall({
// number: res.data
// });
// } else {
// wx.request({
// url: app.globalData.ip + "/store/job/getOneAssistantUser",
// method: "POST",
// header: app.globalData.headers,
// data: {},
// success: function (res) {
// console.log(res.data.data.tel);
// wx.setStorageSync({
// key: "assistantUserTel",
// data: res.data.data.tel
// });
// wx.makePhoneCall({
// number: res.data.data.tel + ""
// });
// }
// });
// }
},
emptyMethod () { },
wxLogin () {
var that = this;
wx.login({
success (res) {
if (res.code) {
that.setData({
wxCode: res.code,
});
} else {
console.log("获取code失败" + res.errMsg);
}
},
});
},
getPhoneNumber (e) {
var that = this;
console.log(e);
console.log(e.detail.errMsg);
2 years ago
console.log(that.data.jobDetail);
2 years ago
/*wx.setStorageSync({
2 years ago
key: "jobDetailStorage",
2 years ago
data: that.data.jobDetail,
2 years ago
});*/
2 years ago
wx.setStorageSync("jobDetailStorage", that.data.jobDetail);
2 years ago
// 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,
2 years ago
type: "yishoudan",
2 years ago
appId: app.globalData.appId
},
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;
console.log(that.data.isAgency);
if (collected) {
promise.then((res) => {
that.setData({
isLogin: app.globalData.isLogin,
});
that.doCollected(collected, e.currentTarget.dataset.jobid);
});
} else {
/*wx.navigateTo({
2 years ago
url: "../enroll/index?applyType=1&tel=" + res.data.data.phoneNumber
});*/
2 years ago
promise.then((res) => {
let argument;
2 years ago
argument = JSON.stringify(that.data.jobDetail).replace(/\=|\&/g, "3D");
2 years ago
wx.navigateTo({
url: `../newEnroll/enroll/index?applyType=1&info=${argument}`,
});
});
}
promise.then(() => {
console.log(app.globalData.loginUserInfo.agencyStatus);
that.setData({
isAgency: app.globalData.loginUserInfo.agencyStatus == 1 ? true : false,
});
});
// wx.navigateTo({
// url: "../enroll/index?applyType=1&tel=" + res.data.data.phoneNumber
// });
},
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,
2 years ago
type: "yishoudan",
2 years ago
appId: app.globalData.appId
},
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) => {
let argument;
2 years ago
argument = JSON.stringify(that.data.jobDetail).replace(/\=|\&/g, "3D");
2 years ago
wx.navigateTo({
url: `../newEnroll/enroll/index?applyType=1&info=${argument}`,
});
});
}
promise.then(() => {
console.log(app.globalData.loginUserInfo.agencyStatus);
that.setData({
isAgency: app.globalData.loginUserInfo.agencyStatus == 1 ? true : false,
});
});
},
fail: function (res) {
console.log("获取用户手机号错误");
},
});
} else {
console.log("获取手机号失败!" + res.errMsg);
}
},
});
},
});
} else {
//拒绝
var collected = e.currentTarget.dataset.collected;
if (collected) {
try {
wx.setStorageSync("comeFromPage", "detail");
wx.setStorageSync("comeFromPageParam", { storeJobId: that.data.searchForm.storeJobId });
} catch (e) {
console.log("detail-页面跳转,设置参数错误:", e);
}
wx.navigateTo({
url: "/pages/login/index",
});
} else {
wx.navigateTo({
//url: "../enroll/index?applyType=1&tel=" + res.data.data.phoneNumber
url: "../enroll/index?applyType=1",
});
}
}
return false;
},
2 years ago
2 years ago
collectPaste (e) {
var txt;
2 years ago
var that = this;
if (!this.data.isLogin) {
wx.setStorageSync("comeFromPage", "detail");
2 years ago
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;
2 years ago
var url = "/assistant/job/collect/"+storeJobId;
2 years ago
//发起网络请求
wx.request({
url: app.globalData.ip + url,
header: app.globalData.headers,
method: "GET",
success: function (res) {
2 years ago
console.log(res)
2 years ago
var txt;
if (collected - 1 == 0) {
//取消收藏
2 years ago
that.data.jobDetail.collected = 2;
2 years ago
txt = "取消收藏";
} else {
//收藏
2 years ago
that.data.jobDetail.collected = 1;
2 years ago
txt = "收藏成功";
2 years ago
}
2 years ago
that.setData({
jobDetail: that.data.jobDetail,
isLogin: app.globalData.isLogin,
});
console.log(that.data.jobDetail);
wx.showToast({
icon: "none",
title: txt,
});
},
fail: function (res) {
console.log("操作失败");
},
});
},
2 years ago
2 years ago
/**
* 阻止滑动穿透
*
*
*/
modalMove () {
return false;
},
showTobe () {
this.setData({
iosDialogTobe: true,
});
},
closeTobe () {
this.setData({
iosDialogTobe: false,
});
},
onShareAppMessage: function (res) {
console.log(res)
return{
tittle:'转发标题',
desc:'转发提示',
path:'/pages/detail/index?storeJobId=' + this.data.searchForm.storeJobId,
success:function(res){},
fail:function(res){}
}
2 years ago
},
onShareTimeline: function () {},
share(){
this.onShareAppMessage()
},
goNewEnroll (e) {
let that = this;
this.setData({
recordBillShow: true
})
}
2 years ago
});