hmm 7 ヶ月 前
コミット
bf48f1c390

+ 27 - 0
src/api/globalMap/TyphoonVideo.ts

@@ -0,0 +1,27 @@
+import request from '@/utils/request';
+// 台风年份列表
+export const getTyphoonYearList = (data) => {
+  return request({
+    url: '/api/gateway/v2/get_typhoon_year_n',
+    method: 'post',
+    data: data
+  });
+};
+
+// 台风列表
+export const getTyphoonList = (data) => {
+  return request({
+    url: '/api/gateway/v2/get_typhoon_list',
+    method: 'post',
+    data: data
+  });
+};
+
+// 台风轨迹
+export const getTyphoonTrajectory = (data) => {
+  return request({
+    url: '/api/gateway/v2/get_typhoon_trajectory',
+    method: 'post',
+    data: data
+  });
+};

+ 196 - 0
src/views/globalMap/RightMenu/TyphoonVideo.vue

@@ -0,0 +1,196 @@
+<template>
+  <div class="menu-content">
+    <div class="container">
+      <div class="gradient-text title">台风视频</div>
+      <div class="box-left">
+        <el-input v-model="queryParams.typhoon_code" class="custom-input" placeholder="搜索" @input="initData">
+          <template #prefix>
+            <el-icon class="el-input__icon"><search /></el-icon>
+          </template>
+        </el-input>
+        <el-button class="btn" @click="handleCancel">取消</el-button>
+      </div>
+    </div>
+    <div class="section-box">
+      <div class="title2">路径列表</div>
+      <div style="display: flex; align-content: center">
+        <span style="margin-right: 10px; white-space: nowrap; font-size: 40px; height: 100px">选择台风:</span>
+        <el-select
+          v-model="selectedYear"
+          placeholder="请选择年份"
+          class="custom-select"
+          popper-class="custom-select-popper"
+          :teleported="false"
+          style="width: 1200px; margin-left: 30px"
+        >
+          <el-option v-for="year in yearList" :key="year" :label="year" :value="year"></el-option>
+        </el-select>
+        <el-select
+          v-model="selectedTyphoon"
+          placeholder="请选择台风名称"
+          class="custom-select"
+          popper-class="custom-select-popper"
+          :teleported="false"
+          style="width: 1200px; margin-left: 30px"
+        >
+          <el-option v-for="typhoon in availableTyphoons" :key="typhoon.id" :label="typhoon.name" :value="typhoon.id"></el-option>
+        </el-select>
+      </div>
+    </div>
+    <div class="custom-table">
+      <div class="th">
+        <div class="td">过去时间</div>
+        <div class="td">经纬度</div>
+        <div class="td">位置</div>
+        <div class="td">操作</div>
+      </div>
+      <div class="table-content">
+        <div v-for="(item, index) in dataList" :key="item.id" class="tr">
+          <div class="td">{{ item.name }}</div>
+          <div class="td">{{ item.work_unit }}</div>
+          <div class="td">{{ item.position }}</div>
+          <div class="td">
+            <div class="text" @click="handleConnect(index, item)">周边视频</div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+<script setup lang="ts">
+import { ref, reactive, onMounted, watch } from 'vue';
+import { getTyphoonTrajectory, getTyphoonYearList } from '@/api/globalMap/TyphoonVideo';
+
+const selectedYear = ref(''); //selectedYear 用于存储用户选择的年份
+const yearList = ref([]); // yearList 用于存储从 getTyphoonYearList 获取的年份列表
+//入参
+const queryParams = reactive({
+  typhoon_code: ''
+});
+
+//调用函数
+onMounted(() => {
+  initData();
+});
+
+//调接口在 initData 函数中,首先调用 getTyphoonYearList 并处理返回的数据,将其赋值给 yearList。
+const initData = () => {
+  getTyphoonYearList().then((res) => {
+    if (res.code === 0) {
+      yearList.value.splice(0, yearList.value.length, ...res.rows.map(item => item.year_n));  // 更新年份列表
+    } else {
+      console.error('Failed to fetch typhoon year list:', res);
+    }
+  });
+  getTyphoonTrajectory({
+    query: {
+      typhoon_code: queryParams.typhoon_code
+    }
+  }).then((res) => {
+    if (res.code === 0 && Array.isArray(res.rows)) {
+      dataList.splice(0, dataList.length, ...res.rows); // 使用 splice 替换数组内容,保持响应性
+    } else {
+      console.error('Invalid response from server:', res);
+      // 可以选择清空数据列表或显示错误消息
+      dataList.splice(0, dataList.length); // 清空数据列表
+    }
+  });
+};
+
+// 数据列表,直接定义为数组
+const dataList = reactive([]);
+</script>
+
+<style lang="scss" scoped>
+.menu-content {
+  width: 1579px;
+  height: 1394px;
+  background: url('@/assets/images/map/rightMenu/content.png') no-repeat;
+  padding: 130px 20px 20px 20px;
+  font-size: 36px;
+  position: relative;
+  color: #ffffff;
+}
+
+.box-left {
+  display: flex;
+  margin-top: 30px;
+  margin-bottom: 20px;
+  .btn {
+    width: 140px;
+    min-width: 140px;
+    height: 60px;
+    background: url('@/assets/images/map/rightMenu/potentialFloodHazard/btn.png') no-repeat;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    cursor: pointer;
+    margin-left: 20px;
+    color: #ffffff;
+    font-size: 32px;
+  }
+}
+
+.custom-table {
+  width: 100%;
+  height: 1030px;
+  overflow-y: auto;
+  overflow-x: hidden;
+  .table-content {
+    height: 880px;
+    overflow-y: auto;
+    overflow-x: hidden;
+  }
+  .th {
+    width: 100%;
+    height: 151px;
+    background: url('@/assets/images/map/rightMenu/th.png') no-repeat;
+    background-size: 100% 100%;
+    display: flex;
+  }
+  .tr {
+    width: 100%;
+    height: 139px;
+    background: url('@/assets/images/map/rightMenu/td.png') no-repeat;
+    background-size: 100% 100%;
+    display: flex;
+    padding-right: 20px;
+    &:hover {
+      background: url('@/assets/images/map/rightMenu/td_checked.png') no-repeat;
+      background-size: 100% 100%;
+    }
+  }
+  .td {
+    flex: 1;
+    color: #edfaff;
+    font-size: 38px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    cursor: pointer;
+  }
+  .td-text {
+    /* 设置字体透明 */
+    color: transparent;
+    /* 使用 -webkit-background-clip 属性将背景剪裁至文本形状 */
+    -webkit-background-clip: text;
+    /* 非Webkit内核浏览器需要使用标准前缀 */
+    background-clip: text;
+    font-family: 'YouSheBiaoTiHei';
+    /* 设置线性渐变,从红色渐变到蓝色 */
+    background-image: linear-gradient(to bottom, #ffffff 50%, #3075d3 100%);
+    font-size: 48px;
+  }
+  .text-green {
+    background-image: linear-gradient(to bottom, #ffffff 50%, #40c75f 100%);
+  }
+  .text-danger {
+    background-image: linear-gradient(to bottom, #ffffff 50%, #ff2f3c 100%);
+  }
+}
+
+.title2 {
+  font-size: 48px;
+  height: 100px;
+}
+</style>