From baff45343e32d2c7abd721e01740ed60c2b41369 Mon Sep 17 00:00:00 2001 From: X_Rian <904416525@qq.com> Date: Wed, 31 Jul 2024 11:35:02 +0800 Subject: [PATCH] =?UTF-8?q?flx=EF=BC=9A=E6=97=A5=E5=BF=97=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8F=98=E6=9B=B4=E5=89=8D=E5=90=8E=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/nowDate/index.js | 112 +++++++------ src/views/companyAdmin/operationLog.vue | 158 +++++++++++++++++- .../componentsModule/dataListData.vue | 8 +- 3 files changed, 220 insertions(+), 58 deletions(-) diff --git a/src/util/nowDate/index.js b/src/util/nowDate/index.js index 1e3ca425..d611929b 100644 --- a/src/util/nowDate/index.js +++ b/src/util/nowDate/index.js @@ -1,70 +1,80 @@ export default function getDate() { - // 获取当前日期 - let date = new Date(); + // 获取当前日期 + let date = new Date(); - // 获取当前月份 - let nowMonth = date.getMonth() + 1; + // 获取当前月份 + let nowMonth = date.getMonth() + 1; - // 获取当前是几号 - let strDate = date.getDate(); + // 获取当前是几号 + let strDate = date.getDate(); - // 添加分隔符“-” - let separator = "-"; + // 添加分隔符“-” + let separator = "-"; - // 对月份进行处理,1-9月在前面添加一个“0” - if (nowMonth >= 1 && nowMonth <= 9) { - nowMonth = "0" + nowMonth; - } + // 对月份进行处理,1-9月在前面添加一个“0” + if (nowMonth >= 1 && nowMonth <= 9) { + nowMonth = "0" + nowMonth; + } - // 对月份进行处理,1-9号在前面添加一个“0” - if (strDate >= 0 && strDate <= 9) { - strDate = "0" + strDate; - } + // 对月份进行处理,1-9号在前面添加一个“0” + if (strDate >= 0 && strDate <= 9) { + strDate = "0" + strDate; + } - // 最后拼接字符串,得到一个格式为(yyyy-MM-dd)的日期 - // const nowDate = date.getFullYear() + separator + nowMonth + separator + strDate; - const nowDate = date.getFullYear() + separator + nowMonth; - // const theSecondDay = date.getFullYear() + separator + nowMonth + separator + (strDate + 1); - // return { nowDate, theSecondDay } - return nowDate; + // 最后拼接字符串,得到一个格式为(yyyy-MM-dd)的日期 + // const nowDate = date.getFullYear() + separator + nowMonth + separator + strDate; + const nowDate = date.getFullYear() + separator + nowMonth; + // const theSecondDay = date.getFullYear() + separator + nowMonth + separator + (strDate + 1); + // return { nowDate, theSecondDay } + return nowDate; } export function getNowTime() { - let dateTime - let yy = new Date().getFullYear() - let mm = new Date().getMonth() + 1 - let dd = new Date().getDate() - let hh = new Date().getHours() - let mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes() - let ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds() - dateTime = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss - return dateTime + let dateTime + let yy = new Date().getFullYear() + let mm = new Date().getMonth() + 1 + let dd = new Date().getDate() + let hh = new Date().getHours() + let mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes() + let ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds() + dateTime = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss + return dateTime } // 格式化时间 export function dateFormat(oDate, fmt) { - var o = { - "M+": oDate.getMonth() + 1, //月份 - "d+": oDate.getDate(), //日 - "h+": oDate.getHours(), //小时 - "m+": oDate.getMinutes(), //分 - "s+": oDate.getSeconds(), //秒 - "q+": Math.floor((oDate.getMonth() + 3) / 3), //季度 - "S": oDate.getMilliseconds()//毫秒 - }; - if (/(y+)/.test(fmt)) { - fmt = fmt.replace(RegExp.$1, (oDate.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; + var o = { + "M+": oDate.getMonth() + 1, //月份 + "d+": oDate.getDate(), //日 + "h+": oDate.getHours(), //小时 + "m+": oDate.getMinutes(), //分 + "s+": oDate.getSeconds(), //秒 + "q+": Math.floor((oDate.getMonth() + 3) / 3), //季度 + "S": oDate.getMilliseconds() //毫秒 + }; + if (/(y+)/.test(fmt)) { + fmt = fmt.replace(RegExp.$1, (oDate.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; } // 根据下标返回英文字母(用作试题答案) export function filterAnswer(index) { - const englishUppercaseWord = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split('') - return englishUppercaseWord[index]; + const englishUppercaseWord = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split('') + return englishUppercaseWord[index]; } + +// 用来判断数据是否为json格式 +export function isJSON(str) { + try { + JSON.parse(str); + } catch (e) { + return false; + } + return true; +} \ No newline at end of file diff --git a/src/views/companyAdmin/operationLog.vue b/src/views/companyAdmin/operationLog.vue index 0f5ae9a7..0bc9cbe4 100644 --- a/src/views/companyAdmin/operationLog.vue +++ b/src/views/companyAdmin/operationLog.vue @@ -1,6 +1,6 @@ \ No newline at end of file + + \ No newline at end of file diff --git a/src/views/userCenter/userCenter/componentsModule/dataListData.vue b/src/views/userCenter/userCenter/componentsModule/dataListData.vue index 5f8cf4a6..f396c3ff 100644 --- a/src/views/userCenter/userCenter/componentsModule/dataListData.vue +++ b/src/views/userCenter/userCenter/componentsModule/dataListData.vue @@ -51,7 +51,7 @@ - + - {{ detailRow.operModul }} + {{ detailRow.dataChangeBefore }} - {{ detailRow.operModul }} + {{ detailRow.dataChangeAfter }}