async function pdfshangchuan(e) {
uniCloud.chooseAndUploadFile({
type: 'all',
count: 1,
extension: [".pdf"],
onChooseFile(res) {
console.log("上传的 pdf", res);
return Promise.all(res.tempFiles).then((fileList) => {
let result = {
tempFilePaths: []
};
const date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const formattedDate = `${year}-${month}-${day}`;
result.tempFiles = fileList.map((fileItem, index) => {
result.tempFilePaths.push(fileItem.path);
const fileNameSplit = fileItem.name.split('.');
const ext = fileNameSplit.pop();
const fileName = fileNameSplit.join('.').replace(/[\s\/\?<>\\:\*\|":]/g, '_');
return {
path: fileItem.path,
cloudPath: `gaozhishu/${fileName}_${formattedDate}_${index}.${ext}`,
fileType: fileItem.fileType
};
});
return result;
});
}
}).then(res => {
console.log("最终的 pdf", res);
});
}
12-17
1573

08-07
688

04-06
579
