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 4
     <meta charset="UTF-8" />
5 5
     <link rel="icon" href="/favicon.ico" />
6 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 8
   </head>
9 9
   <body>
10 10
     <div id="app"></div>

+ 1 - 0
src/permission.js

@@ -13,6 +13,7 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration
13 13
 const whiteList = ['/login', '/register']
14 14
 const routeStore = useRouteStore(pinia)
15 15
 const appStore = useAppStore(pinia)
16
+appStore.getAdminConfig()
16 17
 router.beforeEach(async (to, from, next) => {
17 18
 
18 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 23
   id: 'App',
24 24
   state: () => ({
25 25
     setting: {
26
-      title: 'Rustdesk-Api-Admin',
26
+      title: 'Rustdesk API Admin',
27 27
       hello: '',
28 28
       sideIsCollapse: false,
29 29
       logo,
@@ -55,17 +55,21 @@ export const useAppStore = defineStore({
55 55
     },
56 56
     getAppConfig () {
57 57
       console.log('getAppConfig')
58
-      app().then(res => {
58
+      return app().then(res => {
59 59
         this.setting.appConfig = res.data
60 60
       })
61 61
     },
62 62
     getAdminConfig () {
63 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 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