all
heyujie
2021-07-21 b5e2e236828b7fbc0e8f2bdbf66651ad8907e3b1
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
<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)"
      >
        <span class="icon iconfont">{{item.icon}}</span>
        <span class="card-text">{{ item.name }}</span>
      </div>
    </div>
    <systemClean v-if="activePage == 1" style="width: 100%" :percent="storagePercent"></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>
  </div>
</template>
 
<script>
import {
  getClockInfo,
  saveClockInfo,
  testNTPserver,freedisk
} from "@/api/system";
import systemClean from "../views/systemClean";
import updateSettings from "../views/updateSettings";
import BackUp from "../views/backUp";
import restartSettings from "../views/restartSettings";
export default {
  name: "settings",
  components: {
    systemClean,
    updateSettings,
    BackUp,
    restartSettings,
  },
  data() {
    return {
      menuArr: [
        { name: "更新设置" ,icon:"\ue60f" },
        // { name: "备份还原",icon:""  },
        { name: "系统清理" ,icon:"\ue6e0" },
        { name: "重启设置" ,icon:"" },
      ],
      activePage: 0,
      storagePercent: 0,
    };
  },
  mounted() {
     this.getLeftPer()
  },
  methods: {
    openMenu(item, i) {
      this.activePage = i;
    },
    getLeftPer(){
      freedisk().then((res) => {
        this.storagePercent = Math.round(res.data.free/ res.data.all *100)
      })
    },
  },
};
</script>
<style lang="scss">
.container {
  height: 100%;
  display: flex;
  flex-direction: row;
  flex: 1;
  flex-basis: auto;
  box-sizing: border-box;
  .container-left {
    height: 100%;
      width: 240px;
 
    overflow: auto;
    box-sizing: border-box;
    flex-shrink: 0;
    padding: 10px;
    border-right: 5px solid rgba(248, 248, 248, 1);
    box-sizing: border-box;
    .left-card {
      height: 50px;
      cursor: pointer;
      border-radius: 10px;
      margin-bottom: 10px;
      display: flex;    background-color: #f8f8f8;
 
      align-items: center;
      .iconfont {
        margin-left: 15px;
        margin-right: 10px;
        font-size: 18px;
      }
      .card-text {
        font-size: 15px;
      }
    }
    .left-card-active {
      color: #fff;
      background-color: rgba(61, 104, 225, 1);
    }
   
    .left-card:hover {
      background-color: rgba(61, 104, 225, 1);
      color: #fff;
    }
  }
 
}
</style>