fix: code style

This commit is contained in:
dylanmay
2025-11-06 23:23:25 +08:00
parent 500ce9cf7c
commit 007bb2dd26
21 changed files with 116 additions and 105 deletions

View File

@@ -38,7 +38,7 @@ const onBeforeUpload =
props.type === UploadType.Image ? beforeImageUpload : beforeVoiceUpload;
/** 自定义上传 */
const customRequest: UploadProps['customRequest'] = async (options) => {
const customRequest: UploadProps['customRequest'] = async function (options) {
const { file, onError, onSuccess } = options;
const formData = new FormData();

View File

@@ -42,9 +42,9 @@ const uploadRules = {
title: [{ message: '请输入标题', required: true, trigger: 'blur' } as const],
};
const handleCancel = () => {
function handleCancel() {
emit('update:open', false);
};
}
const fileList = ref<any[]>([]);
@@ -58,17 +58,17 @@ const uploadData: UploadData = reactive({
const uploadFormRef = ref<FormInstance | null>(null);
const uploadVideoRef = ref<any>(null);
const submitVideo = async () => {
async function submitVideo() {
try {
await uploadFormRef.value?.validate();
uploadVideoRef.value?.submit();
} catch {
// Validation failed
}
};
}
/** 自定义上传 */
const customRequest: UploadProps['customRequest'] = async (options) => {
const customRequest: UploadProps['customRequest'] = async function (options) {
const { file, onError, onSuccess } = options;
const formData = new FormData();

View File

@@ -49,9 +49,9 @@ const columns = [
];
// 下载文件
const handleDownload = (url: string) => {
function handleDownload(url: string) {
window.open(url, '_blank');
};
}
</script>
<template>

View File

@@ -41,9 +41,9 @@ const columns = [
},
];
const handleDownload = (url: string) => {
function handleDownload(url: string) {
window.open(url, '_blank');
};
}
</script>
<template>

View File

@@ -17,17 +17,23 @@ interface UploadData {
type: UploadType;
}
const beforeImageUpload: UploadProps['beforeUpload'] = (
const beforeImageUpload: UploadProps['beforeUpload'] = function (
rawFile: UploadRawFile,
) => useBeforeUpload(UploadType.Image, 2)(rawFile);
) {
return useBeforeUpload(UploadType.Image, 2)(rawFile);
};
const beforeVoiceUpload: UploadProps['beforeUpload'] = (
const beforeVoiceUpload: UploadProps['beforeUpload'] = function (
rawFile: UploadRawFile,
) => useBeforeUpload(UploadType.Voice, 2)(rawFile);
) {
return useBeforeUpload(UploadType.Voice, 2)(rawFile);
};
const beforeVideoUpload: UploadProps['beforeUpload'] = (
const beforeVideoUpload: UploadProps['beforeUpload'] = function (
rawFile: UploadRawFile,
) => useBeforeUpload(UploadType.Video, 10)(rawFile);
) {
return useBeforeUpload(UploadType.Video, 10)(rawFile);
};
export {
beforeImageUpload,

View File

@@ -47,15 +47,15 @@ const queryParams = reactive({
const showCreateVideo = ref(false); // 是否新建视频的弹窗
/** 侦听公众号变化 */
const onAccountChanged = (id: number) => {
function onAccountChanged(id: number) {
accountId.value = id;
queryParams.accountId = id;
queryParams.pageNo = 1;
getList();
};
}
/** 查询列表 */
const getList = async () => {
async function getList() {
loading.value = true;
try {
const data = await MpMaterialApi.getMaterialPage({
@@ -67,25 +67,25 @@ const getList = async () => {
} finally {
loading.value = false;
}
};
}
/** 搜索按钮操作 */
const handleQuery = () => {
function handleQuery() {
queryParams.pageNo = 1;
getList();
};
}
/** 处理 tab 切换 */
const onTabChange = () => {
function onTabChange() {
// 提前清空数据,避免 tab 切换后显示垃圾数据
list.value = [];
total.value = 0;
// 从第一页开始查询
handleQuery();
};
}
/** 处理删除操作 */
const handleDelete = async (id: number) => {
async function handleDelete(id: number) {
Modal.confirm({
content: '此操作将永久删除该文件, 是否继续?',
title: '提示',
@@ -95,7 +95,7 @@ const handleDelete = async (id: number) => {
await getList();
},
});
};
}
</script>
<template>