公告管理
This commit is contained in:
@@ -1,6 +1,70 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<el-row class="row-bg" justify="center">
|
||||||
|
<el-col :span="20">
|
||||||
|
<el-button link type="primary" @click="dialogTableVisible = true"
|
||||||
|
>添加公告</el-button>
|
||||||
|
<el-dialog v-model="dialogTableVisible" title="Shipping address">
|
||||||
|
<h1>特色</h1>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
|
<el-table :data="data" style="width: 100%">
|
||||||
|
<el-table-column label="标题" prop="title"/>
|
||||||
|
<el-table-column label="内容" prop="content"/>
|
||||||
|
<el-table-column label="时间" prop="created_at"/>
|
||||||
|
<el-table-column fixed="right" label="Operations" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" size="small" @click="handleClick(scope.row)"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
</el-table>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from "axios";
|
||||||
|
import * as dayjs from 'dayjs';
|
||||||
|
import {ElNotification} from "element-plus";
|
||||||
|
import { reactive, ref } from 'vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data(){
|
||||||
|
return{
|
||||||
|
data:[],
|
||||||
|
dialogTableVisible:false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
axios.get('/api/v1/notice').then(res => {
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
console.log(res.data.data);
|
||||||
|
this.data = res.data.data;
|
||||||
|
this.data.forEach(function(item,index){
|
||||||
|
item.created_at = dayjs(item.created_at).format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
})
|
||||||
|
this.data.reverse();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
handleClick(row){
|
||||||
|
axios.delete('/api/v1/admin/notice/'+row.id).then(res => {
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
this.data.splice(this.data.indexOf(row),1);
|
||||||
|
ElNotification.success({
|
||||||
|
title: '成功',
|
||||||
|
message: '删除成功',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<AdminNavbar></AdminNavbar>
|
<AdminNotification></AdminNotification>
|
||||||
<notification></notification>
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import AdminNavbar from "../../components/admin/admin-Navbar.vue";
|
|
||||||
import Notification from "../../components/admin/notification.vue";
|
import AdminNotification from "../../components/admin/notification.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {Notification,AdminNavbar}
|
components: {AdminNotification},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<admin-navbar></admin-navbar>
|
<admin-navbar></admin-navbar>
|
||||||
|
<router-view/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
Reference in New Issue
Block a user