|
|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
<div :class="'logo-container-' + layout">
|
|
|
<router-link to="/">
|
|
|
+ <!-- 这里是logo变更的位置 -->
|
|
|
<vab-remix-icon v-if="logo" class="logo" :icon-class="logo" />
|
|
|
<span
|
|
|
class="title"
|
|
|
@@ -10,161 +11,82 @@
|
|
|
{{ title }}
|
|
|
</span>
|
|
|
</router-link>
|
|
|
- <!--时间展示区(包含毫秒)-->
|
|
|
- <span class="compact-time-display">
|
|
|
- <span class="time-line utc-time">
|
|
|
- {{ "天文时间:" + formattedUTCTime }}
|
|
|
- </span>
|
|
|
- <br />
|
|
|
- <span class="time-line local-time">
|
|
|
- {{ "绝对时间:" + formattedLocalTime }}
|
|
|
- </span>
|
|
|
- </span>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
<script>
|
|
|
-import { mapGetters } from "vuex";
|
|
|
-
|
|
|
-export default {
|
|
|
- name: "VabLogo",
|
|
|
- data() {
|
|
|
- return {
|
|
|
- title: this.$baseTitle,
|
|
|
- timer: null,
|
|
|
- currentTime: new Date(),
|
|
|
- };
|
|
|
- },
|
|
|
- computed: {
|
|
|
- ...mapGetters({
|
|
|
- logo: "settings/logo",
|
|
|
- layout: "settings/layout",
|
|
|
- }),
|
|
|
- formattedUTCTime() {
|
|
|
- return this.formatUTCTime(this.currentTime);
|
|
|
- },
|
|
|
- formattedLocalTime() {
|
|
|
- return this.formatLocalTime(this.currentTime);
|
|
|
+ import { mapGetters } from "vuex";
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: "VabLogo",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ title: this.$baseTitle,
|
|
|
+ };
|
|
|
},
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- // 改为每10毫秒更新一次(确保毫秒级精度)
|
|
|
- this.timer = setInterval(() => {
|
|
|
- this.currentTime = new Date();
|
|
|
- }, 10);
|
|
|
- },
|
|
|
- beforeDestroy() {
|
|
|
- clearInterval(this.timer);
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 格式化UTC时间(包含毫秒)
|
|
|
- formatUTCTime(date) {
|
|
|
- const pad = (num, length = 2) => String(num).padStart(length, "0");
|
|
|
- return `${date.getUTCFullYear()}-${pad(date.getUTCMonth() + 1)}-${pad(
|
|
|
- date.getUTCDate()
|
|
|
- )} ${pad(date.getUTCHours())}:${pad(date.getUTCMinutes())}:${pad(
|
|
|
- date.getUTCSeconds()
|
|
|
- )} UTC`;
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ logo: "settings/logo",
|
|
|
+ layout: "settings/layout",
|
|
|
+ }),
|
|
|
},
|
|
|
- // 格式化本地时间(包含毫秒)
|
|
|
- formatLocalTime(date) {
|
|
|
- const pad = (num, length = 2) => String(num).padStart(length, "0");
|
|
|
- const hours = date.getHours();
|
|
|
- const ampm = hours >= 12 ? "PM" : "AM";
|
|
|
- const displayHours = hours % 12 || 12;
|
|
|
- return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(
|
|
|
- date.getDate()
|
|
|
- )} ${pad(displayHours)}:${pad(date.getMinutes())}:${pad(
|
|
|
- date.getSeconds()
|
|
|
- )} ${ampm}`;
|
|
|
- },
|
|
|
- },
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
-
|
|
|
<style lang="scss" scoped>
|
|
|
-@mixin container {
|
|
|
- position: relative;
|
|
|
- height: $base-top-bar-height;
|
|
|
- overflow: hidden;
|
|
|
- line-height: $base-top-bar-height;
|
|
|
- background: $base-menu-background;
|
|
|
-}
|
|
|
-
|
|
|
-@mixin logo {
|
|
|
- display: inline-block;
|
|
|
- width: 34px;
|
|
|
- height: 34px;
|
|
|
- margin-right: 3px;
|
|
|
- color: $base-title-color;
|
|
|
- vertical-align: middle;
|
|
|
-}
|
|
|
-
|
|
|
-@mixin title {
|
|
|
- display: inline-block;
|
|
|
- overflow: hidden;
|
|
|
- font-size: 20px;
|
|
|
- line-height: 55px;
|
|
|
- color: $base-title-color;
|
|
|
- text-overflow: ellipsis;
|
|
|
- white-space: nowrap;
|
|
|
- vertical-align: middle;
|
|
|
-}
|
|
|
-
|
|
|
-.logo-container-horizontal {
|
|
|
- @include container;
|
|
|
-
|
|
|
- .logo {
|
|
|
- @include logo;
|
|
|
+ @mixin container {
|
|
|
+ position: relative;
|
|
|
+ height: $base-top-bar-height;
|
|
|
+ overflow: hidden;
|
|
|
+ line-height: $base-top-bar-height;
|
|
|
+ background: $base-menu-background;
|
|
|
}
|
|
|
|
|
|
- .title {
|
|
|
- @include title;
|
|
|
+ @mixin logo {
|
|
|
+ display: inline-block;
|
|
|
+ width: 34px;
|
|
|
+ height: 34px;
|
|
|
+ margin-right: 3px;
|
|
|
+ color: $base-title-color;
|
|
|
+ vertical-align: middle;
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-.logo-container-vertical {
|
|
|
- @include container;
|
|
|
-
|
|
|
- height: $base-logo-height;
|
|
|
- line-height: $base-logo-height;
|
|
|
- text-align: center;
|
|
|
|
|
|
- .logo {
|
|
|
- @include logo;
|
|
|
+ @mixin title {
|
|
|
+ display: inline-block;
|
|
|
+ overflow: hidden;
|
|
|
+ font-size: 20px;
|
|
|
+ line-height: 55px;
|
|
|
+ color: $base-title-color;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ vertical-align: middle;
|
|
|
}
|
|
|
|
|
|
- .title {
|
|
|
- @include title;
|
|
|
+ .logo-container-horizontal {
|
|
|
+ @include container;
|
|
|
|
|
|
- max-width: calc(#{$base-left-menu-width} - 60px);
|
|
|
+ .logo {
|
|
|
+ @include logo;
|
|
|
+ }
|
|
|
+
|
|
|
+ .title {
|
|
|
+ @include title;
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-.compact-time-display {
|
|
|
- font-family: "Courier New", monospace;
|
|
|
- padding: 12px;
|
|
|
- border-radius: 6px;
|
|
|
- background-color: transparent;
|
|
|
- line-height: 1.5;
|
|
|
- display: inline-block;
|
|
|
- vertical-align: middle;
|
|
|
+ .logo-container-vertical {
|
|
|
+ @include container;
|
|
|
|
|
|
- .time-line {
|
|
|
- font-weight: 800;
|
|
|
- white-space: nowrap;
|
|
|
- font-size: 12px;
|
|
|
+ height: $base-logo-height;
|
|
|
+ line-height: $base-logo-height;
|
|
|
+ text-align: center;
|
|
|
|
|
|
- &.utc-time {
|
|
|
- color: #8d978f;
|
|
|
- font-size: 1rem;
|
|
|
- font-weight: 800;
|
|
|
+ .logo {
|
|
|
+ @include logo;
|
|
|
}
|
|
|
|
|
|
- &.local-time {
|
|
|
- color: #8d978f;
|
|
|
- font-size: 1rem;
|
|
|
+ .title {
|
|
|
+ @include title;
|
|
|
+
|
|
|
+ max-width: calc(#{$base-left-menu-width} - 60px);
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
</style>
|