فهرست منبع

♻️ refactor(profile): 优化个人资料页面代码结构

- 移除未使用的useEffect和Image组件导入
- 简化UserProfile类型导入方式

♻️ refactor(minio): 清理小程序专用上传函数

- 删除uploadMinIOWithTaroFile函数,减少冗余代码
- 移除导出的uploadMinIOWithTaroFile函数,优化API接口
yourname 4 ماه پیش
والد
کامیت
41e2710f8b
2فایلهای تغییر یافته به همراه3 افزوده شده و 22 حذف شده
  1. 3 4
      mini/src/pages/profile/index.tsx
  2. 0 18
      mini/src/utils/minio.ts

+ 3 - 4
mini/src/pages/profile/index.tsx

@@ -1,14 +1,13 @@
-import { useState, useEffect } from 'react'
+import { useState } from 'react'
 import { View, Text, ScrollView } from '@tarojs/components'
 import Taro from '@tarojs/taro'
 import { TabBarLayout } from '@/layouts/tab-bar-layout'
-import { useAuth , type User as UserProfile} from '@/utils/auth'
+import { useAuth } from '@/utils/auth'
 import { cn } from '@/utils/cn'
 import { Button } from '@/components/ui/button'
-import { Image } from '@/components/ui/image'
 import { Navbar } from '@/components/ui/navbar'
 import { AvatarUpload } from '@/components/ui/avatar-upload'
-import { uploadFromChoose, type UploadResult } from '@/utils/minio'
+import { type UploadResult } from '@/utils/minio'
 import './index.css'
 
 const ProfilePage: React.FC = () => {

+ 0 - 18
mini/src/utils/minio.ts

@@ -761,23 +761,6 @@ async function getFileInfoPromise(filePath: string): Promise<{ size: number }> {
   });
 }
 
-// ==================== 小程序专用函数 ====================
-/**
- * 小程序专用:从选择器上传
- */
-export async function uploadMinIOWithTaroFile(
-  uploadPath: string,
-  tempFilePath: string,
-  fileName: string,
-  callbacks?: MinioProgressCallbacks
-): Promise<UploadResult> {
-  if (!isMiniProgram) {
-    throw new Error('此功能仅支持小程序环境');
-  }
-  const fileKey = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}-${fileName}`;
-  return uploadMinIOWithPolicy(uploadPath, tempFilePath, fileKey, callbacks);
-}
-
 // 新增:自动适应运行环境的文件选择并上传函数
 /**
  * 自动适应运行环境:选择文件并上传到 MinIO
@@ -868,6 +851,5 @@ export default {
   getUploadPolicy,
   getMultipartUploadPolicy,
   uploadMinIOWithPolicy,
-  uploadMinIOWithTaroFile,
   uploadFromSelect
 };