zxl
15 小时以前 172933f098017bc4c4f57dcda0d490ea12bb13bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
<template>
  <div class="model-item" v-if="element && element.key">
    <!-- 轮播图模块,包括个人信息,快捷导航模块 -->
    <template v-if="element.type == 'carousel'">
      <model-carousel :data="element"></model-carousel>
    </template>
    <!-- 轮播图模块,100%宽度,无个人信息栏 -->
    <template v-if="element.type == 'carousel1'">
      <model-carousel1 class="mb_20" :data="element"></model-carousel1>
    </template>
    <!-- 轮播图模块,包括个人信息,两个轮播模块 -->
    <template v-if="element.type == 'carousel2'">
      <model-carousel2 class="mb_20" :data="element"></model-carousel2>
    </template>
    <!-- 热门广告 -->
    <template v-if="element.type == 'hotAdvert'">
      <div class="setup-content">
        <img
          style="display: block"
          :src="element.options.list[0].img"
          @click="$router.push(element.options.list[0].url)"
          width="1200"
          alt=""
        />
        <div class="setup-box">
          <div>
            <Button
              size="small"
              @click.stop="handleSelectModel(element.options.list[0])"
              >编辑</Button
            >
          </div>
        </div>
      </div>
      <ul class="advert-list">
        <template v-for="(item, index) in element.options.list">
          <li
            v-if="index !== 0"
            @click="$router.push(item.url)"
            class="setup-content"
            :key="index"
          >
            <img :src="item.img" width="230" height="190" alt="" />
            <div class="setup-box">
              <div>
                <Button size="small" @click.stop="handleSelectModel(item)"
                  >编辑</Button
                >
              </div>
            </div>
          </li>
        </template>
      </ul>
    </template>
    <!-- 限时秒杀 待完善 -->
    <template v-if="element.type == 'seckill'">
      <seckill :data="element"></seckill>
    </template>
    <!-- 折扣广告 -->
    <template v-if="element.type == 'discountAdvert'">
      <div
        class="discountAdvert"
        :style="{
          'background-image':
            'url(' + require('@/assets/nav/decorate.png') + ')',
        }"
      >
        <div>
          <div
            v-for="(item, index) in element.options.classification"
            :key="index"
            class="setup-content"
          >
            <img :src="item.img" width="190" height="210" alt="" />
            <div class="setup-box">
              <div>
                <Button size="small" @click.stop="handleSelectModel(item)"
                  >编辑</Button
                >
              </div>
            </div>
          </div>
        </div>
        <div>
          <div
            v-for="(item, index) in element.options.brandList"
            :key="index"
            class="setup-content"
          >
            <img :src="item.img" width="240" height="105" alt="" />
            <div class="setup-box">
              <div>
                <Button size="small" @click.stop="handleSelectModel(item)"
                  >编辑</Button
                >
              </div>
            </div>
          </div>
        </div>
      </div>
    </template>
    <!-- 好货推荐 -->
    <template v-if="element.type == 'recommend'">
      <recommend :data="element"></recommend>
    </template>
    <!-- 新品排行 -->
    <template v-if="element.type == 'newGoodsSort'">
      <new-goods-sort :data="element"></new-goods-sort>
    </template>
    <!-- 首页广告 -->
    <template v-if="element.type == 'firstAdvert'">
      <first-page-advert :data="element"></first-page-advert>
    </template>
    <!-- 横幅广告 -->
    <template v-if="element.type == 'bannerAdvert'">
      <div class="horizontal-advert setup-content">
        <img
          v-if="element.options.img"
          width="1200"
          :src="element.options.img"
          alt=""
        />
        <div v-else class="default-con">
          <p>广告图片</p>
          <p>1200*自定义</p>
        </div>
        <div class="setup-box">
          <div>
            <Button
              size="small"
              @click.stop="handleSelectModel(element.options)"
              >编辑</Button
            >
          </div>
        </div>
      </div>
    </template>
    <template v-if="element.type == 'notEnough'">
      <not-enough :data="element"></not-enough>
    </template>
    <div class="del-btn">
      <Button size="small" type="error" @click="handleModelDelete">删除</Button>
    </div>
    <Modal
      v-model="showModal"
      title="装修"
      draggable
      width="800"
      :z-index="100"
      :mask-closable="false"
    >
      <div class="modal-top-advert">
        <div>
          <!-- 热门广告两种图片尺寸 -->
          <img
            class="show-image"
            width="600"
            height="40"
            v-if="selected.size && selected.size.indexOf('1200') >= 0"
            :src="selected.img"
            alt
          />
          <img
            class="show-image"
            width="230"
            height="190"
            v-if="selected.size && selected.size.indexOf('230*190') >= 0"
            :src="selected.img"
            alt
          />
          <!-- 折扣广告三种图片尺寸 -->
          <img
            class="show-image"
            width="600"
            height="300"
            v-if="selected.size && selected.size.indexOf('1300') >= 0"
            :src="selected.img"
            alt
          />
          <img
            class="show-image"
            width="190"
            height="210"
            v-if="selected.size && selected.size.indexOf('190*210') >= 0"
            :src="selected.img"
            alt
          />
          <img
            class="show-image"
            width="240"
            height="105"
            v-if="selected.size && selected.size.indexOf('240*105') >= 0"
            :src="selected.img"
            alt
          />
        </div>
        <div class="tips">
          建议尺寸:<span>{{ selected.size }}</span>
        </div>
        <div>
          图片链接:<span>{{ selected.url }}</span>
          <Button size="small" type="primary" @click="handleSelectLink"
            >选择链接</Button
          >
        </div>
        <div>
          选择图片:<Button size="small" type="primary" @click="handleSelectImg">选择图片</Button>&nbsp;
        </div>
      </div>
    </Modal>
    <!-- 选择商品。链接 -->
    <liliDialog
      ref="liliDialog"
      @selectedLink="selectedLink"
  
    ></liliDialog>
    <!-- 选择图片 -->
    <Modal width="1200px" v-model="picModelFlag" footer-hide>
      <ossManage @callback="callbackSelected" :isComponent="true" :initialize="picModelFlag" ref="ossManage"/>
    </Modal>
  </div>
</template>
 
<script>
import ModelCarousel from "./modelList/carousel.vue";
import ModelCarousel1 from './modelList/carousel1.vue';
import ModelCarousel2 from './modelList/carousel2.vue';
import FirstPageAdvert from "./modelList/firstPageAdvert.vue";
import NewGoodsSort from "./modelList/newGoodsSort.vue";
import Recommend from "./modelList/recommend.vue";
import NotEnough from "./modelList/notEnough.vue";
import Seckill from "./modelList/seckill.vue";
// import ossManage from "@/views/sys/oss-manage/ossManage";
import ossManage from "@/views/shop/ossManages";
 
export default {
  name: "modelFormItem",
  props: ["element", "select", "index", "data"],
  components: {
    ModelCarousel,
    ModelCarousel1,
    ModelCarousel2,
    Recommend,
    NewGoodsSort,
    FirstPageAdvert,
    NotEnough,
    Seckill,
    ossManage,
  },
  data() {
    return {
      showModal: false, // modal显隐
      selected: {}, // 已选数据
      picModelFlag: false, // 图片选择器
    };
  },
  methods: {
    // 编辑模块
    handleSelectModel(item) {
      this.selected = item;
      this.showModal = true;
    },
    // 删除模块
    handleModelDelete() {
      this.$Modal.confirm({
        title: "提示",
        content: "<p>确定删除当前模块吗?</p>",
        onOk: () => {
          this.$nextTick(() => {
            this.data.list.splice(this.index, 1);
          });
        },
      });
    },
    handleSelectLink(item, index) {
      // 调起选择链接弹窗
      this.$refs.liliDialog.open("link");
    },
    // 确定选择链接
    selectedLink(val) {
      this.selected.url = this.$options.filters.formatLinkType(val);
    },
    
    handleSelectImg() {
      // 选择图片
      this.$refs.ossManage.selectImage = true;
      this.picModelFlag = true;
    },
    // 回显图片
    callbackSelected(val) {
      this.picModelFlag = false;
      this.selected.img = val.url;
    },
  },
};
</script>
<style lang="scss" scoped>
@import "./modelList/setup-box.scss";
.model-item {
  position: relative;
  margin-bottom: 20px;
  &:hover {
    .del-btn {
      display: block;
    }
  }
}
.del-btn {
  width: 100px;
  height: 100px;
  display: none;
  position: absolute;
  right: -100px;
  top: 0;
  &:hover {
    display: block;
  }
}
/** 横幅广告 */
.horizontal-advert {
  width: 1200px;
  height: auto;
  .default-con {
    height: 100px;
    padding-top: 30px;
    text-align: center;
    background: #ddd;
  }
}
/** 热门广告 */
.advert-list {
  background: $theme_color;
  height: 200px;
  display: flex;
  justify-content: space-around;
  padding: 3px 10px;
  > li {
    img {
      cursor: pointer;
      border-radius: 10px;
      transition: all 150ms ease-in-out;
      &:hover {
        transform: translateY(-3px);
        box-shadow: rgba(0, 0, 0, 0.4) 0px 5px 20px 0px;
      }
    }
  }
}
/** 限时秒杀 */
.limit-img {
  display: flex;
  flex-direction: row;
  img {
    width: 300px;
    height: 100px;
  }
}
/** 折扣广告 */
.discountAdvert {
  height: 566px;
  background-repeat: no-repeat;
  margin-left: -97px;
  position: relative;
  > div {
    padding-left: 295px;
    display: flex;
    flex-wrap: wrap;
    &:nth-child(1) img {
      margin: 10px 10px 0 0;
    }
    &:nth-child(2) img {
      margin: 0 10px 0 0;
    }
  }
}
/** 首页品牌 */
.brand {
  .brand-view {
    display: flex;
    margin-top: 10px;
    .brand-view-content {
      width: 470px;
      margin-left: 10px;
      img {
        width: 100%;
        height: 316px;
      }
      .brand-view-title {
        height: 50px;
        padding: 0 5px;
        display: flex;
        align-items: center;
        justify-content: space-between;
      }
    }
    .brand-view-content:first-child {
      width: 240px;
      margin-left: 0;
    }
  }
  .brand-list {
    margin-top: 10px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    li {
      width: 121px;
      height: 112px;
      position: relative;
      overflow: hidden;
      border: 1px solid #f5f5f5;
      margin: -1px -1px 0 0;
      &:hover {
        .brand-mash {
          display: flex;
        }
      }
      .brand-img {
        text-align: center;
        margin-top: 30px;
        img {
          width: 100px;
          height: auto;
        }
      }
      .brand-mash {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        background: rgba(0, 0, 0, 0.5);
        width: inherit;
        height: inherit;
        font-size: 12px;
        font-weight: bold;
        .ivu-icon {
          position: absolute;
          right: 10px;
          top: 10px;
          font-size: 15px;
        }
        align-items: center;
        justify-content: center;
        flex-direction: column;
        color: #fff;
        cursor: pointer;
        div:last-child {
          background-color: $theme_color;
          border-radius: 9px;
          padding: 0 10px;
          margin-top: 5px;
        }
      }
    }
    .refresh {
      display: flex;
      align-items: center;
      flex-direction: column;
      justify-content: center;
      .ivu-icon {
        font-size: 18px;
        transition: all 0.3s ease-out;
      }
      &:hover {
        background-color: $theme_color;
        color: #fff;
        .ivu-icon {
          transform: rotateZ(360deg);
        }
      }
    }
  }
}
 
/** 装修模态框 内部样式start */
.modal-top-advert {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  > * {
    margin-bottom: 10px;
  }
}
</style>