豪豪 il y a 6 mois
Parent
commit
8cfd2a689f

+ 4 - 3
.env.production

@@ -1,4 +1,5 @@
-VITE_BASE_API='https://cimweb.zjw.sh.cegn.cn:2007/data-business-prod/'
-VITE_BASE_URL='https://cimweb.zjw.sh.cegn.cn:2007/data-business-prod/'
+VITE_BASE_API='https://cimweb.zjw.sh.cegn.cn:2007/data-business-prod-2/'
+VITE_BASE_URL='https://cimweb.zjw.sh.cegn.cn:2007/data-business-prod-2/'
 VITE_OPEN_API='https://cimweb.zjw.sh.cegn.cn:2008/'
-VITE_OPEN_URL='https://cimweb.zjw.sh.cegn.cn:2008/'
+VITE_OPEN_URL='https://cimweb.zjw.sh.cegn.cn:2008/'
+VITE_SYSTEM_ID='1282'

+ 1 - 1
index.html

@@ -4,7 +4,7 @@
     <meta charset="UTF-8" />
     <link rel="icon" type="image/svg+xml" href="/jianzhu.svg" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <title>上海市住建行业基础数据库应用系统</title>
+    <title>IOT数据可视化平台</title>
 </head>
 <body>
 <div id="app"></div>

+ 1 - 1
package-lock.json

@@ -6312,7 +6312,7 @@
     },
     "postcss-px-to-viewport": {
       "version": "git+ssh://git@github.com/evrone/postcss-px-to-viewport.git#9d6c5cee5eea367fb4c7cf0c3bb1117979b5fbf4",
-      "from": "postcss-px-to-viewport@https://github.com/evrone/postcss-px-to-viewport",
+      "from": "postcss-px-to-viewport@github:evrone/postcss-px-to-viewport",
       "requires": {
         "object-assign": ">=4.0.1"
       }

+ 35 - 39
src/router/index.js

@@ -6,40 +6,20 @@ 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";
+import {getTokenInterior} from "@/service/userInfo.js";
+
+
 
 const router = createRouter({
     history:createWebHashHistory(import.meta.env.BASE_URL),
     routes:[
         {
-            path:'/',
-            redirect:'/visualizationHome/mainPage'
-        },
-        {
-            path:'/visualizationHome',
-            name:'visualizationHome',
-            component:VisualizationHome,
-            children:[
-                {
-                    path:'houseBuilding',
-                    name:'houseBuilding',
-                    component:HouseBuilding,
-                },
-                {
-                    path:'municipalFacilities',
-                    name:'municipalFacilities',
-                    component:MunicipalFacilities,
-                },
-                {
-                    path:'mainPage',
-                    name:'mainPage',
-                    component:MainPage,
-                },
-            ]
+            path:'/login',
+            name:'login',
+            // component:() => import('../views/login/Login.vue')
         },
         {
-            path:'/formHome',
-            name:'formHome',
-            component:FormHome
+            path:'/index:ticket',
         },
         {
             path:'/iotAnalysis',
@@ -48,16 +28,32 @@ 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';
-    // }
-})
+router.beforeEach((to, from, next) => {
+    // 外部跳转, 携带票据守卫请求后端服务校验
+    if (to.path === '/login') {
+        let param = to.query.ticket;
+        debugger
+        // 调用后端服务进行权限校验
+        getTokenInterior(param, import.meta.env.VITE_SYSTEM_ID)
+            .then(res => {
+            debugger
+                // 401状态码,重定向到登录页
+                if (res.data.code === '401') {
+                    alert(res.data.msg);
+                    window.location.href = res.data.data.backUrl;
+                }
+
+                // 200状态码,权限校验成功,跳转到 /main/home
+                if (res.data.code === '200') {
+                    router.replace({ path: '/iotAnalysis' });
+                }
+            })
+            .catch(err => {
+                console.error('校验请求失败:', err);
+            });
+    } else {
+        // 继续执行下一步
+        next();
+    }
+});
 export default router

+ 30 - 4
src/service/index.js

@@ -3,40 +3,66 @@ import {timeout} from "./config.js";
 const requestInstance = axios.create({
     baseURL:import.meta.env.VITE_BASE_API,
     timeout,
-    method:"post"
+    method:"post",
+    headers:{
+        "auth-sysId":import.meta.env.VITE_SYSTEM_ID
+    },
+
 })
 
 const requestInstance_Map_token = axios.create({
     baseURL:import.meta.env.VITE_OPEN_API,
     timeout,
-    method:"post"
+    method:"post",
+    headers:{
+        "auth-sysId":import.meta.env.VITE_SYSTEM_ID
+    },
 })
 
 const requestInstance_Service_token = axios.create({
     baseURL:import.meta.env.VITE_OPEN_API,
     timeout,
     method:"get",
+    headers:{
+        "auth-sysId":import.meta.env.VITE_SYSTEM_ID
+    },
 })
 
 const requestPost = axios.create({
     baseURL:import.meta.env.VITE_BASE_API,
     timeout,
-    method:"post"
+    method:"post",
+    headers:{
+        "auth-sysId":import.meta.env.VITE_SYSTEM_ID
+    },
 })
 
 const requestGet = axios.create({
     baseURL:import.meta.env.VITE_BASE_API,
     timeout,
     method:"get",
+    headers:{
+        "auth-sysId":import.meta.env.VITE_SYSTEM_ID
+    },
 })
 
+ const requestInstance_Get = axios.create({
+    baseURL:import.meta.env.VITE_BASE_API,
+    timeout,
+    method:"get",
+    withCredentials:true,
+    headers:{
+        "auth-sysId":import.meta.env.VITE_SYSTEM_ID
+    }
+})
 
 export {
     requestInstance,
     requestInstance_Map_token,
     requestInstance_Service_token,
 	requestPost,
-	requestGet
+	requestGet,
+    requestInstance_Get
 }
 
 

+ 118 - 0
src/service/userInfo.js

@@ -0,0 +1,118 @@
+import {requestGet, requestInstance, requestInstance_Get} from "@/service/index";
+
+export function GetUserInfo(){//查询用户信息
+    return requestGet({
+        url:'/Authentication/GetUserInfo',
+        params:{
+        }
+    })
+}
+
+export function GetRoleInfo(){//查询用户 角色信息
+    return requestInstance_Get({
+        url:'/Authentication/GetRoleInfo',
+        params:{
+        }
+    })
+}
+
+export function GetUnitList(){//查询用户 单位信息
+    return requestInstance_Get({
+        url:'/Authentication/GetUnitList',
+        params:{
+        }
+    })
+}
+
+//查询模块树
+export function selectSystemMainByRoleUuid_V01(data){
+    return requestInstance({
+        url:'/ptjkInterface/selectSystemMainByRoleUuid_V01',
+        data:{
+            ...data
+        }
+    })
+}
+//查询模块列表
+export function selectSystemMainByRoleUuid(data){
+    return requestInstance({
+        url:'/ptjkInterface/selectSystemMainByRoleUuid',
+        data:{
+            ...data
+        }
+    })
+}
+
+//查询按钮
+export function selectConfigButtonByRoleUuid(data){
+    return requestInstance({
+        url:'/zyml-module-button/selectConfigButtonByRoleUuid',
+        data:{
+            ...data
+        }
+    })
+}
+
+//循环处理 模块信息
+export function handleMoudleData(dataList){
+    let modelData = {};
+    for(let i=0;i<dataList.length;i++){
+        modelData[dataList[i]["CODE"]] = dataList[i]["CODE"];
+    }
+    //存储缓存
+    localStorage.setItem("bimBrowseModels",JSON.stringify(modelData));
+}
+//验证模块信息
+export function verificationMoudle(code){
+    if(localStorage.getItem("bimBrowseModels") == null){
+        return false;
+    }
+    let modelData = JSON.parse(localStorage.getItem("bimBrowseModels"));
+    for (let i = 0 ;i < modelData.length;i++){
+        if(modelData[i] === code){
+            return true;
+        }
+    }
+    return false;
+    // return false;
+}
+//缓存按钮信息
+//循环处理 模块信息
+export function handleMoudleButtonData(dataList){
+    let buttonData = {};
+    for(let i=0;i<dataList.length;i++){
+        buttonData[dataList[i]["CODE"]] = dataList[i]["CODE"];
+    }
+    //存储缓存
+    localStorage.setItem("bimBrowseButtons",JSON.stringify(buttonData));
+}
+
+export function getTokenInterior(ticket, id) {
+    return requestInstance_Get({
+        url: '/login/getTokenInterior',
+        headers: {
+            'auth-ticket': decodeURIComponent(ticket.toString()),
+            'auth-sysId': id,
+        },
+        method: 'get',
+    });
+}
+
+//查询单位信息
+export function getUnitDataList(data){
+    return requestInstance({
+        url:'/unit/v1/getUnitDataList',
+        data:{
+            ...data
+        }
+    })
+}
+
+export function getPermissionSet(data){//查询用户 角色信息
+    return requestInstance_Get({
+        url:'/login/getTokenInterior',
+        headers:{
+            "auth-ticket":data
+        }
+    })
+}

+ 1 - 1
src/views/IOTDataAnalysis/components/IOTHeader.vue

@@ -5,7 +5,7 @@
       class="header-title-bg"
       src="../../../assets/imgs/IOTImage/header-bg.png"
     />
-    <div class="header-title">IOT数据专题分析</div>
+    <div class="header-title">IOT数据应用系统</div>
   </div>
 </template>
 

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

@@ -2,7 +2,8 @@
   <div id="visualizationHeader">
     <div class="left-title">
       <span>
-         上海市住建行业基础数据库应用系统
+<!--         上海市住建行业基础数据库应用系统-->
+        IOT数据可视化平台
       </span>
     </div>
     <div class="top-menu">

+ 3 - 3
vite.config.js

@@ -17,8 +17,8 @@ export default defineConfig({
             // 代理所有 /api 的请求,该求情将被代理到 target 中
             '/api': {
                 // 代理请求之后的请求地址(你的真实接口地址)
-                // target: 'https://cimweb.zjw.sh.cegn.cn:2007/data-business-prod-2/',
-                target: 'http://192.168.3.60:9250/',
+                target: 'https://cimweb.zjw.sh.cegn.cn:2007/data-business-prod-2/',
+                // target: 'http://192.168.3.60:9250/',
                 secure: false,
                 ws: true,
                 // 跨域
@@ -114,7 +114,7 @@ export default defineConfig({
                         /\/src\/pages\/amap\/factor-monitor.vue/,
                     ],
                     landscape: false, // 是否处理横屏情况
-                }),  
+                }),
             ]
         }
     },