Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
GaoQuYingJiH5-SDT
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
xinzhedeai
GaoQuYingJiH5-SDT
Commits
52588906
You need to sign in or sign up before continuing.
Commit
52588906
authored
Mar 20, 2024
by
xinzhedeai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公共方法
parent
d14c2194
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
23 deletions
+17
-23
http.js
js/http.js
+2
-8
util.js
js/util.js
+15
-15
No files found.
js/http.js
View file @
52588906
...
...
@@ -137,25 +137,19 @@ var http = {
},
responseType
:
'
blob
'
//在请求中加上这一行,特别重要
}).
then
(
res
=>
{
// let response = res.data
// console.log('res.statusCode', response)
// if(response.statusCode >= 300){
// // alert('系统发生错误')
// return
// }
// resolve(res.data)
// 返回格式是文件流格式
// 在请求拿到文件流res以后,使用a标签下载
let
fileData
=
res
.
data
let
blob
=
new
Blob
([
fileData
],
{
type
:
'
application/msword;charset=UTF-8
'
}
/* , {
type: `application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=utf-8;`
} */
)
var
a
=
document
.
createElement
(
'
a
'
);
document
.
body
.
appendChild
(
a
);
a
.
style
=
'
display: none
'
;
var
url
=
window
.
URL
.
createObjectURL
(
blob
);
a
.
href
=
url
;
a
.
setAttribute
(
'
download
'
,
'
YH.docx
'
)
a
.
setAttribute
(
'
download
'
,
'
YH
-
'
+
getTargetDateYMD
().
replaceAll
(
'
-
'
,
''
)
+
'
.docx
'
)
a
.
click
();
a
.
remove
();
window
.
URL
.
revokeObjectURL
(
url
);
...
...
js/util.js
View file @
52588906
...
...
@@ -65,7 +65,7 @@ function getTargetDateYM(dayLength, type) {
*
* @functionName: getPageName
* @Description: get page name from URL
* @author:
Double
* @author:
zjb
*
*/
function
getPageName
()
{
...
...
@@ -82,7 +82,7 @@ function getPageName() {
*
* @functionName: getOS
* @Description: get operating system
* @author:
Double
* @author:
zjb
*
*/
function
getOS
()
{
...
...
@@ -122,7 +122,7 @@ function getOS() {
*
* @functionName: getNavigator
* @Description: get navigator
* @author:
Double
* @author:
zjb
*
*/
function
getNavigator
()
{
...
...
@@ -152,7 +152,7 @@ function getNavigator() {
*
* @functionName: isPC
* @Description: 判断使用设备是否为PC
* @author:
Double
* @author:
zjb
*
*/
function
isPC
()
{
...
...
@@ -172,7 +172,7 @@ function isPC() {
*
* @functionName: getParameter
* @Description: get parameter from URL
* @author:
Double
* @author:
zjb
*
*/
function
getParameter
(
name
)
{
...
...
@@ -207,7 +207,7 @@ function getParameter(name) {
*
* @functionName: setParameter
* @Description: set parameter to URL
* @author:
Double
* @author:
zjb
*
*/
function
setParameter
()
{
...
...
@@ -230,7 +230,7 @@ function setParameter() {
*
* @functionName: trim
* @Description: 由于IE8不支持trim方法,此处自定义
* @author:
Double
* @author:
zjb
*
*/
String
.
prototype
.
trim
=
function
()
{
...
...
@@ -240,7 +240,7 @@ String.prototype.trim = function() {
/**
* @functionName: setCookie
* @Description: set cookies
* @author:
Double
* @author:
zjb
*/
function
setCookie
(
name
,
value
,
days
)
{
if
(
name
===
'
whMap
'
||
name
===
'
columnArr
'
){
// 页面搜索条件记录 更改存取方式
...
...
@@ -266,7 +266,7 @@ function setCookie(name, value, days) {
*
* @functionName: getCookie
* @Description: get cookies
* @author:
Double
* @author:
zjb
*
*/
function
getCookie
(
name
)
{
...
...
@@ -284,7 +284,7 @@ function getCookie(name) {
*
* @functionName: jumpBack
* @Description: 从详情页跳回
* @author:
Double
* @author:
zjb
*
*/
function
jumpBack
(
destination
)
{
...
...
@@ -300,7 +300,7 @@ function jumpBack(destination) {
*
* @functionName: delCookie
* @Description: delete cookies
* @author:
Double
* @author:
zjb
*
*/
function
delCookie
(
name
)
{
...
...
@@ -315,7 +315,7 @@ function delCookie(name) {
*
* @functionName: serializeObject
* @Description: form序列化成object
* @author:
Double
* @author:
zjb
* @param: form
*/
var
serializeObject
=
function
()
{
...
...
@@ -341,7 +341,7 @@ var serializeObject = function() {
*
* @functionName: formatDate
* @Description: 格式化Date对象
* @author:
Double
* @author:
zjb
* @param: date, symbol-选填
*/
function
formatDate
()
{
...
...
@@ -367,7 +367,7 @@ function formatDate() {
*
* @functionName: formatTime
* @Description: 格式化Date对象的time
* @author:
Double
* @author:
zjb
* @param: date
*/
function
formatTime
()
{
...
...
@@ -403,7 +403,7 @@ function formatTime() {
*
* @functionName: objToStr
* @Description: 将JSON转换为String, 作为参数传进函数
* @author:
Double
* @author:
zjb
* @param: obj
*/
function
objToStr
(
obj
)
{
...
...
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