mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
feat(MainView): 添加实时日期和时间显示功能
- 在 MainView 组件中添加了实时更新的日期和时间显示 - 实现了页面加载时初始化日期和时间,并设置每秒更新的定时器 - 优化了组件卸载时清除定时器的逻辑 - 添加了用户信息显示和退出系统的功能
This commit is contained in:
@@ -58,68 +58,13 @@ export default {
|
|||||||
currentKey: '',
|
currentKey: '',
|
||||||
subCurrentKey: '',
|
subCurrentKey: '',
|
||||||
menuList: [],
|
menuList: [],
|
||||||
// menuList: [
|
|
||||||
// {
|
subMenu: [],
|
||||||
// name: '系统总览',
|
currentTime: '',
|
||||||
// path: '/home'
|
timer: null,
|
||||||
// },
|
dateVal: moment().locale('zh-cn').format('ll') + ' ',
|
||||||
// {
|
weekVal: moment().locale('zh-cn').format('dddd'),
|
||||||
// name: '运行监控',
|
user:localStorage.getItem('account').replace(/^"|"$/g, '')
|
||||||
// path: '/monitor'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '预测管理',
|
|
||||||
// path: '/predict'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '统计分析',
|
|
||||||
// path: '/statisticalAnalysis'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '系统管理',
|
|
||||||
// path: '/system',
|
|
||||||
// children: [
|
|
||||||
// {
|
|
||||||
// name: '用户管理',
|
|
||||||
// path: '/user'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '角色管理',
|
|
||||||
// path: '/role'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '权限管理',
|
|
||||||
// icon: 'icon-caidanguanli'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '场站管理',
|
|
||||||
// path: '/station',
|
|
||||||
// icon: 'icon-caidanguanli'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '服务管理',
|
|
||||||
// icon: 'icon-bumenguanli'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '策略管理',
|
|
||||||
// path: '/policy'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '设备管理',
|
|
||||||
// path: '/device '
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '告警日志',
|
|
||||||
// path: '/log'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '系统日志',
|
|
||||||
// path: '/syslog'
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
// }
|
|
||||||
// ],
|
|
||||||
subMenu: []
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -149,9 +94,35 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// this.initRoute()
|
this.getDateTime()
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
this.getDateTime()
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
clearInterval(this.timer)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
logout(){
|
||||||
|
const that=this
|
||||||
|
this.$Modal.confirm({
|
||||||
|
title: '你确认退出系统吗?',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
|
||||||
|
async onOk() {
|
||||||
|
localStorage.clear()
|
||||||
|
that.$router.push('/login')
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
},
|
||||||
|
class: 'test'
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
//getDateTime
|
||||||
|
getDateTime() {
|
||||||
|
this.currentTime = moment().locale('zh-cn').format('LTS')
|
||||||
|
},
|
||||||
// 新增子菜单处理方法
|
// 新增子菜单处理方法
|
||||||
handleSubMenu(pathSegments,to) {
|
handleSubMenu(pathSegments,to) {
|
||||||
// 查找当前激活的主菜单项
|
// 查找当前激活的主菜单项
|
||||||
|
|||||||
Reference in New Issue
Block a user