Преглед изворни кода

Merge remote-tracking branch 'origin/master'

Hwf пре 7 месеци
родитељ
комит
208131fa64
2 измењених фајлова са 65 додато и 7 уклоњено
  1. 1 1
      src/views/InformationReception/index.vue
  2. 64 6
      src/views/worker/index.vue

+ 1 - 1
src/views/InformationReception/index.vue

@@ -232,7 +232,7 @@ const getList = () => {
     }
 
     .info_type_0 {
-      background: #FF9518;
+      background: #FFAF00;
     }
 
     .info_type_1 {

+ 64 - 6
src/views/worker/index.vue

@@ -33,20 +33,22 @@
         </div>
       </div>
     </div>
-    <div class="notice-bar">
+    <div class="notice-bar" v-if="noticeBarState.show">
       <!-- 静态的预警信息 -->
       <div class="notice-item">
         <div class="notice-header">
           <div class="notice-label-box">
-            <div class="notice-label">预警信息</div>
+            <div :class="['notice-label', get_info_type_color(noticeBarState.latestMessages.info_type)]">
+              {{ get_info_type_text(noticeBarState.latestMessages.info_type) }}
+            </div>
           </div>
           <!-- 查看更多的链接 -->
           <div class="notice-more" @click="goToInformationReception">查看更多 >></div>
         </div>
         <div class="notice-content">
-          这里是静态的预警信息内容,不需要从变量中获取。
+          {{ noticeBarState.latestMessages.content }}
         </div>
-        <div class="notice-time">2023-10-10 10:00:00</div>
+        <div class="notice-time">{{ noticeBarState.latestMessages.publish_time }}</div>
       </div>
     </div>
     <div class="container-content">
@@ -97,16 +99,39 @@ import { useRouter } from "vue-router";
 import closeImg from "@/assets/images/close.png";
 import { getPointInfoComprehensiveSearch } from "@/api/globalMap";
 import OnlineRollCall from "@/components/OnlineRollCall/index.vue";
+import { InformationList } from "@/api/InformationReception/InformationReception";
 
 const router = useRouter();
 const noticeBarState = reactive({
   show: false,
-  latestMessages: []
+  latestMessages: {
+    info_type: '',
+    content: '',
+    publish_time: ''
+  }
 });
 
 const goToInformationReception = () => {
   router.push({ name: "InformationReception" });
 };
+
+const get_info_type_text = (val) => {
+    return opt_info_type.find(item => item.value == val).text
+}
+
+const get_info_type_color = (val) => {
+  return "info_type_" + val
+}
+
+const opt_info_type = [
+  { text: "全部", value: "" },
+  { text: "预警信息", value: "0" },
+  { text: "灾情信息", value: "1" },
+  { text: "处置信息", value: "2" },
+  { text: "指挥救援", value: "3" },
+  { text: "公众防范", value: "4" }
+];
+
 // 菜单数据
 const menu = ref([
   { name: "巡查工作", icon: "icon1", num: 0, url: "inspectionWork" },
@@ -149,6 +174,15 @@ const getImageUrl = name => {
 };
 
 // 请求数据
+const initData = async() => {
+  let res = await InformationList({})
+  const data = res.data || [];
+  if (data.length > 0) {
+    noticeBarState.latestMessages = data[0]
+    noticeBarState.show = true;
+  }
+}
+/*
 const initData = async () => {
   try {
     const sortOrder = "desc";
@@ -175,6 +209,7 @@ const initData = async () => {
     noticeBarState.show = false; // 如果请求失败,不显示通知栏
   }
 };
+*/
 // 搜索
 const searchBoxRef = ref();
 let showSearch = ref();
@@ -450,10 +485,30 @@ onMounted(() => {
   padding: 5px;
   transform: skewX(-20deg); /* 斜切变形 */
   .notice-label {
-    color: #FFAF00;
+    
     font-size: 14px;
     transform: skewX(20deg);
   }
+
+  .info_type_0 {
+    color: #FFAF00;
+  }
+
+  .info_type_1 {
+    color: #FF1818;
+  }
+
+  .info_type_2 {
+    color: #2c81ff;
+  }
+
+  .info_type_3 {
+    color: #FF9F9F;
+  }
+
+  .info_type_4 {
+    color: #A4D3FF;
+  }
 }
 
 
@@ -477,8 +532,11 @@ onMounted(() => {
 }
 
 .notice-more {
+  margin-top:4px;
   font-size: 14px;
   color: #2C81FF;
   cursor: pointer;
 }
+
+
 </style>