提交 312affad 编写于 作者: jlj05024111@163.com's avatar jlj05024111@163.com

feat: 更新禁用登录页密码框的自动填充,统一登录失败时的消息提示

上级 85b23e27
......@@ -37,6 +37,9 @@ export const IBizInput = defineComponent({
minRows: 2,
};
const showPwd = ref(false);
const showTogglePwdIcon = ref(false);
// 文本域默认行数,仅在 textarea 类型下有效
const rows = ref(2);
if (editorModel.editorType === 'TEXTAREA_10') {
......@@ -72,6 +75,10 @@ export const IBizInput = defineComponent({
autoSize = false;
}
}
if (editorModel.editorParams.showtogglepwdicon) {
showTogglePwdIcon.value =
editorModel.editorParams.showtogglepwdicon === 'true';
}
}
const currentVal = ref<string | number>('');
......@@ -187,6 +194,17 @@ export const IBizInput = defineComponent({
});
}
const pwdIcon = computed(() => {
if (showTogglePwdIcon.value && type.value === 'password') {
return showPwd.value ? 'eye-open' : 'eye-close';
}
return '';
});
const handleTogglePwd = () => {
showPwd.value = !showPwd.value;
};
return {
ns,
rows,
......@@ -198,6 +216,10 @@ export const IBizInput = defineComponent({
inputRef,
autoSize,
c,
showPwd,
showTogglePwdIcon,
pwdIcon,
handleTogglePwd,
};
},
render(h) {
......@@ -208,6 +230,8 @@ export const IBizInput = defineComponent({
this.ns.is('textarea', Object.is(this.type, 'textarea')),
this.disabled ? this.ns.m('disabled') : '',
this.readonly ? this.ns.m('readonly') : '',
this.ns.e(this.type),
this.ns.is('show-pwd', this.showPwd),
]}
>
{[
......@@ -229,14 +253,16 @@ export const IBizInput = defineComponent({
value: this.currentVal,
clearable: !this.disabled && !this.readonly && true,
placeholder: this.controller.placeHolder,
type: this.type,
type: this.type === 'password' ? 'text' : this.type,
rows: this.rows,
disabled: this.disabled,
autosize: this.autoSize,
icon: this.pwdIcon,
},
on: {
'on-change': this.handleChange,
'on-blur': this.handleBlur,
'on-click': this.handleTogglePwd,
},
nativeOn: {
keyup: this.handleKeyUp,
......
......@@ -30,6 +30,17 @@
}
}
@include e(password) {
input {
-webkit-text-security: disc;
}
@include when('show-pwd') {
input {
-webkit-text-security: unset;
}
}
}
@media screen and (max-width: 720px) {
@include b(login-extend) {
align-items: center;
......
......@@ -72,6 +72,8 @@ export default defineComponent({
const countdown = ref(0);
const showPwd = ref(false);
onMounted(() => {
setTimeout(() => {
const el = document.querySelector('.app-loading-x') as HTMLDivElement;
......@@ -213,16 +215,20 @@ export default defineComponent({
</i-form-item>
<i-form-item prop='password'>
<i-input
type='password'
type='text'
class={[ns.e('password'), ns.is('show-pwd', showPwd.value)]}
value={loginData.password}
on-on-change={(evt: InputEvent) => {
const { value } = evt.target as HTMLInputElement;
loginData.password = value;
}}
on-on-enter={onClick}
on-on-click={() => {
showPwd.value = !showPwd.value;
}}
placeholder='请输入密码'
size='large'
password
icon={showPwd.value ? 'ios-eye' : 'ios-eye-off'}
>
<i-icon type='ios-unlock' slot='prefix'></i-icon>
</i-input>
......
......@@ -56,6 +56,8 @@ export default defineComponent({
ibiz.appData = undefined;
ibiz.orgData = undefined;
const showPwd = ref(false);
onMounted(() => {
setTimeout(() => {
const el = document.querySelector('.app-loading-x') as HTMLDivElement;
......@@ -90,12 +92,18 @@ export default defineComponent({
}
}
ibiz.notification.error({
title: res.data?.message || '登录失败',
title: res.data?.message?.includes('用户名或密码错误')
? '用户名或密码错误'
: '登录失败',
});
loading.value = false;
} catch (error) {
ibiz.notification.error({
title: (error as IData).response?.data?.message || '登录失败',
title: (error as IData).response?.data?.message?.includes(
'用户名或密码错误',
)
? '用户名或密码错误'
: '登录失败',
});
loading.value = false;
}
......@@ -150,16 +158,20 @@ export default defineComponent({
</i-form-item>
<i-form-item prop='password'>
<i-input
type='password'
type='text'
class={[ns.e('password'), ns.is('show-pwd', showPwd.value)]}
value={loginData.password}
on-on-change={(evt: InputEvent) => {
const { value } = evt.target as HTMLInputElement;
loginData.password = value;
}}
on-on-enter={onClick}
on-on-click={() => {
showPwd.value = !showPwd.value;
}}
placeholder='请输入密码'
size='large'
password
icon={showPwd.value ? 'ios-eye' : 'ios-eye-off'}
>
<i-icon type='ios-unlock' slot='prefix'></i-icon>
</i-input>
......
......@@ -127,3 +127,15 @@
}
}
}
@include b('kq-login-view') {
@include e(password) {
input {
-webkit-text-security: disc;
}
@include when('show-pwd') {
input {
-webkit-text-security: unset;
}
}
}
}
\ No newline at end of file
......@@ -57,6 +57,8 @@ export default defineComponent({
ibiz.appData = undefined;
ibiz.orgData = undefined;
const showPwd = ref(false);
onMounted(() => {
setTimeout(() => {
const el = document.querySelector('.app-loading-x') as HTMLDivElement;
......@@ -90,12 +92,18 @@ export default defineComponent({
}
}
ibiz.notification.error({
title: res.data?.message || '登录失败',
title: res.data?.message?.includes('用户名或密码错误')
? '用户名或密码错误'
: '登录失败',
});
loading.value = false;
} catch (error) {
ibiz.notification.error({
title: (error as IData).response?.data?.message || '登录失败',
title: (error as IData).response?.data?.message?.includes(
'用户名或密码错误',
)
? '用户名或密码错误'
: '登录失败',
});
loading.value = false;
}
......@@ -147,16 +155,20 @@ export default defineComponent({
<span class={ns.b('form-label-text')}>密码</span>
</div>
<i-input
type='password'
type='text'
value={loginData.password}
on-on-change={(evt: InputEvent) => {
const { value } = evt.target as HTMLInputElement;
loginData.password = value;
}}
class={[ns.e('password'), ns.is('show-pwd', showPwd.value)]}
on-on-enter={onClick}
on-on-click={() => {
showPwd.value = !showPwd.value;
}}
placeholder='请输入密码'
size='large'
password
icon={showPwd.value ? 'ios-eye' : 'ios-eye-off'}
></i-input>
</i-form-item>
<i-form-item class={ns.b('buttons')}>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册