From c0c034b3ef0fdf0fd9c802d5984dbd717db6817a Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期三, 06 九月 2023 17:54:55 +0800
Subject: [PATCH] 定制桌面.

---
 src/pages/desktop/index/components/ToolsEntry.vue |  160 ++++++++-------
 src/pages/index/App.vue                           |  127 +++---------
 src/pages/index/api.ts                            |  107 ++++++++--
 src/pages/desktop/index/App.vue                   |  179 ++++++++---------
 src/pages/desktop/index/components/Tools.vue      |   14 -
 src/pages/settings/index/index.vue                |    4 
 6 files changed, 283 insertions(+), 308 deletions(-)

diff --git a/src/pages/desktop/index/App.vue b/src/pages/desktop/index/App.vue
index 97d9b3d..84e9b57 100644
--- a/src/pages/desktop/index/App.vue
+++ b/src/pages/desktop/index/App.vue
@@ -9,18 +9,18 @@
 </template>
 
 <script>
-import html2canvas from "html2canvas";
-import Desktop from "./components/Desktop";
-import NotificationCenter from "./components/NotificationCenter";
-import NoticeTip from "./components/NoticeTip";
-import Tools from "./components/Tools";
-import ToolsEntry from "./components/ToolsEntry";
-import { getServerName } from "./api.ts";
+import html2canvas from "html2canvas"
+import Desktop from "./components/Desktop"
+import NotificationCenter from "./components/NotificationCenter"
+import NoticeTip from "./components/NoticeTip"
+import Tools from "./components/Tools"
+import ToolsEntry from "./components/ToolsEntry"
+import { getServerName } from "./api.ts"
 
-import { getApps } from "@/api/app";
-import { getDevInfo } from "@/api/login";
+import { getApps } from "@/api/app"
+import { getDevInfo } from "@/api/login"
 
-import config from "../../../../package.json";
+import config from "../../../../package.json"
 
 export default {
   name: "app",
@@ -29,53 +29,49 @@
     NotificationCenter,
     NoticeTip,
     Tools,
-    ToolsEntry,
+    ToolsEntry
   },
   data() {
     return {
-      buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [],
+      buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || []
       // defaultBgUrl:"/images/desktop/background.png"
-    };
+    }
   },
   computed: {
     isAdmin() {
-      if (
-        sessionStorage.getItem("userInfo") &&
-        sessionStorage.getItem("userInfo") !== ""
-      ) {
-        let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username;
-        return loginName === "superadmin" || loginName === "basic";
+      if (sessionStorage.getItem("userInfo") && sessionStorage.getItem("userInfo") !== "") {
+        let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username
+        return loginName === "superadmin" || loginName === "basic"
       }
-      return false;
+      return false
     },
     defaultBgUrl() {
       if (JSON.parse(sessionStorage.getItem("userInfo"))) {
-        return JSON.parse(sessionStorage.getItem("userInfo")).backgroundpic;
+        return JSON.parse(sessionStorage.getItem("userInfo")).backgroundpic
       }
-      return "";
-    },
+      return ""
+    }
   },
   created() {
-    this.getServerName();
-    this.getDevInfo();
+    this.getServerName()
+    this.getDevInfo()
   },
   mounted() {
-    document.getElementById("app").style.backgroundImage = `url(${
-      this.defaultBgUrl || "/images/desktop/background.png"
-    })`;
-    this.showApps();
-    let _that = this;
-    let msgResp = require("./mock/messages.json");
+    document.getElementById("app").style.backgroundImage = `url(${this.defaultBgUrl ||
+      "/images/desktop/background.png"})`
+    this.showApps()
+    let _that = this
+    let msgResp = require("./mock/messages.json")
     if (msgResp.success) {
-      msgResp.data.forEach(function (item) {
-        _that.addMessage(item);
-      });
+      msgResp.data.forEach(function(item) {
+        _that.addMessage(item)
+      })
     }
-    let weather = require("./mock/weather.json");
+    let weather = require("./mock/weather.json")
     if (weather.success) {
-      _that.addWeather(weather.data.data);
+      _that.addWeather(weather.data.data)
     }
-    setTimeout(function () {
+    setTimeout(function() {
       _that.addMessage(
         {
           id: "N2",
@@ -83,48 +79,45 @@
           tip: "娑堟伅",
           title: "SmartAI",
           body: "V" + config.version,
-          time: new Date(),
+          time: new Date()
         },
         true
-      );
-    }, 1000);
+      )
+    }, 1000)
     window.addEventListener("message", (e) => {
       if (e.data.msg == "AppUpdate") {
-        this.showApps();
+        this.showApps()
       }
       if (e.data.msg == "checkSN") {
-        this.$refs.desktop.validateSn();
+        this.$refs.desktop.validateSn()
       }
       if (e.data.msg === "changeColor") {
-        const iframeArr = document.querySelectorAll("iframe");
+        const iframeArr = document.querySelectorAll("iframe")
         iframeArr.forEach((item) => {
-          item.contentWindow.postMessage(
-            { msg: "changeColor", color: e.data.color },
-            "*"
-          );
-        });
+          item.contentWindow.postMessage({ msg: "changeColor", color: e.data.color }, "*")
+        })
       }
-    });
+    })
   },
   methods: {
     quit() {
-      this.$refs.tools.toLogout();
+      this.$refs.tools.toLogout()
     },
     onJumpToDock(name) {
-      this.$refs.dock_model.onJumpToDock(name);
+      this.$refs.dock_model.onJumpToDock(name)
     },
     onChangeBg(v) {
-      document.getElementById("app").style.backgroundImage = "url(" + v + ")";
+      document.getElementById("app").style.backgroundImage = "url(" + v + ")"
     },
     showApps() {
-      let _that = this;
+      let _that = this
 
       getApps().then((rsp) => {
         if (rsp && rsp.success) {
-          _that.$store.state.desktop.docks = [];
-          let installedApps = [];
-          rsp.data;
-          rsp.data.forEach(function (item) {
+          _that.$store.state.desktop.docks = []
+          let installedApps = []
+          rsp.data
+          rsp.data.forEach(function(item) {
             if (item.installed) {
               let temp = {
                 id: item.id,
@@ -132,9 +125,7 @@
                 create_time: item.create_time,
                 height: item.height,
                 icon: item.icon,
-                src: item.iconBlob
-                  ? "data:image/png;base64," + item.iconBlob
-                  : item.icon,
+                src: item.iconBlob ? "data:image/png;base64," + item.iconBlob : item.icon,
                 installed: item.installed,
                 isDelete: item.isDelete,
                 isUpgrade: item.isUpgrade,
@@ -147,51 +138,47 @@
                 url: item.url,
                 version: item.version,
                 width: item.width,
-                isDefault: item.isDefault,
-              };
-
-              // 鍒ゆ柇鏉冮檺
-              if (
-                _that.isAdmin ||
-                _that.buttonAuthority.indexOf(item.package) >= 0
-              ) {
-                _that.$store.commit("desktop/addDock", temp);
+                isDefault: item.isDefault
               }
 
-              installedApps.push(item.package);
-            }
-          });
+              // 鍒ゆ柇鏉冮檺
+              // if (_that.isAdmin || _that.buttonAuthority.indexOf(item.package) >= 0) {
+              _that.$store.commit("desktop/addDock", temp)
+              // }
 
-          sessionStorage.setItem("apps", installedApps.join(","));
+              installedApps.push(item.package)
+            }
+          })
+          sessionStorage.setItem("apps", installedApps.join(","))
         }
-      });
+      })
     },
-    addMessage: function (message, ding) {
-      this.$store.dispatch("desktop/addMessage", message);
+    addMessage: function(message, ding) {
+      this.$store.dispatch("desktop/addMessage", message)
       // if (ding) {
       //   new Audio('sounds/ping.mp3').play();
       // }
-      this.$refs.notice_tip_model.showTip(message);
+      this.$refs.notice_tip_model.showTip(message)
     },
-    addWeather: function (weather) {
-      this.$store.commit("desktop/addWeather", weather);
+    addWeather: function(weather) {
+      this.$store.commit("desktop/addWeather", weather)
     },
     screenShot(dock) {
       //鎵惧埌褰撳墠鐨刬frame
       let curIframe = Array.from(document.querySelectorAll("iframe")).find(
         (iframe) => iframe.src.indexOf(dock.url) >= 0
-      );
+      )
       //淇濆瓨褰撳墠搴旂敤蹇収
       html2canvas(curIframe.contentWindow.document.body, {
         dpi: window.devicePixelRatio * 4,
         logging: true, //鏌ョ湅html2canvas鍐呴儴鎵ц娴佺▼
         removeContainer: true,
         imageTimeout: 0,
-        useCORS: true, //寮�鍚法鍩熼厤缃�
+        useCORS: true //寮�鍚法鍩熼厤缃�
         //allowTaint: true
       })
         .then((canvas) => {
-          let shotSrc = canvas.toDataURL();
+          let shotSrc = canvas.toDataURL()
           // this.$store.commit('desktop/addMinDock', {
           //   id: dock.id,
           //   src: dock.icon,
@@ -201,31 +188,29 @@
           // });
           this.$store.commit("desktop/shotscreen", {
             id: dock.id,
-            src: shotSrc,
-          });
+            src: shotSrc
+          })
         })
         .catch((e) => {
-          this.$store.commit("desktop/shotscreen", { id: dock.id, src: "" });
-        });
+          this.$store.commit("desktop/shotscreen", { id: dock.id, src: "" })
+        })
     },
     async getServerName() {
-      let res = await getServerName();
+      let res = await getServerName()
       if (res && res.success) {
-        this.serverTitle = res.data.serverName;
-        window.document.title = res.data.serverName
-          ? res.data.serverName
-          : "SmartAI";
-        sessionStorage.setItem("title", res.data.serverName);
+        this.serverTitle = res.data.serverName
+        window.document.title = res.data.serverName ? res.data.serverName : "SmartAI"
+        sessionStorage.setItem("title", res.data.serverName)
       }
     },
     async getDevInfo() {
-      const res = await getDevInfo();
+      const res = await getDevInfo()
       if (res && res.success && res.data.deviceType.substr(0, 2) === "DS") {
-        sessionStorage.setItem("isShowPolling", "show");
+        sessionStorage.setItem("isShowPolling", "show")
       }
-    },
-  },
-};
+    }
+  }
+}
 </script>
 
 <style>
diff --git a/src/pages/desktop/index/components/Tools.vue b/src/pages/desktop/index/components/Tools.vue
index 533a993..82ea0ab 100644
--- a/src/pages/desktop/index/components/Tools.vue
+++ b/src/pages/desktop/index/components/Tools.vue
@@ -19,16 +19,6 @@
             {{ x.name }}
           </div>
         </div>
-        <div class="bot">
-          <div class="set" @click="clickFastPath('绯荤粺璁剧疆')">
-            <span class="icon iconfont">{{ "\ue60f" }}</span>
-            <span>璁剧疆</span>
-          </div>
-          <div class="exit" @click="toLogout">
-            <span class="icon iconfont">{{ "\ue60f" }}</span>
-            <span>閫�鍑�</span>
-          </div>
-        </div>
       </div>
       <div class="tools-icon no-hover-style">
         <img class="smart-ai" :src="`${publicPath}images/desktop/header-icon/SmartAI-鏂�.png`" alt />
@@ -64,7 +54,7 @@
       <div class="tools-icon" @click="notificationCenterClick()">
         <img :src="`${publicPath}images/desktop/header-icon/notice.png`" alt />
       </div>
-      <div class="tools-icon">
+      <div class="tools-icon" v-show="false">
         <el-dropdown size="small" placement="bottom">
           <span class="el-dropdown-link">
             <img :src="`${publicPath}images/desktop/header-icon/user.png`" alt />
@@ -563,7 +553,7 @@
   }
 }
 .fast-path {
-  height: 310px;
+  height: 188px;
   position: absolute;
   width: 200px;
   top: 55px;
diff --git a/src/pages/desktop/index/components/ToolsEntry.vue b/src/pages/desktop/index/components/ToolsEntry.vue
index 028aa13..13c181e 100644
--- a/src/pages/desktop/index/components/ToolsEntry.vue
+++ b/src/pages/desktop/index/components/ToolsEntry.vue
@@ -45,9 +45,9 @@
 </template>
 
 <script>
-import draggable from "vuedraggable";
-import { findAllSdk } from "@/api/taskMange";
-import bus from "@/plugin/bus";
+import draggable from "vuedraggable"
+import { findAllSdk } from "@/api/taskMange"
+import bus from "@/plugin/bus"
 export default {
   name: "toolsEntry",
   data() {
@@ -67,131 +67,133 @@
       // ],
       //rowSize: 3,
       // badgeNum: 0,
-    };
+    }
   },
   computed: {
     stateDocks() {
-      return this.$store.state.desktop.docks;
+      console.log("carousels", this.$store.state.desktop.docks)
+      return this.$store.state.desktop.docks
     },
     carousels() {
-      let pages = 0;
-      let tempArr = this.stateDocks.concat(this.installedSdk);
-      let upgradeArr = tempArr.filter((item) => item.isUpgrade);
-      let arr = null;
+      let pages = 0
+      let tempArr = this.stateDocks.concat(this.installedSdk)
+      let upgradeArr = tempArr.filter((item) => item.isUpgrade)
+      let arr = null
       //鏍规嵁灞忓箷楂樺害鏉ュ垽鏂槸灞曠ず3鎺掕繕鏄�4鎺� 闃堝��:970
       if (window.innerHeight >= 930) {
         //this.rowSize = 4;
-        arr = this.chunk(tempArr, 24);
+        arr = this.chunk(tempArr, 24)
       } else {
         //this.rowSize = 3;
-        arr = this.chunk(tempArr, 18);
+        arr = this.chunk(tempArr, 18)
       }
-      return arr;
+
+      return arr
     },
     badgeNum() {
-      let tempArr = this.stateDocks.concat(this.installedSdk);
-      return tempArr.filter((item) => item.isUpgrade).length;
+      let tempArr = this.stateDocks.concat(this.installedSdk)
+      return tempArr.filter((item) => item.isUpgrade).length
     },
     rowSize() {
       if (window.innerHeight >= 930) {
-        return 4;
+        return 4
       } else {
-        return 3;
+        return 3
       }
     }
   },
   mounted() {
-    this.getAllSdk();
-    let _this = this;
+    this.getAllSdk()
+    let _this = this
     window.addEventListener("message", (e) => {
       if (e.data && e.data.msg) {
-        let msg = e.data.msg;
+        let msg = e.data.msg
         if (msg === "logout") {
-          location.assign("/");
-          return;
+          location.assign("/")
+          return
         }
         if (msg.indexOf("toSearch") >= 0) {
-          let params = msg.substring(7);
-          this.addFrameByName("search", params);
+          let params = msg.substring(7)
+          this.addFrameByName("search", params)
         }
         if (msg.indexOf("toCluster") >= 0) {
-          let params = msg.substring(8);
-          this.addFrameByName("searchForCluster", params);
+          let params = msg.substring(8)
+          this.addFrameByName("searchForCluster", params)
         }
         if (msg.indexOf("toSetting") > -1) {
-          const str = msg.split("?")[1];
-          this.addFrameByName("settings", str);
+          const str = msg.split("?")[1]
+          this.addFrameByName("settings", str)
         }
         if (msg.indexOf("toVindicate") > -1) {
-          const str = msg.split("?")[1];
-          this.addFrameByName("vindicate", str);
+          const str = msg.split("?")[1]
+          this.addFrameByName("vindicate", str)
         }
         if (msg.indexOf("toAI") > -1) {
-          const str = msg.split("?")[1];
-          this.addFrameByName("algorithmManage", str);
+          const str = msg.split("?")[1]
+          this.addFrameByName("algorithmManage", str)
         }
         if (msg.indexOf("toOpenApp") >= 0) {
-          let id = msg.substring(10);
-          this.addFrameByID(id);
+          let id = msg.substring(10)
+          this.addFrameByID(id)
         }
         if (msg.indexOf("changeBackground") > -1) {
-          const name = e.data.msg.split("?")[1];
-          _this.$emit("changeBackground", `/images/desktop/${name}.png`);
+          const name = e.data.msg.split("?")[1]
+          _this.$emit("changeBackground", `/images/desktop/${name}.png`)
         }
         if (msg == "AppUpdate") {
-          this.getAllSdk();
+          this.getAllSdk()
         }
       }
-    });
+    })
   },
   methods: {
     chunk(arr, size) {
-      size = Math.max(size, 0);
-      const len = arr == null ? 0 : arr.length;
+      size = Math.max(size, 0)
+      const len = arr == null ? 0 : arr.length
       if (!len || size < 1) {
-        return [];
+        return []
       }
-      let index = 0;
-      let resIndex = 0;
-      const result = new Array(Math.ceil(len / size));
+      let index = 0
+      let resIndex = 0
+      const result = new Array(Math.ceil(len / size))
       while (index < len) {
-        result[resIndex++] = arr.slice(index, (index += size));
+        result[resIndex++] = arr.slice(index, (index += size))
       }
-      return result;
+      return result
     },
     onJumpToDock(name) {
-      let togo;
+      let togo
       this.carousels.forEach((arr) => {
         arr.forEach((x) => {
           if (x.title == name) {
-            togo = x;
+            togo = x
           }
-        });
-      });
-      this.dockClick(togo);
+        })
+      })
+      this.dockClick(togo)
     },
     getAllSdk() {
       findAllSdk()
         .then((res) => {
-          this.installedSdk = res.data.filter((item) => item.installed);
+          this.installedSdk = res.data.filter((item) => item.installed)
         })
         .catch((e) => {
-          console.log(e);
-        });
+          console.log(e)
+        })
     },
     dockClick(dock) {
       if (dock.type === "1") {
-        window.open(dock.url);
+        window.open(dock.url)
       } else if (dock.type === "2" && !dock.isOpen) {
-        if(dock.url== "/view/debuggTool/"){
-          return true;
+        if (dock.url == "/view/debuggTool/") {
+          return true
         }
         this.$store.dispatch("desktop/addFrame", {
           id: dock.id,
           icon: dock.src,
           title: dock.title,
           url: dock.url
-        });
+        })
         this.$store.commit("desktop/addMinDock", {
           id: dock.id,
           src: dock.src,
@@ -200,44 +202,44 @@
           highlight: true,
           url: dock.url,
           screenshot: ""
-        });
+        })
         //鎵撳紑搴旂敤鍚庡紓姝ユ姄鎷�,涔嬪悗鐨勬姄鎷嶉噰鐢ㄨ繖寮犲浐瀹氱殑
         //if(dock.name=='cameraVideo'||dock.name=='search'||dock.name=='library'||dock.name=='cameraAccess'||dock.name=='dataStack'){
         setTimeout(() => {
-          this.$parent.screenShot(dock);
-        }, 1500);
+          this.$parent.screenShot(dock)
+        }, 1500)
         //}
       } else if (dock.type === "2" && dock.isOpen) {
-        this.$store.commit("desktop/resetMinFrame", dock.id);
+        this.$store.commit("desktop/resetMinFrame", dock.id)
       }
     },
     resetDockItem() {
-      const dockItems = document.getElementsByClassName("dock-item");
-      const dockMask = document.getElementsByClassName("dock-mask")[0];
+      const dockItems = document.getElementsByClassName("dock-item")
+      const dockMask = document.getElementsByClassName("dock-mask")[0]
       for (let i = 0; i < dockItems.length; i++) {
-        dockItems[i].width = 60;
+        dockItems[i].width = 60
         if (dockItems[i].parentNode.nextElementSibling) {
-          dockItems[i].parentNode.nextElementSibling.style.marginLeft = "-35px";
+          dockItems[i].parentNode.nextElementSibling.style.marginLeft = "-35px"
         }
       }
-      dockMask.style.width = dockItems.length * 60 + 40 + "px";
+      dockMask.style.width = dockItems.length * 60 + 40 + "px"
     },
     addFrameByName(name, params) {
-      let dock = null;
+      let dock = null
       this.$store.state.desktop.docks.forEach((app) => {
         if (app.name === name) {
-          dock = app;
+          dock = app
         }
-      });
+      })
       if (dock.isOpen) {
-        this.$store.dispatch("desktop/closeFrame", dock);
+        this.$store.dispatch("desktop/closeFrame", dock)
       }
       this.$store.dispatch("desktop/addFrame", {
         id: dock.id,
         icon: dock.src,
         title: dock.title,
         url: dock.url + "?" + params
-      });
+      })
       this.$store.commit("desktop/addMinDock", {
         id: dock.id,
         src: dock.src,
@@ -246,23 +248,23 @@
         highlight: true,
         url: dock.url,
         screenshot: ""
-      });
+      })
     },
     addFrameByID(id, params) {
-      let dock = null;
-      let toClose = null;
+      let dock = null
+      let toClose = null
       this.$store.state.desktop.docks.forEach((app) => {
         if (app.id == id) {
-          dock = app;
+          dock = app
         }
         if (app.name == "algorithmManage") {
-          toClose = app;
+          toClose = app
         }
-      });
-      this.dockClick(dock);
+      })
+      this.dockClick(dock)
     }
   }
-};
+}
 </script>
 
 <style lang="scss">
diff --git a/src/pages/index/App.vue b/src/pages/index/App.vue
index 6a976e0..9a4d3bc 100644
--- a/src/pages/index/App.vue
+++ b/src/pages/index/App.vue
@@ -39,7 +39,8 @@
 import formAccount from "@/pages/index/components/formAccount"
 import formNet from "@/pages/index/components/formNet"
 import formInfo from "@/pages/index/components/formInfo"
-import { getInitInfo, savePassword, initNetwork, saveRegInfo, getRegInfo, isOnNet } from "./api"
+import { tologin, getLoginUserData, getServerName } from "./api.ts"
+import { getMenuListData } from "@/api/utils"
 
 export default {
   name: "smartai init",
@@ -60,107 +61,45 @@
     }
   },
   mounted() {
-    location.assign("/view/desktop/")
-    return
-
-    this.getInitInfo()
-    let message = "缃戠粶姝e父"
-
-    function onLine(callback) {
-      var img = new Image()
-      //涓存椂鍒ゆ柇缃戠粶鏄惁閫氱晠
-      img.src = "http://apps.smartai.com/img/icons/favicon-32x32.png"
-      img.onload = function() {
-        if (callback) callback(true)
-      }
-      img.onerror = function() {
-        if (callback) callback(false)
-      }
-    }
-
-    onLine((flag) => {
-      let message = ""
-      if (flag) {
-        this.isOnline = true
-        message = "宸叉湁缃戠粶"
-      } else {
-        //缃戠粶鏂綉鏁堟灉鍥惧嚭鏉ュ悗锛屽皢姝ゅ湴鏀逛负璺宠浆璺緞鍒版晥鏋滃浘涓�
-        message = "鏃犳硶杩炴帴浜掕仈缃�"
-        this.$notify({
-          message: message
-        })
-      }
-    })
+    this.testLogin()
   },
 
   methods: {
-    preForm() {
-      if (this.active == this.createUser) {
-        return
-      }
-      this.active--
+    async testLogin() {
+      // location.assign("/view/desktop/")
+      tologin({ username: "basic", password: "basic2019" })
+        .then((json) => {
+          const loginedInfo = {
+            access_token: json.token_type + " " + json.access_token,
+            refresh_token: json.refresh_token
+          }
+          sessionStorage.setItem("expires_in", json.expires_in)
+          sessionStorage.setItem("loginedInfo", JSON.stringify(loginedInfo))
+          sessionStorage.setItem("userInfo", JSON.stringify(json.userInfo))
 
-      // 濡傛灉缃戠粶姝e父, 鐩存帴璺宠繃
-      if (this.active == this.configNet && this.isOnline) {
-        this.active--
-      }
-
-      this.$refs["carousel"].setActiveItem(this.active)
+          location.assign("/view/desktop/")
+        })
+        .catch()
     },
-    async nextForm() {
-      // 鎻愪氦娉ㄥ唽淇℃伅
-      if (this.active == this.registerInfo) {
-        const data = this.$refs[`form${this.active}`].getFormData()
-        await saveRegInfo(data)
-        location.assign("/view/login/")
-        return
+    async getLoginUserData() {
+      let res = await getLoginUserData()
+      if (res.success) {
+        sessionStorage.setItem("userInfo", JSON.stringify(res.data))
+        // 鑾峰彇鏉冮檺
+        // await this.getMenuList()
+
+        return res.data
+      } else {
       }
-
-      // 閰嶇疆缃戠粶
-      if (this.active == this.configNet) {
-        const data = this.$refs[`form${this.active}`].getFormData()
-        initNetwork(data)
-      }
-
-      // 鍒涘缓鐢ㄦ埛
-      if (this.active == this.createUser) {
-        const data = this.$refs[`form${this.active}`].getFormData()
-        if (!data) {
-          return false
-        }
-
-        await savePassword(data)
-
-        // 濡傛灉缃戠粶姝e父, 鐩存帴璺冲埌绗笁閮�
-        if (this.isOnline) {
-          this.active++
-        }
-      }
-
-      this.active++
-      this.$refs["carousel"].setActiveItem(this.active)
     },
-    async nextFormNot() {
-      await this.getInitInfo()
-
-      this.active++
-      this.$refs["carousel"].next()
-    },
-    async getInitInfo() {
-      const res = await getInitInfo().catch((err) => {
-        this.isWhite = false
-      })
-
-      if (res.data && res.data.initPwd && !res.data.initRegInfo) {
-        this.active = this.isOnline ? this.registerInfo : this.configNet
+    async getMenuList() {
+      let results = await getMenuListData({})
+      if (results && results.success) {
+        /* 瀛樺偍鏉冮檺 */
+        let buttonAuthoritys = results.data
+        sessionStorage.setItem("buttonAuthoritys", "," + buttonAuthoritys + ",")
+        sessionStorage.setItem("menuInfo", JSON.stringify(results))
       }
-
-      if (res.data && res.data.initPwd && res.data.initRegInfo) {
-        location.assign("/view/login/")
-        return
-      }
-
-      this.isWhite = false
     }
   }
 }
diff --git a/src/pages/index/api.ts b/src/pages/index/api.ts
index e4d8eff..88b652a 100644
--- a/src/pages/index/api.ts
+++ b/src/pages/index/api.ts
@@ -1,24 +1,23 @@
-import request from '@/scripts/httpRequest'
-import qs from 'qs'
+import request from "@/scripts/httpRequest"
+import qs from "qs"
 
- //鑾峰彇鏄惁淇濆瓨杩囩敤鎴峰悕瀵嗙爜 浠ュ強鏄惁淇濆瓨杩囨敞鍐屼俊鎭�
+//鑾峰彇鏄惁淇濆瓨杩囩敤鎴峰悕瀵嗙爜 浠ュ強鏄惁淇濆瓨杩囨敞鍐屼俊鎭�
 export const getInitInfo = (query: any) => {
   return request({
     url: "/data/api-v/sysinit/getInitInfo",
     method: "get",
     params: query
-  });
-};
+  })
+}
 
 //鑾峰彇娉ㄥ唽淇℃伅
 export const getRegInfo = (query: any) => {
   return request({
-    url: "/data/api-v/sysinit/getRegInfo" ,
+    url: "/data/api-v/sysinit/getRegInfo",
     method: "get",
     params: query
-  });
-};
-
+  })
+}
 
 //鑾峰彇缃戝崱鍒楄〃
 export const networkList = (query: any) => {
@@ -26,9 +25,8 @@
     url: "/data/api-v/sysinit/networkList",
     method: "get",
     params: query
-  });
-};
-
+  })
+}
 
 //淇濆瓨鐢ㄦ埛鍚嶅瘑鐮�
 export const savePassword = (data: any) => {
@@ -36,9 +34,8 @@
     url: "/data/api-v/sysinit/savePassword",
     method: "post",
     data
-  });
-};
-
+  })
+}
 
 //鍒濆鍖栫綉缁�
 export const initNetwork = (data: any) => {
@@ -46,30 +43,92 @@
     url: "/data/api-v/sysinit/initNetwork",
     method: "post",
     data
-  });
-};
+  })
+}
 
 //淇濆瓨娉ㄥ唽淇℃伅
 export const saveRegInfo = (data: any) => {
   return request({
-    url:  "/data/api-v/sysinit/saveRegInfo" ,
+    url: "/data/api-v/sysinit/saveRegInfo",
     method: "post",
     data
-  });
-};
+  })
+}
 
 export const getList = (query: any) => {
   return request({
     url: "/data/api-v/gb28181/findAreaByParentId",
     method: "get",
     params: query
-  });
-};
+  })
+}
 
 export const isOnNet = (query: any) => {
   return request({
     url: "http://apps.smartai.com/data/api-u/user/login",
     method: "get",
     params: query
-  });
-};
\ No newline at end of file
+  })
+}
+
+// 鐧诲綍
+export const tologin = (query: any) => {
+  // let query = 'username=' + user.loginName + '&password=' + user.password
+  return request({
+    url: "/data/api-u/sys/login",
+    method: "post",
+    data: qs.stringify(query)
+  })
+}
+
+// 閫�鍑�
+export const logout = () => {
+  return request({
+    url: "/data/api-u/sys/logout",
+    method: "get"
+  })
+}
+
+// 鑾峰彇鐢ㄦ埛淇℃伅
+// export const getLoginUserData = () => {
+//   let token =
+//     sessionStorage.getItem('loginedInfo') &&
+//     JSON.parse(sessionStorage.getItem('loginedInfo')).access_token
+//   return request({
+//     url: '/data/api-u/users/current',
+//     method: 'get',
+//     headers: {
+//       'Content-Type': 'application/x-www-form-urlencoded',
+//       Authorization: token || ''
+//     }
+//   })
+// }
+
+export const getLoginUserData = () => {
+  let token = sessionStorage.getItem("loginedInfo") && JSON.parse(sessionStorage.getItem("loginedInfo")).access_token
+  return request({
+    url: "/data/api-u/users/profile",
+    method: "get",
+    headers: {
+      "Content-Type": "application/x-www-form-urlencoded",
+      Authorization: token || ""
+    }
+  })
+}
+
+//淇敼瀵嗙爜
+export const updatePwd = (query: any) => {
+  return request({
+    url: "/data/api-u/users/updatePwd",
+    method: "post",
+    data: qs.stringify(query)
+  })
+}
+
+//鑾峰彇椤圭洰鍚嶇О
+export const getServerName = (query: any) => {
+  return request({
+    url: "/data/api-v/info/getServerName",
+    method: "get"
+  })
+}
diff --git a/src/pages/settings/index/index.vue b/src/pages/settings/index/index.vue
index e9c7648..cb6f2ae 100644
--- a/src/pages/settings/index/index.vue
+++ b/src/pages/settings/index/index.vue
@@ -732,9 +732,9 @@
     const menu = getUrlKey("menu")
     if (menu) {
       this.showWelcome = false
-      this.activeIndex = this.menuArr.findIndex((x) => x.name == menu)
+      this.activeIndex = menu
       this.$nextTick(() => {
-        this.$refs.view_3.openRight(2)
+        this.$refs[menu].openRight(2)
       })
     }
     this.fetchUserList()

--
Gitblit v1.8.0