From a3872614c11c344faee70b7c3660784276bc6e17 Mon Sep 17 00:00:00 2001
From: anne-lxm <1076217653@qq.com>
Date: Wed, 1 Feb 2023 21:38:08 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0uni-id-pages=E6=8F=92?=
=?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
uni_modules/uni-badge/changelog.md | 2 +
.../components/uni-badge/uni-badge.vue | 8 +--
uni_modules/uni-badge/package.json | 2 +-
uni_modules/uni-easyinput/changelog.md | 2 +
.../uni-easyinput/uni-easyinput.vue | 13 +++-
uni_modules/uni-easyinput/package.json | 2 +-
uni_modules/uni-id-pages/changelog.md | 5 ++
.../uni-id-pages-avatar.vue | 11 +++-
.../uni-id-pages-fab-login.vue | 54 +++++++++-------
uni_modules/uni-id-pages/package.json | 2 +-
.../pages/login/login-withoutpwd.vue | 62 ++++++++++++-------
uni_modules/uni-list/changelog.md | 6 +-
.../uni-list-chat/uni-list-chat.vue | 45 +++++++++-----
.../uni-list-item/uni-list-item.vue | 7 ++-
uni_modules/uni-list/package.json | 2 +-
15 files changed, 147 insertions(+), 76 deletions(-)
diff --git a/uni_modules/uni-badge/changelog.md b/uni_modules/uni-badge/changelog.md
index 56581c4e..e352c60c 100644
--- a/uni_modules/uni-badge/changelog.md
+++ b/uni_modules/uni-badge/changelog.md
@@ -1,3 +1,5 @@
+## 1.2.2(2023-01-28)
+- 修复 运行/打包 控制台警告问题
## 1.2.1(2022-09-05)
- 修复 当 text 超过 max-num 时,badge 的宽度计算是根据 text 的长度计算,更改为 css 计算实际展示宽度,详见:[https://ask.dcloud.net.cn/question/150473](https://ask.dcloud.net.cn/question/150473)
## 1.2.0(2021-11-19)
diff --git a/uni_modules/uni-badge/components/uni-badge/uni-badge.vue b/uni_modules/uni-badge/components/uni-badge/uni-badge.vue
index 664dc370..282d2539 100644
--- a/uni_modules/uni-badge/components/uni-badge/uni-badge.vue
+++ b/uni_modules/uni-badge/components/uni-badge/uni-badge.vue
@@ -21,7 +21,7 @@
* @value error 红色
* @property {String} inverted = [true|false] 是否无需背景颜色
* @property {Number} maxNum 展示封顶的数字值,超过 99 显示 99+
- * @property {String} absolute = [rightTop|rightBottom|leftBottom|leftTop] 开启绝对定位, 角标将定位到其包裹的标签的四角上
+ * @property {String} absolute = [rightTop|rightBottom|leftBottom|leftTop] 开启绝对定位, 角标将定位到其包裹的标签的四角上
* @value rightTop 右上
* @value rightBottom 右下
* @value leftTop 左上
@@ -191,12 +191,13 @@
/* #ifndef APP-NVUE */
display: flex;
overflow: hidden;
- box-sizing: border-box;
+ box-sizing: border-box;
+ font-feature-settings: "tnum";
+ min-width: 20px;
/* #endif */
justify-content: center;
flex-direction: row;
height: 20px;
- min-width: 20px;
padding: 0 4px;
line-height: 18px;
color: #fff;
@@ -206,7 +207,6 @@
border: 1px solid #fff;
text-align: center;
font-family: 'Helvetica Neue', Helvetica, sans-serif;
- font-feature-settings: "tnum";
font-size: $bage-size;
/* #ifdef H5 */
z-index: 999;
diff --git a/uni_modules/uni-badge/package.json b/uni_modules/uni-badge/package.json
index 7a34d9c3..b0bac937 100644
--- a/uni_modules/uni-badge/package.json
+++ b/uni_modules/uni-badge/package.json
@@ -1,7 +1,7 @@
{
"id": "uni-badge",
"displayName": "uni-badge 数字角标",
- "version": "1.2.1",
+ "version": "1.2.2",
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
"keywords": [
"",
diff --git a/uni_modules/uni-easyinput/changelog.md b/uni_modules/uni-easyinput/changelog.md
index 3f9d3b38..5f5a55d4 100644
--- a/uni_modules/uni-easyinput/changelog.md
+++ b/uni_modules/uni-easyinput/changelog.md
@@ -1,3 +1,5 @@
+## 1.1.6(2023-01-28)
+- 新增 keyboardheightchange 事件,可监听键盘高度变化
## 1.1.5(2022-11-29)
- 优化 主题样式
## 1.1.4(2022-10-27)
diff --git a/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue b/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue
index 68dd6a60..5f3ace73 100644
--- a/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue
+++ b/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue
@@ -19,6 +19,7 @@
@blur="_Blur"
@focus="_Focus"
@confirm="onConfirm"
+ @keyboardheightchange="onkeyboardheightchange"
>
@@ -339,7 +341,7 @@ export default {
init() {
if (this.value || this.value === 0) {
this.val = this.value;
- } else if (this.modelValue || this.modelValue === 0) {
+ } else if (this.modelValue || this.modelValue === 0 || this.modelValue === '') {
this.val = this.modelValue;
} else {
this.val = null;
@@ -456,6 +458,15 @@ export default {
this.$emit('clear');
},
+ /**
+ * 键盘高度发生变化的时候触发此事件
+ * 兼容性:微信小程序2.7.0+、App 3.1.0+
+ * @param {Object} event
+ */
+ onkeyboardheightchange(event) {
+ this.$emit("keyboardheightchange",event);
+ },
+
/**
* 去除空格
*/
diff --git a/uni_modules/uni-easyinput/package.json b/uni_modules/uni-easyinput/package.json
index 63d07fbd..657771a7 100644
--- a/uni_modules/uni-easyinput/package.json
+++ b/uni_modules/uni-easyinput/package.json
@@ -1,7 +1,7 @@
{
"id": "uni-easyinput",
"displayName": "uni-easyinput 增强输入框",
- "version": "1.1.5",
+ "version": "1.1.6",
"description": "Easyinput 组件是对原生input组件的增强",
"keywords": [
"uni-ui",
diff --git a/uni_modules/uni-id-pages/changelog.md b/uni_modules/uni-id-pages/changelog.md
index 2c5adcc8..866ac964 100644
--- a/uni_modules/uni-id-pages/changelog.md
+++ b/uni_modules/uni-id-pages/changelog.md
@@ -1,3 +1,8 @@
+## 1.1.0(2023-01-31)
+- 【重要】优化 小程序端资源包大小(运行时大小为:731KB,发行后为:583KB;注:可以直接将本插件作为分包使用)
+- 更新 微信小程序端 上传头像功能 用`wx.cropImage`实现图片裁剪
+- 修复 选择一键登录时会先显示 非密码登录页面的问题
+- 修复 一键登录 点击右上角的关闭按钮没有返回上一页的问题
## 1.0.41(2023-01-16)
- 优化 压缩依赖的文件资源大小
## 1.0.40(2023-01-16)
diff --git a/uni_modules/uni-id-pages/components/uni-id-pages-avatar/uni-id-pages-avatar.vue b/uni_modules/uni-id-pages/components/uni-id-pages-avatar/uni-id-pages-avatar.vue
index 80e8f32f..694594af 100644
--- a/uni_modules/uni-id-pages/components/uni-id-pages-avatar/uni-id-pages-avatar.vue
+++ b/uni_modules/uni-id-pages/components/uni-id-pages-avatar/uni-id-pages-avatar.vue
@@ -122,8 +122,15 @@
callback(res.tempFilePath)
},
fail(e){
- console.error(e)
- callback(filePath)
+ console.error(e)
+ uni.showModal({
+ content: 'wx.cropImage ' + e.errMsg,
+ showCancel: false,
+ confirmText:"跳过裁剪",
+ complete() {
+ callback(filePath)
+ }
+ });
}
})
// #endif
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 c6a98309..defcaa45 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
@@ -2,7 +2,7 @@
+ @click="item.path?toPage(item.path):login_before(item.id,false)">
{{item.text}}
@@ -17,7 +17,6 @@
//前一个窗口的页面地址。控制点击切换快捷登录方式是创建还是返回
import {store,mutations} from '@/uni_modules/uni-id-pages/common/store.js'
let allServicesList = []
-
export default {
computed: {
agreements() {
@@ -66,6 +65,7 @@
"text": "微信登录",
"logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/weixin.png",
},
+ // #ifndef MP-WEIXIN
{
"id": "apple",
"text": "苹果登录",
@@ -111,6 +111,7 @@
"text": "新浪微博", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/sinaweibo.png",
}
+ // #endif
],
univerifyStyle: { //一键登录弹出窗的样式配置参数
"fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
@@ -203,17 +204,18 @@
}
return '/' + pages[pages.length - n].route
},
- navigateTo(path) {
+ 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') {
//如果要被打开的页面已经打开,且这个页面是 /uni_modules/uni-id-pages/pages/index/index 则把类型参数传给他
- let type = path.split('?')[1].split('=')[1]
- uni.$emit('uni-id-pages-set-login-type', type)
+ let loginType = path.split('?')[1].split('=')[1]
+ uni.$emit('uni-id-pages-setLoginType', loginType)
} else if (this.getRoute(2) == path) { // 如果上一个页面就是,马上要打开的页面,直接返回。防止重复开启
uni.navigateBack();
} else if (this.getRoute(1) != path) {
- uni.navigateTo({
+ uni[type]({
url: path,
animationType: 'slide-in-left',
complete(e) {
@@ -238,7 +240,7 @@
].includes(type)) {
return uni.showToast({
title: '该登录方式暂未实现,欢迎提交pr',
- icon: 'none',
+ icon: 'none',
duration: 3000
});
}
@@ -255,7 +257,7 @@
}else{
return uni.showToast({
title: '当前设备不支持此登录,请选择其他登录方式',
- icon: 'none',
+ icon: 'none',
duration: 3000
});
}
@@ -278,7 +280,7 @@
) {
return uni.showToast({
title: '当前设备不支持此登录,请选择其他登录方式',
- icon: 'none',
+ icon: 'none',
duration: 3000
});
}
@@ -321,18 +323,24 @@
uni.showLoading({
mask: true
})
+
if (type == 'univerify') {
let univerifyManager = uni.getUniverifyManager()
+ let clickAnotherButtons = false
let onButtonsClickFn = async res => {
- // console.log('点击了第三方登录,provider:', res, res.provider, this.univerifyStyle.buttons.list);
- //同步一键登录弹出层隐私协议框是否打勾
+ console.log('点击了第三方登录,provider:', res, res.provider, this.univerifyStyle.buttons.list);
+ clickAnotherButtons = true
+ // 同步一键登录弹出层隐私协议框是否打勾
let agree = (await uni.getCheckBoxState())[1].state
this.agree = agree
let {
path
} = this.univerifyStyle.buttons.list[res.index]
- if (path) {
- this.navigateTo(path)
+ if (path) {
+ if( this.getRoute(1).includes('login-withoutpwd') && path.includes('login-withoutpwd') ){
+ this.getParentComponent().showCurrentWebview()
+ }
+ this.toPage(path,1)
closeUniverify()
} else {
if (agree) {
@@ -343,7 +351,7 @@
} else {
uni.showToast({
title: "你未同意隐私政策协议",
- icon: 'none',
+ icon: 'none',
duration: 3000
});
}
@@ -365,16 +373,20 @@
this.login(res.authResult, 'univerify')
},
fail(err) {
- uni.showToast({
- title: JSON.stringify(err),
- icon: 'none',
- duration: 3000
- });
+ console.log(err)
+ if(!clickAnotherButtons){
+ uni.navigateBack()
+ }
+ // uni.showToast({
+ // title: JSON.stringify(err),
+ // icon: 'none',
+ // duration: 3000
+ // });
},
complete: async e => {
uni.hideLoading()
//同步一键登录弹出层隐私协议框是否打勾
- this.agree = (await uni.getCheckBoxState())[1].state
+ // this.agree = (await uni.getCheckBoxState())[1].state
// 取消订阅自定义按钮点击事件
univerifyManager.offButtonsClick(onButtonsClickFn)
}
@@ -422,7 +434,7 @@
uniIdCo[action](params).then(result => {
uni.showToast({
title: '登录成功',
- icon: 'none',
+ icon: 'none',
duration: 2000
});
// #ifdef MP-WEIXIN
diff --git a/uni_modules/uni-id-pages/package.json b/uni_modules/uni-id-pages/package.json
index ae1ae1fa..1c8e2ff5 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.0.41",
+ "version": "1.1.0",
"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 ca60fe31..5e88727f 100644
--- a/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue
+++ b/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue
@@ -10,8 +10,10 @@
将根据第三方账号服务平台的授权范围获取你的信息
-
-
+
+
@@ -19,8 +21,8 @@
未注册的账号验证通过后将自动注册
+86
-
+
@@ -40,7 +42,7 @@
return {
type: "", //快捷登录方式
phone: "", //手机号码
- focusPhone:false,
+ focusPhone: false,
logo: "/static/logo.png"
}
},
@@ -52,24 +54,27 @@
return /^1\d{10}$/.test(this.phone);
},
imgSrc() { //大快捷登录按钮图
- return this.type == 'weixin'? '/uni_modules/uni-id-pages/static/login/weixin.png' : '/uni_modules/uni-id-pages/static/app-plus/apple.png'
+ return this.type == 'weixin' ? '/uni_modules/uni-id-pages/static/login/weixin.png' :
+ '/uni_modules/uni-id-pages/static/app-plus/apple.png'
}
},
async onLoad(e) {
//获取通过url传递的参数type设置当前登录方式,如果没传递直接默认以配置的登录
let type = e.type || config.loginTypes[0]
this.type = type
+
// console.log("this.type: -----------",this.type);
- if(type != 'univerify'){
+ if (type != 'univerify') {
this.focusPhone = true
}
this.$nextTick(() => {
//关闭重复显示的登录快捷方式
if (['weixin', 'apple'].includes(type)) {
- this.$refs.uniFabLogin.servicesList = this.$refs.uniFabLogin.servicesList.filter(item =>item.id != type)
+ this.$refs.uniFabLogin.servicesList = this.$refs.uniFabLogin.servicesList.filter(item =>
+ item.id != type)
}
})
- uni.$on('uni-id-pages-set-login-type', type => {
+ uni.$on('uni-id-pages-setLoginType', type => {
this.type = type
})
},
@@ -84,29 +89,38 @@
// #endif
},
onUnload() {
- uni.$off('uni-id-pages-set-login-type')
+ uni.$off('uni-id-pages-setLoginType')
},
onReady() {
- //是否优先启动一键登录。即:页面一加载就启动一键登录
+ // 是否优先启动一键登录。即:页面一加载就启动一键登录
//#ifdef APP-PLUS
if (this.type == "univerify") {
+ const pages = getCurrentPages();
+ currentWebview = pages[pages.length - 1].$getAppWebview();
+ currentWebview.setStyle({
+ "top": "2000px" // 隐藏当前页面窗体
+ })
this.type == this.loginTypes[1]
// console.log('开始一键登录');
- setTimeout(() => {
- this.$refs.uniFabLogin.login_before('univerify')
- }, 100)
+ this.$refs.uniFabLogin.login_before('univerify')
}
//#endif
},
methods: {
+ showCurrentWebview(){
+ // 恢复当前页面窗体的显示 一键登录,默认不显示当前窗口
+ currentWebview.setStyle({
+ "top": 0
+ })
+ },
quickLogin(e) {
- let options = {}
+ let options = {}
- if (e.detail?.code) {
- options.phoneNumberCode = e.detail.code
- }
+ if (e.detail?.code) {
+ options.phoneNumberCode = e.detail.code
+ }
- if (this.type === 'weixinMobile' && !e.detail?.code) return
+ if (this.type === 'weixinMobile' && !e.detail?.code) return
this.$refs.uniFabLogin.login_before(this.type, true, options)
},
@@ -146,13 +160,13 @@