lejianwen месяцев назад: 11
Родитель
Сommit
aeafcdde60
3 измененных файлов с 10 добавлено и 5 удалено
  1. 1 1
      index.html
  2. 1 0
      src/permission.js
  3. 8 4
      src/store/app.js

+ 1 - 1
index.html

@@ -4,7 +4,7 @@
4
     <meta charset="UTF-8" />
4
     <meta charset="UTF-8" />
5
     <link rel="icon" href="/favicon.ico" />
5
     <link rel="icon" href="/favicon.ico" />
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
-    <title>Rustdesk-Api-Admin</title>
7
+    <title>Rustdesk API Admin</title>
8
   </head>
8
   </head>
9
   <body>
9
   <body>
10
     <div id="app"></div>
10
     <div id="app"></div>

+ 1 - 0
src/permission.js

@@ -13,6 +13,7 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration
13
 const whiteList = ['/login', '/register']
13
 const whiteList = ['/login', '/register']
14
 const routeStore = useRouteStore(pinia)
14
 const routeStore = useRouteStore(pinia)
15
 const appStore = useAppStore(pinia)
15
 const appStore = useAppStore(pinia)
16
+appStore.getAdminConfig()
16
 router.beforeEach(async (to, from, next) => {
17
 router.beforeEach(async (to, from, next) => {
17
 
18
 
18
   document.title = T(to.meta?.title) + ' - ' + appStore.setting.title
19
   document.title = T(to.meta?.title) + ' - ' + appStore.setting.title

+ 8 - 4
src/store/app.js

@@ -23,7 +23,7 @@ export const useAppStore = defineStore({
23
   id: 'App',
23
   id: 'App',
24
   state: () => ({
24
   state: () => ({
25
     setting: {
25
     setting: {
26
-      title: 'Rustdesk-Api-Admin',
26
+      title: 'Rustdesk API Admin',
27
       hello: '',
27
       hello: '',
28
       sideIsCollapse: false,
28
       sideIsCollapse: false,
29
       logo,
29
       logo,
@@ -55,17 +55,21 @@ export const useAppStore = defineStore({
55
     },
55
     },
56
     getAppConfig () {
56
     getAppConfig () {
57
       console.log('getAppConfig')
57
       console.log('getAppConfig')
58
-      app().then(res => {
58
+      return app().then(res => {
59
         this.setting.appConfig = res.data
59
         this.setting.appConfig = res.data
60
       })
60
       })
61
     },
61
     },
62
     getAdminConfig () {
62
     getAdminConfig () {
63
       console.log('getAdminConfig')
63
       console.log('getAdminConfig')
64
-      admin().then(res => {
65
-        this.setting.title = res.data.title
64
+      return admin().then(res => {
65
+        this.replaceAdminTitle(res.data.title)
66
         this.setting.hello = res.data.hello
66
         this.setting.hello = res.data.hello
67
       })
67
       })
68
     },
68
     },
69
+    replaceAdminTitle(newTitle){
70
+      document.title = document.title.replace(`- ${this.setting.title}`, `- ${newTitle}`)
71
+      this.setting.title = newTitle
72
+    },
69
   },
73
   },
70
 })
74
 })
71
 
75