浏览代码

zzy + 样式修改、图层接入

zhiyuan-007 10 月之前
父节点
当前提交
73411e9943

+ 1 - 0
src/App.vue

@@ -1,5 +1,6 @@
 <script>
 import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
+import {useUserStore} from "@/store/userStore.js";
 export default {
   name:'App',
   setup() {

src/assets/imgs/图层.png → src/assets/imgs/tckg.png


+ 0 - 1
src/components/StructureTypeStatistics.vue

@@ -33,7 +33,6 @@
     isLoading.value = true;
     getSelectJzncJzjgCount().then(res => {
       isLoading.value = false;
-      debugger
       let data = res.data.data.Rows[0];
       setEchartsSBar(document.getElementById("chartFive"),data,currentType)
     })

+ 15 - 0
src/router/index.js

@@ -4,6 +4,9 @@ import VisualizationHome from "../views/c-views/visualizationPart/VisualizationH
 import HouseBuilding from "@/views/c-views/visualizationPart/houseBuilding/HouseBuilding.vue";
 import MainPage from "@/views/c-views/visualizationPart/mainPage/MainPage.vue";
 import MunicipalFacilities from "@/views/c-views/visualizationPart/municipalFacilities/MunicipalFacilities.vue";
+import {ElMessageBox} from "element-plus";
+import {useUserStore} from "@/store/userStore.js";
+
 const router = createRouter({
     history:createWebHashHistory(import.meta.env.BASE_URL),
     routes:[
@@ -40,4 +43,16 @@ const router = createRouter({
         }
     ]
 })
+router.beforeEach((to,from) =>{
+    let userStore = useUserStore();
+    let userInfo =  localStorage.getItem('exchangeUserInfo');
+    userStore.userInfo = JSON.parse(userInfo);
+    if(!userInfo ||userInfo == "null"||userInfo == null||userInfo == ""){
+        ElMessageBox.alert("请登录后操作",name,{
+            type:"warning",
+            confirmButtonText: "确定",
+        })
+        window.location.href='https://cimweb.zjw.sh.cegn.cn:2007/cim-home/#/login';
+    }
+})
 export default router

+ 1 - 0
src/store/mapStore.js

@@ -1,6 +1,7 @@
 import {defineStore} from "pinia";
 export const useMapStore = defineStore('map',{
     state:() =>({
+        layerShow:false,
         currentLayerList:[],
         camera:{
             heading:null,

+ 7 - 0
src/store/userStore.js

@@ -0,0 +1,7 @@
+import {defineStore} from "pinia";
+
+export const useUserStore = defineStore('user', {
+    state: () => ({
+        userInfo:{},
+    })
+})

+ 2 - 1
src/views/c-cpns/ServiceTree.vue

@@ -1,5 +1,5 @@
 <template>
-  <div id="serviceTree">
+  <div id="serviceTree" v-show="mapStore.layerShow">
     <div class="common-title">
       <span>图层</span>
     </div>
@@ -78,6 +78,7 @@ export default {
       getTreeData()
     })
     return {
+      mapStore,
       treeData,
       changeChange,
       treeRef

+ 34 - 0
src/views/c-cpns/TreeMenu.vue

@@ -0,0 +1,34 @@
+<template>
+  <div id="treeMenu" @click="changeShow">
+  </div>
+</template>
+
+<script>
+import {useMapStore} from "@/store/mapStore.js";
+export default {
+  name: "TreeMenu",
+  setup(){
+    const mapStore = useMapStore()
+    function changeShow(){
+      mapStore.layerShow = !mapStore.layerShow;
+    }
+    return{
+      changeShow
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+#treeMenu{
+  position: absolute;
+  cursor: pointer;
+  z-index: 2;
+  right: 453px;
+  top: 87px;
+  width: 40px;
+  height: 42px;
+  background:url("../../assets/imgs/tckg.png") no-repeat;
+  background-size: 100% 100%;
+}
+</style>

+ 43 - 2
src/views/c-cpns/VisualizationHeader.vue

@@ -10,15 +10,28 @@
         <span @click="changePath(item)">{{item.label}}</span>
       </div>
     </div>
+    <div class="right-user">
+      <el-icon class="single-icon"><User /></el-icon>
+      <span>{{username}}</span>
+      <el-icon class="single-icon" @click="logOut"><SwitchButton /></el-icon>
+    </div>
   </div>
 </template>
 
 <script>
 import {ref} from "vue";
 import router from "@/router/index.js";
+import {useUserStore} from "@/store/userStore.js";
+import {User,SwitchButton} from "@element-plus/icons-vue";
+
 export default {
   name: "VisualizationHeader",
+  components:{
+    User,
+    SwitchButton
+  },
   setup(){
+    let userStore = useUserStore();
     let menuList = ref([
       {
         id:"01",
@@ -38,7 +51,9 @@ export default {
         chosen:false,
         label:"市政设施"
       }
-    ])
+    ]);
+    let username =ref('');
+    username.value = userStore.userInfo.gxjh_username;
     function changePath(item){
       menuList.value.forEach((i)=>{
         if(i.name == item.name){
@@ -49,9 +64,16 @@ export default {
         }
       })
     }
+    function logOut(){
+      userStore.userInfo = {};
+      localStorage.setItem('exchangeUserInfo',null);
+      window.location.href='https://cimweb.zjw.sh.cegn.cn:2007/cim-home/#/login';
+    }
     return {
+      logOut,
       menuList,
-      changePath
+      changePath,
+      username
     }
   }
 }
@@ -119,5 +141,24 @@ export default {
       }
     }
   }
+  .right-user{
+    position: absolute;
+    right: 30px;
+    top:10px;
+    width: 200px;
+    height: 60px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    color: #ffffff;
+    font-size: 18px;
+    span{
+      padding-left: 6px;
+    }
+    .single-icon{
+      padding-left: 20px;
+      cursor: pointer;
+    }
+  }
 }
 </style>

+ 3 - 1
src/views/c-views/visualizationPart/VisualizationHome.vue

@@ -2,6 +2,7 @@
   <div id="visualizationHome">
     <VisualizationHeader />
     <Map/>
+    <TreeMenu />
     <ServiceTree />
     <FigureLegend />
     <router-view/>
@@ -15,9 +16,10 @@ import Map from "../../c-cpns/Map.vue";
 import VisualizationBottom from "@/views/c-cpns/VisualizationBottom.vue";
 import ServiceTree from "@/views/c-cpns/ServiceTree.vue";
 import FigureLegend from "@/views/c-cpns/figureLegend.vue";
+import TreeMenu from "@/views/c-cpns/TreeMenu.vue";
 export default {
   name: "VisualizationHome",
-  components: {FigureLegend, ServiceTree, VisualizationBottom, Map, VisualizationHeader}
+  components: {TreeMenu, FigureLegend, ServiceTree, VisualizationBottom, Map, VisualizationHeader}
 }
 </script>
 

+ 2 - 2
vite.config.js

@@ -15,8 +15,8 @@ export default defineConfig({
             // 代理所有 /api 的请求,该求情将被代理到 target 中
             '/api': {
                 // 代理请求之后的请求地址(你的真实接口地址)
-                //target: 'https://cimweb.zjw.sh.cegn.cn:2007/data-business-prod/',
-                target: 'http://localhost:9250/',
+                target: 'https://cimweb.zjw.sh.cegn.cn:2007/data-business-prod/',
+                //target: 'http://localhost:9250/',
                 secure: false,
                 ws: true,
                 // 跨域