fix: 修复参数设置页面,回显问题

This commit is contained in:
shaohuzhang1 2024-10-23 19:19:16 +08:00 committed by shaohuzhang1
parent c9f6941b9a
commit 434db5a900
2 changed files with 10 additions and 10 deletions

View File

@ -102,7 +102,8 @@ class ErrMessage:
'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('请确保此文件名最多包含 {max_length} 个字符(长度为 {length})。') 'max_length': gettext_lazy('%s】请确保此文件名最多包含 {max_length} 个字符(长度为 {length})。' % field),
'invalid': gettext_lazy('%s】提交的数据不是文件。请检查表单上的编码类型。' % field)
} }
@staticmethod @staticmethod
@ -112,5 +113,5 @@ class ErrMessage:
'empty': gettext_lazy('%s】提交的文件为空。' % field), 'empty': gettext_lazy('%s】提交的文件为空。' % field),
'invalid': gettext_lazy('%s】提交的数据不是文件。请检查表单上的编码类型。' % field), 'invalid': gettext_lazy('%s】提交的数据不是文件。请检查表单上的编码类型。' % field),
'no_name': gettext_lazy('%s】无法确定任何文件名。' % field), 'no_name': gettext_lazy('%s】无法确定任何文件名。' % field),
'max_length': gettext_lazy('请确保此文件名最多包含 {max_length} 个字符(长度为 {length})。') 'max_length': gettext_lazy('%s请确保此文件名最多包含 {max_length} 个字符(长度为 {length})。' % field)
} }

View File

@ -326,8 +326,8 @@ const xpackForm = ref<any>({
header_font_color: '#1f2329' header_font_color: '#1f2329'
}, },
float_location: { float_location: {
x: { type: '', value: 0 }, x: { type: 'bottom', value: 30 },
y: { type: '', value: 0 } y: { type: 'right', value: 0 }
} }
}) })
@ -389,12 +389,9 @@ const open = (data: any, content: any) => {
xpackForm.value.show_history = data.show_history xpackForm.value.show_history = data.show_history
xpackForm.value.draggable = data.draggable xpackForm.value.draggable = data.draggable
xpackForm.value.show_guide = data.show_guide xpackForm.value.show_guide = data.show_guide
xpackForm.value.avatar = data.avatar
xpackForm.value.float_icon = data.float_icon
imgUrl.value.avatar = data.avatar imgUrl.value.avatar = data.avatar
imgUrl.value.float_icon = data.float_icon imgUrl.value.float_icon = data.float_icon
imgUrl.value.user_avatar = data.user_avatar imgUrl.value.user_avatar = data.user_avatar
xpackForm.value.user_avatar = data.user_avatar
xpackForm.value.disclaimer = data.disclaimer xpackForm.value.disclaimer = data.disclaimer
xpackForm.value.disclaimer_value = data.disclaimer_value xpackForm.value.disclaimer_value = data.disclaimer_value
xpackForm.value.custom_theme.theme_color = data.custom_theme?.theme_color xpackForm.value.custom_theme.theme_color = data.custom_theme?.theme_color
@ -411,10 +408,12 @@ 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()
form.value.custom_theme = JSON.stringify(form.value.custom_theme)
form.value.float_location = JSON.stringify(form.value.float_location)
Object.keys(form.value).map((item) => { Object.keys(form.value).map((item) => {
fd.append(item, form.value[item]) if (['custom_theme', 'float_location'].includes(item)) {
fd.append(item, JSON.stringify(form.value[item]))
} else {
fd.append(item, form.value[item])
}
}) })
applicationXpackApi.putAccessToken(id as string, fd, loading).then((res) => { applicationXpackApi.putAccessToken(id as string, fd, loading).then((res) => {
emit('refresh') emit('refresh')