From aeafcdde606f2a98c31bc95d019e37092e708773 Mon Sep 17 00:00:00 2001
From: lejianwen <84855512@qq.com>
Date: Wed, 12 Feb 2025 21:08:33 +0800
Subject: [PATCH] fix: Document title
---
index.html | 2 +-
src/permission.js | 1 +
src/store/app.js | 12 ++++++++----
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/index.html b/index.html
index fe303c0..6eab3fb 100644
--- a/index.html
+++ b/index.html
@@ -4,7 +4,7 @@
-
Rustdesk-Api-Admin
+ Rustdesk API Admin
diff --git a/src/permission.js b/src/permission.js
index f58b285..9281308 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -13,6 +13,7 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration
const whiteList = ['/login', '/register']
const routeStore = useRouteStore(pinia)
const appStore = useAppStore(pinia)
+appStore.getAdminConfig()
router.beforeEach(async (to, from, next) => {
document.title = T(to.meta?.title) + ' - ' + appStore.setting.title
diff --git a/src/store/app.js b/src/store/app.js
index 8aff291..a71f0b7 100644
--- a/src/store/app.js
+++ b/src/store/app.js
@@ -23,7 +23,7 @@ export const useAppStore = defineStore({
id: 'App',
state: () => ({
setting: {
- title: 'Rustdesk-Api-Admin',
+ title: 'Rustdesk API Admin',
hello: '',
sideIsCollapse: false,
logo,
@@ -55,17 +55,21 @@ export const useAppStore = defineStore({
},
getAppConfig () {
console.log('getAppConfig')
- app().then(res => {
+ return app().then(res => {
this.setting.appConfig = res.data
})
},
getAdminConfig () {
console.log('getAdminConfig')
- admin().then(res => {
- this.setting.title = res.data.title
+ return admin().then(res => {
+ this.replaceAdminTitle(res.data.title)
this.setting.hello = res.data.hello
})
},
+ replaceAdminTitle(newTitle){
+ document.title = document.title.replace(`- ${this.setting.title}`, `- ${newTitle}`)
+ this.setting.title = newTitle
+ },
},
})