From dad69ea7f72aa3c691e0c102fc3ad9e438fef303 Mon Sep 17 00:00:00 2001 From: wangqiujuan0808 <578331299@qq.com> Date: Mon, 14 Oct 2024 15:23:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/infoApi.js | 8 +-- src/api/myApi.js | 6 +- src/components/EditPass.vue | 10 +-- src/views/Home.vue | 121 ++++++++++++++++++++++-------------- src/views/Level.vue | 2 +- src/views/Login.vue | 2 +- src/views/Page.vue | 6 +- vite.config.js | 4 +- 8 files changed, 93 insertions(+), 66 deletions(-) diff --git a/src/api/infoApi.js b/src/api/infoApi.js index 1149167..6e0667b 100644 --- a/src/api/infoApi.js +++ b/src/api/infoApi.js @@ -4,18 +4,18 @@ import { const infoApi = { // 获取设备信息 getSys() { - return postPBRequest("/info", null, 51000); + return postPBRequest("/system", null, 57000); }, // 获取网络信息 getNet(params) { - return postPBRequest("/net", params, 52000); + return postPBRequest("/system", params, 57001); }, saveNet(params) { - return postPBRequest("/net", params, 52200); + return postPBRequest("/system", params, 57201); }, // 重启设备 reboot() { - return postPBRequest("/user", null, 50003); + return postPBRequest("/system", null, 57202); }, // // 透传列表 // getTc(params) { diff --git a/src/api/myApi.js b/src/api/myApi.js index bf7d580..e5d7f6c 100644 --- a/src/api/myApi.js +++ b/src/api/myApi.js @@ -4,7 +4,7 @@ import { const myApi = { // 登录状态查询 loginStatus() { - return postPBRequest('/user', null, 50000); + return postPBRequest('/system', null, 50000); }, // 登录 login(params = {}) { @@ -12,11 +12,11 @@ const myApi = { }, // 退出登陆 logout() { - return postPBRequest('/user', null, 50002); + return postPBRequest('/system', null, 50002); }, // 修改密码 editPass(params = {}) { - return postPBRequest('/user', params, 90201); + return postPBRequest('/system', params, 90201); } } export default myApi; \ No newline at end of file diff --git a/src/components/EditPass.vue b/src/components/EditPass.vue index 40aa939..ce033b0 100644 --- a/src/components/EditPass.vue +++ b/src/components/EditPass.vue @@ -53,17 +53,17 @@ export default { rules: { oldPass: [ { required: true, message: "请输入密码", trigger: "blur" }, - { min: 6, max: 18, message: "长度在6到18个字符", trigger: "blur" }, + { min: 2, max: 18, message: "长度在2到18个字符", trigger: "blur" }, { required: true, validator: checkPass, trigger: "blur" }, ], newPass: [ { required: true, message: "请输入密码", trigger: "blur" }, - { min: 6, max: 18, message: "长度在6到18个字符", trigger: "blur" }, + { min: 5, max: 20, message: "长度在5到20个字符", trigger: "blur" }, { required: true, validator: checkPass, trigger: "blur" }, ], confirmPass: [ { required: true, message: "请输入密码", trigger: "blur" }, - { min: 6, max: 18, message: "长度在6到18个字符", trigger: "blur" }, + { min: 5, max: 20, message: "长度在5到20个字符", trigger: "blur" }, { required: true, validator: validatePassCheck, trigger: "blur" }, ], }, @@ -96,11 +96,11 @@ export default { } const res = await myApi.editPass(param); if (res.code == 0) { - ElMessage.success(res.message|| "请求成功"); + ElMessage.success(res.data|| "请求成功"); // 关闭弹框 ctx.emit("dialogSuccess"); } else { - ElMessage.error(res.message); + ElMessage.error(res.data); } } else { } diff --git a/src/views/Home.vue b/src/views/Home.vue index df9a996..1735886 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -2,9 +2,9 @@
- 2023年08月23日 星期三 09:57:11 - 时间校对 +
@@ -12,58 +12,60 @@ 设备信息
型号 - {{ deviceData.basicinfo.model }} + {{ deviceData.device_information && deviceData.device_information.model }}
序列号 - {{ deviceData.basicinfo.sn }} + {{ deviceData.device_information && deviceData.device_information.sn }}
开机时间 - {{ deviceData.hostinfo.boottime }} + {{ deviceData.running_information && deviceData.running_information.hostinfo && + deviceData.running_information.hostinfo.boottime }}
运行时长 - {{ deviceData.hostinfo.uptime }} + {{ deviceData.running_information && deviceData.running_information.hostinfo && + deviceData.running_information.hostinfo.uptime }}
- 内存信息 + 内存信息
-
- 磁盘信息 -
-
-
-
+
+ 磁盘信息 +
+
+
-
- -
- 网卡信息 -
-

网卡{{ item.name }}的使用情况

-
- - 字节 - - {{ item.bytesRecv }}↓ - {{ item.bytesSent }}↑ - +
+
+ +
+ 网卡信息 +
+

网卡{{ item.name }}的使用情况

+
+ + 字节 + + {{ item.bytesRecv }}↓ + {{ item.bytesSent }}↑ - - - - {{ item.packetsRecv }}↓ - {{ item.packetsSent }}↑ - + + + + + {{ item.packetsRecv }}↓ + {{ item.packetsSent }}↑ -
+
-
+
+
@@ -90,7 +92,7 @@ export default { }); onMounted(async () => { - getSys(); + getSys(); }); const getSys = async () => { const res = await infoApi.getSys(); @@ -106,15 +108,15 @@ export default { let dom = document.getElementById("echartDiv"); let data = { name: "内存使用比", - usedPercent: state.deviceData.meminfo.used_percent.toFixed(2), - used: state.deviceData.meminfo.used_percent.toFixed(2), + usedPercent: state.deviceData.running_information.meminfo.used_percent.toFixed(2), + used: state.deviceData.running_information.meminfo.used_percent.toFixed(2), total: 100, }; getEchart(dom, data); - state.deviceData.diskinfo.forEach((ele, index) => { + state.deviceData.running_information.diskinfo.forEach((ele, index) => { let domItem = document.getElementById("echartDiv" + index); let dataItem = { - name: ele.name.split("/")[2], + name: ele.path, usedPercent: ele.used_percent.toFixed(2), used: ele.used_percent.toFixed(2), total: 100, @@ -199,6 +201,7 @@ export default { flex-direction: column; justify-content: space-between; } + .time-div { height: 8%; width: 100%; @@ -208,24 +211,29 @@ export default { align-items: center; justify-content: flex-end; padding: 0 15px; + >span { padding: 0 15px; font-size: 26px; } } + .top-div { height: 39%; width: 100%; display: flex; justify-content: space-between; } + .bottom-div { height: 49%; width: 100%; display: flex; justify-content: space-between; } -.left-div, .left-div1 { + +.left-div, +.left-div1 { height: 100%; width: 65%; border: 1px solid #006b3b; @@ -234,40 +242,47 @@ export default { justify-content: space-around; display: flex; padding: 20px; - > div { + + >div { height: 40px; line-height: 40px; display: flex; justify-content: space-between; text-align: center; } + .name { width: 25%; border: 1px solid #c3c3c3; height: 100%; font-size: 18px; } + .value { width: 73%; border: 1px solid #c3c3c3; font-size: 18px; } + .process { width: 73%; padding: 15px 0; } + .process-div { height: 100%; justify-content: space-around; align-items: center; - > div { + + >div { width: 48%; height: 100%; } } } -.right-div, .right-div1 { +.right-div, +.right-div1 { height: 100%; width: 34%; border: 1px solid #006b3b; @@ -276,18 +291,21 @@ export default { border-radius: 10px; display: flex; padding: 10px; - > div { + + >div { height: 49%; flex-direction: column; justify-content: space-between; display: flex; align-items: center; } + .all-con { width: 100%; height: 50%; // border: 1px solid red; } + .data { padding: 5px 0; width: 70%; @@ -295,21 +313,25 @@ export default { display: flex; justify-content: space-around; flex-direction: column; + // border: 1px solid greenyellow; >span { height: 30px; display: flex; align-items: center; + // border: 1px solid red; .name { width: 20%; font-size: 18px; } + .dataValue { width: 80%; display: flex; justify-content: space-between; align-items: center; + span { width: 40%; border: 1px solid #c3c3c3; @@ -319,15 +341,18 @@ export default { color: #098658; font-size: 16px; } + .recv { background: #f8cecc; } + .sent { background: #dae8fc; } } } } + .title { // border: 1px solid red; width: 100%; @@ -339,12 +364,14 @@ export default { margin-bottom: 5px; } } -.left-div1, .right-div1 { + +.left-div1, +.right-div1 { width: 49.5%; } + .echartDiv { width: 70% !important; height: 100% !important; margin: 0 auto; -} - +} diff --git a/src/views/Level.vue b/src/views/Level.vue index 54c3883..d02e259 100644 --- a/src/views/Level.vue +++ b/src/views/Level.vue @@ -187,7 +187,7 @@ export default { if (valid) { const res = await infoApi.saveNet(state.formData); if (res.code == 0) { - ElMessage.success(res.message || "请求成功"); + ElMessage.success(res.data + ',保存网络后会重启' || "请求成功,保存网络后会重启"); getNet(); } else { ElMessage.error(res.message); diff --git a/src/views/Login.vue b/src/views/Login.vue index b2319d9..888f4ec 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -93,7 +93,7 @@ export default { store.commit("setUserInfo", userInfo); getLoginStatus(); } else { - ElMessage.error(res.message); + ElMessage.error(res.data); } }) } else { diff --git a/src/views/Page.vue b/src/views/Page.vue index 37664fa..aaa70ea 100644 --- a/src/views/Page.vue +++ b/src/views/Page.vue @@ -266,13 +266,13 @@ export default { } const tableRowClassName = ({ row, rowIndex }) => { - if(row.status == 1) { + if(row.driver_status == 1) { return '' } - if(row.status == 2) { + if(row.driver_status == 2) { return 'green' } - if(row.status == 3) { + if(row.driver_status == 3) { return 'red' } diff --git a/vite.config.js b/vite.config.js index db09529..15d1a24 100644 --- a/vite.config.js +++ b/vite.config.js @@ -37,8 +37,8 @@ export default ({ mode }) => defineConfig({ '/api': { // target: 'http://cdcm_test_api.shikicc.com:58909', // target: 'http://frp.shikicc.com:58951', - target: 'https://cdcm_api2.shikicc.com', - // target: 'https://cdcm_api.shikicc.com', + // target: 'https://cdcm_api2.shikicc.com', + target: 'https://cdcm_api.shikicc.com', changeOrigin: true, rewrite: path => path.replace(/^\/api/, '/api') }