Blame view

antis-ncc-admin/src/views/basic/dashboard/index.vue 1.91 KB
03207d5d   wwk   1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
  <template>
    <div class="dashboard-container">
        <div style="padding:20px">欢迎使用后台管理系统</div>
    </div>
  </template>
  
  <script>
  import { getAuthPortal } from '@/api/onlineDev/portal'
  import Setting from './Setting'
  import PortalLayout from '@/components/VisualPortal/Layout'
  import { mapGetters } from 'vuex'
  
  export default {
    name: 'dashboard',
    components: { Setting, PortalLayout },
    data() {
      return {
        portalId: '',
        layout: [],
        ajaxing: true,
        loading: false
      }
    },
    computed: {
      ...mapGetters(['userInfo'])
    },
    created() {
      this.portalId = this.userInfo.portalId
      this.getData()
    },
    methods: {
      getData() {
        this.loading = true
        this.layout = []
        if (!this.portalId) {
          this.loading = false
          this.ajaxing = false
          return
        }
        getAuthPortal(this.portalId).then(res => {
          if (res.data && res.data.formData) {
            let formData = JSON.parse(res.data.formData)
            this.layout = formData.layout || []
          }
          this.ajaxing = false
          setTimeout(() => {
            this.loading = false
          }, 500);
        }).catch(() => {
          this.loading = false
          this.ajaxing = false
        })
      },
      refresh(id) {
        if (!id) return
        this.portalId = id
        this.getData()
      }
    }
  }
  </script>
  <style lang="scss" scoped>
  .dashboard-container {
    width: 100%;
    height: 100%;
    background: #ebeef5;
    position: relative;
    >>> .layout-area {
      width: 100%;
      border-radius: 4px;
      overflow: hidden;
    }
    .setting-btn {
      position: absolute;
      top: 200px;
      right: -10px;
      height: 40px;
      width: 40px;
      text-align: center;
      padding: 0;
      border-radius: 20px 0 0 20px;
      z-index: 100;
      >>> i {
        font-size: 20px;
        font-weight: 580;
      }
    }
    >>> .vue-grid-layout {
      margin: -10px;
    }
    >>> .el-scrollbar__view {
      overflow: hidden;
    }
  }
  </style>