ZZJ
2021-09-24 758d6d078ef2fb99907a1a78de6548c542768b37
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<template>
  <div class="container">
    <div class="container-left">
      <div
        class="left-card"
        v-for="(item, i) in menuArr"
        :key="i"
        :class="activePage == i ? 'left-card-active' : ''"
        @click="openMenu(item, i)"
      >
        <img :src="item.img_black" class="icon iconfont icon_black" />
        <img :src="item.img_white" class="icon iconfont icon_white" />
        <span class="card-text">{{ item.name }}</span>
      </div>
    </div>
    <systemClean v-if="activePage == 1" style="width: 100%" :free="free" :full="full" @refreshPercent="getLeftPer"></systemClean>
    <updateSettings v-if="activePage == 0" style="width: 100%"></updateSettings>
    <!-- <back-up v-if="activePage == 3" style="width: 100%"></back-up> -->
    <restartSettings v-if="activePage == 2" style="width: 100%"></restartSettings>
    <sysInfo v-if="activePage == 3" style="width: 100%"></sysInfo>
  </div>
</template>
 
<script>
import {
  freedisk
} from "@/api/system";
import { getUrlKey } from "@/api/utils";
import systemClean from "../views/systemClean";
import updateSettings from "../views/updateSettings";
// import BackUp from "../views/backUp";
import restartSettings from "../views/restartSettings";
import sysInfo from "../views/sysInfo";
export default {
  name: "settings",
  components: {
    systemClean,
    updateSettings,
 //   BackUp,
    restartSettings,sysInfo
  },
  data() {
    return {
      menuArr: [
        { name: "更新设置" ,img_black:"/images/vindicate/更新设置-黑.png", img_white:"/images/vindicate/更新设置-白.png",},
        { name: "系统清理" ,img_black:"/images/vindicate/系统清理-黑.png", img_white:"/images/vindicate/系统清理-白.png",},
        { name: "重启设置" ,img_black:"/images/vindicate/重启设置-黑.png", img_white:"/images/vindicate/重启设置-白.png",},
        { name: "系统信息" ,img_black:"/images/vindicate/系统信息-黑.png", img_white:"/images/vindicate/系统信息-白.png",},
      ],
      activePage: 0,
      free: 0,
      full: 0,
    };
  },
  created() {
    let color = localStorage.getItem('--colorCard')
    if(color) {
      document.documentElement.style.setProperty('--colorCard',`${color}`)
    } 
  },
  mounted() {
    const menu = getUrlKey("menu");
    if (menu) {
      this.activePage = this.menuArr.findIndex((x) => x.name == menu);
      // this.$nextTick(() => {
      //   this.$refs.netSettings.openRight(2);
      // });
    }
     this.getLeftPer()
  },
  methods: {
    openMenu(item, i) {
      this.activePage = i;
    },
    getLeftPer(){
      freedisk().then((res) => {
        this.free = res.data.free
        this.full = res.data.all
      })
    },
  },
};
</script>
<style lang="scss">
.container {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: row;
  flex: 1;
  flex-basis: auto;
  box-sizing: border-box;
  .container-left {
    height: 100%;
    width: 244px;
    overflow: auto;
    box-sizing: border-box;
    flex-shrink: 0;
    padding: 17px 10px 0 10px;
    box-sizing: border-box;
    background: #fff;
    .left-card {
      position: relative;
      width: 224px;
      height: 56px;
      cursor: pointer;
      border-radius: 8px;
      margin-bottom: 4px;
      display: flex;    
      background-color: #F2F2F7;
      align-items: center;
      .icon_white {
        position: absolute;
        top: 8px;
        left: 0;
        visibility: hidden;
      }
      .iconfont {
        width: 40px;
        height: 40px;
        margin: 0 20px 0 20px;
        background: #333333;
        border-radius: 8px;
      }
      .card-text {
        font-family: PingFang SC;
        font-weight: 700;
        font-size: 16px;
        line-height: 22.4px;
      }
    }
    .left-card-active {
      color: #fff;
      background-color: var(--colorCard);
      .icon_black {
      visibility: hidden;
      }
      .icon_white{
        visibility: visible;
      }
      .iconfont {
        color: #333333;
        background-color: #fff;
      }
    }
   
    .left-card:hover {
      background-color: var(--colorCard);
      color: #fff;
      .iconfont {
        color: #333333;
        background-color: #fff;
      }
      .icon_black {
      visibility: hidden;
      }
      .icon_white{
        visibility: visible;
      }
    }
  }
 
}
</style>