From ccee429d379e0108b7445f72ade8d97c110a6fb3 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期二, 09 十一月 2021 18:01:59 +0800
Subject: [PATCH] 问题修复

---
 src/pages/systemSettings/index/App.vue |  303 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 217 insertions(+), 86 deletions(-)

diff --git a/src/pages/systemSettings/index/App.vue b/src/pages/systemSettings/index/App.vue
index e5988b4..ef71b7c 100644
--- a/src/pages/systemSettings/index/App.vue
+++ b/src/pages/systemSettings/index/App.vue
@@ -1,12 +1,12 @@
 <template>
-  <div class="container">
+  <div class="container" v-if="!showWelcome">
     <div class="container-left">
       <div
         class="left-card"
         :class="activeIndex == index ? 'left-card-active' : ''"
         v-for="(item, index) in menuArr"
         :key="index"
-        @click="openMenu(item, index)"
+        @click="openMenu(item.name, index)"
       >
         <span class="icon iconfont">&#xe646;</span>
         <span class="card-text">{{ item.name }}</span>
@@ -30,13 +30,10 @@
             <div class="touxiang">
               <img
                 v-if="item.headpic"
-                :src="
-                  item.headpic.indexOf('http') > -1
-                    ? item.headpic
-                    : 'http://' + item.headpic
-                "
+                :src="`data:image/png;base64,${item.headpic}`"
                 alt=""
               />
+              
             </div>
             <span class="user-name">{{ item.username }}</span>
           </div>
@@ -57,7 +54,6 @@
             <span class="week">{{ weekday }}</span>
           </div>
         </div>
-
         <div class="line">
           <div class="name">NTP鏍℃椂</div>
           <el-switch
@@ -92,11 +88,7 @@
             <div class="touxiang-big">
               <img
                 v-if="activeAccountItem.headpic"
-                :src="
-                  activeAccountItem.headpic.indexOf('http') > -1
-                    ? activeAccountItem.headpic
-                    : 'http://' + activeAccountItem.headpic
-                "
+                :src="`data:image/png;base64,${activeAccountItem.headpic}`"
                 alt=""
               />
             </div>
@@ -143,7 +135,6 @@
 
         <div class="change-pw" v-if="inAccountDetail && isChangePw">
           <div class="title">淇敼瀵嗙爜</div>
-
           <el-form
             :model="passwordForm"
             :rules="pwRules"
@@ -177,7 +168,7 @@
             </el-form-item>
           </el-form>
           <div class="btns">
-            <div class="cancel" @click="cancelChangePassword">鍙栨秷</div>
+            <div class="cancel" @click="cancelPassword">鍙栨秷</div>
             <div class="ok" @click="SaveNewPassword('passwordForm')">淇濆瓨</div>
           </div>
         </div>
@@ -224,23 +215,30 @@
             <div
               class="upload-jpg"
               :class="
-                selectedPic == index && url !== '' ? 'upload-jpg-mask' : ''
+                selectedPic == index? 'upload-jpg-border' : ''
               "
-              v-for="(url, index) in jpgArr"
+              v-for="(item, index) in jpgArr"
               :key="index"
-              @click="pickHeadDefPic(url, index)"
+              @click="pickHeadDefPic(item, index)"
             >
-              <img v-if="url !== ''" :src="url" alt="" srcset="" />
+              <img
+                v-if="item"
+                :src="`data:image/png;base64,${item.path}`"
+                alt=""
+                srcset=""
+              />
+              <div class="img-mask" v-if="selectedPic == index">
+                <span class="icon iconfont enable">&#xe62a;</span>
+              </div>
             </div>
-
-            <el-upload
+            <!-- <el-upload
               class="upload-demo"
               action="https://jsonplaceholder.typicode.com/posts/"
               :show-file-list="false"
               :http-request="uploadUserPic"
             >
-              <div class="upload-jpg-up">涓婁紶</div>
-            </el-upload>
+              <div v-if="loadedPic == ''" class="upload-jpg-up">涓婁紶</div>
+            </el-upload> -->
           </div>
           <div class="fill-group">
             <el-form
@@ -255,6 +253,17 @@
                   placeholder="蹇呭~"
                   v-model="addForm.userName"
                 ></el-input>
+              </el-form-item>
+              <el-form-item prop="roleId">
+                <div class="p-title">瑙掕壊锛�</div>
+                <el-select v-model="addForm.roleId" placeholder="璇烽�夋嫨瑙掕壊">
+                  <el-option
+                    v-for="(item, i) in roleList"
+                    :key="i"
+                    :label="item.name"
+                    :value="item.id"
+                  ></el-option>
+                </el-select>
               </el-form-item>
               <el-form-item prop="nickName">
                 <div class="p-title">鏄电О锛�</div>
@@ -461,7 +470,7 @@
         </div>
 
         <div class="btns">
-          <div class="cancel" @click="cancelChangePassword">鍙栨秷</div>
+          <div class="cancel" @click="cancelPassword">鍙栨秷</div>
           <div class="ok" @click="submitClock">淇濆瓨</div>
         </div>
       </div>
@@ -484,6 +493,44 @@
       style="width: 100%"
     ></generalSettings>
   </div>
+  <div class="welcome-page" v-else>
+    <div class="child" @click="openWelcome('璐︽埛',0)">
+      <div class="child-info">
+        <span class="icon iconfont welcome-icon">&#xe6de;</span>
+        <span class="welcome-title">璐︽埛</span>
+      </div>
+    </div>
+    <div class="child"  @click="openWelcome('鏃ユ湡鏃堕棿',1)">
+      <div class="child-info">
+        <span class="icon iconfont welcome-icon">&#xe6ff;</span>
+        <span class="welcome-title">鏃ユ湡鏃堕棿</span>
+      </div>
+    </div>
+    <div class="child"  @click="openWelcome('闆嗙兢绠$悊',2)">
+      <div class="child-info">
+        <span class="icon iconfont welcome-icon">&#xe6df;</span>
+        <span class="welcome-title">闆嗙兢绠$悊</span>
+      </div>
+    </div>
+    <div class="child"  @click="openWelcome('缃戠粶璁剧疆',3)">
+      <div class="child-info">
+        <span class="icon iconfont welcome-icon">&#xe6dd;</span>
+        <span class="welcome-title">缃戠粶璁剧疆</span>
+      </div>
+    </div>
+    <div class="child"  @click="openWelcome('閿洏鍜岃瑷�',4)">
+      <div class="child-info">
+        <span class="icon iconfont welcome-icon">&#xe6dc;</span>
+        <span class="welcome-title">閿洏鍜岃瑷�</span>
+      </div>
+    </div>
+    <div class="child"  @click="openWelcome('閫氱敤璁剧疆',5)">
+      <div class="child-info">
+        <span class="icon iconfont welcome-icon">&#xe6db;</span>
+        <span class="welcome-title">閫氱敤璁剧疆</span>
+      </div>
+    </div>
+  </div>
 </template>
 
 <script>
@@ -498,6 +545,7 @@
   deleteUser,
   getUserMenus,
   defHeadPics,
+  getRoles,
 } from "@/api/user";
 import switchBar from "../components/switchBar";
 import ipInput from "@/components/subComponents/IPInput";
@@ -540,6 +588,7 @@
       activeAccountItem: {},
       syncMonth: "",
       syncHour: "",
+      showWelcome: true,
       syncDay: "",
       syncMin: "",
       syncSec: "00",
@@ -559,6 +608,7 @@
       showMonthInput: false,
       selectedPic: null,
       showDayInput: false,
+      loadedPic: "",
       cameraInfo: false,
       dependentScene: false,
       timestamp: 0,
@@ -570,6 +620,7 @@
       syncType: "1",
       equipmentTime: "",
       equipmentDate: "",
+      roleList: [],
       ntpTestLoading: false,
       settime: "",
       weekday: "",
@@ -582,7 +633,7 @@
         { name: "閫氱敤璁剧疆" },
       ],
       accountArr: [],
-      jpgArr: ["", "", "", "", "", "", "", "", ""],
+      jpgArr: [],
       isManual: false,
       isNtp: true,
       activePage: "璐︽埛",
@@ -608,6 +659,7 @@
         password: "",
         headpic: "",
         confirmPassword: "",
+        roleId: "",
       },
       rules: {
         userName: [
@@ -620,21 +672,21 @@
           },
         ],
         password: [
-            { required: true, message: '璇疯緭鍏ュ瘑鐮�', trigger: 'blur' },
-            { min: 6, message: '闀垮害鑷冲皯涓� 6 浣�', trigger: 'blur' }
-          ],
+          { required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" },
+          { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" },
+        ],
         confirmPassword: [{ validator: validatePass2, trigger: "blur" }],
       },
       pwRules: {
         // pw: [{ validator: validatePass3, trigger: "blur" }],
-         curPassword: [
-            { required: true, message: '璇疯緭鍏ュ瘑鐮�', trigger: 'blur' },
-            { min: 6, message: '闀垮害鑷冲皯涓� 6 浣�', trigger: 'blur' }
-          ],
+        curPassword: [
+          { required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" },
+          { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" },
+        ],
         newPassword: [
-            { required: true, message: '璇疯緭鍏ュ瘑鐮�', trigger: 'blur' },
-            { min: 6, message: '闀垮害鑷冲皯涓� 6 浣�', trigger: 'blur' }
-          ],
+          { required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" },
+          { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" },
+        ],
         confirmPassword: [{ validator: validatePass4, trigger: "blur" }],
       },
     };
@@ -650,9 +702,7 @@
   methods: {
     fetchDefHeadPic() {
       defHeadPics().then((res) => {
-        res.data.slice(0, 5).forEach((x, i) => {
-          this.jpgArr[i] = x;
-        });
+        this.jpgArr = res.data;
       });
     },
     fetchUserList(showLast = false) {
@@ -660,12 +710,12 @@
         this.accountArr = res.data;
         if (this.accountArr.length) {
           this.activeAccountItem = this.accountArr[0];
+          this.activeAccountIndex = 0;
         }
         if (showLast) {
           this.cancelAdd();
           const lastIdx = this.accountArr.length - 1;
           this.openAccount(this.accountArr[lastIdx], lastIdx);
-          
         }
       });
     },
@@ -691,6 +741,8 @@
       this.activeAccountItem = item;
       this.activeAccountIndex = i;
       this.inAccountDetail = false;
+      this.cancelSet();
+      this.fetchMenu();
     },
     minusOne(typ) {
       this.isSyncBrowser = false;
@@ -749,18 +801,12 @@
     },
     fatherChange(item) {
       item.children.forEach((x) => {
-        x.selected = false;
+        x.selected = item.selected;
       });
     },
     childrenChange(item) {
       let isAllSelected = item.children.every((x) => x.selected == true);
-      let isAllNotSelected = item.children.every((x) => x.selected == false);
-      if (isAllSelected) item.selected = true;
-      if (isAllNotSelected) item.selected = false;
-    },
-    getMaxDay() {
-      const maxDay = new Date(+this.syncYrs, +this.syncMonth, 0).getDate();
-      if (this.syncDay > maxDay) this.syncDay = maxDay;
+      item.selected = isAllSelected;
     },
     plusOne(typ) {
       this.isSyncBrowser = false;
@@ -862,7 +908,10 @@
         id: this.activeAccountItem.id,
         menuIds: arr,
       }).then((res) => {
-        res.data;
+        if (res.success) {
+          this.$message.success(res.msg);
+          this.cancelSet();
+        }
       });
     },
     formatTime(number, format) {
@@ -889,14 +938,14 @@
       n = n.toString();
       return n[1] ? n : "0" + n;
     },
-    uploadUserPic(params) {
-      let param = new FormData();
-      param.append("file", params.file);
-      uploadHeadPic(param).then((res) => {
-        let index = this.jpgArr.findIndex((x) => x == "");
-        this.$set(this.jpgArr, index, res.data);
-      });
-    },
+    // uploadUserPic(params) {
+    //   let param = new FormData();
+    //   param.append("file", params.file);
+    //   uploadHeadPic(param).then((res) => {
+    //     this.jpgArr.push(res.data);
+    //     this.loadedPic = res.data;
+    //   });
+    // },
     initClockConf(ntpTest = false) {
       getClockInfo().then((rsp) => {
         if (rsp && rsp.success) {
@@ -918,12 +967,16 @@
         }
       });
     },
-    openMenu(item, i) {
-      this.activePage = item.name;
+    openMenu(name, i) {
+      this.activePage = name;
       this.activeIndex = i;
       if (this.activePage == "鏃ユ湡鏃堕棿") {
         this.initClockConf();
       }
+    },
+    openWelcome(name,i){
+      this.showWelcome = false
+      this.openMenu(name,i)
     },
     showInput(typ) {
       this[`show${typ}Input`] = true;
@@ -939,7 +992,7 @@
       this[`input${typ}`] = "";
     },
     syncBrowser(enable) {
-      this.isSyncBrowser = val;
+      this.isSyncBrowser = enable;
       if (!enable) {
         clearInterval(this.browserTimer);
       } else {
@@ -955,15 +1008,22 @@
     showAddAccount() {
       this.inAccountDetail = false;
       this.isAddAccount = true;
+      getRoles().then((res) => {
+        if (res.success) {
+          this.roleList = res.data;
+        }
+      });
     },
     cancelAdd() {
       this.inAccountDetail = false;
       this.isAddAccount = false;
+      this.$refs["addForm"].resetFields();
+      this.selectedPic = null;
     },
-    cancelChangePassword() {
+    cancelPassword() {
       this.isChangePw = false;
       this.inAccountDetail = false;
-      this.$refs['passwordForm'].resetFields()
+      this.$refs["passwordForm"].resetFields();
     },
     SaveNewPassword(formName) {
       this.$refs[formName].validate((valid) => {
@@ -973,7 +1033,10 @@
             newPwd: this.passwordForm.newPassword,
           }).then(
             (res) => {
-              this.$message.success(res.data);
+              if (res.success) {
+                this.$message.success(res.msg);
+                this.cancelPassword();
+              }
             },
             (err) => {
               this.$message.warning("淇濆瓨澶辫触锛�" + err.msg);
@@ -1006,8 +1069,8 @@
         }
       });
     },
-    pickHeadDefPic(url, i) {
-      this.addForm.headpic = url;
+    pickHeadDefPic(item, i) {
+      this.addForm.headpic = item.path;
       this.selectedPic = i;
     },
     testNTP() {
@@ -1039,6 +1102,7 @@
     cancelSet() {
       this.isSetPermission = false;
       this.inAccountDetail = false;
+      this.sysMenus = [];
     },
     showChangePassword() {
       this.isChangePw = true;
@@ -1086,10 +1150,11 @@
     openPermission() {
       this.inAccountDetail = true;
       this.isSetPermission = true;
-      this.fetchMenu();
+      if (this.sysMenus.length == 0) {
+        this.fetchMenu();
+      }
     },
     parseTime() {
-      debugger;
       [this.syncYrs, this.syncMonth, this.syncDay] = this.equipmentDate.split(
         "-"
       );
@@ -1116,6 +1181,50 @@
 };
 </script>
 <style lang="scss">
+.welcome-page {
+  width: 100%;
+  height: 100%;
+  background-color: #f5f5f5;
+  display: -ms-flexbox;
+  padding: 0 50px;
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+  .child {
+    box-sizing: border-box;
+    background-color: white;
+    -webkit-box-flex: 0;
+    -ms-flex: 0 0 33.3%;
+    /* flex: 0 0 16%; */
+    float: left;
+    width: 250px;
+    height: 200px;
+    margin: 50px 57px 30px 57px;
+    border-radius: 20px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    cursor: pointer;
+    .child-info {
+      display: flex;
+      flex-direction: column;
+      height: 62%;
+      justify-content: space-around;
+      .welcome-icon {
+        font-size: 72px;
+      }
+      .welcome-title {
+        font-size: 18px;
+      }
+    }
+  }
+  .child:hover {
+    -moz-box-shadow: 5px 5px 10px #ddd;
+    -webkit-box-shadow: 5px 5px 10px #ddd;
+    box-shadow: 5px 5px 10px #ddd;
+    transform: translate3d(0,-2.5px,0);
+     transition: all 0.3s;
+}
+}
 .container {
   height: 100%;
   display: flex;
@@ -1125,7 +1234,7 @@
   box-sizing: border-box;
   .container-left {
     height: 100%;
-    width: 210px;
+     width: 230px;
     overflow: auto;
     box-sizing: border-box;
     flex-shrink: 0;
@@ -1168,8 +1277,7 @@
     .account-left {
       .add-account {
         color: rgba(61, 104, 225, 1);
-        margin-top: 50px;
-
+        margin-top: 30px;
         .iconfont {
           cursor: pointer;
           font-size: 32px;
@@ -1298,7 +1406,7 @@
               margin: 5px 15px;
               height: 30px;
               line-height: 30px;
-              width: 90px;
+              // width: 90px;
               text-align: left;
               font-size: 15px;
               display: flex;
@@ -1320,6 +1428,7 @@
             .user-role {
               margin: 5px 0 0 15px;
               font-size: 14px;
+              color: darkseagreen;
             }
           }
         }
@@ -1400,49 +1509,71 @@
 
       .add-account-page {
         .upload-group {
-          height: 130px;
+          height: 120px;
           width: 360px;
           margin: 0 auto;
           overflow: hidden;
           .upload-jpg {
-            height: 46px;
-            width: 46px;
+            position: relative;
+            height: 48px;
+            width: 48px;
             float: left;
             margin: 0 10px;
-            margin-bottom: 20px;
+            margin-bottom: 10px;
             background-color: rgba(242, 242, 242, 1);
-            border: 3px solid transparent;
+            border: 2px solid transparent;
             border-radius: 50%;
             cursor: pointer;
             img {
-              height: 46px;
-              width: 46px;
+              height: 48px;
+              width: 48px;
+              border-radius: 50%;
+            }
+            .img-mask {
+              position: absolute;
+              left: 0;
+              top: 0;
+              height: 48px;
+              width: 48px;
+              background-color: rgba(0, 0, 0, 0.3);
+              color: white;
+              border-radius: 50%;
+              display: flex;
+              justify-content: center;
+              align-items: center;
+              .selected {
+                font-size: 22px;
+              }
             }
           }
-          .upload-jpg-mask {
-            border: 3px solid blue;
+          .upload-jpg-border {
+            border: 2px solid cornflowerblue;
           }
           .upload-jpg-up {
-            height: 52px;
-            width: 52px;
+            height: 48px;
+            width: 48px;
             float: left;
             display: flex;
             background-color: rgba(242, 242, 242, 1);
-            margin: 0 10px;
-            margin-bottom: 20px;
-            border-radius: 25px;
+            border: 2px solid transparent;
+            border-radius: 50%;
+
             justify-content: center;
             align-items: center;
             font-size: 12px;
             cursor: pointer;
           }
-          .loaded-Pic {
-          }
         }
         .fill-group {
           .p-title {
+            height: 34px;
             text-align: left;
           }
+          .el-form-item {
+            .el-select {
+              width: 100%;
+            }
+          }
         }
       }
     }

--
Gitblit v1.8.0