فهرست منبع

Merge branch '2025北京诚祥' of https://gogs.mtavip.com/wangguoyu/uniProject into 2025北京诚祥

tanxue 2 ماه پیش
والد
کامیت
5d2a570e14
1فایلهای تغییر یافته به همراه26 افزوده شده و 24 حذف شده
  1. 26 24
      pages/client/my/myInfo.vue

+ 26 - 24
pages/client/my/myInfo.vue

@@ -71,62 +71,64 @@
 	})
 
 	function handleSelect(e) {
-		doUploadImage(e.tempFilePaths[0])
+		console.log('eee',e)
+		doUploadImage(e)
 	}
 
 	function genderSelect(genderValue){
 		data.gender = genderValue;
 	}
 
-	function doUploadImage(filePath) {
-		const loading = uni.showLoading({
-			title: '上传中...',
-			mask: true
-		});
+	function doUploadImage(params) {
+		const filePath = params.tempFiles[0];
+		const fileUrl = params.tempFilePaths;
 
+		
 		try {
-			const suffix = filePath.split('.').pop();
+			const suffix = filePath.file.name.split('.').pop();
 			let req = {
 				prefix: 'resource/',
-				suffix: suffix
+				suffix: suffix,
 			}
-
+			uni.showLoading({
+				title: '上传中...',
+				mask: true
+			});
 			getAliyunPolicy(req).then(res => {
 				if (res.code == 0) {
 					const policyData = res.data;
+					
 					const formData = {
-						key: policyData.key,
-						policy: policyData.policy,
-						OSSAccessKeyId: policyData.accessid,
-						signature: policyData.signature,
-						success_action_status: '200',
-						file: {
-							name: policyData.key,
-							uri: filePath
-						}
-					};
+						key:  policyData.key,
+						policy:  policyData.policy,
+						signature:  policyData.signature,
+						OSSAccessKeyId:  policyData.accessid,
+						success_action_status:  '200',
+					}
+					
 					uni.uploadFile({
 						url: policyData.uploadUrl,
-						filePath: filePath,
+						filePath: fileUrl[0],
 						name: 'file',
 						formData: formData,
-						header: {
-							'Content-Type': 'multipart/form-data'
-						},
 						success(uploadRes) {
 							if (uploadRes.statusCode === 200) {
+								console.log('uploadRes',uploadRes)
 								data.icon = `${policyData.downloadUrl}/${policyData.key}`;
+								console.log( `${policyData.downloadUrl}/${policyData.key}`)
 								uni.showToast({
 									title: '上传成功',
 									icon: 'success'
 								});
+								
 							} else {
 								uni.showToast({
 									icon: 'none',
 									title: '上传失败',
 								});
+								uni.hideLoading();
 							}
-							uni.hideLoading();
+			
 						},
 						fail(err) {
 							uni.showToast({