html+nginx实现看板

1.效果

2.代码html

复制代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8" />
  <title>数据监控看板</title>
  <script src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      background: #051224;
      padding: 20px;
      font-family: "Microsoft YaHei", sans-serif;
    }

    .title {
      text-align: center;
      font-size: 32px;
      color: #00e0ff;
      letter-spacing: 3px;
      margin-bottom: 20px;
      text-shadow: 0 0 15px #00e0ff;
    }

    #chart {
      width: 100%;
      height: 800px;
      border: 1px solid rgba(0, 224, 255, 0.3);
      border-radius: 12px;
      background: rgba(0, 20, 50, 0.4);
      backdrop-filter: blur(5px);
    }
  </style>
</head>

<body>
  <div class="title">一周数据统计大屏</div>
  <div id="chart"></div>

  <script>
    const myChart = echarts.init(document.getElementById('chart'));
    const week = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];

    // 生成80-160的随机数据
    function getRandomData() {
      return week.map(() => Math.floor(Math.random() * 80) + 80);
    }

    // 更新图表
    function updateChart() {
      const data = getRandomData();
      myChart.setOption({
        tooltip: {
          trigger: 'axis',
          backgroundColor: 'rgba(0, 10, 30, 0.9)',
          borderColor: '#00e0ff',
          textStyle: { color: '#fff' }
        },
        grid: {
          left: '5%',
          right: '5%',
          bottom: '5%',
          top: '5%',
          containLabel: true
        },
        xAxis: {
          type: 'category',
          data: week,
          axisLine: { lineStyle: { color: '#00e0ff' } },
          axisLabel: { color: '#fff', fontSize: 14 }
        },
        yAxis: {
          type: 'value',
          min: 0,
          max: 200,
          axisLine: { lineStyle: { color: '#00e0ff' } },
          splitLine: { lineStyle: { color: 'rgba(0,224,255,0.15)' } },
          axisLabel: { color: '#fff' }
        },
        series: [{
          type: 'bar',
          data: data,
          barWidth: '40%',
          itemStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
              { offset: 0, color: '#00d2ff' },
              { offset: 1, color: '#0072ff' }
            ])
          }
        }]
      });
    }

    // 首次加载
    updateChart();
    // 每3秒自动刷新
    setInterval(updateChart, 3000);
  </script>
</body>
</html>

3.nginx.conf配置

复制代码
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log notice;
#error_log  logs/error.log info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       9999;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

4.Ngixn静默启动

复制代码
@echo off
chcp 437 >nul
cd /d "%~dp0"

echo Closing old Nginx...
taskkill /f /im nginx.exe >nul 2>&1
timeout /t 1 /nobreak >nul

echo Starting Nginx...
start nginx.exe

echo ======================================
echo  SUCCESS! Nginx is running
echo  Open your browser:
echo  http://localhost:9999
echo ======================================
pause
相关推荐
CHNE_TAO_EMSM17 分钟前
Android studio 打开文件时自动下载源码
前端·javascript·android studio
一孤程1 小时前
Airtest自动化测试第五篇:小程序与Web测试——跨平台自动化全覆盖
前端·自动化测试·小程序·自动化·测试·airtest
IT_陈寒1 小时前
SpringBoot自动配置不是你以为的那样的智能
前端·人工智能·后端
yume_sibai2 小时前
大屏数据可视化 - 边框红绿呼吸灯实现详解
前端·信息可视化·typescript
Hyyy2 小时前
很多Desktop都在上的Computer Use是什么
前端·llm
慢功夫2 小时前
开篇:VS Code 为什么不是一个普通 React App
前端·visual studio code
你挚爱的强哥3 小时前
Vue2 实现 1.5s 十连击监听(连续点击若干次),封装通用可复用点击检测工具,不用 data!Vue 封装通用连击监听方法,支持自定义时长与点击次数
前端·javascript·vue.js
huashengzsj3 小时前
Shopify个人建站如何搭建独立站:从零开始的完整指南
前端·网络·人工智能
程序猿小泓3 小时前
从 Claude Code 学 Agent Harness:一个前端工程师的 AI Agent 学习笔记
前端·人工智能·学习
柒和远方4 小时前
从审计日志到可下载证据包:事务型 Outbox、租约 fencing 与保留水位
前端·后端·架构