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
0
Merge Requests
0
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
2058baf0
Commit
2058baf0
authored
Jul 04, 2021
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:将下载的方法提取出来
parent
191c33c9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
23 deletions
+9
-23
src/core/downloads.js
+7
-21
src/index.html
+0
-0
src/index.tsx
+2
-2
No files found.
src/core/downloads.js
View file @
2058baf0
/*
* @Author: your name
* @Date: 2021-07-02 17:15:50
* @LastEditTime: 2021-07-0
2 17:23:47
* @LastEditTime: 2021-07-0
4 18:10:34
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /xiaomai-cloud-class-web/src/core/downLoad.js
*/
(
function
(
root
,
factory
)
{
if
(
typeof
define
===
'function'
&&
define
.
amd
)
{
// AMD. Register as an anonymous module.
define
([],
factory
);
}
else
if
(
typeof
exports
===
'object'
)
{
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module
.
exports
=
factory
();
}
else
{
// Browser globals (root is window)
root
.
download
=
factory
();
}
})(
this
,
function
()
{
return
function
download
(
data
,
strFileName
,
strMimeType
)
{
window
.
download
=
function
download
(
data
,
strFileName
,
strMimeType
)
{
var
self
=
window
,
// this script is only for browsers anyway...
defaultMime
=
'application/octet-stream'
,
// this default mime also triggers iframe downloads
mimeType
=
strMimeType
||
defaultMime
,
...
...
@@ -116,8 +102,8 @@
url
=
url
.
replace
(
/^data:
([\w\/\-\+]
+
)
/
,
defaultMime
);
if
(
!
window
.
open
(
url
))
{
// popup blocked, offer direct download:
if
(
confirm
(
'Displaying New Document
\
n
\
nUse Save As... to download, then click back to return to this page.'
))
{
location
.
href
=
url
;
if
(
window
.
confirm
(
'Displaying New Document
\
n
\
nUse Save As... to download, then click back to return to this page.'
))
{
window
.
location
.
href
=
url
;
}
}
return
true
;
...
...
@@ -163,5 +149,5 @@
reader
.
readAsDataURL
(
blob
);
}
return
true
;
};
/* end download() */
});
\ No newline at end of file
};
/* end download() */
\ No newline at end of file
src/index.html
View file @
2058baf0
This diff is collapsed.
Click to expand it.
src/index.tsx
View file @
2058baf0
...
...
@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2020-04-27 20:35:34
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-07-04
09:52:45
* @LastEditTime: 2021-07-04
16:59:14
* @Description:
*/
...
...
@@ -17,8 +17,8 @@ import { RootRouter } from './routes/index';
import
'antd/dist/antd.less'
;
import
'video-react/dist/video-react.css'
;
import
'@/common/less/index.less'
;
import
'@/core/downloads'
;
import
'@/core/function'
;
// import '@/core/downloads';
import
'@/core/xmTD'
;
import
User
from
'@/common/js/user'
;
import
Service
from
"@/common/js/service"
;
...
...
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