1 Star 0 Fork 0

compute-monitor / UI

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

计算机资源监控UI

此为UI界面,内容很简单,就是访问接口获取数据,稍微处理一下,然后显示出来

使用方法

如果是在有node.js的环境下使用,直接“npm run dev”

如果是编译部署到服务器上,需要依赖nginx,nginx的部署与使用网上有资料,这里不再重复

服务器部署

  1. 运行指令“npm build”,构建项目,就会在当前目录下生成一个“dist”目录,里面的文件就是构建好的目录
  2. 将目录复制到服务器的某个目录下
  3. 然后再nginx的配置文件上配置:
        server {
            listen       10000;
            server_name  localhost;
    
            location / {
                root   E:\service\monitorUI;
                index  index.html;
            try_files $uri /index.html;
            }
    
            location /html {
            add_header Cache-Control no-store;
            }
        }
    配置文件中的路径需要自己修改,”dist”我改名为“monitorUI”了,下面这个location是为了处理项目更新后浏览器刷新却不生效的问题。
  4. 重新加载配置"nginx -s reload"之后就可以使用ip:port访问了。

框架介绍

框架采用Vue3+Vite+TypeScript+element Plus,可以看:这篇分析

也是当前比较流行的技术

状态管理

我采用pinia做状态管理,也可以理解为全局变量,方便页面数据的更新,系列文章里有分析,这里就不再介绍。

数据分析

代码位于“src/service”下。首先有一个接收数据的结构体“models/source.ts”.

然后“api/source.ts”获取数据和处理数据,详情看代码,注释很详细

页面卡片显示

页面也很简单,采用el-card实现,相关资料可以看element plus官网

代码在“src/components/Card.vue“ ,它就调用数据接口更新数据,然后将数据按照形式展现出来,可以看代码解析。

MIT License Copyright (c) 2022 lsj唯一 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

监控的UI 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/compute-monitor/ui.git
git@gitee.com:compute-monitor/ui.git
compute-monitor
ui
UI
master

搜索帮助