zhangzengfei
2022-07-20 4a800a8fc83c6bd1f86a8e847b079a51a7532c09
src/pages/settings/index/index.vue
@@ -16,7 +16,12 @@
    <div class="container-center" v-if="activeIndex == 0">
      <div class="account-left" v-if="activeIndex == 0">
        <div class="account-list">
        <div
          class="account-list"
          :class="{ 'account-list-scroll': account_list_scroll }"
          @mouseenter="account_list_scroll = true"
          @mouseleave="account_list_scroll = false"
        >
          <div
            class="account-card"
            :class="activeAccountIndex == index ? 'account-card-active' : ''"
@@ -72,7 +77,6 @@
                <span class="enable" v-if="!showJPGArr" @click="editHeadPic"
                  >编辑头像</span
                >
              </div>
            </div>
            <div class="user-desc">
@@ -212,35 +216,6 @@
        <div class="permission" v-if="inAccountDetail && isSetPermission">
          <div class="title">权限管理</div>
          <!-- <div class="line-wrap" v-for="item in sysMenus" :key="item.id">
            <div class="line">
              <div class="name">{{ item.name }}</div>
              <el-switch
                v-model="item.selected"
                active-color="rgba(61, 104, 225, 1)"
                @change="fatherChange(item)"
              >
              </el-switch>
            </div>
            <div v-if="item.children">
              <div
                class="line"
                style="margin-left: 55px"
                v-for="x in item.children"
                :key="x.id"
              >
                <div class="name">{{ x.name }}</div>
                <el-switch
                  v-model="x.selected"
                  active-color="rgba(61, 104, 225, 1)"
                  @change="childrenChange(item)"
                >
                </el-switch>
              </div>
            </div>
          </div> -->
          <!--    -->
          <div class="tree-window">
            <el-tree
              ref="treeMenus"
@@ -601,8 +576,11 @@
      style="width: 100%"
      ref="view_6"
    ></deviceInfo>
    <Authorization v-if="activeIndex == 7" style="width: 100%" ref="view_7">
    </Authorization>
    <WebManage v-if="activeIndex == 8"></WebManage>
  </div>
  <div class="welcome-page" v-else ref="curPage">
  <div class="welcome-page" v-else ref="curPage" @mouseup="mouseDownIndex = ''">
    <div
      class="search-box"
      :class="showRecomand ? 'border-change' : ''"
@@ -614,7 +592,6 @@
        size="mini"
        @focus="showRecomand = true"
        clearable
        @input="filterRecomand"
        :suffix-icon="showRecomand && searchText.length ? '' : 'el-icon-search'"
        v-model="searchText"
      >
@@ -639,6 +616,8 @@
      <div
        class="nav-child"
        @click="openWelcome(i)"
        @mousedown="mouseDownIndex = i"
        :class="mouseDownIndex === i ? 'nav-child-active' : ''"
        v-for="(item, i) in menuArr"
        :key="i"
      >
@@ -671,6 +650,8 @@
import deviceInfo from "../views/deviceInfo";
import keyboardLanguage from "../views/keyboardLanguage";
import generalSettings from "../views/generalSettings";
import Authorization from "../views/Authorization";
import WebManage from "@/pages/settings/components/WebManage";
import { pad0, getUrlKey } from "@/api/utils";
export default {
@@ -683,6 +664,8 @@
    keyboardLanguage,
    generalSettings,
    deviceInfo,
    Authorization,
    WebManage,
  },
  data() {
    var v2 = (rule, value, callback) => {
@@ -761,7 +744,6 @@
      selectedPic: null,
      showDayInput: false,
      timestamp: 0,
      ajustType: "手动校时",
      inAccountDetail: false,
      isChangePw: false,
      isSetPermission: false,
@@ -824,6 +806,20 @@
          blackIcon: "/images/settings/黑色一级icon/设备信息.png",
          whiteIcon: "/images/settings/白色一级icon/设备信息.png",
        },
        {
          name: "授权管理",
          icon: "\ue7e9;",
          imgUrl: "/images/settings/授权管理.png",
          blackIcon: "/images/settings/黑色一级icon/授权管理.png",
          whiteIcon: "/images/settings/白色一级icon/授权管理.png",
        },
        {
          name: "域名管理",
          icon: "\ue6db",
          imgUrl: "/images/settings/通用设置.png",
          blackIcon: "/images/settings/黑色一级icon/通用设置.png",
          whiteIcon: "/images/settings/白色一级icon/通用设置.png",
        },
      ],
      accountArr: [],
      jpgArr: [],
@@ -833,6 +829,7 @@
      inputHour: "",
      inputMin: "",
      inputSec: "",
      mouseDownIndex: "",
      inputYrs: "",
      showInputNickName: false,
      inputMonth: "",
@@ -878,22 +875,26 @@
        ],
        confirmPassword: [{ validator: v4, trigger: "blur" }],
      },
      account_list_scroll: false,
    };
  },
  created(){
  let color = localStorage.getItem('--colorCard')
    if(color) {
      document.documentElement.style.setProperty('--colorCard',`${color}`)
    }
  created() {
    let color = localStorage.getItem("--colorCard");
    if (color) {
      document.documentElement.style.setProperty("--colorCard", `${color}`);
    }
  },
  beforeDestroy() {
    clearTimeout(this.clockTimer);
    clearInterval(this.browserTimer);
    // if (this.$refs.curPage) {
    //   this.$refs.curPage.removeEventListener("click");
    // }
  },
  mounted() {
    // 返回按钮回调
    window.addEventListener("message", (e) => {
      if (e.data.msg === "返回系统设置") {
        this.showWelcome = true;
      }
    });
    const menu = getUrlKey("menu");
    if (menu) {
      this.showWelcome = false;
@@ -1159,15 +1160,7 @@
        }
      );
    },
    // flatCheckedArr(arr, res) {
    //   for (const item of arr) {
    //     if (item.selected) res.push(item.id);
    //     if (item.children) this.flatCheckedArr(item.children, res);
    //   }
    // },
    saveAuth() {
      // let arr = [];
      // this.flatCheckedArr(this.sysMenus, arr);
      updataUser({
        id: this.activeAccountItem.id,
        menuIds: this.$refs.treeMenus.getCheckedKeys(),
@@ -1478,26 +1471,21 @@
      }
    },
    parseTime() {
      [this.syncYrs, this.syncMonth, this.syncDay] = this.equipmentDate.split(
        "-"
      );
      [this.syncHour, this.syncMin, this.syncSec] = this.equipmentTime.split(
        ":"
      );
      [this.syncYrs, this.syncMonth, this.syncDay] =
        this.equipmentDate.split("-");
      [this.syncHour, this.syncMin, this.syncSec] =
        this.equipmentTime.split(":");
    },
    // changeSwitch(str) {
    //   if (str == "isNtp") {
    //     this.isManual = !this[str];
    //   } else {
    //     this.isNtp = !this[str];
    //   }
    //   this.syncType = this.isNtp ? "1" : "2";
    //   if (this.isManual) this.parseTime();
    // },
  },
  computed: {
    activeUserRole() {
      return this.activeAccountItem.sysRoles[0].name;
      if (
        this.activeAccountItem.sysRoles &&
        this.activeAccountItem.sysRoles.length
      ) {
        return this.activeAccountItem.sysRoles[0].name;
      }
      return "普通用户";
    },
    curUserRole() {
      const info = JSON.parse(sessionStorage.getItem("userInfo"));
@@ -1516,6 +1504,10 @@
      return false;
    },
    isShowPermitBtn() {
      // basic 用户不允许修改权限
      if (this.activeUserRole == "超级管理员") {
        return false;
      }
      if (this.curUserRole == "管理员") {
        return this.activeUserRole == "普通用户";
      } else {
@@ -1532,6 +1524,27 @@
      }
    },
  },
  watch: {
    showWelcome(newVal) {
      if (newVal) {
        // 隐藏返回按按钮
        window.parent.postMessage(
          {
            msg: "hiddenBack",
          },
          "*"
        );
      } else {
        //显示返回按钮
        window.parent.postMessage(
          {
            msg: "showBack",
          },
          "*"
        );
      }
    },
  },
};
</script>
<style lang="scss">
@@ -1544,7 +1557,7 @@
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  .border-change {
    border-radius: 20px !important;
    border-radius: 15px !important;
  }
  .search-box {
    width: 332px;
@@ -1552,12 +1565,15 @@
    position: fixed;
    left: calc(50% - 166px);
    top: 50px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid var(--colorCard);
    box-sizing: border-box;
    backdrop-filter: blur(4px);
    border-radius: 40px;
    .search-res {
      background-color: rgba(255, 255, 255, 0.5);
    }
    .search-input {
      font-size: 14px;
      .el-input--mini .el-input__inner {
@@ -1585,6 +1601,31 @@
        transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
        width: 100%;
        font-weight: bold;
        &::-webkit-input-placeholder {
          /* WebKit browsers */
          color: #828282;
          font-weight: normal;
          font-size: 14px;
        }
        &:-moz-placeholder {
          /* Mozilla Firefox 4 to 18 */
          color: #828282;
          font-weight: normal;
          font-size: 14px;
        }
        &::-moz-placeholder {
          /* Mozilla Firefox 19+ */
          color: #828282;
          font-weight: normal;
          font-size: 14px;
        }
        &:-ms-input-placeholder {
          /* Internet Explorer 10+ */
          color: #828282;
          font-weight: normal;
          font-size: 14px;
        }
      }
      .el-input__suffix {
        display: flex;
@@ -1613,7 +1654,7 @@
        text-align: left;
        box-sizing: border-box;
        padding: 0 20px;
        color: #333333;
        color: #4f4f4f;
        font-size: 14px;
        cursor: pointer;
      }
@@ -1623,7 +1664,7 @@
        text-align: left;
        box-sizing: border-box;
        padding: 0 20px;
        color: #333333;
        color: #4f4f4f;
        font-size: 14px;
      }
      .res-bar:hover {
@@ -1634,6 +1675,8 @@
    }
  }
  .nav-items {
    max-width: 960px;
    margin: 0 auto;
    .nav-child {
      box-sizing: border-box;
      background-color: rgba(251, 251, 255, 0.1);
@@ -1648,6 +1691,15 @@
      justify-content: center;
      align-items: center;
      cursor: pointer;
      border: 2px solid #f2f2f7;
      &-active {
        border: 2px solid #4e94ff;
      }
      &:hover {
        background: #f2f2f7;
      }
      .child-info {
        display: flex;
@@ -1659,18 +1711,17 @@
        img {
          width: 64px;
          margin: 0 auto;
          margin-top: 65px;
          margin-top: 61px;
          height: 50px;
        }
        .welcome-title {
          font-size: 16px;
          font-weight: bold;
          margin-top: 24px;
          color: #333333;
          color: #4f4f4f;
        }
      }
    }
  }
}
.container {
@@ -1681,7 +1732,9 @@
  flex-basis: auto;
  box-sizing: border-box;
  background-color: #fff;
  border-top: 1px solid #e1e0e6;
  color: #4f4f4f;
  border-top: 2px solid #e1e0e6;
  overflow-x: hidden;
  .container-left {
    height: 100%;
    width: 244px;
@@ -1694,22 +1747,22 @@
      height: 56px;
      cursor: pointer;
      border-radius: 8px;
      margin-bottom: 10px;
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      padding: 0 20px;
      .card-text {
        margin-left: 20px;
        color: #333333;
        color: #4f4f4f;
        font-weight: bold;
        font-size: 16px;
        line-height: 22px;
        height: 22px;
      }
      img {
        height: 40px;
        width: 40px;
        height: 30px;
        width: 30px;
      }
      .w {
        display: none;
@@ -1740,15 +1793,33 @@
    overflow: auto;
    flex-shrink: 0;
    padding: 10px;
    border-right: 4px solid #f2f2f7;
    padding-top: 6px;
    padding-right: 5px;
    border-top: 4px solid #f2f2f7;
    border-left: 4px solid #f2f2f7;
    box-sizing: border-box;
    background-color: #fbfaff;
    border-left: 4px solid #f2f2f7;
    .account-left {
      height: 100%;
      .account-list {
        height: calc(85%);
        overflow: auto;
        padding-right: 5px;
        &::-webkit-scrollbar-track,
        &::-webkit-scrollbar-thumb {
          visibility: hidden;
        }
        &::-webkit-scrollbar {
          background-color: #fff;
        }
        &.account-list-scroll::-webkit-scrollbar-thumb,
        &.account-list-scroll::-webkit-scrollbar-track {
          visibility: visible;
        }
        &.account-list-scroll::-webkit-scrollbar {
          background-color: #f5f5f5;
        }
      }
      .add-account {
        color: var(--colorCard);
@@ -1785,7 +1856,7 @@
          height: 19.21px;
          background: #ffffff;
          border-radius: 20px;
          color: #333333;
          color: #4f4f4f;
          transform: scale(0.833333);
          line-height: 22.21px;
          span {
@@ -1813,6 +1884,8 @@
    position: relative;
    padding: 30px 40px;
    background: #f2f2f7;
    border-left: 4px solid #f2f2f7;
    border-top: 4px solid #f2f2f7;
    .account-right {
      height: 100%;
      .account-content {
@@ -1870,7 +1943,7 @@
            display: flex;
            flex-direction: column;
            align-items: center;
            color: #333333;
            color: #4f4f4f;
            min-width: 200px;
            .user-name {
              margin-bottom: 10px;
@@ -1970,13 +2043,13 @@
      .change-pw {
        padding: 40px 10px;
        max-width: 600px;
        // max-width: 600px;
        margin: 0 auto;
        .title {
          font-weight: bold;
          font-size: 16px;
          line-height: 22px;
          color: #333333;
          color: #4f4f4f;
          margin-bottom: 40px;
          height: 28px;
          display: flex;
@@ -1996,7 +2069,7 @@
          border-radius: 8px;
          padding: 0 15px 0 20px;
          .el-select-dropdown__item {
            color: #333333;
            color: #4f4f4f;
            height: 32px;
            font-size: 12px;
            line-height: 32px;
@@ -2024,12 +2097,12 @@
            border: 2px solid transparent;
            border-radius: 20px;
            height: 32px;
          line-height: 32px;
            line-height: 32px;
            padding: 0 15px;
            font-size: 14px;
            font-weight: bold;
          }
          .el-input__inner:focus{
          .el-input__inner:focus {
            border: 2px solid var(--colorCard);
          }
          .el-input__inner::placeholder {
@@ -2041,7 +2114,7 @@
            width: 100%;
          }
          .el-select .el-input .el-select__caret {
            color: #333333;
            color: #4f4f4f;
            font-size: 14px;
            font-weight: 600;
          }
@@ -2065,7 +2138,7 @@
          font-size: 15px;
        }
        .el-input__clear {
          color: #333333;
          color: #4f4f4f;
          font-size: 16px;
          line-height: 48px;
        }
@@ -2084,7 +2157,7 @@
          line-height: 48px;
          font-size: 16px;
          font-weight: 600;
          color: #333333;
          color: #4f4f4f;
          height: 48px;
          background: #fbfaff;
          border-bottom: 2px solid #f2f2f7;
@@ -2194,7 +2267,7 @@
          line-height: 22px;
        }
        .fill-group {
          max-width: 450px;
          //  max-width: 450px;
          margin-top: 10px;
          margin: 0 auto;
@@ -2206,7 +2279,7 @@
            border-radius: 8px;
            padding: 0 15px 0 20px;
            .el-select-dropdown__item {
              color: #333333;
              color: #4f4f4f;
              height: 32px;
              font-size: 12px;
              line-height: 32px;
@@ -2237,18 +2310,18 @@
          }
          .el-form-item {
            .el-input__inner {
            background-color: #ffffff;
            border: 2px solid transparent;
            border-radius: 20px;
            height: 32px;
          line-height: 32px;
            padding: 0 15px;
            font-size: 14px;
            font-weight: bold;
          }
          .el-input__inner:focus{
            border: 2px solid var(--colorCard);
          }
              background-color: #ffffff;
              border: 2px solid transparent;
              border-radius: 20px;
              height: 32px;
              line-height: 32px;
              padding: 0 15px;
              font-size: 14px;
              font-weight: bold;
            }
            .el-input__inner:focus {
              border: 2px solid var(--colorCard);
            }
            .el-input__inner::placeholder {
              color: #c0c4cc;
              font-size: 12px;
@@ -2258,7 +2331,7 @@
              width: 100%;
            }
            .el-select .el-input .el-select__caret {
              color: #333333;
              color: #4f4f4f;
              font-size: 14px;
              font-weight: 600;
            }
@@ -2269,7 +2342,7 @@
    .datetime-right {
      .datetime-left {
        .device-time {
          color: #333333;
          color: #4f4f4f;
          .title {
            display: flex;
            justify-content: center;
@@ -2555,43 +2628,38 @@
        border: 2px solid transparent;
      }
    }
  }
      .btns {
      margin: 0 auto;
      margin-top: 40px;
      width: fit-content;
      display: flex;
      .cancel {
        width: 188px;
        height: 40px;
        cursor: pointer;
        border-radius: 25px;
        background-color: #e0e0e0;
        line-height: 40px;
        font-weight: bold;
        font-size: 16px;
        margin-right: 12px;
      }
      .ok {
        width: 188px;
        height: 40px;
        cursor: pointer;
        border-radius: 25px;
        background-color: var(--colorCard);
        color: #fff;
        line-height: 40px;
        font-weight: bold;
        font-size: 16px;
      }
  .btns {
    margin: 0 auto;
    margin-top: 40px;
    width: fit-content;
    display: flex;
    .cancel {
      width: 188px;
      height: 40px;
      cursor: pointer;
      border-radius: 25px;
      background-color: #e0e0e0;
      line-height: 40px;
      font-weight: bold;
      font-size: 16px;
      margin-right: 12px;
    }
    .ok {
      width: 188px;
      height: 40px;
      cursor: pointer;
      border-radius: 25px;
      background-color: var(--colorCard);
      color: #fff;
      line-height: 40px;
      font-weight: bold;
      font-size: 16px;
    }
  }
  .container-right-for-account {
    background: #fbfaff;
    padding: 0;
  }
}
.del-account-message-box {
}
</style>