From d890222d0a61f413ce86b5a42d8606d6bb4bc7aa Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 21 Dec 2021 11:12:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=97=B6=E9=97=B4=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F'?= =?UTF-8?q?=E6=97=A0'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/canvas/components/Editor/DateFormat.vue | 3 ++- frontend/src/components/widget/DeWidget/DeShowDate.vue | 8 ++++---- .../src/components/widget/DeWidget/TimeDefault.vue | 2 +- frontend/src/components/widget/DeWidget/TimeElec.vue | 10 +++++++--- frontend/src/components/widget/DeWidget/TimeSimple.vue | 8 +++++--- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/frontend/src/components/canvas/components/Editor/DateFormat.vue b/frontend/src/components/canvas/components/Editor/DateFormat.vue index 48b41e3307..97e0d45673 100644 --- a/frontend/src/components/canvas/components/Editor/DateFormat.vue +++ b/frontend/src/components/canvas/components/Editor/DateFormat.vue @@ -97,7 +97,8 @@ export default { timeOptions: [ { value: 'hh:mm:ss', label: 'hh:mm:ss' }, - { value: 'hh时mm分ss秒', label: 'hh时mm分ss秒' } + { value: 'hh时mm分ss秒', label: 'hh时mm分ss秒' }, + { value: '', label: '无' } ], dateOptions: [ { value: 'yyyy-MM-dd', label: 'yyyy-MM-dd' }, diff --git a/frontend/src/components/widget/DeWidget/DeShowDate.vue b/frontend/src/components/widget/DeWidget/DeShowDate.vue index 5b71e6a3d5..6b95c13419 100644 --- a/frontend/src/components/widget/DeWidget/DeShowDate.vue +++ b/frontend/src/components/widget/DeWidget/DeShowDate.vue @@ -1,12 +1,12 @@ diff --git a/frontend/src/components/widget/DeWidget/TimeDefault.vue b/frontend/src/components/widget/DeWidget/TimeDefault.vue index c33066b290..5b59dcd0cc 100644 --- a/frontend/src/components/widget/DeWidget/TimeDefault.vue +++ b/frontend/src/components/widget/DeWidget/TimeDefault.vue @@ -44,7 +44,7 @@ export default { }, formatDate() { const weekArr = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'] - let timeFormat = this.element.formatInfo.timeFormat || 'hh:mm:ss' + let timeFormat = this.element.formatInfo.timeFormat const showWeek = this.element.formatInfo.showWeek const showDate = this.element.formatInfo.showDate const dateFormat = this.element.formatInfo.dateFormat || 'yyyy-MM-dd' diff --git a/frontend/src/components/widget/DeWidget/TimeElec.vue b/frontend/src/components/widget/DeWidget/TimeElec.vue index 0ad7958f40..0270662399 100644 --- a/frontend/src/components/widget/DeWidget/TimeElec.vue +++ b/frontend/src/components/widget/DeWidget/TimeElec.vue @@ -1,7 +1,7 @@ @@ -66,7 +66,7 @@ export default { }, updateTime() { var cd = new Date() - const timeFormat = this.element.formatInfo.timeFormat || 'hh:mm:ss' + const timeFormat = this.element.formatInfo.timeFormat const showWeek = this.element.formatInfo.showWeek const showDate = this.element.formatInfo.showDate const dateFormat = this.element.formatInfo.dateFormat || 'yyyy-MM-dd' @@ -75,8 +75,12 @@ export default { nowDate = cd.format(dateFormat) } const nowWeek = this.week[cd.getDay()] + if (timeFormat) { + this.time = cd.format(timeFormat) + } else { + this.time = null + } - this.time = cd.format(timeFormat) this.date = showWeek ? (nowDate + ' ' + nowWeek) : nowDate } } diff --git a/frontend/src/components/widget/DeWidget/TimeSimple.vue b/frontend/src/components/widget/DeWidget/TimeSimple.vue index badb0ecd83..a33212b60e 100644 --- a/frontend/src/components/widget/DeWidget/TimeSimple.vue +++ b/frontend/src/components/widget/DeWidget/TimeSimple.vue @@ -65,7 +65,7 @@ export default { this.timer = setInterval(this.canvass, 500) }, canvass() { - const timeFormat = this.element.formatInfo.timeFormat || 'hh:mm:ss' + const timeFormat = this.element.formatInfo.timeFormat const dateFormat = this.element.formatInfo.dateFormat || 'yyyy-MM-dd' const showWeek = this.element.formatInfo.showWeek const showDate = this.element.formatInfo.showDate @@ -110,8 +110,10 @@ export default { } else { englishWeek = 'Saturday' } - - const simpleTime = time.format(timeFormat) + let simpleTime = '' + if (timeFormat) { + simpleTime = time.format(timeFormat) + } let nowDate = '' if (showDate && dateFormat) { nowDate = time.format(dateFormat)