|
@@ -42,9 +42,9 @@
|
|
|
<!-- 时间 -->
|
|
<!-- 时间 -->
|
|
|
<div class="time_box">
|
|
<div class="time_box">
|
|
|
<!-- #TODO 动态获取实时变化 -->
|
|
<!-- #TODO 动态获取实时变化 -->
|
|
|
- <span class="time_day">2023-08-09</span>
|
|
|
|
|
- <span class="time_weekday">星期三</span>
|
|
|
|
|
- <span class="time_date">14:20:22</span>
|
|
|
|
|
|
|
+ <span class="time_day">{{fmtTime?fmtTime[0]:null}}</span>
|
|
|
|
|
+ <span class="time_weekday">星期{{weekday}}</span>
|
|
|
|
|
+ <span class="time_date">{{fmtTime?fmtTime[1]:null}}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="header_user_line">|</div>
|
|
<div class="header_user_line">|</div>
|
|
|
<!-- 图标 -->
|
|
<!-- 图标 -->
|
|
@@ -63,14 +63,41 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+import { formatDate } from "@/utils/common";
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
- return {};
|
|
|
|
|
|
|
+ return {
|
|
|
|
|
+ // 当前时间
|
|
|
|
|
+ fmtTime :[],
|
|
|
|
|
+ // 星期数
|
|
|
|
|
+ weekday:'',
|
|
|
|
|
+ // 定时器
|
|
|
|
|
+ timer:''
|
|
|
|
|
+ };
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- mounted() {},
|
|
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ // 创建定时器获取时间
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.getTime();
|
|
|
|
|
+ }, 1);
|
|
|
|
|
+ this.timer = setInterval(()=>{
|
|
|
|
|
+ this.getTime();
|
|
|
|
|
+ },1000)
|
|
|
|
|
+ },
|
|
|
|
|
+ beforeDestroy(){
|
|
|
|
|
+ clearInterval(timer)
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
- methods: {},
|
|
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ // 获取并格式化当前时间
|
|
|
|
|
+ getTime() {
|
|
|
|
|
+ const time = new Date().getTime();
|
|
|
|
|
+ const thisDay = new Date().getDay()
|
|
|
|
|
+ this.weekday = ["日", "一", "二", "三", "四", "五", "六"][thisDay]
|
|
|
|
|
+ this.fmtTime = formatDate(time).split(' ')
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
@@ -94,6 +121,7 @@ export default {
|
|
|
.time_date {
|
|
.time_date {
|
|
|
font-family: DS4Font;
|
|
font-family: DS4Font;
|
|
|
margin-right: 2rem;
|
|
margin-right: 2rem;
|
|
|
|
|
+ width: 3.5rem;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.icon_box {
|
|
.icon_box {
|
|
@@ -127,9 +155,11 @@ export default {
|
|
|
}
|
|
}
|
|
|
::v-deep .el-menu-item {
|
|
::v-deep .el-menu-item {
|
|
|
height: 48px !important;
|
|
height: 48px !important;
|
|
|
- font-size: 1.33rem;
|
|
|
|
|
|
|
+ font-size: 1.33rem !important;
|
|
|
line-height: 48px !important;
|
|
line-height: 48px !important;
|
|
|
color: #516380 !important;
|
|
color: #516380 !important;
|
|
|
|
|
+ padding: 0 !important;
|
|
|
|
|
+ margin-right: 2rem !important;
|
|
|
}
|
|
}
|
|
|
::v-deep .is-active {
|
|
::v-deep .is-active {
|
|
|
border-bottom: 4px solid #134bea !important;
|
|
border-bottom: 4px solid #134bea !important;
|