javaScript蓝桥杯-----天气趋势 A

目录

  • 一、介绍
  • 二、准备
  • 三、目标
  • 四、代码
  • 五、完成


一、介绍

日常生活中,气象数据对于人们的生活具有非常重要的意义,数据的表现形式多种多样,使用图表进行展示使数据在呈现上更加直观。

本题请实现一个 Y 城 2022 年的天气趋势图。

二、准备

开始答题前,需要先打开本题的项目代码文件夹,目录结构如下:

├── css
│   └── style.css
├── effect-1.gif
├── effect-2.gif
├── index.html
└── js
    ├── axios.js
    ├── echarts.min.js
    ├── vue.min.js
    └── weather.json

其中:

  • css/style.css 是样式文件。
  • index.html 是主页面。
  • js/axios.js 是 axios 文件。
  • js/vue.min.js 是 vue2.x 文件。
  • js/echarts.min.js 是 echarts 文件。
  • js/weather.json 是请求需要用到的天气数据。
  • effect-1.gif 是当月和未来七天切换的效果图。
  • effect-2.gif 是最终完成的效果图。

在浏览器中预览 index.html 页面效果如下:
在这里插入图片描述

三、目标

  1. 完成数据请求(数据来源 ./js/weather.json),weather.json 中存放的数据为 12 个月对应的温度数据。在项目目录下已经提供了 axios,考生可自行选择是否使用。注意:调试完成后请将请求地址写死为 ./js/weather.json。
  2. 把 data 中的月份数据 monthList, 在 class=month 标签下面的 li 上完成渲染,点击月份则切换对应月份的温度数据同时被点击的月份会变成激活状态( .active 类),x 轴为日期,y 轴为温度,默认显示 1 月份数据。
    在这里插入图片描述
  3. 如果点击的月份是当天(通过时间函数动态获取的时间)所在月份,本月和未来七天切换的 tab (即 id=currentMonth 元素)显示,其他月份 currentMonth 元素不显示。
    • 默认显示本月数据。
    • 点击本月显示当月数据,点击未来七天显示从当天(包含当天)开始未来七天的数据,当显示未来七天数据时 x 轴需要显示为月/日格式。
      点击 tab 上本月和未来七天会切换激活状态(.active)。

以当天为 5 月 29 号为例,未来七天 x 轴显示示例(即 x 轴显示成:5/29,5/30,5/31,6/1,6/2,6/3,6/4):
在这里插入图片描述
本月和未来七天 切换效果见文件夹下 effect-1.gif。
在这里插入图片描述

最终效果见文件夹下面的 gif 图,图片名称为 effect-2.gif(提示:可以通过 VS Code 或者浏览器预览 gif 图片)
在这里插入图片描述

四、代码

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>天气趋势</title>
    <meta
      name="viewport"
      content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
    />
    <link rel="stylesheet" type="text/css" href="css/style.css" />
    <script src="./js/axios.js"></script>
    <script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>
    <script
      src="js/echarts.min.js"
      type="text/javascript"
      charset="utf-8"
    ></script>
  </head>

  <body>
    <div id="app">
      <div class="top-bar">2022年 Y 城全年温度统计图</div>
      <!-- 主体 -->
      <div class="container">
        <!-- 月份 -->
        <div class="month">
          <ul>
            <!-- TODO:待补充代码 在下面的 li 标签中完成 12个月份 (即 monthList) 的渲染  -->
            <li class="active">1月</li>
          </ul>
        </div>
        <div class="chart">
          <!-- TODO:待补充代码  -->
          <!-- currentMonth  未来七天和本月 tab 切换,只有当前月才显示 -->
          <div id="currentMonth">
            <div class="title">
              <h3>{{typeTitle}}</h3>
              <div class="type">
                <span id="seven">未来7天</span>
                <span id="current">本月</span>
              </div>
            </div>
          </div>
          <div id="chart"></div>
        </div>
      </div>
    </div>
  </body>
</html>
<script>
  // TODO:待补充代码
  var vm = new Vue({
    el: "#app",
    data: {
      chart: null, // 图表
      chartOptions: null, // 图表配置项
      typeTitle: "本月天气",
      monthList: {
        January: "1月",
        February: "2月",
        March: "3月",
        April: "4月",
        May: "5月",
        June: "6月",
        July: "7月",
        August: "8月",
        September: "9月",
        October: "10月",
        November: "11月",
        December: "12月",
      },
    },
    mounted: function () {
      // 初始化 echarts
      this.$nextTick(() => {
        this.initChart();
      });
    },
    methods: {
      initChart() {
        // 初始化图表
        this.chart = echarts.init(document.getElementById("chart"));
        // 配置项
        this.chartOptions = {
          grid: {
            top: 35,
            bottom: 5,
            left: 10,
            right: 10,
            containLabel: true,
          },
          tooltip: {
            trigger: "axis",
            axisPointer: {
              lineStyle: {
                color: {
                  type: "linear",
                  x: 0,
                  y: 0,
                  x2: 0,
                  y2: 1,
                  colorStops: [
                    {
                      offset: 0,
                      color: "rgba(255,255,255,0)",
                    },
                    {
                      offset: 0.5,
                      color: "rgba(255,255,255,1)",
                    },
                    {
                      offset: 1,
                      color: "rgba(255,255,255,0)",
                    },
                  ],
                  global: false,
                },
              },
            },
          },
          xAxis: [
            {
              type: "category",
              boundaryGap: false,
              axisLabel: {
                formatter: "{value}",
                fontSize: 12,
                margin: 20,
                textStyle: {
                  color: "#bfbfbf",
                },
              },
              axisLine: {
                lineStyle: {
                  color: "#e9e9e9",
                },
              },
              splitLine: {
                show: true,
                lineStyle: {
                  color: "#f7f7f7",
                },
              },
              axisTick: {
                show: false,
              },
              // x 轴显示的数据,日期
              data: [
                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,
              ],
            },
          ],
          yAxis: [
            {
              boundaryGap: false,
              type: "value",
              axisLabel: {
                textStyle: {
                  color: "#bfbfbf",
                },
                formatter: `{value}\u2103`,
              },
              nameTextStyle: {
                color: "#fff",
                fontSize: 12,
                lineHeight: 40,
              },
              splitLine: {
                lineStyle: {
                  color: "#f7f7f7",
                },
              },
              axisLine: {
                show: true,
                lineStyle: {
                  color: "#e9e9e9",
                },
              },
              axisTick: {
                show: false,
              },
            },
          ],
          series: [
            {
              name: "天气",
              type: "line",
              smooth: false,
              showSymbol: false,
              symbolSize: 0,
              zlevel: 3,
              itemStyle: {
                color: "#ff6600",
                borderColor: "#a3c8d8",
              },
              lineStyle: {
                normal: {
                  width: 3,
                  color: "#ff6600",
                },
              },
              areaStyle: {
                normal: {
                  color: new echarts.graphic.LinearGradient(
                    0,
                    0,
                    0,
                    1,
                    [
                      {
                        offset: 0,
                        color: "#ff6600",
                      },
                      {
                        offset: 0.8,
                        color: "#ff9900",
                      },
                    ],
                    false
                  ),
                },
              },
              //  Y 轴显示的数据,即温度数据
              data: [
                23, 19, 30, 31, 18, 20, 16, 15, 23, 27, 29, 30, 32, 23, 25, 20,
                22, 24, 34, 24, 21, 26, 23, 24, 25, 23, 25, 28, 32, 20,
              ],
            },
          ],
        };

        // 调用此方法设置 echarts 数据
        this.chart.setOption(this.chartOptions);
      },
    },
  });
</script>

weather.json

[
  {
    "January": [
      -13, -13, -13, -14, -13, -12, -12, -13, -13, -13, -14, -13, -14, -14, -13,
      -13, -13, -13, -13, -13, -13, -13, -12, -12, -11, -11, -11, -11, -12, -12,
      -12
    ]
  },
  {
    "February": [
      -11, -11, -10, -10, -9, -9, -9, -8, -9, -8, -9, -9, -8, -8, -8, -7, -7,
      -6, -6, -6, -6, -6, -6, -5, -5, -4, -4, -3
    ]
  },
  {
    "March": [
      -3, -3, -3, -2, -2, -2, -1, 0, 0, 0, 0, 1, 2, 2, 2, 3, 4, 4, 4, 3, 3, 4,
      4, 5, 5, 6, 7, 7, 7, 8, 7
    ]
  },
  {
    "April": [
      8, 9, 10, 11, 12, 11, 11, 11, 10, 10, 11, 12, 13, 13, 13, 13, 13, 15, 15,
      15, 16, 15, 14, 15, 16, 16, 17, 18, 18, 19
    ]
  },
  {
    "May": [
      18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 21, 21, 22, 22, 21, 22, 22, 22,
      22, 22, 23, 23, 22, 23, 23, 23, 24, 24, 24, 23, 23
    ]
  },
  {
    "June": [
      24, 24, 24, 25, 25, 25, 26, 25, 26, 27, 27, 26, 27, 26, 26, 27, 27, 27,
      28, 28, 28, 27, 28, 26, 28, 28, 28, 28, 29, 29
    ]
  },
  {
    "July": [
      28, 28, 27, 28, 28, 28, 26, 28, 28, 27, 29, 30, 29, 28, 28, 28, 28, 28,
      28, 29, 28, 30, 28, 28, 28, 28, 28, 28, 30, 28, 28
    ]
  },
  {
    "August": [
      28, 28, 27, 28, 28, 28, 26, 28, 28, 27, 29, 28, 29, 28, 28, 28, 28, 28,
      28, 29, 28, 30, 28, 28, 28, 28, 28, 28, 27, 26, 25
    ]
  },
  {
    "September": [
      26, 28, 27, 27, 27, 26, 26, 26, 25, 25, 26, 27, 25, 26, 26, 25, 25, 25,
      24, 25, 24, 24, 24, 22, 23, 22, 21, 21, 21, 20
    ]
  },
  {
    "October": [
      18, 16, 17, 17, 16, 16, 16, 15, 15, 15, 14, 14, 13, 13, 12, 12, 12, 12,
      11, 11, 11, 10, 9, 9, 8, 9, 9, 8, 7, 7, 6
    ]
  },
  {
    "November": [
      6, 7, 7, 6, 6, 5, 3, 2, 2, 1, 0, 1, 0, 0, -1, 0, -1, -1, -2, -2, -2, -3,
      -3, -4, -4, -4, -4, -5, -6, -6
    ]
  },
  {
    "December": [
      -5, -6, -6, -8, -7, -8, -8, -8, -9, -9, -9, -9, -9, -10, -9, -9, -9, -9,
      -10, -11, -11, -11, -12, -12, -12, -12, -12, -13, -13, -14, -13
    ]
  }
]

css/style.css

* {
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
  text-decoration: none;
  color: inherit;
  font-weight: normal;
  font-family: "微软雅黑";
  box-sizing: border-box;
  font-style: normal;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  width: 100%;
  overflow-x: hidden;
  background: #f8f8f8;
}
.top-bar {
  width: 100%;
  text-align: center;
  position: relative;
  font-size: 24px;
  color: #333333;
  padding: 8px 0;
}
.container {
  width: 100%;
  padding: 0 0.25rem 1rem 0.25rem;
}

/* 月份 */

.month {
  width: 100%;
  height: auto;
  overflow: hidden;
  padding: 0.4rem 0;
}

.month ul {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.month ul li {
  font-size: 16px;
  color: #999999;
  text-align: center;
  width: 60px;
  margin: 0 0.2rem;
  cursor: pointer;
}

.month ul li.active {
  color: #ff6600;
  padding: 10px;
  background: #fff1e5;
  border-radius: 5px;
}

.chart {
  width: 100%;
  height: auto;
  overflow: hidden;
  background: #ffffff;
  padding: 0.35rem 0.3rem;
  margin-top: 0.4rem;
  border-radius: 0.2rem;
}

.chart .title {
  width: 100%;
  height: auto;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart .title h3 {
  font-size: 20px;
  color: #333333;
  font-weight: bold;
}

.chart .title .type {
  display: flex;
  align-items: center;
}

.chart .title .type span {
  width: 60px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  font-size: 16px;
  color: #bcbcbc;
  background: #f7f7f7;
  cursor: pointer;
}

.chart .title .type span.active {
  color: #ff6600;
  background: #fff1e5;
  border-radius: 5px;
}

.chart .title .type span:first-child {
  border-radius: 0.1rem 0 0 0.1rem;
}

.chart .title .type span:last-child {
  border-radius: 0 0.1rem 0.1rem 0;
}

.chart #chart {
  width: 1000px;
  height: 600px;
  margin: 0 auto;
}

五、完成

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>天气趋势</title>
    <meta
      name="viewport"
      content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
    />
    <link rel="stylesheet" type="text/css" href="css/style.css" />
    <script src="./js/axios.js"></script>
    <script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>
    <script
      src="js/echarts.min.js"
      type="text/javascript"
      charset="utf-8"
    ></script>
  </head>

  <body>
    <div id="app">
      <div class="top-bar">2022年 Y 城全年温度统计图</div>
      <!-- 主体 -->
      <div class="container">
        <!-- 月份 -->
        <div class="month">
          <ul>
            <!-- TODO:待补充代码 在下面的 li 标签中完成 12个月份 (即 monthList) 的渲染  -->
            <li
              v-for="(value,key,index) in monthList"
              @click="changeActive(index)"
              :class="{'active':index==indexMonth}"
            >
              {{value}}
            </li>
          </ul>
        </div>
        <div class="chart">
          <!-- TODO:待补充代码  -->
          <!-- currentMonth  未来七天和本月 tab 切换,只有当前月才显示 -->
          <div v-if="nowMonth==indexMonth" id="currentMonth">
            <div class="title">
              <h3>{{getTypeTitle}}</h3>
              <div class="type">
                <span
                  @click="changeTag"
                  :class="{'active':!isActive}"
                  id="seven"
                  >未来7天</span
                >
                <span
                  @click="changeTag"
                  :class="{'active':isActive}"
                  id="current"
                  >本月</span
                >
              </div>
            </div>
          </div>
          <div id="chart"></div>
        </div>
      </div>
    </div>
  </body>
</html>
<script>
  // TODO:待补充代码
  var vm = new Vue({
    el: "#app",
    data: {
      chart: null, // 图表
      chartOptions: null, // 图表配置项
      typeTitle: "本月天气",
      nowMonth: new Date().getMonth(),
      isActive: true,
      monthList: {
        January: "1月",
        February: "2月",
        March: "3月",
        April: "4月",
        May: "5月",
        June: "6月",
        July: "7月",
        August: "8月",
        September: "9月",
        October: "10月",
        November: "11月",
        December: "12月",
      },
      list: [],
      indexMonth: 0,
    },
    mounted: function () {
      // 初始化 echarts
      this.$nextTick(async () => {
        this.initChart();
        await this.getData();
        this.updateMonthData();
      });
    },
    computed: {
      getTypeTitle() {
        return this.isActive ? "本月天气" : "未来7天天气";
      },
    },
    methods: {
      initChart() {
        // 初始化图表
        this.chart = echarts.init(document.getElementById("chart"));
        // 配置项
        this.chartOptions = {
          grid: {
            top: 35,
            bottom: 5,
            left: 10,
            right: 10,
            containLabel: true,
          },
          tooltip: {
            trigger: "axis",
            axisPointer: {
              lineStyle: {
                color: {
                  type: "linear",
                  x: 0,
                  y: 0,
                  x2: 0,
                  y2: 1,
                  colorStops: [
                    {
                      offset: 0,
                      color: "rgba(255,255,255,0)",
                    },
                    {
                      offset: 0.5,
                      color: "rgba(255,255,255,1)",
                    },
                    {
                      offset: 1,
                      color: "rgba(255,255,255,0)",
                    },
                  ],
                  global: false,
                },
              },
            },
          },
          xAxis: [
            {
              type: "category",
              boundaryGap: false,
              axisLabel: {
                formatter: "{value}",
                fontSize: 12,
                margin: 20,
                textStyle: {
                  color: "#bfbfbf",
                },
              },
              axisLine: {
                lineStyle: {
                  color: "#e9e9e9",
                },
              },
              splitLine: {
                show: true,
                lineStyle: {
                  color: "#f7f7f7",
                },
              },
              axisTick: {
                show: false,
              },
              // x 轴显示的数据,日期
              data: [
                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,
              ],
            },
          ],
          yAxis: [
            {
              boundaryGap: false,
              type: "value",
              axisLabel: {
                textStyle: {
                  color: "#bfbfbf",
                },
                formatter: `{value}\u2103`,
              },
              nameTextStyle: {
                color: "#fff",
                fontSize: 12,
                lineHeight: 40,
              },
              splitLine: {
                lineStyle: {
                  color: "#f7f7f7",
                },
              },
              axisLine: {
                show: true,
                lineStyle: {
                  color: "#e9e9e9",
                },
              },
              axisTick: {
                show: false,
              },
            },
          ],
          series: [
            {
              name: "天气",
              type: "line",
              smooth: false,
              showSymbol: false,
              symbolSize: 0,
              zlevel: 3,
              itemStyle: {
                color: "#ff6600",
                borderColor: "#a3c8d8",
              },
              lineStyle: {
                normal: {
                  width: 3,
                  color: "#ff6600",
                },
              },
              areaStyle: {
                normal: {
                  color: new echarts.graphic.LinearGradient(
                    0,
                    0,
                    0,
                    1,
                    [
                      {
                        offset: 0,
                        color: "#ff6600",
                      },
                      {
                        offset: 0.8,
                        color: "#ff9900",
                      },
                    ],
                    false
                  ),
                },
              },
              //  Y 轴显示的数据,即温度数据
              data: [
                23, 19, 30, 31, 18, 20, 16, 15, 23, 27, 29, 30, 32, 23, 25, 20,
                22, 24, 34, 24, 21, 26, 23, 24, 25, 23, 25, 28, 32, 20,
              ],
            },
          ],
        };

        // 调用此方法设置 echarts 数据
        this.chart.setOption(this.chartOptions);
      },
      changeActive(value) {
        this.indexMonth = value;
        //如果当前月分和本月是相同的
        if (this.indexMonth == this.nowMonth) {
          //如果本月是激活的
          if (this.isActive) {
            this.updateMonthData();
          } else {
            this.updateWeekData();
          }
        } else {
          this.updateMonthData();
        }
      },
      updateWeekData() {
        const date = new Date().getDate(); //获取当天的日期
        let index = Object.values(this.list[this.indexMonth])[0];
        const keys = [];
        const values = [];
        for (var i = date; i < date + 7; i++) {
          //如果i大于本月天数则结束
          if (i > index.length) {
            break;
          }
          keys.push(`${this.indexMonth + 1}/${i}`);
          values.push(index[i - 1]);
        }
        if (keys.length < 7) {
          //说明本月结束但是要添加7个数据
          if (this.indexMonth < 11) {
            index = Object.values(this.list[this.indexMonth + 1])[0];
          } else {
            index = Object.values(this.list[0])[0];
          }
          for (var i = 0; keys.length < 7; i++) {
            keys.push(`${this.indexMonth + 2}/${i + 1}`);
            values.push(index[i]);
          }
        }
        this.chartOptions.xAxis[0].data = keys;
        this.chartOptions.series[0].data = values;
        // 调用此方法设置 echarts 数据
        this.chart.setOption(this.chartOptions);
      },
      updateMonthData() {
        const index = Object.values(this.list[this.indexMonth])[0];
        const keys = [];
        const values = [];
        for (item in index) {
          keys.push(item + 1);
          values.push(index[item]);
        }
        this.chartOptions.xAxis[0].data = keys;
        this.chartOptions.series[0].data = values;
        // 调用此方法设置 echarts 数据
        this.chart.setOption(this.chartOptions);
      },
      async getData() {
        const res = await axios({ url: "./js/weather.json" });
        this.list = res.data;
      },
      changeTag() {
        this.isActive = !this.isActive;
        this.isActive ? this.updateMonthData() : this.updateWeekData();
      },
    },
  });
</script>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/27497.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

100天精通Python(可视化篇)——第88天:全网最全Seaborn库常用绘图3万字总结(参数说明+案例实战)

文章目录 一、Seaborn介绍1.1 介绍1.2 安装1.3 风格设置1.3.1 style&#xff08;风格&#xff09;1.3.2 context&#xff08;环境设置&#xff09; 1.4 调色盘设置1.5 数据集下载 二、Relational plots&#xff08;关系图&#xff09;2.1 scatterplot&#xff08;散点图&#x…

SpringSecurity 总结

SpringSecurity 总结 第一章 权限管理 权限管理SpringSecurity 简介整体架构 权限管理&#xff1a; 实现: "对用户访问系统的控制"(身份认证) &#xff0c; 按照 "安全规则"或者 "安全策略" (对已经认证的用户进行授权) 控制&#xff0c;用…

K8s in Action 阅读笔记——【13】Securing cluster nodes and the network

K8s in Action 阅读笔记——【13】Securing cluster nodes and the network 13.1 Using the host node’s namespaces in a pod Pod中的容器通常在不同的Linux名称空间下运行&#xff0c;这使得它们的进程与其他容器或节点默认名称空间下运行的进程隔离开来。 例如&#xff…

【计算机组成与体系结构Ⅰ】课程设计——基于Logisim的模型计算机设计

基于Logisim的模型计算机设计 一、实验目的 基于Logisim软件&#xff0c;根据一个模型指令系统&#xff0c;在逐步学习和了解计算机组成各部分逻辑组成和各部分互联的基础上&#xff0c;深入理解课程中的知识点&#xff0c;利用此软件设计并实现一个模拟的8位模型计算机原型。…

Python爬取影评并进行情感分析和数据可视化

Python爬取影评并进行情感分析和数据可视化 文章目录 Python爬取影评并进行情感分析和数据可视化一、引言二、使用requestsBeautifulSoup进行影评的爬取1、分析界面元素2、编写代码 三、情感分析1、数据预处理2、情感分析3、数据可视化 一、引言 前几天出了《航海王&#xff1…

delete 清空表之后,磁盘空间未发生变化?

上篇文章结尾和小伙伴们留了一个小问题&#xff0c;就是关于 optimize table 命令&#xff0c;今天我想花点时间再来和小伙伴们聊一聊这个话题。 1. 删除空洞 1.1 案例展示 首先我们先来看这样一个例子。 我现在有一个名为 sakila 的数据库&#xff0c;该库中有一个 film 表…

x宝评论抓取

#某宝评论接口sign参数逆向 1.接口速览 多次请求发现&#xff0c;t为时间戳&#xff0c;sign为加密参数&#xff0c;盲猜和data、t有关&#xff0c;sign为32位&#xff0c;盲猜是字符串的32位的MD5 2.搜索js代码 这里为搜索的是appKey&#xff0c;就找到了sign&#xff0c;然…

【CSS】常见的选择器

1.标签选择器 语法 标签 { }作用 标签选择器用于选择某种标签比如 选择p标签&#xff0c;并设置背景颜色 p { background-color:yellow; }例子 选择div标签&#xff0c;并将其字体大小设置为100px&#xff0c;字体设置为"微软雅黑"&#xff0c;文字颜色设置为r…

UDP协议和TCP协议

目录 UDP TCP 通过序列号与确认应答提高可靠性 为什么TCP是三次握手 为什么是四次挥手 超时重传机制 流控制 利用窗口控制提高速度 窗口控制与重发控制 拥塞控制 延迟确认应答 捎带应答 UDP UDP是不具有可靠性的数据报协议。细微的处理它会交给上层的应用去完成。…

从零开始,5分钟轻松实现Spring Boot与RabbitMQ的无缝集成

&#x1f30f; 环境 docker v4.16.2springboot 2.7.0RabbitMQ 3.9.1 rabbitmq_delayed_message_exchange 3.9.0 ps&#xff1a;代码地址 gitee &#x1fa9c; 服务架构 使用maven多模块&#xff0c;将生产者、消费者分别以springboot项目启动&#xff0c;两者通过RabbitMQ…

面试总结个人版

一、面试题 java 集合 &#xff0c; spring springmvc springboot springcloud 数据库相关的&#xff0c; redis 相关 &#xff0c;mq 相关 &#xff0c;结合业务的场景题 1、part one 集合 HashMap底层原理 HashMap是基于哈希表的Map接口的非同步实现。元素以键值对的形式存…

AI-Prompt 1.0 版简介公测!你的AI提示词网站!

提示词&#xff08;Prompt&#xff09; 是什么&#xff1f; 在 AI 大模型中&#xff0c;一个 prompt 是一个输入文本&#xff0c;用于触发模型生成输出。例如&#xff0c;当我们向一个 AI 大模型提交需求时&#xff0c;我们的需求就是一个 prompt。 在介绍产品之前&#xff0c;…

CoreDX DDS应用开发指南(4)DDS实体h和主题

6 DDS实体 DDS标准定义了一个体系结构,该体系结构表示构成DDS API实体的面向对象模型。这些实体充当中间件和应用软件之间的接口。为了开发支持DDS的应用程序,开发人员必须创建、交互并销毁这些DDS实体。 本章概述了DDS实体和相关概念。 6.1 DDS实体层次结构 构成DDS API的主…

OpenELB 在 CVTE 的最佳实践

作者&#xff1a;大飞哥&#xff0c;视源电子股份运维工程师&#xff0c; KubeSphere 社区用户委员会广州站站长&#xff0c;KubeSphere Ambassador。 公司介绍 广州视源电子科技股份有限公司&#xff08;以下简称视源股份&#xff09;成立于 2005 年 12 月&#xff0c;旗下拥…

[7]PCB设计实验|认识常用元器件|电容器|19:00~19:30

目录 一、电容器的识别 电容的应用 1. 电容有通交流阻隔直流电的作用 2. 有滤波、耦合、旁路作用等 3. 有些电容是有极性&#xff0c;有些是没有极性 二、常见电容器 1. 贴片电容 a、材质瓷片 b、材质钽介质 c、材质电解质 2. 手插电容 a、瓷片电容 b、聚脂电容 …

Windows命令行查找并kill进程及常用批处理命令汇总

Windows命令行查找并kill进程及常用命令汇总 打开命令窗口 开始—->运行—->cmd&#xff0c;或者是 windowR 组合键&#xff0c;调出命令窗口。 cmd命令行杀死Windows进程方法 1、根据进程名称批量kill 1&#xff09;、执行tasklist|more检索进程 2&#xff09;、执…

使用OpenAI创建对话式聊天机器人

引言 在当今的技术世界中&#xff0c;人工智能&#xff08;AI&#xff09;的发展迅猛&#xff0c;为我们带来了许多令人兴奋的创新。其中&#xff0c;自然语言处理&#xff08;NLP&#xff09;领域的进展使得开发对话式聊天机器人成为可能。OpenAI是一家领先的人工智能研究实验…

常见的JS存储方式及其特点

在前端开发中&#xff0c;经常需要在浏览器端存储和管理数据。为了实现数据的持久化存储和方便的访问&#xff0c;JavaScript提供了多种数据存储方式。本文将介绍几种常见的前端JS数据存储方式及其特点。 1. Cookie Cookie是一种小型的文本文件&#xff0c;由浏览器保存在用户…

如何利用google的protobuf设计、实现自己的RPC框架

一、前言 这篇文章我们就来聊一聊 RPC 的相关内容&#xff0c;来看一下如何利用 Google 的开源序列化工具 protobuf&#xff0c;来实现一个我们自己的 RPC 框架&#xff0c;内容有点长&#xff0c;请耐心看完。 序列化[1]&#xff1a;将结构数据或对象转换成能够被存储和传输&…

基于javaweb jsp+servlet实验室设备管理系统的设计与实现

一.项目介绍 本系统分为 超级管理员、老师、学生三类角色 超级管理员&#xff1a;通知管理、维护用户信息、实验室管理&#xff08;负责维护实验室、预约实验室&#xff09;、设备管理&#xff08;维护技术参数、维护运行数据、维护电子文档&#xff09;、设备维修管理&am…
最新文章