mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
refactor: 优化代码
This commit is contained in:
parent
6ebeeaf134
commit
da38621d1d
|
|
@ -101,7 +101,7 @@ class ErrMessage:
|
|||
return {
|
||||
'required': gettext_lazy('【%s】此字段必填。' % field),
|
||||
'null': gettext_lazy('【%s】此字段不能为null。' % field),
|
||||
'invalid_image': gettext_lazy('【%s】上载有效的图像,您上载的文件不是图像或图像已损坏。' % field),
|
||||
'invalid_image': gettext_lazy('您上载的【%s】文件不是图像或图像已损坏,请上载有效的图像。' % field),
|
||||
'max_length': gettext_lazy('【%s】请确保此文件名最多包含 {max_length} 个字符(长度为 {length})。' % field),
|
||||
'invalid': gettext_lazy('【%s】提交的数据不是文件,请检查表单上的编码类型。' % field)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -431,11 +431,11 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
await formEl.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
let fd = new FormData()
|
||||
Object.keys(form.value).map((item) => {
|
||||
Object.keys(xpackForm.value).map((item) => {
|
||||
if (['custom_theme', 'float_location'].includes(item)) {
|
||||
fd.append(item, JSON.stringify(form.value[item]))
|
||||
fd.append(item, JSON.stringify(xpackForm.value[item]))
|
||||
} else {
|
||||
fd.append(item, form.value[item])
|
||||
fd.append(item, xpackForm.value[item])
|
||||
}
|
||||
})
|
||||
applicationXpackApi.putAccessToken(id as string, fd, loading).then((res) => {
|
||||
|
|
|
|||
|
|
@ -148,9 +148,9 @@ function createPlatform(key: string, name: string): Platform {
|
|||
|
||||
function formatFieldName(key?: any): string {
|
||||
const fieldNames: { [key: string]: string } = {
|
||||
corp_id: 'Corp ID',
|
||||
app_key: 'APP Key',
|
||||
app_secret: 'APP Secret',
|
||||
corp_id: 'Corp ID',
|
||||
agent_id: 'Agent ID',
|
||||
callback_url: '回调地址'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ const props = defineProps<{
|
|||
config: {
|
||||
app_secret: string
|
||||
app_key: string
|
||||
agent_id?: string
|
||||
corp_id?: string
|
||||
}
|
||||
}>()
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ const initActive = async () => {
|
|||
const data = {
|
||||
appKey: props.config.app_key,
|
||||
appSecret: props.config.app_secret,
|
||||
agent_id: props.config.agent_id
|
||||
corp_id: props.config.corp_id
|
||||
}
|
||||
|
||||
const redirectUri = encodeURIComponent(window.location.origin)
|
||||
|
|
@ -104,7 +104,7 @@ const initActive = async () => {
|
|||
state: 'fit2cloud-ding-qr',
|
||||
prompt: 'consent',
|
||||
exclusiveLogin: 'true',
|
||||
exclusiveCorpId: 'ding7fd29779c8cf3e0224f2f5cc6abecb85'
|
||||
exclusiveCorpId: data.corp_id
|
||||
},
|
||||
(loginResult) => {
|
||||
const authCode = loginResult.authCode
|
||||
|
|
|
|||
Loading…
Reference in New Issue