Browse Source

学校-壁纸

gzb
wangzhonglu 10 months ago
parent
commit
b8e4517642
2 changed files with 921 additions and 4 deletions
  1. 46
    0
      src/api/setting.js
  2. 875
    4
      src/views/schoolSection/setting/wallpaper.vue

+ 46
- 0
src/api/setting.js View File

@@ -0,0 +1,46 @@
1
+import { setRequest } from "@/utils/httpRequest";
2
+
3
+/**
4
+ * 8.1.1 壁纸-列表
5
+ */
6
+export const wallpaper_list = (data) => setRequest("wallpaper/list", data);
7
+/**
8
+ * 8.1.2 壁纸-添加
9
+ */
10
+export const wallpaper_add = (data) => setRequest("wallpaper/add", data);
11
+/**
12
+ * 8.1.3 壁纸-更新
13
+ */
14
+export const wallpaper_edit = (data) => setRequest("wallpaper/edit", data);
15
+/**
16
+ * 8.1.4 壁纸-详情
17
+ */
18
+export const wallpaper_detail = (data) => setRequest("wallpaper/detail", data);
19
+/**
20
+ * 8.1.5 壁纸-删除
21
+ */
22
+export const wallpaper_delete = (data) => setRequest("wallpaper/delete", data);
23
+/**
24
+ * 8.2.1 LOGO-详情
25
+ */
26
+export const logo_detail = (data) => setRequest("logo/detail", data);
27
+/**
28
+ * 8.2.2 LOGO-保存
29
+ */
30
+export const logo_edit = (data) => setRequest("logo/edit", data);
31
+/**
32
+ * 8.2.3 LOGO-重置
33
+ */
34
+export const logo_delete = (data) => setRequest("logo/delete", data);
35
+/**
36
+ * 8.3.1 设备设置-详情
37
+ */
38
+export const password_detail = (data) => setRequest("password/detail", data);
39
+/**
40
+ * 8.3.2 设备设置-保存
41
+ */
42
+export const password_edit = (data) => setRequest("password/edit", data);
43
+/**
44
+ * 8.3.3 设备设置-重置
45
+ */
46
+export const password_delete = (data) => setRequest("password/delete", data);

+ 875
- 4
src/views/schoolSection/setting/wallpaper.vue View File

@@ -1,14 +1,885 @@
1 1
 <template>
2
-  <div class="main_root"></div>
2
+  <div class="main_root">
3
+    <div class="search_header">
4
+      <Input
5
+        v-model="searchForm.name"
6
+        placeholder="请输入壁纸名称"
7
+        search
8
+        @on-search="searchList()"
9
+        style="width: 150px"
10
+      />
11
+      <Button type="primary" class="primary_btn" @click="toAdd()">新建</Button>
12
+    </div>
13
+    <div class="table_wrap">
14
+      <Table :columns="columns" :data="searchForm.list">
15
+        <div
16
+          slot-scope="{ row }"
17
+          slot="hpathSlot"
18
+          style="display: flex; justify-content: center; align-items: center"
19
+        >
20
+          <img
21
+            style="
22
+              margin: 4px 0;
23
+              max-width: 100px;
24
+              max-height: 56px;
25
+              object-fit: contain;
26
+            "
27
+            v-if="row.hpath"
28
+            :src="$api.showImageUrl + row.hpath"
29
+          />
30
+        </div>
31
+        <div
32
+          slot-scope="{ row }"
33
+          slot="vpathSlot"
34
+          style="display: flex; justify-content: center; align-items: center"
35
+        >
36
+          <img
37
+            style="
38
+              margin: 4px 0;
39
+              max-width: 100px;
40
+              max-height: 56px;
41
+              object-fit: contain;
42
+            "
43
+            v-if="row.vpath"
44
+            :src="$api.showImageUrl + row.vpath"
45
+          />
46
+        </div>
47
+        <template slot-scope="{ row }" slot="actionSlot">
48
+          <div class="action_list">
49
+            <div @click="toView(row)">查看</div>
50
+            <div v-if="userInfo.adminid === row.createid" @click="toEdit(row)">
51
+              编辑
52
+            </div>
53
+            <div
54
+              v-if="userInfo.adminid === row.createid"
55
+              class="action_del"
56
+              @click="toDel(row)"
57
+            >
58
+              删除
59
+            </div>
60
+          </div>
61
+        </template>
62
+      </Table>
63
+    </div>
64
+    <div class="page_wrap">
65
+      <Page
66
+        :transfer="true"
67
+        :total="searchForm.total"
68
+        :current="searchForm.page"
69
+        :page-size="searchForm.size"
70
+        :page-size-opts="[10, 20, 40, 60]"
71
+        @on-change="pageChange"
72
+        @on-page-size-change="pageSizeChange"
73
+        show-total
74
+        show-sizer
75
+      ></Page>
76
+    </div>
77
+    <!-- 新建/编辑 -->
78
+    <Modal
79
+      class="modal1"
80
+      :mask-closable="false"
81
+      v-model="wallpaperInfo.show"
82
+      :title="wallpaperInfo.wallpaperid ? '编辑' : '新建'"
83
+    >
84
+      <Form
85
+        v-if="wallpaperInfo.show"
86
+        ref="addForm"
87
+        :model="wallpaperInfo"
88
+        :rules="rules"
89
+        :label-width="80"
90
+      >
91
+        <FormItem label="名称" prop="wname">
92
+          <Input v-model="wallpaperInfo.wname" placeholder="请输入名称"></Input>
93
+        </FormItem>
94
+        <FormItem label="壁纸" class="require">
95
+          <div class="wallpaper_upload_box">
96
+            <div class="wallpaper_h">
97
+              <Upload
98
+                action
99
+                :show-upload-list="false"
100
+                class="wallpaper_upload"
101
+                :before-upload="
102
+                  (file) => {
103
+                    upLoadHWallpaper(file);
104
+                    return false;
105
+                  }
106
+                "
107
+                accept=".png,.jpeg,.jpg,.gif"
108
+              >
109
+                <div class="wallpaper_img_box" v-if="wallpaperInfo.hpath">
110
+                  <img :src="$api.showImageUrl + wallpaperInfo.hpath" />
111
+                </div>
112
+                <div v-else class="upload_tip">
113
+                  <div>
114
+                    <Icon type="ios-cloud-upload-outline" size="42"></Icon>
115
+                    <div>横屏壁纸</div>
116
+                  </div>
117
+                </div>
118
+              </Upload>
119
+              <Spin fix v-if="wallpaperInfo.hLoading">
120
+                <Icon
121
+                  type="ios-loading"
122
+                  size="18"
123
+                  class="demo-spin-icon-load"
124
+                ></Icon>
125
+                <div>加载中</div>
126
+              </Spin>
127
+            </div>
128
+            <div class="wallpaper_v">
129
+              <Upload
130
+                action
131
+                :show-upload-list="false"
132
+                class="wallpaper_upload"
133
+                :before-upload="
134
+                  (file) => {
135
+                    upLoadVWallpaper(file);
136
+                    return false;
137
+                  }
138
+                "
139
+                accept=".png,.jpeg,.jpg,.gif"
140
+              >
141
+                <div class="wallpaper_img_box" v-if="wallpaperInfo.vpath">
142
+                  <img :src="$api.showImageUrl + wallpaperInfo.vpath" />
143
+                </div>
144
+                <div v-else class="upload_tip">
145
+                  <div>
146
+                    <Icon type="ios-cloud-upload-outline" size="42"></Icon>
147
+                    <div>竖屏壁纸</div>
148
+                  </div>
149
+                </div>
150
+              </Upload>
151
+              <Spin fix v-if="wallpaperInfo.vLoading">
152
+                <Icon
153
+                  type="ios-loading"
154
+                  size="18"
155
+                  class="demo-spin-icon-load"
156
+                ></Icon>
157
+                <div>加载中</div>
158
+              </Spin>
159
+            </div>
160
+            <div class="wallpaper_tip">
161
+              <div>支持格式:jpg、jpeg、gif、png</div>
162
+              <div>最大限制:2MB</div>
163
+            </div>
164
+          </div>
165
+        </FormItem>
166
+        <FormItem label="适配类型">
167
+          <div
168
+            class="device_brand"
169
+            v-for="brandItem in wallpaperInfo.deviceList"
170
+            :key="brandItem.dgroupid"
171
+          >
172
+            <div class="device_brand_header">
173
+              <div class="drop_icon_box" @click="toCloseDeviceBrand(brandItem)">
174
+                <Icon
175
+                  :class="[
176
+                    'drop_icon',
177
+                    brandItem.close ? 'arrow_dropdown' : ''
178
+                  ]"
179
+                  type="md-arrow-dropdown"
180
+                  :size="20"
181
+                />
182
+              </div>
183
+              <Checkbox
184
+                :disabled="brandItem.devices.length === 0"
185
+                :indeterminate="getIndeterminate(brandItem)"
186
+                :value="getCheckedAllValue(brandItem)"
187
+                @click.prevent.native="
188
+                  deviceBrandCheckedAll(
189
+                    brandItem,
190
+                    getCheckedAllValue(brandItem)
191
+                  )
192
+                "
193
+                >{{ brandItem.dgname }}</Checkbox
194
+              >
195
+            </div>
196
+            <div class="device_brand_main" v-if="!brandItem.close">
197
+              <Checkbox
198
+                v-for="deviceItem in brandItem.devices"
199
+                :key="deviceItem.deviceid"
200
+                :value="wallpaperInfo.deviceids.includes(deviceItem.deviceid)"
201
+                @on-change="deviceModelCheck(deviceItem)"
202
+                >{{ deviceItem.deviceModel }}</Checkbox
203
+              >
204
+            </div>
205
+          </div>
206
+        </FormItem>
207
+      </Form>
208
+      <div slot="footer">
209
+        <Button @click="wallpaperInfo.show = false">取消</Button>
210
+        <Button @click="saveAddInfo()" class="primary_btn" type="primary"
211
+          >保存</Button
212
+        >
213
+      </div>
214
+    </Modal>
215
+    <!-- 查看 -->
216
+    <Modal
217
+      class="modal1"
218
+      :mask-closable="false"
219
+      v-model="viewInfo.show"
220
+      title="查看"
221
+    >
222
+      <div class="viwe_title">{{ viewInfo.wname }}</div>
223
+      <Form v-if="viewInfo.show" :label-width="80">
224
+        <FormItem label="壁纸效果">
225
+          <div class="view_wallpaper_box">
226
+            <div class="view_img_box h" v-if="viewInfo.hpath">
227
+              <img :src="$api.showImageUrl + viewInfo.hpath" />
228
+            </div>
229
+            <div class="view_img_box v" v-if="viewInfo.vpath">
230
+              <img :src="$api.showImageUrl + viewInfo.vpath" />
231
+            </div>
232
+          </div>
233
+        </FormItem>
234
+        <FormItem label="适配类型">
235
+          <div
236
+            class="device_brand"
237
+            v-for="brandItem in viewInfo.deviceList"
238
+            :key="brandItem.dgroupid"
239
+          >
240
+            <div class="device_brand_header">
241
+              <div class="drop_icon_box" @click="toCloseDeviceBrand(brandItem)">
242
+                <Icon
243
+                  :class="[
244
+                    'drop_icon',
245
+                    brandItem.close ? 'arrow_dropdown' : ''
246
+                  ]"
247
+                  type="md-arrow-dropdown"
248
+                  :size="20"
249
+                />
250
+              </div>
251
+              <Checkbox
252
+                :disabled="brandItem.devices.length === 0"
253
+                :indeterminate="getIndeterminate(brandItem)"
254
+                :value="getCheckedAllValue(brandItem)"
255
+                @click.prevent.native="
256
+                  deviceBrandCheckedAll(
257
+                    brandItem,
258
+                    getCheckedAllValue(brandItem)
259
+                  )
260
+                "
261
+                >{{ brandItem.dgname }}</Checkbox
262
+              >
263
+            </div>
264
+            <div class="device_brand_main" v-if="!brandItem.close">
265
+              <Checkbox
266
+                v-for="deviceItem in brandItem.devices"
267
+                :key="deviceItem.deviceid"
268
+                :value="viewInfo.deviceids.includes(deviceItem.deviceid)"
269
+                @on-change="deviceModelCheck(deviceItem)"
270
+                >{{ deviceItem.deviceModel }}</Checkbox
271
+              >
272
+            </div>
273
+          </div>
274
+        </FormItem>
275
+      </Form>
276
+      <div slot="footer" style="text-align: center">
277
+        <Button @click="viewInfo.show = false">关闭</Button>
278
+      </div>
279
+    </Modal>
280
+  </div>
3 281
 </template>
4 282
 
5 283
 <script>
284
+import axios from "axios";
285
+import {
286
+  wallpaper_list,
287
+  wallpaper_add,
288
+  wallpaper_edit,
289
+  wallpaper_detail,
290
+  wallpaper_delete
291
+} from "@/api/setting";
292
+import { device_list } from "@/api/appgroup";
6 293
 export default {
7 294
   data() {
8
-    return {};
295
+    return {
296
+      userInfo: {},
297
+      searchForm: {
298
+        name: "",
299
+        page: 1,
300
+        size: 10,
301
+        list: [],
302
+        total: 0
303
+      },
304
+      columns: [
305
+        {
306
+          title: "序号",
307
+          align: "center",
308
+          width: 70,
309
+          render: (h, params) => {
310
+            return h(
311
+              "span",
312
+              params.index +
313
+                (this.searchForm.page - 1) * this.searchForm.size +
314
+                1
315
+            );
316
+          }
317
+        },
318
+        {
319
+          title: "横屏壁纸",
320
+          slot: "hpathSlot",
321
+          align: "center"
322
+        },
323
+        {
324
+          title: "竖屏壁纸",
325
+          slot: "vpathSlot",
326
+          align: "center"
327
+        },
328
+        {
329
+          title: "壁纸名称",
330
+          key: "wname",
331
+          align: "center"
332
+        },
333
+        {
334
+          title: "操作人",
335
+          key: "updatename",
336
+          align: "center"
337
+        },
338
+        {
339
+          title: "操作时间",
340
+          key: "updatetime",
341
+          width: 190,
342
+          align: "center"
343
+        },
344
+        {
345
+          title: "操作",
346
+          slot: "actionSlot",
347
+          width: 180,
348
+          align: "center"
349
+        }
350
+      ],
351
+      // 新建/编辑
352
+      wallpaperInfo: {
353
+        show: false,
354
+        wallpaperid: null,
355
+        rversion: null,
356
+        wname: "",
357
+        hpath: "",
358
+        hLoading: false,
359
+        vpath: "",
360
+        vLoading: false,
361
+        // 2区域3学校
362
+        wlevel: 3,
363
+        // 对应的区域/学校ID
364
+        objectid: "",
365
+        deviceids: [],
366
+        deviceList: []
367
+      },
368
+      // 查看
369
+      viewInfo: {
370
+        show: false,
371
+        wname: "",
372
+        hpath: "",
373
+        vpath: "",
374
+        deviceids: [],
375
+        deviceList: []
376
+      },
377
+      rules: {
378
+        wname: [
379
+          {
380
+            required: true,
381
+            message: "请输入名称",
382
+            trigger: "blur"
383
+          }
384
+        ]
385
+      }
386
+    };
9 387
   },
10
-  methods: {}
388
+  created() {
389
+    this.userInfo = JSON.parse(
390
+      localStorage.getItem("xh_control_userInfo")
391
+    ).content;
392
+    this.searchList();
393
+  },
394
+  methods: {
395
+    // 搜索
396
+    searchList() {
397
+      this.searchForm.page = 1;
398
+      this.getList();
399
+    },
400
+    // 页码改变
401
+    pageChange(page) {
402
+      this.searchForm.page = page;
403
+      this.getList();
404
+    },
405
+    // 每页显示数量改变
406
+    pageSizeChange(size) {
407
+      this.searchForm.size = size;
408
+      this.searchForm.page = 1;
409
+      this.getList();
410
+    },
411
+    // 获取列表
412
+    getList() {
413
+      console.warn("---注意替换regionid--schoolid-->wallpaper_list");
414
+      wallpaper_list({
415
+        page: this.searchForm.page,
416
+        size: this.searchForm.size,
417
+        name: this.searchForm.name,
418
+        regionid: 11,
419
+        schoolid: 4
420
+      }).then((data) => {
421
+        if (data.code === 0) {
422
+          this.searchForm.list = data.obj.data;
423
+          this.searchForm.total = data.obj.total;
424
+        } else {
425
+          this.$Message.error(data.msg);
426
+        }
427
+      });
428
+    },
429
+    // 新建
430
+    toAdd() {
431
+      console.warn("---objectid---->", 4);
432
+      this.wallpaperInfo = {
433
+        show: true,
434
+        wallpaperid: null,
435
+        rversion: null,
436
+        wname: "",
437
+        hpath: "",
438
+        hLoading: false,
439
+        vpath: "",
440
+        vLoading: false,
441
+        // 2区域3学校
442
+        wlevel: 3,
443
+        // 对应的区域/学校ID
444
+        objectid: 4,
445
+        deviceids: [],
446
+        deviceList: []
447
+      };
448
+      this.getDeviceList().then((list) => {
449
+        this.wallpaperInfo.deviceList = list;
450
+      });
451
+    },
452
+    // 获取设备列表
453
+    getDeviceList() {
454
+      return new Promise((resolve) => {
455
+        device_list({}).then((data) => {
456
+          if (data.code === 0) {
457
+            resolve(data.obj || []);
458
+          } else {
459
+            resolve([]);
460
+            this.$Message.error(data.msg);
461
+          }
462
+        });
463
+      });
464
+    },
465
+    upLoadHWallpaper(file) {
466
+      let size = file.size / 1024 / 1024;
467
+      let str = file.name.split(".");
468
+      let suffix = str[str.length - 1];
469
+      suffix = suffix.toLowerCase();
470
+      if (
471
+        suffix !== "png" &&
472
+        suffix !== "jpeg" &&
473
+        suffix !== "jpg" &&
474
+        suffix !== "gif"
475
+      ) {
476
+        this.$Message.warning("请上传png、jpeg、jpg、gif类型的图片");
477
+        return false;
478
+      }
479
+      if (size > 2) {
480
+        this.$Message.error("图片太大,不能超过2M!");
481
+        return false;
482
+      }
483
+      let formData = new FormData();
484
+      formData.append("file", file);
485
+      formData.append("savefolder", "wallpaper");
486
+      formData.append("isrename", "1");
487
+      this.wallpaperInfo.hLoading = true;
488
+      axios
489
+        .post(this.$api.baseImageUrl + "up/upfile", formData, {
490
+          timeout: 1000 * this.$api.axiosFileTimeout
491
+        })
492
+        .then((res) => {
493
+          this.wallpaperInfo.hLoading = false;
494
+          if (res.data.code === 0) {
495
+            this.wallpaperInfo.hpath = res.data.obj;
496
+          } else {
497
+            this.$Message.error(res.data.msg);
498
+          }
499
+        })
500
+        .catch(() => {
501
+          this.wallpaperInfo.hLoading = false;
502
+          this.$Message.error("横屏壁纸上传失败");
503
+        });
504
+    },
505
+    upLoadVWallpaper(file) {
506
+      let size = file.size / 1024 / 1024;
507
+      let str = file.name.split(".");
508
+      let suffix = str[str.length - 1];
509
+      suffix = suffix.toLowerCase();
510
+      if (
511
+        suffix !== "png" &&
512
+        suffix !== "jpeg" &&
513
+        suffix !== "jpg" &&
514
+        suffix !== "gif"
515
+      ) {
516
+        this.$Message.warning("请上传png、jpeg、jpg、gif类型的图片");
517
+        return false;
518
+      }
519
+      if (size > 2) {
520
+        this.$Message.error("图片太大,不能超过2M!");
521
+        return false;
522
+      }
523
+      let formData = new FormData();
524
+      formData.append("file", file);
525
+      formData.append("savefolder", "wallpaper");
526
+      formData.append("isrename", "1");
527
+      this.wallpaperInfo.vLoading = true;
528
+      axios
529
+        .post(this.$api.baseImageUrl + "up/upfile", formData, {
530
+          timeout: 1000 * this.$api.axiosFileTimeout
531
+        })
532
+        .then((res) => {
533
+          this.wallpaperInfo.vLoading = false;
534
+          if (res.data.code === 0) {
535
+            this.wallpaperInfo.vpath = res.data.obj;
536
+          } else {
537
+            this.$Message.error(res.data.msg);
538
+          }
539
+        })
540
+        .catch(() => {
541
+          this.wallpaperInfo.vLoading = false;
542
+          this.$Message.error("竖屏壁纸上传失败");
543
+        });
544
+    },
545
+    // 隐藏品牌下所有类型
546
+    toCloseDeviceBrand(brandItem) {
547
+      this.$set(brandItem, "close", !brandItem.close);
548
+    },
549
+    // 获取样式控制状态
550
+    getIndeterminate(brandItem) {
551
+      let selectList = [];
552
+      brandItem.devices.forEach((deviceItem) => {
553
+        if (this.wallpaperInfo.deviceids.includes(deviceItem.deviceid)) {
554
+          selectList.push(deviceItem.deviceid);
555
+        }
556
+      });
557
+      return (
558
+        selectList.length > 0 && selectList.length !== brandItem.devices.length
559
+      );
560
+    },
561
+    // 获取品牌全选状态
562
+    getCheckedAllValue(brandItem) {
563
+      let selectAll = true;
564
+      for (const deviceItem of brandItem.devices) {
565
+        if (!this.wallpaperInfo.deviceids.includes(deviceItem.deviceid)) {
566
+          return false;
567
+        }
568
+      }
569
+      return selectAll && brandItem.devices.length > 0;
570
+    },
571
+    // 设备品牌全选变化
572
+    deviceBrandCheckedAll(brandItem, oldCheckAll) {
573
+      if (brandItem.devices.length === 0) {
574
+        return;
575
+      }
576
+      brandItem.devices.forEach((deviceItem) => {
577
+        this.wallpaperInfo.deviceids = this.wallpaperInfo.deviceids.filter(
578
+          (id) => id !== deviceItem.deviceid
579
+        );
580
+        if (!oldCheckAll) {
581
+          this.wallpaperInfo.deviceids.push(deviceItem.deviceid);
582
+        }
583
+      });
584
+    },
585
+    // 品牌类型选中改变
586
+    deviceModelCheck(deviceItem) {
587
+      if (this.wallpaperInfo.deviceids.includes(deviceItem.deviceid)) {
588
+        this.wallpaperInfo.deviceids = this.wallpaperInfo.deviceids.filter(
589
+          (id) => id !== deviceItem.deviceid
590
+        );
591
+      } else {
592
+        this.wallpaperInfo.deviceids.push(deviceItem.deviceid);
593
+      }
594
+    },
595
+    // 保存新建
596
+    saveAddInfo() {
597
+      this.$refs.addForm.validate((valid) => {
598
+        if (valid) {
599
+          if (!(this.wallpaperInfo.hpath || this.wallpaperInfo.vpath)) {
600
+            this.$Message.error("请上传壁纸");
601
+            return;
602
+          }
603
+          this.wallpaperInfo.show = false;
604
+          let form = {
605
+            wname: this.wallpaperInfo.wname,
606
+            hpath: this.wallpaperInfo.hpath,
607
+            vpath: this.wallpaperInfo.vpath,
608
+            wlevel: this.wallpaperInfo.wlevel,
609
+            objectid: this.wallpaperInfo.objectid,
610
+            deviceids: this.wallpaperInfo.deviceids
611
+          };
612
+          if (this.wallpaperInfo.wallpaperid && this.wallpaperInfo.rversion) {
613
+            form.wallpaperid = this.wallpaperInfo.wallpaperid;
614
+            form.rversion = this.wallpaperInfo.rversion;
615
+          }
616
+          let api =
617
+            this.wallpaperInfo.wallpaperid && this.wallpaperInfo.rversion
618
+              ? wallpaper_edit
619
+              : wallpaper_add;
620
+          api(form).then((data) => {
621
+            if (data.code === 0) {
622
+              this.searchList();
623
+              this.$Message.success(data.msg);
624
+            } else {
625
+              this.$Message.error(data.msg);
626
+            }
627
+          });
628
+        }
629
+      });
630
+    },
631
+    // 查看
632
+    toView(row) {
633
+      this.viewInfo = {
634
+        show: true,
635
+        wname: row.wname,
636
+        hpath: row.hpath,
637
+        vpath: row.vpath,
638
+        deviceids: [],
639
+        deviceList: []
640
+      };
641
+      this.getWallpaperDetail(row.wallpaperid).then((data) => {
642
+        if (data) {
643
+          let _deviceids = [];
644
+          data.devices.forEach((brandItem) => {
645
+            brandItem.devices.forEach((deviceItem) => {
646
+              _deviceids.push(deviceItem.deviceid);
647
+            });
648
+          });
649
+          this.wallpaperInfo.deviceids = _deviceids;
650
+        }
651
+      });
652
+      this.getDeviceList().then((list) => {
653
+        this.wallpaperInfo.deviceList = list;
654
+      });
655
+    },
656
+    // 编辑
657
+    toEdit(row) {
658
+      this.wallpaperInfo = {
659
+        show: true,
660
+        wallpaperid: row.wallpaperid,
661
+        rversion: row.rversion,
662
+        wname: row.wname,
663
+        hpath: row.hpath,
664
+        hLoading: false,
665
+        vpath: row.vpath,
666
+        vLoading: false,
667
+        // 2区域3学校
668
+        wlevel: row.wlevel,
669
+        // 对应的区域/学校ID
670
+        objectid: row.objectid,
671
+        deviceids: [],
672
+        deviceList: []
673
+      };
674
+      this.getWallpaperDetail(row.wallpaperid).then((data) => {
675
+        if (data) {
676
+          let _deviceids = [];
677
+          data.devices.forEach((brandItem) => {
678
+            brandItem.devices.forEach((deviceItem) => {
679
+              _deviceids.push(deviceItem.deviceid);
680
+            });
681
+          });
682
+          this.wallpaperInfo.deviceids = _deviceids;
683
+        }
684
+      });
685
+      this.getDeviceList().then((list) => {
686
+        this.wallpaperInfo.deviceList = list;
687
+      });
688
+    },
689
+    getWallpaperDetail(wallpaperid) {
690
+      return new Promise((resolve) => {
691
+        wallpaper_detail({ wallpaperid }).then((data) => {
692
+          if (data.code === 0) {
693
+            resolve(data.obj);
694
+          } else {
695
+            resolve();
696
+            this.$Message.error(data.msg);
697
+          }
698
+        });
699
+      });
700
+    },
701
+    // 删除
702
+    toDel(row) {
703
+      this.$Modal.confirm({
704
+        title: "提示",
705
+        content: "您确定删除选中数据吗?",
706
+        onOk: () => {
707
+          wallpaper_delete({
708
+            wallpaperid: row.wallpaperid,
709
+            rversion: row.rversion
710
+          }).then((data) => {
711
+            if (data.code === 0) {
712
+              this.searchList();
713
+              this.$Message.success(data.msg);
714
+            } else {
715
+              this.$Message.error(data.msg);
716
+            }
717
+          });
718
+        },
719
+        onCancel: () => {}
720
+      });
721
+    }
722
+  }
11 723
 };
12 724
 </script>
13 725
 
14
-<style lang="less" scoped></style>
726
+<style lang="less" scoped>
727
+.search_header {
728
+  display: flex;
729
+  justify-content: space-between;
730
+  align-items: center;
731
+  margin: 16px 16px;
732
+}
733
+.wallpaper_upload_box {
734
+  display: flex;
735
+  justify-content: flex-start;
736
+  align-items: flex-start;
737
+  .wallpaper_h {
738
+    position: relative;
739
+    margin-top: 60px;
740
+    margin-right: 50px;
741
+    width: 190px;
742
+    height: 130px;
743
+    border-radius: 6px;
744
+    opacity: 1;
745
+    border: 5px solid #333;
746
+    background: #f0f6fc;
747
+    &:hover {
748
+      background: #eaf5ff;
749
+      .upload_tip {
750
+        color: #339cff !important;
751
+      }
752
+    }
753
+    .wallpaper_upload {
754
+      width: 180px;
755
+      height: 120px;
756
+      cursor: pointer;
757
+      .wallpaper_img_box {
758
+        width: 180px;
759
+        height: 120px;
760
+        img {
761
+          width: 100%;
762
+          height: 100%;
763
+        }
764
+      }
765
+      .upload_tip {
766
+        display: flex;
767
+        justify-content: center;
768
+        align-items: center;
769
+        width: 180px;
770
+        height: 120px;
771
+        text-align: center;
772
+        color: #b8c2d9;
773
+      }
774
+    }
775
+  }
776
+  .wallpaper_v {
777
+    position: relative;
778
+    margin-right: 20px;
779
+    width: 130px;
780
+    height: 190px;
781
+    border-radius: 6px;
782
+    opacity: 1;
783
+    border: 5px solid #333;
784
+    background: #f0f6fc;
785
+    &:hover {
786
+      background: #eaf5ff;
787
+      .upload_tip {
788
+        color: #339cff !important;
789
+      }
790
+    }
791
+    .wallpaper_upload {
792
+      width: 120px;
793
+      height: 180px;
794
+      cursor: pointer;
795
+      .wallpaper_img_box {
796
+        width: 120px;
797
+        height: 180px;
798
+        img {
799
+          width: 100%;
800
+          height: 100%;
801
+        }
802
+      }
803
+      .upload_tip {
804
+        display: flex;
805
+        justify-content: center;
806
+        align-items: center;
807
+        width: 120px;
808
+        height: 180px;
809
+        text-align: center;
810
+        color: #b8c2d9;
811
+      }
812
+    }
813
+  }
814
+  .wallpaper_tip {
815
+    font-size: 16px;
816
+    color: #7c8db5;
817
+  }
818
+}
819
+.device_brand {
820
+  /deep/.ivu-checkbox-wrapper {
821
+    font-size: 16px;
822
+  }
823
+  .device_brand_header {
824
+    display: flex;
825
+    justify-content: flex-start;
826
+    align-items: center;
827
+    flex-wrap: wrap;
828
+    .drop_icon_box {
829
+      display: flex;
830
+      justify-content: flex-start;
831
+      align-items: center;
832
+      margin-right: 4px;
833
+      height: 32px;
834
+      cursor: pointer;
835
+      .drop_icon {
836
+        transition: all 0.1s ease-in-out;
837
+        &.arrow_dropdown {
838
+          transform: rotate(-90deg);
839
+        }
840
+      }
841
+    }
842
+  }
843
+  .device_brand_main {
844
+    display: flex;
845
+    justify-content: flex-start;
846
+    align-items: center;
847
+    flex-wrap: wrap;
848
+    padding-left: 24px;
849
+  }
850
+}
851
+.viwe_title {
852
+  margin-bottom: 16px;
853
+  font-size: 18px;
854
+  font-weight: bold;
855
+  text-align: center;
856
+}
857
+.view_wallpaper_box {
858
+  display: flex;
859
+  justify-content: flex-start;
860
+  align-items: flex-end;
861
+  .view_img_box {
862
+    position: relative;
863
+    margin-right: 20px;
864
+    border-radius: 6px;
865
+    border: 5px solid #333;
866
+    background: #f0f6fc;
867
+    &.h {
868
+      width: 180px;
869
+      height: 120px;
870
+      img {
871
+        width: 100%;
872
+        height: 100%;
873
+      }
874
+    }
875
+    &.v {
876
+      width: 120px;
877
+      height: 180px;
878
+      img {
879
+        width: 100%;
880
+        height: 100%;
881
+      }
882
+    }
883
+  }
884
+}
885
+</style>

Loading…
Cancel
Save