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