index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <van-swipe :autoplay="3000">
  3. <van-swipe-item v-for="n in banners" :key="n">
  4. <img :src="n" />
  5. </van-swipe-item>
  6. </van-swipe>
  7. <van-search v-model="search_keyword" placeholder="请输入内容" />
  8. <van-notice-bar
  9. @click="handleNoticeBar"
  10. v-show="noticeBarState.show"
  11. left-icon="volume-o"
  12. scrollable
  13. mode="closeable"
  14. :text="noticeBarState.event_title"
  15. />
  16. <van-grid :column-num="2">
  17. <van-grid-item icon="photo-o" text="工作审批" />
  18. <van-grid-item icon="photo-o" text="信息接报" />
  19. <van-grid-item icon="photo-o" text="在线点名" />
  20. <van-grid-item icon="photo-o" text="事件管理" to="/event/index" />
  21. </van-grid>
  22. <div class="app_panel">
  23. <van-sidebar :v-model="0">
  24. <van-sidebar-item title="综合应用" />
  25. </van-sidebar>
  26. <div class="app_panel_row">
  27. <div class="app_panel_row_left">
  28. <div>自然灾害<br/>风险检测</div>
  29. </div>
  30. <div class="app_panel_row_right">
  31. <van-grid :column-num="3">
  32. <van-grid-item icon="photo-o" text="灾害检测" />
  33. <van-grid-item icon="photo-o" text="大风灾害" />
  34. <van-grid-item icon="photo-o" text="森林火灾" />
  35. <van-grid-item icon="photo-o" text="台风实况" />
  36. <van-grid-item icon="photo-o" text="水文检测" />
  37. </van-grid>
  38. </div>
  39. </div>
  40. <div class="app_panel_row">
  41. <div class="app_panel_row_left">
  42. <div>应急事件<br/>场景应急</div>
  43. </div>
  44. <div class="app_panel_row_right">
  45. <van-grid :column-num="3">
  46. <van-grid-item icon="photo-o" text="自然灾害" />
  47. <van-grid-item icon="photo-o" text="事故灾难" />
  48. <van-grid-item icon="photo-o" text="城市事件" />
  49. </van-grid>
  50. </div>
  51. </div>
  52. </div>
  53. </template>
  54. <script lang="ts" setup>
  55. import { ref, reactive, onMounted } from 'vue';
  56. import { getActiveEventList } from "@/api/event";
  57. const downLoadApi = import.meta.env.VITE_BASE_API + import.meta.env.VITE_BASE_DOWNLOAD_API;
  58. const search_keyword = ref('');
  59. const banners = ref([
  60. downLoadApi + 'banner_1.png',
  61. downLoadApi + 'banner_2.png',
  62. ]);
  63. const noticeBarState = reactive({
  64. show: false,
  65. event_id: '',
  66. event_title: ''
  67. })
  68. const handleNoticeBar = () => {
  69. console.log(noticeBarState.event_title);
  70. }
  71. onMounted(() => {
  72. getActiveEventList().then((res) => {
  73. if(res.data.event_id != noticeBarState.event_id) {
  74. noticeBarState.show = true
  75. noticeBarState.event_id = res.data.event_id;
  76. noticeBarState.event_title = res.data.event_title;
  77. }
  78. }).catch((err)=> {
  79. noticeBarState.show = false
  80. noticeBarState.event_id = '';
  81. noticeBarState.event_title = '';
  82. })
  83. })
  84. </script>
  85. <style lang="scss" scoped>
  86. .app_panel {
  87. padding:8px 8px 0 8px;
  88. .app_panel_row {
  89. display: flex;
  90. flex-direction: row;
  91. justify-content: start;
  92. margin-bottom: 8px;
  93. .app_panel_row_left {
  94. width:140px;
  95. font-size: 12px;
  96. display: inline-flex;
  97. padding: 2px 8px;
  98. justify-content: center;
  99. align-items: center;
  100. background: #efefef;
  101. }
  102. .app_panel_row_right {
  103. width:calc(100vh - 140px - 20px);
  104. }
  105. }
  106. }
  107. </style>