|
7 | 7 | -->
|
8 | 8 | <el-col :span="24" class="warp-main">
|
9 | 9 | <el-form ref="infoForm" :model="infoForm" :rules="rules" label-width="120px">
|
10 |
| - <el-form-item label="标题" prop="a_title"> |
11 |
| - <el-input v-model="infoForm.a_title"></el-input> |
| 10 | + <el-form-item label="标题" prop="btitle"> |
| 11 | + <el-input v-model="infoForm.btitle"></el-input> |
12 | 12 | </el-form-item>
|
13 | 13 |
|
14 |
| - <el-form-item label="来源" prop="a_source"> |
15 |
| - <el-input v-model="infoForm.a_source"></el-input> |
| 14 | + <el-form-item label="分类"> |
| 15 | + <el-select v-model="infoForm.bcategory" placeholder="请选择文章分类"> |
| 16 | + <el-option label="技术博文" value="技术博文"></el-option> |
| 17 | + </el-select> |
| 18 | + </el-form-item> |
| 19 | + |
| 20 | + <el-form-item label="作者" prop="bsubmitter"> |
| 21 | + <el-input v-model="infoForm.bsubmitter"></el-input> |
16 | 22 | </el-form-item>
|
17 | 23 | <!--使用编辑器
|
18 | 24 | -->
|
19 |
| - <el-form-item label="详细"> |
| 25 | + <el-form-item label="详细" prop="bcontent"> |
20 | 26 | <div class="edit_container">
|
21 |
| - <quill-editor v-model="infoForm.a_content" |
| 27 | + <quill-editor v-model="infoForm.bcontent" |
22 | 28 | ref="myQuillEditor"
|
23 | 29 | class="editer"
|
24 |
| - :options="infoForm.editorOption" @ready="onEditorReady($event)"> |
| 30 | + :options="editorOption" @ready="onEditorReady($event)"> |
25 | 31 | </quill-editor>
|
26 | 32 | </div>
|
27 | 33 | </el-form-item>
|
|
39 | 45 |
|
40 | 46 | <script>
|
41 | 47 | import {quillEditor} from "vue-quill-editor"; //调用编辑器
|
| 48 | + // require styles |
| 49 | + import 'quill/dist/quill.core.css' |
| 50 | + import 'quill/dist/quill.snow.css' |
| 51 | + import 'quill/dist/quill.bubble.css' |
| 52 | +
|
| 53 | +
|
42 | 54 | export default {
|
43 | 55 | data() {
|
44 | 56 | return {
|
45 | 57 | infoForm: {
|
46 |
| - a_title: "", |
47 |
| - a_source: "", |
48 |
| - a_content: "", |
49 |
| - editorOption: {} |
| 58 | + btitle: "", |
| 59 | + bsubmitter: "", |
| 60 | + bcategory:"技术博文", |
| 61 | + bcontent: "" |
50 | 62 | },
|
| 63 | + editorOption: {}, |
51 | 64 | //表单验证
|
52 | 65 | rules: {
|
53 |
| - a_title: [{required: true, message: "请输入标题", trigger: "blur"}], |
54 |
| - a_content: [ |
| 66 | + btitle: [{required: true, message: "请输入标题", trigger: "blur"}], |
| 67 | + bcontent: [ |
55 | 68 | {required: true, message: "请输入详细内容", trigger: "blur"}
|
56 | 69 | ]
|
57 | 70 | }
|
|
73 | 86 | //this.$refs.infoForm.validate,这是表单验证
|
74 | 87 | this.$refs.infoForm.validate(valid => {
|
75 | 88 | if (valid) {
|
76 |
| - debugger |
| 89 | + console.log(this.infoForm) |
| 90 | + var postPara=this.infoForm; |
| 91 | + this.$api.post("Blog", postPara, r => { |
| 92 | + debugger |
| 93 | + if(r.success){ |
| 94 | + var id=r.response |
| 95 | + this.$notify({ |
| 96 | + type: "success", |
| 97 | + message: "添加成功,感谢技术分享!", |
| 98 | + duration: 3000 |
| 99 | + }); |
| 100 | + this.$router.replace(`/content/${id}`); |
| 101 | +
|
| 102 | + }else{ |
| 103 | + var errorMsg=r.msg |
| 104 | + this.$message({ |
| 105 | + type: "error", |
| 106 | + message: errorMsg, |
| 107 | + showClose: true |
| 108 | + }); |
77 | 109 |
|
| 110 | + } |
| 111 | + this.list = r.data; |
| 112 | + this.page = r.page; |
| 113 | + this.TotalCount = r.pageCount; |
| 114 | + this.isShow = false; |
| 115 | + }); |
78 | 116 | }
|
79 | 117 | });
|
80 | 118 | }
|
|
93 | 131 | width: 75%;
|
94 | 132 | margin: 0 auto;
|
95 | 133 | }
|
96 |
| - .ql-editor.ql-blank { |
| 134 | + .ql-container.ql-snow,.ql-editor.ql-blank { |
97 | 135 | min-height: 300px !important;
|
98 | 136 | }
|
99 | 137 | .el-form{
|
|
0 commit comments