diff --git a/frontend/src/api/modules/user/index.ts b/frontend/src/api/modules/user/index.ts index 48952a7a4c..79a360ba1e 100644 --- a/frontend/src/api/modules/user/index.ts +++ b/frontend/src/api/modules/user/index.ts @@ -1,7 +1,34 @@ import MSR from '@/api/http/index'; -import { GetMenuListUrl, getPublicKeyUrl, isLoginUrl, LoginUrl, LogoutUrl } from '@/api/requrls/user'; +import { + AddAPIKEYUrl, + AddLocalConfigUrl, + DeleteAPIKEYUrl, + DisableAPIKEYUrl, + DisableLocalConfigUrl, + EnableAPIKEYUrl, + EnableLocalConfigUrl, + GetAPIKEYListUrl, + GetLocalConfigUrl, + GetMenuListUrl, + GetPublicKeyUrl, + isLoginUrl, + LoginUrl, + LogoutUrl, + UpdateAPIKEYUrl, + UpdateLocalConfigUrl, + ValidAPIKEYUrl, + ValidLocalConfigUrl, +} from '@/api/requrls/user'; -import type { LoginData, LoginRes } from '@/models/user'; +import type { + AddLocalConfigParams, + APIKEY, + LocalConfig, + LoginData, + LoginRes, + UpdateAPIKEYParams, + UpdateLocalConfigParams, +} from '@/models/user'; import type { RouteRecordNormalized } from 'vue-router'; @@ -22,5 +49,70 @@ export function getMenuList() { } export function getPublicKeyRequest() { - return MSR.get({ url: getPublicKeyUrl }, { ignoreCancelToken: true }); + return MSR.get({ url: GetPublicKeyUrl }, { ignoreCancelToken: true }); +} + +// 个人设置-更新本地执行 +export function updateLocalConfig(data: UpdateLocalConfigParams) { + return MSR.post({ url: UpdateLocalConfigUrl, data }); +} + +// 个人设置-添加本地执行 +export function addLocalConfig(data: AddLocalConfigParams) { + return MSR.post({ url: AddLocalConfigUrl, data }); +} + +// 个人设置-验证本地执行配置 +export function validLocalConfig(id: string) { + return MSR.get({ url: ValidLocalConfigUrl, params: id }); +} + +// 个人设置-获取本地执行配置 +export function getLocalConfig() { + return MSR.get({ url: GetLocalConfigUrl }); +} + +// 个人设置-启用本地执行配置 +export function enableLocalConfig(id: string) { + return MSR.get({ url: EnableLocalConfigUrl, params: id }); +} + +// 个人设置-禁用本地执行配置 +export function disableLocalConfig(id: string) { + return MSR.get({ url: DisableLocalConfigUrl, params: id }); +} + +// 个人设置-修改 APIKEY +export function updateAPIKEY(data: UpdateAPIKEYParams) { + return MSR.post({ url: UpdateAPIKEYUrl, data }); +} + +// 个人设置-验证 APIKEY +export function validAPIKEY() { + return MSR.get({ url: ValidAPIKEYUrl }); +} + +// 个人设置-获取 APIKEY 列表 +export function getAPIKEYList() { + return MSR.get({ url: GetAPIKEYListUrl }); +} + +// 个人设置-开启 APIKEY +export function enableAPIKEY(id: string) { + return MSR.get({ url: EnableAPIKEYUrl, params: id }); +} + +// 个人设置-关闭 APIKEY +export function disableAPIKEY(id: string) { + return MSR.get({ url: DisableAPIKEYUrl, params: id }); +} + +// 个人设置-删除 APIKEY +export function deleteAPIKEY(id: string) { + return MSR.get({ url: DeleteAPIKEYUrl, params: id }); +} + +// 个人设置-生成 APIKEY +export function addAPIKEY() { + return MSR.get({ url: AddAPIKEYUrl }); } diff --git a/frontend/src/api/requrls/user.ts b/frontend/src/api/requrls/user.ts index e05a14851a..1b8939f64b 100644 --- a/frontend/src/api/requrls/user.ts +++ b/frontend/src/api/requrls/user.ts @@ -2,4 +2,17 @@ export const LoginUrl = '/login'; export const isLoginUrl = '/is-login'; export const LogoutUrl = '/signout'; export const GetMenuListUrl = '/api/user/menu'; -export const getPublicKeyUrl = '/get-key'; +export const GetPublicKeyUrl = '/get-key'; +export const UpdateLocalConfigUrl = '/user/local/config/update'; // 个人设置-更新本地执行配置 +export const AddLocalConfigUrl = '/user/local/config/add'; // 个人设置-添加本地执行 +export const ValidLocalConfigUrl = '/user/local/config/validate'; // 个人设置-验证本地执行 +export const GetLocalConfigUrl = '/user/local/config/get'; // 个人设置-获取本地执行配置 +export const EnableLocalConfigUrl = '/user/local/config/enable'; // 个人设置-启用本地执行配置 +export const DisableLocalConfigUrl = '/user/local/config/disable'; // 个人设置-禁用本地执行配置 +export const UpdateAPIKEYUrl = '/user/api/key/update'; // 个人设置-更新 APIKEY +export const ValidAPIKEYUrl = '/user/api/key/validate'; // 个人设置-验证 APIKEY +export const GetAPIKEYListUrl = '/user/api/key/list'; // 个人设置-获取 APIKEY 列表 +export const EnableAPIKEYUrl = '/user/api/key/enable'; // 个人设置-开启 APIKEY +export const DisableAPIKEYUrl = '/user/api/key/disable'; // 个人设置-关闭 APIKEY +export const DeleteAPIKEYUrl = '/user/api/key/delete'; // 个人设置-删除 APIKEY +export const AddAPIKEYUrl = '/user/api/key/add'; // 个人设置-生成 APIKEY diff --git a/frontend/src/auto-import.d.ts b/frontend/src/auto-import.d.ts index 5eb5ac528f..d298c3ccaa 100644 --- a/frontend/src/auto-import.d.ts +++ b/frontend/src/auto-import.d.ts @@ -62,4 +62,5 @@ declare global { declare global { // @ts-ignore export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue' + import('vue') } diff --git a/frontend/src/components/business/ms-personal-drawer/components/apiKey.vue b/frontend/src/components/business/ms-personal-drawer/components/apiKey.vue index 1c075d2783..021034158a 100644 --- a/frontend/src/components/business/ms-personal-drawer/components/apiKey.vue +++ b/frontend/src/components/business/ms-personal-drawer/components/apiKey.vue @@ -10,7 +10,15 @@ - {{ t('common.new') }} + + {{ t('common.new') }} +
@@ -38,14 +46,16 @@
{{ t('ms.personal.desc') }}
- -
{{ item.desc }}
+ +
{{ item.description || '-' }}
{{ t('ms.personal.createTime') }}
-
{{ dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') }}
+
+ {{ dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') }} +
{{ t('ms.personal.expireTime') }}
- {{ dayjs(item.expireTime).format('YYYY-MM-DD HH:mm:ss') }} + {{ item.forever ? t('ms.personal.forever') : dayjs(item.expireTime).format('YYYY-MM-DD HH:mm:ss') }} @@ -61,7 +71,7 @@ v-model:model-value="item.enable" size="small" :before-change="() => handleBeforeEnableChange(item)" - > + />
@@ -112,6 +122,7 @@