1.3.7-alpha.1 • Published 3 months ago

@gaopeng123/login-module v1.3.7-alpha.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

login-module

登录模块,统一管理登录逻辑

属性配置

属性说明类型默认值
title项目上面的项目名称string某某系统
id拼接本地数据存储的key值stringlogin-module
main-style登录页样式,可替换背景图string''
title-styletitle的样式string''
body-styleform表单的样式string''
item-styleform表单每一项的样式string''
method请求类型 GET POSTstringPOST
url是否需要组件去处理登录逻辑,默认fetch下发数据请求stringnull
userform表单用户的name属性stringuser
passwordform表单密码的name属性stringpassword
password-text密码是否支持明文显示 plain支持切换明文 cipher不支持stringplain
captcha验证码能力,同时定义验证码字段名词string''
captchasrc验证码src地址,手动设置stringnull
captchaurl验证码请求地址地址string | nullnull
captchamethod验证码请求类型stringPOST
publickey加密公钥stringnull
keeplogged支持记住密码booleanfalse
browser-remembers-password是否允许浏览器记住密码booleanfalse
agreement-proprietary用户协议的主题(主要体现的解释权)例如:干饭人集团用户协议中,会将title和“干饭人集团”进行拼接string''
forgot-password-url是否支持忘记密码功能,如果传递url 插件处理密码找回逻辑否则使用事件监听处理url | boolean‘’
phone-login-url手机号登录,如果传递url 则插件会处理验证码请求,如果不传则使用监听函数处理url | boolean‘’
slot
tabs表单上方title下方区域位置
username-helper表单用户名输入区域位置

事件配置

(注意webpace5摇树配置会导致导入不可用时,请直接使用import ‘@gaopeng123/login-module’ 导入)

submit事件 在点击登录时触发,传递的登录信息在,detail字段中
afterSubmit 在登录数据下发服务端后触发 用于处理登录后的路由跳转等逻辑
submitError 在fetch出错情况下触发
captchaClick 在点击验证码的时候触发
<login-module
    url="/login"
    method="POST"
    publickey="*"
    user="userId"
    password="password"
    captcha="captcha"
    captchamethod="GET"
    captchaurl="/captcha"
    id="form"
    main-style="background-image: url(./assets/background.jpg)"
    body-style="right: 200px;"
    title="系统">
</login-module>
// 事件订阅
<script>
        const form = document.querySelector('#form');
    // 提交事件
    form.addEventListener('submit', (data)=> {
        console.log(data)
    });
    // fetch请求响应后
    form.addEventListener('afterSubmit', (data)=> {
        console.log(data)
    });
    // fetch请求失败后
    form.addEventListener('submitError', (data)=> {
        console.log(data)
    });
    // 点击验证码触发事件
    form.addEventListener('captchaClick', (data) => {
        console.log(data);
        form.setAttribute('captchasrc', '/iconfont/test.svg')   
    });
    // 密码重置
    form.addEventListener('resetPasswordSubmit', (data) => {
        console.log('resetPasswordSubmit', data);
        // 关闭窗口
        form.success();
    });
    /**
    * 短信验证码接口
    */
    form.addEventListener('sendSMSVerificationCode', (data) => {
        console.log('sendSMSVerificationCode', data);
    });
</script>

CSS variables

变量名含义默认值
--login-module-login-title-colortitle颜色#333333
--login-module-login-title-fontSizetitle字体fontSize28px
--login-module-login-title-fontWeighttitle字体fontWeight600
--login-module-login-title-fontFamilytitle字体fontFamilyPingFangSC-Semibold, PingFang SC
--login-module-agreement-proprietary-coloragreement-proprietary颜色#42b983

slot

tabs // 顶部
username-helper // 账号下方
footer // 底部
1.3.7-alpha.1

3 months ago

1.3.6

3 months ago

1.3.6-alpha.3

9 months ago

1.3.6-alpha.4

9 months ago

1.3.6-alpha.2

9 months ago

1.3.5

10 months ago

1.3.4

10 months ago

1.3.2

11 months ago

1.3.0

12 months ago

1.3.1-alpha.0

12 months ago

1.2.4

1 year ago

1.2.19-alpha.2

12 months ago

1.2.12

1 year ago

1.2.13

1 year ago

1.2.11

1 year ago

1.2.17

1 year ago

1.2.15

1 year ago

1.2.18-alpha.1

1 year ago

1.0.4

2 years ago

1.1.0

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.2

2 years ago

0.9.12

2 years ago

0.9.14

2 years ago

0.9.15

2 years ago

1.0.2-alpha.9

2 years ago

1.0.2-alpha.6

2 years ago

0.9.10

2 years ago

0.9.11

2 years ago

1.0.2-alpha.4

2 years ago

1.0.2-alpha.5

2 years ago

0.9.7

2 years ago

0.9.4

2 years ago

0.9.6

2 years ago

1.0.2-alpha.10

2 years ago

0.9.5

2 years ago

0.6.10

2 years ago

0.6.12

2 years ago

0.6.11

2 years ago

0.5.0

2 years ago

0.7.0

2 years ago

0.5.1

2 years ago

0.8.1

2 years ago

0.6.2

2 years ago

0.6.0

2 years ago

0.4.5

2 years ago

0.4.4

2 years ago

0.4.7

2 years ago

0.4.6

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.0

3 years ago

0.2.15

3 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.10

3 years ago

0.2.1

3 years ago

0.2.8

3 years ago

0.2.4

3 years ago

0.1.21

3 years ago

0.1.20

3 years ago

0.1.14

3 years ago

0.1.15

3 years ago

0.1.16

3 years ago

0.1.17

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.13

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.7

3 years ago

0.1.9

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago