浏览代码

图标上传

charles_c 5 月之前
父节点
当前提交
87a78bd581
共有 3 个文件被更改,包括 29 次插入26 次删除
  1. 9 8
      src/pages/Activity/index.tsx
  2. 10 9
      src/pages/ExchangeItem/index.tsx
  3. 10 9
      src/pages/NewActivities/index.tsx

+ 9 - 8
src/pages/Activity/index.tsx

@@ -156,6 +156,7 @@ const ActivityManagement: React.FC = () => {
 
       if (uploadData.success) {
         setBackgroundImageUrl(uploadData.url);
+        message.success('图片上传成功');
         return {
           status: 'done',
           url: uploadData.url,
@@ -238,14 +239,14 @@ const ActivityManagement: React.FC = () => {
             name: 'file',
             listType: 'picture-card',
           }}
-          onChange={(info) => {
-            const { status } = info.file;
-            if (status === 'done') {
-              message.success('图片上传成功');
-            } else if (status === 'error') {
-              message.error('图片上传失败');
-            }
-          }}
+          // onChange={(info) => {
+          //   const { status } = info.file;
+          //   if (status === 'done') {
+          //     message.success('图片上传成功');
+          //   } else if (status === 'error') {
+          //     message.error('图片上传失败');
+          //   }
+          // }}
         />
         <ProFormText name="backgroundImageLink" label="跳转链接" />
         <ProFormSwitch name="isActive" label="是否激活" />

+ 10 - 9
src/pages/ExchangeItem/index.tsx

@@ -161,6 +161,7 @@ const ExchangeItemManagement: React.FC = () => {
 
       if (uploadData.success) {
         setLogoUrl(uploadData.url);
+        message.success('图标上传成功');
         return {
           status: 'done',
           url: uploadData.url,
@@ -168,7 +169,7 @@ const ExchangeItemManagement: React.FC = () => {
       }
     } catch (error) {
       console.error('Upload error:', error);
-      message.error(`文件上传失败: ${error.message}`);
+      message.error(`图标上传失败: ${error.message}`);
       return {
         status: 'error',
         error: error.message,
@@ -252,14 +253,14 @@ const ExchangeItemManagement: React.FC = () => {
             name: 'file',
             listType: 'picture-card',
           }}
-          onChange={(info) => {
-            const { status } = info.file;
-            if (status === 'done') {
-              message.success('图片上传成功');
-            } else if (status === 'error') {
-              message.error('图片上传失败');
-            }
-          }}
+          // onChange={(info) => {
+          //   const { status } = info.file;
+          //   if (status === 'done') {
+          //     message.success('图片上传成功');
+          //   } else if (status === 'error') {
+          //     message.error('图片上传失败');
+          //   }
+          // }}
         />
       </ModalForm>
 

+ 10 - 9
src/pages/NewActivities/index.tsx

@@ -176,6 +176,7 @@ const ActivityManagement: React.FC = () => {
 
       if (uploadData.success) {
         setIconUrl(uploadData.url);
+        message.success('图标上传成功');
         return {
           status: 'done',
           url: uploadData.url,
@@ -183,7 +184,7 @@ const ActivityManagement: React.FC = () => {
       }
     } catch (error) {
       console.error('Upload error:', error);
-      message.error(`上传失败: ${error.message}`);
+      message.error(`图标上传失败: ${error.message}`);
       return {
         status: 'error',
         error: error.message,
@@ -247,14 +248,14 @@ const ActivityManagement: React.FC = () => {
             name: 'file',
             listType: 'picture-card',
           }}
-          onChange={(info) => {
-            const { status } = info.file;
-            if (status === 'done') {
-              message.success('图标上传成功');
-            } else if (status === 'error') {
-              message.error('图标上传失败');
-            }
-          }}
+          // onChange={(info) => {
+          //   const { status } = info.file;
+          //   if (status === 'done') {
+          //     message.success('图标上传成功');
+          //   } else if (status === 'error') {
+          //     message.error('图标上传失败');
+          //   }
+          // }}
         />
         <ProFormDigit name="order" label="排序" min={0} initialValue={0} />
         <ProFormSwitch name="isActive" label="是否激活" initialValue={true} />