Merge branch 'main' of http://123.207.203.228:3000/shang/yfs
This commit is contained in:
commit
bf36bbbec5
|
|
@ -56,7 +56,8 @@
|
|||
avatarUrl: uni.getStorageSync('userinfo').headimg,
|
||||
nickname: uni.getStorageSync('userinfo').nickname,
|
||||
headimg_status: false,
|
||||
id: uni.getStorageSync('userinfo').ID
|
||||
id: uni.getStorageSync('userinfo').ID,
|
||||
imageBase64: "",
|
||||
}
|
||||
},
|
||||
onLoad() {},
|
||||
|
|
@ -70,11 +71,40 @@
|
|||
},
|
||||
|
||||
onChooseAvatar(e) {
|
||||
console.log("6666666666", e.detail.avatarUrl)
|
||||
// console.log("6666666666", e.detail, e.detail.avatarUrl)
|
||||
this.avatarUrl = e.detail.avatarUrl
|
||||
this.headimg_status = true
|
||||
var that = this;
|
||||
// 获取图片的 Base64 编码
|
||||
uni.getFileSystemManager().readFile({
|
||||
filePath: this.avatarUrl,
|
||||
encoding: 'base64',
|
||||
success: (base64Res) => {
|
||||
const base64 = 'data:image/png;base64,' + base64Res.data;
|
||||
console.log(base64);
|
||||
that.imageBase64 = base64;
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('读取文件失败:', err);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
// // 获取图片的二进制数据
|
||||
// uni.getFileSystemManager().readFile({
|
||||
// filePath: this.avatarUrl,
|
||||
// encoding: 'binary',
|
||||
// success: (binaryRes) => {
|
||||
// const binaryData = binaryRes.data;
|
||||
// console.log('二进制数据:', binaryData);
|
||||
// },
|
||||
// fail: (err) => {
|
||||
// console.error('读取文件失败:', err);
|
||||
// }
|
||||
// });
|
||||
},
|
||||
|
||||
|
||||
// chooseAvatar() {
|
||||
// let that = this
|
||||
// uni.chooseImage({
|
||||
|
|
@ -115,7 +145,8 @@
|
|||
url: 'update_userinfo',
|
||||
data: {
|
||||
nickname: that.nickname,
|
||||
headimg: that.avatarUrl
|
||||
headimg: that.avatarUrl,
|
||||
imagebase: that.imageBase64
|
||||
},
|
||||
success(ress) {
|
||||
if (ress.status == 1) {
|
||||
|
|
@ -136,7 +167,8 @@
|
|||
url: 'update_userinfo',
|
||||
data: {
|
||||
nickname: that.nickname,
|
||||
headimg: that.avatarUrl
|
||||
headimg: that.avatarUrl,
|
||||
imagebase: that.imageBase64
|
||||
},
|
||||
success(ress) {
|
||||
if (ress.status == 1) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user