xieqy 2 years ago
parent
commit
306a8e1e44
4 changed files with 58 additions and 28 deletions
  1. 28 25
      public/index.html
  2. 2 1
      src/permission.ts
  3. 26 1
      src/views/groupPage/header/header.vue
  4. 2 1
      src/views/login/index.vue

+ 28 - 25
public/index.html

@@ -1,26 +1,27 @@
 <!DOCTYPE html>
 <html>
-  <head>
-    <meta charset="utf-8" />
-    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
-    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
-    <!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico" /> -->
 
-    <link rel="stylesheet" href="./static/Build/Cesium/Widgets/widgets.css" />
-    <link rel="stylesheet" href="./static/css/reset.css" />
-    <link rel="stylesheet" href="./static//Build/supermapjs/ol/ol.css" />
-    <link rel="stylesheet" href="./static//Build/supermapjs/ol/iclient-ol.min.css" />
-    <!-- built files will be auto injected -->
-    <script src="./static/Build/supermapjs/ol/ol.js"></script>
-    <script src="./static/Build/supermapjs/ol/iclient-ol.min.js"></script>
-    <script src="./static/Build/supermapjs/leaflet/leaflet.js"></script>
-    <script src="./static/Build/supermapjs/leaflet/iclient9-leaflet.min.js"></script>
-    <script src="./static/Build/Cesium/Cesium.js"></script>
-    <script src="./static/Build/supermap/SuperMap-7.1-11828.js"></script>
-    <script src="./static/Build/supermap/Lang/zh-CN.js"></script>
+<head>
+  <meta charset="utf-8" />
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
+  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
+  <!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico" /> -->
 
-    <title>城市排水系统动态监测评估系统</title>
-    <!-- <script src="https://eqcn.ajz.miesnfu.com/wp-content/plugins/wp-3d-pony/live2dw/lib/L2Dwidget.min.js"></script>
+  <link rel="stylesheet" href="./static/Build/Cesium/Widgets/widgets.css" />
+  <link rel="stylesheet" href="./static/css/reset.css" />
+  <link rel="stylesheet" href="./static//Build/supermapjs/ol/ol.css" />
+  <link rel="stylesheet" href="./static//Build/supermapjs/ol/iclient-ol.min.css" />
+  <!-- built files will be auto injected -->
+  <script src="./static/Build/supermapjs/ol/ol.js"></script>
+  <script src="./static/Build/supermapjs/ol/iclient-ol.min.js"></script>
+  <script src="./static/Build/supermapjs/leaflet/leaflet.js"></script>
+  <script src="./static/Build/supermapjs/leaflet/iclient9-leaflet.min.js"></script>
+  <script src="./static/Build/Cesium/Cesium.js"></script>
+  <script src="./static/Build/supermap/SuperMap-7.1-11828.js"></script>
+  <script src="./static/Build/supermap/Lang/zh-CN.js"></script>
+
+  <title>三峡发展智慧EPC综合决策分析平台</title>
+  <!-- <script src="https://eqcn.ajz.miesnfu.com/wp-content/plugins/wp-3d-pony/live2dw/lib/L2Dwidget.min.js"></script>
     <script>
       L2Dwidget.init({
         model: {
@@ -46,9 +47,11 @@
         }
       })
     </script> -->
-  </head>
-  <body>
-    <div id="app"></div>
-  </body>
-  <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js"></script> -->
-</html>
+</head>
+
+<body>
+  <div id="app"></div>
+</body>
+<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js"></script> -->
+
+</html>

+ 2 - 1
src/permission.ts

@@ -75,7 +75,8 @@ router.beforeEach(async (to, from, next) => {
           //初始化地图资源
           // let appconfig = await store.dispatch('gis/initGISResource')
           // console.log(appconfig)
-          next({ ...to })
+          // next({ ...to })
+          next(accessRoutes.some(e => e.path == '/groupPage') ? { path: '/groupPage' } : { ...to })
         } catch (error) {
           // debugger
           console.log(error)

+ 26 - 1
src/views/groupPage/header/header.vue

@@ -66,6 +66,9 @@
 <script>
 import Config from './config.json'
 import { getUserMenu } from '@/api/user'
+import { setParams } from 'staticPub/config'
+import { fetchProjects, setProjectKey } from '@/api/common'
+import { setSessionStorage } from '@/utils/auth'
 export default {
   name: 'bigScreenHeader', //大屏头部菜单栏
   data() {
@@ -210,7 +213,8 @@ export default {
       ) {
         this.logout()
       } else {
-        this.$router.push({ path: '/' })
+        // this.$router.push({ path: '/' })
+        this.fetchProject()
       }
     },
     async logout() {
@@ -262,6 +266,27 @@ export default {
       setInterval(() => {
         this.specificTime = getnow()
       }, 100)
+    },
+    //获取项目信息
+    async fetchProject() {
+      const { result } = await fetchProjects()
+      let target = result.find((i) => i.orgName == '湖北省区域公司')
+      target = target.prjList.find((i) => i.name == '宜昌水环境二期')
+      this.onProjectSelect(target)
+    },
+    async onProjectSelect(row) {
+      // 这里设置当前项目
+      setParams(row.gcfw)
+      const { id } = row || {}
+      this.$store.commit('project/UPDATE', row)
+      setSessionStorage('initPosition', row.geo_info) //项目初始位置
+      setSessionStorage('currentPrj', row.id) //项目ID
+      if (id) {
+        const { result } = await setProjectKey(id)
+        if (result) {
+          this.$router.push('/dashboard')
+        }
+      }
     }
   }
 }

+ 2 - 1
src/views/login/index.vue

@@ -302,7 +302,8 @@ export default class Login extends Vue {
                 } else {
                   this.loading = false
                   setTimeout(() => {
-                    this.$router.push({ path: '/prjSelection' })
+                    // this.$router.push({ path: '/prjSelection' })
+                    this.$router.push({ path: '/' })
                   }, 0)
                 }
               })