perf: 修改 acounts 创建提示

This commit is contained in:
ibuler
2023-02-01 18:55:08 +08:00
parent 0bc3a9f0e7
commit c9065c88f3
3 changed files with 16 additions and 7 deletions

View File

@@ -1,13 +1,13 @@
<template>
<Dialog
:title="$tc('assets.AddAccount')"
:visible.sync="iVisible"
:close-on-click-modal="false"
:destroy-on-close="true"
:show-cancel="false"
:show-confirm="false"
:close-on-click-modal="false"
width="70%"
:title="$tc('assets.AddAccount')"
:visible.sync="iVisible"
v-bind="$attrs"
width="70%"
v-on="$listeners"
>
<AccountCreateUpdateForm
@@ -88,8 +88,6 @@ export default {
this.iVisible = false
this.$emit('add', true)
this.$message.success(this.$tc('common.createSuccessMsg'))
}).catch(() => {
this.$message.error(this.$tc('common.createErrorMsg'))
})
},
editAccount(form) {

View File

@@ -234,9 +234,19 @@ export function getDayFuture(days, now) {
export function getErrorResponseMsg(error) {
let msg = ''
const data = error.response && error.response.data || {}
const data = error.response && error.response.data || error
if (data && (data.error || data.msg || data.detail)) {
msg = data.error || data.msg || data.detail
} else if (data && data['non_field_errors']) {
msg = data['non_field_errors'].join(', ')
} else if (Array.isArray(data)) {
msg = data.map((item, i) => {
let msg = getErrorResponseMsg(item)
if (msg) {
msg = `${i + 1}. ${msg}`
}
return msg
}).filter(i => i).join('; ')
}
return msg
}

View File

@@ -102,6 +102,7 @@ export function flashErrorMsg({ response, error }) {
}
let timer = null
function refreshSessionAgeDelay(response) {
if (response.request.responseURL.indexOf('/users/profile/') !== -1) {
return