From 140b27424cc839803853225639998851ce39d6ba Mon Sep 17 00:00:00 2001 From: chenruilong Date: Wed, 22 Feb 2023 18:31:51 +0800 Subject: [PATCH] =?UTF-8?q?1.1.2=20=E5=8F=91=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 1 + uni_modules/uni-id-pages/changelog.md | 4 +++ .../uni-id-pages/common/login-page.mixin.js | 7 +++- uni_modules/uni-id-pages/package.json | 2 +- .../uni-id-co/common/constants.js | 9 +++-- .../cloudfunctions/uni-id-co/index.obj.js | 35 +++++++++++++++---- .../cloudfunctions/uni-id-co/package.json | 2 +- .../database/uni-id-users.schema.json | 2 +- 8 files changed, 49 insertions(+), 13 deletions(-) diff --git a/pages.json b/pages.json index 6563c18..089aaf9 100644 --- a/pages.json +++ b/pages.json @@ -123,6 +123,7 @@ "uniIdRouter": { "loginPage": "uni_modules/uni-id-pages/pages/login/login-withoutpwd", "needLogin": [ + "pages/index/index", "uni_modules/uni-id-pages/pages/userinfo/userinfo" ], "resToLogin": true diff --git a/uni_modules/uni-id-pages/changelog.md b/uni_modules/uni-id-pages/changelog.md index 9b1fe26..bb8c7db 100644 --- a/uni_modules/uni-id-pages/changelog.md +++ b/uni_modules/uni-id-pages/changelog.md @@ -1,3 +1,7 @@ +## 1.1.2(2023-02-10) +- 新增 微信小程序端 首页需强制登录时,隐藏返回首页按钮 +- uni-id-co 新增 外部联登后修改用户信息接口(updateUserInfoByExternal) [文档](https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#external-update-userinfo) +- uni-id-co 优化外部联登接口(登录、注册)逻辑 ## 1.1.1(2023-02-02) - 新增 微信小程序端 支持选择使用微信资料的“头像”和“昵称” 设置用户资料 [详情参考](https://wdoc-76491.picgzc.qpic.cn/MTY4ODg1MDUyNzQyMDUxNw_21263_rTNhg68FTngQGdvQ_1647431233?w=1280&h=695.7176470588236) ## 1.1.0(2023-01-31) diff --git a/uni_modules/uni-id-pages/common/login-page.mixin.js b/uni_modules/uni-id-pages/common/login-page.mixin.js index 26936db..cff4071 100644 --- a/uni_modules/uni-id-pages/common/login-page.mixin.js +++ b/uni_modules/uni-id-pages/common/login-page.mixin.js @@ -45,7 +45,12 @@ let mixin = { if (e.uniIdRedirectUrl) { this.uniIdRedirectUrl = decodeURIComponent(e.uniIdRedirectUrl) - } + } + + if(getCurrentPages().length === 1){ + uni.hideHomeButton() + console.log('已隐藏:返回首页按钮'); + } }, computed: { needAgreements() { diff --git a/uni_modules/uni-id-pages/package.json b/uni_modules/uni-id-pages/package.json index fef8199..ff20264 100644 --- a/uni_modules/uni-id-pages/package.json +++ b/uni_modules/uni-id-pages/package.json @@ -1,7 +1,7 @@ { "id": "uni-id-pages", "displayName": "uni-id-pages", - "version": "1.1.1", + "version": "1.1.2", "description": "云端一体简单、统一、可扩展的用户中心页面模版", "keywords": [ "用户管理", diff --git a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/constants.js b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/constants.js index a23dee4..f7ec549 100644 --- a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/constants.js +++ b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/constants.js @@ -10,6 +10,7 @@ const openDataCollectionName = 'opendb-open-data' const openDataCollection = db.collection(openDataCollectionName) const USER_IDENTIFIER = { + _id: 'uid', username: 'username', mobile: 'mobile', email: 'email', @@ -22,7 +23,8 @@ const USER_IDENTIFIER = { 'qq_openid.app': 'qq-account', 'qq_openid.mp': 'qq-account', ali_openid: 'alipay-account', - apple_openid: 'alipay-account' + apple_openid: 'alipay-account', + identities: 'idp' } const USER_STATUS = { @@ -76,6 +78,8 @@ const EMAIL_SCENE = { BIND_EMAIL: 'bind-email' } +const EXTERNAL_DIRECT_CONNECT_PROVIDER = 'externalDirectConnect' + module.exports = { db, dbCmd, @@ -88,5 +92,6 @@ module.exports = { CAPTCHA_SCENE, LOG_TYPE, SMS_SCENE, - EMAIL_SCENE + EMAIL_SCENE, + EXTERNAL_DIRECT_CONNECT_PROVIDER } diff --git a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js index 69013a4..8b15223 100644 --- a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js +++ b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js @@ -83,7 +83,8 @@ const { const { externalRegister, - externalLogin + externalLogin, + updateUserInfoByExternal } = require('./module/external') module.exports = { @@ -602,15 +603,35 @@ module.exports = { */ setPwd, /** - * 外部用户注册,将自身系统的用户账号导入uniId,为其创建一个对应uniId的账号(unieid),使得该账号可以使用依赖uniId的系统及功能。 + * 外部注册用户 * @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#external-register - * @returns + * @param {object} params + * @param {string} params.externalUid 业务系统的用户id + * @param {string} params.nickname 昵称 + * @param {string} params.gender 性别 + * @param {string} params.avatar 头像 + * @returns {object} */ externalRegister, /** - * 外部用户登录,使用unieid即可登录 + * 外部用户登录 * @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#external-login - * @returns - * */ - externalLogin + * @param {object} params + * @param {string} params.userId uni-id体系用户id + * @param {string} params.externalUid 业务系统的用户id + * @returns {object} + */ + externalLogin, + /** + * 使用 userId 或 externalUid 获取用户信息 + * @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#external-update-userinfo + * @param {object} params + * @param {string} params.userId uni-id体系的用户id + * @param {string} params.externalUid 业务系统的用户id + * @param {string} params.nickname 昵称 + * @param {string} params.gender 性别 + * @param {string} params.avatar 头像 + * @returns {object} + */ + updateUserInfoByExternal } diff --git a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/package.json b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/package.json index e4b8b33..e7fe854 100644 --- a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/package.json +++ b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/package.json @@ -1,6 +1,6 @@ { "name": "uni-id-co", - "version": "1.0.38", + "version": "1.1.2", "description": "", "main": "index.js", "keywords": [], diff --git a/uni_modules/uni-id-pages/uniCloud/database/uni-id-users.schema.json b/uni_modules/uni-id-pages/uniCloud/database/uni-id-users.schema.json index f2d13c5..b5aea02 100644 --- a/uni_modules/uni-id-pages/uniCloud/database/uni-id-users.schema.json +++ b/uni_modules/uni-id-pages/uniCloud/database/uni-id-users.schema.json @@ -388,7 +388,7 @@ "title": "用户名", "trim": "both", "permission": { - "read": true, + "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission", "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission" } }, -- GitLab