|
@@ -1,13 +1,10 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div id="app" class="app-container">
|
3
|
3
|
<el-form ref="form" :model="form">
|
4
|
|
- <el-form-item :label-width="formLabelWidth" label="业务名称">
|
5
|
|
- <el-input v-model="form.serviceName"/>
|
|
4
|
+ <el-form-item :label-width="formLabelWidth" label="案例标题">
|
|
5
|
+ <el-input v-model="form.caseTitle"/>
|
6
|
6
|
</el-form-item>
|
7
|
|
- <el-form-item :label-width="formLabelWidth" label="权重">
|
8
|
|
- <el-input v-model="form.sort"/>
|
9
|
|
- </el-form-item>
|
10
|
|
- <el-form-item :label-width="formLabelWidth" label="banner图">
|
|
7
|
+ <el-form-item :label-width="formLabelWidth" label="案例封面图">
|
11
|
8
|
<el-upload
|
12
|
9
|
:action= "uploadImgUrl"
|
13
|
10
|
:show-file-list="false"
|
|
@@ -18,24 +15,42 @@
|
18
|
15
|
<i v-else class="el-icon-plus avatar-uploader-icon"/>
|
19
|
16
|
</el-upload>
|
20
|
17
|
</el-form-item>
|
|
18
|
+ <el-form-item :label-width="formLabelWidth" label="案例简介">
|
|
19
|
+ <el-input v-model="form.caseSummary"/>
|
|
20
|
+ </el-form-item>
|
|
21
|
+ <el-form-item :label-width="formLabelWidth" label="案例类型">
|
|
22
|
+ <el-select v-model="form.taCaseTypeId" placeholder="请选择案例类型">
|
|
23
|
+ <el-option v-for="item in caseTypeList" :key="item.id" :value="item.id" :label="item.typeName"/>
|
|
24
|
+ </el-select>
|
|
25
|
+ </el-form-item>
|
|
26
|
+ <el-form-item :label-width="formLabelWidth" label="案例客户方logo">
|
|
27
|
+ <el-upload
|
|
28
|
+ :action= "uploadImgUrl"
|
|
29
|
+ :show-file-list="false"
|
|
30
|
+ :on-success="handleLogoSuccess"
|
|
31
|
+ class="avatar-uploader"
|
|
32
|
+ name="uploadFiles">
|
|
33
|
+ <img v-if="logoUrl" :src="logoUrl" class="avatar">
|
|
34
|
+ <i v-else class="el-icon-plus avatar-uploader-icon"/>
|
|
35
|
+ </el-upload>
|
|
36
|
+ </el-form-item>
|
|
37
|
+ <el-form-item :label-width="formLabelWidth" label="所属行业">
|
|
38
|
+ <el-input v-model="form.caseIndustry"/>
|
|
39
|
+ </el-form-item>
|
21
|
40
|
<el-form-item>
|
22
|
|
- <el-tag
|
23
|
|
- v-for="tag in dynamicTags"
|
24
|
|
- :key="tag"
|
25
|
|
- :disable-transitions="false"
|
26
|
|
- closable
|
27
|
|
- @close="handleClose(tag)">
|
28
|
|
- {{ tag }}
|
29
|
|
- </el-tag>
|
30
|
|
- <el-input
|
31
|
|
- v-if="inputVisible"
|
32
|
|
- ref="saveTagInput"
|
33
|
|
- v-model="inputValue"
|
34
|
|
- size="small"
|
35
|
|
- class="input-new-tag"
|
36
|
|
- @keyup.enter.native="handleInputConfirm"
|
37
|
|
- @blur="handleInputConfirm"/>
|
38
|
|
- <el-button v-else class="button-new-tag" closable @click="showInput">+ 添加标签</el-button>
|
|
41
|
+ <p class="title">案例内容</p>
|
|
42
|
+ <div id="websiteEditorElem" style="height: 400px"/>
|
|
43
|
+ </el-form-item>
|
|
44
|
+ <el-form-item :label-width="formLabelWidth" label="权重">
|
|
45
|
+ <el-input v-model="form.sort"/>
|
|
46
|
+ </el-form-item>
|
|
47
|
+ <el-form-item :label-width="formLabelWidth" label="是否置顶">
|
|
48
|
+ <el-switch
|
|
49
|
+ v-model="form.topping"
|
|
50
|
+ active-color="#13ce66"
|
|
51
|
+ inactive-color="#ff4949"
|
|
52
|
+ active-value="1"
|
|
53
|
+ inactive-value="0"/>
|
39
|
54
|
</el-form-item>
|
40
|
55
|
</el-form>
|
41
|
56
|
<div slot="footer" class="dialog-footer">
|
|
@@ -49,6 +64,7 @@
|
49
|
64
|
// import { updateArticle, createBanner } from '@/api/banner' // getBanner
|
50
|
65
|
import waves from '@/directive/waves' // Waves directive
|
51
|
66
|
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
|
67
|
+import E from 'wangeditor'
|
52
|
68
|
const calendarTypeOptions = [
|
53
|
69
|
{ key: 'CN', display_name: 'China' },
|
54
|
70
|
{ key: 'US', display_name: 'USA' },
|
|
@@ -84,6 +100,7 @@ export default {
|
84
|
100
|
total: 0,
|
85
|
101
|
listLoading: true,
|
86
|
102
|
imageUrl: '', // 图片预览
|
|
103
|
+ logoUrl: '', // 图片预览
|
87
|
104
|
importanceOptions: [1, 2, 3],
|
88
|
105
|
calendarTypeOptions,
|
89
|
106
|
communityQuery: {
|
|
@@ -98,10 +115,14 @@ export default {
|
98
|
115
|
listQuery: [],
|
99
|
116
|
form: {
|
100
|
117
|
id: '',
|
101
|
|
- serviceName: '',
|
|
118
|
+ caseTitle: '',
|
102
|
119
|
sort: '',
|
103
|
|
- serviceImageUrl: '',
|
104
|
|
- labelList: []
|
|
120
|
+ caseCoverImg: '',
|
|
121
|
+ caseLogoImg: '',
|
|
122
|
+ caseSummary: '',
|
|
123
|
+ caseIndustry: '',
|
|
124
|
+ topping: 0,
|
|
125
|
+ content: ''
|
105
|
126
|
},
|
106
|
127
|
uploadImgUrl: process.env.BASE_API + '/uploadimage',
|
107
|
128
|
dialogStatus: '',
|
|
@@ -109,6 +130,7 @@ export default {
|
109
|
130
|
formLabelWidth: '120px',
|
110
|
131
|
showContentVisible: false,
|
111
|
132
|
showURLVisible: true,
|
|
133
|
+ caseTypeList: [],
|
112
|
134
|
bannerPositionArr: [
|
113
|
135
|
{ id: 1, value: '首页banner' },
|
114
|
136
|
{ id: 2, value: '服务banner' }
|
|
@@ -118,17 +140,50 @@ export default {
|
118
|
140
|
inputValue: ''
|
119
|
141
|
}
|
120
|
142
|
},
|
121
|
|
- computed: {
|
|
143
|
+ mounted() {
|
|
144
|
+ const _that = this
|
|
145
|
+ const phoneEditor = new E('#websiteEditorElem')
|
|
146
|
+ phoneEditor.customConfig.zIndex = 1
|
|
147
|
+ phoneEditor.customConfig.onchange = function(html) {
|
|
148
|
+ _that.form.content = html
|
|
149
|
+ console.log('that.dynamic.url', _that.form.content)
|
|
150
|
+ }
|
|
151
|
+ // phoneEditor.customConfig.uploadImgServer = this.upFileUrl
|
|
152
|
+ // phoneEditor.customConfig.uploadFileName = 'uploadFiles'
|
|
153
|
+
|
|
154
|
+ phoneEditor.customConfig.customUploadImg = function(files, insert) {
|
|
155
|
+ _that.uploadImg(files[0]).then(data => {
|
|
156
|
+ insert(data)
|
|
157
|
+ })
|
|
158
|
+ }
|
|
159
|
+ phoneEditor.customConfig.menus = [
|
|
160
|
+ 'head', // 标题
|
|
161
|
+ 'bold', // 粗体
|
|
162
|
+ 'fontSize', // 字号
|
|
163
|
+ 'fontName', // 字体
|
|
164
|
+ 'italic', // 斜体
|
|
165
|
+ 'underline', // 下划线
|
|
166
|
+ 'strikeThrough', // 删除线
|
|
167
|
+ 'foreColor', // 文字颜色
|
|
168
|
+ 'backColor', // 背景颜色
|
|
169
|
+ 'justify', // 对齐方式
|
|
170
|
+ 'image' // 插入图片
|
|
171
|
+ ]
|
|
172
|
+ phoneEditor.create()
|
122
|
173
|
},
|
123
|
174
|
created() {
|
124
|
|
- this.listQuery = this.$route.params.listQuery
|
|
175
|
+ this.getCaseTypeList()
|
125
|
176
|
},
|
126
|
177
|
updated() {
|
127
|
178
|
},
|
128
|
179
|
methods: {
|
129
|
180
|
handleAvatarSuccess(res, file) { // 上传成功回调
|
130
|
181
|
this.imageUrl = URL.createObjectURL(file.raw)
|
131
|
|
- this.form.serviceImageUrl = res.data[0]
|
|
182
|
+ this.form.caseCoverImg = res.data[0]
|
|
183
|
+ },
|
|
184
|
+ handleLogoSuccess(res, file) { // 上传成功回调
|
|
185
|
+ this.logoUrl = URL.createObjectURL(file.raw)
|
|
186
|
+ this.form.caseLogoImg = res.data[0]
|
132
|
187
|
},
|
133
|
188
|
dialogAddForm() {
|
134
|
189
|
this.dialogFormVisible = true
|
|
@@ -138,7 +193,7 @@ export default {
|
138
|
193
|
},
|
139
|
194
|
dialogForm(isVaule) {
|
140
|
195
|
if (isVaule === '0') {
|
141
|
|
- this.$router.push({ name: 'service-index' })
|
|
196
|
+ this.$router.push({ name: 'case-index' })
|
142
|
197
|
} else {
|
143
|
198
|
this.createData()
|
144
|
199
|
}
|
|
@@ -156,13 +211,13 @@ export default {
|
156
|
211
|
this.$refs['form'].validate((valid) => {
|
157
|
212
|
if (valid) {
|
158
|
213
|
this.form.labelList = this.dynamicTags
|
159
|
|
- this.$store.dispatch('service/createService', this.form).then((res) => {
|
|
214
|
+ this.$store.dispatch('servicecase/createCase', this.form).then((res) => {
|
160
|
215
|
if (res.data.code === '0') {
|
161
|
216
|
this.$message({
|
162
|
217
|
message: res.data.message,
|
163
|
218
|
type: 'success'
|
164
|
219
|
})
|
165
|
|
- this.$router.push({ name: 'service-index' })
|
|
220
|
+ this.$router.push({ name: 'case-index' })
|
166
|
221
|
} else {
|
167
|
222
|
this.$message({
|
168
|
223
|
message: res.data.message,
|
|
@@ -189,12 +244,24 @@ export default {
|
189
|
244
|
}
|
190
|
245
|
this.inputVisible = false
|
191
|
246
|
this.inputValue = ''
|
|
247
|
+ },
|
|
248
|
+ getCaseTypeList() {
|
|
249
|
+ this.$store.dispatch('servicecase/getCaseTypeList', this.form).then((res) => {
|
|
250
|
+ if (res.data.code === '0') {
|
|
251
|
+ this.caseTypeList = res.data.data
|
|
252
|
+ }
|
|
253
|
+ })
|
192
|
254
|
}
|
193
|
255
|
}
|
194
|
256
|
}
|
195
|
257
|
</script>
|
196
|
258
|
|
197
|
259
|
<style scoped>
|
|
260
|
+.title{
|
|
261
|
+ font-size: 14px;
|
|
262
|
+ color: #606266;
|
|
263
|
+ font-weight: 600;
|
|
264
|
+}
|
198
|
265
|
.app-container {
|
199
|
266
|
width: 50%;
|
200
|
267
|
margin: auto;
|