From d24c9dde20cba23b96082b4db81b5223c75e4ea9 Mon Sep 17 00:00:00 2001 From: odc.xiaohui <xiaohui@Q1> Date: 星期三, 08 三月 2023 09:06:28 +0800 Subject: [PATCH] 身份证正反面调整 --- src/utils/helper.js | 95 +++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 83 insertions(+), 12 deletions(-) diff --git a/src/utils/helper.js b/src/utils/helper.js index e8e2d20..7ac38fd 100644 --- a/src/utils/helper.js +++ b/src/utils/helper.js @@ -2,7 +2,7 @@ // 娣辨嫹璐� export function deepClone(obj) { let objClone = Array.isArray(obj) ? [] : {}; - if (obj && typeof obj === 'object' && obj != null) { + if (obj && typeof obj === 'object') { for (let key in obj) { if (obj.hasOwnProperty(key)) { if (obj[key] && typeof obj[key] === 'object') { @@ -22,24 +22,75 @@ return filterTime(t2.getTime() - t1.getTime()); } // 鑾峰彇瀛楀吀琛� -export async function getTypeList(level,code){ +export async function getTypeList(level, code) { let arr; await myrequest({ - method:'get', - url:`sccg/dict/query_type?level=${level}&typeCode=${code}` + method: 'get', + url: `sccg/dict/query_type?level=${level}&typeCode=${code}` }) - .then(res=>{ - arr = res.data; - }) + .then(res => { + arr = res.data; + }) return arr; +} +// 鑾峰彇瀛楀吀琛�2 +export async function getCodeList(code){ + let arr; + await myrequest({ + method: 'get', + url: `/sccg/dict/queryByCode?code=${code}` + }) + .then(res => { + arr = res.data; + }) + return arr; +} + +// data: 鏂囦欢, contentDisposition锛氳姹傚ご涓枃浠剁殑鍚嶅瓧 +// 榛樿涓嶇敤淇敼锛岀洿鎺ュ皢杩斿洖鐨剅es浼犲叆鍗冲彲 +export function downloadFile(res) { + const blob = new Blob([res.data], { type: 'application/octet-stream' }); + const fileName = res.contentDisposition.split(`''`)[1]; + if (window.navigator && window.navigator.msSaveBlob) { + window.navigator.msSaveBlob(blob, fileName); + } else { + const link = document.createElement('a'); + link.style.display = 'none'; + link.href = window.URL.createObjectURL(blob); + link.download = decodeURI(fileName); + document.body.appendChild(link); + link.click(); + window.URL.revokeObjectURL(link.href); + document.body.removeChild(link); + } +} + +// 鑾峰彇token +export function getToken() { + const token = sessionStorage.getItem('token'); + const tokenHead = sessionStorage.getItem('tokenHead'); + if (token && tokenHead) { + return tokenHead + token; + } +} +// 鑾峰彇骞存湀鏃ユ椂鍒嗙 +export function getNowDate(time){ + const result = new Date(time); + let yy = result.getFullYear(), + mm = result.getMonth()+1, + dd = result.getDate(), + hh = result.getHours(), + mi = result.getMinutes(), + ss = result.getSeconds() + return yy+'-'+ fillTime(mm)+'-'+fillTime(dd)+" "+fillTime(hh)+':'+fillTime(mi) + ':' + fillTime(ss); } function filterTime(time) { if (time < 0) { return '宸查�炬湡'; } - let dd = Math.floor(time/24/60/60/1000), - hh = Math.floor(time/60/60/1000-dd*24), - mi = Math.floor(time/60/1000-dd*24*60-hh*60); + let dd = Math.floor(time / 24 / 60 / 60 / 1000), + hh = Math.floor(time / 60 / 60 / 1000 - dd * 24), + mi = Math.floor(time / 60 / 1000 - dd * 24 * 60 - hh * 60); return addDay(fillTime(dd)) + addHour(fillTime(hh)) + addMin(fillTime(mi)); } function fillTime(num) { @@ -50,14 +101,14 @@ } function addDay(str) { str = parseFloat(str); - if (str <0) { + if (str < 0) { return; } return str + '澶�' } function addHour(str) { str = parseFloat(str); - if (str <0) { + if (str < 0) { return; } return str + '灏忔椂' @@ -69,3 +120,23 @@ } return str + '鍒嗛挓' } + +export const EVENT_SOURCE = [ + { label: '瑙嗛宸℃煡', value: 1 }, + { label: '浜哄伐涓婃姤', value: 2 } +] + +export const CATEGOTY = [ + { label: '杩濊', value: 1 }, + { label: '杩濆缓', value: 2 } +] + +export const RESOURCE_TYPE = [ + { label: '涓婃姤', value: '01' }, + { label: '澶勭疆', value: '02' } +] + +export const RESOURCE_OPTIONS = [ + { label: '浜哄伐涓婃姤', value: 2 }, + { label: '瑙嗛宸℃煡', value: 1 } +] -- Gitblit v1.8.0