|
@@ -1,66 +1,74 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="edit-carousel">
|
3
|
|
- <el-form ref="form" :model="building" label-width="180px">
|
|
3
|
+ <el-form ref="form" :model="form" label-width="180px">
|
4
|
4
|
<el-form-item label="所属项目:">
|
5
|
|
- <el-select v-model="buildingProperty" multiple placeholder="请选择">
|
6
|
|
- <el-option v-for="(t,i) in propertyType" :key="i" :label="t.name" :value="t.id"></el-option>
|
|
5
|
+ <el-select v-model="form.buildingId" placeholder="请选择">
|
|
6
|
+ <el-option
|
|
7
|
+ v-for="item in buildingList"
|
|
8
|
+ :key="item.buildingId"
|
|
9
|
+ :label="item.buildingName"
|
|
10
|
+ :value="item.buildingId">
|
|
11
|
+ </el-option>
|
7
|
12
|
</el-select>
|
8
|
13
|
</el-form-item>
|
9
|
14
|
<el-form-item label="主图:">
|
10
|
15
|
<el-upload
|
11
|
|
- :action="upFileUrl"
|
12
|
|
- name='file'
|
13
|
|
- list-type="picture-card"
|
14
|
|
- :headers="uploadHeaders"
|
15
|
|
- :file-list="imgList"
|
16
|
|
- :show-file-list="true"
|
17
|
|
- :before-upload="beforeImgUpload"
|
18
|
|
- :on-success="handleAvatarSuccess"
|
19
|
|
- :on-remove="handleRemove">
|
20
|
|
- <i class="el-icon-plus"></i>
|
|
16
|
+ :headers="uploadHeaders"
|
|
17
|
+ :action="upFileUrl"
|
|
18
|
+ :show-file-list="false"
|
|
19
|
+ :on-success="handleAvatarSuccess">
|
|
20
|
+ <img v-if="imageUrl" :src="imageUrl" class="avatar">
|
|
21
|
+ <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
21
|
22
|
</el-upload>
|
22
|
|
- <el-dialog :visible.sync="dialogVisible">
|
23
|
|
- <img width="100%" :src="dialogImageUrl" alt="">
|
24
|
|
- </el-dialog>
|
25
|
23
|
</el-form-item>
|
26
|
24
|
<el-form-item label="标题:">
|
27
|
|
- <el-input v-model="building.tel"></el-input>
|
|
25
|
+ <el-input v-model="form.title"></el-input>
|
28
|
26
|
</el-form-item>
|
29
|
27
|
<el-form-item label="发布位置:">
|
30
|
|
- <el-select v-model="buildingProperty" multiple placeholder="请选择">
|
31
|
|
- <el-option v-for="(t,i) in propertyType" :key="i" :label="t.name" :value="t.id"></el-option>
|
|
28
|
+ <el-select v-model="form.showPosition" placeholder="请选择">
|
|
29
|
+ <el-option v-for="(item,i) in showPositionList" :key="i" :label="item.name" :value="item.value"></el-option>
|
32
|
30
|
</el-select>
|
33
|
31
|
</el-form-item>
|
34
|
32
|
<el-form-item label="类型:">
|
35
|
|
- <el-select v-model="buildingProperty" multiple placeholder="请选择">
|
36
|
|
- <el-option v-for="(t,i) in propertyType" :key="i" :label="t.name" :value="t.id"></el-option>
|
|
33
|
+ <el-select v-model="form.contentType" placeholder="请选择">
|
|
34
|
+ <el-option v-for="(t,i) in contentTypeList" :key="i" :label="t.name" :value="t.value"></el-option>
|
37
|
35
|
</el-select>
|
38
|
36
|
</el-form-item>
|
39
|
|
- <el-form-item label="发布内容:">
|
40
|
|
- <div id="websiteEditorElem" style="height: 400px"></div>
|
|
37
|
+ <el-form-item label="发布内容:" v-if=" form.contentType === 'other'">
|
|
38
|
+ <rich-editor v-model="form.content" style="height: 400px; width: 1000px;" />
|
41
|
39
|
</el-form-item>
|
42
|
|
- <el-form-item label="发布内容:" class="publish">
|
43
|
|
- <p>活动名称展示处<span class="choose" v-popover:popover4>{{showPlace?showPlace:'请选择'}}</span></p>
|
44
|
|
- <el-popover ref="popover4" placement="right" width="560" v-model="popover4" trigger="click">
|
45
|
|
- <el-table :data="gridData">
|
46
|
|
- <el-table-column width="360" property="name" label="标题"></el-table-column>
|
47
|
|
- <el-table-column width="200" label="操作">
|
48
|
|
- <template slot-scope="scope">
|
49
|
|
- <el-button type="text" @click="handleEdit(scope.row)" size="small">选择</el-button>
|
50
|
|
- </template>
|
51
|
|
- </el-table-column>
|
52
|
|
- </el-table>
|
53
|
|
- </el-popover>
|
|
40
|
+ <el-form-item label="发布活动:" class="publish" v-if=" form.contentType === 'activity'">
|
|
41
|
+ <p>{{ showPlace }}<span class="choose" @click="showDial">请选择</span></p>
|
54
|
42
|
</el-form-item>
|
55
|
43
|
<el-form-item label="状态:">
|
56
|
|
- <el-select v-model="buildingProperty" multiple placeholder="请选择">
|
57
|
|
- <el-option v-for="(t,i) in propertyType" :key="i" :label="t.name" :value="t.id"></el-option>
|
|
44
|
+ <el-select v-model="form.status" placeholder="请选择">
|
|
45
|
+ <el-option v-for="(t,i) in extendContentStatus" :key="i" :label="t.name" :value="t.value"></el-option>
|
58
|
46
|
</el-select>
|
59
|
47
|
</el-form-item>
|
60
|
48
|
<el-form-item>
|
61
|
|
- <el-button type="primary" @click="onSubmit">保存</el-button>
|
|
49
|
+ <el-button type="primary" @click="submitAddOrUpdate">保存</el-button>
|
62
|
50
|
<el-button @click="onCancel">取消</el-button>
|
63
|
51
|
</el-form-item>
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+ <el-dialog title="选择活动" :visible.sync="dialogTableVisible">
|
|
55
|
+ <el-table :data="activityList">
|
|
56
|
+ <el-table-column property="title" label="活动名称"></el-table-column>
|
|
57
|
+ <el-table-column fixed="right" label="操作">
|
|
58
|
+ <template slot-scope="scope">
|
|
59
|
+ <el-button type="text" @click="handleDel(scope.row)" size="small">选择</el-button>
|
|
60
|
+ </template>
|
|
61
|
+ </el-table-column>
|
|
62
|
+ </el-table>
|
|
63
|
+ <el-pagination
|
|
64
|
+ @size-change="dialogHandleSizeChange"
|
|
65
|
+ @current-change="dialogHandleCurrentChange"
|
|
66
|
+ :current-page.sync="activityForm.pageNum"
|
|
67
|
+ :page-size="activityForm.pageSize"
|
|
68
|
+ layout="total, prev, pager, next"
|
|
69
|
+ :total="activityTotal">
|
|
70
|
+ </el-pagination>
|
|
71
|
+ </el-dialog>
|
64
|
72
|
</el-form>
|
65
|
73
|
</div>
|
66
|
74
|
</template>
|
|
@@ -87,6 +95,76 @@ export default {
|
87
|
95
|
data() {
|
88
|
96
|
var _self = this;
|
89
|
97
|
return {
|
|
98
|
+ form: {
|
|
99
|
+ contentId: '',
|
|
100
|
+ buildingId: '',
|
|
101
|
+ image: '',
|
|
102
|
+ title: '',
|
|
103
|
+ showPosition: '',
|
|
104
|
+ contentType: '',
|
|
105
|
+ content: '',
|
|
106
|
+ status: 0,
|
|
107
|
+ targetId: '',
|
|
108
|
+ showType: 'banner'
|
|
109
|
+ },
|
|
110
|
+ imageUrl: '',
|
|
111
|
+ buildingList: [], // 所属项目
|
|
112
|
+ buildingForm: { // 所属项目条件
|
|
113
|
+ pageNum: 1,
|
|
114
|
+ pageSize: 100
|
|
115
|
+ },
|
|
116
|
+ showPositionList: [
|
|
117
|
+ {
|
|
118
|
+ name: '首页',
|
|
119
|
+ value: 'index'
|
|
120
|
+ },
|
|
121
|
+ {
|
|
122
|
+ name: '商城',
|
|
123
|
+ value: 'mall'
|
|
124
|
+ }
|
|
125
|
+ ],
|
|
126
|
+ contentTypeList: [
|
|
127
|
+ {
|
|
128
|
+ name: '活动',
|
|
129
|
+ value: 'activity'
|
|
130
|
+ },
|
|
131
|
+ {
|
|
132
|
+ name: '项目',
|
|
133
|
+ value: 'project'
|
|
134
|
+ },
|
|
135
|
+ {
|
|
136
|
+ name: '资讯',
|
|
137
|
+ value: 'news'
|
|
138
|
+ },
|
|
139
|
+ {
|
|
140
|
+ name: '其他',
|
|
141
|
+ value: 'other'
|
|
142
|
+ }
|
|
143
|
+ ],
|
|
144
|
+ extendContentStatus: [ // 状态
|
|
145
|
+ {
|
|
146
|
+ name: "启用",
|
|
147
|
+ value: 1
|
|
148
|
+ },
|
|
149
|
+ {
|
|
150
|
+ name: "停用",
|
|
151
|
+ value: 0
|
|
152
|
+ },
|
|
153
|
+ ],
|
|
154
|
+ activityForm: { // 活动查询条件
|
|
155
|
+ pageNum: 1,
|
|
156
|
+ pageSize: 10
|
|
157
|
+ },
|
|
158
|
+ activityTotal: 0, // 活动总数
|
|
159
|
+ dialogTableVisible: false, //选择活动弹框
|
|
160
|
+ activityList: [], // 活动列表
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+ // 下面的不敢删除
|
90
|
168
|
popover4:false,//弹框
|
91
|
169
|
showPlace:'',//活动名称展示处
|
92
|
170
|
gridData: [
|
|
@@ -203,13 +281,8 @@ export default {
|
203
|
281
|
return true;
|
204
|
282
|
},
|
205
|
283
|
handleAvatarSuccess(res) {
|
206
|
|
- this.imgList = [
|
207
|
|
- ...this.imgList,
|
208
|
|
- {
|
209
|
|
- url: res.data
|
210
|
|
- }
|
211
|
|
- ];
|
212
|
|
- this.loading.close();
|
|
284
|
+ this.imageUrl = res.data
|
|
285
|
+ this.form.image = res.data
|
213
|
286
|
},
|
214
|
287
|
handleMapImgSuccess(res) {
|
215
|
288
|
this.building = { ...this.building, mapImg: res.data };
|
|
@@ -328,66 +401,80 @@ export default {
|
328
|
401
|
// this.showHx = true;
|
329
|
402
|
// });
|
330
|
403
|
// },
|
331
|
|
- handleDel(row) {
|
332
|
|
- this.$confirm("确认删除此数据?", "提示", {
|
333
|
|
- confirmButtonText: "确定",
|
334
|
|
- cancelButtonText: "取消",
|
335
|
|
- type: "warning"
|
336
|
|
- }).then(() => {
|
337
|
|
- if (this.building.status === 1) {
|
338
|
|
- this.$message.error("当前楼盘处于发布状态,不允许删除!");
|
339
|
|
- return false;
|
340
|
|
- }
|
341
|
|
- this.deleteApartment({
|
342
|
|
- id: row.apartmentId
|
343
|
|
- }).then(() => {
|
344
|
|
- this.getAparmentList();
|
345
|
|
- });
|
|
404
|
+ handleDel(row) { // 选择
|
|
405
|
+ this.form.targetId = row.dynamicId
|
|
406
|
+ this.showPlace = row.title
|
|
407
|
+ this.dialogTableVisible = false
|
|
408
|
+ },
|
|
409
|
+
|
|
410
|
+ showDial() { // 显示活动弹窗
|
|
411
|
+ this.dialogTableVisible = true
|
|
412
|
+ this.getActivityList()
|
|
413
|
+ },
|
|
414
|
+ getExtendContentById() {
|
|
415
|
+ this.$store.dispatch('carouselFigure/getByIdExtendContent', this.form).then((res) => {
|
|
416
|
+ console.log('carouselFigure/getByIdExtendContent', res)
|
|
417
|
+ this.form = res
|
|
418
|
+ this.imageUrl = res.image
|
|
419
|
+ this.showPlace = res.targetName
|
|
420
|
+ }).catch(() => {
|
|
421
|
+ console.log('carouselFigure/getByIdExtendContent err')
|
|
422
|
+ })
|
|
423
|
+ },
|
|
424
|
+ getBuildList() {
|
|
425
|
+ this.$store.dispatch('building/getBuildings', this.buildingForm).then((res) => {
|
|
426
|
+ this.buildingList = res.records
|
|
427
|
+ }).catch(() => {
|
|
428
|
+ console.log('building/getBuildings err')
|
|
429
|
+ })
|
|
430
|
+ },
|
|
431
|
+ getActivityList() { // 活动列表
|
|
432
|
+ this.$store.dispatch('activity/getActivityList',this.activityForm).then(res => {
|
|
433
|
+ this.activityList = res.list;
|
|
434
|
+ this.activityForm.pageSize = res.pageSize
|
|
435
|
+ this.activityForm.pageNum = res.pageNum
|
|
436
|
+ this.activityTotal = res.total
|
|
437
|
+ }).catch(err => {
|
|
438
|
+ this.$notify.error(err.msg || err.message);
|
346
|
439
|
});
|
347
|
|
- }
|
|
440
|
+ },
|
|
441
|
+ dialogHandleSizeChange(value) {
|
|
442
|
+ this.activityForm.pageSize = value
|
|
443
|
+ this.getActivityList()
|
|
444
|
+ },
|
|
445
|
+ dialogHandleCurrentChange(value) {
|
|
446
|
+ this.activityForm.pageNum = value
|
|
447
|
+ this.getActivityList()
|
|
448
|
+ },
|
|
449
|
+ submitAddOrUpdate() { // 添加或者修改
|
|
450
|
+
|
|
451
|
+ // 添加
|
|
452
|
+ if (this.form.contentId === undefined || this.form.contentId === '') {
|
|
453
|
+ this.$store.dispatch('carouselFigure/addExtendContent', this.form).then((res) => {
|
|
454
|
+ this.$message.success('操作成功')
|
|
455
|
+ this.$router.go(-1)
|
|
456
|
+ }).catch(() => {
|
|
457
|
+
|
|
458
|
+ })
|
|
459
|
+ return
|
|
460
|
+ }
|
|
461
|
+
|
|
462
|
+ // 修改
|
|
463
|
+ this.$store.dispatch('carouselFigure/updateExtendContent', this.form).then((res) => {
|
|
464
|
+ this.$message.success('操作成功')
|
|
465
|
+ this.$router.go(-1)
|
|
466
|
+ }).catch(() => {
|
|
467
|
+ console.log('carouselFigure/updateExtendContent err')
|
|
468
|
+ })
|
|
469
|
+ },
|
|
470
|
+
|
348
|
471
|
},
|
349
|
|
- mounted() {
|
350
|
|
- const _that = this;
|
351
|
|
- const phoneEditor = new E("#websiteEditorElem");
|
352
|
|
- phoneEditor.customConfig.onchange = function(html) {
|
353
|
|
- _that.building = { ..._that.building, remark: html };
|
354
|
|
- };
|
355
|
|
- phoneEditor.customConfig.customUploadImg = function(files, insert) {
|
356
|
|
- _that.uploadImg(files[0]).then(data => {
|
357
|
|
- insert(data[0]);
|
358
|
|
- });
|
359
|
|
- };
|
360
|
|
- phoneEditor.customConfig.menus = [
|
361
|
|
- "head", // 标题
|
362
|
|
- "bold", // 粗体
|
363
|
|
- "fontSize", // 字号
|
364
|
|
- "fontName", // 字体
|
365
|
|
- "italic", // 斜体
|
366
|
|
- "underline", // 下划线
|
367
|
|
- "strikeThrough", // 删除线
|
368
|
|
- "foreColor", // 文字颜色
|
369
|
|
- "backColor", // 背景颜色
|
370
|
|
- "justify", // 对齐方式
|
371
|
|
- "image" // 插入图片
|
372
|
|
- ];
|
373
|
|
- phoneEditor.create();
|
374
|
|
- if ((this.$route.query.id || "") !== "") {
|
375
|
|
- this.getAparmentList();
|
376
|
|
- window.console.log(this.getDetail);
|
377
|
|
- this.getDetail({ id: this.$route.query.id }).then(data => {
|
378
|
|
- this.buildingProperty = data.propertyType.split(",");
|
379
|
|
- phoneEditor.txt.html(data.remark);
|
380
|
|
- this.imgList = data.buildingImg.map(x => {
|
381
|
|
- return {
|
382
|
|
- name: x.imgId,
|
383
|
|
- url: x.url
|
384
|
|
- };
|
385
|
|
- });
|
386
|
|
- this.tags = data.buildingTag.map(x => x.tagName);
|
387
|
|
- });
|
388
|
|
- } else {
|
389
|
|
- phoneEditor.txt.html("");
|
|
472
|
+ created() {
|
|
473
|
+ this.form.contentId = this.$route.query.id
|
|
474
|
+ if (this.$route.query.id !== undefined) {
|
|
475
|
+ this.getExtendContentById()
|
390
|
476
|
}
|
|
477
|
+ this.getBuildList()
|
391
|
478
|
}
|
392
|
479
|
};
|
393
|
480
|
</script>
|