Description:域账号校验超时,系统异常,无效的域账号,网络异常,错误提示优化

Match-id-f059af3f770b133bc7999d3dcbedb4fec3f39d07
This commit is contained in:
li-li-wang 2023-08-09 12:38:35 +08:00 committed by baoyang
parent 0b7e655796
commit 5cf66c246d
4 changed files with 38 additions and 18 deletions

View File

@ -128,6 +128,8 @@ export default class Constants {
static ERR_JS_CREDENTIAL_SERVER_ERROR = 19100005;
static ERR_JS_NOT_DLP_FILE = 19100008;
static ERR_JS_DLP_FILE_READ_ONLY = 19100010;
static ERR_JS_INVALID_PARAMETER = 12300002;
static ERR_JS_ACCOUNT_NOT_FOUND = 12300003;
static DLP_FILE_PARSE_ERROR = 103;
static DLP_INSTALL_SANDBOX_SUCCESS = 202;
static DLP_GET_PARAMETERS_FAILED = 100;

View File

@ -19,12 +19,21 @@ import Constants from '../constant';
import { isPC } from '../utils';
const TAG = "[DLPManager_AddStaff]";
@Extend(Text) function inputMessageText() {
.fontSize($r('sys.float.ohos_fa_text_size_body'))
.lineHeight(Constants.PP_TEXT_LINE_HEIGHT2)
.fontColor($r('sys.color.ohos_id_color_handup'))
.fontWeight(FontWeight.Medium)
.margin({ top: Constants.ENCRYPTION_ADD_STAFF_BORDER_MARGIN_TOP })
.textAlign(TextAlign.Start)
}
@Component
struct staffInput {
@State inputId: string = ''
@State isAccountCheckSuccess: boolean = true;
@State staffArrayLength: boolean = false;
@State isInputInvalid: boolean = false;
@State isNetworkInvalid: boolean = false;
@State activeStaffIndex: number = -1;
@Link staffArray: {
authAccount: string,
@ -108,8 +117,9 @@ struct staffInput {
.height(Constants.ENCRYPTION_ADD_STAFF_HEIGHT)
.onChange((value) => {
this.inputId = value
if (this.isInputInvalid) {
this.isInputInvalid = false
if (this.isInputInvalid || this.isNetworkInvalid) {
this.isInputInvalid = false;
this.isNetworkInvalid = false;
}
})
.onSubmit(() => {
@ -122,10 +132,6 @@ struct staffInput {
if (!this.inputId) {
return
}
if (this.inputId === 'error') {
this.isInputInvalid = true
return
}
try {
let domainAccountInfo = {
domain: 'china',
@ -133,16 +139,21 @@ struct staffInput {
}
if (globalThis.domainAccount) {
this.isAccountCheckSuccess = false;
account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo, (err, res) => {
account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo, (err, isExist) => {
this.isAccountCheckSuccess = true;
if (err) {
this.isInputInvalid = true;
return;
} else {
if (isExist) {
this.staffArray.push({
authAccount: this.inputId.toLocaleLowerCase(),
})
this.inputId = '';
} else {
if ([Constants.ERR_JS_INVALID_PARAMETER, Constants.ERR_JS_ACCOUNT_NOT_FOUND].includes(err.code)){
this.isInputInvalid = true;
return;
} else {
this.isNetworkInvalid = true;
return;
}
}
})
} else {
@ -167,19 +178,18 @@ struct staffInput {
})
.border({
width: { bottom: Constants.ENCRYPTION_ADD_STAFF_BORDER },
color: (this.isInputInvalid || this.staffArrayLength )
color: (this.isInputInvalid || this.staffArrayLength || this.isNetworkInvalid )
? $r('sys.color.ohos_id_color_handup') : $r('sys.color.ohos_id_color_text_secondary'),
})
Flex({ direction: FlexDirection.Row }) {
if (this.isInputInvalid) {
Text(globalThis.domainAccount ? $r('app.string.incorrect_work_ID') : $r('app.string.incorrect_account'))
.fontSize($r('sys.float.ohos_fa_text_size_body'))
.lineHeight(Constants.PP_TEXT_LINE_HEIGHT2)
.fontColor($r('sys.color.ohos_id_color_handup'))
.fontWeight(FontWeight.Medium)
.margin({ top: Constants.ENCRYPTION_ADD_STAFF_BORDER_MARGIN_TOP })
.textAlign(TextAlign.Start)
.inputMessageText()
}
if (this.isNetworkInvalid) {
Text(globalThis.domainAccount ? $r('app.string.network_invalid') : $r('app.string.incorrect_account'))
.inputMessageText()
}
Blank()
if (this.staffArray.length >= Constants.ENCRYPTION_ADD_STAFF_LENGTH_MAX * Constants.ENCRYPTION_ADD_STAFF_LENGTH) {

View File

@ -156,6 +156,10 @@
"name": "incorrect_work_ID",
"value": "Invalid employee ID. Please reenter."
},
{
"name": "network_invalid",
"value": "Network error. Try again later."
},
{
"name": "enter_a_complete_account",
"value": "Enter an account name"

View File

@ -156,6 +156,10 @@
"name": "incorrect_work_ID",
"value": "工号错误,请输入有效的工号"
},
{
"name": "network_invalid",
"value": "网络异常,请稍后再试"
},
{
"name": "enter_a_complete_account",
"value": "请输入用户帐号"