ljw 1 год назад
Родитель
Сommit
4d1da2e89e
6 измененных файлов с 48 добавлено и 23 удалено
  1. 22 0
      src/api/config.js
  2. 0 14
      src/api/rustdesk.js
  3. 14 2
      src/store/app.js
  4. 3 3
      src/store/user.js
  5. 2 2
      src/utils/webclient.js
  6. 7 2
      src/views/my/info.vue

+ 22 - 0
src/api/config.js

@@ -0,0 +1,22 @@
1
+import request from '@/utils/request'
2
+
3
+export function server () {
4
+  return request({
5
+    url: '/config/server',
6
+    method: 'get',
7
+  })
8
+}
9
+
10
+export function app () {
11
+  return request({
12
+    url: '/config/app',
13
+    method: 'get',
14
+  })
15
+}
16
+
17
+export function admin () {
18
+  return request({
19
+    url: '/config/admin',
20
+    method: 'get',
21
+  })
22
+}

+ 0 - 14
src/api/rustdesk.js

@@ -1,14 +0,0 @@
1
-import request from '@/utils/request'
2
-
3
-export function config () {
4
-  return request({
5
-    url: '/server-config',
6
-    method: 'get',
7
-  })
8
-}
9
-export function appConfig () {
10
-  return request({
11
-    url: '/app-config',
12
-    method: 'get',
13
-  })
14
-}

+ 14 - 2
src/store/app.js

@@ -4,7 +4,7 @@ import zhCn from 'element-plus/es/locale/lang/zh-cn'
4
 import en from 'element-plus/es/locale/lang/en'
4
 import en from 'element-plus/es/locale/lang/en'
5
 import ko from 'element-plus/es/locale/lang/ko'
5
 import ko from 'element-plus/es/locale/lang/ko'
6
 import ru from 'element-plus/es/locale/lang/ru'
6
 import ru from 'element-plus/es/locale/lang/ru'
7
-import { appConfig } from '@/api/rustdesk'
7
+import { admin, app } from '@/api/config'
8
 
8
 
9
 const langs = {
9
 const langs = {
10
   'zh-CN': { name: '中文', value: zhCn },
10
   'zh-CN': { name: '中文', value: zhCn },
@@ -17,6 +17,7 @@ export const useAppStore = defineStore({
17
   state: () => ({
17
   state: () => ({
18
     setting: {
18
     setting: {
19
       title: 'Rustdesk-Api-Admin',
19
       title: 'Rustdesk-Api-Admin',
20
+      hello: '',
20
       sideIsCollapse: false,
21
       sideIsCollapse: false,
21
       logo,
22
       logo,
22
       langs: langs,
23
       langs: langs,
@@ -41,12 +42,23 @@ export const useAppStore = defineStore({
41
     changeLang (v) {
42
     changeLang (v) {
42
       this.setLang(v)
43
       this.setLang(v)
43
     },
44
     },
45
+    loadConfig(){
46
+      this.getAppConfig()
47
+      this.getAdminConfig()
48
+    },
44
     getAppConfig () {
49
     getAppConfig () {
45
       console.log('getAppConfig')
50
       console.log('getAppConfig')
46
-      appConfig().then(res => {
51
+      app().then(res => {
47
         this.setting.appConfig = res.data
52
         this.setting.appConfig = res.data
48
       })
53
       })
49
     },
54
     },
55
+    getAdminConfig(){
56
+      console.log('getAdminConfig')
57
+      admin().then(res => {
58
+        this.setting.title = res.data.title
59
+        this.setting.hello = res.data.hello
60
+      })
61
+    }
50
   },
62
   },
51
 })
63
 })
52
 
64
 

+ 3 - 3
src/store/user.js

@@ -43,7 +43,7 @@ export const useUserStore = defineStore({
43
     async login (form) {
43
     async login (form) {
44
       const res = await login(form).catch(_ => false)
44
       const res = await login(form).catch(_ => false)
45
       if (res) {
45
       if (res) {
46
-        useAppStore().getAppConfig()
46
+        useAppStore().loadConfig()
47
         const userData = res.data
47
         const userData = res.data
48
         this.saveUserData(userData)
48
         this.saveUserData(userData)
49
         return userData
49
         return userData
@@ -54,7 +54,7 @@ export const useUserStore = defineStore({
54
     async info () {
54
     async info () {
55
       const res = await current().catch(_ => false)
55
       const res = await current().catch(_ => false)
56
       if (res) {
56
       if (res) {
57
-        useAppStore().getAppConfig()
57
+        useAppStore().loadConfig()
58
         const userData = res.data
58
         const userData = res.data
59
         setToken(userData.token)
59
         setToken(userData.token)
60
         this.$patch({
60
         this.$patch({
@@ -93,7 +93,7 @@ export const useUserStore = defineStore({
93
       const res = await oidcQuery(params).catch(_ => false)
93
       const res = await oidcQuery(params).catch(_ => false)
94
       if (res) {
94
       if (res) {
95
         removeCode()
95
         removeCode()
96
-        useAppStore().getAppConfig()
96
+        useAppStore().loadConfig()
97
         const userData = res.data
97
         const userData = res.data
98
         this.saveUserData(userData)
98
         this.saveUserData(userData)
99
         return userData
99
         return userData

+ 2 - 2
src/utils/webclient.js

@@ -1,5 +1,5 @@
1
 import { ref } from 'vue'
1
 import { ref } from 'vue'
2
-import { config } from '@/api/rustdesk'
2
+import { server } from '@/api/config'
3
 import Websock from '@/utils/webclient/websock'
3
 import Websock from '@/utils/webclient/websock'
4
 import * as rendezvous from '@/utils/webclient/rendezvous'
4
 import * as rendezvous from '@/utils/webclient/rendezvous'
5
 import * as message from '@/utils/webclient/message'
5
 import * as message from '@/utils/webclient/message'
@@ -13,7 +13,7 @@ export const toWebClientLink = (row) => {
13
 export function loadRustdeskConfig () {
13
 export function loadRustdeskConfig () {
14
   const rustdeskConfig = ref({})
14
   const rustdeskConfig = ref({})
15
   const fetchConfig = async () => {
15
   const fetchConfig = async () => {
16
-    const res = await config().catch(_ => false)
16
+    const res = await server().catch(_ => false)
17
     if (res) {
17
     if (res) {
18
       rustdeskConfig.value = res.data
18
       rustdeskConfig.value = res.data
19
       localStorage.setItem('custom-rendezvous-server', res.data.id_server)
19
       localStorage.setItem('custom-rendezvous-server', res.data.id_server)

+ 7 - 2
src/views/my/info.vue

@@ -1,7 +1,7 @@
1
 <template>
1
 <template>
2
   <div>
2
   <div>
3
-    <el-card :title="T('Userinfo')">
4
-      <el-form class="info-form" ref="form" label-width="120px" label-suffix=":">
3
+    <el-card :title="T('Userinfo')" shadow="hover">
4
+      <el-form class="info-form" ref="form" label-width="120px" label-suffix=":" >
5
         <el-form-item :label="T('Username')">
5
         <el-form-item :label="T('Username')">
6
           <div>{{ userStore.username }}</div>
6
           <div>{{ userStore.username }}</div>
7
         </el-form-item>
7
         </el-form-item>
@@ -30,6 +30,9 @@
30
         </el-form-item>
30
         </el-form-item>
31
       </el-form>
31
       </el-form>
32
     </el-card>
32
     </el-card>
33
+    <el-card shadow="hover" style="margin-top: 20px">
34
+      <div v-html="appStore.setting.hello"></div>
35
+    </el-card>
33
     <changePwdDialog v-model:visible="changePwdVisible"></changePwdDialog>
36
     <changePwdDialog v-model:visible="changePwdVisible"></changePwdDialog>
34
   </div>
37
   </div>
35
 </template>
38
 </template>
@@ -38,11 +41,13 @@
38
   import changePwdDialog from '@/components/changePwdDialog.vue'
41
   import changePwdDialog from '@/components/changePwdDialog.vue'
39
   import { ref } from 'vue'
42
   import { ref } from 'vue'
40
   import { useUserStore } from '@/store/user'
43
   import { useUserStore } from '@/store/user'
44
+  import { useAppStore } from '@/store/app'
41
   import { bind, unbind } from '@/api/oauth'
45
   import { bind, unbind } from '@/api/oauth'
42
   import { myOauth } from '@/api/user'
46
   import { myOauth } from '@/api/user'
43
   import { ElMessageBox } from 'element-plus'
47
   import { ElMessageBox } from 'element-plus'
44
   import { T } from '@/utils/i18n'
48
   import { T } from '@/utils/i18n'
45
 
49
 
50
+  const appStore = useAppStore()
46
   const userStore = useUserStore()
51
   const userStore = useUserStore()
47
   const changePwdVisible = ref(false)
52
   const changePwdVisible = ref(false)
48
   const showChangePwd = () => {
53
   const showChangePwd = () => {