Commit abaabc29 authored by zhengke's avatar zhengke

no message

parent d2623ff1
......@@ -140,7 +140,8 @@ const insertImageElement = async (files: FileList) => {
gid: GroupId.value
}
let filePath="/Upload/User/";
let url = await AliyunUpload.UploadAvatar(files[0], filePath, parms);
let name = new Date().getTime()+".png"
let url = await AliyunUpload.UploadCloudDisk(files[0], `${name}`, parms);
if(url) Search()
}
......@@ -279,7 +280,7 @@ onMounted(()=>{
<style lang="scss" scoped>
.CloudDisk-L{
border-right: 1px solid #E9E9E9;
padding: 22px 22px 0 0;
padding: 22px 22px 22px 0;
}
.CloudDisk-L-inquire{
margin-bottom: 20px;
......
......@@ -19,11 +19,10 @@ class AliyunUpload {
return ''
}
}
static UploadAvatar = async (file: any, filepath: string,parms:any) => {
static UploadAvatar = async (file: any, filepath: string) => {
try {
const formData = new FormData();
formData.append('file', file);
if(parms) formData.append('parms', parms);
const response = await fetch(`${domainManager().UploadUrl}/Upload?filePath=${encodeURIComponent(filepath)}`, {
method: 'POST',
body: formData,
......@@ -38,6 +37,25 @@ class AliyunUpload {
return ''
}
}
static UploadCloudDisk= async (file: any, name: string, parms: any) => {
try {
const formData = new FormData();
formData.append('file', file);
if(parms&&parms.uid) formData.append('parms', parms);
const response = await fetch(`${domainManager().UploadUrl}/Upload?filePath=${encodeURIComponent(name)}`, {
method: 'POST',
body: formData,
});
if (response.ok) {
let result = await response.text()
let datas = JSON.parse(result)
return 'https://im.oytour.com' + datas.FilePath
}
return ''
} catch (error) {
return ''
}
}
}
export default AliyunUpload
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment