refactor: 优化代码
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run

This commit is contained in:
wxg0103 2024-10-29 19:22:20 +08:00
parent 6ebeeaf134
commit da38621d1d
4 changed files with 8 additions and 8 deletions

View File

@ -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)
}

View File

@ -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) => {

View File

@ -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: '回调地址'
}

View File

@ -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