Skip to content

Commit

Permalink
bugfix: 修复国密相关的体验问题
Browse files Browse the repository at this point in the history
  • Loading branch information
luofann authored and ZhuoZhuoCrayon committed Sep 5, 2023
1 parent a448a87 commit 58feabe
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
13 changes: 9 additions & 4 deletions frontend/desktop/src/components/common/RenderForm/FormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,15 @@
defaultValueFormat = this.getDefaultValueFormat()
}
const isTypeValid = Array.isArray(defaultValueFormat.type)
? defaultValueFormat.type.indexOf(valueType) > -1
: defaultValueFormat.type === valueType
const defaultValueType = Array.isArray(defaultValueFormat.type) ? defaultValueFormat.type : [defaultValueFormat.type]
if (isTypeValid) {
// 处理非密码框表单使用密码变量时,需要展示******的场景
// 非密码框且值类型包含string的表单,如果当前value为Object类型,且type值为password_value时,展示值为******
if (this.scheme.type !== 'password' && defaultValueType.includes('String') && checkDataType(val) === 'Object' && val.type === 'password_value') {
return '******'
}
if (defaultValueType.includes(valueType)) {
formValue = tools.deepClone(val)
} else {
formValue = tools.deepClone(defaultValueFormat.value)
Expand Down Expand Up @@ -468,6 +472,7 @@
valueFormat = {
type: ['String', 'Object'],
value: {
type: 'password_value',
tag: 'value',
value: ''
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@
break
case 'password':
val = {
type: 'password_value',
tag: 'value',
value: ''
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@
<template>
<div class="tag-password">
<div v-if="formMode" class="password-edit-wrapper">
<bk-select v-if="canUseVar" slot="prepend" class="select-type" :clearable="false" :value="localVal.tag" @selected="handleSelectType">
<bk-select
v-if="canUseVar"
slot="prepend"
class="select-type"
:disabled="!editable || !formMode || disabled"
:clearable="false"
:value="localVal.tag"
@selected="handleSelectType">
<bk-option id="value" :name="$t('password_手动输入')"></bk-option>
<bk-option id="variable" :name="$t('password_使用密码变量')"></bk-option>
</bk-select>
Expand All @@ -23,6 +30,7 @@
type="password"
:value="inputText"
:placeholder="inputPlaceholder"
:disabled="!editable || !formMode || disabled"
@input="handleInput"
@focus="handleFocus"
@blur="handleBlur" />
Expand All @@ -33,6 +41,7 @@
rows="4"
:value="inputText"
:placeholder="inputPlaceholder"
:disabled="!editable || !formMode || disabled"
@keydown="handleTextareaKeyDown"
@input="handleTextareaInput"
@keyup="handleTextareaKeyUp"
Expand All @@ -41,7 +50,7 @@
</textarea>
</template>
<bk-select v-else class="select-var" :value="localVal.value" @selected="handleSelectVariable">
<bk-option v-for="item in variables" :key="item.id" :id="item.id" :name="item.name"></bk-option>
<bk-option v-for="item in variables" :key="item.id" :id="item.id" :name="item.id"></bk-option>
</bk-select>
<span v-show="!validateInfo.valid" class="common-error-tip error-info">{{validateInfo.message}}</span>
</div>
Expand Down Expand Up @@ -90,6 +99,7 @@
data () {
return {
localVal: {
type: 'password_value',
tag: 'value',
value: ''
},
Expand Down

0 comments on commit 58feabe

Please sign in to comment.