suochencheng 7 tahun lalu
induk
melakukan
0b4a33543c
2 mengubah file dengan 48 tambahan dan 4 penghapusan
  1. 40 0
      src/main/vue/src/pages/CommonIframe.vue
  2. 8 4
      src/main/vue/src/router/index.js

+ 40 - 0
src/main/vue/src/pages/CommonIframe.vue

@@ -0,0 +1,40 @@
+<template>
+    <iframe :src="iframeSrc" :height="height" width="100%" class="iframe"> </iframe>
+</template>
+<script>
+import { mapState } from 'vuex'
+
+export default {
+    created() {
+        this.getIframeSrc();
+    },
+    data() {
+        return {
+            iframeSrc: '/404',
+        }
+    },
+    computed: {
+        height() {
+            return window.innerHeight - 104 + 'px'
+        }
+    },
+    methods: {
+        getIframeSrc() {
+
+            this.iframeSrc = this.$route.query.code;
+
+        },
+    },
+    watch: {
+        $route() {
+            this.getIframeSrc()
+        }
+    },
+
+}
+</script>
+<style lang="less" scoped>
+.iframe {
+    border: none;
+}
+</style>

+ 8 - 4
src/main/vue/src/router/index.js

@@ -170,6 +170,11 @@ const router = new Router({
                     name: 'commonQuery',
                     component: () => import('../pages/CommonQuery')
                 },
+                {
+                    path: '/commonIframe',
+                    name: 'commonIframe',
+                    component: () => import('../pages/CommonIframe')
+                },
                 {
                     path: '/queryConfigs',
                     name: 'queryConfigs',
@@ -252,14 +257,11 @@ const router = new Router({
             path: '/login',
             name: 'login',
             component: () => import('../pages/Login')
-        },
-        {
-            path: '*',
-            redirect: '/404'
         }
     ]
 });
 router.beforeEach((to, from, next) => {
+    //console.log(to);
     if (/^\/http/.test(to.path)) {
         console.log(Vue.$baseUrl);
         let url = to.path.replace('/', '');
@@ -290,6 +292,8 @@ router.beforeEach((to, from, next) => {
         }).catch(() => {
             next('/login');
         })
+    } else if (!to.matched.length) {
+        next('/404');
     } else {
         next();
     }