修改uuid和pro地址

planet
shenhan 2025-03-17 10:53:47 +08:00
parent 9d87e7db9d
commit f603a2c205
2 changed files with 12 additions and 11 deletions

View File

@ -1,2 +1,2 @@
NODE_ENV = 'production'
VITE_NUXT_ENV = 'http://1.13.246.108:8080/'
VITE_NUXT_ENV = 'http://113.45.190.154:8080/'

View File

@ -145,13 +145,13 @@ const calculateFileHash = (file: File): Promise<string> => {
// });
// };
// ID
const guid = () => {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
const r = (Math.random() * 16) | 0;
const v = c === "x" ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
};
// const guid = () => {
// return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
// const r = (Math.random() * 16) | 0;
// const v = c === "x" ? r : (r & 0x3) | 0x8;
// return v.toString(16);
// });
// };
//
const initParam = () => {
@ -164,13 +164,14 @@ const initParam = () => {
requiredValid.value = false;
};
function getOssDefaultPath(name, uuid) {
function getOssDefaultPath(name:any) {
const timestamp = Date.now();
const now = new Date();
const year = now.getFullYear(); //
const month = String(now.getMonth() + 1).padStart(2, "0"); //
const day = String(now.getDate()).padStart(2, "0"); //
return `${year}/${month}/${day}/${uuid}/${name}`; //
return `${year}/${month}/${day}/${timestamp}/${name}`; //
}
//
const selectFile = async (event: Event) => {
@ -259,7 +260,7 @@ const selectFile = async (event: Event) => {
}
totalChunks.value = Math.ceil(file.value.size / chunkSize.value);
objectKey.value = `${getOssDefaultPath(fileName.value, guid())}`;
objectKey.value = `${getOssDefaultPath(fileName.value)}`;
// ID
const res = await request.get(`/file/getUploadId?objectKey=${objectKey.value}`);
uploadId.value = res.data;