公告管理完成
This commit is contained in:
@@ -3,8 +3,18 @@
|
|||||||
<el-col :span="20">
|
<el-col :span="20">
|
||||||
<el-button link type="primary" @click="dialogTableVisible = true"
|
<el-button link type="primary" @click="dialogTableVisible = true"
|
||||||
>添加公告</el-button>
|
>添加公告</el-button>
|
||||||
<el-dialog v-model="dialogTableVisible" title="Shipping address">
|
<el-dialog v-model="dialogTableVisible" title="新建标题">
|
||||||
<h1>特色</h1>
|
<el-form :model="formData" ref="vForm" label-position="left" label-width="80px"
|
||||||
|
size="default" >
|
||||||
|
<el-form-item label="公告标题" prop="title">
|
||||||
|
<el-input v-model="formData.title" placeholder="请输入公告标题"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="公告内容" prop="content">
|
||||||
|
<el-input :rows="4" type="textarea" v-model="formData.content" placeholder="请输入公告内容"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-button type="primary" @click="submitNotice">提交</el-button>
|
||||||
|
</el-form>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
@@ -34,6 +44,10 @@ import { reactive, ref } from 'vue'
|
|||||||
export default {
|
export default {
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
|
formData:{
|
||||||
|
title:'',
|
||||||
|
content:'',
|
||||||
|
},
|
||||||
data:[],
|
data:[],
|
||||||
dialogTableVisible:false,
|
dialogTableVisible:false,
|
||||||
}
|
}
|
||||||
@@ -53,6 +67,19 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
submitNotice(){
|
||||||
|
axios.post('/api/v1/admin/notice',this.formData).then(res => {
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
this.dialogTableVisible = false;
|
||||||
|
ElNotification.success({
|
||||||
|
title: '成功',
|
||||||
|
message: '添加成功',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
handleClick(row){
|
handleClick(row){
|
||||||
axios.delete('/api/v1/admin/notice/'+row.id).then(res => {
|
axios.delete('/api/v1/admin/notice/'+row.id).then(res => {
|
||||||
if (res.data.code === 200) {
|
if (res.data.code === 200) {
|
||||||
|
Reference in New Issue
Block a user