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

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

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