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.

1015 lines
29 KiB
JavaScript

2 months ago
let data = {
globalConstantData: {
requestComeFrom: 'dandelion_platform_miniapp',
},
/*
*/
store () {
return {
appid: 'wxa7b4864efbcff191', //
cdnBaseImg: "https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/dailibaoming/", // 图片公共前缀路径
svgBaseImg: "https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/1shoudan/",// svg
fadanBaseImg: "https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/dailibaoming/",
coziID: '7543074655566102537',
// coziID: '7491244881596809243',
baseUrl: "https://daotian.matripe.com.cn",// 网络请求的基础路径
// baseUrl: "http://192.168.3.83:8001", // 网络请求的基础路径
2 months ago
// baseUrl: "http://192.168.1.3:8001",// 118
2 months ago
// #ifdef MP-WEIXIN
version: uni.getAccountInfoSync().miniProgram.version || "1.0.0",
mapKey: 'LHQBZ-MLTEG-BO4QK-QJ2TH-NLGZJ-7GFAS',
// #endif
// #ifdef H5 || APP-PLUS || MP-TOUTIAO || MP-KUAISHOU
version: "1.0.0"
// #endif
}
},
/*
*/
shareFun (
path = "/pages/home/index",
image = "",
title = ''
) {
// console.log(uni.getStorageSync('miniApp-info'));
let appInfo = uni.getStorageSync('miniApp-info')
let params = {
path: path +
`?userId=${uni.getStorageSync("apply-userinfo") ? uni.getStorageSync("apply-userinfo").user.id : ''}`,
imageUrl: appInfo.sharePoster ||
"https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/pugongying/share.jpeg", // image ? image :
title: appInfo.slogan || ' '
};
return params;
},
/*
判断是否登录未登录强制跳转至登录页
*/
isLogin () {
let that = this;
if (!uni.getStorageSync("apply-token")) {
uni.reLaunch({
url: '/root/login/index?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: ''
};
}
},
/**
* 全拷贝
*/
fullCopy (data) {
return JSON.parse(JSON.stringify(data))
},
/**
* 获取头部nav高度
*/
getNavInfo () {
if (uni.getSystemInfoSync()) {
var {
statusBarHeight,
platform,
windowHeight
} = uni.getSystemInfoSync();
}
// #ifdef APP-PLUS || H5 || MP-TOUTIAO || MP-KUAISHOU
var {
top,
height
} = this.getMobileInfo;
// #endif
if (uni.getMenuButtonBoundingClientRect) {
var {
top,
height
} = uni.getMenuButtonBoundingClientRect();
}
// #ifdef MP-WEIXIN
// #endif
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
},
/**
* 根据传递的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('无法识别该二维码', () => { }, () => { });
}
uni.scanCode({
success: function (res) {
// console.log('获取扫码结果:', res.result)
if (res.result) {
if (res.result.indexOf('=') > -1) {
// 前往详情页
let params = {
id: res.result.split('=')[1],
isShowMore: false,
isShowJob: false
};
uni.navigateTo({
url: "/root/detail/user?" + that.objToStr(params),
});
} else {
errorMsg();
}
} else {
errorMsg();
}
}
});
},
/*
*/
setNavStyle ($form = 'default') {
},
// 年月日
formatDateYMD (val) {
// model -> view在更新 `<input>` 元素之前格式化值
if (val == null || val == "") {
return null;
}
if ((val != null || val == "") && typeof val == "string") {
if (val.indexOf("T")) {
val = val.replace("T", " "); //原来L端可能返回的时间格式有带T的格式处理一下
}
val = val.replace("-", "/").replace("-", "/");
}
var value = new Date(val);
// console.log(val);
var fmt = "yyyy-MM-dd";
var o = {
"M+": value.getMonth() + 1, //月份
"d+": value.getDate(), //日
// "H+": value.getHours(), //小时
//"h+": val.getHours()%12 == 0 ? 12 : val.getHours()%12, //小时
// "m+": value.getMinutes(), //分
// "s+": value.getSeconds() //秒
//"S": val.getMilliseconds() //毫秒
//"q+": Math.floor((val.getMonth() + 3) / 3) //季度
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (value.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
}
}
return fmt;
},
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
},
/* ///
*/
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;
},
/*
*/
handleConfirm (
options
) {
// console.log(options);
uni.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);
}
});
},
/*
*/
clearLocalStorage () {
uni.removeStorageSync("apply-avatar");
uni.removeStorageSync("apply-username");
uni.removeStorageSync("apply-tel");
uni.removeStorageSync("apply-token");
uni.removeStorageSync("apply-userinfo");
uni.removeStorageSync("apply-userinfo-copy");
uni.removeStorageSync("apply-agencyId");
uni.removeStorageSync("apply-supplierAccount");
uni.removeStorageSync("IS_MINIAPP_MEMBER");
uni.removeStorageSync("IS_MINIAPP_ADMIN");
uni.removeStorageSync("apply-uid")
uni.removeStorageSync("agencyInfo");
uni.removeStorageSync("HAS_PERMISSION")
uni.removeStorageSync("user_ServicePermission")
2 months ago
uni.removeStorageSync("is_teamleader")
2 months ago
},
/* 对象重组成字符串 */
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;
},
/**
* 分割电话号
*/
splitPhone (str) {
// 判断是否为11位
// console.log(str);
if (str.length != 11) return str;
var arr = str.split('');
arr.splice(3, 0, ' ');
arr.splice(8, 0, ' ');
return arr.join('')
},
/* ()
*/
uploadImage ($num = 1, callback = () => { }, $sourceType = ['album', 'camera']) {
uni.chooseImage({
crop: {
width: 100,
height: 100,
quality: 100,
resize: false,
// destWidth: 100,
},
count: $num, //默认9
sizeType: ['original'], //可以指定是原图还是压缩图,默认二者都有
sourceType: $sourceType, //album 从相册选图camera 使用相机
success: function (res) {
// console.log('选取文件数据:', res)
callback(JSON.stringify(res.tempFilePaths));
}
});
},
getOrderStatus () {
return [{
id: '0',
name: '新简历',
value: 0,
text: '新简历',
num: 0
},
{
id: '1',
name: '推工作',
value: 1,
text: '推工作',
num: 0
},
{
id: '2',
name: '已放弃',
value: 2,
text: '已放弃',
num: 0
},
{
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
},
]
},
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();
},
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 = new Date().getFullYear() //当前的年份
let calculationYear = new Date(birthday).getFullYear() //计算的年份
const wholeTime = currentYear + birthday.substring(4) //周岁时间
const calculationAge = currentYear - calculationYear //按照年份计算的年龄
//判断是否过了生日
if (new Date().getTime() > new Date(wholeTime).getTime()) {
info.age = calculationAge
} else {
info.age = calculationAge - 1
}
// console.log('info', info);
return info
},
/*
*/
setReg ($str, $type = 'default') {
if ($type == 'tel') {
return /^1[3-9]\d{9}$/.test($str);
}
if ($type == 'idcard') {
return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test($str);
}
},
getHrDom (_str) {
return `
<view class="g-components-panel-hr g_flex_row_center" style="padding-bottom: 50px;">
<view class="g_flex_column_center">
<view class="doc-left"></view>
</view>
<view class="g_flex_column_center g_fs_14 g_c_9 g_mr_10 g_ml_10 g_pt_10 g_pb_10">${_str}</view>
<view class="g_flex_column_center">
<view class="doc-right"></view>
</view>
</view>`;
},
getEmptyDom (text = "暂无数据", subText = "") {
const cdnBaseImg = this.store().cdnBaseImg;
const clickAttr = text == '请登录' ? ` @click="${clickHandler}"` : '';
function clickHandler () {
uni.reLaunch({
url: '/root/login/index?path=' + that.getPath().path + '&level=' + that.getPath().level
});
}
// console.log('getEmptyDom', text, subText);
return `
<view class="g_flex_column_center" style="min-height: 69px;">
<view class="btn" ${clickAttr}>
<view class="u-empty"
>
<div class='g_flex_row_center' style='color:rgb(192, 196, 204);margin: 5px 0px 0px;'>${text}</div>
<div class='g_flex_row_center'>
<img src="${cdnBaseImg}noData.svg" alt="" />
</div>
</view>
${subText ? `<view class="g_text_c g_fs_13" style="color: #c0c4cc;">${subText}</view>` : ''}
</view>
</view>
`;
},
2 months ago
/*
* 价格中间的特殊字符
*/
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;
},
2 months ago
/**
* canvas绘图 start
*/
/**
* 文字绘制
*/
fillTextLineBreak (ctx, text, x, y, lw, lh, color = "#333", font = "32", weight = "500") {
// , align = "center"
var i = 0;
var n = 0;
var r = -1;
// var initHeight = 0;
ctx.font = weight + " " + font + "px Arial"; //字体大小
ctx.fillStyle = color; //字体颜色
// ctx.textBaseline = align;
// ctx.textAlign = align;
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;
}
},
/**
* 背景图绘制
*/
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) {
// 开始绘制
ctx.save(); // 保存
ctx.beginPath(); // 开始绘制
// ctx.arc(100, 75, 50, 0, 2 * Math.PI)
ctx.arc(size / 2 + x, size / 2 + y, size / 2, 0, Math.PI * 2, false);
ctx.clip();
// 恢复之前保存的绘图上下文
ctx.restore();
},
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();
},
/**
* canvas绘图 end
*/
1 week ago
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;
},
1 week ago
setDeadLine (time, type) {
if (type) {
// 劳务通的倒计时
let differenceTime = new Date().getTime() - new Date(time).getTime()
let absTime = Math.abs(differenceTime)
var D = Math.floor(absTime / (24 * 60 * 60 * 1000));
var leave1 = absTime % (24 * 3600 * 1000);
var H = Math.floor(leave1 / (3600 * 1000));
var leave2 = leave1 % (3600 * 1000);
var M = Math.floor(leave2 / (60 * 1000));
var leave3 = leave2 % (60 * 1000);
var S = Math.floor(leave3 / 1000);
// 时间正负的判断标识
let symbol = true
if (differenceTime < 0) {
symbol = false
}
// // console.log('type', type);
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 S + (symbol ? "秒前" : '秒后');
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 if (type == '后入职') {
// 处理 待入职 的时间显示
// console.log('后入职');
if (D > 0) {
return D + '天' + type
} else if (H > 0) {
return H + '小时' + type
} else if (M > 0) {
return M + '分钟' + type
} else {
return S + '秒' + type
}
} else if (type == 'task') {
// 处理 待入职 的时间显示
let mark = '剩余'
if (symbol) {
mark = '逾期'
}
// console.log('后入职');
if (D > 0) {
return mark + (D >= 999 ? '999+' : D) + '天'
} else if (H > 0) {
return mark + H + '小时'
} else if (M > 0) {
return mark + M + '分钟'
} else {
return '刚刚'
}
}
} else {
let differenceTime = new Date(time).getTime() - new Date().getTime()
let absTime = Math.abs(differenceTime)
let D = Math.floor(absTime / (24 * 60 * 60 * 1000))
let leave1 = absTime % (24 * 3600 * 1000)
let H = Math.floor(leave1 / (3600 * 1000)) > 9 ? Math.floor(leave1 / (3600 * 1000)) : '0' + Math.floor(leave1 / (3600 * 1000))
let leave2 = leave1 % (3600 * 1000)
let M = Math.floor(leave2 / (60 * 1000)) > 9 ? Math.floor(leave2 / (60 * 1000)) : '0' + Math.floor(leave2 / (60 * 1000))
let leave3 = leave2 % (60 * 1000)
let S = Math.floor(leave3 / 1000) > 9 ? Math.floor(leave3 / 1000) : '0' + Math.floor(leave3 / 1000)
// 倒计时到期的判断
let symbol = ''
if (differenceTime < 0) {
symbol = '-'
}
if (D > 0) {
return symbol + D + '天'
} else if (H > 0) {
return symbol + H + ':' + M + ':' + S
} else if (M > 0) {
return symbol + M + ':' + S
} else {
return symbol + S + '秒'
// return '刚刚'
}
}
},
setLWTRightTime ($time = '', $type = '') {
let str = '';
// console.log('$type1', $type);
if (!$time) {
// console.log('1914 001')
$time = new Date().getTime();
}
// 将时间戳转换为毫秒
const timestamp = parseInt($time);
const currentTime = new Date().getTime();
const timeDiff = currentTime - timestamp; // 毫秒差值
// console.log('timeDiff 000', timeDiff);
// 计算时间差
const seconds = Math.floor(Math.abs(timeDiff) / 1000);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);
// console.log('$type 111', $type, '===', days, hours, minutes, seconds);
if (new Date().getTime() - $time > 0) {
// $time 是过去的某个时间(之前)
if ($type == 60) {// 60推工作
if (minutes < 1) {
// 1分钟内
str = '刚刚';
} else if (minutes >= 1 && minutes <= 60) {
// 1分钟~60分钟内
str = `${Math.min(minutes, 60)}分钟前`;
} else if (minutes > 60 && hours <= 24) {
// 60分钟~24小时内
str = `${Math.min(hours, 24)}小时前`;
} else if (days >= 0) {
// 超过1天
if ($type == 40) {
str = `${days}天前提交`;
} else {
str = `${days}天前`;
}
} else {
console.log('1914 001')
}
}
} else {
// $time 是未来的某个时间(之后)
if ($type == 60) {// 60推工作
if (minutes < 1) {
// 1分钟内
str = '刚刚';
} else if (minutes >= 1 && minutes <= 60) {
// 1分钟~60分钟内
str = `${Math.min(minutes, 60)}分钟后`;
} else if (minutes > 60 && hours <= 24) {
// 60分钟~24小时内
str = `${Math.min(hours, 24)}小时后`;
} else if (days >= 0) {
// 超过1天
str = `${days}天后`;
} else {
console.log('1914 001')
}
}
}
if ($type == 50 || $type == 40) {// 50新简历 40待审核
if (minutes < 1) {
// 1分钟内
str = '刚刚';
} else if (minutes >= 1 && minutes <= 60) {
// 1分钟~60分钟内
str = `${Math.min(minutes, 60)}分钟前`;
} else if (minutes > 60 && hours <= 24) {
// 60分钟~24小时内
str = `${Math.min(hours, 24)}小时前`;
} else if (days >= 0) {
// 超过1天
if ($type == 40) {
str = `${days}天前提交`;
} else {
str = `${days}天前`;
}
} else {
console.log('1914 001')
}
}
// console.log('$type', $type);
if ($type == 70) {// 待面试
// const timeDiff = timestamp - currentTime; // 毫秒差值,正数表示未来时间,负数表示过去时间
// console.log('timeDiff111', timeDiff);
if (timeDiff < 0) {
// 面试时间在未来
// const hours = Math.floor(timeDiff / (1000 * 60 * 60));
// const days = Math.floor(hours / 24);
if (minutes < 1) {
// 1分钟内
str = '此刻应面试';
} else if (minutes >= 1 && minutes <= 60) {
// 1分钟~60分钟内
str = `${minutes}分钟后面试`;
} else if (minutes > 60 && hours <= 24) {
// 60分钟~24小时内
str = `${hours}小时后面试`;
} else if (days >= 0) {
// 超过1天
str = `${days}天后面试`;
}
// if (hours < 24) {
// str = `${hours}小时后面试`;
// } else {
// str = `${days}天后面试`;
// }
} else {
// 已超过面试时间
// const absTimeDiff = Math.abs(timeDiff);
// const hours = Math.floor(absTimeDiff / (1000 * 60 * 60));
// const days = Math.floor(hours / 24);
if (minutes < 1) {
// 1分钟内
str = '此刻应面试';
} else if (minutes >= 1 && minutes <= 60) {
// 1分钟~60分钟内
str = `超过${minutes}分钟`;
} else if (minutes > 60 && hours <= 24) {
// 60分钟~24小时内
str = `超过${hours}小时`;
} else if (days >= 0) {
// 超过1天
str = `超过${days}`;
}
// if (hours < 24) {
// str = `超过${hours}小时`;
// } else {
// str = `超过${days}天`;
// }
}
}
if ($type == 80) {// 待入职
// const timeDiff = timestamp - currentTime; // 毫秒差值,正数表示未来时间,负数表示过去时间
if (timeDiff < 0) {
// 入职时间在未来
// const hours = Math.floor(timeDiff / (1000 * 60 * 60));
// const days = Math.floor(hours / 24);
if (minutes < 1) {
// 1分钟内
str = '此刻应入职';
} else if (minutes >= 1 && minutes <= 60) {
// 1分钟~60分钟内
str = `${minutes}分钟后入职`;
} else if (minutes > 60 && hours <= 24) {
// 60分钟~24小时内
str = `${hours}小时后入职`;
} else if (days >= 0) {
// 超过1天
str = `${days}天后入职`;
}
// if (hours < 24) {
// str = `${hours}小时后入职`;
// } else {
// str = `${days}天后入职`;
// }
} else {
// 已超过入职时间
// const absTimeDiff = Math.abs(timeDiff);
// const hours = Math.floor(absTimeDiff / (1000 * 60 * 60));
// const days = Math.floor(hours / 24);
if (minutes < 1) {
// 1分钟内
str = '此刻应入职';
} else if (minutes >= 1 && minutes <= 60) {
// 1分钟~60分钟内
str = `超过${minutes}分钟`;
} else if (minutes > 60 && hours <= 24) {
// 60分钟~24小时内
str = `超过${hours}小时`;
} else if (days >= 0) {
// 超过1天
str = `超过${days}`;
}
}
}
if ($type == 90) {// 在职中
if (minutes < 1) {
// 1分钟内
str = '刚刚跟进';
} else if (minutes >= 1 && minutes <= 60) {
// 1分钟~60分钟内
str = `${Math.min(minutes, 60)}分钟前跟进`;
} else if (minutes > 60 && hours <= 24) {
// 60分钟~24小时内
str = `${Math.min(hours, 24)}小时前跟进`;
} else if (days >= 0) {
// 超过1天
str = `${days}天前跟进`;
}
}
if ($type == 110) {// 已完成
if (minutes < 1) {
// 1分钟内
str = '刚刚跟进';
} else if (minutes >= 1 && minutes <= 35) {
// 1分钟~35分钟内
str = `${Math.min(minutes, 35)}分钟前跟进`;
} else if (minutes > 35 && hours <= 24) {
// 35分钟~24小时内
str = `${Math.min(hours, 24)}小时前跟进`;
} else if (days >= 0 && days < 99) {
// 超过1天但小于99天
str = `${days}天前跟进`;
} else if (days >= 99) {
// 超过99天
str = '99+天前跟进';
}
}
return str;
},
2 months ago
}
export default data;