From 1e09a7a01a6c1888e1a2a832eb007fb8c2b653a0 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期三, 26 一月 2022 11:06:27 +0800
Subject: [PATCH] Merge branch 'bhomebus' of http://192.168.5.5:10010/r/web/vue-smart-ai into bhomebus

---
 src/pages/settings/views/generalSettings.vue |   47 ++++++++++++++++++++++++++++++++++-------------
 1 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/src/pages/settings/views/generalSettings.vue b/src/pages/settings/views/generalSettings.vue
index 648d193..4b6f2a1 100644
--- a/src/pages/settings/views/generalSettings.vue
+++ b/src/pages/settings/views/generalSettings.vue
@@ -298,7 +298,9 @@
 <script>
 import { saveAlarmConfig, getDevInfo } from "@/api/system";
 import { uploadSound, getSoundList, deleteSound } from "@/api/event";
-
+import {
+  updateUser,
+} from "@/api/user";
 export default {
   data() {
     return {
@@ -349,9 +351,9 @@
         { url: "/images/settings/绯荤粺璁剧疆.png" },
       ],
       tableBGList: [
-        { name: "background", url: "/images/settings/background.png" },
-        { name: "message", url: "/images/settings/鏁版嵁鎺ㄩ��.png" },
-        { name: "weather", url: "/images/settings/绯荤粺璁剧疆.png" },
+        { name: "background", url: "/images/desktop/background.png" },
+        { name: "message", url: "/images/desktop/message.png" },
+        { name: "weather", url: "/images/desktop/weather.png" },
       ],
       universalColor:'',
       colorList: [
@@ -377,11 +379,12 @@
         _this.curPlayingIndex = null;
       }
     });
-    const url = localStorage.getItem("backgroundPic");
+    const url = this.curUser.backgroundpic;
+    this.activeIcons = this.curUser.useIconType-1
     if (url) {
-      const arr = url.split("/");
+      // const arr = url.split("/");
       this.activeBg = this.tableBGList.findIndex((x) => {
-        return x.url.includes(arr[arr.length - 1]);
+        return x.url == url;
       });
     } else {
       this.activeBg = 0;
@@ -403,6 +406,10 @@
     max_video_len() {
       return Math.round(this.fakeObj.max * 1.2);
     },
+    curUser() {
+      const info = JSON.parse(sessionStorage.getItem("userInfo"));
+      return info;
+    },
   },
   methods: {
     formatTooltip(v) {
@@ -411,12 +418,16 @@
     pickBg(item, i) {
       this.activeBg = i;
       let message = "changeBackground?" + item.name;
-      window.parent.postMessage(
-        {
-          msg: message,
-        },
-        "*"
-      );
+      window.parent.postMessage(  {msg: message, }, "*" );
+      updateUser({
+        id: this.curUser.id,
+        backgroundpic: item.url,
+      }).then((res) => {
+        if (res.success) {
+          sessionStorage.setItem("userInfo", JSON.stringify(res.data))
+          this.$message.success(res.msg);
+        }
+      });
       this.$forceUpdate()
     },
     togglePlay(item, i) {
@@ -492,6 +503,16 @@
     },
     selectIcons(i) {
       this.activeIcons = i;
+      updateUser({
+        id: this.curUser.id,
+        iconType: i+1,
+      }).then((res) => {
+        if (res.success) {
+          window.parent.postMessage({ msg: "AppUpdate" }, "*");
+          sessionStorage.setItem("userInfo", JSON.stringify(res.data))
+          this.$message.success(res.msg);
+        }
+      });
     },
     removeSound(item) {
       const h = this.$createElement;

--
Gitblit v1.8.0