From afee7ca2261c235d7ce9d18b4a323e9054610edd Mon Sep 17 00:00:00 2001 From: DCloud__JSON Date: Wed, 7 Jun 2023 15:24:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BE=9D=E8=B5=96=E7=9A=84mo?= =?UTF-8?q?dules=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uni-id-pages/changelog.md | 21 +- .../uni-id-pages/common/check-id-card.js | 4 +- uni_modules/uni-id-pages/common/store.js | 18 +- .../uni-id-pages-fab-login.vue | 25 +- uni_modules/uni-id-pages/config.js | 24 +- uni_modules/uni-id-pages/package.json | 4 +- .../pages/login/login-withpwd.vue | 10 +- .../realname-verify/realname-verify.vue | 3 +- .../cloudfunctions/uni-id-co/common/error.js | 140 ++--- .../cloudfunctions/uni-id-co/index.obj.js | 9 +- .../uni-id-co/lib/utils/login.js | 6 +- .../middleware/verify-request-sign.js | 164 +++--- .../uni-id-co/module/admin/add-user.js | 12 +- .../get-auth-result.js | 1 + .../uni-id-co/module/login/login-by-qq.js | 3 +- .../uni-id-co/module/login/login-by-weixin.js | 3 +- .../uni-id-co/module/relate/unbind-qq.js | 15 +- .../uni-id-co/module/relate/unbind-weixin.js | 6 +- .../uni-id-co/module/utils/set-push-cid.js | 27 +- .../uni-id-co/module/verify/create-captcha.js | 5 +- .../module/verify/refresh-captcha.js | 6 +- .../cloudfunctions/uni-id-co/package.json | 2 +- .../uni-open-bridge-common/changelog.md | 2 + .../uni-open-bridge-common/package.json | 2 +- .../uni-open-bridge-common/weixin-server.js | 6 +- uni_modules/uni-transition/changelog.md | 32 +- .../uni-transition/createAnimation.js | 225 ++++---- .../uni-transition/uni-transition.vue | 539 +++++++++--------- uni_modules/uni-transition/package.json | 169 +++--- uni_modules/uni-transition/readme.md | 20 +- 30 files changed, 763 insertions(+), 740 deletions(-) diff --git a/uni_modules/uni-id-pages/changelog.md b/uni_modules/uni-id-pages/changelog.md index f80c251..7c96ba9 100644 --- a/uni_modules/uni-id-pages/changelog.md +++ b/uni_modules/uni-id-pages/changelog.md @@ -1,8 +1,19 @@ -## 1.1.11(2023-03-24) -- 修复 tabbar页面因为token无效而强制跳转至登录页面(url参数包含`uniIdRedirectUrl`)后无法返回的问题 -## 1.1.10(2023-03-24) -- 修复 PC微信扫码登录跳转地址错误 -- uni-id-co 新增 请求鉴权支持 uni-cloud-s2s 模块验证签名 [uni-cloud-s2s文档](https://uniapp.dcloud.net.cn/uniCloud/uni-cloud-s2s.html) +## 1.1.14(2023-05-19) +- 修复 退出登录不会跳转至登录页的问题 +## 1.1.13(2023-05-10) +- 修复 启用摇树优化 报错的问题 +## 1.1.12(2023-05-05) +- uni-id-co 新增 调用 add-user 接口创建用户时允许触发 beforeRegister 钩子方法,beforeRegister 钩子[详见](https://uniapp.dcloud.net.cn/uniCloud/uni-id-summary.html#before-register) +- uni-id-co 新增 自无 unionid 到有 unionid 状态进行登录时为用户补充 unionid 字段 +- uni-id-co 修复 i18n 在特定场景下报错的 bug +- uni-id-co 修复 跨平台解绑微信/QQ时无法解绑的 bug +- uni-id-co 修复 微信小程序等平台创建验证码时无法展示的 bug +- uni-id-co 修复 更新 push_clientid 时因 device_id 没有变化导致无法更新 +## 1.1.11(2023-03-24) +- 修复 tabbar页面因为token无效而强制跳转至登录页面(url参数包含`uniIdRedirectUrl`)后无法返回的问题 +## 1.1.10(2023-03-24) +- 修复 PC微信扫码登录跳转地址错误 +- uni-id-co 新增 请求鉴权支持 uni-cloud-s2s 模块验证签名 [uni-cloud-s2s文档](https://uniapp.dcloud.net.cn/uniCloud/uni-cloud-s2s.html) ## 1.1.9(2023-03-24) - 修复 跳转至登录页面的url参数包含`uniIdRedirectUrl`后无法返回的问题 ## 1.1.8(2023-03-02) diff --git a/uni_modules/uni-id-pages/common/check-id-card.js b/uni_modules/uni-id-pages/common/check-id-card.js index 809d582..c12f2a1 100644 --- a/uni_modules/uni-id-pages/common/check-id-card.js +++ b/uni_modules/uni-id-pages/common/check-id-card.js @@ -1,4 +1,4 @@ -export default function checkIdCard (idCardNumber) { +function checkIdCard (idCardNumber) { if (!idCardNumber || typeof idCardNumber !== 'string' || idCardNumber.length !== 18) return false const coefficient = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] @@ -12,3 +12,5 @@ export default function checkIdCard (idCardNumber) { return checkCode[sum % 11].toString() === code.toLowerCase() } + +export default checkIdCard diff --git a/uni_modules/uni-id-pages/common/store.js b/uni_modules/uni-id-pages/common/store.js index 6bf16ff..d8f2108 100644 --- a/uni_modules/uni-id-pages/common/store.js +++ b/uni_modules/uni-id-pages/common/store.js @@ -79,7 +79,7 @@ export const mutations = { uni.removeStorageSync('uni_id_token'); uni.setStorageSync('uni_id_token_expired', 0) uni.redirectTo({ - url: `/${pagesJson.uniIdRouter && pagesJson.uniIdRouter.loginPage ? 'uni_modules/uni-id-pages/pages/login/login-withoutpwd': ''}`, + url: `/${pagesJson.uniIdRouter && pagesJson.uniIdRouter.loginPage ? pagesJson.uniIdRouter.loginPage: 'uni_modules/uni-id-pages/pages/login/login-withoutpwd'}`, }); uni.$emit('uni-id-pages-logout') this.setUserInfo({},{cover:true}) @@ -98,14 +98,14 @@ export const mutations = { // console.log('判断需要返回几层:', delta); if (uniIdRedirectUrl) { return uni.redirectTo({ - url: uniIdRedirectUrl, - fail: (err1) => { - uni.switchTab({ - url:uniIdRedirectUrl, - fail: (err2) => { - console.log(err1,err2) - } - }) + url: uniIdRedirectUrl, + fail: (err1) => { + uni.switchTab({ + url:uniIdRedirectUrl, + fail: (err2) => { + console.log(err1,err2) + } + }) } }) } 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 f6390f7..913f443 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 @@ -202,7 +202,6 @@ return '/' + pages[pages.length - n].route }, toPage(path,index = 0) { - let type = ['navigateTo','redirectTo'][index] //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') { @@ -212,13 +211,23 @@ } else if (this.getRoute(2) == path) { // 如果上一个页面就是,马上要打开的页面,直接返回。防止重复开启 uni.navigateBack(); } else if (this.getRoute(1) != path) { - uni[type]({ - url: path, - animationType: 'slide-in-left', - complete(e) { - // console.log(e); - } - }) + if(index === 0){ + uni.navigateTo({ + url: path, + animationType: 'slide-in-left', + complete(e) { + // console.log(e); + } + }) + }else{ + uni.redirectTo({ + url: path, + animationType: 'slide-in-left', + complete(e) { + // console.log(e); + } + }) + } } else { console.log('出乎意料的情况,path:' + path); } diff --git a/uni_modules/uni-id-pages/config.js b/uni_modules/uni-id-pages/config.js index d5c7351..e847774 100644 --- a/uni_modules/uni-id-pages/config.js +++ b/uni_modules/uni-id-pages/config.js @@ -17,24 +17,14 @@ export default { // "douyin", // #ifdef APP - // 'univerify', - // #endif - - // #ifdef MP-WEIXIN - 'weixin', - // #endif - - // #ifndef MP-WEIXIN - 'username', - // #endif - + 'univerify', + // #endif + 'weixin', + 'username', // #ifdef APP 'apple', - // #endif - - // #ifndef MP-WEIXIN - 'smsCode', - // #endif + // #endif + 'smsCode' ], // 政策协议 agreements: { @@ -62,7 +52,7 @@ export default { * weak(弱:密码必须包含字母和数字,长度范围:6-16位之间) * 为空或false则不验证密码强度 */ - // passwordStrength: 'medium', + passwordStrength: 'medium', /** * 登录后允许用户设置密码(只针对未设置密码得用户) * 开启此功能将 setPasswordAfterLogin 设置为 true 即可 diff --git a/uni_modules/uni-id-pages/package.json b/uni_modules/uni-id-pages/package.json index 8b8d1da..06c3b4f 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.11", + "version": "1.1.14", "description": "云端一体简单、统一、可扩展的用户中心页面模版", "keywords": [ "用户管理", @@ -48,7 +48,7 @@ "uni-popup", "uni-scss", "uni-transition", - "uni-open-bridge-common", + "uni-open-bridge-common", "uni-cloud-s2s" ], "encrypt": [], diff --git a/uni_modules/uni-id-pages/pages/login/login-withpwd.vue b/uni_modules/uni-id-pages/pages/login/login-withpwd.vue index ea5a83e..e785554 100644 --- a/uni_modules/uni-id-pages/pages/login/login-withpwd.vue +++ b/uni_modules/uni-id-pages/pages/login/login-withpwd.vue @@ -84,7 +84,7 @@ this.focusPassword = true return uni.showToast({ title: '请输入密码', - icon: 'none', + icon: 'none', duration: 3000 }); } @@ -92,7 +92,7 @@ this.focusUsername = true return uni.showToast({ title: '请输入手机号/用户名/邮箱', - icon: 'none', + icon: 'none', duration: 3000 }); } @@ -100,7 +100,7 @@ this.$refs.captcha.getImageCaptcha() return uni.showToast({ title: '请输入验证码', - icon: 'none', + icon: 'none', duration: 3000 }); } @@ -152,7 +152,7 @@ @media screen and (min-width: 690px) { .uni-content { - height: 600px; + height: auto; } } @@ -173,4 +173,4 @@ .link { font-size: 12px; } - + diff --git a/uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify.vue b/uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify.vue index 0ad880b..e402d75 100644 --- a/uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify.vue +++ b/uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify.vue @@ -40,8 +40,9 @@ - + return this + }, + /** + * ref 触发 执行动画 + */ + run(fn) { + if (!this.animation) return + this.animation.run(fn) + }, + // 开始过度动画 + open() { + clearTimeout(this.timer) + this.transform = '' + this.isShow = true + let { opacity, transform } = this.styleInit(false) + if (typeof opacity !== 'undefined') { + this.opacity = opacity + } + this.transform = transform + // 确保动态样式已经生效后,执行动画,如果不加 nextTick ,会导致 wx 动画执行异常 + this.$nextTick(() => { + // TODO 定时器保证动画完全执行,目前有些问题,后面会取消定时器 + this.timer = setTimeout(() => { + this.animation = createAnimation(this.config, this) + this.tranfromInit(false).step() + this.animation.run() + this.$emit('change', { + detail: this.isShow + }) + }, 20) + }) + }, + // 关闭过度动画 + close(type) { + if (!this.animation) return + this.tranfromInit(true) + .step() + .run(() => { + this.isShow = false + this.animationData = null + this.animation = null + let { opacity, transform } = this.styleInit(false) + this.opacity = opacity || 1 + this.transform = transform + this.$emit('change', { + detail: this.isShow + }) + }) + }, + // 处理动画开始前的默认样式 + styleInit(type) { + let styles = { + transform: '' + } + let buildStyle = (type, mode) => { + if (mode === 'fade') { + styles.opacity = this.animationType(type)[mode] + } else { + styles.transform += this.animationType(type)[mode] + ' ' + } + } + if (typeof this.modeClass === 'string') { + buildStyle(type, this.modeClass) + } else { + this.modeClass.forEach(mode => { + buildStyle(type, mode) + }) + } + return styles + }, + // 处理内置组合动画 + tranfromInit(type) { + let buildTranfrom = (type, mode) => { + let aniNum = null + if (mode === 'fade') { + aniNum = type ? 0 : 1 + } else { + aniNum = type ? '-100%' : '0' + if (mode === 'zoom-in') { + aniNum = type ? 0.8 : 1 + } + if (mode === 'zoom-out') { + aniNum = type ? 1.2 : 1 + } + if (mode === 'slide-right') { + aniNum = type ? '100%' : '0' + } + if (mode === 'slide-bottom') { + aniNum = type ? '100%' : '0' + } + } + this.animation[this.animationMode()[mode]](aniNum) + } + if (typeof this.modeClass === 'string') { + buildTranfrom(type, this.modeClass) + } else { + this.modeClass.forEach(mode => { + buildTranfrom(type, mode) + }) + } + + return this.animation + }, + animationType(type) { + return { + fade: type ? 1 : 0, + 'slide-top': `translateY(${type ? '0' : '-100%'})`, + 'slide-right': `translateX(${type ? '0' : '100%'})`, + 'slide-bottom': `translateY(${type ? '0' : '100%'})`, + 'slide-left': `translateX(${type ? '0' : '-100%'})`, + 'zoom-in': `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`, + 'zoom-out': `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})` + } + }, + // 内置动画类型与实际动画对应字典 + animationMode() { + return { + fade: 'opacity', + 'slide-top': 'translateY', + 'slide-right': 'translateX', + 'slide-bottom': 'translateY', + 'slide-left': 'translateX', + 'zoom-in': 'scale', + 'zoom-out': 'scale' + } + }, + // 驼峰转中横线 + toLine(name) { + return name.replace(/([A-Z])/g, '-$1').toLowerCase() + } + } +} + + diff --git a/uni_modules/uni-transition/package.json b/uni_modules/uni-transition/package.json index 379e9aa..ea995a2 100644 --- a/uni_modules/uni-transition/package.json +++ b/uni_modules/uni-transition/package.json @@ -1,87 +1,84 @@ -{ - "id": "uni-transition", - "displayName": "uni-transition 过渡动画", - "version": "1.3.1", - "description": "元素的简单过渡动画", - "keywords": [ - "uni-ui", - "uniui", - "动画", - "过渡", - "过渡动画" -], - "repository": "https://github.com/dcloudio/uni-ui", - "engines": { - "HBuilderX": "" - }, - "directories": { - "example": "../../temps/example_temps" - }, - "dcloudext": { - "category": [ - "前端组件", - "通用组件" - ], - "sale": { - "regular": { - "price": "0.00" - }, - "sourcecode": { - "price": "0.00" - } - }, - "contact": { - "qq": "" - }, - "declaration": { - "ads": "无", - "data": "无", - "permissions": "无" - }, - "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" - }, - "uni_modules": { - "dependencies": ["uni-scss"], - "encrypt": [], - "platforms": { - "cloud": { - "tcb": "y", - "aliyun": "y" - }, - "client": { - "App": { - "app-vue": "y", - "app-nvue": "y" - }, - "H5-mobile": { - "Safari": "y", - "Android Browser": "y", - "微信浏览器(Android)": "y", - "QQ浏览器(Android)": "y" - }, - "H5-pc": { - "Chrome": "y", - "IE": "y", - "Edge": "y", - "Firefox": "y", - "Safari": "y" - }, - "小程序": { - "微信": "y", - "阿里": "y", - "百度": "y", - "字节跳动": "y", - "QQ": "y" - }, - "快应用": { - "华为": "u", - "联盟": "u" - }, - "Vue": { - "vue2": "y", - "vue3": "y" - } - } - } - } +{ + "id": "uni-transition", + "displayName": "uni-transition 过渡动画", + "version": "1.3.2", + "description": "元素的简单过渡动画", + "keywords": [ + "uni-ui", + "uniui", + "动画", + "过渡", + "过渡动画" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } } \ No newline at end of file diff --git a/uni_modules/uni-transition/readme.md b/uni_modules/uni-transition/readme.md index 1e104fe..2f8a77e 100644 --- a/uni_modules/uni-transition/readme.md +++ b/uni_modules/uni-transition/readme.md @@ -1,11 +1,11 @@ - - -## Transition 过渡动画 -> **组件名:uni-transition** -> 代码块: `uTransition` - - -元素过渡动画 - -### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-transition) + + +## Transition 过渡动画 +> **组件名:uni-transition** +> 代码块: `uTransition` + + +元素过渡动画 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-transition) #### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file -- GitLab