合并画布,部分样式调整

This commit is contained in:
X1627315083
2025-06-26 15:41:08 +08:00
parent fd05c70937
commit fc6d8d4c8d
75 changed files with 1772 additions and 672 deletions

View File

@@ -23,10 +23,21 @@ const getUploadUrl = () => {
return url
}
const getMinioUrl = (url) => {
const { pathname } = new URL(url);
const result = pathname.slice(1);
return result
if(isUrl(url)){
const { pathname } = new URL(url);
const result = pathname.slice(1);
return result
}
return ''
}
function isUrl(str) {
try {
new URL(str);
return true;
} catch (e) {
return false;
}
}
const rgbaToHex = (rgba)=> { // rgba转16进制
let hex = '#';
rgba.forEach((i,index) => {
@@ -93,7 +104,27 @@ function downloadIamge(imgsrc, name) { // 下载图片地址和图片名
}
image.src = imgsrc
}
async function downloadVideoWithFetch(url, filename) {
try {
const response = await fetch(url);
const blob = await response.blob();
const blobUrl = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = blobUrl;
a.download = filename || 'video.mp4';
document.body.appendChild(a);
a.click();
// 清理
setTimeout(() => {
document.body.removeChild(a);
URL.revokeObjectURL(blobUrl);
}, 100);
} catch (error) {
console.error('下载失败:', error);
}
}
function dataURLtoFile(dataurl, filename) {//吧url转为文件对象指定文件名称
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
@@ -592,6 +623,7 @@ export {
dataURLtoBlob,
isMoible,
downloadIamge,
downloadVideoWithFetch,
getBrowserInfo,
setPubDate,
murmur,