|
@@ -1,88 +1,96 @@
|
1
|
1
|
<template>
|
2
|
|
- <div style="background:#fff;">
|
3
|
|
- <div v-if="isLoading || windowLoad" class="loading">
|
4
|
|
- <img :src="loading" alt>
|
5
|
|
- <span>{{msg}}</span>
|
6
|
|
- </div>
|
7
|
|
- <div class="cutBox" v-for="(item,index) in banner" :key="index">
|
8
|
|
- <div class="cutDom" v-if="index === mainIndex-1">
|
9
|
|
- <img :src="item.bgImg" class="cover">
|
10
|
|
- <div :style="item.styleCut" v-if="!item.CustomerImg && item.defaultBg" class="cla">
|
11
|
|
- <img :src="item.defaultBg">
|
12
|
|
- </div>
|
13
|
|
- <div :style="item.styleCut" v-if="item.CustomerImg" class="cla">
|
14
|
|
- <img :src="item.CustomerImg">
|
|
2
|
+ <div style="background:#fff;" class="mainPage" id="main">
|
|
3
|
+ <div>
|
|
4
|
+ <div v-if="isLoading || windowLoad" class="loading">
|
|
5
|
+ <img :src="loading" alt>
|
|
6
|
+ <span>{{msg}}</span>
|
|
7
|
+ </div>
|
|
8
|
+ <div class="cutBox" v-for="(item,index) in banner" :key="index">
|
|
9
|
+ <div class="cutDom" v-if="index === mainIndex-1">
|
|
10
|
+ <img :src="item.bgImg" class="cover">
|
|
11
|
+ <div :style="item.styleCut" v-show="!item.CustomerImg && item.defaultBg" class="cla">
|
|
12
|
+ <img :src="item.defaultBg">
|
|
13
|
+ </div>
|
|
14
|
+ <div :style="item.styleCut" v-if="item.CustomerImg" class="cla">
|
|
15
|
+ <img :src="item.CustomerImg">
|
|
16
|
+ </div>
|
|
17
|
+ <img class="text-h" v-if="item.ImgName === '10月'" :src="textH">
|
|
18
|
+ <img class="text-l" v-if="item.ImgName === '4月' || item.ImgName === '7月'" :src="textL">
|
15
|
19
|
</div>
|
16
|
|
- <img class="text-h" v-if="item.ImgName === '10月'" :src="textH">
|
17
|
|
- <img class="text-l" v-if="item.ImgName === '4月' || item.ImgName === '7月'" :src="textL">
|
18
|
20
|
</div>
|
19
|
|
- </div>
|
20
|
|
- <div class="topBanner">
|
21
|
|
- <swiper :options="swiperOption" ref="mySwiper">
|
22
|
|
- <swiper-slide class="swiper-slide" v-for="(item,index) in banner" :key="index">
|
23
|
|
- <div
|
24
|
|
- class="item"
|
25
|
|
- v-if="index === mainIndex-1 || index === mainIndex || index === mainIndex-2"
|
26
|
|
- >
|
27
|
|
- <div>
|
28
|
|
- <img :src="item.bgImg" class="cover">
|
29
|
|
- <img
|
30
|
|
- :style="item.style"
|
31
|
|
- v-if="!item.CustomerImg && item.defaultBg"
|
32
|
|
- :src="item.defaultBg"
|
33
|
|
- >
|
34
|
|
- <img :src="item.CustomerImg" :style="item.style" v-if="item.CustomerImg">
|
35
|
|
- <img class="text-h" v-if="item.ImgName === '10月'" :src="textH">
|
36
|
|
- <img
|
37
|
|
- class="text-l"
|
38
|
|
- v-if="item.ImgName === '4月' || item.ImgName === '7月'"
|
39
|
|
- :src="textL"
|
40
|
|
- >
|
41
|
|
- <div class="reload-img">
|
42
|
|
- <van-uploader :after-read="onRead" v-show="mainIndex !== 1">
|
43
|
|
- <img :src="reloadImg">
|
44
|
|
- </van-uploader>
|
|
21
|
+ <div class="topBanner">
|
|
22
|
+ <swiper :options="swiperOption" ref="mySwiper">
|
|
23
|
+ <swiper-slide class="swiper-slide" v-for="(item,index) in banner" :key="index">
|
|
24
|
+ <div
|
|
25
|
+ class="item"
|
|
26
|
+ v-if="index === mainIndex-1 || index === mainIndex || index === mainIndex-2"
|
|
27
|
+ >
|
|
28
|
+ <div>
|
|
29
|
+ <img :src="item.bgImg" class="cover">
|
|
30
|
+ <img
|
|
31
|
+ :style="item.style"
|
|
32
|
+ v-if="!item.CustomerImg && item.defaultBg"
|
|
33
|
+ :src="item.defaultBg"
|
|
34
|
+ >
|
|
35
|
+ <img :src="item.CustomerImg" :style="item.style" v-if="item.CustomerImg">
|
|
36
|
+ <img class="text-h" v-if="item.ImgName === '10月'" :src="textH">
|
|
37
|
+ <img
|
|
38
|
+ class="text-l"
|
|
39
|
+ v-if="item.ImgName === '4月' || item.ImgName === '7月'"
|
|
40
|
+ :src="textL"
|
|
41
|
+ >
|
|
42
|
+ <div class="reload-img">
|
|
43
|
+ <van-uploader :after-read="onRead" v-show="mainIndex !== 1">
|
|
44
|
+ <img :src="reloadImg">
|
|
45
|
+ </van-uploader>
|
|
46
|
+ </div>
|
45
|
47
|
</div>
|
46
|
48
|
</div>
|
47
|
|
- </div>
|
48
|
|
- </swiper-slide>
|
49
|
|
- </swiper>
|
50
|
|
- <div class="swiper-button-next">
|
51
|
|
- <i class="iconfont icon-you"></i>
|
|
49
|
+ </swiper-slide>
|
|
50
|
+ </swiper>
|
|
51
|
+ <div class="swiper-button-next">
|
|
52
|
+ <i class="iconfont icon-you"></i>
|
|
53
|
+ </div>
|
|
54
|
+ <div class="swiper-button-prev">
|
|
55
|
+ <i class="iconfont icon-left"></i>
|
|
56
|
+ </div>
|
|
57
|
+ <div class="swiper-pagination"></div>
|
52
|
58
|
</div>
|
53
|
|
- <div class="swiper-button-prev">
|
54
|
|
- <i class="iconfont icon-left"></i>
|
|
59
|
+ <div class="meassage" v-if="mainIndex !== 1">备注:为了美观效果请上传{{size}}尺寸照片,未按尺寸会默认裁剪</div>
|
|
60
|
+ <div class="meassage" v-else> </div>
|
|
61
|
+ <div class="operation">
|
|
62
|
+ <div>
|
|
63
|
+ <van-uploader :after-read="onRead" v-show="mainIndex !== 1">
|
|
64
|
+ <img :src="uploadImg">
|
|
65
|
+ <p>自定义图片</p>
|
|
66
|
+ </van-uploader>
|
|
67
|
+ </div>
|
|
68
|
+ <div>
|
|
69
|
+ <img :src="reSet" v-show="mainIndex !== 1" @click="changeOld">
|
|
70
|
+ <p v-show="mainIndex !== 1">恢复默认</p>
|
|
71
|
+ </div>
|
55
|
72
|
</div>
|
56
|
|
- <div class="swiper-pagination"></div>
|
57
|
|
- </div>
|
58
|
|
- <div class="meassage" v-if="mainIndex !== 1">备注:为了美观效果请上传{{size}}尺寸照片,未按尺寸会默认裁剪</div>
|
59
|
|
- <div class="meassage" v-else> </div>
|
60
|
|
- <div class="operation">
|
61
|
|
- <div>
|
62
|
|
- <van-uploader :after-read="onRead" v-show="mainIndex !== 1">
|
63
|
|
- <img :src="uploadImg">
|
64
|
|
- <p>自定义图片</p>
|
65
|
|
- </van-uploader>
|
|
73
|
+ <div class="email">
|
|
74
|
+ <span>邮箱</span>
|
|
75
|
+ <input
|
|
76
|
+ class="input"
|
|
77
|
+ type="text"
|
|
78
|
+ placeholder="接收电子版"
|
|
79
|
+ v-model="email"
|
|
80
|
+ style="border-radius:5px;background:rgba(245, 246, 250, 1);"
|
|
81
|
+ >
|
66
|
82
|
</div>
|
67
|
|
- <div>
|
68
|
|
- <img :src="reSet" v-show="mainIndex !== 1" @click="changeOld">
|
69
|
|
- <p v-show="mainIndex !== 1">恢复默认</p>
|
|
83
|
+ <div class="btn">
|
|
84
|
+ <div @click="pre">预览</div>
|
|
85
|
+ <div @click="showPop=true">确定</div>
|
70
|
86
|
</div>
|
71
|
|
- </div>
|
72
|
|
- <div class="email">
|
73
|
|
- <span>邮箱</span>
|
74
|
|
- <van-field v-model="email" placeholder="接收电子版" style="border-radius:5px;"/>
|
75
|
|
- </div>
|
76
|
|
- <div class="btn">
|
77
|
|
- <div @click="pre">预览</div>
|
78
|
|
- <div @click="showPop=true">确定</div>
|
79
|
|
- </div>
|
80
|
|
- <div v-show="showPop" class="pop-box">
|
81
|
|
- <div class="pop-content">
|
82
|
|
- <div>确认定制此台历?</div>
|
83
|
|
- <div>
|
84
|
|
- <div @click="submit">确定</div>
|
85
|
|
- <div @click="showPop=false">取消</div>
|
|
87
|
+ <div v-show="showPop" class="pop-box">
|
|
88
|
+ <div class="pop-content">
|
|
89
|
+ <div>确认定制此台历?</div>
|
|
90
|
+ <div>
|
|
91
|
+ <div @click="submit">确定</div>
|
|
92
|
+ <div @click="showPop=false">取消</div>
|
|
93
|
+ </div>
|
86
|
94
|
</div>
|
87
|
95
|
</div>
|
88
|
96
|
</div>
|
|
@@ -138,8 +146,7 @@ export default {
|
138
|
146
|
})
|
139
|
147
|
}
|
140
|
148
|
}
|
141
|
|
- },
|
142
|
|
- email: ''
|
|
149
|
+ }
|
143
|
150
|
}
|
144
|
151
|
},
|
145
|
152
|
components: {
|
|
@@ -152,7 +159,8 @@ export default {
|
152
|
159
|
},
|
153
|
160
|
...mapMakingState({
|
154
|
161
|
bannerBlack: item => item.bannerBlack,
|
155
|
|
- bannerRed: item => item.bannerRed
|
|
162
|
+ bannerRed: item => item.bannerRed,
|
|
163
|
+ Email: item => item.email
|
156
|
164
|
}),
|
157
|
165
|
size () {
|
158
|
166
|
if (this.mainIndex === 2 || this.mainIndex === 5 || this.mainIndex === 8 || this.mainIndex === 11) {
|
|
@@ -160,6 +168,14 @@ export default {
|
160
|
168
|
} else {
|
161
|
169
|
return '竖'
|
162
|
170
|
}
|
|
171
|
+ },
|
|
172
|
+ email: {
|
|
173
|
+ get () {
|
|
174
|
+ return this.Email
|
|
175
|
+ },
|
|
176
|
+ set (val) {
|
|
177
|
+ this.setEmail(val)
|
|
178
|
+ }
|
163
|
179
|
}
|
164
|
180
|
},
|
165
|
181
|
created () {
|
|
@@ -170,27 +186,24 @@ export default {
|
170
|
186
|
}
|
171
|
187
|
},
|
172
|
188
|
methods: {
|
173
|
|
- ...mapMakingActions(['setBanner', 'calendar']),
|
|
189
|
+ ...mapMakingActions(['setBanner', 'calendar', 'setEmail']),
|
174
|
190
|
upload (url) {
|
175
|
191
|
this.banner[this.mainIndex - 1].CustomerImg = url
|
176
|
192
|
this.setBanner({ type: this.$route.query.type, data: JSON.parse(JSON.stringify(this.banner)) }).then(() => {
|
177
|
|
- this.$nextTick(() => {
|
178
|
|
- this.calSize().then(() => {
|
179
|
|
- let cutDoms = document.getElementsByClassName('cutDom')[0]
|
180
|
|
- let that = this
|
181
|
|
- cutDoms.onload = function () {
|
182
|
|
- that.convert2canvas(cutDoms, that.mainIndex - 1).then(() => {
|
183
|
|
- that.isLoading = false
|
184
|
|
- }).catch(() => {
|
185
|
|
- that.isLoading = false
|
186
|
|
- })
|
187
|
|
- }
|
|
193
|
+ this.calSize().then(() => {
|
|
194
|
+ let cutDoms = document.getElementsByClassName('cutDom')[0]
|
|
195
|
+ this.convert2canvas(cutDoms, this.mainIndex - 1).then(() => {
|
|
196
|
+ this.isLoading = false
|
|
197
|
+ }).catch(() => {
|
|
198
|
+ this.isLoading = false
|
188
|
199
|
})
|
189
|
200
|
})
|
190
|
201
|
})
|
191
|
202
|
},
|
192
|
203
|
onRead (file) {
|
193
|
204
|
this.isLoading = true
|
|
205
|
+ // this.banner[this.mainIndex - 1].CustomerImgShow = file.content
|
|
206
|
+ // this.setBanner({ type: this.$route.query.type, data: JSON.parse(JSON.stringify(this.banner)) })
|
194
|
207
|
this.toolClass.upload(file).then((res) => {
|
195
|
208
|
this.upload(res.result.url)
|
196
|
209
|
}).catch(() => {
|
|
@@ -198,20 +211,21 @@ export default {
|
198
|
211
|
})
|
199
|
212
|
},
|
200
|
213
|
changeOld () {
|
|
214
|
+ if (!this.banner[this.mainIndex - 1].CustomerImg) {
|
|
215
|
+ return
|
|
216
|
+ }
|
201
|
217
|
this.isLoading = true
|
202
|
218
|
this.banner[this.mainIndex - 1].CustomerImg = ''
|
|
219
|
+ // this.banner[this.mainIndex - 1].CustomerImgShow = ''
|
203
|
220
|
this.setBanner({ type: this.$route.query.type, data: JSON.parse(JSON.stringify(this.banner)) }).then(() => {
|
204
|
221
|
this.$nextTick(() => {
|
205
|
222
|
this.calSize().then(() => {
|
206
|
223
|
let cutDoms = document.getElementsByClassName('cutDom')[0]
|
207
|
|
- const that = this
|
208
|
|
- cutDoms.onload = function () {
|
209
|
|
- that.convert2canvas(cutDoms, that.mainIndex - 1).then(() => {
|
210
|
|
- that.isLoading = false
|
211
|
|
- }).catch(() => {
|
212
|
|
- that.isLoading = false
|
213
|
|
- })
|
214
|
|
- }
|
|
224
|
+ this.convert2canvas(cutDoms, this.mainIndex - 1).then(() => {
|
|
225
|
+ this.isLoading = false
|
|
226
|
+ }).catch(() => {
|
|
227
|
+ this.isLoading = false
|
|
228
|
+ })
|
215
|
229
|
})
|
216
|
230
|
})
|
217
|
231
|
})
|
|
@@ -235,6 +249,7 @@ export default {
|
235
|
249
|
curr.CustomerImg = curr.defaultNoUser
|
236
|
250
|
}
|
237
|
251
|
delete curr['defaultNoUser']
|
|
252
|
+ delete curr['CustomerImgShow']
|
238
|
253
|
});
|
239
|
254
|
let submitData = {
|
240
|
255
|
ModelName: this.$route.query.type == 1 ? '黑色' : '红色',
|
|
@@ -335,24 +350,39 @@ export default {
|
335
|
350
|
calSize () {
|
336
|
351
|
return new Promise((resolve) => {
|
337
|
352
|
let rotate = this.size
|
338
|
|
- let dom = document.getElementsByClassName('cla')[0]
|
|
353
|
+ let dom = document.getElementsByClassName('cla')
|
|
354
|
+ if (dom.length < 2) {
|
|
355
|
+ resolve()
|
|
356
|
+ return
|
|
357
|
+ }
|
|
358
|
+ dom = dom[1]
|
|
359
|
+ let parentW = dom.offsetWidth
|
|
360
|
+ let parentH = dom.offsetHeight
|
339
|
361
|
dom.children[0].onload = function () {
|
340
|
362
|
let imgW = dom.children[0].naturalWidth
|
341
|
363
|
let imgH = dom.children[0].naturalHeight
|
342
|
364
|
if (rotate === '横') {
|
343
|
365
|
if (imgW <= imgH) {
|
344
|
|
- dom.children[0].style = 'width:100%;position:absolute;left:0;top:50%;transform:translateY(-50%);'
|
|
366
|
+ dom.children[0].style = 'width:100%;'
|
|
367
|
+ let Offset = -((dom.children[0].height - parentH) / 2)
|
|
368
|
+ dom.children[0].style = `width:100%;position:relative;top:${Offset}px;left:0`
|
345
|
369
|
resolve()
|
346
|
370
|
} else {
|
347
|
|
- dom.children[0].style = 'height:100%;position:absolute;top:0;left:50%;transform:translateX(-50%);'
|
|
371
|
+ dom.children[0].style = 'height:100%;'
|
|
372
|
+ let Offset = -((dom.children[0].width - parentW) / 2)
|
|
373
|
+ dom.children[0].style = `height:100%;position:relative;left:${Offset}px;top:0`
|
348
|
374
|
resolve()
|
349
|
375
|
}
|
350
|
376
|
} else {
|
351
|
377
|
if (imgW >= imgH) {
|
352
|
|
- dom.children[0].style = 'height:100%;position:absolute;top:0;left:50%;transform:translateX(-50%);'
|
|
378
|
+ dom.children[0].style = 'height:100%;'
|
|
379
|
+ let Offset = -((dom.children[0].width - parentW) / 2)
|
|
380
|
+ dom.children[0].style = `height:100%;position:relative;left:${Offset}px;top:0`
|
353
|
381
|
resolve()
|
354
|
382
|
} else {
|
355
|
|
- dom.children[0].style = 'width:100%;position:absolute;left:0;top:50%;transform:translateY(-50%);'
|
|
383
|
+ dom.children[0].style = 'width:100%;'
|
|
384
|
+ let Offset = -((dom.children[0].height - parentH) / 2)
|
|
385
|
+ dom.children[0].style = `width:100%;position:relative;top:${Offset}px;left:0`
|
356
|
386
|
resolve()
|
357
|
387
|
}
|
358
|
388
|
}
|
|
@@ -371,9 +401,19 @@ export default {
|
371
|
401
|
|
372
|
402
|
|
373
|
403
|
<style lang="scss" scoped>
|
|
404
|
+.input {
|
|
405
|
+ border-radius: 5px;
|
|
406
|
+ background: rgb(245, 246, 250);
|
|
407
|
+ width: 100%;
|
|
408
|
+ height: 0.4rem;
|
|
409
|
+ padding-left: 0.1rem;
|
|
410
|
+}
|
|
411
|
+.mainPage {
|
|
412
|
+ position: fixed;
|
|
413
|
+ overflow-y: scroll;
|
|
414
|
+}
|
374
|
415
|
.cla {
|
375
|
416
|
overflow: hidden;
|
376
|
|
- position: relative;
|
377
|
417
|
z-index: 10;
|
378
|
418
|
}
|
379
|
419
|
.loading {
|
|
@@ -406,7 +446,7 @@ export default {
|
406
|
446
|
.pop-box {
|
407
|
447
|
width: 100%;
|
408
|
448
|
height: 100%;
|
409
|
|
- position: absolute;
|
|
449
|
+ position: fixed;
|
410
|
450
|
left: 0;
|
411
|
451
|
top: 0;
|
412
|
452
|
display: flex;
|
|
@@ -564,9 +604,9 @@ export default {
|
564
|
604
|
align-items: center;
|
565
|
605
|
padding: 0.15rem 0.2rem 0.3rem;
|
566
|
606
|
> div {
|
567
|
|
- flex: 1;
|
568
|
607
|
text-align: center;
|
569
|
608
|
height: 0.68rem;
|
|
609
|
+ margin: 0 0.4rem;
|
570
|
610
|
img {
|
571
|
611
|
width: 0.68rem;
|
572
|
612
|
height: 0.68rem;
|