fix;合并修复问题

This commit is contained in:
ljy
2026-07-09 21:42:36 +08:00
parent 3d3588babb
commit 336116fbf2
18 changed files with 341 additions and 190 deletions
@@ -1,5 +1,6 @@
import { useEffect, useId, useRef, useState } from 'react';
import { uploadFileToOss, type OssMediaType } from '../lib/upload';
import { toastError } from '../lib/toast';
import {
authorizePartnerWechat,
fetchClientConfig,
@@ -84,7 +85,9 @@ export default function OssUploadField({
async function uploadSelectedFile(file: File) {
if (file.size > DEFAULT_MAX_MB * 1024 * 1024) {
setError(`文件不能超过 ${DEFAULT_MAX_MB}MB`);
const text = `文件不能超过 ${DEFAULT_MAX_MB}MB`;
setError(text);
toastError(text);
return;
}
setUploading(true);
@@ -106,7 +109,9 @@ export default function OssUploadField({
try {
await authorizePartnerWechat();
} catch (e) {
setError(e instanceof Error ? e.message : '微信授权失败');
const text = e instanceof Error ? e.message : '微信授权失败';
setError(text);
toastError(text);
setAuthorizing(false);
}
}
@@ -132,7 +137,9 @@ export default function OssUploadField({
setError('');
if (useWechatPicker && needsAuth) {
setError('请先完成微信授权后再上传照片');
const text = '请先完成微信授权后再上传照片';
setError(text);
toastError(text);
return;
}