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
1dadf10b
Commit
1dadf10b
authored
Sep 10, 2024
by
张伯涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AI无人站模块接口请求封装
parent
a79d8e00
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
22 deletions
+33
-22
Extinguisher.js
src/api/AIStation/Extinguisher.js
+2
-2
httpTwo.js
src/api/httpTwo.js
+20
-17
index.vue
src/views/AIStation/ExtinguisherPage/index.vue
+4
-3
vite.config.js
vite.config.js
+7
-0
No files found.
src/api/AIStation/Extinguisher.js
View file @
1dadf10b
...
@@ -2,6 +2,6 @@ import httpTwo from '../httpTwo'
...
@@ -2,6 +2,6 @@ import httpTwo from '../httpTwo'
export
const
getWeatherMagData
=
()
=>
{
// 获取气象干预数据
export
const
getWeatherMagData
=
()
=>
{
return
httpTwo
.
get
(
`/bus
MeterEquipment
/list`
)
return
httpTwo
.
get
(
`/bus
FireExtinguisher
/list`
)
}
}
src/api/httpTwo.js
View file @
1dadf10b
...
@@ -11,18 +11,21 @@ let loadingInstance;
...
@@ -11,18 +11,21 @@ let loadingInstance;
let
loadingStatus
=
false
;
let
loadingStatus
=
false
;
const
router
=
useRouter
();
const
router
=
useRouter
();
axios
.
defaults
.
timeout
=
50000
;
const
AIapi
=
axios
.
create
({
axios
.
defaults
.
headers
.
post
[
'Content-Type'
]
=
'application/json'
;
timeout
:
50000
,
axios
.
defaults
.
baseURL
=
'http://192.168.116.26:8099/'
;
//ExternalSERVEICE;
baseURL
:
'/AIapi'
,
//ExternalSERVEICE;
axios
.
defaults
.
withCredentials
=
true
;
withCredentials
:
true
,
headers
:
{
'Content-Type'
:
'application/json'
}
})
if
(
!
axios
.
defaults
.
baseURL
.
endsWith
(
'/'
))
{
axios
.
defaults
.
baseURL
+=
"/"
;
if
(
!
AIapi
.
defaults
.
baseURL
.
endsWith
(
'/'
))
{
AIapi
.
defaults
.
baseURL
+=
"/"
;
}
}
let
ipAddress
=
'http://192.168.116.26:8099/'
;
let
ipAddress
=
AIapi
.
defaults
.
baseURL
;
axios
.
interceptors
.
request
.
use
((
config
)
=>
{
AIapi
.
interceptors
.
request
.
use
((
config
)
=>
{
config
.
baseURL
=
'
http://192.168.116.26:8099/
'
;
config
.
baseURL
=
'
/AIapi
'
;
console
.
log
(
config
.
baseURL
);
console
.
log
(
config
.
baseURL
);
// config.data = qs.stringify(config.data);
// config.data = qs.stringify(config.data);
return
config
;
return
config
;
...
@@ -30,7 +33,7 @@ axios.interceptors.request.use((config) => {
...
@@ -30,7 +33,7 @@ axios.interceptors.request.use((config) => {
return
Promise
.
reject
(
error
);
return
Promise
.
reject
(
error
);
});
});
axios
.
interceptors
.
response
.
use
((
res
)
=>
{
AIapi
.
interceptors
.
response
.
use
((
res
)
=>
{
closeLoading
();
closeLoading
();
checkResponse
(
res
);
checkResponse
(
res
);
return
Promise
.
resolve
(
res
);
return
Promise
.
resolve
(
res
);
...
@@ -74,7 +77,7 @@ axios.interceptors.response.use((res) => {
...
@@ -74,7 +77,7 @@ axios.interceptors.response.use((res) => {
});
});
function
changeIP
(
IP
){
function
changeIP
(
IP
){
axios
.
defaults
.
baseURL
=
IP
;
AIapi
.
defaults
.
baseURL
=
IP
;
}
}
function
showLoading
(
loading
)
{
function
showLoading
(
loading
)
{
if
(
!
loading
||
loadingStatus
)
{
if
(
!
loading
||
loadingStatus
)
{
...
@@ -123,7 +126,7 @@ function getToken () {
...
@@ -123,7 +126,7 @@ function getToken () {
// return "";
// return "";
// }
// }
//console.log("token:" + store.getters.getToken());
//console.log("token:" + store.getters.getToken());
return
store
.
getters
.
getToken
()
;
return
null
;
}
}
/*
/*
...
@@ -135,9 +138,9 @@ function getToken () {
...
@@ -135,9 +138,9 @@ function getToken () {
function
post
(
url
,
params
,
loading
,
config
)
{
function
post
(
url
,
params
,
loading
,
config
)
{
showLoading
(
loading
);
showLoading
(
loading
);
//console.log(ipAddress);
//console.log(ipAddress);
axios
.
defaults
.
headers
[
_Authorization
]
=
getToken
();
AIapi
.
defaults
.
headers
[
_Authorization
]
=
getToken
();
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
post
(
url
,
params
,
config
)
AIapi
.
post
(
url
,
params
,
config
)
.
then
(
response
=>
{
.
then
(
response
=>
{
resolve
(
response
.
data
);
resolve
(
response
.
data
);
},
err
=>
{
},
err
=>
{
...
@@ -153,9 +156,9 @@ function post (url, params, loading, config) {
...
@@ -153,9 +156,9 @@ function post (url, params, loading, config) {
function
get
(
url
,
param
,
loading
,
config
)
{
function
get
(
url
,
param
,
loading
,
config
)
{
showLoading
(
loading
);
showLoading
(
loading
);
//console.log(ipAddress);
//console.log(ipAddress);
axios
.
defaults
.
headers
[
_Authorization
]
=
getToken
();
AIapi
.
defaults
.
headers
[
_Authorization
]
=
getToken
();
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
get
(
url
,
config
)
AIapi
.
get
(
url
,
config
)
.
then
(
response
=>
{
.
then
(
response
=>
{
resolve
(
response
.
data
)
resolve
(
response
.
data
)
},
err
=>
{
},
err
=>
{
...
@@ -286,7 +289,7 @@ function ajax (param) {
...
@@ -286,7 +289,7 @@ function ajax (param) {
type
:
'post'
,
async
:
true
type
:
'post'
,
async
:
true
},
param
);
},
param
);
httpParam
.
url
=
axios
.
defaults
.
baseURL
+
httpParam
.
url
.
replace
(
/
\/?
/
,
''
);
httpParam
.
url
=
AIapi
.
defaults
.
baseURL
+
httpParam
.
url
.
replace
(
/
\/?
/
,
''
);
httpParam
.
headers
[
_Authorization
]
=
getToken
();
httpParam
.
headers
[
_Authorization
]
=
getToken
();
var
xhr
=
createXHR
();
var
xhr
=
createXHR
();
xhr
.
onreadystatechange
=
function
()
{
xhr
.
onreadystatechange
=
function
()
{
...
...
src/views/AIStation/ExtinguisherPage/index.vue
View file @
1dadf10b
...
@@ -104,12 +104,13 @@ const search = () => {
...
@@ -104,12 +104,13 @@ const search = () => {
startTime
:
queryParams
.
value
.
startTime
,
startTime
:
queryParams
.
value
.
startTime
,
endTime
:
queryParams
.
value
.
endTime
,
endTime
:
queryParams
.
value
.
endTime
,
}
}
axios
.
get
(
'http://192.168.116.26:8099/busMeterEquipment/list'
).
then
(
res
=>
{
})
// axios.get('http://192.168.0.17:8099/busFireExtinguisher/list').then(res => {
// getWeatherMagData().then(res => {
//
//
// })
// })
getWeatherMagData
().
then
(
res
=>
{
})
console
.
log
(
'查询:'
,
item
);
console
.
log
(
'查询:'
,
item
);
searchData
.
value
=
data
;
searchData
.
value
=
data
;
console
.
log
(
'传值:'
,
searchData
.
value
);
console
.
log
(
'传值:'
,
searchData
.
value
);
...
...
vite.config.js
View file @
1dadf10b
...
@@ -30,6 +30,13 @@ export default defineConfig({
...
@@ -30,6 +30,13 @@ export default defineConfig({
target
:
'http://218.69.97.198:8001/'
,
// 目标服务器地址
target
:
'http://218.69.97.198:8001/'
,
// 目标服务器地址
//target: 'http://localhost:5013/', // 目标服务器地址
//target: 'http://localhost:5013/', // 目标服务器地址
changeOrigin
:
true
,
// 允许跨域
changeOrigin
:
true
,
// 允许跨域
},
'/AIapi'
:
{
// target: 'http://192.168.1.252:8001/',
target
:
'http://192.168.0.17:8099/'
,
// 目标服务器地址
//target: 'http://localhost:5013/', // 目标服务器地址
changeOrigin
:
true
,
// 允许跨域
rewrite
:
(
path
)
=>
path
.
replace
(
/^
\/
AIapi/
,
''
),
//路径重写,把'/ddapi'替换为''
}
}
}
}
}
}
...
...
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