<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%" :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: "更新设置" ,icon:"\ue6fa" },
|
// { name: "备份还原",icon:"" },
|
{ name: "系统清理" ,icon:"\uea3b" },
|
{ name: "重启设置" ,icon:"\ue709" },
|
{ name: "系统信息" ,icon:"\ue709" },
|
],
|
activePage: 0,
|
free: 0,
|
full: 0,
|
};
|
},
|
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%;
|
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>
|