From ed747af07e2f36fffd1663ced9e580e9a4e5bb36 Mon Sep 17 00:00:00 2001 From: zsk <710162063@qq.com> Date: Wed, 14 May 2025 20:21:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 4 +- src/utils/common.js | 740 ++++++++++++++++++++++++++++++------- src/utils/request.js | 1 + src/views/homePage/fastExamine.vue | 2 +- src/views/login.vue | 40 +- 5 files changed, 637 insertions(+), 150 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 77cf03c..2321d5b 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -48,7 +48,7 @@ const router = createRouter({ component: () => import("../views/homePage/examine.vue") }, { - path: "/merchantManagement/fasExamine", + path: "/merchantManagement/fastExamine", name: "fastExamine", meta: { title: '快速入驻', @@ -109,7 +109,9 @@ router.beforeEach(async (to, from, next) => { isLogin = true; } console.log(isLogin); + debugger if (isLogin) { + if (to.path == '/login') { next("/merchantManagement/homePage"); } diff --git a/src/utils/common.js b/src/utils/common.js index 606736e..9c96c5f 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -5,6 +5,22 @@ import { } from 'ant-design-vue'; let data = { version: '公共组件', + isOpenMock: false,// 是否开放假功能 + sha:'2025bckj', + env () { + if (import.meta.env.MODE == 'development') { + return 'dev' + } else { + return 'prod' + } + }, + getEnv () {// 不常用。仅服务于某些功能在开发模式下使用或者说是 只有在开发模式下可以看到 + if (import.meta.env.MODE == 'development') { + return 'dev' + } else { + return 'prod' + } + }, /** * model自定义确认弹窗 * @params title 标题 @@ -53,7 +69,28 @@ let data = { }, }) } - + }, + permissionStr () { + return { + 'queryTag': 'queryTag', + 'updateTag': 'updateTag', + 'addTag': 'addTag', + 'deleteTag': 'deleteTag', + 'importTag': 'importTag', + 'exportTag': 'exportTag', + } + }, + gResize (callback = () => { }) { + callback() + let handleResize = () => { + callback() + }; + window.addEventListener('resize', handleResize); + }, + getDayOfWeek () { + const days = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; + const date = new Date(); + return days[date.getDay()]; }, /** * 时间格式转换 @@ -182,6 +219,9 @@ let data = { case 'default':// 2023-10-31 09:00:00 result = year + '-' + month + '-' + date + ' ' + hours + ':' + minute + ':' + second; break; + case 'version': // 2023-10-31 09:00:00 + result = year + month + date; + break; case 'YY--MM--DD HH:MM':// 2023-10-31 09:00 result = year + '-' + month + '-' + date + ' ' + hours + ':' + minute; break; @@ -222,7 +262,7 @@ let data = { * @params $type 1:共享 0 普通 */ setReturnFee (returnFee, returnFeeType, $type) { - let servetype, $num = 1; + let servetype = '', $num = 1; if ($type == 1) { $num = 1; } else { @@ -231,7 +271,7 @@ let data = { if (returnFeeType === 0) { servetype = `${returnFee / $num || "--"}元/小时`; } else if (returnFeeType === 1) { - servetype = `${returnFee / $num || "--"}元/日`; + servetype = `${returnFee / $num || "--"}元/天`; } else if (returnFeeType === 2) { servetype = `${returnFee / $num || "--"}元/月`; } else if (returnFeeType === 3) { @@ -244,6 +284,8 @@ let data = { servetype = `共${returnFee / $num || "--"}元`; } else if (returnFeeType === 7) { servetype = `费用待定`; + } else { + servetype = `-`; } return servetype }, @@ -257,7 +299,13 @@ let data = { .test($str); } if ($type == 'tel') { - return /^[1][3,4,5,7,8,9][0-9]{9}$/.test($str); + return /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test($str); + } + if ($type == 'name') { + return /^[\u4E00-\u9FA5\·A-Za-z]+$/.test($str); + } + if ($type == 'idCard') { + return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test($str); } if ($type == 'grade1') { return /^[0-9]*$/.test($str); // 纯数字 @@ -286,10 +334,10 @@ let data = { { 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 }, + // { 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 }, // { id: "60", name: "已完成", value: "60", text: "已完成", num: 0 } ]; let data = []; @@ -340,6 +388,17 @@ let data = { } else { return type + S + '秒' } + } else if (type == '后入职') { + // 处理 跟入职 的时间显示 + 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 { @@ -453,6 +512,36 @@ let data = { return []; } }, + toGetAddresCopy ($list) { + if ($list && $list.length > 0) { + $list.forEach(item => { + var districtStr = ""; + if (item.storeDistrict) { + var districtArr = item.storeDistrict.split(","); + var districtArr1 = []; + // console.log(districtArr); + districtArr.forEach((item1) => { + if (item1.length != 0) { + item1 = item1 + "丨"; + districtArr1.push(item1); + } + }); + if (districtArr.length < 3) { + districtStr = districtArr1[districtArr1.length - 1]; + } else { + districtStr = districtArr1.join(""); + } + if (item.storeDistrict.indexOf("undefined") > -1) { + districtStr = "-丨"; + } + } + item["district"] = districtStr; + }); + return $list; + } else { + return []; + } + }, /* 性别转化 * @params $list 数组 */ @@ -514,38 +603,38 @@ let data = { if ($type == "default") { if (salaryClassify == 0) { return `
` + - ` ${hourlyPay}` + - ` 元/小时` + + ` ${hourlyPay}` + + ` 元/小时` + `
`; } else if (salaryClassify == 1) { return `
` + - ` ${hourlyPay}` + - ` 元/天` + + ` ${hourlyPay}` + + ` 元/天` + `
`; } else if (salaryClassify == 2) { return `
` + - ` ` + - ` ${hourlyPay}` + - ` ` + + ` ` + + ` ${hourlyPay}` + + ` ` + `
`; } else if (salaryClassify == 3) { return `
` + - ` ` + - ` ${hourlyPay}` + - ` ` + + ` ` + + ` ${hourlyPay}` + + ` ` + `
`; } else if (salaryClassify == 4) { - return `计件`; + return `计件`; } else if (salaryClassify == 5) { return `
` + - ` 保底` + - ` ${hourlyPay}` + - ` ` + + ` 保底` + + ` ${hourlyPay}` + + ` ` + `
`; } else if (salaryClassify == 6) { - return `面议`; + return `面议`; } else if (salaryClassify == 7) { - return `月薪`; + return `月薪`; } else { return "-"; } @@ -654,7 +743,7 @@ let data = { }, /* 处理职位列表的方法 */ - disposeJobListData (jobList) { + disposeJobListData (jobList, $bili = 1,$count = 2) { let that = this; if (jobList !== undefined) { if (Array.isArray(jobList)) { @@ -699,25 +788,26 @@ let data = { item.diffTime = S + "秒前"; } if (item.returnFeeType) { + item.returnFee = Number(item.returnFee); if (item.returnFeeType === 0) { - item.servetype = `${item.returnFee || "--"}元/小时`; + item.servetype = `${item.returnFee / $bili || "--"}元/小时`; } else if (item.returnFeeType === 1) { - item.servetype = `${item.returnFee || "--"}元/日`; + item.servetype = `${item.returnFee / $bili || "--"}元/日`; } else if (item.returnFeeType === 2) { - item.servetype = `${item.returnFee || "--"}元/月`; + item.servetype = `${item.returnFee / $bili || "--"}元/月`; } else if (item.returnFeeType === 3) { - item.servetype = `${item.returnFee || "--"}元/次`; + item.servetype = `${item.returnFee / $bili || "--"}元/次`; } else if (item.returnFeeType === 4) { - item.servetype = `${item.returnFee || "--"}元/件`; + item.servetype = `${item.returnFee / $bili || "--"}元/件`; } else if (item.returnFeeType === 5) { - item.servetype = `工人收入${item.returnFee || "--"}%`; + item.servetype = `工人收入${item.returnFee / $bili || "--"}%`; } else if (item.returnFeeType === 6) { - item.servetype = `共${item.returnFee || "--"}元`; + item.servetype = `共${item.returnFee / $bili || "--"}元`; } else if (item.returnFeeType === 7) { item.servetype = `费用待定`; } } else { - item.servetype = `${item.returnFee || "--"}元/小时`; + item.servetype = `${item.returnFee / $bili || "--"}元/小时`; } //地址深圳丨龙岗区丨 var districtStr = ""; @@ -746,7 +836,7 @@ let data = { const jobSpecialLabelNames = []; if (that.isNotEmptyCheck(item.jobSpecialLabelNames) && Array.isArray(item.jobSpecialLabelNames)) { item.jobSpecialLabelNames.forEach((item, index) => { - if (index <= 2) { + if (index <= $count) { jobSpecialLabelNames.push(item); } else { return; @@ -783,10 +873,11 @@ let data = { } jobList["age"] = ageStr; if (jobList.returnFeeType) { + jobList.returnFee = jobList.returnFee / 100 if (jobList.returnFeeType === 0) { jobList.servetype = `${jobList.returnFee || "--"}元/小时`; } else if (jobList.returnFeeType === 1) { - jobList.servetype = `${jobList.returnFee || "--"}元/日`; + jobList.servetype = `${jobList.returnFee || "--"}元/天`; } else if (jobList.returnFeeType === 2) { jobList.servetype = `${jobList.returnFee || "--"}元/月`; } else if (jobList.returnFeeType === 3) { @@ -801,7 +892,7 @@ let data = { jobList.servetype = `费用待定`; } } else { - jobList.servetype = `${jobList.returnFee || "--"}元/小时`; + jobList.servetype = `${jobList.returnFee / 100 || "--"}元/小时`; } //地址深圳丨龙岗区丨 var districtStr = ""; @@ -848,11 +939,11 @@ let data = { } // 年龄限制 if (Boolean(jobList.minAgeWoman) === true && Boolean(jobList.minAgeMan) === false) { - jobList.gender = "女"; + jobList.gender = "女丨"; } else if (Boolean(jobList.minAgeWoman) === false && Boolean(jobList.minAgeMan) === true) { - jobList.gender = "男"; + jobList.gender = "男丨"; } else { - jobList.gender = "男女不限"; + jobList.gender = "男女不限丨"; } } } @@ -965,63 +1056,51 @@ let data = { */ goWiondowOpenPage (url, $params = {}) { let that = this; - console.log('url', url); + console.log('url', url, '$params', $params); + let basePath = null + basePath = 'http://b.ibocai.cn' + + if (import.meta.env.MODE == 'webdev') { + basePath = 'http://webdev.ibocai.cn' + } if (url == "delivery") {// 后台新开页面 if (that.getDevStr() == "development") { - window.open(window.location.origin + "/#/other/delivery") + window.open(window.location.origin + "/other/delivery") } else { - if (window.location.origin.indexOf('www') > -1) { - window.open('http://www.ibocai.cn/#/other/' + url); - } else { - window.open('http://ibocai.cn/#/other/' + url); - } + window.open("http://k.ibocai.cn/login"); }; - } else if (// 前台特殊处理 - url == "systemMsg" || - url == "teamMsg" || - url == "list" - ) { - if (that.getDevStr() == "development") { - window.open("http://localhost:8888/#/" + url) - } else { - if (window.location.origin.indexOf('www') > -1) { - window.open('http://www.ibocai.cn/#/' + url); + } else if (url == "webLogin") { + if(that.isMobileDevice()){ + if (that.getDevStr() == "development") { + window.location.href = "http://localhost:4000/web-mobile"; } else { - window.open('http://ibocai.cn/#/' + url); - } - }; - } else if (url == "main" || url == "login") {// 前台特殊处理 - console.log('that.getDevStr()', that.getDevStr()); - if (that.getDevStr() == "development") { - window.location.href = "http://localhost:3001/#/" + url; - console.log(window.location.href); - } else { - if (window.location.origin.indexOf('www') > -1) { - window.location.href = 'https://a.matripe.com.cn/stock/index.html#/' + url; + window.location.href = window.location.origin + '/web-mobile' + }; + }else{ + if (that.getDevStr() == "development") { + window.location.href = "http://localhost:4000/" + url; } else { - window.location.href = 'https://a.matripe.com.cn/stock/index.html#/' + url - } - }; - } else if (url == "boundtel") {// 前台特殊处理 + window.location.href = window.location.origin + '/web/home' + }; + } + } else if(url == 'go-admin'){ + let _user = localStorage.getItem('totel'), + _pwd = localStorage.getItem('topwd'); + window.open('https://b.ibocai.cn/login?t=a&s=' + localStorage.getItem('DAOTIAN_token') + '&u=' + _user + '&p=' + _pwd,'_blank') + } else if(url == 'go-bcgyl'){ + window.open('https://www.ibocai.cn/web/home?t=w&s=' + localStorage.getItem('DAOTIAN_token'),'_blank') + } else if (url == "403") {// 前台特殊处理 if (that.getDevStr() == "development") { - window.open("http://localhost:8888/#/accountsetting/" + url) + window.location.href = window.location.origin + '/403'; } else { - if (window.location.origin.indexOf('www') > -1) { - window.open('http://www.ibocai.cn/#/accountsetting/' + url); - } else { - window.open('http://ibocai.cn/#/accountsetting/' + url); - } + window.location.href = basePath + '/403' }; } else {// 后台通用 if (Object.keys($params).length == 0) { if (that.getDevStr() == "development") { - window.open(window.location.origin + '/#/merchantManagement/' + url); + window.open(window.location.origin + '/merchantManagement/' + url); } else { - if (window.location.origin.indexOf('www') > -1) { - window.open('http://www.ibocai.cn/#/merchantManagement/' + url); - } else { - window.open('http://ibocai.cn/#/merchantManagement/' + url); - } + window.open(basePath + '/merchantManagement/' + url); }; } else { let _array = []; @@ -1032,13 +1111,9 @@ let data = { }; _str = _array.join('&'); if (that.getDevStr() == "development") { - window.open(window.location.origin + '/#/merchantManagement/' + url + '?' + _str); + window.open(window.location.origin + '/merchantManagement/' + url + '?' + _str); } else { - if (window.location.origin.indexOf('www') > -1) { - window.open('http://www.ibocai.cn/#/merchantManagement/' + url + '?' + _str); - } else { - window.open('http://ibocai.cn/#/merchantManagement/' + url + '?' + _str); - } + window.open(basePath + '/merchantManagement/' + url + '?' + _str); }; } } @@ -1062,17 +1137,32 @@ let data = { min: 0, max: 0 } + console.log($str); if ($str) { - list.forEach((item, index) => { - if ($str.indexOf(item) > -1 && $str.split(item)[1]) { - obj = { - min: $str.split(item)[0], - max: $str.split(item)[1] + try { + 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], + } + throw new error + } else { + obj = { + min: $str, + max: $str, + } } - } - }) + }) + } catch (error) { + + } + return obj; } - return obj; }, /* 价格转化 * 示例:5000-6000 显示为5,000-6,000 @@ -1107,47 +1197,425 @@ let data = { return '验证中' } else if (status == 6) { return '已过期' + } else if (status == 0) { + return '邀请中' + } + }, + getJobRequestTypeClassifyNameId (id) { + let str = ""; + let array = this.jobRequestTypeClassifyArray(); + array.forEach((item) => { + if (item.id == id) { + str = item.name; + } + }); + return str; + }, + jobRequestTypeClassifyArray () { + let jobRequestTypeClassifyArray = [ + { id: "0", name: "学历", subName: "学历", text: "学历", value: "0", checked: false }, + { id: "1", name: "体征", subName: "体征", text: "体征", value: "1", checked: false }, + { id: "2", name: "衣着", subName: "衣着", text: "衣着", value: "2", checked: false }, + { id: "10", name: "其它", subName: "其它", text: "其它", value: "10", checked: false }, + ]; + return jobRequestTypeClassifyArray; + }, + getJobRequestSpecClassifyNameId (id) { + let str = ""; + let array = this.jobRequestSpecClassifyArray(); + array.forEach((item) => { + if (item.id == id) { + str = item.name; + } + }); + return str; + }, + jobRequestSpecClassifyArray () { + let jobRequestTypeClassifyArray = [ + { id: "0", name: "工作休息", subName: "工作休息", text: "工作休息", value: "0", checked: false }, + { id: "1", name: "薪资待遇", subName: "薪资待遇", text: "薪资待遇", value: "1", checked: false }, + { id: "2", name: "其它特色", subName: "其它特色", text: "其它特色", value: "2", checked: false }, + { id: "3", name: "吃住福利", subName: "吃住福利", text: "吃住福利", value: "3", checked: false }, + { id: "4", name: "面试特色", subName: "面试特色", text: "面试特色", value: "4", checked: false }, + ]; + return jobRequestTypeClassifyArray; + }, + downExcel (data, file_name) { + file_name = file_name + '.xlsx'; + const blob = new Blob([data], { type: "application/vnd.ms-excel;charset=UTF-8" }) + let brower = ''; + if (navigator.userAgent.indexOf('Edge') > -1) { + brower = 'Edge' + } + if ('download' in document.createElement('a')) { + if (brower === 'Edge') { + navigator.msSaveBlob(blob, file_name); + return + } + let link = document.createElement('a'); + link.style.display = 'none'; + link.href = URL.createObjectURL(blob); + link.setAttribute('download', file_name); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link) + } else { + navigator.msSaveBlob(blob, file_name) + } + }, + fileToBase (file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = function (event) { + if (event.target.readyState === FileReader.DONE) { + resolve(event.target.result); + } + }; + reader.onerror = function (error) { + reject(error); + }; + reader.readAsDataURL(file); + }); + }, + policyNumToHanZi (i, type = 'other') { + let pickerStr; + if (i <= 9) { + switch (i) { + case 0: + pickerStr = type == 'add' ? '零条政策' : "政策零"; + break; + 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 + '条政策' : "政策" + i; + break; + } + } + return pickerStr + }, + static: { + reserveaFeeList: [ + { + id: 0, + str: "按小时", + placeholder: "如: 20", + + pre: "按时", + suffix: "元/小时", + }, + { + id: 1, + str: "按天数", + placeholder: "如: 20", + pre: "按天", + suffix: "元/天", + }, + { + id: 2, + str: "按月数", + placeholder: "如: 20", + pre: "按月", + suffix: "元/月", + }, + { + id: 3, + str: "按次数", + placeholder: "如: 20", + pre: "按次", + suffix: "元/次", + }, + { + id: 4, + str: "按件数", + placeholder: "如: 20", + pre: "按件", + suffix: "元/件", + }, + + { + id: 6, + str: "共计", + placeholder: "如: 20", + pre: "共计", + suffix: "元", + }, + { + id: 5, + str: "工人收入", + placeholder: "如: 20", + pre: "工人收入", + suffix: "%", + }, + { + id: 7, + str: "待定", + placeholder: "如: 20", + pre: "待定", + suffix: "待定", + }, + ] + + }, + setDate ($time) { + let _str = '', + $str = $time; + if ($time) { + _str = $str.$y + '-' + String(($str.$M * 1 + 1)).padStart(2, '0') + '-' + String($str.$D).padStart(2, '0') + ' ' + String($str.$H).padStart(2, '0') + ':' + String($str.$m).padStart(2, '0'); + } else { + _str = ''; + } + return _str + }, + getGenderAndAgeById (idCard) { + if (!idCard) { + return false; + } + if (idCard.length !== 18) { + return false; + } + + // 性别判断,奇数为男,偶数为女 + let gender = idCard.charAt(16) % 2 === 0 ? 2 : 1; + + // 提取出生日期部分,格式为YYYYMMDD + const birthDateStr = idCard.substring(6, 14); + + // 将字符串格式的出生日期转换为Date对象 + const birthDate = new Date( + `${birthDateStr.substring(0, 4)}-${birthDateStr.substring(4, 6)}-${birthDateStr.substring(6, 8)}` + ); + + // 计算年龄 + const today = new Date(); + let age = today.getFullYear() - birthDate.getFullYear(); + // 如果当前月份小于出生月份,或者当前月份等于出生月份但是当前日小于出生日,则减去一年 + if ( + today.getMonth() < birthDate.getMonth() || + (today.getMonth() === birthDate.getMonth() && today.getDate() < birthDate.getDate()) + ) { + age--; + } + if (isNaN(gender)) gender = '' + if (isNaN(age)) age = '' + return { gender, age }; + }, + formatPhoneNumber (phone) { + if (phone) { + return phone.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3'); + } else { + return '' + } + }, + excelToBase64 (file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = () => { + const base64String = reader.result.split(',')[1]; + resolve(base64String); + }; + reader.onerror = reject; + reader.readAsDataURL(file); + }); + }, + + isFloatNum (num) { + return typeof num === 'number' && !Number.isInteger(num); + }, + /** + * 根据工单状态ID获取名称 我的工单 + */ + getUserApplyOrderStatusByIdToBill (id) { + let str = ""; + let array = this.userApplyOrderStatusArray(); + array.forEach((item) => { + if (item.id == id) { + str = item.name; + } + }); + return str; + }, + /** + * 处理工单状态 + */ + userApplyOrderStatusArray () { + let orderStatus = [ + { + 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: "45", + name: "面试通过,未入职", + value: "45", + text: "通过未入职", + num: 0, + }, + { id: "50", name: "已离职", value: "50", text: "已离职", num: 0 }, + ]; + return orderStatus; + }, + /* + 处理详情地址 + */ + setJobInfoPosition (pos) { + let city = []; + let citys = []; + if (this.isNotEmptyCheck(pos)) { + city = pos.split(","); + } + city.forEach((i) => { + if (this.isNotEmptyCheck(i)) { + citys.push(i); + } + }); + citys = citys.join(",").replace(/,/g, " | "); + return citys; + }, + /* 新地址下的规则示例: + 省(河北省) 显示 省 (河北省) + + 省市(河北省石家庄市) 显示 省市(河北省石家庄市) + + 省市县(河北省石家庄市深泽县) 显示 省县(河北省深泽县) + 省市区(河南省郑州市二七区)显示 省市(河南省郑州市) + 省市1市2(江苏省苏州市昆山市) 显示 省市2 (江苏省昆山市) + 市市区(北京市1北京市2东城区)显示 市1区(北京市东城区) + 区市区(宁夏回族自治区银川市兴庆区)显示 区市 (宁夏回族自治区银川市) + */ + setJobInfoPositionv3 (str) { + str = str.replace(/;/g, ''); + var reg = /.+?(省|市|自治区|自治州|县|区)/g; // 省市区的正则 + let matches = str.match(reg); + let result = ''; + + 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: + 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]}`; + } + break; + default: + result = str; + break; + } + } else { + result = str; + } + + return result; + }, + timeShowXXX2 (val) { + const now = Date.now(); + const diff = now - val; + + const seconds = Math.floor(diff / 1000); + const minutes = Math.floor(seconds / 60); + const hours = Math.floor(minutes / 60); + const days = Math.floor(hours / 24); + + if (days < 2) { + if (hours > 0) { + return `${hours}小时前`; + } else if (minutes > 0) { + return `${minutes}分钟前`; + } else { + return `${seconds}秒前`; + } + } else { + return `${days}天前`; + } + }, + isMobileDevice() { + if(navigator){ + return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); + }else{ + return false; } }, - getJobRequestTypeClassifyNameId (id) { - let str = ""; - let array = this.jobRequestTypeClassifyArray(); - array.forEach((item) => { - if (item.id == id) { - str = item.name; - } - }); - return str; - }, - jobRequestTypeClassifyArray () { - let jobRequestTypeClassifyArray = [ - { id: "0", name: "学历", subName: "学历", text: "学历", value: "0", checked: false }, - { id: "1", name: "体征", subName: "体征", text: "体征", value: "1", checked: false }, - { id: "2", name: "衣着", subName: "衣着", text: "衣着", value: "2", checked: false }, - { id: "10", name: "其它", subName: "其它", text: "其它", value: "10", checked: false }, - ]; - return jobRequestTypeClassifyArray; - }, - getJobRequestSpecClassifyNameId (id) { - let str = ""; - let array = this.jobRequestSpecClassifyArray(); - array.forEach((item) => { - if (item.id == id) { - str = item.name; - } - }); - return str; - }, - jobRequestSpecClassifyArray () { - let jobRequestTypeClassifyArray = [ - { id: "0", name: "工作休息", subName: "工作休息", text: "工作休息", value: "0", checked: false }, - { id: "1", name: "薪资待遇", subName: "薪资待遇", text: "薪资待遇", value: "1", checked: false }, - { id: "2", name: "其它特色", subName: "其它特色", text: "其它特色", value: "2", checked: false }, - { id: "3", name: "吃住福利", subName: "吃住福利", text: "吃住福利", value: "3", checked: false }, - { id: "4", name: "面试特色", subName: "面试特色", text: "面试特色", value: "4", checked: false }, - ]; - return jobRequestTypeClassifyArray; - } + getUrlParams(){ + const url = window.location.href; + const params = new URLSearchParams(url.split('?')[1]); + return Object.fromEntries(params.entries()); + } } export default data; \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index 719c952..f7f4c1d 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -71,6 +71,7 @@ service.interceptors.request.use( } } req.headers.token = localStorage.getItem("DAOTIAN_token"); + req.headers.Authorization = "Bearer " + localStorage.getItem("DAOTIAN_token"); return req; }, (err) => { diff --git a/src/views/homePage/fastExamine.vue b/src/views/homePage/fastExamine.vue index 4a7dfa1..c67f765 100644 --- a/src/views/homePage/fastExamine.vue +++ b/src/views/homePage/fastExamine.vue @@ -141,7 +141,7 @@