diff --git a/pages/index/index.vue b/pages/index/index.vue index 775863b6bbb9d30402b4e4d5edbbb05bc723ce9e..8cda38eed318bbd27e873109166e3eb9dc3a97b1 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -34,6 +34,9 @@ }, { "value": "huawei", "text": "华为登录" + }, { + "value": "huaweiMobile", + "text": "华为账号一键登录" }] } }, diff --git a/uni_modules/uni-captcha/components/uni-captcha/uni-captcha.vue b/uni_modules/uni-captcha/components/uni-captcha/uni-captcha.vue index 1399e194a45674592053324125713068ee8719e6..71ca03058dba133cfc1a2cf303ca625b3e41d60b 100644 --- a/uni_modules/uni-captcha/components/uni-captcha/uni-captcha.vue +++ b/uni_modules/uni-captcha/components/uni-captcha/uni-captcha.vue @@ -6,7 +6,7 @@ mode="widthFix"> + :inputBorder="false" maxlength="4" v-model="val" placeholder="请输入验证码"> diff --git a/uni_modules/uni-id-pages/changelog.md b/uni_modules/uni-id-pages/changelog.md index 1294ce2265446f7765937bb0c713107c309b3489..0096606a9d302589a2511944e70792ea12d2151d 100644 --- a/uni_modules/uni-id-pages/changelog.md +++ b/uni_modules/uni-id-pages/changelog.md @@ -1,5 +1,7 @@ -## 1.1.23(2024-11-05) -- uni-id-co 修复 没有配置敏感信息解密密钥时导致登录报错的问题 +## 1.1.24(2024-12-20) +- 新增 支持华为元服务登录 +## 1.1.23(2024-11-05) +- uni-id-co 修复 没有配置敏感信息解密密钥时导致登录报错的问题 ## 1.1.22(2024-09-13) - 注册登录时去除字符串两端的空白字符 - 删除static目录下重复资源 diff --git a/uni_modules/uni-id-pages/components/uni-id-pages-agreements/uni-id-pages-agreements.vue b/uni_modules/uni-id-pages/components/uni-id-pages-agreements/uni-id-pages-agreements.vue index 861e3887e275f542c85201a5cb8a2d97bc0af4aa..b38bcd65df3ad8dd4d3cfcb08ab251abf50af6b2 100644 --- a/uni_modules/uni-id-pages/components/uni-id-pages-agreements/uni-id-pages-agreements.vue +++ b/uni_modules/uni-id-pages/components/uni-id-pages-agreements/uni-id-pages-agreements.vue @@ -33,7 +33,7 @@ import config from '@/uni_modules/uni-id-pages/config.js' let retryFun = ()=>console.log('为定义') /** - * uni-id-pages-agreements + * uni-id-pages-agreements * @description 用户服务协议和隐私政策条款组件 * @property {String,Boolean} scope = [register|login] 作用于哪种场景如:register 注册(包括登录并注册,如:微信登录、苹果登录、短信验证码登录)、login 登录。默认值为:register */ @@ -74,12 +74,22 @@ popup(Fun){ this.needPopupAgreements = true // this.needAgreements = true + + //::TODO 鸿蒙元服务暂不支持 createAnimation,等支持后再打开 + // #ifdef MP-HARMONY + return uni.showModal({ + title: "提示", + content: `请先阅读并同意${this.agreements.map(item=>`“${item.title}”`).join('和')}`, + }) + // #endif + // #ifndef MP-HARMONY this.$nextTick(()=>{ if(Fun){ retryFun = Fun } this.$refs.popupAgreement.open() }) + // #endif }, navigateTo({ url, @@ -100,7 +110,7 @@ this.$emit('setAgree', this.isAgree) } }, - created() { + created() { this.needAgreements = (config?.agreements?.scope || []).includes(this.scope) }, data() { @@ -145,7 +155,7 @@ color: #04498c; cursor: pointer; } - + .checkbox-box ::v-deep .uni-checkbox-input{ border-radius: 100%; } @@ -155,13 +165,13 @@ color: #FFFFFF !important; background-color: $uni-color-primary; } - + .content{ flex-wrap: wrap; flex-direction: row; - } - - .root ::v-deep .uni-popup__error{ - color: #333333; + } + + .root ::v-deep .uni-popup__error{ + color: #333333; } diff --git a/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue b/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue index eefd629821b484e6984cff8b6e55feb143e5b655..c9248f3bd11a1dd7b384fb5b4e2b71b02d8f4d05 100644 --- a/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue +++ b/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue @@ -62,22 +62,29 @@ "text": "微信登录", "logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/weixin.png", }, + { + "id": "huawei", + "text": "华为登录", + "logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/huawei.png", + "path": "/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=huawei" + }, + { + "id": "huaweiMobile", + "text": "华为账号一键登录", + "logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/huawei.png", + "path": "/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=huaweiMobile" + }, // #ifndef MP-WEIXIN { "id": "apple", "text": "苹果登录", - "logo": "/uni_modules/uni-id-pages/static/app/uni-fab-login/apple.png", + "logo": "/uni_modules/uni-id-pages/static/uni-fab-login/apple.png", }, { "id": "univerify", "text": "一键登录", "logo": "/uni_modules/uni-id-pages/static/app/uni-fab-login/univerify.png", }, - { - "id": "huawei", - "text": "华为登录", - "logo": "/uni_modules/uni-id-pages/static/app/uni-fab-login/univerify.png", - }, { "id": "taobao", "text": "淘宝登录", //暂未提供该登录方式的接口示例 @@ -207,7 +214,7 @@ return '/' + pages[pages.length - n].route }, toPage(path,index = 0) { - //console.log('比较', this.getRoute(1),this.getRoute(2), path) + console.log('比较', this.getRoute(1),this.getRoute(2), path) if (this.getRoute(1) == path.split('?')[0] && this.getRoute(1) == '/uni_modules/uni-id-pages/pages/login/login-withoutpwd') { //如果要被打开的页面已经打开,且这个页面是 /uni_modules/uni-id-pages/pages/index/index 则把类型参数传给他 @@ -238,7 +245,7 @@ } }, async login_before(type, navigateBack = true, options = {}) { - console.log(type); + console.log(type, options); //提示空实现 if (["qq", "xiaomi", @@ -256,15 +263,17 @@ }); } + console.log('检查当前环境是否支持这种登录方式') //检查当前环境是否支持这种登录方式 // #ifdef APP let isAppExist = true await new Promise((callback) => { + console.log('uni.getProvider', uni.getProvider) uni.getProvider({ service: 'oauth', success: (res) => { const provider = res.providers.find(item => item.id === type) - + console.log('res', res) if (provider) { isAppExist = provider?.isAppExist ?? true callback() @@ -282,6 +291,7 @@ }) }) // #endif + if ( // #ifdef APP !isAppExist @@ -347,7 +357,11 @@ } } // #endif + console.log('login ----') uni.showLoading({ + // #ifdef MP-HARMONY + title: "正在登录", + // #endif mask: true }) @@ -425,7 +439,7 @@ }) } - if (type === 'weixinMobile') { + if (type === 'weixinMobile' || type === 'huaweiMobile') { return this.login({ phoneCode: options.phoneNumberCode }, type) @@ -451,7 +465,12 @@ } : e.authResult, type) }, fail: async (err) => { - console.log(JSON.stringify(err)); + console.error(JSON.stringify(err)); + uni.showModal({ + content: `登录失败; code: ${err.errCode || -1}`, + confirmText: "知道了", + showCancel: false + }); uni.hideLoading() } }) @@ -570,6 +589,6 @@ margin-top: 6px; color: #999; font-size: 10px; - width: 70px; + width: 80px; } diff --git a/uni_modules/uni-id-pages/config.js b/uni_modules/uni-id-pages/config.js index e847774904015c7b21e0bc94379681b158bed1ea..5d7f2310954602c1aaca2885a9bf931850c984c2 100644 --- a/uni_modules/uni-id-pages/config.js +++ b/uni_modules/uni-id-pages/config.js @@ -19,12 +19,18 @@ export default { // #ifdef APP 'univerify', // #endif + // #ifndef MP-HARMONY 'weixin', + // #endif 'username', // #ifdef APP 'apple', // #endif - 'smsCode' + 'smsCode', + // #ifdef APP-HARMONY || MP-HARMONY + 'huawei', + 'huaweiMobile' + // #endif ], // 政策协议 agreements: { diff --git a/uni_modules/uni-id-pages/package.json b/uni_modules/uni-id-pages/package.json index 8f8326f99230e40be741276bebb7c8dff6f6e6a2..0c7981cfa6cb3e6aa2c29927b7f0b941c5eec097 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.23", + "version": "1.1.24", "description": "云端一体简单、统一、可扩展的用户中心页面模版", "keywords": [ "用户管理", diff --git a/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue b/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue index 4621f1d49f81502d46a9ae9b02340820dc4e3273..5069707b1f25cfe91ca7dd670b132e35b46c634e 100644 --- a/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue +++ b/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue @@ -7,13 +7,20 @@ 请选择登录方式 -