seimin 1 year 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 4
     <meta charset="utf-8">
5 5
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 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 8
     <title><%= htmlWebpackPlugin.options.title %></title>
9 9
   </head>
10 10
   <body>

+ 16 - 2
src/components/AppHeader.vue

@@ -7,8 +7,8 @@
7 7
       <div class="app-header__main--leftBottom"></div>
8 8
       <div class="app-header__main--rightBottom"></div>
9 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 12
       </h1>
13 13
     </div>
14 14
     <!-- /头部线条及标题 -->
@@ -24,6 +24,7 @@
24 24
 </template>
25 25
 
26 26
 <script>
27
+import { get } from './../http/http'
27 28
 import AppToday from './AppToday'
28 29
 export default {
29 30
   name: 'AppHeader',
@@ -32,6 +33,8 @@ export default {
32 33
   },
33 34
   data () {
34 35
     return {
36
+      logoTitle: '',
37
+      logoUrl: '',
35 38
       time: new Date().getTime(), // 时间戳
36 39
       timer: null, // 时间定时器
37 40
       week: ''// 星期
@@ -66,10 +69,20 @@ export default {
66 69
         this.time = Date.now()
67 70
         this.runTime()
68 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 83
   mounted () {
72 84
     this.runTime()
85
+    this.getSysNameAndLogo()
73 86
   },
74 87
   beforeDestroy () {
75 88
     clearTimeout(this.timer)
@@ -95,6 +108,7 @@ export default {
95 108
       align-items: center;
96 109
       .app-header__logo{
97 110
         height: .6125rem;
111
+        max-width: .6125rem;
98 112
       }
99 113
     }
100 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 18
 router.beforeEach((to, from, next) => {
19 19
   if (to.meta.title) {
20
-    document.title = document.title = to.meta.title + ' - 大势医院输送保障管理平台'
20
+    // document.title = document.title = to.meta.title + ' - 大势医院输送保障管理平台'
21 21
   }
22 22
   next()
23 23
 })