|
|
"use strict";
|
|
|
const common_vendor = require("../common/vendor.js");
|
|
|
let data = {
|
|
|
globalConstantData: {
|
|
|
requestComeFrom: "assistant_miniapp"
|
|
|
},
|
|
|
/* 固定数据
|
|
|
*/
|
|
|
store() {
|
|
|
return {
|
|
|
appid: "wxa7b4864efbcff191",
|
|
|
//
|
|
|
localBaseImg: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/APP/",
|
|
|
// app图片前缀
|
|
|
cdnBaseImg: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/",
|
|
|
// cdn图片公共前缀路径
|
|
|
v3BaseImg: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/",
|
|
|
// cdn图片公共前缀路径
|
|
|
fadanBaseImg: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/",
|
|
|
loginText: "请登录",
|
|
|
coziID: "7537572244600471579",
|
|
|
baseUrl: "https://daotian.matripe.com.cn",
|
|
|
// 网络请求的基础路径
|
|
|
// baseUrl: "http://192.168.1.87:8001", // 网络请求的基础路径
|
|
|
version: common_vendor.index.getAccountInfoSync().miniProgram.version || "1.0.16"
|
|
|
};
|
|
|
},
|
|
|
fullCopy(data2) {
|
|
|
return JSON.parse(JSON.stringify(data2));
|
|
|
},
|
|
|
/* 清除登录信息存储
|
|
|
*/
|
|
|
clearLocalStorage() {
|
|
|
common_vendor.index.removeStorageSync("apply-avatar");
|
|
|
common_vendor.index.removeStorageSync("apply-username");
|
|
|
common_vendor.index.removeStorageSync("apply-tel");
|
|
|
common_vendor.index.removeStorageSync("apply-token");
|
|
|
common_vendor.index.removeStorageSync("apply-userinfo");
|
|
|
common_vendor.index.removeStorageSync("apply-userinfo-copy");
|
|
|
common_vendor.index.removeStorageSync("apply-agencyId");
|
|
|
common_vendor.index.removeStorageSync("apply-supplierAccount");
|
|
|
common_vendor.index.removeStorageSync("apply-uid");
|
|
|
common_vendor.index.removeStorageSync("agencyInfo");
|
|
|
},
|
|
|
/* 分享给好友
|
|
|
*/
|
|
|
shareFun(path = "/pages/home/index", image = "", title = "报名助手") {
|
|
|
let params = {
|
|
|
path,
|
|
|
// imageUrl: this.store().localBaseImg + 'share.png', // image ? image :
|
|
|
imageUrl: image,
|
|
|
title
|
|
|
};
|
|
|
common_vendor.index.__f__("log", "at utils/common.js:56", "分享数据:", params);
|
|
|
return params;
|
|
|
},
|
|
|
/* 交互反馈:取消确认弹窗
|
|
|
*/
|
|
|
handleConfirm(options) {
|
|
|
common_vendor.index.__f__("log", "at utils/common.js:65", options);
|
|
|
common_vendor.index.showModal({
|
|
|
title: options.title || "",
|
|
|
content: options.content || "",
|
|
|
showCancel: options.showCancel === false ? false : true,
|
|
|
confirmText: options.confirmText || "确定",
|
|
|
confirmColor: options.confirmColor || "#576b95",
|
|
|
cancelColor: options.cancelColor || "#000",
|
|
|
cancelText: options.cancelText || "取消",
|
|
|
success(res) {
|
|
|
options.success(res);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
/* 判断是否登录,未登录,强制跳转至登录页
|
|
|
*/
|
|
|
isLogin() {
|
|
|
let that = this;
|
|
|
if (!common_vendor.index.getStorageSync("apply-token")) {
|
|
|
common_vendor.index.reLaunch({
|
|
|
url: "/root/person/loginIndex?path=/" + that.getPath().path + "&level=" + that.getPath().level
|
|
|
});
|
|
|
return false;
|
|
|
} else {
|
|
|
return true;
|
|
|
}
|
|
|
},
|
|
|
/* 获取当前path
|
|
|
*/
|
|
|
getPath() {
|
|
|
const pages = getCurrentPages();
|
|
|
if (pages.length > 0) {
|
|
|
let _path = pages[pages.length - 1].route;
|
|
|
return {
|
|
|
path: _path,
|
|
|
level: _path.slice(0, 4)
|
|
|
};
|
|
|
} else {
|
|
|
return {
|
|
|
path: "",
|
|
|
level: ""
|
|
|
};
|
|
|
}
|
|
|
},
|
|
|
/* 一键复制文案
|
|
|
*/
|
|
|
copyText($text = "默认文案", $toast = "复制成功") {
|
|
|
common_vendor.index.setClipboardData({
|
|
|
data: $text,
|
|
|
success: function() {
|
|
|
common_vendor.index.showToast({
|
|
|
title: $toast
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
/* 上传图片
|
|
|
*/
|
|
|
uploadImage($num = 1, callback = () => {
|
|
|
}, $sourceType = ["album", "camera"]) {
|
|
|
common_vendor.index.chooseImage({
|
|
|
crop: {
|
|
|
width: 100,
|
|
|
height: 100
|
|
|
},
|
|
|
count: $num,
|
|
|
//默认9
|
|
|
sizeType: ["original", "compressed"],
|
|
|
//可以指定是原图还是压缩图,默认二者都有
|
|
|
sourceType: $sourceType,
|
|
|
//album 从相册选图,camera 使用相机
|
|
|
success: function(res) {
|
|
|
common_vendor.index.__f__("log", "at utils/common.js:134", "选取文件数据:", res);
|
|
|
callback(JSON.stringify(res.tempFilePaths));
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
/* 上传视频和图片
|
|
|
*/
|
|
|
uploadM($num = 1, callback = () => {
|
|
|
}) {
|
|
|
common_vendor.index.chooseMedia({
|
|
|
count: $num,
|
|
|
//默认9
|
|
|
sizeType: ["original", "compressed"],
|
|
|
//可以指定是原图还是压缩图,默认二者都有
|
|
|
sourceType: ["album", "camera"],
|
|
|
//从相册选择
|
|
|
success: function(res) {
|
|
|
common_vendor.index.__f__("log", "at utils/common.js:147", "选取文件数据:", res);
|
|
|
callback(JSON.stringify(res.tempFilePaths));
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
/* 格式转化
|
|
|
* 临时路径转base数据
|
|
|
*/
|
|
|
temToBase($path) {
|
|
|
if ($path) {
|
|
|
common_vendor.index.getFileSystemManager().readFile({
|
|
|
filePath: $path,
|
|
|
encoding: "base64",
|
|
|
success: (res) => {
|
|
|
let base64 = "data:image/jpeg;base64," + res.data;
|
|
|
common_vendor.index.__f__("log", "at utils/common.js:162", "base64:", base64);
|
|
|
return base64;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
/* 设置导航条
|
|
|
*/
|
|
|
setNavStyle($form = "default") {
|
|
|
common_vendor.index.__f__("log", "at utils/common.js:171", "into setNavStyle");
|
|
|
if ($form == "home") {
|
|
|
common_vendor.index.setNavigationBarColor({
|
|
|
backgroundColor: "#fff",
|
|
|
frontColor: "#000000"
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
* 时间格式转换
|
|
|
* @params str 时间戳或者标准时间
|
|
|
* @params type 类型
|
|
|
* @returns
|
|
|
*/
|
|
|
getPointTime(str = "", type = "default") {
|
|
|
let year, month, date, hours, minute, second;
|
|
|
let time;
|
|
|
if (type == "pointDate") {
|
|
|
time = new Date(new Date((/* @__PURE__ */ new Date()).getTime() - (str - 1) * 24 * 60 * 60 * 1e3));
|
|
|
type = "YY--MM--DD";
|
|
|
} else if (type == "yesterday") {
|
|
|
time = new Date(new Date(/* @__PURE__ */ new Date()).setDate(new Date(/* @__PURE__ */ new Date()).getDate() - 1));
|
|
|
type = "YY--MM--DD";
|
|
|
} else if (type == "thisweek") {
|
|
|
if (str == "first") {
|
|
|
let currentDate = /* @__PURE__ */ new Date();
|
|
|
let currentDay = currentDate.getDay();
|
|
|
let daysToSunday = currentDay === 0 ? 7 : currentDay;
|
|
|
let lastSunday = new Date(currentDate.getTime() - daysToSunday * 24 * 60 * 60 * 1e3);
|
|
|
let lastSundayYear = lastSunday.getFullYear();
|
|
|
let lastSundayMonth = lastSunday.getMonth() + 1;
|
|
|
let lastSundayDate = lastSunday.getDate();
|
|
|
let formattedDate = lastSundayYear + "-" + String(lastSundayMonth).padStart(2, "0") + "-" + String(lastSundayDate).padStart(2, "0");
|
|
|
time = formattedDate;
|
|
|
type = "first-week";
|
|
|
} else if (str == "last") {
|
|
|
const today = /* @__PURE__ */ new Date();
|
|
|
if (today.getDay() === 0) {
|
|
|
time = /* @__PURE__ */ new Date();
|
|
|
} else {
|
|
|
time = /* @__PURE__ */ new Date();
|
|
|
}
|
|
|
type = "YY--MM--DD";
|
|
|
}
|
|
|
} else if (type == "lastweek") {
|
|
|
const isSun = /* @__PURE__ */ new Date();
|
|
|
if (isSun.getDay() === 0) {
|
|
|
if (str == "first") {
|
|
|
let currentDate = /* @__PURE__ */ new Date();
|
|
|
let currentDay = currentDate.getDay();
|
|
|
let daysToSunday = currentDay === 0 ? 7 : currentDay;
|
|
|
let lastSunday = new Date(currentDate.getTime() - daysToSunday * 24 * 60 * 60 * 1e3);
|
|
|
let lastSundayYear = lastSunday.getFullYear();
|
|
|
let lastSundayMonth = lastSunday.getMonth() + 1;
|
|
|
let lastSundayDate = lastSunday.getDate();
|
|
|
let formattedDate = lastSundayYear + "-" + String(lastSundayMonth).padStart(2, "0") + "-" + String(lastSundayDate).padStart(2, "0");
|
|
|
time = formattedDate;
|
|
|
type = "first-week";
|
|
|
} else if (str == "last") {
|
|
|
const today = /* @__PURE__ */ new Date();
|
|
|
const dayOfWeek = today.getDay();
|
|
|
const diff = 6 - dayOfWeek;
|
|
|
const targetSaturday = new Date(today.getFullYear(), today.getMonth(), today.getDate() + diff);
|
|
|
const year2 = targetSaturday.getFullYear();
|
|
|
const month2 = targetSaturday.getMonth() + 1;
|
|
|
const date2 = targetSaturday.getDate();
|
|
|
const formattedDate = `${year2}-${month2 < 10 ? "0" + month2 : month2}-${date2 < 10 ? "0" + date2 : date2}`;
|
|
|
time = formattedDate;
|
|
|
type = "end-week";
|
|
|
}
|
|
|
} else {
|
|
|
if (str == "first") {
|
|
|
let getPreviousSundayDate = function() {
|
|
|
const today = /* @__PURE__ */ new Date();
|
|
|
const dayOfWeek = today.getDay();
|
|
|
const daysSinceLastSunday = (dayOfWeek + 6) % 7 + 8;
|
|
|
const previousSunday = new Date(today);
|
|
|
previousSunday.setDate(today.getDate() - daysSinceLastSunday);
|
|
|
return previousSunday;
|
|
|
};
|
|
|
time = new Date(getPreviousSundayDate());
|
|
|
type = "YY--MM--DD";
|
|
|
} else if (str == "last") {
|
|
|
let getPreviousSaturdayDate = function() {
|
|
|
const today = /* @__PURE__ */ new Date();
|
|
|
const dayOfWeek = today.getDay();
|
|
|
const daysSinceLastSaturday = (dayOfWeek + 6) % 7 + 2;
|
|
|
const previousSaturday = new Date(today);
|
|
|
previousSaturday.setDate(today.getDate() - daysSinceLastSaturday);
|
|
|
return previousSaturday;
|
|
|
};
|
|
|
time = new Date(getPreviousSaturdayDate());
|
|
|
type = "YY--MM--DD";
|
|
|
}
|
|
|
}
|
|
|
} else if (type == "thismonth") {
|
|
|
time = new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1);
|
|
|
type = "YY--MM--DD";
|
|
|
} else if (type == "lastmonth") {
|
|
|
if (str == "first") {
|
|
|
time = new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1, 1);
|
|
|
} else if (str == "last") {
|
|
|
time = new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1 + 1, 0);
|
|
|
}
|
|
|
type = "YY--MM--DD";
|
|
|
} else if (type == "first-week")
|
|
|
;
|
|
|
else {
|
|
|
time = str ? new Date(str) : new Date((/* @__PURE__ */ new Date()).getTime());
|
|
|
}
|
|
|
if (time && typeof time == "object") {
|
|
|
year = time.getFullYear();
|
|
|
month = (time.getMonth() + 1).toString().padStart(2, "0");
|
|
|
date = time.getDate().toString().padStart(2, "0");
|
|
|
hours = time.getHours().toString().padStart(2, "0");
|
|
|
minute = time.getMinutes().toString().padStart(2, "0");
|
|
|
second = time.getSeconds().toString().padStart(2, "0");
|
|
|
}
|
|
|
let result;
|
|
|
if (!str) {
|
|
|
return "-";
|
|
|
}
|
|
|
switch (type) {
|
|
|
case "default":
|
|
|
result = year + "-" + month + "-" + date + " " + hours + ":" + minute + ":" + second;
|
|
|
break;
|
|
|
case "small":
|
|
|
result = year + month + date + hours + minute + second;
|
|
|
break;
|
|
|
case "YY--MM--DD HH:MM":
|
|
|
result = year + "-" + month + "-" + date + " " + hours + ":" + minute;
|
|
|
break;
|
|
|
case "MM--DD HH:MM":
|
|
|
result = month + "-" + date + " " + hours + ":" + minute;
|
|
|
break;
|
|
|
case "YY--MM--DD":
|
|
|
result = year + "-" + month + "-" + date;
|
|
|
break;
|
|
|
case "HH:MM:SS":
|
|
|
result = hours + ":" + minute + ":" + second;
|
|
|
break;
|
|
|
case "first-week":
|
|
|
result = time;
|
|
|
break;
|
|
|
case "end-week":
|
|
|
result = time;
|
|
|
break;
|
|
|
}
|
|
|
return result;
|
|
|
},
|
|
|
/* 设置倒计时
|
|
|
* @params time 字符串
|
|
|
*/
|
|
|
setDeadLine(time, type) {
|
|
|
if (type) {
|
|
|
let differenceTime = (/* @__PURE__ */ new Date()).getTime() - new Date(time).getTime();
|
|
|
let absTime = Math.abs(differenceTime);
|
|
|
var D = Math.floor(absTime / (24 * 60 * 60 * 1e3));
|
|
|
var leave1 = absTime % (24 * 3600 * 1e3);
|
|
|
var H = Math.floor(leave1 / (3600 * 1e3));
|
|
|
var leave2 = leave1 % (3600 * 1e3);
|
|
|
var M = Math.floor(leave2 / (60 * 1e3));
|
|
|
var leave3 = leave2 % (60 * 1e3);
|
|
|
var S = Math.floor(leave3 / 1e3);
|
|
|
let symbol = true;
|
|
|
if (differenceTime < 0) {
|
|
|
symbol = false;
|
|
|
}
|
|
|
if (type == "jiaofu") {
|
|
|
if (D > 0) {
|
|
|
return D + (symbol ? "天前" : "天后");
|
|
|
} else if (H > 0) {
|
|
|
return H + (symbol ? "小时前" : "小时后");
|
|
|
} else if (M > 0) {
|
|
|
return M + (symbol ? "分钟前" : "分钟后");
|
|
|
} else {
|
|
|
return "刚刚";
|
|
|
}
|
|
|
} else if (type == "在职") {
|
|
|
if (D > 0) {
|
|
|
return type + D + "天";
|
|
|
} else if (H > 0) {
|
|
|
return type + H + "小时";
|
|
|
} else if (M > 0) {
|
|
|
return type + M + "分钟";
|
|
|
} else {
|
|
|
return type + S + "秒";
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
let differenceTime = new Date(time).getTime() - (/* @__PURE__ */ new Date()).getTime();
|
|
|
let absTime = Math.abs(differenceTime);
|
|
|
let D2 = Math.floor(absTime / (24 * 60 * 60 * 1e3));
|
|
|
let leave12 = absTime % (24 * 3600 * 1e3);
|
|
|
let H2 = Math.floor(leave12 / (3600 * 1e3)) > 9 ? Math.floor(leave12 / (3600 * 1e3)) : "0" + Math.floor(leave12 / (3600 * 1e3));
|
|
|
let leave22 = leave12 % (3600 * 1e3);
|
|
|
let M2 = Math.floor(leave22 / (60 * 1e3)) > 9 ? Math.floor(leave22 / (60 * 1e3)) : "0" + Math.floor(leave22 / (60 * 1e3));
|
|
|
let leave32 = leave22 % (60 * 1e3);
|
|
|
let S2 = Math.floor(leave32 / 1e3) > 9 ? Math.floor(leave32 / 1e3) : "0" + Math.floor(leave32 / 1e3);
|
|
|
let symbol = "";
|
|
|
if (D2 > 0) {
|
|
|
return symbol + D2 + "天";
|
|
|
} else if (H2 > 0) {
|
|
|
return symbol + H2 + ":" + M2 + ":" + S2;
|
|
|
} else if (M2 > 0) {
|
|
|
return symbol + M2 + ":" + S2;
|
|
|
} else {
|
|
|
return symbol + S2 + "秒";
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
/* 省市区格式转化
|
|
|
* 转化前:河南省郑州市
|
|
|
* 转化后:河南省 | 郑州市 |
|
|
|
* @params $list 数组
|
|
|
*/
|
|
|
toGetAddress($list) {
|
|
|
if ($list && $list.length > 0) {
|
|
|
$list.forEach((item) => {
|
|
|
var districtStr = "";
|
|
|
if (item.storeDistrict) {
|
|
|
var districtArr = item.storeDistrict.split(",");
|
|
|
var districtArr1 = [];
|
|
|
districtArr.forEach((item1, index) => {
|
|
|
if (item1.length != 0) {
|
|
|
item1 = item1 + "丨";
|
|
|
if (index < 2) {
|
|
|
districtArr1.push(item1);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
districtStr = districtArr1.join("");
|
|
|
if (item.storeDistrict.indexOf("undefined") > -1) {
|
|
|
districtStr = "-丨";
|
|
|
}
|
|
|
}
|
|
|
item["district"] = districtStr;
|
|
|
});
|
|
|
return $list;
|
|
|
} else {
|
|
|
return [];
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
* 新职位处理
|
|
|
*/
|
|
|
toGetAddressv3($list) {
|
|
|
if ($list && $list.length > 0) {
|
|
|
$list.forEach((item) => {
|
|
|
let storeDistrict = item.storeAddr || item.storeDistrict;
|
|
|
item["district"] = this.setJobInfoPositionv3(storeDistrict);
|
|
|
});
|
|
|
return $list;
|
|
|
} else {
|
|
|
return [];
|
|
|
}
|
|
|
},
|
|
|
handleSetSex($obj = {}) {
|
|
|
if (Boolean($obj.minAgeWoman) === true && Boolean($obj.minAgeMan) === false) {
|
|
|
$obj.gender = "女";
|
|
|
} else if (Boolean($obj.minAgeWoman) === false && Boolean($obj.minAgeMan) === true) {
|
|
|
$obj.gender = "男";
|
|
|
} else {
|
|
|
$obj.gender = "男女不限";
|
|
|
}
|
|
|
return $obj;
|
|
|
},
|
|
|
handleSetAge($obj = {}) {
|
|
|
if ($obj.minAge && $obj.maxAge) {
|
|
|
$obj["age"] = $obj.minAge + "-" + $obj.maxAge + "岁";
|
|
|
} else if ($obj.minAge) {
|
|
|
$obj["age"] = $obj.minAge + "岁以上";
|
|
|
} else if ($obj.maxAge) {
|
|
|
$obj["age"] = $obj.maxAge + "岁以下";
|
|
|
} else if ($obj.minAge == "" && $obj.maxAge == "") {
|
|
|
$obj["age"] = "-";
|
|
|
}
|
|
|
return $obj;
|
|
|
},
|
|
|
setJobInfoPositionv3(str) {
|
|
|
str = str.replace(/;/g, "");
|
|
|
var reg = /.+?(省|市|自治区|自治州|县|区)/g;
|
|
|
let matches = str.match(reg);
|
|
|
let result = "";
|
|
|
function getStr(str2) {
|
|
|
if (matches[0].includes("省") || matches[0].includes("自治区") || matches[0].includes("自治州")) {
|
|
|
if (matches[1].includes("市") && matches[2].includes("市")) {
|
|
|
result = `${matches[0]}丨${matches[2]}`;
|
|
|
} else {
|
|
|
if (matches[2].includes("县")) {
|
|
|
result = `${matches[0]}丨${matches[2]}`;
|
|
|
} else {
|
|
|
result = `${matches[0]}丨${matches[1]}`;
|
|
|
}
|
|
|
}
|
|
|
} else if (matches[1].includes("市")) {
|
|
|
result = `${matches[0]}丨${matches[2]}`;
|
|
|
} else {
|
|
|
result = `${matches[1]}丨${matches[2]}`;
|
|
|
}
|
|
|
}
|
|
|
if (matches && matches.length > 0) {
|
|
|
switch (matches.length) {
|
|
|
case 1:
|
|
|
result = matches[0];
|
|
|
break;
|
|
|
case 2:
|
|
|
if (matches[0].includes("省") || matches[0].includes("自治区") || matches[0].includes("自治州")) {
|
|
|
result = `${matches[0]}丨${matches[1]}`;
|
|
|
} else {
|
|
|
result = `${matches[0]}丨${matches[1]}`;
|
|
|
}
|
|
|
break;
|
|
|
case 3:
|
|
|
getStr();
|
|
|
break;
|
|
|
case 4:
|
|
|
getStr();
|
|
|
break;
|
|
|
case 5:
|
|
|
getStr();
|
|
|
break;
|
|
|
default:
|
|
|
result = str;
|
|
|
break;
|
|
|
}
|
|
|
} else {
|
|
|
result = str;
|
|
|
}
|
|
|
return result;
|
|
|
},
|
|
|
/* 年龄转化
|
|
|
* @params $list 数组
|
|
|
*/
|
|
|
toGetAge($list) {
|
|
|
if ($list && $list.length > 0) {
|
|
|
$list.forEach((item) => {
|
|
|
if (item.minAge && item.maxAge) {
|
|
|
item["age"] = item.minAge + "-" + item.maxAge + "岁";
|
|
|
} else if (item.minAge) {
|
|
|
item["age"] = item.minAge + "岁以上";
|
|
|
} else if (item.maxAge) {
|
|
|
item["age"] = item.maxAge + "岁以下";
|
|
|
} else {
|
|
|
let newArr = [item.minAgeMan, item.maxAgeMan, item.minAgeWoman, item.maxAgeWoman];
|
|
|
newArr.sort();
|
|
|
let minAge = newArr[0] == 0 ? newArr[2] : newArr[0];
|
|
|
let maxAge = newArr[3];
|
|
|
item["age"] = minAge + "-" + maxAge + "岁";
|
|
|
}
|
|
|
});
|
|
|
return $list;
|
|
|
} else {
|
|
|
return [];
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
* 根据薪资类型和薪资值获取薪资展示
|
|
|
*/
|
|
|
getSalaryClassifyValue(salaryClassify, salaryClassifyValue, salaryClassifyValue1) {
|
|
|
var salary = this.moneyToFixed(salaryClassifyValue);
|
|
|
var salary1 = this.moneyToFixed(salaryClassifyValue1);
|
|
|
if (salaryClassify == 0) {
|
|
|
return `${salary}元/小时`;
|
|
|
} else if (salaryClassify == 1) {
|
|
|
return `${salary}元/天`;
|
|
|
} else if (salaryClassify == 2) {
|
|
|
return `补${salary}元`;
|
|
|
} else if (salaryClassify == 3) {
|
|
|
return `返${salary}元`;
|
|
|
} else if (salaryClassify == 4) {
|
|
|
return `计件`;
|
|
|
} else if (salaryClassify == 5) {
|
|
|
return `保底${salary}元`;
|
|
|
} else if (salaryClassify == 6) {
|
|
|
return `面议`;
|
|
|
} else if (salaryClassify == 7) {
|
|
|
return salary + "-" + salary1 + `元/月`;
|
|
|
} else {
|
|
|
return "-";
|
|
|
}
|
|
|
},
|
|
|
/* 同步 */
|
|
|
moneyToFixed(money, fixed = 2, multiplicator = 100) {
|
|
|
if (money != 0 && money != null && money != "" && money != void 0) {
|
|
|
return this.cutZero(new Number(money / multiplicator).toFixed(fixed));
|
|
|
} else {
|
|
|
return "0";
|
|
|
}
|
|
|
},
|
|
|
/* 同步 */
|
|
|
cutZero(old) {
|
|
|
let newstr = old;
|
|
|
var leng = old.length - old.indexOf(".") - 1;
|
|
|
if (old.indexOf(".") > -1) {
|
|
|
for (var i = leng; i > 0; i--) {
|
|
|
if (newstr.lastIndexOf("0") > -1 && newstr.substr(newstr.length - 1, 1) == 0) {
|
|
|
var k = newstr.lastIndexOf("0");
|
|
|
if (newstr.charAt(k - 1) == ".") {
|
|
|
return newstr.substring(0, k - 1);
|
|
|
} else {
|
|
|
newstr = newstr.substring(0, k);
|
|
|
}
|
|
|
} else {
|
|
|
return newstr;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return old;
|
|
|
},
|
|
|
/* 处理职位列表的方法
|
|
|
*/
|
|
|
disposeJobListData(jobList) {
|
|
|
let that = this;
|
|
|
if (jobList !== void 0) {
|
|
|
if (Array.isArray(jobList)) {
|
|
|
jobList.forEach((item) => {
|
|
|
item["workType"] = that.getWorkTypeById(item.workTypeMulti);
|
|
|
if (that.isNotEmptyCheck(item.distance)) {
|
|
|
item["distanceKm"] = that.getDistanceName(item.distance);
|
|
|
}
|
|
|
if (that.isNotEmptyCheck(item.jobDesp)) {
|
|
|
item["jobDesp"] = item["jobDesp"].replaceAll("*****", "");
|
|
|
}
|
|
|
var ageStr2 = "";
|
|
|
if (that.isNotEmptyCheck(item.minAge) && that.isNotEmptyCheck(item.maxAge)) {
|
|
|
ageStr2 = item.minAge + "-" + item.maxAge + "岁";
|
|
|
} else if (that.isNotEmptyCheck(item.minAge)) {
|
|
|
ageStr2 = item.minAge + "岁以上";
|
|
|
} else if (that.isNotEmptyCheck(item.maxAge)) {
|
|
|
ageStr2 = item.maxAge + "岁以下";
|
|
|
}
|
|
|
item["age"] = ageStr2;
|
|
|
item.updateTime = that.getPointTime(item.updateTime, "YY--MM--DD HH:MM");
|
|
|
let differenceTime = (/* @__PURE__ */ new Date()).getTime() - new Date(item.updateTime || /* @__PURE__ */ new Date()).getTime();
|
|
|
var D = Math.floor(differenceTime / (24 * 60 * 60 * 1e3));
|
|
|
var leave1 = differenceTime % (24 * 3600 * 1e3);
|
|
|
var H = Math.floor(leave1 / (3600 * 1e3));
|
|
|
var leave2 = leave1 % (3600 * 1e3);
|
|
|
var M = Math.floor(leave2 / (60 * 1e3));
|
|
|
var leave3 = leave2 % (60 * 1e3);
|
|
|
var S = Math.floor(leave3 / 1e3);
|
|
|
item.diffTime = null;
|
|
|
if (D > 0) {
|
|
|
item.diffTime = D + "天前";
|
|
|
} else if (H > 0) {
|
|
|
item.diffTime = H + "小时前";
|
|
|
} else if (M > 0) {
|
|
|
item.diffTime = M + "分钟前";
|
|
|
} else {
|
|
|
item.diffTime = S + "秒前";
|
|
|
}
|
|
|
if (item.returnFeeType) {
|
|
|
if (item.returnFeeType === 0) {
|
|
|
item.servetype = `${item.returnFee || "--"}元/小时`;
|
|
|
} else if (item.returnFeeType === 1) {
|
|
|
item.servetype = `${item.returnFee || "--"}元/日`;
|
|
|
} else if (item.returnFeeType === 2) {
|
|
|
item.servetype = `${item.returnFee || "--"}元/月`;
|
|
|
} else if (item.returnFeeType === 3) {
|
|
|
item.servetype = `${item.returnFee || "--"}元/次`;
|
|
|
} else if (item.returnFeeType === 4) {
|
|
|
item.servetype = `${item.returnFee || "--"}元/件`;
|
|
|
} else if (item.returnFeeType === 5) {
|
|
|
item.servetype = `工人收入${item.returnFee || "--"}%`;
|
|
|
} else if (item.returnFeeType === 6) {
|
|
|
item.servetype = `共${item.returnFee || "--"}元`;
|
|
|
} else if (item.returnFeeType === 7) {
|
|
|
item.servetype = `费用待定`;
|
|
|
}
|
|
|
} else {
|
|
|
item.servetype = `${item.returnFee || "--"}元/小时`;
|
|
|
}
|
|
|
var districtStr2 = "";
|
|
|
if (that.isNotEmptyCheck(item.district)) {
|
|
|
var districtArr2 = item.district.split(",");
|
|
|
var districtArr12 = [];
|
|
|
districtArr2.forEach((item1, index) => {
|
|
|
if (item1.length != 0 && index < 2) {
|
|
|
item1 = item1 + "丨";
|
|
|
districtArr12.push(item1);
|
|
|
}
|
|
|
});
|
|
|
if (districtArr2.length < 3) {
|
|
|
districtStr2 = districtArr12[districtArr12.length - 1];
|
|
|
} else {
|
|
|
districtStr2 = districtArr12.join("");
|
|
|
}
|
|
|
if (item.district.indexOf("undefined") > -1) {
|
|
|
districtStr2 = "-丨";
|
|
|
}
|
|
|
}
|
|
|
item["district"] = districtStr2;
|
|
|
item["jobRequestLabelNames"] = that.getjobRequestLabelNamesArray(item.jobRequestLabelNames);
|
|
|
const jobRequestLabelNames = [];
|
|
|
if (that.isNotEmptyCheck(item.jobRequestLabelNames) && Array.isArray(item.jobRequestLabelNames)) {
|
|
|
item.jobRequestLabelNames.forEach((item2, index) => {
|
|
|
if (index <= 2) {
|
|
|
jobRequestLabelNames.push(item2);
|
|
|
} else {
|
|
|
return;
|
|
|
}
|
|
|
});
|
|
|
item.jobRequestLabelNames = jobRequestLabelNames;
|
|
|
}
|
|
|
if (Boolean(item.minAgeWoman) === true && Boolean(item.minAgeMan) === false) {
|
|
|
item.gender = "女丨";
|
|
|
} else if (Boolean(item.minAgeWoman) === false && Boolean(item.minAgeMan) === true) {
|
|
|
item.gender = "男丨";
|
|
|
} else {
|
|
|
item.gender = "男女不限丨";
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
jobList["workType"] = that.getWorkTypeById(jobList.workTypeMulti);
|
|
|
if (that.isNotEmptyCheck(jobList.distance)) {
|
|
|
jobList["distanceKm"] = that.getDistanceName(jobList.distance);
|
|
|
}
|
|
|
if (that.isNotEmptyCheck(jobList.jobDesp)) {
|
|
|
jobList["jobDesp"] = jobList["jobDesp"].replaceAll("*****", "");
|
|
|
}
|
|
|
if (Boolean(jobList.minAgeWoman) === true && Boolean(jobList.minAgeMan) === false) {
|
|
|
jobList.genderAge = "女丨" + jobList.minAgeWoman + "-" + jobList.maxAgeWoman + "岁";
|
|
|
} else if (Boolean(jobList.minAgeWoman) === false && Boolean(jobList.minAgeMan) === true) {
|
|
|
jobList.genderAge = "男丨" + jobList.minAgeMan + "-" + jobList.maxAgeMan + "岁";
|
|
|
} else if (jobList.minAgeWoman != jobList.minAgeMan || jobList.maxAgeWoman != jobList.maxAgeMan) {
|
|
|
jobList.genderAge = "男" + jobList.minAgeMan + "-" + jobList.maxAgeMan + "岁丨女" + jobList.minAgeWoman + "-" + jobList.maxAgeWoman + "岁";
|
|
|
} else {
|
|
|
jobList.genderAge = "男女不限丨" + jobList.minAge + "-" + jobList.maxAge + "岁";
|
|
|
}
|
|
|
var ageStr = "";
|
|
|
if (that.isNotEmptyCheck(jobList.minAge) && that.isNotEmptyCheck(jobList.maxAge)) {
|
|
|
ageStr = jobList.minAge + "-" + jobList.maxAge + "岁";
|
|
|
} else if (that.isNotEmptyCheck(jobList.minAge)) {
|
|
|
ageStr = jobList.minAge + "岁以上";
|
|
|
} else if (that.isNotEmptyCheck(jobList.maxAge)) {
|
|
|
ageStr = jobList.maxAge + "岁以下";
|
|
|
}
|
|
|
jobList["age"] = ageStr;
|
|
|
if (jobList.returnFeeType) {
|
|
|
if (jobList.returnFeeType === 0) {
|
|
|
jobList.servetype = `${jobList.returnFee || "--"}元/小时`;
|
|
|
} else if (jobList.returnFeeType === 1) {
|
|
|
jobList.servetype = `${jobList.returnFee || "--"}元/日`;
|
|
|
} else if (jobList.returnFeeType === 2) {
|
|
|
jobList.servetype = `${jobList.returnFee || "--"}元/月`;
|
|
|
} else if (jobList.returnFeeType === 3) {
|
|
|
jobList.servetype = `${jobList.returnFee || "--"}元/次`;
|
|
|
} else if (jobList.returnFeeType === 4) {
|
|
|
jobList.servetype = `${jobList.returnFee || "--"}元/件`;
|
|
|
} else if (jobList.returnFeeType === 5) {
|
|
|
jobList.servetype = `工人收入${jobList.returnFee || "--"}%`;
|
|
|
} else if (jobList.returnFeeType === 6) {
|
|
|
jobList.servetype = `共${jobList.returnFee || "--"}元`;
|
|
|
} else if (jobList.returnFeeType === 7) {
|
|
|
jobList.servetype = `费用待定`;
|
|
|
}
|
|
|
} else {
|
|
|
jobList.servetype = `${jobList.returnFee || "--"}元/小时`;
|
|
|
}
|
|
|
var districtStr = "";
|
|
|
if (that.isNotEmptyCheck(jobList.district) || that.isNotEmptyCheck(jobList.storeDistrict)) {
|
|
|
var districtArr;
|
|
|
districtArr = that.isNotEmptyCheck(jobList.district) ? jobList.district.split(",") : jobList.storeDistrict.split(",");
|
|
|
var districtArr1 = [];
|
|
|
districtArr.forEach((item1, index) => {
|
|
|
if (item1.length != 0 && index < 2) {
|
|
|
item1 = item1 + "丨";
|
|
|
districtArr1.push(item1);
|
|
|
}
|
|
|
});
|
|
|
if (districtArr.length > 3) {
|
|
|
districtStr = districtArr1[districtArr1.length - 1];
|
|
|
} else {
|
|
|
districtStr = districtArr1.join("");
|
|
|
}
|
|
|
if (jobList.district == void 0 && jobList.storeDistrict == void 0) {
|
|
|
districtStr = "-丨";
|
|
|
}
|
|
|
}
|
|
|
jobList["district"] = districtStr;
|
|
|
jobList["jobRequestLabelNames"] = that.getjobRequestLabelNamesArray(jobList.jobRequestLabelNames);
|
|
|
const jobRequestLabelNames1 = [];
|
|
|
if (that.isNotEmptyCheck(jobList.jobRequestLabelNames) && Array.isArray(jobList.jobRequestLabelNames)) {
|
|
|
jobList.jobRequestLabelNames.forEach((item, index) => {
|
|
|
jobRequestLabelNames1.push(item);
|
|
|
});
|
|
|
jobList.jobRequestLabelNames = jobRequestLabelNames1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return jobList;
|
|
|
},
|
|
|
/**
|
|
|
* 根据工种类型ID获取名称
|
|
|
*/
|
|
|
getWorkTypeById(id) {
|
|
|
let str = "";
|
|
|
let array = this.workTypeArray();
|
|
|
array.forEach((item) => {
|
|
|
if (item.id == id) {
|
|
|
str = item.name;
|
|
|
}
|
|
|
});
|
|
|
return str;
|
|
|
},
|
|
|
/**
|
|
|
* 工种类型
|
|
|
*/
|
|
|
workTypeArray() {
|
|
|
let workTypeArray = [
|
|
|
{
|
|
|
id: 0,
|
|
|
name: "全职",
|
|
|
value: "0",
|
|
|
text: "全职",
|
|
|
checked: false
|
|
|
},
|
|
|
{
|
|
|
id: 1,
|
|
|
name: "兼职",
|
|
|
value: "1",
|
|
|
text: "兼职",
|
|
|
checked: false
|
|
|
},
|
|
|
{
|
|
|
id: 2,
|
|
|
name: "寒暑假工",
|
|
|
value: "2",
|
|
|
text: "寒暑假工",
|
|
|
checked: false
|
|
|
},
|
|
|
{
|
|
|
id: 3,
|
|
|
name: "实习生",
|
|
|
value: "3",
|
|
|
text: "实习生",
|
|
|
checked: false
|
|
|
},
|
|
|
{
|
|
|
id: 4,
|
|
|
name: "零工",
|
|
|
value: "4",
|
|
|
text: "零工",
|
|
|
checked: false
|
|
|
}
|
|
|
];
|
|
|
return workTypeArray;
|
|
|
},
|
|
|
/**
|
|
|
* 如果不是是null '' 'null' 'undefined'
|
|
|
* @param item
|
|
|
* @returns
|
|
|
*/
|
|
|
isNotEmptyCheck(value) {
|
|
|
return !this.isEmptyCheck(value);
|
|
|
},
|
|
|
/**
|
|
|
* 如果是null '' 'null' 'undefined'
|
|
|
* @param item
|
|
|
* @returns
|
|
|
*/
|
|
|
isEmptyCheck(value) {
|
|
|
if (value == null || value === "" || value == "null" || typeof value == "undefined") {
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
},
|
|
|
/**
|
|
|
* 根据状态工单类型ID获取名称
|
|
|
*/
|
|
|
getDistanceName(distance) {
|
|
|
let str = "";
|
|
|
if (this.isNotEmptyCheck(distance)) {
|
|
|
if (distance > 1e3) {
|
|
|
var dis = distance / 1e3;
|
|
|
dis = dis.toFixed(1);
|
|
|
str = dis + "km";
|
|
|
} else {
|
|
|
str = distance + "m";
|
|
|
}
|
|
|
}
|
|
|
return str;
|
|
|
},
|
|
|
/* 综合月薪 正则规则
|
|
|
* 价格中间的特殊字符
|
|
|
*/
|
|
|
specStrReg($str) {
|
|
|
let list = [
|
|
|
"~",
|
|
|
"!",
|
|
|
"@",
|
|
|
"#",
|
|
|
"%",
|
|
|
"^",
|
|
|
"&",
|
|
|
"*",
|
|
|
"(",
|
|
|
")",
|
|
|
"!",
|
|
|
"(",
|
|
|
")",
|
|
|
"+",
|
|
|
"`",
|
|
|
"-",
|
|
|
"=",
|
|
|
"·",
|
|
|
"q",
|
|
|
"w",
|
|
|
"e",
|
|
|
"r",
|
|
|
"t",
|
|
|
"y",
|
|
|
"u",
|
|
|
"i",
|
|
|
"o",
|
|
|
"p",
|
|
|
"[",
|
|
|
"]",
|
|
|
"{",
|
|
|
"}",
|
|
|
"|",
|
|
|
"|",
|
|
|
"a",
|
|
|
"s",
|
|
|
"d",
|
|
|
"f",
|
|
|
"g",
|
|
|
"h",
|
|
|
"j",
|
|
|
"k",
|
|
|
"l",
|
|
|
";",
|
|
|
":",
|
|
|
"'",
|
|
|
'"',
|
|
|
":",
|
|
|
"“",
|
|
|
"”",
|
|
|
"z",
|
|
|
"x",
|
|
|
"c",
|
|
|
"v",
|
|
|
"b",
|
|
|
"n",
|
|
|
"m",
|
|
|
",",
|
|
|
".",
|
|
|
"/",
|
|
|
"<",
|
|
|
">",
|
|
|
"?",
|
|
|
"《",
|
|
|
"》",
|
|
|
"?",
|
|
|
"Q",
|
|
|
"W",
|
|
|
"E",
|
|
|
"R",
|
|
|
"T",
|
|
|
"Y",
|
|
|
"U",
|
|
|
"I",
|
|
|
"O",
|
|
|
"P",
|
|
|
"A",
|
|
|
"S",
|
|
|
"D",
|
|
|
"F",
|
|
|
"G",
|
|
|
"H",
|
|
|
"J",
|
|
|
"K",
|
|
|
"L",
|
|
|
"Z",
|
|
|
"X",
|
|
|
"C",
|
|
|
"V",
|
|
|
"B",
|
|
|
"N",
|
|
|
"M",
|
|
|
" ",
|
|
|
"——"
|
|
|
], obj = {
|
|
|
min: 0,
|
|
|
max: 0
|
|
|
};
|
|
|
if ($str) {
|
|
|
list.forEach((item, index) => {
|
|
|
if ($str.indexOf(item) > -1 && $str.split(item)[1]) {
|
|
|
let newlist = [$str.split(item)[0], $str.split(item)[1]];
|
|
|
newlist.sort(function(a, b) {
|
|
|
return a - b;
|
|
|
});
|
|
|
obj = {
|
|
|
min: newlist[0],
|
|
|
max: newlist[1]
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
return obj;
|
|
|
},
|
|
|
getjobRequestLabelNamesArray(jobRequestLabelNames) {
|
|
|
if (this.isNotEmptyCheck(jobRequestLabelNames)) {
|
|
|
return jobRequestLabelNames.split(", ");
|
|
|
}
|
|
|
return [];
|
|
|
},
|
|
|
/* 对象重组成字符串 */
|
|
|
objToStr(obj = {}, type = "url") {
|
|
|
let str = "";
|
|
|
if (type == "url") {
|
|
|
str = Object.keys(obj).map((key) => `${key}=${obj[key]}`).join("&");
|
|
|
} else if (type == "copy") {
|
|
|
str = Object.keys(obj).map((key) => `${key}${obj[key]}`).join("");
|
|
|
}
|
|
|
return str;
|
|
|
},
|
|
|
getUUID() {
|
|
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
|
return (c === "x" ? Math.random() * 16 | 0 : "r&0x3" | "0x8").toString(16);
|
|
|
});
|
|
|
},
|
|
|
getOrderStatus() {
|
|
|
return [
|
|
|
{
|
|
|
id: "10",
|
|
|
name: "待审核",
|
|
|
value: 10,
|
|
|
text: "待审核",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "20",
|
|
|
name: "待接待",
|
|
|
value: 20,
|
|
|
text: "待接待",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "21",
|
|
|
name: "审核未通过",
|
|
|
value: 21,
|
|
|
text: "审核未通过",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "25",
|
|
|
name: "待面试",
|
|
|
value: 25,
|
|
|
text: "待面试",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "26",
|
|
|
name: "未接到",
|
|
|
value: 26,
|
|
|
text: "未接到",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "30",
|
|
|
name: "待入职",
|
|
|
value: 30,
|
|
|
text: "待入职",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "35",
|
|
|
name: "面试未通过",
|
|
|
value: 35,
|
|
|
text: "面试未通过",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "40",
|
|
|
name: "已入职",
|
|
|
value: 40,
|
|
|
text: "已入职",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "48",
|
|
|
name: "约离职",
|
|
|
value: 48,
|
|
|
text: "约离职",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "45",
|
|
|
name: "通过未入职",
|
|
|
value: 45,
|
|
|
text: "通过未入职",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "50",
|
|
|
name: "已离职",
|
|
|
value: 50,
|
|
|
text: "已离职",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "100",
|
|
|
name: "待确认",
|
|
|
value: "50",
|
|
|
text: "待确认",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "101",
|
|
|
name: "已取消",
|
|
|
value: "50",
|
|
|
text: "已取消",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "102",
|
|
|
name: "官方审核中",
|
|
|
value: "50",
|
|
|
text: "官方审核中",
|
|
|
num: 0
|
|
|
},
|
|
|
{
|
|
|
id: "103",
|
|
|
name: "审核不通过",
|
|
|
value: "50",
|
|
|
text: "审核不通过",
|
|
|
num: 0
|
|
|
}
|
|
|
];
|
|
|
},
|
|
|
/* 预览图
|
|
|
*/
|
|
|
viewBigImage($url = "") {
|
|
|
common_vendor.index.previewImage({
|
|
|
urls: [$url],
|
|
|
longPressActions: {
|
|
|
itemList: ["保存图片"],
|
|
|
success: function(data2) {
|
|
|
},
|
|
|
fail: function(err) {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
/* 正则
|
|
|
*/
|
|
|
setReg($str, $type = "default") {
|
|
|
if ($type == "tel") {
|
|
|
return /^[1][3,4,5,7,8,9][0-9]{9}$/.test($str);
|
|
|
}
|
|
|
if ($type == "idcard") {
|
|
|
return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test($str);
|
|
|
}
|
|
|
},
|
|
|
isValidIdCard(idCard) {
|
|
|
const idCardRegex = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])\d{3}[\dXx]$/;
|
|
|
if (!idCardRegex.test(idCard)) {
|
|
|
return false;
|
|
|
}
|
|
|
const factors = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
|
|
|
const checkCodeList = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
|
|
|
let sum = 0;
|
|
|
for (let i = 0; i < 17; i++) {
|
|
|
sum += parseInt(idCard[i]) * factors[i];
|
|
|
}
|
|
|
const checkCode = checkCodeList[sum % 11];
|
|
|
return checkCode === idCard[17].toUpperCase();
|
|
|
},
|
|
|
/* 姓名/性别/年龄/民族
|
|
|
*/
|
|
|
titleToStr($obj) {
|
|
|
let _sex = "", _age = "", _nation = "";
|
|
|
if ($obj.sex == 0) {
|
|
|
_sex = "";
|
|
|
} else if ($obj.sex == 1) {
|
|
|
_sex = "/男";
|
|
|
} else if ($obj.sex == 2) {
|
|
|
_sex = "/女";
|
|
|
} else {
|
|
|
_sex = "";
|
|
|
}
|
|
|
if ($obj.age) {
|
|
|
_age = "/" + $obj.age;
|
|
|
} else {
|
|
|
_age = "";
|
|
|
}
|
|
|
if ($obj.nation) {
|
|
|
_nation = "/" + $obj.nation;
|
|
|
} else {
|
|
|
_nation = "";
|
|
|
}
|
|
|
return _sex + _age + _nation;
|
|
|
},
|
|
|
/**
|
|
|
* app端 获取手机自定义导航高度
|
|
|
*/
|
|
|
getMobileInfo() {
|
|
|
let info = {
|
|
|
top: common_vendor.index.getSystemInfoSync().statusBarHeight,
|
|
|
height: 32
|
|
|
};
|
|
|
return info;
|
|
|
},
|
|
|
/**
|
|
|
* 获取头部nav高度
|
|
|
*/
|
|
|
getNavInfo() {
|
|
|
if (common_vendor.index.getSystemInfoSync()) {
|
|
|
var { statusBarHeight, platform, windowHeight } = common_vendor.index.getSystemInfoSync();
|
|
|
}
|
|
|
if (common_vendor.index.getMenuButtonBoundingClientRect()) {
|
|
|
var { top, height } = common_vendor.index.getMenuButtonBoundingClientRect();
|
|
|
}
|
|
|
let info = {};
|
|
|
info.statusBarHeight = statusBarHeight;
|
|
|
info.menuButtonHeight = height ? height : 32;
|
|
|
info.windowHeight = windowHeight;
|
|
|
if (top && top !== 0 && height && height !== 0) {
|
|
|
const navigationBarHeight = (top - statusBarHeight) * 2 + height;
|
|
|
info.navigationBarHeight = navigationBarHeight;
|
|
|
} else {
|
|
|
info.navigationBarHeight = platform === "android" ? 48 : 40;
|
|
|
}
|
|
|
return info;
|
|
|
},
|
|
|
// 身份证号获取年龄等信息
|
|
|
getInfoByIDcard(idCard) {
|
|
|
let info = {};
|
|
|
let birthday;
|
|
|
if (idCard.length === 15) {
|
|
|
info.sex = ["女", "男"][idCard.substr(14, 1) % 2];
|
|
|
birthday = Y + [idCard.substr(6, 2), idCard.substr(8, 2), idCard.substr(10, 2)].join("-");
|
|
|
} else if (idCard.length === 18) {
|
|
|
info.sex = ["女", "男"][idCard.substr(16, 1) % 2];
|
|
|
birthday = [idCard.substr(6, 4), idCard.substr(10, 2), idCard.substr(12, 2)].join("-");
|
|
|
}
|
|
|
let currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
|
let calculationYear = new Date(birthday).getFullYear();
|
|
|
const wholeTime = currentYear + birthday.substring(4);
|
|
|
const calculationAge = currentYear - calculationYear;
|
|
|
if ((/* @__PURE__ */ new Date()).getTime() > new Date(wholeTime).getTime()) {
|
|
|
info.age = calculationAge;
|
|
|
} else {
|
|
|
info.age = calculationAge - 1;
|
|
|
}
|
|
|
common_vendor.index.__f__("log", "at utils/common.js:1219", "info", info);
|
|
|
return info;
|
|
|
},
|
|
|
/**
|
|
|
* 根据传递的scene参数,获取里面的内容
|
|
|
*/
|
|
|
sceneToJson(sceneStr) {
|
|
|
let json = {};
|
|
|
let array = sceneStr.split(",");
|
|
|
array.forEach((item) => {
|
|
|
let arr = item.split("=");
|
|
|
let key = arr[0];
|
|
|
let value = arr[1];
|
|
|
json[key] = value;
|
|
|
});
|
|
|
return json;
|
|
|
},
|
|
|
/* 扫一扫
|
|
|
*/
|
|
|
handleScanCode() {
|
|
|
let that = this;
|
|
|
function errorMsg() {
|
|
|
that.handleConfirm("无法识别该二维码", () => {
|
|
|
}, () => {
|
|
|
});
|
|
|
}
|
|
|
common_vendor.index.scanCode({
|
|
|
success: function(res) {
|
|
|
common_vendor.index.__f__("log", "at utils/common.js:1247", "获取扫码结果:", res.result);
|
|
|
if (res.result) {
|
|
|
if (res.result.indexOf("=") > -1) {
|
|
|
let params = {
|
|
|
id: res.result.split("=")[1],
|
|
|
isShowMore: false,
|
|
|
isShowJob: false
|
|
|
};
|
|
|
common_vendor.index.navigateTo({
|
|
|
url: "/root/detail/user?" + that.objToStr(params)
|
|
|
});
|
|
|
} else {
|
|
|
errorMsg();
|
|
|
}
|
|
|
} else {
|
|
|
errorMsg();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
/**
|
|
|
* canvas绘图 start
|
|
|
*/
|
|
|
/**
|
|
|
* 文字绘制
|
|
|
*/
|
|
|
fillTextLineBreak(ctx, text, x, y, lw, lh, color = "#333", font = "32", weight = "500", align = "left") {
|
|
|
var i = 0;
|
|
|
var n = 0;
|
|
|
var r = -1;
|
|
|
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;
|
|
|
}
|
|
|
},
|
|
|
// 计算总体宽度
|
|
|
calculateTotalWidth(ctx, segments) {
|
|
|
let totalWidth = 0;
|
|
|
segments.forEach((segment) => {
|
|
|
common_vendor.index.__f__("log", "at utils/common.js:1296", "segment", segment);
|
|
|
if (segment) {
|
|
|
ctx.font = `${segment.fontWeight} ${segment.fontSize}px Arial`;
|
|
|
totalWidth += ctx.measureText(segment.content).width + (segment.space || 0);
|
|
|
}
|
|
|
});
|
|
|
return totalWidth;
|
|
|
},
|
|
|
// 绘制单行居中的拼接文本
|
|
|
drawCenteredText(ctx, x, y, textSegments) {
|
|
|
const totalWidth = this.calculateTotalWidth(ctx, textSegments);
|
|
|
common_vendor.index.__f__("log", "at utils/common.js:1310", "totalWidth", totalWidth, textSegments);
|
|
|
const centerX = x;
|
|
|
const startX = (centerX - totalWidth) / 2;
|
|
|
const centerY = y;
|
|
|
let currentX = startX;
|
|
|
textSegments.forEach((segment) => {
|
|
|
if (segment) {
|
|
|
ctx.font = `${segment.fontWeight} ${segment.fontSize}px Arial`;
|
|
|
ctx.fillStyle = segment.color;
|
|
|
ctx.fillText(segment.content, currentX, centerY);
|
|
|
currentX += ctx.measureText(segment.content).width + (segment.space || 0);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
/**
|
|
|
* 背景图绘制
|
|
|
*/
|
|
|
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();
|
|
|
},
|
|
|
roundRect_yuan(ctx, x, y, size, color) {
|
|
|
ctx.save();
|
|
|
ctx.beginPath();
|
|
|
ctx.arc(size / 2 + x, size / 2 + y, size / 2, 0, Math.PI * 2, false);
|
|
|
ctx.fillStyle = color;
|
|
|
ctx.strokeStyle = color;
|
|
|
ctx.fill();
|
|
|
ctx.clip();
|
|
|
ctx.restore();
|
|
|
},
|
|
|
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();
|
|
|
},
|
|
|
// 绘制折线
|
|
|
setZigzag(ctx) {
|
|
|
const points = [
|
|
|
{ x: 100, y: 100 },
|
|
|
// 起点
|
|
|
{ x: 200, y: 100 },
|
|
|
// 转折点
|
|
|
{ x: 200, y: 200 }
|
|
|
// 终点
|
|
|
];
|
|
|
let cornerRadius = -10;
|
|
|
ctx.lineWidth = lineWidth;
|
|
|
ctx.strokeStyle = strokeColor;
|
|
|
ctx.lineCap = "round";
|
|
|
ctx.beginPath();
|
|
|
ctx.moveTo(points[0].x, points[0].y);
|
|
|
for (let i = 1; i < points.length - 1; i++) {
|
|
|
const prev = points[i - 1];
|
|
|
const curr = points[i];
|
|
|
const next = points[i + 1];
|
|
|
const inVector = { x: curr.x - prev.x, y: curr.y - prev.y };
|
|
|
const outVector = { x: next.x - curr.x, y: next.y - curr.y };
|
|
|
const inLength = Math.sqrt(inVector.x ** 2 + inVector.y ** 2);
|
|
|
const outLength = Math.sqrt(outVector.x ** 2 + outVector.y ** 2);
|
|
|
const normalizedIn = {
|
|
|
x: inVector.x / inLength,
|
|
|
y: inVector.y / inLength
|
|
|
};
|
|
|
const normalizedOut = {
|
|
|
x: outVector.x / outLength,
|
|
|
y: outVector.y / outLength
|
|
|
};
|
|
|
const start = {
|
|
|
x: curr.x - normalizedIn.x * cornerRadius,
|
|
|
y: curr.y - normalizedIn.y * cornerRadius
|
|
|
};
|
|
|
const end = {
|
|
|
x: curr.x + normalizedOut.x * cornerRadius,
|
|
|
y: curr.y + normalizedOut.y * cornerRadius
|
|
|
};
|
|
|
ctx.lineTo(start.x, start.y);
|
|
|
const control1 = {
|
|
|
x: start.x + normalizedOut.x * cornerRadius,
|
|
|
y: start.y + normalizedOut.y * cornerRadius
|
|
|
};
|
|
|
const control2 = {
|
|
|
x: end.x - normalizedIn.x * cornerRadius,
|
|
|
y: end.y - normalizedIn.y * cornerRadius
|
|
|
};
|
|
|
ctx.bezierCurveTo(control1.x, control1.y, control2.x, control2.y, end.x, end.y);
|
|
|
}
|
|
|
ctx.lineTo(points[points.length - 1].x, points[points.length - 1].y);
|
|
|
ctx.stroke();
|
|
|
},
|
|
|
/**
|
|
|
* canvas绘图 end
|
|
|
*/
|
|
|
policyNumToHanZi(i, type = "other") {
|
|
|
let pickerStr;
|
|
|
if (i <= 9) {
|
|
|
switch (i) {
|
|
|
case 1:
|
|
|
pickerStr = type == "add" ? "一条政策" : "政策一";
|
|
|
break;
|
|
|
case 2:
|
|
|
pickerStr = type == "add" ? "二条政策" : "政策二";
|
|
|
break;
|
|
|
case 3:
|
|
|
pickerStr = type == "add" ? "三条政策" : "政策三";
|
|
|
break;
|
|
|
case 4:
|
|
|
pickerStr = type == "add" ? "四条政策" : "政策四";
|
|
|
break;
|
|
|
case 5:
|
|
|
pickerStr = type == "add" ? "五条政策" : "政策五";
|
|
|
break;
|
|
|
case 6:
|
|
|
pickerStr = type == "add" ? "六条政策" : "政策六";
|
|
|
break;
|
|
|
case 7:
|
|
|
pickerStr = type == "add" ? "七条政策" : "政策七";
|
|
|
break;
|
|
|
case 8:
|
|
|
pickerStr = type == "add" ? "八条政策" : "政策八";
|
|
|
break;
|
|
|
case 9:
|
|
|
pickerStr = type == "add" ? "九条政策" : "政策九";
|
|
|
break;
|
|
|
case 10:
|
|
|
pickerStr = type == "add" ? "十条政策" : "政策十";
|
|
|
break;
|
|
|
default:
|
|
|
pickerStr = type == "add" ? i + 1 + "条政策" : "政策" + (i + 1);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
return pickerStr;
|
|
|
},
|
|
|
/**
|
|
|
* 获取服务费类型
|
|
|
* @params returnFeeType 类型
|
|
|
* @params $type 1:共享 0 普通
|
|
|
*/
|
|
|
setReturnFee(returnFee, returnFeeType, $type) {
|
|
|
let servetype = "-", $num = 1;
|
|
|
if ($type == 1) {
|
|
|
$num = 1;
|
|
|
} else {
|
|
|
$num = 100;
|
|
|
}
|
|
|
if (returnFeeType === 0) {
|
|
|
servetype = `${returnFee / $num || "--"}元/小时`;
|
|
|
} else if (returnFeeType === 1) {
|
|
|
servetype = `${returnFee / $num || "--"}元/日`;
|
|
|
} else if (returnFeeType === 2) {
|
|
|
servetype = `${returnFee / $num || "--"}元/月`;
|
|
|
} else if (returnFeeType === 3) {
|
|
|
servetype = `${returnFee / $num || "--"}元/次`;
|
|
|
} else if (returnFeeType === 4) {
|
|
|
servetype = `${returnFee / $num || "--"}元/件`;
|
|
|
} else if (returnFeeType === 5) {
|
|
|
servetype = `工人收入${returnFee / $num || "--"}%`;
|
|
|
} else if (returnFeeType === 6) {
|
|
|
servetype = `共${returnFee / $num || "--"}元`;
|
|
|
} else if (returnFeeType === 7) {
|
|
|
servetype = `费用待定`;
|
|
|
}
|
|
|
return servetype;
|
|
|
},
|
|
|
yijobCopy(recordList) {
|
|
|
var that = this;
|
|
|
common_vendor.index.__f__("log", "at utils/common.js:1530", recordList);
|
|
|
if (recordList && recordList.length > 0) {
|
|
|
recordList.forEach((item, index) => {
|
|
|
var monthlyPayStr = "";
|
|
|
if (that.isNotEmptyCheck(item.minMonthlyPay) && that.isNotEmptyCheck(item.maxMonthlyPay)) {
|
|
|
if (item.minMonthlyPay == item.maxMonthlyPay) {
|
|
|
monthlyPayStr = item.minMonthlyPay / 100;
|
|
|
} else {
|
|
|
monthlyPayStr = item.minMonthlyPay / 100 + "-" + item.maxMonthlyPay / 100;
|
|
|
}
|
|
|
} else if (that.isNotEmptyCheck(item.minMonthlyPay)) {
|
|
|
monthlyPayStr = item.minMonthlyPay / 100;
|
|
|
} else if (that.isNotEmptyCheck(item.maxMonthlyPay)) {
|
|
|
monthlyPayStr = item.maxMonthlyPay / 100;
|
|
|
}
|
|
|
item["monthlyPay"] = monthlyPayStr;
|
|
|
item.jobSpecialLabelNameArray = [];
|
|
|
that.getjobRequestLabelNamesArray(item.jobRequestLabelNames).forEach((i, index2) => {
|
|
|
item["jobSpecialLabelNameArray"].push(i);
|
|
|
});
|
|
|
if (item.distance) {
|
|
|
if (item.distance < 1e3) {
|
|
|
item.distance = item.distance;
|
|
|
} else if (item.distance >= 1e3 && item.distance <= 1e5) {
|
|
|
item.distance = (item.distance / 1e3).toFixed(1) + "km";
|
|
|
} else {
|
|
|
item.distance = (item.distance / 1e3).toFixed() + "km";
|
|
|
}
|
|
|
}
|
|
|
item.cus_price = item.salaryClassify != 7 ? that.getSalaryClassifyValueHtml(item.salaryClassify, item.salaryClassifyValue) : "月薪";
|
|
|
});
|
|
|
}
|
|
|
return recordList;
|
|
|
},
|
|
|
/**
|
|
|
* 根据薪资类型和薪资值获取薪资展示
|
|
|
*/
|
|
|
getSalaryClassifyValueHtml(salaryClassify, salaryClassifyValue, salaryClassifyValue1) {
|
|
|
var salary = this.moneyToFixed(salaryClassifyValue);
|
|
|
this.moneyToFixed(salaryClassifyValue1);
|
|
|
if (salaryClassify == 0) {
|
|
|
return `<span style='font-size:18px'>${salary}<span style='font-size:14px'>元/小时</span></span>`;
|
|
|
} else if (salaryClassify == 1) {
|
|
|
return `<span style='font-size:18px'>${salary}<span style='font-size:14px'>元/天</span></span>`;
|
|
|
} else if (salaryClassify == 2) {
|
|
|
return `<span style='font-size:18px'><span style='font-size:14px'>补</span>${salary}<span style='font-size:14px'>元</span></span>`;
|
|
|
} else if (salaryClassify == 3) {
|
|
|
return `<span style='font-size:18px'><span style='font-size:14px'>返</span>${salary}<span style='font-size:14px'>元</span></span>`;
|
|
|
} else if (salaryClassify == 4) {
|
|
|
return `<span style='font-size:18px'>计件</span>`;
|
|
|
} else if (salaryClassify == 5) {
|
|
|
return `<span style='font-size:14px'>保底</span>${salary}<span style='font-size:14px'>元</span>`;
|
|
|
} else if (salaryClassify == 6) {
|
|
|
return `<span style='font-size:18px'>面议</span>`;
|
|
|
} else if (salaryClassify == 7) {
|
|
|
return `<span style='font-size:18px'>月薪</span>`;
|
|
|
} else {
|
|
|
return "-";
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
* 最大最小年龄获取性别限制
|
|
|
*/
|
|
|
getGenderByMinAge(res) {
|
|
|
let str = "";
|
|
|
if (res.minAgeMan && res.minAgeWoman) {
|
|
|
str = "男女不限";
|
|
|
} else if (res.minAgeMan && !res.minAgeWoman) {
|
|
|
str = "仅限男性";
|
|
|
} else if (!res.minAgeMan && res.minAgeWoman) {
|
|
|
str = "仅限女性";
|
|
|
}
|
|
|
return str;
|
|
|
}
|
|
|
};
|
|
|
exports.data = data;
|
|
|
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/common.js.map
|