|
@@ -9,7 +9,7 @@
|
9
|
9
|
<Card>
|
10
|
10
|
<Form :label-width="110">
|
11
|
11
|
<FormItem label="父分类">
|
12
|
|
- <Select v-model="form.pid">
|
|
12
|
+ <Select v-model="form.pname">
|
13
|
13
|
<Option v-for="item in pList" :value="item.name" :key="item.id">{{ item.name }}</Option>
|
14
|
14
|
</Select>
|
15
|
15
|
</FormItem>
|
|
@@ -25,12 +25,15 @@
|
25
|
25
|
<FormItem label="服务介绍">
|
26
|
26
|
<Input v-model="form.summary" />
|
27
|
27
|
</FormItem>
|
|
28
|
+ <FormItem label="提交项">
|
|
29
|
+ <Input v-model="form.fields_json" type="textarea" :rows="10" placeholder="请输入表单提交项" />
|
|
30
|
+ </FormItem>
|
28
|
31
|
<FormItem label="服务详情">
|
29
|
32
|
<editor :editor-content="form.content"></editor>
|
30
|
33
|
</FormItem>
|
31
|
34
|
<FormItem label="服务图片">
|
32
|
35
|
<img :src="form.photo" style="width:100%;max-width:750px;" v-if="form.photo" class="upload-img">
|
33
|
|
- <Upload :headers="uploadHeader" :on-success="handleSuccess" :action='$domain + "/upload"'>
|
|
36
|
+ <Upload :on-success="handleSuccess" :action='$domain + "/upload"'>
|
34
|
37
|
<Button icon="ios-cloud-upload-outline">上传更新图片</Button>
|
35
|
38
|
</Upload>
|
36
|
39
|
</FormItem>
|
|
@@ -43,6 +46,7 @@
|
43
|
46
|
</Form>
|
44
|
47
|
<div class="submit">
|
45
|
48
|
<Button @click="handlePublish" :loading="publishLoading" icon="ios-checkmark" size="large" type="primary">发布</Button>
|
|
49
|
+ <Button @click="cancelEdit" style="margin-left:10px;" size="large" type="default">取消</Button>
|
46
|
50
|
</div>
|
47
|
51
|
</Card>
|
48
|
52
|
</Col>
|
|
@@ -59,7 +63,8 @@ export default {
|
59
|
63
|
editor
|
60
|
64
|
},
|
61
|
65
|
props: {
|
62
|
|
- formContent: Object
|
|
66
|
+ formContent: Object,
|
|
67
|
+ parentList: Array
|
63
|
68
|
},
|
64
|
69
|
watch: {
|
65
|
70
|
formContent() {
|
|
@@ -67,47 +72,57 @@ export default {
|
67
|
72
|
this.formContent.location = '';
|
68
|
73
|
}
|
69
|
74
|
this.form = this.formContent;
|
|
75
|
+ },
|
|
76
|
+ parentList() {
|
|
77
|
+ this.pList = this.parentList;
|
70
|
78
|
}
|
71
|
79
|
},
|
72
|
80
|
data () {
|
73
|
81
|
return {
|
74
|
82
|
form: this.formContent,
|
75
|
83
|
publishLoading: false,
|
76
|
|
- pList: []
|
|
84
|
+ pList: this.parentList
|
77
|
85
|
};
|
78
|
86
|
},
|
79
|
|
- mounted() {
|
80
|
|
- this.axios.get('classify/parent', {}).then((res) => {
|
81
|
|
- if (res.data.status == 0) {
|
82
|
|
- this.pList = res.data.data;
|
83
|
|
- }
|
84
|
|
- });
|
85
|
|
- },
|
86
|
87
|
methods: {
|
|
88
|
+ cancelEdit() {
|
|
89
|
+ this.$emit("pub-cancel");
|
|
90
|
+ },
|
87
|
91
|
handlePublish() {
|
88
|
|
- if (true) {
|
|
92
|
+ // return console.warn(this.form, this.pList);
|
|
93
|
+ const form = this.form;
|
|
94
|
+ if (form.name && form.pname) {
|
89
|
95
|
this.publishLoading = true;
|
90
|
96
|
let content = tinymce.activeEditor.getContent();
|
|
97
|
+ for (let p of this.pList) {
|
|
98
|
+ if (p.name === form.pname) {
|
|
99
|
+ form.pid = p.id;
|
|
100
|
+ }
|
|
101
|
+ }
|
91
|
102
|
let data = {
|
92
|
|
- pid: this.form.pid,
|
93
|
|
- name: this.form.name,
|
94
|
|
- info: this.form.info,
|
95
|
|
- summary: this.form.summary,
|
96
|
|
- server: this.form.server,
|
97
|
|
- content: content,
|
98
|
|
- photo: this.form.photo,
|
99
|
|
- location: this.form.location
|
|
103
|
+ pid: form.pid,
|
|
104
|
+ name: form.name,
|
|
105
|
+ info: form.info,
|
|
106
|
+ summary: form.summary,
|
|
107
|
+ // server: form.server,
|
|
108
|
+ server: 'server',
|
|
109
|
+ content,
|
|
110
|
+ photo: form.photo,
|
|
111
|
+ location: form.location || 'bottom',
|
|
112
|
+ fields_json: form.fields_json
|
100
|
113
|
};
|
101
|
114
|
if (this.form.id) {
|
102
|
115
|
data.id = this.form.id;
|
103
|
116
|
}
|
104
|
117
|
this.axios.post("/classify/store", data).then((res) => {
|
|
118
|
+ this.publishLoading = false;
|
105
|
119
|
if (res.data.status == 0) {
|
106
|
120
|
this.$Message.success('操作成功!');
|
107
|
|
- this.publishLoading = false;
|
108
|
121
|
setTimeout(() => {
|
109
|
122
|
this.$emit("pub-success");
|
110
|
123
|
}, 1000);
|
|
124
|
+ } else {
|
|
125
|
+ this.$Message.warning(res.data.message);
|
111
|
126
|
}
|
112
|
127
|
});
|
113
|
128
|
} else {
|