Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
bfbbdaaf
Commit
bfbbdaaf
authored
Feb 03, 2026
by
renmanyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:上传改造
parent
741ac6dd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
src/core/upload.js
+20
-4
No files found.
src/core/upload.js
View file @
bfbbdaaf
import
{
func
}
from
"prop-types"
;
import
Service
from
'@/common/js/service'
;
import
User
from
'@/common/js/user'
;
import
{
message
}
from
'antd'
;
...
...
@@ -6,7 +5,7 @@ import { message } from 'antd';
* @Author: 吴文洁
* @Date: 2020-08-11 11:47:14
* @LastEditors: renmanyi
* @LastEditTime: 2026-02-03 1
4:29:56
* @LastEditTime: 2026-02-03 1
5:28:25
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -118,7 +117,18 @@ class Upload {
resourceName
:
name
,
}
Service
.
Hades
(
'/public/hades/ossAuthority'
,
params
).
then
((
res
)
=>
{
const
{
resourceId
,
accessId
,
policy
,
callback
,
signature
,
key
,
host
}
=
res
.
result
;
const
signInfo
=
res
.
result
;
const
{
resourceId
}
=
res
.
result
;
if
(
signInfo
.
vendorType
===
'TENCENT_COS'
)
{
// 腾讯云 COS 上传
this
.
uploadBlobToNewOSSTx
(
new
Blob
([
string
]),
name
,
signInfo
.
signatureVO
||
signInfo
).
then
(()
=>
{
success
(
resourceId
);
}).
catch
(()
=>
{
error
();
});
}
else
{
// 阿里云 OSS 上传
const
{
accessId
,
policy
,
callback
,
signature
,
key
,
host
}
=
signInfo
;
const
xhr
=
new
XMLHttpRequest
();
const
formData
=
new
FormData
();
formData
.
append
(
"OSSAccessKeyId"
,
accessId
);
...
...
@@ -126,6 +136,9 @@ class Upload {
formData
.
append
(
"callback"
,
callback
);
formData
.
append
(
"Signature"
,
signature
);
formData
.
append
(
"key"
,
key
);
if
(
signInfo
.
securityToken
)
{
formData
.
append
(
"x-oss-security-token"
,
signInfo
.
securityToken
);
}
formData
.
append
(
"file"
,
new
Blob
([
string
]));
formData
.
append
(
"success_action_status"
,
200
);
xhr
.
open
(
"POST"
,
host
);
...
...
@@ -136,7 +149,10 @@ class Upload {
error
();
}
xhr
.
send
(
formData
);
})
}
}).
catch
(()
=>
{
error
();
});
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment