Compare commits
No commits in common. "f75ab621d21ca94dba3db4875f4c21eab526f0d1" and "dc4c0fd334bd7c776b8b2afeef7f3e57945bbfc4" have entirely different histories.
f75ab621d2
...
dc4c0fd334
|
@ -208,18 +208,6 @@ const insertImageElement = (files: FileList) => {
|
|||
// })
|
||||
}
|
||||
|
||||
//获取当前的时间
|
||||
const getTime=()=>{
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = ('0' + (now.getMonth() + 1)).slice(-2);
|
||||
const day = ('0' + now.getDate()).slice(-2);
|
||||
const hours = ('0' + now.getHours()).slice(-2);
|
||||
const minutes = ('0' + now.getMinutes()).slice(-2);
|
||||
const seconds = ('0' + now.getSeconds()).slice(-2);
|
||||
return `${year}-${month}-${day}_${hours}:${minutes}:${seconds}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* base64转图片File
|
||||
* @param {String} base64 图片base64
|
||||
|
@ -246,10 +234,9 @@ const base64ToFile = (base64: string, fileName = '试题图片') => {
|
|||
// charCodeAt():获取给定索引处字符对应的 UTF-16 代码单元
|
||||
u8arr[n] = bstr.charCodeAt(n)
|
||||
}
|
||||
const filename = fileName+getTime()
|
||||
// 利用构造函数创建File文件对象
|
||||
// new File(bits, name, options)
|
||||
const file = new File([u8arr], `${filename}.${suffix}`, {
|
||||
const file = new File([u8arr], `${fileName}.${suffix}`, {
|
||||
type: type
|
||||
})
|
||||
// 返回file
|
||||
|
|
Loading…
Reference in New Issue