Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-project
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
海康威视
web-project
Commits
f2e23e5f
Commit
f2e23e5f
authored
Sep 11, 2024
by
liwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增了delete和put封装的请求
parent
d5176562
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletion
+39
-1
httpTwo.js
src/api/httpTwo.js
+39
-1
No files found.
src/api/httpTwo.js
View file @
f2e23e5f
...
@@ -172,6 +172,38 @@ function get (url, param, loading, config) {
...
@@ -172,6 +172,38 @@ function get (url, param, loading, config) {
})
})
}
}
function
put
(
url
,
param
,
loading
,
config
)
{
showLoading
(
loading
);
//console.log(ipAddress);
AIapi
.
defaults
.
headers
[
_Authorization
]
=
getToken
();
return
new
Promise
((
resolve
,
reject
)
=>
{
AIapi
.
put
(
url
,
param
,
config
)
.
then
(
response
=>
{
resolve
(
response
.
data
)
},
err
=>
{
reject
(
err
)
})
.
catch
((
error
)
=>
{
reject
(
error
)
})
})
}
function
deletes
(
url
,
param
,
loading
,
config
)
{
showLoading
(
loading
);
//console.log(ipAddress);
AIapi
.
defaults
.
headers
[
_Authorization
]
=
getToken
();
return
new
Promise
((
resolve
,
reject
)
=>
{
AIapi
.
delete
(
url
,
config
)
.
then
(
response
=>
{
resolve
(
response
.
data
)
},
err
=>
{
reject
(
err
)
})
.
catch
((
error
)
=>
{
reject
(
error
)
})
})
}
//url:url地址
//url:url地址
//params:请求参数
//params:请求参数
//fileName:下载的文件名
//fileName:下载的文件名
...
@@ -332,4 +364,10 @@ ajax.post = function (url, param, success, errror) {
...
@@ -332,4 +364,10 @@ ajax.post = function (url, param, success, errror) {
ajax
.
get
=
function
(
url
,
param
,
success
,
errror
)
{
ajax
.
get
=
function
(
url
,
param
,
success
,
errror
)
{
ajax
({
url
:
url
,
param
:
param
,
success
:
success
,
error
:
errror
,
type
:
'get'
})
ajax
({
url
:
url
,
param
:
param
,
success
:
success
,
error
:
errror
,
type
:
'get'
})
}
}
export
default
{
post
,
get
,
download
,
ajax
,
ipAddress
,
changeIP
}
ajax
.
put
=
function
(
url
,
param
,
success
,
errror
)
{
ajax
({
url
:
url
,
param
:
param
,
success
:
success
,
error
:
errror
,
type
:
'put'
})
}
ajax
.
deletes
=
function
(
url
,
param
,
success
,
errror
)
{
ajax
({
url
:
url
,
param
:
param
,
success
:
success
,
error
:
errror
,
type
:
'delete'
})
}
export
default
{
post
,
get
,
put
,
deletes
,
download
,
ajax
,
ipAddress
,
changeIP
}
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