Jelajahi Sumber

master: Fixed 组件动画增加 权限地图增加

gitboyzcf 2 bulan lalu
induk
melakukan
6833f62d13

File diff ditekan karena terlalu besar
+ 0 - 0
public/geojson/100000_full.json


File diff ditekan karena terlalu besar
+ 370 - 90
src/components/ECharts/optionsConfig.js


+ 169 - 0
src/layout/HomeMap.vue

@@ -0,0 +1,169 @@
+<template>
+  <div class="home-map w-full h-full">
+    <ECharts
+      id="home-map-echarts"
+      width="100%"
+      height="100%"
+      ref="echartsRef"
+      :loading="loading"
+      :fullOptions="fullOptions"
+    />
+  </div>
+</template>
+
+<script setup>
+  import { chartOptions } from '@/components/ECharts/optionsConfig'
+  import { useOutsideHomeStore } from '@/stores/modules/home'
+  import { $mitt } from '@/utils'
+
+  const { API_GET_GEO_JSON_GET } = useRequest()
+  const useHomeStore = useOutsideHomeStore()
+  const loading = ref(true)
+  const echartsRef = ref()
+
+  var data = [
+    { name: '北京', value: 5 },
+    { name: '天津', value: 14 },
+    { name: '河北', value: 157 },
+    { name: '山西', value: 110 },
+    { name: '内蒙古', value: 40 },
+    { name: '辽宁', value: 40 },
+    { name: '吉林', value: 40 },
+    { name: '黑龙江', value: 60 },
+    { name: '上海', value: 10 },
+    { name: '江苏', value: 60 },
+    { name: '浙江', value: 50 },
+    { name: '安徽', value: 151 },
+    { name: '福建', value: 60 },
+    { name: '江西', value: 74 },
+    { name: '山东', value: 200 },
+    { name: '河南', value: 100 },
+    { name: '湖北', value: 40 },
+    { name: '湖南', value: 50 },
+    { name: '重庆', value: 40 },
+    { name: '四川', value: 120 },
+    { name: '贵州', value: 135 },
+    { name: '云南', value: 90 },
+    { name: '西藏', value: 25 },
+    { name: '陕西', value: 100 },
+    { name: '甘肃', value: 60 },
+    { name: '青海', value: 20 },
+    { name: '宁夏', value: 110 },
+    { name: '新疆', value: 32 },
+    { name: '广东', value: 10 },
+    { name: '广西', value: 100 },
+    { name: '海南', value: 40 }
+  ]
+
+  var toolTipData = [
+    {
+      name: '湖南',
+      value: 5,
+      areas: ['长沙', '株洲', '益阳']
+    },
+    {
+      name: '安徽',
+      value: 3,
+      areas: ['合肥', '芜湖']
+    },
+    {
+      name: '山东',
+      value: 80,
+      areas: ['济南', '青岛', '淄博', '烟台', '威海', '临沂']
+    },
+    {
+      name: '四川',
+      value: 35,
+      areas: ['成都', '攀枝花', '乐山', '泸州']
+    },
+    {
+      name: '云南',
+      value: 27,
+      areas: ['昆明', '玉溪', '丽江', '普洱', '临沧']
+    },
+    {
+      name: '黑龙江',
+      value: 13,
+      areas: ['哈尔滨', '鹤岗', '黑河', '绥化', '大庆', '佳木斯']
+    },
+    {
+      name: '甘肃',
+      value: 42,
+      areas: ['兰州', '嘉峪关', '天水', '酒泉']
+    },
+    {
+      name: '西藏',
+      value: 74,
+      areas: []
+    }
+  ]
+  var geoCoordMap = {
+    黑龙江: [127.9688, 45.368],
+    内蒙古: [110.3467, 41.4899],
+    吉林: [125.8154, 44.2584],
+    北京市: [116.4551, 40.2539],
+    辽宁: [123.1238, 42.1216],
+    河北: [114.4995, 38.1006],
+    天津: [117.4219, 39.4189],
+    山西: [112.3352, 37.9413],
+    陕西: [109.1162, 34.2004],
+    甘肃: [103.5901, 36.3043],
+    宁夏: [106.3586, 38.1775],
+    青海: [101.4038, 36.8207],
+    新疆: [87.611053, 43.828171],
+    西藏: [91.117212, 29.646922],
+    四川: [103.9526, 30.7617],
+    重庆: [108.384366, 30.439702],
+    山东: [117.1582, 36.8701],
+    河南: [113.4668, 34.6234],
+    江苏: [118.8062, 31.9208],
+    安徽: [117.29, 32.0581],
+    湖北: [114.3896, 30.6628],
+    浙江: [119.5313, 29.8773],
+    福建: [119.4543, 25.9222],
+    江西: [116.0046, 28.6633],
+    湖南: [113.0823, 28.2568],
+    贵州: [106.6992, 26.7682],
+    云南: [102.9199, 25.4663],
+    广东: [113.12244, 23.009505],
+    广西: [108.479, 23.1152],
+    海南: [110.3893, 19.8516],
+    台湾: [120.702967, 24.123621],
+    上海: [121.4648, 31.2891]
+  }
+
+  const fullOptions = ref({ options: {} })
+
+  const setData = async (code = 100000) => {
+    const geoJSON = await API_GET_GEO_JSON_GET({ code })
+    console.log(geoJSON)
+    loading.value = false
+    fullOptions.value.options = chartOptions.setMapOption(data, geoJSON, toolTipData, geoCoordMap)
+  }
+  const init = async () => {
+    setData()
+    echartsRef.value.myChart.on('click', async function (params) {
+      if (params.data) {
+        const { adcode, name, level } = params.data
+        if (level === 'district' || useHomeStore.codes[useHomeStore.codes.length - 1] === adcode) {
+          return
+        }
+        console.log(adcode, name, level)
+        useHomeStore.setCode(adcode)
+        setData(adcode)
+      }
+    })
+
+    // $mitt.on('onPreLevel', () => {
+    //   useHomeStore.codes.pop()
+    //   setData(useHomeStore.codes[useHomeStore.codes.length - 1])
+    // })
+  }
+  onMounted(() => {
+    init()
+  })
+  onUnmounted(() => {
+    echartsRef.value.myChart.off('click')
+    echartsRef.value.myChart.dispose()
+  })
+</script>

+ 1 - 1
src/layout/LayoutHeader.vue

@@ -1,6 +1,6 @@
 <template>
   <div
-    class="layout-header w-full h-55px absolute top-0 left-0 flex justify-between items-center px-15px"
+    class="layout-header w-full h-55px absolute top-0 left-0 flex justify-between items-center px-15px animate__animated animate__fadeInDown animate__1s"
   >
     <div> </div>
     <div

+ 28 - 49
src/views/home/home.vue

@@ -2,50 +2,29 @@
   <Layout class="home">
     <template #map>
       <!-- <ThreeMap /> -->
-      <!-- <router-view v-slot="{ Component }">
-        <Transition name="fade">
-          <component :is="Component" />
-        </Transition>
-      </router-view> -->
-      <Map />
+      <Transition name="fade">
+        <component :is="mapBoxCom" />
+      </Transition>
+      <!-- <Map /> -->
+      <!-- <HomeMap /> -->
     </template>
     <template #left>
-      <!-- <Transition
+      <Transition
         name="left"
-        enter-active-class="animate__animated animate__flipInY"
-        leave-active-class="animate__animated animate__flipOutY"
+        enter-active-class="animate__animated animate__backInLeft"
+        leave-active-class="animate__animated animate__backOutLeft"
       >
         <component :is="leftBoxCom" />
-      </Transition> -->
-      <div class="flip-card">
-        <div class="flip-card-inner" :class="{ 'is-flipped': isFlipped }">
-          <div class="flip-card-front">
-            <!-- 这里放置前面的内容 -->
-            <LeftBox />
-          </div>
-          <div class="flip-card-back">
-            <!-- 这里放置后面的内容 -->
-            <LeftBoxTwo />
-          </div>
-        </div>
-      </div>
+      </Transition>
     </template>
     <template #right>
-      <!-- <Transition name="flip">
+      <Transition
+        name="flip"
+        enter-active-class="animate__animated animate__backInRight"
+        leave-active-class="animate__animated animate__backOutRight"
+      >
         <component :is="rightBoxCom" />
-      </Transition> -->
-      <div class="flip-card">
-        <div class="flip-card-inner" :class="{ 'is-flipped': isFlipped }">
-          <div class="flip-card-front">
-            <!-- 这里放置前面的内容 -->
-            <RightBox />
-          </div>
-          <div class="flip-card-back">
-            <!-- 这里放置后面的内容 -->
-            <RightBoxTwo />
-          </div>
-        </div>
-      </div>
+      </Transition>
     </template>
     <template #top>
       <MiddleTopBox v-if="isMap" />
@@ -61,33 +40,33 @@
   import Layout from '@/layout/index.vue'
   import LeftBox from './leftbox/index.vue'
   import RightBox from './rightbox/index.vue'
-  import LeftBoxTwo from './leftboxtwo/index.vue'
-  import RightBoxTwo from './rightboxtwo/index.vue'
+  // import LeftBoxTwo from './leftboxtwo/index.vue'
+  // import RightBoxTwo from './rightboxtwo/index.vue'
 
   import MiddleBottomBox from './middleBottomBox/index.vue'
   import MiddleTopBox from './middleTopBox/index.vue'
   import VideoBox from '../VideoBox/index.vue'
-  import Map from '@/layout/Map.vue'
+  // import Map from '@/layout/Map.vue'
+  import HomeMap from '@/layout/HomeMap.vue'
   import { $mitt } from '@/utils'
   import { useOutsideHomeStore } from '@/stores/modules/home'
 
   const useHomeStore = useOutsideHomeStore()
   const isMap = computed(() => useHomeStore.temp === 'map')
 
-  const isFlipped = ref(false)
-
-  // const leftBoxCom = shallowRef(LeftBox)
-  // const rightBoxCom = shallowRef(RightBox)
+  const leftBoxCom = shallowRef(LeftBox)
+  const rightBoxCom = shallowRef(RightBox)
+  const mapBoxCom = shallowRef(HomeMap)
 
   $mitt.on('onThemeIndex', (i) => {
     if (i) {
-      // leftBoxCom.value = defineAsyncComponent(() => import('./leftboxtwo/index.vue'))
-      // rightBoxCom.value = defineAsyncComponent(() => import('./rightboxtwo/index.vue'))
-      isFlipped.value = true
+      leftBoxCom.value = defineAsyncComponent(() => import('./leftboxtwo/index.vue'))
+      rightBoxCom.value = defineAsyncComponent(() => import('./rightboxtwo/index.vue'))
+      rightBoxCom.value = defineAsyncComponent(() => import('@/layout/Map.vue'))
     } else {
-      // leftBoxCom.value = LeftBox
-      // rightBoxCom.value = RightBox
-      isFlipped.value = false
+      leftBoxCom.value = LeftBox
+      rightBoxCom.value = RightBox
+      mapBoxCom.value = HomeMap
     }
   })
 </script>

+ 4 - 4
src/views/home/leftbox/index.vue

@@ -1,12 +1,12 @@
 <template>
-  <div class="w-453px flex flex-col gap-15px lr-box-bg overflow-hidden">
-    <Box title="概况" wHeader="60px">
+  <div class="w-453px flex flex-col gap-15px lr-box-bg overflow-hidden absolute">
+    <Box title="概况" wHeader="60px" class="animate__animated animate__fadeInLeft animate__faster">
       <TopBox />
     </Box>
-    <Box title="设备信息">
+    <Box title="设备信息" class="animate__animated animate__fadeInLeft animate__fast">
       <MiddleBox />
     </Box>
-    <Box title="用户情况">
+    <Box title="用户情况" class="animate__animated animate__fadeInLeft animate__1s">
       <BottomBox />
     </Box>
   </div>

+ 9 - 2
src/views/home/leftbox/middleBox.vue

@@ -12,7 +12,14 @@
         <Countto class="text-20px color-#389bff font-bold" :endVal="60" />
       </div>
     </div>
-    <swiper
+    <ECharts
+      id="sbxx-echarts"
+      width="100%"
+      height="280px"
+      :loading="loading"
+      :fullOptions="{ options: chartOptions.setSbxxOption() }"
+    />
+    <!-- <swiper
       :spaceBetween="30"
       :centeredSlides="true"
       :autoplay="{
@@ -45,7 +52,7 @@
           :fullOptions="{ options: chartOptions.setSbxxOption2() }"
         />
       </swiper-slide>
-    </swiper>
+    </swiper> -->
   </div>
 </template>
 

+ 4 - 4
src/views/home/leftboxtwo/index.vue

@@ -1,12 +1,12 @@
 <template>
-  <div class="w-453px flex flex-col gap-15px lr-box-bg overflow-hidden">
-    <Box title="概况2" wHeader="60px">
+  <div class="w-453px flex flex-col gap-15px lr-box-bg overflow-hidden absolute">
+    <Box title="概况2" wHeader="60px" class="animate__animated animate__fadeInLeft animate__faster">
       <TopBox />
     </Box>
-    <Box title="设备信息2">
+    <Box title="设备信息2" class="animate__animated animate__fadeInLeft animate__fast">
       <MiddleBox />
     </Box>
-    <Box title="用户情况2">
+    <Box title="用户情况2" class="animate__animated animate__fadeInLeft animate__1s">
       <BottomBox />
     </Box>
   </div>

+ 7 - 3
src/views/home/rightbox/index.vue

@@ -1,9 +1,13 @@
 <template>
-  <div class="w-453px flex flex-col gap-15px lr-box-bg overflow-hidden">
-    <Box title="报警中心">
+  <div class="w-453px flex flex-col gap-15px lr-box-bg overflow-hidden absolute right-0">
+    <Box title="报警中心" class="animate__animated animate__fadeInRight animate__faster">
       <RightTopBox />
     </Box>
-    <Box title="报警类型TOP5" wHeader="124px">
+    <Box
+      title="报警类型TOP5"
+      wHeader="124px"
+      class="animate__animated animate__fadeInRight animate__fast"
+    >
       <RightBottomBox />
     </Box>
   </div>

+ 7 - 3
src/views/home/rightboxtwo/index.vue

@@ -1,9 +1,13 @@
 <template>
-  <div class="w-453px flex flex-col gap-15px lr-box-bg overflow-hidden">
-    <Box title="报警中心2">
+  <div class="w-453px flex flex-col gap-15px lr-box-bg overflow-hidden absolute right-0">
+    <Box title="报警中心2" class="animate__animated animate__fadeInRight animate__faster">
       <RightTopBox />
     </Box>
-    <Box title="报警类型TOP52" wHeader="124px">
+    <Box
+      title="报警类型TOP52"
+      wHeader="124px"
+      class="animate__animated animate__fadeInRight animate__fast"
+    >
       <RightBottomBox />
     </Box>
   </div>

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini