From fe7c0536adf6b212b52d6f8187c53efdb6f6763c Mon Sep 17 00:00:00 2001 From: linju Date: Wed, 7 Sep 2022 16:18:11 +0800 Subject: [PATCH] 1.0.12 --- pages/index/index.vue | 2 +- uni_modules/uni-id-pages/changelog.md | 3 + uni_modules/uni-id-pages/common/common.js | 12 ++ .../uni-id-pages/common/login-page.scss | 16 +-- .../uni-id-pages/pages/userinfo/userinfo.vue | 36 ++++-- .../uni-id-co/package-lock.json | 122 +++++++++++------- 6 files changed, 121 insertions(+), 70 deletions(-) create mode 100644 uni_modules/uni-id-pages/common/common.js diff --git a/pages/index/index.vue b/pages/index/index.vue index 92dbd78..db64161 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -46,7 +46,7 @@ }, toUserInfoPage() { uni.navigateTo({ - url: "/uni_modules/uni-id-pages/pages/userinfo/userinfo" + url: "/uni_modules/uni-id-pages/pages/userinfo/userinfo?showLoginManage=true" }) } } diff --git a/uni_modules/uni-id-pages/changelog.md b/uni_modules/uni-id-pages/changelog.md index 210fd1b..b11a207 100644 --- a/uni_modules/uni-id-pages/changelog.md +++ b/uni_modules/uni-id-pages/changelog.md @@ -2,6 +2,9 @@ - 优化 适配pc端样式 - 新增 邮箱验证码注册 - 新增 邮箱验证码找回密码 +- 新增 退出登录(全局)回调事件:`uni-id-pages-logout`,支持通过[uni.$on](https://uniapp.dcloud.net.cn/api/window/communication.html#on)监听; +- 调整 抽离退出登录方法至`/uni_modules/uni-id-pages/common/common.js`中,方便在项目其他页面中调用 +- 调整 用户中心(路径:`/uni_modules/uni-id-pages/pages/userinfo/userinfo`)默认不再显示退出登录按钮。支持页面传参数`showLoginManage=true`恢复显示 ## 1.0.11(2022-09-01) - 修复 iOS端,一键登录功能卡在showLoading的问题 - 更新 合并密码强度与长度配置 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#config) diff --git a/uni_modules/uni-id-pages/common/common.js b/uni_modules/uni-id-pages/common/common.js new file mode 100644 index 0000000..6ba8e23 --- /dev/null +++ b/uni_modules/uni-id-pages/common/common.js @@ -0,0 +1,12 @@ +const uniIdCo = uniCloud.importObject("uni-id-co") +export default { + async logout() { + await uniIdCo.logout() + uni.removeStorageSync('uni_id_token'); + uni.setStorageSync('uni_id_token_expired', 0) + uni.redirectTo({ + url: '/uni_modules/uni-id-pages/pages/login/login-withoutpwd', + }); + uni.$emit('uni-id-pages-logout') + }, +} \ No newline at end of file diff --git a/uni_modules/uni-id-pages/common/login-page.scss b/uni_modules/uni-id-pages/common/login-page.scss index af505db..9279073 100644 --- a/uni_modules/uni-id-pages/common/login-page.scss +++ b/uni_modules/uni-id-pages/common/login-page.scss @@ -97,15 +97,7 @@ border-radius: 5px; } - .uni-body.uni_modules-uni-id-pages-pages-login-login-withoutpwd{ - height: auto !important; - } - -/* -.uni-btn::after{ - display: none; -} -.uni-btn[disabled]{ - background-color: $uni-color-primary !important; - opacity: 0.3; -}*/ \ No newline at end of file +.uni-body.uni_modules-uni-id-pages-pages-login-login-withoutpwd{ + height: auto !important; +} + \ No newline at end of file diff --git a/uni_modules/uni-id-pages/pages/userinfo/userinfo.vue b/uni_modules/uni-id-pages/pages/userinfo/userinfo.vue index 567eaba..c59c9c6 100644 --- a/uni_modules/uni-id-pages/pages/userinfo/userinfo.vue +++ b/uni_modules/uni-id-pages/pages/userinfo/userinfo.vue @@ -21,14 +21,17 @@ - - +