Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quantum-blocks-h5
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
quantum-blocks-h5
Commits
41d252c3
Commit
41d252c3
authored
Mar 30, 2021
by
郝聪敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature: 测试upload
parent
9ef35f48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
webpack.config.js
webpack.config.js
+17
-14
No files found.
webpack.config.js
View file @
41d252c3
...
@@ -178,34 +178,37 @@ module.exports = {
...
@@ -178,34 +178,37 @@ module.exports = {
SecretId
:
'
AKIDVlxtVqOK9i0wc0m0e7C5saATZnl2xvUx
'
,
SecretId
:
'
AKIDVlxtVqOK9i0wc0m0e7C5saATZnl2xvUx
'
,
SecretKey
:
'
NWQ3VlmWeFtIQHrDI6F9oCheMq41lGVV
'
SecretKey
:
'
NWQ3VlmWeFtIQHrDI6F9oCheMq41lGVV
'
});
});
const
files
List
=
[];
const
files
Path
=
[];
function
isValid
(
path
)
{
function
isValid
(
path
)
{
const
format
=
[
'
.ico
'
,
'
.html
'
,
'
.ttf
'
,
'
.woff
'
,
'
.woff2
'
];
const
format
=
[
'
.ico
'
,
'
.html
'
,
'
.ttf
'
,
'
.woff
'
,
'
.woff2
'
];
return
!
format
.
some
(
v
=>
path
.
endsWith
(
v
))
return
!
format
.
some
(
v
=>
path
.
endsWith
(
v
))
}
}
function
readFileList
(
dir
,
files
List
=
[])
{
function
readFileList
(
dir
,
files
Path
=
[])
{
const
files
=
fs
.
readdirSync
(
dir
);
const
files
=
fs
.
readdirSync
(
dir
);
files
.
forEach
((
item
,
index
)
=>
{
files
.
forEach
((
item
,
index
)
=>
{
var
fullPath
=
path
.
join
(
dir
,
item
);
var
fullPath
=
path
.
join
(
dir
,
item
);
const
stat
=
fs
.
statSync
(
fullPath
);
const
stat
=
fs
.
statSync
(
fullPath
);
if
(
stat
.
isDirectory
())
{
if
(
stat
.
isDirectory
())
{
readFileList
(
path
.
join
(
dir
,
item
),
files
List
);
//递归读取文件
readFileList
(
path
.
join
(
dir
,
item
),
files
Path
);
//递归读取文件
}
else
if
(
isValid
(
fullPath
))
{
}
else
if
(
isValid
(
fullPath
))
{
files
List
.
push
(
fullPath
);
files
Path
.
push
(
fullPath
);
}
}
});
});
return
files
List
;
return
files
Path
;
}
}
readFileList
(
path
.
resolve
(
__dirname
,
'
./public
'
),
filesList
);
readFileList
(
path
.
resolve
(
__dirname
,
'
./public
'
),
filesPath
);
// console.log('filepath', filesList);
const
filesList
=
filesPath
.
map
(
filepath
=>
{
const
files
=
[{
const
filesPathArr
=
filepath
.
split
(
'
/
'
);
Bucket
:
'
misc-1258270469
'
,
const
Key
=
`qb/
${
filesPathArr
[
filesPathArr
.
length
-
1
]}
`
;
Region
:
'
ap-beijing
'
,
return
{
Key
:
'
qb/fixIosTitle.html
'
,
Bucket
:
'
misc-1258270469
'
,
FilePath
:
filepath
,
Region
:
'
ap-beijing
'
,
}];
Key
,
FilePath
:
filepath
}
});
cos
.
uploadFiles
({
cos
.
uploadFiles
({
files
:
files
,
files
:
files
List
,
SliceSize
:
1024
*
1024
,
SliceSize
:
1024
*
1024
,
onProgress
:
function
(
info
)
{
onProgress
:
function
(
info
)
{
var
percent
=
parseInt
(
info
.
percent
*
10000
)
/
100
;
var
percent
=
parseInt
(
info
.
percent
*
10000
)
/
100
;
...
...
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