|
@@ -23,6 +23,11 @@
|
23
|
23
|
<img v-if="row.hpath" :src="$api.showImageUrl + row.hpath" />
|
24
|
24
|
</div>
|
25
|
25
|
</template>
|
|
26
|
+ <template slot-scope="{ row }" slot="vpath">
|
|
27
|
+ <div class="hpath">
|
|
28
|
+ <img v-if="row.vpath" :src="$api.showImageUrl + row.vpath" />
|
|
29
|
+ </div>
|
|
30
|
+ </template>
|
26
|
31
|
<template slot-scope="{ row }" slot="actionSlot">
|
27
|
32
|
<div class="action_list">
|
28
|
33
|
<div @click="toView(row)">查看</div>
|
|
@@ -66,29 +71,60 @@
|
66
|
71
|
placeholder="请输入壁纸名称"
|
67
|
72
|
></Input>
|
68
|
73
|
</FormItem>
|
69
|
|
- <FormItem label="壁纸" style="width: 100%">
|
70
|
|
- <div class="up">
|
71
|
|
- <Upload
|
72
|
|
- class="Upload"
|
73
|
|
- action
|
74
|
|
- :show-upload-list="false"
|
75
|
|
- :before-upload="
|
76
|
|
- (file) => {
|
77
|
|
- upLoad(file);
|
78
|
|
- return false;
|
79
|
|
- }
|
80
|
|
- "
|
81
|
|
- accept=".png,.jpeg,.jpg,.gif"
|
82
|
|
- >
|
83
|
|
- <div v-if="wallpaperInfo.hpath" class="hpath">
|
84
|
|
- <img :src="$api.showImageUrl + wallpaperInfo.hpath" />
|
85
|
|
- </div>
|
86
|
|
- <div v-else class="icon">
|
87
|
|
- <Icon type="ios-cloud-upload-outline" size="42"></Icon>
|
88
|
|
- <div>横屏壁纸</div>
|
89
|
|
- </div>
|
90
|
|
- </Upload>
|
91
|
|
- <span>支持图片格式:jpg、jgeg、gif、png</span>
|
|
74
|
+ <FormItem label="壁纸" class="require" style="width: 100%">
|
|
75
|
+ <div class="wallpaper_upload_box">
|
|
76
|
+ <div class="wallpaper_h">
|
|
77
|
+ <Upload
|
|
78
|
+ action
|
|
79
|
+ :show-upload-list="false"
|
|
80
|
+ class="wallpaper_upload"
|
|
81
|
+ :before-upload="
|
|
82
|
+ (file) => {
|
|
83
|
+ upLoad(file, 1);
|
|
84
|
+ return false;
|
|
85
|
+ }
|
|
86
|
+ "
|
|
87
|
+ accept=".png,.jpeg,.jpg,.gif"
|
|
88
|
+ >
|
|
89
|
+ <div class="wallpaper_img_box" v-if="wallpaperInfo.hpath">
|
|
90
|
+ <img :src="$api.showImageUrl + wallpaperInfo.hpath" />
|
|
91
|
+ </div>
|
|
92
|
+ <div v-else class="upload_tip">
|
|
93
|
+ <div>
|
|
94
|
+ <Icon type="ios-cloud-upload-outline" size="42"></Icon>
|
|
95
|
+ <div>横屏壁纸</div>
|
|
96
|
+ </div>
|
|
97
|
+ </div>
|
|
98
|
+ </Upload>
|
|
99
|
+ </div>
|
|
100
|
+ <div class="wallpaper_v">
|
|
101
|
+ <Upload
|
|
102
|
+ action
|
|
103
|
+ :show-upload-list="false"
|
|
104
|
+ class="wallpaper_upload"
|
|
105
|
+ :before-upload="
|
|
106
|
+ (file) => {
|
|
107
|
+ upLoad(file, 2);
|
|
108
|
+ return false;
|
|
109
|
+ }
|
|
110
|
+ "
|
|
111
|
+ accept=".png,.jpeg,.jpg,.gif"
|
|
112
|
+ >
|
|
113
|
+ <div class="wallpaper_img_box" v-if="wallpaperInfo.vpath">
|
|
114
|
+ <img :src="$api.showImageUrl + wallpaperInfo.vpath" />
|
|
115
|
+ </div>
|
|
116
|
+ <div v-else class="upload_tip">
|
|
117
|
+ <div>
|
|
118
|
+ <Icon type="ios-cloud-upload-outline" size="42"></Icon>
|
|
119
|
+ <div>竖屏壁纸</div>
|
|
120
|
+ </div>
|
|
121
|
+ </div>
|
|
122
|
+ </Upload>
|
|
123
|
+ </div>
|
|
124
|
+ <div class="wallpaper_tip">
|
|
125
|
+ <div>支持格式:jpg、jpeg、gif、png</div>
|
|
126
|
+ <div>最大限制:2MB</div>
|
|
127
|
+ </div>
|
92
|
128
|
</div>
|
93
|
129
|
</FormItem>
|
94
|
130
|
<FormItem label="适配类型" class="require" style="width: 100%">
|
|
@@ -121,11 +157,13 @@
|
121
|
157
|
<div class="view_titles">{{ viewInfo.wname }}</div>
|
122
|
158
|
<div class="view_content">
|
123
|
159
|
<div class="view_title">壁纸效果</div>
|
124
|
|
- <div class="hpath">
|
125
|
|
- <img
|
126
|
|
- v-if="viewInfo.hpath"
|
127
|
|
- :src="$api.showImageUrl + viewInfo.hpath"
|
128
|
|
- />
|
|
160
|
+ <div class="view_wallpaper_box">
|
|
161
|
+ <div class="view_img_box h" v-if="viewInfo.hpath">
|
|
162
|
+ <img :src="$api.showImageUrl + viewInfo.hpath" />
|
|
163
|
+ </div>
|
|
164
|
+ <div class="view_img_box v" v-if="viewInfo.vpath">
|
|
165
|
+ <img :src="$api.showImageUrl + viewInfo.vpath" />
|
|
166
|
+ </div>
|
129
|
167
|
</div>
|
130
|
168
|
</div>
|
131
|
169
|
<div class="view_content" style="margin-top: 20px">
|
|
@@ -169,7 +207,6 @@ import {
|
169
|
207
|
wallpaper_list_device,
|
170
|
208
|
wallpaper_list_devicewp
|
171
|
209
|
} from "@/api/setting";
|
172
|
|
-import { device_list } from "@/api/appgroup";
|
173
|
210
|
export default {
|
174
|
211
|
components: {
|
175
|
212
|
CheckboxDevice
|
|
@@ -184,25 +221,17 @@ export default {
|
184
|
221
|
list: [],
|
185
|
222
|
total: 0
|
186
|
223
|
},
|
187
|
|
- // 新建
|
|
224
|
+ // 新建/编辑
|
188
|
225
|
wallpaperInfo: {
|
189
|
226
|
show: false,
|
190
|
227
|
id: null,
|
191
|
228
|
wname: "",
|
192
|
229
|
hpath: "",
|
|
230
|
+ vpath: "",
|
193
|
231
|
wlevel: "",
|
194
|
232
|
objectid: "",
|
195
|
233
|
deviceids: []
|
196
|
234
|
},
|
197
|
|
- // 编辑
|
198
|
|
- modifyRegion: {
|
199
|
|
- show: false,
|
200
|
|
- regionid: null,
|
201
|
|
- name: "",
|
202
|
|
- regionCode: "",
|
203
|
|
- comm: "",
|
204
|
|
- rversion: null
|
205
|
|
- },
|
206
|
235
|
// 查看
|
207
|
236
|
viewInfo: {
|
208
|
237
|
show: false,
|
|
@@ -240,6 +269,11 @@ export default {
|
240
|
269
|
slot: "hpath",
|
241
|
270
|
align: "center"
|
242
|
271
|
},
|
|
272
|
+ {
|
|
273
|
+ title: "竖屏壁纸",
|
|
274
|
+ slot: "vpath",
|
|
275
|
+ align: "center"
|
|
276
|
+ },
|
243
|
277
|
{
|
244
|
278
|
title: "壁纸名称",
|
245
|
279
|
key: "wname",
|
|
@@ -295,17 +329,23 @@ export default {
|
295
|
329
|
this.$Message.error(res.msg);
|
296
|
330
|
}
|
297
|
331
|
},
|
298
|
|
- upLoad(file) {
|
|
332
|
+ upLoad(file, type) {
|
|
333
|
+ //type 1横屏 2竖屏
|
299
|
334
|
let str = file.name.split(".");
|
|
335
|
+ let size = file.size / 1024 / 1024;
|
300
|
336
|
let suffix = str[str.length - 1];
|
301
|
337
|
suffix = suffix.toLowerCase();
|
302
|
338
|
if (suffix !== "png" && suffix !== "jpeg" && suffix !== "jpg") {
|
303
|
339
|
this.$Message.warning("请上传png、jpeg、jpg类型的文件");
|
304
|
340
|
return false;
|
305
|
341
|
}
|
|
342
|
+ if (size > 2) {
|
|
343
|
+ this.$Message.error("图片太大,不能超过2M!");
|
|
344
|
+ return false;
|
|
345
|
+ }
|
306
|
346
|
let formData = new FormData();
|
307
|
347
|
formData.append("file", file);
|
308
|
|
- formData.append("savefolder", "app");
|
|
348
|
+ formData.append("savefolder", "wallpaper");
|
309
|
349
|
formData.append("isrename", "1");
|
310
|
350
|
let Url = this.$api.baseImageUrl + "up/upfile";
|
311
|
351
|
this.showLoading = true;
|
|
@@ -316,7 +356,11 @@ export default {
|
316
|
356
|
.then((res) => {
|
317
|
357
|
this.showLoading = false;
|
318
|
358
|
if (res.data.code === 0) {
|
319
|
|
- this.wallpaperInfo.hpath = res.data.obj;
|
|
359
|
+ if (type === 1) {
|
|
360
|
+ this.wallpaperInfo.hpath = res.data.obj;
|
|
361
|
+ } else {
|
|
362
|
+ this.wallpaperInfo.vpath = res.data.obj;
|
|
363
|
+ }
|
320
|
364
|
this.$Message.success(res.data.msg);
|
321
|
365
|
} else {
|
322
|
366
|
this.$Message.error(res.data.msg);
|
|
@@ -324,7 +368,7 @@ export default {
|
324
|
368
|
})
|
325
|
369
|
.catch(() => {
|
326
|
370
|
this.showLoading = false;
|
327
|
|
- this.$Message.error("图片上传失败");
|
|
371
|
+ this.$Message.error("壁纸上传失败");
|
328
|
372
|
});
|
329
|
373
|
},
|
330
|
374
|
// 搜索
|
|
@@ -377,6 +421,7 @@ export default {
|
377
|
421
|
id: null,
|
378
|
422
|
wname: "",
|
379
|
423
|
hpath: "",
|
|
424
|
+ vpath: "",
|
380
|
425
|
wlevel: "",
|
381
|
426
|
objectid: "",
|
382
|
427
|
deviceids: []
|
|
@@ -401,8 +446,8 @@ export default {
|
401
|
446
|
this.$Message.error("请选择设备!");
|
402
|
447
|
return;
|
403
|
448
|
}
|
404
|
|
- if (!this.wallpaperInfo.hpath) {
|
405
|
|
- this.$Message.error("请上传横屏壁纸!");
|
|
449
|
+ if (!this.wallpaperInfo.hpath && !this.wallpaperInfo.vpath) {
|
|
450
|
+ this.$Message.error("请上传壁纸!");
|
406
|
451
|
return;
|
407
|
452
|
}
|
408
|
453
|
let api = this.wallpaperInfo.wallpaperid
|
|
@@ -411,6 +456,7 @@ export default {
|
411
|
456
|
let form = {
|
412
|
457
|
wname: this.wallpaperInfo.wname,
|
413
|
458
|
hpath: this.wallpaperInfo.hpath,
|
|
459
|
+ vpath: this.wallpaperInfo.vpath,
|
414
|
460
|
wlevel: 2,
|
415
|
461
|
rtype: this.powerParams.rtype,
|
416
|
462
|
objectid: this.powerParams.objectid,
|
|
@@ -426,6 +472,7 @@ export default {
|
426
|
472
|
this.showLoading = false;
|
427
|
473
|
if (data.code === 0) {
|
428
|
474
|
this.wallpaperInfo.show = false;
|
|
475
|
+ this.init();
|
429
|
476
|
this.searchList();
|
430
|
477
|
this.$Message.success(data.msg);
|
431
|
478
|
} else {
|
|
@@ -449,6 +496,7 @@ export default {
|
449
|
496
|
show: true,
|
450
|
497
|
wname: data.obj.wname,
|
451
|
498
|
hpath: data.obj.hpath,
|
|
499
|
+ vpath: data.obj.vpath,
|
452
|
500
|
devices: data.obj.devices
|
453
|
501
|
};
|
454
|
502
|
} else {
|
|
@@ -483,6 +531,7 @@ export default {
|
483
|
531
|
wallpaperid: res.obj.wallpaperid,
|
484
|
532
|
wname: res.obj.wname,
|
485
|
533
|
hpath: res.obj.hpath,
|
|
534
|
+ vpath: res.obj.vpath,
|
486
|
535
|
wlevel: res.obj.wlevel,
|
487
|
536
|
objectid: res.obj.objectid,
|
488
|
537
|
deviceids: res.obj.devices,
|
|
@@ -556,17 +605,32 @@ export default {
|
556
|
605
|
flex: none;
|
557
|
606
|
margin: 0 10px;
|
558
|
607
|
}
|
559
|
|
- .hpath {
|
560
|
|
- width: 180px;
|
561
|
|
- height: 120px;
|
562
|
|
- border-radius: 8px;
|
563
|
|
- overflow: hidden;
|
564
|
|
- border: 3px solid #333333;
|
565
|
|
- background-color: #f0f6fc;
|
566
|
|
- img {
|
567
|
|
- width: 100%;
|
568
|
|
- height: 100%;
|
569
|
|
- object-fit: cover;
|
|
608
|
+ .view_wallpaper_box {
|
|
609
|
+ display: flex;
|
|
610
|
+ justify-content: flex-start;
|
|
611
|
+ align-items: flex-end;
|
|
612
|
+ .view_img_box {
|
|
613
|
+ position: relative;
|
|
614
|
+ margin-right: 20px;
|
|
615
|
+ border-radius: 6px;
|
|
616
|
+ border: 5px solid #333;
|
|
617
|
+ background: #f0f6fc;
|
|
618
|
+ &.h {
|
|
619
|
+ width: 180px;
|
|
620
|
+ height: 120px;
|
|
621
|
+ img {
|
|
622
|
+ width: 100%;
|
|
623
|
+ height: 100%;
|
|
624
|
+ }
|
|
625
|
+ }
|
|
626
|
+ &.v {
|
|
627
|
+ width: 120px;
|
|
628
|
+ height: 180px;
|
|
629
|
+ img {
|
|
630
|
+ width: 100%;
|
|
631
|
+ height: 100%;
|
|
632
|
+ }
|
|
633
|
+ }
|
570
|
634
|
}
|
571
|
635
|
}
|
572
|
636
|
.view_devices {
|
|
@@ -590,55 +654,99 @@ export default {
|
590
|
654
|
|
591
|
655
|
.table_wrap {
|
592
|
656
|
.hpath {
|
593
|
|
- width: 100px;
|
594
|
|
- height: 60px;
|
|
657
|
+ max-width: 100px;
|
|
658
|
+ max-height: 60px;
|
595
|
659
|
margin: 10px auto;
|
596
|
660
|
img {
|
597
|
|
- width: 100%;
|
598
|
|
- height: 100%;
|
599
|
|
- object-fit: cover;
|
|
661
|
+ max-width: 100px;
|
|
662
|
+ max-height: 60px;
|
600
|
663
|
}
|
601
|
664
|
}
|
602
|
665
|
}
|
603
|
|
-.up {
|
|
666
|
+.wallpaper_upload_box {
|
604
|
667
|
display: flex;
|
605
|
|
- .Upload {
|
606
|
|
- width: 180px;
|
607
|
|
- height: 120px;
|
608
|
|
- border-radius: 8px;
|
609
|
|
- border: 3px solid #333333;
|
610
|
|
- background-color: #f0f6fc;
|
611
|
|
- display: flex;
|
612
|
|
- align-items: center;
|
613
|
|
- justify-content: center;
|
614
|
|
- cursor: pointer;
|
615
|
|
- .icon {
|
616
|
|
- color: #b8c2d9;
|
617
|
|
- text-align: center;
|
618
|
|
- }
|
|
668
|
+ justify-content: flex-start;
|
|
669
|
+ align-items: flex-start;
|
|
670
|
+ .wallpaper_h {
|
|
671
|
+ position: relative;
|
|
672
|
+ margin-top: 60px;
|
|
673
|
+ margin-right: 50px;
|
|
674
|
+ width: 190px;
|
|
675
|
+ height: 130px;
|
|
676
|
+ border-radius: 6px;
|
|
677
|
+ opacity: 1;
|
|
678
|
+ border: 5px solid #333;
|
|
679
|
+ background: #f0f6fc;
|
619
|
680
|
&:hover {
|
620
|
681
|
background: #eaf5ff;
|
621
|
|
- .icon {
|
622
|
|
- color: #339cff;
|
|
682
|
+ .upload_tip {
|
|
683
|
+ color: #339cff !important;
|
623
|
684
|
}
|
624
|
685
|
}
|
625
|
|
- .hpath {
|
|
686
|
+ .wallpaper_upload {
|
626
|
687
|
width: 180px;
|
627
|
688
|
height: 120px;
|
628
|
|
- border-radius: 8px;
|
629
|
|
- overflow: hidden;
|
630
|
|
- padding: 3px;
|
631
|
|
- img {
|
632
|
|
- width: 100%;
|
633
|
|
- height: 100%;
|
634
|
|
- object-fit: cover;
|
|
689
|
+ cursor: pointer;
|
|
690
|
+ .wallpaper_img_box {
|
|
691
|
+ width: 180px;
|
|
692
|
+ height: 120px;
|
|
693
|
+ img {
|
|
694
|
+ width: 100%;
|
|
695
|
+ height: 100%;
|
|
696
|
+ }
|
|
697
|
+ }
|
|
698
|
+ .upload_tip {
|
|
699
|
+ display: flex;
|
|
700
|
+ justify-content: center;
|
|
701
|
+ align-items: center;
|
|
702
|
+ width: 180px;
|
|
703
|
+ height: 120px;
|
|
704
|
+ text-align: center;
|
|
705
|
+ color: #b8c2d9;
|
635
|
706
|
}
|
636
|
707
|
}
|
637
|
708
|
}
|
638
|
|
- span {
|
639
|
|
- margin-left: 20px;
|
640
|
|
- color: #7c8db5;
|
|
709
|
+ .wallpaper_v {
|
|
710
|
+ position: relative;
|
|
711
|
+ margin-right: 20px;
|
|
712
|
+ width: 130px;
|
|
713
|
+ height: 190px;
|
|
714
|
+ border-radius: 6px;
|
|
715
|
+ opacity: 1;
|
|
716
|
+ border: 5px solid #333;
|
|
717
|
+ background: #f0f6fc;
|
|
718
|
+ &:hover {
|
|
719
|
+ background: #eaf5ff;
|
|
720
|
+ .upload_tip {
|
|
721
|
+ color: #339cff !important;
|
|
722
|
+ }
|
|
723
|
+ }
|
|
724
|
+ .wallpaper_upload {
|
|
725
|
+ width: 120px;
|
|
726
|
+ height: 180px;
|
|
727
|
+ cursor: pointer;
|
|
728
|
+ .wallpaper_img_box {
|
|
729
|
+ width: 120px;
|
|
730
|
+ height: 180px;
|
|
731
|
+ img {
|
|
732
|
+ width: 100%;
|
|
733
|
+ height: 100%;
|
|
734
|
+ }
|
|
735
|
+ }
|
|
736
|
+ .upload_tip {
|
|
737
|
+ display: flex;
|
|
738
|
+ justify-content: center;
|
|
739
|
+ align-items: center;
|
|
740
|
+ width: 120px;
|
|
741
|
+ height: 180px;
|
|
742
|
+ text-align: center;
|
|
743
|
+ color: #b8c2d9;
|
|
744
|
+ }
|
|
745
|
+ }
|
|
746
|
+ }
|
|
747
|
+ .wallpaper_tip {
|
641
|
748
|
font-size: 16px;
|
|
749
|
+ color: #7c8db5;
|
642
|
750
|
}
|
643
|
751
|
}
|
644
|
752
|
</style>
|