提交 19d91730 编写于 作者: DCloud_JSON's avatar DCloud_JSON

2.1.1

上级 9b381cb0
## 2.1.1(2023-02-02)
- 重要 分包加载uni-id-pages 优化后 运行时主包大小为:637KB 分包为:78KB,发布后主包大小为:585KB 分包为:75KB
- 新增 微信小程序端 支持选择使用微信资料的“头像”和“昵称” 设置用户资料 [详情参考](https://wdoc-76491.picgzc.qpic.cn/MTY4ODg1MDUyNzQyMDUxNw_21263_rTNhg68FTngQGdvQ_1647431233?w=1280&h=695.7176470588236)
## 2.1.0(2023-01-17) ## 2.1.0(2023-01-17)
- 重要 新增uni-admin需要的相关依赖和初始化数据(方便uni-admin关联uni-starter后可直接运行) - 重要 新增uni-admin需要的相关依赖和初始化数据(方便uni-admin关联uni-starter后可直接运行)
- 升级依赖的 [uni-id-pages](https://ext.dcloud.net.cn/plugin?name=uni-id-pages) 修复如下问题: - 升级依赖的 [uni-id-pages](https://ext.dcloud.net.cn/plugin?name=uni-id-pages) 修复如下问题:
......
{ {
"id": "uni-starter", "id": "uni-starter",
"displayName": "uni-starter", "displayName": "uni-starter",
"version": "2.1.0", "version": "2.1.1",
"description": "云端一体应用快速开发基本项目模版", "description": "云端一体应用快速开发基本项目模版",
"keywords": [ "keywords": [
"login", "login",
......
## 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) ## 1.1.0(2023-01-31)
- 【重要】优化 小程序端资源包大小(运行时大小为:731KB,发行后为:583KB;注:可以直接将本插件作为分包使用) - 【重要】优化 小程序端资源包大小(运行时大小为:731KB,发行后为:583KB;注:可以直接将本插件作为分包使用)
- 更新 微信小程序端 上传头像功能 用`wx.cropImage`实现图片裁剪 - 更新 微信小程序端 上传头像功能 用`wx.cropImage`实现图片裁剪
......
<template> <template>
<view @click="uploadAvatarImg" class="box" :class="{'showBorder':border}" :style="{width,height,lineHeight:height}"> <button open-type="chooseAvatar" @chooseavatar="bindchooseavatar" @click="uploadAvatarImg" class="box" :class="{'showBorder':border}" :style="{width,height,lineHeight:height}">
<cloud-image v-if="avatar_file" :src="avatar_file.url" :width="width" :height="height"></cloud-image> <cloud-image v-if="avatar_file" :src="avatar_file.url" :width="width" :height="height"></cloud-image>
<uni-icons v-else :style="{width,height,lineHeight:height}" class="chooseAvatar" type="plusempty" size="30" <uni-icons v-else :style="{width,height,lineHeight:height}" class="chooseAvatar" type="plusempty" size="30"
color="#dddddd"></uni-icons> color="#dddddd"></uni-icons>
</view> </button>
</template> </template>
<script> <script>
...@@ -66,12 +66,70 @@ ...@@ -66,12 +66,70 @@
// 使用 clientDB 提交数据 // 使用 clientDB 提交数据
mutations.updateUserInfo({avatar_file}) mutations.updateUserInfo({avatar_file})
}, },
async bindchooseavatar(res){
let avatarUrl = res.detail.avatarUrl
let avatar_file = {
extname: avatarUrl.split('.')[avatarUrl.split('.').length - 1],
name:'',
url:avatarUrl
}
// 裁剪
let filePath = await new Promise((callback) => {
wx.cropImage({
src:avatarUrl,
cropScale:"1:1",
success: res => {
callback(res.tempFilePath)
},
fail(e){
console.error(e)
uni.showModal({
content: 'wx.cropImage ' + e.errMsg,
showCancel: false,
confirmText:"跳过裁剪",
complete() {
callback(avatarUrl)
}
});
}
})
})
//上传到服务器
let cloudPath = this.userInfo._id + '' + Date.now()
avatar_file.name = cloudPath
try{
uni.showLoading({
title: "更新中",
mask: true
});
let {
fileID
} = await uniCloud.uploadFile({
filePath,
cloudPath,
fileType: "image"
});
avatar_file.url = fileID
uni.hideLoading()
}catch(e){
console.error(e);
}
this.setAvatarFile(avatar_file)
},
uploadAvatarImg(res) { uploadAvatarImg(res) {
// #ifdef MP-WEIXIN
return false // 微信小程序走 bindchooseavatar方法
// #endif
if(!this.hasLogin){ if(!this.hasLogin){
return uni.navigateTo({ return uni.navigateTo({
url:'/uni_modules/uni-id-pages/pages/login/login-withoutpwd' url:'/uni_modules/uni-id-pages/pages/login/login-withoutpwd'
}) })
} }
const crop = { const crop = {
quality: 100, quality: 100,
width: 600, width: 600,
...@@ -113,27 +171,6 @@ ...@@ -113,27 +171,6 @@
}); });
} }
// #endif // #endif
// #ifdef MP-WEIXIN
wx.cropImage({
src:filePath,
cropScale:"1:1",
success: res => {
callback(res.tempFilePath)
},
fail(e){
console.error(e)
uni.showModal({
content: 'wx.cropImage ' + e.errMsg,
showCancel: false,
confirmText:"跳过裁剪",
complete() {
callback(filePath)
}
});
}
})
// #endif
}) })
// #endif // #endif
...@@ -166,13 +203,15 @@ ...@@ -166,13 +203,15 @@
overflow: hidden; overflow: hidden;
} }
/* #endif */ /* #endif */
.box{
padding: 0;
}
.chooseAvatar { .chooseAvatar {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: inline-block; display: inline-block;
box-sizing: border-box; box-sizing: border-box;
/* #endif */ /* #endif */
border: dotted 1px #ddd;
border-radius: 10px; border-radius: 10px;
text-align: center; text-align: center;
padding: 1px; padding: 1px;
......
...@@ -7,9 +7,6 @@ ...@@ -7,9 +7,6 @@
<text class="login-title">{{item.text}}</text> <text class="login-title">{{item.text}}</text>
</view> </view>
</view> </view>
<!-- #ifdef MP-WEIXIN -->
<uni-id-pages-user-profile @next="doUserProfileNext" ref="userProfile"></uni-id-pages-user-profile>
<!-- #endif -->
</view> </view>
</template> </template>
<script> <script>
...@@ -333,14 +330,11 @@ ...@@ -333,14 +330,11 @@
let checkBoxState = await uni.getCheckBoxState(); let checkBoxState = await uni.getCheckBoxState();
// 同步一键登录弹出层隐私协议框是否打勾 // 同步一键登录弹出层隐私协议框是否打勾
// #ifdef VUE2 // #ifdef VUE2
let agree = checkBoxState[1].state this.agree = checkBoxState[1].state
// #endif // #endif
// #ifdef VUE3 // #ifdef VUE3
let agree = checkBoxState.state this.agree = checkBoxState.state
// #endif // #endif
this.agree = agree
let { let {
path path
} = this.univerifyStyle.buttons.list[res.index] } = this.univerifyStyle.buttons.list[res.index]
...@@ -351,7 +345,7 @@ ...@@ -351,7 +345,7 @@
this.toPage(path,1) this.toPage(path,1)
closeUniverify() closeUniverify()
} else { } else {
if (agree) { if (this.agree) {
closeUniverify() closeUniverify()
setTimeout(() => { setTimeout(() => {
this.login_before(res.provider) this.login_before(res.provider)
...@@ -445,17 +439,6 @@ ...@@ -445,17 +439,6 @@
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
// #ifdef MP-WEIXIN
//如果是微信小程序端的微信登录,且为首次登录,就弹出获取微信昵称+头像用于绑定资料
if (['weixin', 'weixinMobile'].includes(type) && result.type == "register") {
mutations.loginSuccess({
...result,
showToast: false,
autoBack: false
})
return this.$refs.userProfile.open(result.uid)
}
// #endif
// #ifdef H5 // #ifdef H5
result.loginType = type result.loginType = type
// #endif // #endif
...@@ -475,13 +458,6 @@ ...@@ -475,13 +458,6 @@
uni.hideLoading() uni.hideLoading()
}) })
}, },
doUserProfileNext() {
try {
mutations.loginSuccess()
} catch (e) {
console.log(e);
}
},
async getUserInfo(e) { async getUserInfo(e) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.getUserInfo({ uni.getUserInfo({
......
{ {
"id": "uni-id-pages", "id": "uni-id-pages",
"displayName": "uni-id-pages", "displayName": "uni-id-pages",
"version": "1.1.0", "version": "1.1.1",
"description": "云端一体简单、统一、可扩展的用户中心页面模版", "description": "云端一体简单、统一、可扩展的用户中心页面模版",
"keywords": [ "keywords": [
"用户管理", "用户管理",
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
</uni-list> </uni-list>
<!-- #endif --> <!-- #endif -->
<uni-popup ref="dialog" type="dialog"> <uni-popup ref="dialog" type="dialog">
<uni-popup-dialog mode="input" :value="userInfo.nickname" @confirm="setNickname" title="设置昵称" <uni-popup-dialog mode="input" :value="userInfo.nickname" @confirm="setNickname" :inputType="setNicknameIng?'nickname':'text'"
placeholder="请输入要设置的昵称"> title="设置昵称" placeholder="请输入要设置的昵称">
</uni-popup-dialog> </uni-popup-dialog>
</uni-popup> </uni-popup>
<uni-id-pages-bind-mobile ref="bind-mobile-by-sms" @success="bindMobileSuccess"></uni-id-pages-bind-mobile> <uni-id-pages-bind-mobile ref="bind-mobile-by-sms" @success="bindMobileSuccess"></uni-id-pages-bind-mobile>
...@@ -57,8 +57,9 @@ ...@@ -57,8 +57,9 @@
// mobile:'', // mobile:'',
// nickname:'' // nickname:''
// }, // },
hasPwd:false, hasPwd: false,
showLoginManage:false//通过页面传参隐藏登录&退出登录按钮 showLoginManage: false ,//通过页面传参隐藏登录&退出登录按钮
setNicknameIng:false
} }
}, },
async onShow() { async onShow() {
...@@ -66,8 +67,8 @@ ...@@ -66,8 +67,8 @@
this.univerifyStyle.otherLoginButton.title = "其他号码绑定" this.univerifyStyle.otherLoginButton.title = "其他号码绑定"
}, },
async onLoad(e) { async onLoad(e) {
if(e.showLoginManage){ if (e.showLoginManage) {
this.showLoginManage = true//通过页面传参隐藏登录&退出登录按钮 this.showLoginManage = true //通过页面传参隐藏登录&退出登录按钮
} }
//判断当前用户是否有密码,否则就不显示密码修改功能 //判断当前用户是否有密码,否则就不显示密码修改功能
let res = await uniIdCo.getAccountInfo() let res = await uniIdCo.getAccountInfo()
...@@ -82,13 +83,13 @@ ...@@ -82,13 +83,13 @@
} }
}) })
}, },
logout(){ logout() {
mutations.logout() mutations.logout()
}, },
bindMobileSuccess(){ bindMobileSuccess() {
mutations.updateUserInfo() mutations.updateUserInfo()
}, },
changePassword(){ changePassword() {
uni.navigateTo({ uni.navigateTo({
url: '/uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd', url: '/uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd',
complete: (e) => { complete: (e) => {
...@@ -127,7 +128,7 @@ ...@@ -127,7 +128,7 @@
mutations.updateUserInfo() mutations.updateUserInfo()
}).catch(e => { }).catch(e => {
console.log(e); console.log(e);
}).finally(e=>{ }).finally(e => {
// console.log(e); // console.log(e);
uni.closeAuthView() uni.closeAuthView()
}) })
...@@ -147,15 +148,19 @@ ...@@ -147,15 +148,19 @@
}, },
setNickname(nickname) { setNickname(nickname) {
if (nickname) { if (nickname) {
mutations.updateUserInfo({nickname}) mutations.updateUserInfo({
nickname
})
this.setNicknameIng = false
this.$refs.dialog.close() this.$refs.dialog.close()
} else { } else {
this.setNicknameIng = true
this.$refs.dialog.open() this.$refs.dialog.open()
} }
}, },
deactivate(){ deactivate() {
uni.navigateTo({ uni.navigateTo({
url:"/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate" url: "/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate"
}) })
}, },
async bindThirdAccount(provider) { async bindThirdAccount(provider) {
...@@ -165,7 +170,7 @@ ...@@ -165,7 +170,7 @@
alipay: 'ali_openid', alipay: 'ali_openid',
apple: 'apple_openid', apple: 'apple_openid',
qq: 'qq_openid' qq: 'qq_openid'
}[provider.toLowerCase()] } [provider.toLowerCase()]
if (this.userInfo[bindField]) { if (this.userInfo[bindField]) {
await uniIdCo['unbind' + provider]() await uniIdCo['unbind' + provider]()
...@@ -175,7 +180,9 @@ ...@@ -175,7 +180,9 @@
provider: provider.toLowerCase(), provider: provider.toLowerCase(),
onlyAuthorize: true, onlyAuthorize: true,
success: async e => { success: async e => {
const res = await uniIdCo['bind' + provider]({code: e.code}) const res = await uniIdCo['bind' + provider]({
code: e.code
})
if (res.errCode) { if (res.errCode) {
uni.showToast({ uni.showToast({
title: res.errMsg || '绑定失败', title: res.errMsg || '绑定失败',
...@@ -195,7 +202,6 @@ ...@@ -195,7 +202,6 @@
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "@/uni_modules/uni-id-pages/common/login-page.scss"; @import "@/uni_modules/uni-id-pages/common/login-page.scss";
.uni-content { .uni-content {
...@@ -208,6 +214,7 @@ ...@@ -208,6 +214,7 @@
box-sizing: border-box; box-sizing: border-box;
flex-direction: column; flex-direction: column;
} }
@media screen and (min-width: 690px) { @media screen and (min-width: 690px) {
.uni-content { .uni-content {
padding: 0; padding: 0;
...@@ -219,6 +226,7 @@ ...@@ -219,6 +226,7 @@
box-shadow: none; box-shadow: none;
} }
} }
/* #endif */ /* #endif */
.avatar { .avatar {
align-items: center; align-items: center;
...@@ -242,7 +250,7 @@ ...@@ -242,7 +250,7 @@
width: 80%; width: 80%;
} }
.mt10{ .mt10 {
margin-top: 10px; margin-top: 10px;
} }
</style> </style>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
"title": "头像地址", "title": "头像地址",
"trim": "both", "trim": "both",
"permission": { "permission": {
"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission", "read": true,
"write": "doc._id == auth.uid || 'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission" "write": "doc._id == auth.uid || 'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"description": "用file类型方便使用uni-file-picker组件", "description": "用file类型方便使用uni-file-picker组件",
"title": "头像文件", "title": "头像文件",
"permission": { "permission": {
"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission", "read": true,
"write": "doc._id == auth.uid || 'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission" "write": "doc._id == auth.uid || 'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
......
## 1.8.2(2023-02-02)
- uni-popup-dialog 组件新增 inputType 属性
## 1.8.1(2022-12-01) ## 1.8.1(2022-12-01)
- 修复 nvue 下 v-show 报错 - 修复 nvue 下 v-show 报错
## 1.8.0(2022-11-29) ## 1.8.0(2022-11-29)
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</view> </view>
<view v-else class="uni-dialog-content"> <view v-else class="uni-dialog-content">
<slot> <slot>
<input class="uni-dialog-input" v-model="val" type="text" :placeholder="placeholderText" :focus="focus" > <input class="uni-dialog-input" v-model="val" :type="inputType" :placeholder="placeholderText" :focus="focus" >
</slot> </slot>
</view> </view>
<view class="uni-dialog-button-group"> <view class="uni-dialog-button-group">
...@@ -57,6 +57,10 @@ ...@@ -57,6 +57,10 @@
mixins: [popup], mixins: [popup],
emits:['confirm','close'], emits:['confirm','close'],
props: { props: {
inputType:{
type: String,
default: 'text'
},
value: { value: {
type: [String, Number], type: [String, Number],
default: '' default: ''
...@@ -171,11 +175,6 @@ ...@@ -171,11 +175,6 @@
</script> </script>
<style lang="scss" > <style lang="scss" >
$uni-primary: #007aff !default;
$uni-success: #4cd964 !default;
$uni-warning: #f0ad4e !default;
$uni-error: #dd524d !default;
.uni-popup-dialog { .uni-popup-dialog {
width: 300px; width: 300px;
border-radius: 11px; border-radius: 11px;
...@@ -245,7 +244,7 @@ ...@@ -245,7 +244,7 @@
} }
.uni-button-color { .uni-button-color {
color: $uni-primary; color: #007aff;
} }
.uni-dialog-input { .uni-dialog-input {
...@@ -259,15 +258,15 @@ ...@@ -259,15 +258,15 @@
} }
.uni-popup__success { .uni-popup__success {
color: $uni-success; color: #4cd964;
} }
.uni-popup__warn { .uni-popup__warn {
color: $uni-warning; color: #f0ad4e;
} }
.uni-popup__error { .uni-popup__error {
color: $uni-error; color: #dd524d;
} }
.uni-popup__info { .uni-popup__info {
......
{ {
"id": "uni-popup", "id": "uni-popup",
"displayName": "uni-popup 弹出层", "displayName": "uni-popup 弹出层",
"version": "1.8.1", "version": "1.8.2",
"description": " Popup 组件,提供常用的弹层", "description": " Popup 组件,提供常用的弹层",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册