完善公告时间戳

This commit is contained in:
jiayuqi7813
2022-07-01 02:10:00 +08:00
parent 2c9b4a7f4f
commit 0af9d9a010
5 changed files with 36 additions and 4 deletions

View File

@@ -53,6 +53,7 @@
<script> <script>
import axios from "axios"; import axios from "axios";
import {ElNotification} from "element-plus"; import {ElNotification} from "element-plus";
import router from "../../router";
export default { export default {
data(){ data(){
@@ -64,12 +65,18 @@ export default {
mounted(){ mounted(){
axios.get("/api/v1/user/session").then(res => { 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.username = res.data.data.username;
this.role = res.data.data.role; this.role = res.data.data.role;
} }
}).catch(err => {}); }).catch(err => {
ElNotification.error({
title: '错误',
message: 'You dont Have Permission',
duration: 0,
});
router.push('/login');
});
}, },

View File

@@ -0,0 +1,6 @@
<template>
</template>
<script>
</script>

View File

@@ -31,6 +31,7 @@ export default {
this.data.forEach(function(item,index){ this.data.forEach(function(item,index){
item.created_at = dayjs(item.created_at).format('YYYY-MM-DD HH:mm:ss'); 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> </style>

View File

@@ -57,6 +57,13 @@ const router = createRouter({
path:'/admin', path:'/admin',
name:'Admin', name:'Admin',
component: () => import('../views/admin/index.vue'), component: () => import('../views/admin/index.vue'),
children:[
{
path:'notification',
name:'AdminNotification',
component : () => import('../views/admin/AdminNotice.vue'),
}
]
}, },
{ {
path:'/404', path:'/404',

View 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>