提交 72e5912f 编写于 作者: DCloud_JSON's avatar DCloud_JSON

1.1.5 更新 微信小程序端 更新头像信息,如果是使用微信的头像则不再调用裁剪接口

上级 df2fb27c
## 1.1.5(2023-02-23)
- 更新 微信小程序端 更新头像信息,如果是使用微信的头像则不再调用裁剪接口
## 1.1.4(2023-02-21)
- 修复 部分情况下 `uniIdRedirectUrl` 参数无效的问题
## 1.1.3(2023-02-20)
......
......@@ -71,31 +71,8 @@
let avatar_file = {
extname: avatarUrl.split('.')[avatarUrl.split('.').length - 1],
name:'',
url:avatarUrl
url:''
}
// 裁剪
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
......@@ -107,7 +84,7 @@
let {
fileID
} = await uniCloud.uploadFile({
filePath,
filePath:avatarUrl,
cloudPath,
fileType: "image"
});
......@@ -116,20 +93,20 @@
}catch(e){
console.error(e);
}
console.log('avatar_file',avatar_file);
this.setAvatarFile(avatar_file)
},
uploadAvatarImg(res) {
// #ifdef MP-WEIXIN
return false // 微信小程序走 bindchooseavatar方法
// #endif
// #ifndef MP-WEIXIN
if(!this.hasLogin){
return uni.navigateTo({
url:'/uni_modules/uni-id-pages/pages/login/login-withoutpwd'
})
}
const crop = {
quality: 100,
width: 600,
......@@ -192,6 +169,7 @@
this.setAvatarFile(avatar_file)
}
})
// #endif
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册