From 0c62a7c904347cc2ae9144b7d28f0fae1631ac9c Mon Sep 17 00:00:00 2001 From: binbin_pan Date: Thu, 14 Mar 2024 15:40:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E5=9B=BE=E6=A0=87+=E5=AE=9E?= =?UTF-8?q?=E6=97=B6=E6=98=BE=E7=A4=BA=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 3 ++- src/router/index.ts | 1 + src/views/screen/sharePlatform.vue | 27 ++++++++++++++++++++++----- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 2d5a1da..bc50105 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,8 @@ - Vite App + 机具租赁共享平台 +
diff --git a/src/router/index.ts b/src/router/index.ts index c5cc1d0..e009bd1 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -20,6 +20,7 @@ const routes: Array = [ icon: '', }, component: () => import('views/Index.vue'), + children:[] }, { path: '/screen/sharePlatform', diff --git a/src/views/screen/sharePlatform.vue b/src/views/screen/sharePlatform.vue index 954fb46..71f4db7 100644 --- a/src/views/screen/sharePlatform.vue +++ b/src/views/screen/sharePlatform.vue @@ -7,7 +7,7 @@
晴转多云 16℃ - 2023.11.16 星期四 09:56:12 + {{ nowTime }}
@@ -372,6 +372,7 @@ onMounted(() => { iniTapiBmCompanyInfoTypeLis() iniTapiMaDevInfoMaList() + InitApiMaLeaseInfoInfoTypeList() }) @@ -513,9 +514,26 @@ const InitApiMaLeaseInfoInfoTypeList= async()=>{ } } -onMounted(()=>{ - InitApiMaLeaseInfoInfoTypeList() -}) +const nowTime = ref("") + +// 实时获取当前时间, 格式为 2023.11.16 星期四 09:56:12 +const getCurrentWeather = () => { + const date = new Date() + const year = date.getFullYear() + const month = (date.getMonth() + 1 + '').padStart(2, '0') + const day = (date.getDate() + '').padStart(2, '0') + const week = date.getDay() + const weekArr = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'] + const hour = (date.getHours() + '').padStart(2, '0') + const minute = (date.getMinutes() + '').padStart(2, '0') + const second = (date.getSeconds() + '').padStart(2, '0') + return `${year}.${month}.${day} ${weekArr[week]} ${hour}:${minute}:${second}` +} + +setInterval(() => { + nowTime.value = getCurrentWeather() +}, 1000) +