Commit 4573787af719d8279a03b62fbdfe4a629ad18119
Merge branch 'f-dev' into 'main'
fix:修改页脚时间为动态时间 See merge request huang/yun-teng-iot-front!226
Showing
1 changed file
with
57 additions
and
3 deletions
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | <a @click="openWindow(DOC_URL)">{{ t('layout.footer.onlineDocument') }}</a> | 9 | <a @click="openWindow(DOC_URL)">{{ t('layout.footer.onlineDocument') }}</a> |
| 10 | </div> | 10 | </div> |
| 11 | - <div>Copyright ©2018-2022 云腾五洲</div> | 11 | + <div>Copyright ©2018-{{ isUpdateTime }} 云腾五洲</div> |
| 12 | </Footer> | 12 | </Footer> |
| 13 | </template> | 13 | </template> |
| 14 | 14 | ||
| @@ -35,10 +35,63 @@ | @@ -35,10 +35,63 @@ | ||
| 35 | const { getShowFooter } = useRootSetting(); | 35 | const { getShowFooter } = useRootSetting(); |
| 36 | const { currentRoute } = useRouter(); | 36 | const { currentRoute } = useRouter(); |
| 37 | const { prefixCls } = useDesign('layout-footer'); | 37 | const { prefixCls } = useDesign('layout-footer'); |
| 38 | - | ||
| 39 | const footerRef = ref<ComponentRef>(null); | 38 | const footerRef = ref<ComponentRef>(null); |
| 40 | const { setFooterHeight } = useLayoutHeight(); | 39 | const { setFooterHeight } = useLayoutHeight(); |
| 41 | - | 40 | + const isUpdateTime: any = ref(''); |
| 41 | + const doUpdateTime = () => { | ||
| 42 | + let year = getDateTime('year'); | ||
| 43 | + isUpdateTime.value = year; | ||
| 44 | + }; | ||
| 45 | + doUpdateTime(); | ||
| 46 | + function getDateTime(type) { | ||
| 47 | + let date = new Date(); | ||
| 48 | + let hengGang = '-'; | ||
| 49 | + let maoHao = ':'; | ||
| 50 | + let year = date.getFullYear(); | ||
| 51 | + let month: any = date.getMonth() + 1; | ||
| 52 | + let curDate: any = date.getDate(); | ||
| 53 | + let curHours: any = date.getHours(); | ||
| 54 | + let curMinutes: any = date.getMinutes(); | ||
| 55 | + let curSeconds: any = date.getSeconds(); | ||
| 56 | + | ||
| 57 | + if (month >= 1 && month <= 9) { | ||
| 58 | + month = '0' + month; | ||
| 59 | + } | ||
| 60 | + if (curDate >= 0 && curDate <= 9) { | ||
| 61 | + curDate = '0' + curDate; | ||
| 62 | + } | ||
| 63 | + if (curHours >= 0 && curHours <= 9) { | ||
| 64 | + curHours = '0' + curHours; | ||
| 65 | + } | ||
| 66 | + if (curMinutes >= 0 && curMinutes <= 9) { | ||
| 67 | + curMinutes = '0' + curMinutes; | ||
| 68 | + } | ||
| 69 | + if (curSeconds >= 0 && curSeconds <= 9) { | ||
| 70 | + curSeconds = '0' + curSeconds; | ||
| 71 | + } | ||
| 72 | + let currentdate: any = ''; | ||
| 73 | + if (type == 'year') { | ||
| 74 | + currentdate = year; | ||
| 75 | + return currentdate; | ||
| 76 | + } else if (type == 'month') { | ||
| 77 | + currentdate = year + hengGang + month; | ||
| 78 | + return currentdate; | ||
| 79 | + } else { | ||
| 80 | + currentdate = | ||
| 81 | + year + | ||
| 82 | + hengGang + | ||
| 83 | + month + | ||
| 84 | + hengGang + | ||
| 85 | + curDate + | ||
| 86 | + ' ' + | ||
| 87 | + curHours + | ||
| 88 | + maoHao + | ||
| 89 | + curMinutes + | ||
| 90 | + maoHao + | ||
| 91 | + curSeconds; | ||
| 92 | + return currentdate; | ||
| 93 | + } | ||
| 94 | + } | ||
| 42 | const getShowLayoutFooter = computed(() => { | 95 | const getShowLayoutFooter = computed(() => { |
| 43 | if (unref(getShowFooter)) { | 96 | if (unref(getShowFooter)) { |
| 44 | const footerEl = unref(footerRef)?.$el; | 97 | const footerEl = unref(footerRef)?.$el; |
| @@ -58,6 +111,7 @@ | @@ -58,6 +111,7 @@ | ||
| 58 | SITE_URL, | 111 | SITE_URL, |
| 59 | openWindow, | 112 | openWindow, |
| 60 | footerRef, | 113 | footerRef, |
| 114 | + isUpdateTime, | ||
| 61 | }; | 115 | }; |
| 62 | }, | 116 | }, |
| 63 | }); | 117 | }); |