遇见
4 years ago
15 changed files with 230 additions and 39 deletions
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
# Git push 注意Server中的db/config.js文件 |
||||
|
||||
## 敏感数据!!!!敏感数据!!!!敏感数据!!!! |
||||
|
@ -1,9 +1,71 @@
@@ -1,9 +1,71 @@
|
||||
<template> |
||||
<div>ArticleEdit</div> |
||||
<div class="CreateFather"> |
||||
<el-form @submit.native.prevent="EditArticle" ref="form" :model="ArticleForm"> |
||||
<el-form-item label="文章名称"> |
||||
<el-input v-model="ArticleForm.title" class="ArticleTitleWidth"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="文章内容"> |
||||
<el-input type="textarea" v-model="ArticleForm.content" style="width: 90%;"></el-input> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" native-type="submit">保存修改</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { mapGetters } from "vuex"; |
||||
import { UpdataArticle } from "@/api/article"; |
||||
|
||||
export default { |
||||
name: 'ArticleEdit' |
||||
} |
||||
name: "ArticleEdit", |
||||
data() { |
||||
return { |
||||
ArticleForm: { |
||||
title: "", |
||||
content: "", |
||||
}, |
||||
}; |
||||
}, |
||||
computed: { |
||||
...mapGetters(["article"]), |
||||
}, |
||||
methods: { |
||||
fetchArticle() { |
||||
// console.log(this.$route.params.id); |
||||
this.ArticleForm.title = this.article[this.$route.params.id].title; |
||||
this.ArticleForm.content = this.article[this.$route.params.id].content; |
||||
// this.ArticleForm = this.article[this.$route.params.id]; |
||||
}, |
||||
EditArticle() { |
||||
UpdataArticle( |
||||
this.article[this.$route.params.id].id, |
||||
this.ArticleForm |
||||
).then((res) => { |
||||
if (res.code === 0) { |
||||
this.$message({ |
||||
message: res.msg, |
||||
type: "success", |
||||
}); |
||||
this.$router.push("/Article/List"); |
||||
} else { |
||||
this.$message.error(res.msg); |
||||
} |
||||
}); |
||||
}, |
||||
}, |
||||
created() { |
||||
this.fetchArticle(); |
||||
}, |
||||
}; |
||||
</script> |
||||
<style scoped> |
||||
.CreateFather { |
||||
margin: 30px 0px 0px 30px; |
||||
width: 100%; |
||||
} |
||||
.ArticleTitleWidth { |
||||
width: 500px; |
||||
} |
||||
</style> |
@ -1,9 +1,9 @@
@@ -1,9 +1,9 @@
|
||||
@url = http://127.0.0.1:5000/ |
||||
### |
||||
POST {{ url }}article/create |
||||
put {{ url }}/article/list/10 |
||||
Content-Type: application/json |
||||
|
||||
{ |
||||
"username": "sam", |
||||
"password": "123456" |
||||
"title": "sam", |
||||
"content": "123456" |
||||
} |
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
module.exports = { |
||||
host: "host", |
||||
port: "port", |
||||
user: "user", |
||||
password: "password", |
||||
database: "database000" |
||||
} |
Loading…
Reference in new issue