add admin conf
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function server () {
|
||||
return request({
|
||||
url: '/config/server',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function app () {
|
||||
return request({
|
||||
url: '/config/app',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function admin () {
|
||||
return request({
|
||||
url: '/config/admin',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function config () {
|
||||
return request({
|
||||
url: '/server-config',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
export function appConfig () {
|
||||
return request({
|
||||
url: '/app-config',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
+14
-2
@@ -4,7 +4,7 @@ import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
import en from 'element-plus/es/locale/lang/en'
|
||||
import ko from 'element-plus/es/locale/lang/ko'
|
||||
import ru from 'element-plus/es/locale/lang/ru'
|
||||
import { appConfig } from '@/api/rustdesk'
|
||||
import { admin, app } from '@/api/config'
|
||||
|
||||
const langs = {
|
||||
'zh-CN': { name: '中文', value: zhCn },
|
||||
@@ -17,6 +17,7 @@ export const useAppStore = defineStore({
|
||||
state: () => ({
|
||||
setting: {
|
||||
title: 'Rustdesk-Api-Admin',
|
||||
hello: '',
|
||||
sideIsCollapse: false,
|
||||
logo,
|
||||
langs: langs,
|
||||
@@ -41,12 +42,23 @@ export const useAppStore = defineStore({
|
||||
changeLang (v) {
|
||||
this.setLang(v)
|
||||
},
|
||||
loadConfig(){
|
||||
this.getAppConfig()
|
||||
this.getAdminConfig()
|
||||
},
|
||||
getAppConfig () {
|
||||
console.log('getAppConfig')
|
||||
appConfig().then(res => {
|
||||
app().then(res => {
|
||||
this.setting.appConfig = res.data
|
||||
})
|
||||
},
|
||||
getAdminConfig(){
|
||||
console.log('getAdminConfig')
|
||||
admin().then(res => {
|
||||
this.setting.title = res.data.title
|
||||
this.setting.hello = res.data.hello
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
+3
-3
@@ -43,7 +43,7 @@ export const useUserStore = defineStore({
|
||||
async login (form) {
|
||||
const res = await login(form).catch(_ => false)
|
||||
if (res) {
|
||||
useAppStore().getAppConfig()
|
||||
useAppStore().loadConfig()
|
||||
const userData = res.data
|
||||
this.saveUserData(userData)
|
||||
return userData
|
||||
@@ -54,7 +54,7 @@ export const useUserStore = defineStore({
|
||||
async info () {
|
||||
const res = await current().catch(_ => false)
|
||||
if (res) {
|
||||
useAppStore().getAppConfig()
|
||||
useAppStore().loadConfig()
|
||||
const userData = res.data
|
||||
setToken(userData.token)
|
||||
this.$patch({
|
||||
@@ -93,7 +93,7 @@ export const useUserStore = defineStore({
|
||||
const res = await oidcQuery(params).catch(_ => false)
|
||||
if (res) {
|
||||
removeCode()
|
||||
useAppStore().getAppConfig()
|
||||
useAppStore().loadConfig()
|
||||
const userData = res.data
|
||||
this.saveUserData(userData)
|
||||
return userData
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ref } from 'vue'
|
||||
import { config } from '@/api/rustdesk'
|
||||
import { server } from '@/api/config'
|
||||
import Websock from '@/utils/webclient/websock'
|
||||
import * as rendezvous from '@/utils/webclient/rendezvous'
|
||||
import * as message from '@/utils/webclient/message'
|
||||
@@ -13,7 +13,7 @@ export const toWebClientLink = (row) => {
|
||||
export function loadRustdeskConfig () {
|
||||
const rustdeskConfig = ref({})
|
||||
const fetchConfig = async () => {
|
||||
const res = await config().catch(_ => false)
|
||||
const res = await server().catch(_ => false)
|
||||
if (res) {
|
||||
rustdeskConfig.value = res.data
|
||||
localStorage.setItem('custom-rendezvous-server', res.data.id_server)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card :title="T('Userinfo')">
|
||||
<el-form class="info-form" ref="form" label-width="120px" label-suffix=":">
|
||||
<el-card :title="T('Userinfo')" shadow="hover">
|
||||
<el-form class="info-form" ref="form" label-width="120px" label-suffix=":" >
|
||||
<el-form-item :label="T('Username')">
|
||||
<div>{{ userStore.username }}</div>
|
||||
</el-form-item>
|
||||
@@ -30,6 +30,9 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card shadow="hover" style="margin-top: 20px">
|
||||
<div v-html="appStore.setting.hello"></div>
|
||||
</el-card>
|
||||
<changePwdDialog v-model:visible="changePwdVisible"></changePwdDialog>
|
||||
</div>
|
||||
</template>
|
||||
@@ -38,11 +41,13 @@
|
||||
import changePwdDialog from '@/components/changePwdDialog.vue'
|
||||
import { ref } from 'vue'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { useAppStore } from '@/store/app'
|
||||
import { bind, unbind } from '@/api/oauth'
|
||||
import { myOauth } from '@/api/user'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { T } from '@/utils/i18n'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const userStore = useUserStore()
|
||||
const changePwdVisible = ref(false)
|
||||
const showChangePwd = () => {
|
||||
|
||||
Reference in New Issue
Block a user