完善公告时间戳
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
<script>
|
||||
import axios from "axios";
|
||||
import {ElNotification} from "element-plus";
|
||||
import router from "../../router";
|
||||
|
||||
export default {
|
||||
data(){
|
||||
@@ -64,12 +65,18 @@ export default {
|
||||
|
||||
mounted(){
|
||||
axios.get("/api/v1/user/session").then(res => {
|
||||
if (res.data.code === 200) {
|
||||
if (res.data.code === 200 && res.data.data.role === 1) {
|
||||
this.username = res.data.data.username;
|
||||
this.role = res.data.data.role;
|
||||
|
||||
}
|
||||
}).catch(err => {});
|
||||
}).catch(err => {
|
||||
ElNotification.error({
|
||||
title: '错误',
|
||||
message: 'You dont Have Permission',
|
||||
duration: 0,
|
||||
});
|
||||
router.push('/login');
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
6
src/components/admin/notification.vue
Normal file
6
src/components/admin/notification.vue
Normal file
@@ -0,0 +1,6 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
@@ -31,6 +31,7 @@ export default {
|
||||
this.data.forEach(function(item,index){
|
||||
item.created_at = dayjs(item.created_at).format('YYYY-MM-DD HH:mm:ss');
|
||||
})
|
||||
this.data.reverse();
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -41,4 +42,4 @@ export default {
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
@@ -57,6 +57,13 @@ const router = createRouter({
|
||||
path:'/admin',
|
||||
name:'Admin',
|
||||
component: () => import('../views/admin/index.vue'),
|
||||
children:[
|
||||
{
|
||||
path:'notification',
|
||||
name:'AdminNotification',
|
||||
component : () => import('../views/admin/AdminNotice.vue'),
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'/404',
|
||||
|
11
src/views/admin/AdminNotice.vue
Normal file
11
src/views/admin/AdminNotice.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<AdminNavbar></AdminNavbar>
|
||||
<notification></notification>
|
||||
</template>
|
||||
<script>
|
||||
import AdminNavbar from "../../components/admin/admin-Navbar.vue";
|
||||
import Notification from "../../components/admin/notification.vue";
|
||||
export default {
|
||||
components: {Notification,AdminNavbar}
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user