Blame view

ant-design-vue-jeecg/src/components/layouts/IframePageView.vue 2.62 KB
1
2
3
4
5
6
7
<template>

    <iframe  :id="id" :src="url" frameborder="0" width="100%" height="800px" scrolling="auto"></iframe>

</template>

<script>
8
9
  import Vue from 'vue'
  import { ACCESS_TOKEN } from "@/store/mutation-types"
10
  import { TENANT_ID } from "@/store/mutation-types"
11
12
  import PageLayout from '../page/PageLayout'
  import RouteView from './RouteView'
13
  import {mixinDevice} from '@/utils/mixin'
14
15
16

  export default {
    name: "IframePageContent",
17
    inject:['closeCurrent'],
18
    mixins: [mixinDevice],
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
    data () {
      return {
        url: "",
        id:""
      }
    },
    created () {
      this.goUrl()
    },
    updated () {
      this.goUrl()
    },
    watch: {
      $route(to, from) {
        this.goUrl();
      }
    },
    methods: {
      goUrl () {
        let url = this.$route.meta.url
        let id = this.$route.path
        this.id = id
        //url = "http://www.baidu.com"
        console.log("------url------"+url)
        if (url !== null && url !== undefined) {
44
45
46
47
48
49
          //-----------------------------------------------------------------------------------------
          //url支持通过 ${token}方式传递当前登录TOKEN
          let tokenStr = "${token}";
          if(url.indexOf(tokenStr)!=-1) {
            let token = Vue.ls.get(ACCESS_TOKEN);
            this.url = url.replace(tokenStr, token);
50
51
          } else {
            this.url = url
52
          }
53
54
55
56
57
58
59
60
61

          //update-begin---author:wangshuai ---date:20220711  for:[VUEN-1638]菜单tenantId需要动态生成------------
          let tenantIdStr = '${tenantId}'
          let tenantUrl = this.url
          if (tenantUrl.indexOf(tenantIdStr) != -1) {
            let tenantId = Vue.ls.get(TENANT_ID)
            this.url = tenantUrl.replace(tenantIdStr, tenantId)
          }
          //update-end---author:wangshuai ---date:20220711  for:[VUEN-1638]菜单tenantId需要动态生成--------------
62
63
          //-----------------------------------------------------------------------------------------
64
65
          // 是否允许打开外部页面,需要非Mobile模式且打开多页签模式
          let allowOpen = !this.isMobile() && this.$store.state.app.multipage
66
          /*update_begin author:wuxianquan date:20190908 for:判断打开方式,新窗口打开时this.$route.meta.internalOrExternal==true */
67
          if(allowOpen && this.$route.meta.internalOrExternal === true){
68
69
70
71
72
            this.closeCurrent();
            window.open(this.url);
          }
          /*update_end author:wuxianquan date:20190908 for:判断打开方式,新窗口打开时this.$route.meta.internalOrExternal==true */
73
74
75
76
77
78
79
80
        }
      }
    }
  }
</script>

<style>
</style>