统一前后端代码格式化配置
This commit is contained in:
@@ -31,13 +31,15 @@ export const ADMIN_TABLE_PAGINATION_BASE: Pick<
|
||||
* 服务端分页列表(任务/订单/用户/审计等)。
|
||||
* 始终展示 10/20/50/100,避免 antd「total ≤ 50 不显示」默认行为。
|
||||
*/
|
||||
export function buildAdminTablePagination(options: {
|
||||
current?: number
|
||||
page?: number
|
||||
pageSize?: number
|
||||
total?: number
|
||||
onChange?: TablePaginationConfig['onChange']
|
||||
} & Partial<TablePaginationConfig>): TablePaginationConfig {
|
||||
export function buildAdminTablePagination(
|
||||
options: {
|
||||
current?: number
|
||||
page?: number
|
||||
pageSize?: number
|
||||
total?: number
|
||||
onChange?: TablePaginationConfig['onChange']
|
||||
} & Partial<TablePaginationConfig>,
|
||||
): TablePaginationConfig {
|
||||
const { current, page, pageSize, total, onChange, ...rest } = options
|
||||
return {
|
||||
...ADMIN_TABLE_PAGINATION_BASE,
|
||||
@@ -61,13 +63,15 @@ export function buildAdminLocalTablePagination(
|
||||
}
|
||||
|
||||
/** kuaishou-lewan 发货记录分页(100–1000) */
|
||||
export function buildCloudtentaclesTablePagination(options: {
|
||||
current?: number
|
||||
page?: number
|
||||
pageSize?: number
|
||||
total?: number
|
||||
onChange?: TablePaginationConfig['onChange']
|
||||
} & Partial<TablePaginationConfig>): TablePaginationConfig {
|
||||
export function buildCloudtentaclesTablePagination(
|
||||
options: {
|
||||
current?: number
|
||||
page?: number
|
||||
pageSize?: number
|
||||
total?: number
|
||||
onChange?: TablePaginationConfig['onChange']
|
||||
} & Partial<TablePaginationConfig>,
|
||||
): TablePaginationConfig {
|
||||
const { current, page, pageSize, total, onChange, ...rest } = options
|
||||
return {
|
||||
showSizeChanger: true,
|
||||
|
||||
@@ -18,9 +18,7 @@ export function getImageIdentity(file: {
|
||||
}): string {
|
||||
const objectKey = String(file?.objectKey || '').trim()
|
||||
if (objectKey) return objectKey
|
||||
const url = String(
|
||||
file?.url || file?.mediumUrl || file?.thumbnailUrl || '',
|
||||
).trim()
|
||||
const url = String(file?.url || file?.mediumUrl || file?.thumbnailUrl || '').trim()
|
||||
return getImageIdentityFromUrl(url)
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,7 @@ const IMAGE_UPLOAD_QUALITY: Record<string, number> = {
|
||||
|
||||
export async function optimizeImageForUpload(file: File, scene: string) {
|
||||
if (!file.type.startsWith('image/')) return file
|
||||
if (!['image/jpeg', 'image/png', 'image/webp'].includes(file.type))
|
||||
return file
|
||||
if (!['image/jpeg', 'image/png', 'image/webp'].includes(file.type)) return file
|
||||
if (typeof document === 'undefined') return file
|
||||
|
||||
const maxSide = IMAGE_UPLOAD_MAX_SIDE[scene] ?? 1600
|
||||
@@ -21,11 +20,7 @@ export async function optimizeImageForUpload(file: File, scene: string) {
|
||||
|
||||
try {
|
||||
const image = await loadImage(file)
|
||||
const { width, height } = fitSize(
|
||||
image.naturalWidth,
|
||||
image.naturalHeight,
|
||||
maxSide,
|
||||
)
|
||||
const { width, height } = fitSize(image.naturalWidth, image.naturalHeight, maxSide)
|
||||
const canvas = document.createElement('canvas')
|
||||
canvas.width = width
|
||||
canvas.height = height
|
||||
@@ -70,11 +65,7 @@ function fitSize(width: number, height: number, maxSide: number) {
|
||||
}
|
||||
}
|
||||
|
||||
function canvasToBlob(
|
||||
canvas: HTMLCanvasElement,
|
||||
type: string,
|
||||
quality: number,
|
||||
) {
|
||||
function canvasToBlob(canvas: HTMLCanvasElement, type: string, quality: number) {
|
||||
return new Promise<Blob | null>((resolve) => {
|
||||
canvas.toBlob(resolve, type, quality)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user