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

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

上级 123040e6
......@@ -36,6 +36,8 @@ export const IBizInput = defineComponent({
let autoSize: boolean | { minRows: Number; maxRows?: Number } = {
minRows: 2,
};
const showPwd = ref(false);
const showTogglePwdIcon = ref(false);
// 文本域默认行数,仅在 textarea 类型下有效
const rows = ref(2);
......@@ -72,6 +74,10 @@ export const IBizInput = defineComponent({
autoSize = false;
}
}
if (editorModel.editorParams.showtogglepwdicon) {
showTogglePwdIcon.value =
editorModel.editorParams.showtogglepwdicon === 'true';
}
}
const currentVal = ref<string | number>('');
......@@ -187,6 +193,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 +215,10 @@ export const IBizInput = defineComponent({
inputRef,
autoSize,
c,
showPwd,
showTogglePwdIcon,
pwdIcon,
handleTogglePwd,
};
},
render(h) {
......@@ -223,20 +244,24 @@ export const IBizInput = defineComponent({
'disabledresize',
this.c.editorParams.disabledresize === 'true',
),
this.ns.e(this.type),
this.ns.is('show-pwd', this.showPwd),
],
props: {
...this.c.customProps,
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,
......
......@@ -28,6 +28,17 @@
}
}
}
@include e(password) {
input {
-webkit-text-security: disc;
}
@include when('show-pwd') {
input {
-webkit-text-security: unset;
}
}
}
}
@media screen and (max-width: 720px) {
......@@ -130,9 +141,9 @@
}
&.is-disabled {
background-color: #E5E8EC;
border-color: #E5E8EC;
color: #B3BBC6;
background-color: #e5e8ec;
border-color: #e5e8ec;
color: #b3bbc6;
}
}
......
......@@ -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;
......@@ -110,12 +112,18 @@ export default defineComponent({
}
}
ibiz.notification.error({
title: res.data?.message || '登录失败',
title: res.data?.message?.includes('用户名或密码错误')
? res.data?.message
: '登录失败',
});
loading.value = false;
} catch (error) {
ibiz.notification.error({
title: (error as IData).response?.data?.message || '登录失败',
title: (error as IData).response?.data?.message?.includes(
'用户名或密码错误',
)
? (error as IData).response?.data?.message
: '登录失败',
});
loading.value = false;
}
......@@ -213,16 +221,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('用户名或密码错误')
? res.data?.message
: '登录失败',
});
loading.value = false;
} catch (error) {
ibiz.notification.error({
title: (error as IData).response?.data?.message || '登录失败',
title: (error as IData).response?.data?.message?.includes(
'用户名或密码错误',
)
? (error as IData).response?.data?.message
: '登录失败',
});
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,16 @@
}
}
}
@include b('kq-login-view') {
@include e(password) {
input {
-webkit-text-security: disc;
}
@include when('show-pwd') {
input {
-webkit-text-security: unset;
}
}
}
}
......@@ -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('用户名或密码错误')
? res.data?.message
: '登录失败',
});
loading.value = false;
} catch (error) {
ibiz.notification.error({
title: (error as IData).response?.data?.message || '登录失败',
title: (error as IData).response?.data?.message?.includes(
'用户名或密码错误',
)
? (error as IData).response?.data?.message
: '登录失败',
});
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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册