Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
npm
/
glsx-common
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a503ee83
authored
Oct 12, 2021
by
limin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.4.2
1 parent
54b5e8b2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
51 deletions
dist/glsx-common.js
package.json
src/http.js
src/index.js
src/util.js
dist/glsx-common.js
View file @
a503ee8
This diff is collapsed.
Click to expand it.
package.json
View file @
a503ee8
{
{
"name"
:
"glsx-common"
,
"name"
:
"glsx-common"
,
"version"
:
"1.4.
0
"
,
"version"
:
"1.4.
2
"
,
"description"
:
"glsx common"
,
"description"
:
"glsx common"
,
"main"
:
"./dist/glsx-common.js"
,
"main"
:
"./dist/glsx-common.js"
,
"private"
:
false
,
"private"
:
false
,
...
...
src/http.js
View file @
a503ee8
...
@@ -45,9 +45,12 @@ Http.prototype.create = function () {
...
@@ -45,9 +45,12 @@ Http.prototype.create = function () {
this
.
service
.
interceptors
.
response
.
use
(
this
.
service
.
interceptors
.
response
.
use
(
({
data
:
res
,
config
:
{
returnAll
}
})
=>
{
({
data
:
res
,
config
:
{
returnAll
}
})
=>
{
const
{
const
{
response
:
{
code_key
=
'
returnC
ode'
,
errId
=
'errId'
,
code_success_value
=
'0'
,
data_key
=
'data'
},
response
:
{
code_key
=
'
c
ode'
,
errId
=
'errId'
,
code_success_value
=
'0'
,
data_key
=
'data'
},
alert
alert
}
=
this
.
customer
}
=
this
.
customer
if
(
returnAll
||
!
alert
)
{
return
res
}
let
code
=
res
[
code_key
]
let
code
=
res
[
code_key
]
// let errId = res[errId]
// let errId = res[errId]
// 特殊的code处理,可以增加
// 特殊的code处理,可以增加
...
@@ -58,12 +61,10 @@ Http.prototype.create = function () {
...
@@ -58,12 +61,10 @@ Http.prototype.create = function () {
default
:
default
:
if
(
alert
)
{
if
(
alert
)
{
alert
(
res
.
message
||
res
.
msg
||
'出错了,请联系管理员'
)
alert
(
res
.
message
||
res
.
msg
||
'出错了,请联系管理员'
)
}
else
{
returnAll
=
true
}
}
break
break
}
}
return
re
turnAll
?
res
:
re
s
[
data_key
]
return
res
[
data_key
]
},
},
error
=>
{
error
=>
{
const
{
alert
}
=
this
.
customer
const
{
alert
}
=
this
.
customer
...
...
src/index.js
View file @
a503ee8
...
@@ -4,14 +4,13 @@
...
@@ -4,14 +4,13 @@
* @Author: limin
* @Author: limin
* @Date: 2021-09-06 11:12:07
* @Date: 2021-09-06 11:12:07
* @LastEditors: limin
* @LastEditors: limin
* @LastEditTime: 2021-
09-21 14:36:51
* @LastEditTime: 2021-
10-11 14:13:52
* @FilePath: \
npm\
glsx-common\src\index.js
* @FilePath: \glsx-common\src\index.js
*/
*/
import
Http
from
"./http"
;
import
Http
from
'./http'
import
array
from
"./util.array"
;
import
array
from
'./util.array'
import
util
from
"./util"
;
import
util
from
'./util'
// import qiankun from "./qiankun";
import
storage
from
'./storage'
import
storage
from
"./storage"
;
import
Postmate
from
'./postmate'
import
Postmate
from
"./postmate"
;
const
utils
=
{
...
util
,
array
,
storage
}
const
utils
=
{
...
util
,
array
,
storage
};
export
{
Http
,
utils
,
Postmate
}
export
{
Http
,
utils
,
Postmate
};
src/util.js
View file @
a503ee8
...
@@ -27,20 +27,6 @@ export const Util = {
...
@@ -27,20 +27,6 @@ export const Util = {
},
},
/**
/**
* 获取当前时间
*/
getCurrentDate
:
function
()
{
let
time
=
new
Date
()
let
y
=
time
.
getFullYear
()
let
m
=
time
.
getMonth
()
+
1
let
d
=
time
.
getDate
()
return
{
date
:
y
+
'/'
+
m
+
'/'
+
d
}
},
/**
* 获取浏览器参数
* 获取浏览器参数
*/
*/
getUrlParams
:
function
(
name
)
{
getUrlParams
:
function
(
name
)
{
...
@@ -62,28 +48,6 @@ export const Util = {
...
@@ -62,28 +48,6 @@ export const Util = {
},
},
/**
/**
* 根据当前时间,计算往后30天的日期
*/
getAfterDate
:
function
(
day
)
{
let
date1
=
new
Date
()
let
date2
=
new
Date
(
date1
)
let
time
=
30
if
(
day
)
{
time
=
day
}
date2
.
setDate
(
date1
.
getDate
()
+
time
)
let
_date
=
date2
.
getFullYear
()
+
'-'
+
(
date2
.
getMonth
()
+
1
)
+
'-'
+
date2
.
getDate
()
return
{
date
:
_date
,
year
:
date2
.
getFullYear
(),
month
:
date2
.
getMonth
()
+
1
,
day
:
date2
.
getDate
()
}
},
/**
* 字段截取
* 字段截取
*/
*/
cutStr
:
function
(
str
,
num
)
{
cutStr
:
function
(
str
,
num
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment