From 5d50408914c2e5afcc14865b320986fd7be8acf5 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Thu, 06 Nov 2025 14:30:34 +0800
Subject: [PATCH] feat:兼容上传头像
---
src/subPackages/userDetail/infos/index.vue | 17 ++++-------------
1 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/src/subPackages/userDetail/infos/index.vue b/src/subPackages/userDetail/infos/index.vue
index 07b4f68..39bac58 100644
--- a/src/subPackages/userDetail/infos/index.vue
+++ b/src/subPackages/userDetail/infos/index.vue
@@ -147,12 +147,7 @@
uni.chooseImage({
count: 1,
success: (res) => {
-
- // const tempFilePaths = res.tempFiles[0];
- // const a = tempFilePaths.name? tempFilePaths.name : tempFilePaths.path
-
const tempFile = res.tempFiles[0]; // 获取文件对象
- // 1. 获取文件路径(兼容不同端的路径字段)
const filePath = tempFile.path || tempFile.tempFilePath;
if (!filePath) {
uni.showToast({
@@ -161,15 +156,12 @@
});
return;
}
-
-
let fileName = tempFile.name;
if (!fileName) {
-
const pathWithoutProtocol = filePath.replace(/^file:\/\//, '');
fileName = pathWithoutProtocol.split('/').pop() || 'unknown.png';
}
- console.log('filePath', filePath)
+
// 显示加载中
uni.showLoading({
title: '上传中...'
@@ -217,6 +209,7 @@
icon: 'none',
duration: 2000
});
+ getUserInfoData()
} else {
uni.showToast({
@@ -224,10 +217,11 @@
icon: 'none',
duration: 2000
});
+ getUserInfoData()
}
});
- getUserInfoData()
+
};
onShow(async () => {
getUserInfoData()
@@ -241,10 +235,7 @@
display: flex;
flex-direction: column;
align-items: center;
-
-
}
-
.avatarBox {
width: 228rpx;
height: 228rpx;
--
Gitblit v1.9.3