魏熙美 5 år sedan
förälder
incheckning
8c09a0ba7d

+ 175
- 164
src/views/carouselFigure/advertisement.vue Visa fil

@@ -5,224 +5,235 @@
5 5
         <div class="flex-item flex-h">
6 6
           <el-button size="mini" type="success" @click='addDynamic'>新增</el-button>
7 7
         </div>
8
+        <el-select v-model="buildingId" placeholder="请选择" @change="getList">
9
+          <el-option
10
+                  v-for="item in buildingList"
11
+                  :key="item.buildingId"
12
+                  :label="item.buildingName"
13
+                  :value="item.buildingId">
14
+          </el-option>
15
+        </el-select>
8 16
       </div>
9 17
       <div class="moreFilter"></div>
10 18
     </div>
11
-    <el-table
12
-      :data="dynamics.list || []"
13
-      >
19
+    <el-table :data="carouselList.records || []">
14 20
       <el-table-column
15
-        type="index">
21
+              type="index">
16 22
         <template slot-scope="scope">
17 23
           <span>{{ GetIndex(scope.$index) }}</span>
18 24
         </template>
19 25
       </el-table-column>
20 26
       <el-table-column
21
-        label="主图">
27
+              label="主图">
22 28
         <template slot-scope="scope">
23 29
           <div class="header">
24
-            <img :src="scope.row.imgUrl" alt="" />
30
+            <img :src="scope.row.image" alt="" />
25 31
           </div>
26 32
         </template>
27 33
       </el-table-column>
28 34
       <el-table-column
29
-        prop="title"
30
-        label="类型">
35
+              prop="showType"
36
+              label="类型">
37
+        <template slot-scope="scope">{{ scope.row.showType === 'banner' ? '轮播图' : scope.row.showType === 'screen' ? '开屏' : '' }}</template>
31 38
       </el-table-column>
32 39
       <el-table-column
33
-        prop="createDate"
34
-        label="发布时间">
40
+              label="发布时间"
41
+              width="180">
42
+        <template slot-scope="scope">
43
+          <span>{{FormatDate(scope.row.createDate)}}</span>
44
+        </template>
35 45
       </el-table-column>
36 46
       <el-table-column
37
-        label="状态"
38
-        >
47
+              label="状态">
39 48
         <template slot-scope="scope">
40 49
           <span>{{scope.row.status == 1 ? '启用' : '停用'}}</span>
41 50
         </template>
42 51
       </el-table-column>
43 52
       <el-table-column
44
-        fixed="right"
45
-        label="操作"
46
-        width="180">
53
+              fixed="right"
54
+              label="操作"
55
+              width="180">
47 56
         <template slot-scope="scope">
48 57
           <el-button type="text" @click="handleEdit(scope.row)" v-if="scope.row.status === 0" size="small">编辑</el-button>
49
-          <el-button type="text" @click="handlePulic(scope.row)" size="small" v-if="scope.row.status === 0">启用</el-button>
50
-          <el-button type="text" @click="handleUnPulic(scope.row)" size="small" v-if="scope.row.status === 1">禁用</el-button>
51
-
58
+          <el-button type="text" @click="handlePulic(scope.row.contentId, 1)" size="small" v-if="scope.row.status === 0">启用</el-button>
59
+          <el-button type="text" @click="Prohibit(scope.row.contentId, 0)" size="small" v-if="scope.row.status === 1">禁用</el-button>
52 60
         </template>
53 61
       </el-table-column>
54 62
     </el-table>
55 63
     <el-pagination
56
-      small
57
-      style="margin-top:10px;"
58
-      layout="prev, pager, next"
59
-      :current-page.sync="currentPage"
60
-      :pageSize="pageSize"
61
-      :total="dynamics.total || 0"
62
-      @current-change="getList"
64
+            small
65
+            style="margin-top:10px;"
66
+            layout="prev, pager, next"
67
+            :current-page.sync="currentPage"
68
+            :pageSize="pageSize"
69
+            :total="carouselList.total || 0"
70
+            @current-change="getList"
63 71
     >
64 72
     </el-pagination>
65 73
   </div>
66 74
 </template>
67 75
 
68 76
 <script>
69
-import { createNamespacedHelpers } from 'vuex';
77
+  import { createNamespacedHelpers } from "vuex";
78
+  import dayjs from 'dayjs'
70 79
 
71
-const {mapState: mapDynamicState, mapActions: mapDynamicActions} = createNamespacedHelpers('dynamic')
72
-const {mapState: mapBuildingState, mapActions: mapBuildingActions} = createNamespacedHelpers('building')
80
+  const {
81
+    mapState: mapCarouselFigureState,
82
+    mapActions: mapCarouselFigureActions
83
+  } = createNamespacedHelpers("carouselFigure");
73 84
 
74
-export default {
75
-  data() {
76
-    return {
77
-      pageSize: 20,
78
-      currentPage: 1,
79
-      name: '',
80
-      buildingId: '',
81
-    }
82
-  },
83
-  computed: {
84
-    ...mapDynamicState({
85
-      dynamics: x => x.dynamics
86
-    }),
87
-    ...mapBuildingState({
88
-      buildings: x => x.buildings
89
-    })
90
-  },
91
-  methods: {
92
-    ...mapDynamicActions([
93
-      'getDynamics',
94
-      'setDetailNull',
95
-      'deleteDynamics',
96
-      'publicDynamic',
97
-      'cancelDynamic'
98
-    ]),
99
-    ...mapBuildingActions([
100
-      'getBuildings',
101
-    ]),
102
-    GetIndex (inx) {
103
-      return (this.currentPage - 1) * this.pageSize + inx + 1
104
-    },
105
-    FormatDate (date) {
106
-      if (date) {
107
-        return dayjs(date).formate('yyyy-MM-DD HH:mm:ss')
108
-      } else {
109
-        return ''
110
-      }
85
+  const {
86
+    mapState: mapBuildingState,
87
+    mapActions: mapBuildingActions
88
+  } = createNamespacedHelpers("building");
89
+
90
+  export default {
91
+    data() {
92
+      return {
93
+        pageSize: 20,
94
+        currentPage: 1,
95
+        name: "",
96
+        buildingId: "",
97
+        buildingList: [], // 所属项目
98
+        buildingForm: { // 所属项目条件
99
+          pageNum: 1,
100
+          pageSize: 100
101
+        },
102
+      };
111 103
     },
112
-    getList () {
113
-      this.getDynamics({
114
-        pageNum: this.currentPage,
115
-        pageSize: this.pageSize,
116
-        name: this.name,
117
-        buildingId: this.buildingId
104
+    computed: {
105
+      ...mapCarouselFigureState({
106
+        carouselList: x => x.carouselList
107
+      }),
108
+      ...mapBuildingState({
109
+        buildings: x => x.buildings
118 110
       })
119 111
     },
120
-    getBuildingName (id) {
121
-      return ((this.buildings.list || []).filter(x => x.buildingId === id)[0] || {}).buildingName || ''
122
-    },
123
-    search () {
124
-      this.currentPage = 1
125
-      this.getList()
126
-    },
127
-    handleEdit (row) {
128
-      this.setDetailNull()
129
-      this.$router.push({name: 'advertisementEdit', query: {id: row.dynamicId}})
130
-    },
131
-    handlePulic (row) {
132
-      this.$confirm('确认发布此数据?', '提示', {
133
-        confirmButtonText: '确定',
134
-        cancelButtonText: '取消',
135
-        type: 'warning'
136
-      }).then(() => {
137
-        this.publicDynamic({
138
-          id: row.dynamicId
112
+    methods: {
113
+      ...mapCarouselFigureActions(["getExtendContent","handleExtendContent"]),
114
+      ...mapBuildingActions(["getBuildings"]),
115
+      GetIndex(inx) {
116
+        return (this.currentPage - 1) * this.pageSize + inx + 1;
117
+      },
118
+      FormatDate(date) {
119
+        if (!date || date.indexOf('0001-') > -1) return ''
120
+
121
+        return dayjs(date).format('YYYY-MM-DD HH:mm:ss')
122
+      },
123
+
124
+      getList() {
125
+        this.getExtendContent({
126
+          pageNum: this.currentPage,
127
+          pageSize: this.pageSize,
128
+          buildingId: this.buildingId,
129
+          showType: 'screen'
130
+        });
131
+      },
132
+      getBuildingName(id) {
133
+        return (
134
+                ((this.buildings.list || []).filter(x => x.buildingId === id)[0] || {})
135
+                        .buildingName || ""
136
+        );
137
+      },
138
+      search() {
139
+        this.currentPage = 1;
140
+        this.getList();
141
+      },
142
+      handleEdit(row) {
143
+        this.$router.push({ name: "advertisementEdit", query: { id: row.contentId } });
144
+      },
145
+      handlePulic(contentId, status) {
146
+        this.$confirm("确认发布此数据?", "提示", {
147
+          confirmButtonText: "确定",
148
+          cancelButtonText: "取消",
149
+          type: "warning"
139 150
         }).then(() => {
140
-          this.getList()
141
-        })
142
-      })
143
-    },
144
-    handleUnPulic (row) {
145
-      this.$confirm('确认取消发布此数据?', '提示', {
146
-        confirmButtonText: '确定',
147
-        cancelButtonText: '取消',
148
-        type: 'warning'
149
-      }).then(() => {
150
-        this.cancelDynamic({
151
-          id: row.dynamicId}).then(() => {
152
-          this.getList()
153
-        })
154
-      })
155
-    },
156
-    handleDel (row) {
157
-      this.$confirm('确认删除此数据?', '提示', {
158
-        confirmButtonText: '确定',
159
-        cancelButtonText: '取消',
160
-        type: 'warning'
161
-      }).then(() => {
162
-        if (row.status === 1) {
163
-          this.$message.error('当前活动处于发布状态,不允许删除!')
164
-          return false
165
-        }
166
-        this.deleteDynamics({
167
-          id: row.dynamicId
151
+          this.updateExtendContent(contentId, status)
152
+        });
153
+      },
154
+      Prohibit(contentId, status) {
155
+        this.$confirm("确认停用此轮播图?", "提示", {
156
+          confirmButtonText: "确定",
157
+          cancelButtonText: "取消",
158
+          type: "warning"
159
+        }).then(() => {
160
+          this.updateExtendContent(contentId, status)
161
+        });
162
+      },
163
+      handleDel(contentId, status) {
164
+        this.$confirm("确认删除此数据?", "提示", {
165
+          confirmButtonText: "确定",
166
+          cancelButtonText: "取消",
167
+          type: "warning"
168 168
         }).then(() => {
169
-          this.getList()
169
+          if (row.status === 1) {
170
+            this.$message.error("当前活动处于发布状态,不允许删除!");
171
+            return false;
172
+          }
173
+        });
174
+      },
175
+      updateExtendContent(contentId, status) { // 修改轮播状态
176
+        this.$store.dispatch('carouselFigure/updateExtendContent', { contentId: contentId, status: status }).then((res) => {
177
+          this.getList();
178
+        }).catch(() =>{
179
+          console.log('carouselFigure/updateExtendContent err')
170 180
         })
171
-      })
181
+      },
182
+      addDynamic() {
183
+        this.$router.push({ name: "advertisementEdit" });
184
+      },
185
+      getBuildList() {
186
+        this.$store.dispatch('building/getBuildings', this.buildingForm).then((res) => {
187
+          this.buildingList = res.records
188
+        }).catch(() => {
189
+          console.log('building/getBuildings err')
190
+        })
191
+      },
172 192
     },
173
-    addDynamic () {
174
-      this.setDetailNull()
175
-      this.$router.push({name: 'advertisementEdit'})
193
+    created() {
194
+      this.getBuildList()
195
+      this.getList();
176 196
     }
177
-  },
178
-  created () {
179
-    this.getBuildings({
180
-      pageNum: 1,
181
-      pageSize: 100,
182
-    }).then(() => {
183
-      this.getList()
184
-    })
185
-  }
186
-}
197
+  };
187 198
 </script>
188 199
 
189 200
 <style lang="scss" scoped>
190
-.header{
191
-  width: 50px;
192
-  height: 50px;
193
-  img{
194
-    width: 100%;
195
-    height: 100%;
201
+  .header {
202
+    width: 50px;
203
+    height: 50px;
204
+    img {
205
+      width: 100%;
206
+      height: 100%;
207
+    }
196 208
   }
197
-}
198 209
 
199
-.system-table-search{
200
-  width: calc(100% - 40px);
201
-  margin: 20px auto 0;
202
-}
210
+  .system-table-search {
211
+    width: calc(100% - 40px);
212
+    margin: 20px auto 0;
213
+  }
203 214
 
204
-.system-table-search li{
205
-  margin-right: 20px;
206
-}
215
+  .system-table-search li {
216
+    margin-right: 20px;
217
+  }
207 218
 
208
-.system-table-search ul{
209
-  font-size: 0;
210
-  white-space: nowrap;
211
-}
219
+  .system-table-search ul {
220
+    font-size: 0;
221
+    white-space: nowrap;
222
+  }
212 223
 
213
-.system-table-search ul>li{
214
-  display: inline-block;
215
-}
224
+  .system-table-search ul > li {
225
+    display: inline-block;
226
+  }
216 227
 
217
-.flex-h {
218
-  display: flex;
219
-  display: -webkit-flex;
220
-}
228
+  .flex-h {
229
+    display: flex;
230
+    display: -webkit-flex;
231
+  }
221 232
 
222
-.flex-item {
223
-  flex: 1;
224
-  -webkit-flex: 1;
225
-  position: relative;
226
-  overflow: hidden;
227
-}
233
+  .flex-item {
234
+    flex: 1;
235
+    -webkit-flex: 1;
236
+    position: relative;
237
+    overflow: hidden;
238
+  }
228 239
 </style>

+ 506
- 414
src/views/carouselFigure/advertisementEdit.vue Visa fil

@@ -1,454 +1,546 @@
1 1
 <template>
2
-    <div class="edit-carousel">
3
-      <el-form ref="form" :model="building" label-width="180px">
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>
7
-          </el-select>
8
-        </el-form-item>
9
-        <el-form-item label="主图:">
10
-          <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>
21
-          </el-upload>
22
-          <el-dialog :visible.sync="dialogVisible">
23
-            <img width="100%" :src="dialogImageUrl" alt="">
24
-          </el-dialog>
25
-        </el-form-item>
26
-        <el-form-item label="标题:">
27
-          <el-input v-model="building.tel"></el-input>
28
-        </el-form-item>
29
-        <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>
32
-          </el-select>
33
-        </el-form-item>
34
-        <el-form-item label="发布内容:">
35
-          <div id="websiteEditorElem" style="height: 400px"></div>
36
-        </el-form-item>
37
-        <el-form-item label="发布内容:" class="publish">
38
-          <p>活动名称展示处<span class="choose" v-popover:popover4>{{showPlace?showPlace:'请选择'}}</span></p>
39
-          <el-popover ref="popover4"  placement="right"  width="560" v-model="popover4"  trigger="click">
40
-            <el-table :data="gridData">
41
-            <el-table-column width="360" property="name" label="标题"></el-table-column>
42
-            <el-table-column width="200" label="操作">
43
-              <template slot-scope="scope">
44
-                <el-button type="text" @click="handleEdit(scope.row)" size="small">选择</el-button>
45
-        </template>
46
-            </el-table-column>
47
-            </el-table>
48
-          </el-popover>
49
-        </el-form-item>
50
-        <el-form-item label="状态:">
51
-          <el-select v-model="buildingProperty" multiple placeholder="请选择">
52
-            <el-option v-for="(t,i) in propertyType" :key="i" :label="t.name" :value="t.id"></el-option>
53
-          </el-select>
54
-        </el-form-item>
55
-        <el-form-item>
56
-          <el-button type="primary" @click="onSubmit">保存</el-button>
57
-          <el-button @click="onCancel">取消</el-button>
58
-        </el-form-item>
59
-      </el-form>
60
-    </div>    
2
+  <div class="edit-carousel">
3
+    <el-form ref="form" :model="form" label-width="180px">
4
+      <el-form-item label="所属项目:">
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>
12
+        </el-select>
13
+      </el-form-item>
14
+      <el-form-item label="主图:">
15
+        <el-upload
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>
22
+        </el-upload>
23
+      </el-form-item>
24
+      <el-form-item label="标题:">
25
+        <el-input v-model="form.title"></el-input>
26
+      </el-form-item>
27
+      <el-form-item label="发布位置:">
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>
30
+        </el-select>
31
+      </el-form-item>
32
+      <el-form-item label="类型:">
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>
35
+        </el-select>
36
+      </el-form-item>
37
+      <el-form-item label="发布内容:" v-if=" form.contentType === 'other'">
38
+        <rich-editor v-model="form.content" style="height: 400px; width: 1000px;" />
39
+      </el-form-item>
40
+      <el-form-item label="发布活动:" class="publish" v-if=" form.contentType === 'activity'">
41
+        <p>{{ showPlace }}<span class="choose" @click="showDial">请选择</span></p>
42
+      </el-form-item>
43
+      <el-form-item label="状态:">
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>
46
+        </el-select>
47
+      </el-form-item>
48
+      <el-form-item>
49
+        <el-button type="primary" @click="submitAddOrUpdate">保存</el-button>
50
+        <el-button @click="onCancel">取消</el-button>
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>
72
+    </el-form>
73
+  </div>
61 74
 </template>
62 75
 
63 76
 <script>
64
-import { createNamespacedHelpers } from "vuex";
65
-import apis from "../../config/api";
66
-import { mapState } from "vuex";
67
-import E from "wangeditor";
77
+  import { createNamespacedHelpers } from "vuex";
78
+  import apis from "../../config/api";
79
+  import { mapState } from "vuex";
80
+  import E from "wangeditor";
68 81
 
69
-const {
70
-  mapState: mapBuildingState,
71
-  mapActions: mapBuildingActions,
72
-  mapMutations: mapBuildingMutations
73
-} = createNamespacedHelpers("building");
82
+  const {
83
+    mapState: mapBuildingState,
84
+    mapActions: mapBuildingActions,
85
+    mapMutations: mapBuildingMutations
86
+  } = createNamespacedHelpers("building");
74 87
 
75
-const { mapActions: mapApartmentActions } = createNamespacedHelpers(
76
-  "apartment"
77
-);
88
+  const { mapActions: mapApartmentActions } = createNamespacedHelpers(
89
+          "apartment"
90
+  );
78 91
 
79
-const { mapActions: mapImgActions } = createNamespacedHelpers("img");
92
+  const { mapActions: mapImgActions } = createNamespacedHelpers("img");
80 93
 
81
-export default {
82
-  data() {
83
-    var _self = this;
84
-    return {
85
-      popover4:false,//弹框
86
-      showPlace:'',//活动名称展示处
87
-      gridData: [
88
-        {
89
-          date: "2016-05-02",
90
-          name: "高奢生活,在遇到它之前你想象不到"
94
+  export default {
95
+    data() {
96
+      var _self = this;
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'
91 109
         },
92
-        {
93
-          date: "2016-05-04",
94
-          name: "欢乐套圈圈,福利大放送"
110
+        imageUrl: '',
111
+        buildingList: [], // 所属项目
112
+        buildingForm: { // 所属项目条件
113
+          pageNum: 1,
114
+          pageSize: 100
95 115
         },
96
-        {
97
-          date: "2016-05-01",
98
-          name: "上海市普陀区金沙江路 1518 弄"
99
-        }
100
-      ],
101
-      upFileUrl: apis.file.upload.url,
102
-      commPrefix: "",
103
-      imgurl: "",
104
-      loadingZm: false,
105
-      activeName: "detail",
106
-      dialogImageUrl: "",
107
-      dialogVisible: false,
108
-      dialogApartImageUrl: "",
109
-      dialogApartVisible: false,
110
-      showHx: false,
111
-      imgList: [],
112
-      tags: [],
113
-      buildingProperty: [],
114
-      aparments: [],
115
-      aparmentInfo: {},
116
-      aparmentImg: [],
117
-      saleType: [
118
-        {
119
-          id: 1,
120
-          name: "待定"
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
121 157
         },
122
-        {
123
-          id: 2,
124
-          name: "售罄"
125
-        },
126
-        {
127
-          id: 3,
128
-          name: "在售"
129
-        }
130
-      ]
131
-    };
132
-  },
133
-  computed: {
134
-    ...mapBuildingState({
135
-      detail: x => x.detail
136
-    }),
137
-    ...mapState({
138
-      dicts: x => x.dicts
139
-    }),
140
-    building: {
141
-      get() {
142
-        return this.detail;
143
-      },
144
-      set(val) {
145
-        return this.updateDetail(val);
146
-      }
147
-    },
148
-    propertyType() {
149
-      return (this.dicts || []).filter(x => x.type === "propertyType");
150
-    },
151
-    uploadHeaders() {
152
-      const token = localStorage.getItem("x-token") || "";
153
-      return {
154
-        Authorization: `Bearer ${token}`
155
-      };
156
-    }
157
-  },
158
-  methods: {
159
-    ...mapBuildingMutations(["updateDetail"]),
160
-    ...mapBuildingActions(["getDetail", "addBuilding", "editBuilding"]),
161
-    ...mapApartmentActions([
162
-      "getApartments",
163
-      "getApartmentDetail",
164
-      "addApartment",
165
-      "editApartment",
166
-      "deleteApartment"
167
-    ]),
168
-    ...mapImgActions(["uploadImg"]),
169
-    getSaleTypeName(id) {
170
-      return (this.saleType.filter(x => x.id == id)[0] || {}).name;
171
-    },
172
-    onCancel() {
173
-      this.$router.push({ name: "buildinglist" });
174
-    },
175
-    handleRemove(file, fileList) {
176
-      this.imgList = fileList;
177
-    },
178
-    handleAparmentRemove(file, fileList) {
179
-      this.aparmentImg = fileList;
180
-    },
158
+        activityTotal: 0, // 活动总数
159
+        dialogTableVisible: false, //选择活动弹框
160
+        activityList: [], // 活动列表
181 161
 
182
-    beforeImgUpload(file) {
183
-      if (file.type !== "image/jpeg" && file.type !== "image/png") {
184
-        this.$message.error("上传图片只能是 JPG 或 PNG 格式!");
185
-        return false;
186
-      }
187
-      // if (file.size / 1024 > 300) {
188
-      //   this.$message.error('图片大小不允许超过300k!')
189
-      //   return false
190
-      // }
191
-      this.loading = this.$loading({
192
-        lock: true,
193
-        text: "上传中...",
194
-        spinner: "el-icon-loading",
195
-        background: "rgba(0, 0, 0, 0.7)"
196
-      });
197 162
 
198
-      return true;
199
-    },
200
-    handleAvatarSuccess(res) {
201
-      this.imgList = [
202
-        ...this.imgList,
203
-        {
204
-          url: res.data
205
-        }
206
-      ];
207
-      this.loading.close();
208
-    },
209
-    handleMapImgSuccess(res) {
210
-      this.building = { ...this.building, mapImg: res.data };
211
-      this.loading.close();
212
-    },
213
-    handlePosterSuccess(res) {
214
-      this.building = { ...this.building, poster: res.data };
215
-      this.loading.close();
216
-    },
217
-    handleAparmentSuccess(res) {
218
-      this.aparmentImg = [
219
-        ...this.aparmentImg,
220
-        {
221
-          url: res.data
222
-        }
223
-      ];
224
-      this.loading.close();
225
-    },
226
-    onSubmit() {
227
-      const imgs = this.imgList.map((x, i) => {
228
-        return {
229
-          imgType: "banner",
230
-          url: x.url,
231
-          orderNo: i + 1
232
-        };
233
-      });
234
-      const tag = this.tags.map(x => {
235
-        return {
236
-          tagName: x
237
-        };
238
-      });
239
-      const building = {
240
-        ...this.building,
241
-        img: imgs,
242
-        propertyType: this.buildingProperty.join(","),
243
-        tag
163
+
164
+
165
+
166
+
167
+        // 下面的不敢删除
168
+        popover4:false,//弹框
169
+        showPlace:'',//活动名称展示处
170
+        gridData: [
171
+          {
172
+            date: "2016-05-02",
173
+            name: "高奢生活,在遇到它之前你想象不到"
174
+          },
175
+          {
176
+            date: "2016-05-04",
177
+            name: "欢乐套圈圈,福利大放送"
178
+          },
179
+          {
180
+            date: "2016-05-01",
181
+            name: "上海市普陀区金沙江路 1518 弄"
182
+          }
183
+        ],
184
+        upFileUrl: apis.file.upload.url,
185
+        commPrefix: "",
186
+        imgurl: "",
187
+        loadingZm: false,
188
+        activeName: "detail",
189
+        dialogImageUrl: "",
190
+        dialogVisible: false,
191
+        dialogApartImageUrl: "",
192
+        dialogApartVisible: false,
193
+        showHx: false,
194
+        imgList: [],
195
+        tags: [],
196
+        buildingProperty: [],
197
+        aparments: [],
198
+        aparmentInfo: {},
199
+        aparmentImg: [],
200
+        saleType: [
201
+          {
202
+            id: 1,
203
+            name: "待定"
204
+          },
205
+          {
206
+            id: 2,
207
+            name: "售罄"
208
+          },
209
+          {
210
+            id: 3,
211
+            name: "在售"
212
+          }
213
+        ]
244 214
       };
245
-      if (!building.buildingId) {
246
-        // 新增
247
-        this.addBuilding({
248
-          onSuccess: this.onCancel,
249
-          detail: JSON.stringify(building)
250
-        });
251
-      } else {
252
-        // 修改
253
-        this.editBuilding({
254
-          onSuccess: this.onCancel,
255
-          detail: JSON.stringify(building)
256
-        });
257
-      }
258 215
     },
259
-    FormatDate(date) {
260
-      return (date || "").split("T")[0] === "0001-01-01"
261
-        ? ""
262
-        : (date || "").split("T")[0];
263
-    },
264
-    saveAparment() {
265
-      const imgs = this.aparmentImg.map((x, i) => {
216
+    computed: {
217
+      ...mapBuildingState({
218
+        detail: x => x.detail
219
+      }),
220
+      ...mapState({
221
+        dicts: x => x.dicts
222
+      }),
223
+      building: {
224
+        get() {
225
+          return this.detail;
226
+        },
227
+        set(val) {
228
+          return this.updateDetail(val);
229
+        }
230
+      },
231
+      propertyType() {
232
+        return (this.dicts || []).filter(x => x.type === "propertyType");
233
+      },
234
+      uploadHeaders() {
235
+        const token = localStorage.getItem("x-token") || "";
266 236
         return {
267
-          imgType: "aparment",
268
-          url: x.url,
269
-          orderNo: i + 1
237
+          Authorization: `Bearer ${token}`
270 238
         };
271
-      });
272
-      if (!this.aparmentInfo.apartmentId) {
273
-        this.addApartment(
274
-          JSON.stringify({
275
-            ...this.aparmentInfo,
276
-            img: imgs
277
-          })
278
-        ).then(() => {
279
-          this.getAparmentList();
280
-          this.showHx = false;
281
-        });
282
-      } else {
283
-        this.editApartment(
284
-          JSON.stringify({
285
-            ...this.aparmentInfo,
286
-            img: imgs
287
-          })
288
-        ).then(() => {
289
-          this.getAparmentList();
290
-          this.showHx = false;
291
-        });
292 239
       }
293 240
     },
294
-    addHx() {
295
-      this.aparmentImg = [];
296
-      this.aparmentInfo = { buildingId: this.building.buildingId };
297
-      this.showHx = true;
298
-    },
299
-    getAparmentList() {
300
-      this.getApartments({ buildingId: this.$route.query.id }).then(data => {
301
-        this.aparments = data;
302
-      });
303
-    },
304
-    handleEdit(row){
305
-      this.showPlace = row.name
306
-      this.popover4 = false
307
-
241
+    methods: {
242
+      ...mapBuildingMutations(["updateDetail"]),
243
+      ...mapBuildingActions(["getDetail", "addBuilding", "editBuilding"]),
244
+      ...mapApartmentActions([
245
+        "getApartments",
246
+        "getApartmentDetail",
247
+        "addApartment",
248
+        "editApartment",
249
+        "deleteApartment"
250
+      ]),
251
+      ...mapImgActions(["uploadImg"]),
252
+      getSaleTypeName(id) {
253
+        return (this.saleType.filter(x => x.id == id)[0] || {}).name;
254
+      },
255
+      onCancel() {
256
+        this.$router.push({ name: "buildinglist" });
257
+      },
258
+      handleRemove(file, fileList) {
259
+        this.imgList = fileList;
260
+      },
261
+      handleAparmentRemove(file, fileList) {
262
+        this.aparmentImg = fileList;
263
+      },
308 264
 
309
-    },
310
-    // handleEdit(row) {
311
-    //   this.aparmentImg = [];
312
-    //   this.getApartmentDetail({
313
-    //     id: row.apartmentId
314
-    //   }).then(data => {
315
-    //     console.log("...", data);
316
-    //     this.aparmentImg = data.buildingImgList.map(x => {
317
-    //       return {
318
-    //         name: x.imgId,
319
-    //         url: x.url
320
-    //       };
321
-    //     });
322
-    //     this.aparmentInfo = data;
323
-    //     this.showHx = true;
324
-    //   });
325
-    // },
326
-    handleDel(row) {
327
-      this.$confirm("确认删除此数据?", "提示", {
328
-        confirmButtonText: "确定",
329
-        cancelButtonText: "取消",
330
-        type: "warning"
331
-      }).then(() => {
332
-        if (this.building.status === 1) {
333
-          this.$message.error("当前楼盘处于发布状态,不允许删除!");
265
+      beforeImgUpload(file) {
266
+        if (file.type !== "image/jpeg" && file.type !== "image/png") {
267
+          this.$message.error("上传图片只能是 JPG 或 PNG 格式!");
334 268
           return false;
335 269
         }
336
-        this.deleteApartment({
337
-          id: row.apartmentId
338
-        }).then(() => {
339
-          this.getAparmentList();
270
+        // if (file.size / 1024 > 300) {
271
+        //   this.$message.error('图片大小不允许超过300k!')
272
+        //   return false
273
+        // }
274
+        this.loading = this.$loading({
275
+          lock: true,
276
+          text: "上传中...",
277
+          spinner: "el-icon-loading",
278
+          background: "rgba(0, 0, 0, 0.7)"
340 279
         });
341
-      });
342
-    }
343
-  },
344
-  mounted() {
345
-    const _that = this;
346
-    const phoneEditor = new E("#websiteEditorElem");
347
-    phoneEditor.customConfig.onchange = function(html) {
348
-      _that.building = { ..._that.building, remark: html };
349
-    };
350
-    phoneEditor.customConfig.customUploadImg = function(files, insert) {
351
-      _that.uploadImg(files[0]).then(data => {
352
-        insert(data[0]);
353
-      });
354
-    };
355
-    phoneEditor.customConfig.menus = [
356
-      "head", // 标题
357
-      "bold", // 粗体
358
-      "fontSize", // 字号
359
-      "fontName", // 字体
360
-      "italic", // 斜体
361
-      "underline", // 下划线
362
-      "strikeThrough", // 删除线
363
-      "foreColor", // 文字颜色
364
-      "backColor", // 背景颜色
365
-      "justify", // 对齐方式
366
-      "image" // 插入图片
367
-    ];
368
-    phoneEditor.create();
369
-    if ((this.$route.query.id || "") !== "") {
370
-      this.getAparmentList();
371
-      window.console.log(this.getDetail);
372
-      this.getDetail({ id: this.$route.query.id }).then(data => {
373
-        this.buildingProperty = data.propertyType.split(",");
374
-        phoneEditor.txt.html(data.remark);
375
-        this.imgList = data.buildingImg.map(x => {
280
+
281
+        return true;
282
+      },
283
+      handleAvatarSuccess(res) {
284
+        this.imageUrl = res.data
285
+        this.form.image = res.data
286
+      },
287
+      handleMapImgSuccess(res) {
288
+        this.building = { ...this.building, mapImg: res.data };
289
+        this.loading.close();
290
+      },
291
+      handlePosterSuccess(res) {
292
+        this.building = { ...this.building, poster: res.data };
293
+        this.loading.close();
294
+      },
295
+      handleAparmentSuccess(res) {
296
+        this.aparmentImg = [
297
+          ...this.aparmentImg,
298
+          {
299
+            url: res.data
300
+          }
301
+        ];
302
+        this.loading.close();
303
+      },
304
+      onSubmit() {
305
+        const imgs = this.imgList.map((x, i) => {
306
+          return {
307
+            imgType: "banner",
308
+            url: x.url,
309
+            orderNo: i + 1
310
+          };
311
+        });
312
+        const tag = this.tags.map(x => {
313
+          return {
314
+            tagName: x
315
+          };
316
+        });
317
+        const building = {
318
+          ...this.building,
319
+          img: imgs,
320
+          propertyType: this.buildingProperty.join(","),
321
+          tag
322
+        };
323
+        if (!building.buildingId) {
324
+          // 新增
325
+          this.addBuilding({
326
+            onSuccess: this.onCancel,
327
+            detail: JSON.stringify(building)
328
+          });
329
+        } else {
330
+          // 修改
331
+          this.editBuilding({
332
+            onSuccess: this.onCancel,
333
+            detail: JSON.stringify(building)
334
+          });
335
+        }
336
+      },
337
+      FormatDate(date) {
338
+        return (date || "").split("T")[0] === "0001-01-01"
339
+                ? ""
340
+                : (date || "").split("T")[0];
341
+      },
342
+      saveAparment() {
343
+        const imgs = this.aparmentImg.map((x, i) => {
376 344
           return {
377
-            name: x.imgId,
378
-            url: x.url
345
+            imgType: "aparment",
346
+            url: x.url,
347
+            orderNo: i + 1
379 348
           };
380 349
         });
381
-        this.tags = data.buildingTag.map(x => x.tagName);
382
-      });
383
-    } else {
384
-      phoneEditor.txt.html("");
350
+        if (!this.aparmentInfo.apartmentId) {
351
+          this.addApartment(
352
+                  JSON.stringify({
353
+                    ...this.aparmentInfo,
354
+                    img: imgs
355
+                  })
356
+          ).then(() => {
357
+            this.getAparmentList();
358
+            this.showHx = false;
359
+          });
360
+        } else {
361
+          this.editApartment(
362
+                  JSON.stringify({
363
+                    ...this.aparmentInfo,
364
+                    img: imgs
365
+                  })
366
+          ).then(() => {
367
+            this.getAparmentList();
368
+            this.showHx = false;
369
+          });
370
+        }
371
+      },
372
+      addHx() {
373
+        this.aparmentImg = [];
374
+        this.aparmentInfo = { buildingId: this.building.buildingId };
375
+        this.showHx = true;
376
+      },
377
+      getAparmentList() {
378
+        this.getApartments({ buildingId: this.$route.query.id }).then(data => {
379
+          this.aparments = data;
380
+        });
381
+      },
382
+      handleEdit(row){
383
+        this.showPlace = row.name
384
+        this.popover4 = false
385
+
386
+
387
+      },
388
+      // handleEdit(row) {
389
+      //   this.aparmentImg = [];
390
+      //   this.getApartmentDetail({
391
+      //     id: row.apartmentId
392
+      //   }).then(data => {
393
+      //     console.log("...", data);
394
+      //     this.aparmentImg = data.buildingImgList.map(x => {
395
+      //       return {
396
+      //         name: x.imgId,
397
+      //         url: x.url
398
+      //       };
399
+      //     });
400
+      //     this.aparmentInfo = data;
401
+      //     this.showHx = true;
402
+      //   });
403
+      // },
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);
439
+        });
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
+
471
+    },
472
+    created() {
473
+      this.form.contentId = this.$route.query.id
474
+      if (this.$route.query.id !== undefined) {
475
+        this.getExtendContentById()
476
+      }
477
+      this.getBuildList()
385 478
     }
386
-  }
387
-};
479
+  };
388 480
 </script>
389 481
 
390 482
 <style lang="scss">
391
-.header {
392
-  width: 50px;
393
-  height: 50px;
394
-  img {
395
-    width: 100%;
396
-    height: 100%;
483
+  .header {
484
+    width: 50px;
485
+    height: 50px;
486
+    img {
487
+      width: 100%;
488
+      height: 100%;
489
+    }
397 490
   }
398
-}
399
-.avatar-uploader .el-upload {
400
-  border: 1px dashed #d9d9d9;
401
-  border-radius: 6px;
402
-  cursor: pointer;
403
-  position: relative;
404
-  overflow: hidden;
405
-}
406
-.avatar-uploader .el-upload:hover {
407
-  border-color: #409eff;
408
-}
409
-.avatar-uploader-icon {
410
-  font-size: 28px;
411
-  color: #8c939d;
412
-  width: 178px;
413
-  height: 178px;
414
-  line-height: 178px;
415
-  text-align: center;
416
-}
417
-.avatar {
418
-  width: 178px;
419
-  height: 178px;
420
-  display: block;
421
-}
422
-.edit-carousel {
423
-  .el-select {
424
-    max-width: 300px !important;
491
+  .avatar-uploader .el-upload {
492
+    border: 1px dashed #d9d9d9;
493
+    border-radius: 6px;
494
+    cursor: pointer;
495
+    position: relative;
496
+    overflow: hidden;
425 497
   }
426
-  .el-input {
427
-    max-width: 400px;
498
+  .avatar-uploader .el-upload:hover {
499
+    border-color: #409eff;
428 500
   }
429
-  .publish {
430
-    p {
431
-      margin: 0;
432
-      font-size: 15.4px;
433
-      .choose {
434
-        color: blue;
435
-        margin-left: 15px;
501
+  .avatar-uploader-icon {
502
+    font-size: 28px;
503
+    color: #8c939d;
504
+    width: 178px;
505
+    height: 178px;
506
+    line-height: 178px;
507
+    text-align: center;
508
+  }
509
+  .avatar {
510
+    width: 178px;
511
+    height: 178px;
512
+    display: block;
513
+  }
514
+  .edit-carousel {
515
+    .el-select {
516
+      max-width: 300px !important;
517
+    }
518
+    .el-input {
519
+      max-width: 400px;
520
+    }
521
+    .publish {
522
+      p {
523
+        margin: 0;
524
+        font-size: 15.4px;
525
+        .choose {
526
+          color: blue;
527
+          margin-left: 15px;
528
+        }
436 529
       }
437 530
     }
438 531
   }
439
-}
440
-.el-popover {
441
-  z-index: 10004 !important;
442
-  .el-table .cell{
443
-    text-align: center;
532
+  .el-popover {
533
+    z-index: 10004 !important;
534
+    .el-table .cell{
535
+      text-align: center;
536
+    }
444 537
   }
445
-}
446 538
 
447
-.el-select-dropdown {
448
-  z-index: 10003 !important;
449
-}
539
+  .el-select-dropdown {
540
+    z-index: 10003 !important;
541
+  }
450 542
 
451
-.el-date-picker {
452
-  z-index: 10002 !important;
453
-}
543
+  .el-date-picker {
544
+    z-index: 10002 !important;
545
+  }
454 546
 </style>

+ 3
- 2
src/views/carouselFigure/list.vue Visa fil

@@ -34,7 +34,7 @@
34 34
       <el-table-column
35 35
         prop="showType"
36 36
         label="类型">
37
-        <template slot-scope="scope">{{ scope.row.showType === 'banner' ? '轮播图' : '' }}</template>
37
+        <template slot-scope="scope">{{ scope.row.showType === 'banner' ? '轮播图' : scope.row.showType === 'screen' ? '开屏' : '' }}</template>
38 38
       </el-table-column>
39 39
       <el-table-column
40 40
         prop="showPosition"
@@ -131,7 +131,8 @@ export default {
131 131
       this.getExtendContent({
132 132
         pageNum: this.currentPage,
133 133
         pageSize: this.pageSize,
134
-        buildingId: this.buildingId
134
+        buildingId: this.buildingId,
135
+        showType: 'banner'
135 136
       });
136 137
     },
137 138
     getBuildingName(id) {