seimin 2 years ago
parent
commit
baaa2f5eb7
4 changed files with 36 additions and 4 deletions
  1. 1 1
      public/index.html
  2. 16 2
      src/components/AppHeader.vue
  3. 18 0
      src/http/http.js
  4. 1 1
      src/router/index.js

+ 1 - 1
public/index.html

@@ -4,7 +4,7 @@
4
     <meta charset="utf-8">
4
     <meta charset="utf-8">
5
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
5
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
6
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
-    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
7
+    <link rel="icon" id="favicon" href="<%= BASE_URL %>favicon.ico">
8
     <title><%= htmlWebpackPlugin.options.title %></title>
8
     <title><%= htmlWebpackPlugin.options.title %></title>
9
   </head>
9
   </head>
10
   <body>
10
   <body>

+ 16 - 2
src/components/AppHeader.vue

@@ -7,8 +7,8 @@
7
       <div class="app-header__main--leftBottom"></div>
7
       <div class="app-header__main--leftBottom"></div>
8
       <div class="app-header__main--rightBottom"></div>
8
       <div class="app-header__main--rightBottom"></div>
9
       <h1 class="app-header__title">
9
       <h1 class="app-header__title">
10
-        <img class="app-header__logo" src="./../assets/img/logo.png">
11
-        大势输送保障管理平台
10
+        <img class="app-header__logo" :src="logoUrl">
11
+        {{logoTitle}}
12
       </h1>
12
       </h1>
13
     </div>
13
     </div>
14
     <!-- /头部线条及标题 -->
14
     <!-- /头部线条及标题 -->
@@ -24,6 +24,7 @@
24
 </template>
24
 </template>
25
 
25
 
26
 <script>
26
 <script>
27
+import { get } from './../http/http'
27
 import AppToday from './AppToday'
28
 import AppToday from './AppToday'
28
 export default {
29
 export default {
29
   name: 'AppHeader',
30
   name: 'AppHeader',
@@ -32,6 +33,8 @@ export default {
32
   },
33
   },
33
   data () {
34
   data () {
34
     return {
35
     return {
36
+      logoTitle: '',
37
+      logoUrl: '',
35
       time: new Date().getTime(), // 时间戳
38
       time: new Date().getTime(), // 时间戳
36
       timer: null, // 时间定时器
39
       timer: null, // 时间定时器
37
       week: ''// 星期
40
       week: ''// 星期
@@ -66,10 +69,20 @@ export default {
66
         this.time = Date.now()
69
         this.time = Date.now()
67
         this.runTime()
70
         this.runTime()
68
       }, 500)
71
       }, 500)
72
+    },
73
+    getSysNameAndLogo () {
74
+      get('/auth/getSysNameAndLogo')
75
+        .then((result) => {
76
+          this.logoTitle = result.largeScreenName || ''
77
+          this.logoUrl = result.favicon || ''
78
+          document.querySelector('#favicon').href = result.favicon || ''
79
+          document.title = this.logoTitle
80
+        })
69
     }
81
     }
70
   },
82
   },
71
   mounted () {
83
   mounted () {
72
     this.runTime()
84
     this.runTime()
85
+    this.getSysNameAndLogo()
73
   },
86
   },
74
   beforeDestroy () {
87
   beforeDestroy () {
75
     clearTimeout(this.timer)
88
     clearTimeout(this.timer)
@@ -95,6 +108,7 @@ export default {
95
       align-items: center;
108
       align-items: center;
96
       .app-header__logo{
109
       .app-header__logo{
97
         height: .6125rem;
110
         height: .6125rem;
111
+        max-width: .6125rem;
98
       }
112
       }
99
     }
113
     }
100
     .app-header__main--left {
114
     .app-header__main--left {

+ 18 - 0
src/http/http.js

@@ -32,3 +32,21 @@ export function post (url, data = {}) {
32
       })
32
       })
33
   })
33
   })
34
 }
34
 }
35
+
36
+// get请求
37
+export function get (url, data = {}) {
38
+  url = path + url
39
+  return new Promise((resolve, reject) => {
40
+    axios({
41
+      method: 'get',
42
+      url,
43
+      data
44
+    })
45
+      .then(res => {
46
+        resolve(res.data)
47
+      })
48
+      .catch(err => {
49
+        reject(err)
50
+      })
51
+  })
52
+}

+ 1 - 1
src/router/index.js

@@ -17,7 +17,7 @@ const router = new VueRouter({
17
 })
17
 })
18
 router.beforeEach((to, from, next) => {
18
 router.beforeEach((to, from, next) => {
19
   if (to.meta.title) {
19
   if (to.meta.title) {
20
-    document.title = document.title = to.meta.title + ' - 大势医院输送保障管理平台'
20
+    // document.title = document.title = to.meta.title + ' - 大势医院输送保障管理平台'
21
   }
21
   }
22
   next()
22
   next()
23
 })
23
 })