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