Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
binhai-people
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
binhai-jiaoguan
binhai-people
Commits
0acf4300
Commit
0acf4300
authored
Nov 21, 2023
by
小费同学阿
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
c269efaa
16469e4a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
16 deletions
+29
-16
baidu.js
src/api/baidu.js
+9
-1
header.vue
src/layout/components/header.vue
+14
-10
ruoyi.js
src/utils/ruoyi.js
+5
-5
index.vue
src/views/Home/index.vue
+1
-0
No files found.
src/api/baidu.js
View file @
0acf4300
import
request
from
"@/utils/request-baidu"
;
import
request
from
'@/utils/request-baidu'
export
function
getWeather
()
{
export
function
getWeather
()
{
return
request
({
return
request
({
...
@@ -110,3 +110,11 @@ export function walkingPlanning(origin, destination, origin_uid, destination_uid
...
@@ -110,3 +110,11 @@ export function walkingPlanning(origin, destination, origin_uid, destination_uid
}
}
})
})
}
}
export
function
headerWeather
(
params
)
{
return
request
({
url
:
'/weather/v1/'
,
method
:
'get'
,
params
:
params
})
}
src/layout/components/header.vue
View file @
0acf4300
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
import
Cookies
from
'js-cookie'
import
Cookies
from
'js-cookie'
import
logo
from
'@/assets/image/logo.png'
import
logo
from
'@/assets/image/logo.png'
import
axios
from
'axios'
import
axios
from
'axios'
import
{
headerWeather
}
from
'@/api/baidu'
export
default
{
export
default
{
data
()
{
data
()
{
...
@@ -61,17 +62,20 @@ export default {
...
@@ -61,17 +62,20 @@ export default {
data_type
:
'all'
,
data_type
:
'all'
,
ak
:
'bSlMW0ziNWrg8TjNzUKZpLE9iGcS3jc2'
ak
:
'bSlMW0ziNWrg8TjNzUKZpLE9iGcS3jc2'
}
}
headerWeather
(
params
).
then
(
response
=>
{
this
.
weatherCondition
=
response
.
result
.
forecasts
this
.
weatherNow
=
response
.
result
.
now
})
// 将 params 对象传递给 GET 请求
// 将 params 对象传递给 GET 请求
axios
.
get
(
`
${
process
.
env
.
VUE_APP_BAIDU_API
}
weather/v1/`
,
{
params
})
//
axios.get(`${process.env.VUE_APP_BAIDU_API}weather/v1/`, { params })
.
then
(
response
=>
{
//
.then(response => {
console
.
log
(
'11111'
,
response
)
//
console.log('11111', response)
this
.
weatherCondition
=
response
.
data
.
result
.
forecasts
//
this.weatherCondition = response.data.result.forecasts
this
.
weatherNow
=
response
.
data
.
result
.
now
//
this.weatherNow = response.data.result.now
})
//
})
.
catch
(
error
=>
{
//
.catch(error => {
console
.
error
(
error
)
//
console.error(error)
})
//
})
},
},
toHome
()
{
toHome
()
{
if
(
this
.
$route
.
path
!==
'/Home'
)
{
if
(
this
.
$route
.
path
!==
'/Home'
)
{
...
...
src/utils/ruoyi.js
View file @
0acf4300
...
@@ -55,14 +55,14 @@ export function resetForm(refName) {
...
@@ -55,14 +55,14 @@ export function resetForm(refName) {
// 添加日期范围
// 添加日期范围
export
function
addDateRange
(
params
,
dateRange
,
propName
)
{
export
function
addDateRange
(
params
,
dateRange
,
propName
)
{
const
search
=
params
const
search
=
params
search
.
params
=
typeof
(
search
.
params
)
===
'object'
&&
search
.
params
!==
null
&&
!
Array
.
isArray
(
search
.
params
)
?
search
.
params
:
{}
// search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {};
dateRange
=
Array
.
isArray
(
dateRange
)
?
dateRange
:
[]
dateRange
=
Array
.
isArray
(
dateRange
)
?
dateRange
:
[]
if
(
typeof
(
propName
)
===
'undefined'
)
{
if
(
typeof
(
propName
)
===
'undefined'
)
{
search
.
params
[
'beginTime'
]
=
dateRange
[
0
]
search
[
'beginTime'
]
=
dateRange
[
0
]
search
.
params
[
'endTime'
]
=
dateRange
[
1
]
search
[
'endTime'
]
=
dateRange
[
1
]
}
else
{
}
else
{
search
.
params
[
'begin'
+
propName
]
=
dateRange
[
0
]
search
[
'begin'
+
propName
]
=
dateRange
[
0
]
search
.
params
[
'end'
+
propName
]
=
dateRange
[
1
]
search
[
'end'
+
propName
]
=
dateRange
[
1
]
}
}
return
search
return
search
}
}
...
...
src/views/Home/index.vue
View file @
0acf4300
...
@@ -299,6 +299,7 @@ import NavList from '@/views/Home/components/NavList/index.vue'
...
@@ -299,6 +299,7 @@ import NavList from '@/views/Home/components/NavList/index.vue'
import
{
getTrafficInfoList
,
getroadConditions
}
from
'@/views/trafficInformation/api'
import
{
getTrafficInfoList
,
getroadConditions
}
from
'@/views/trafficInformation/api'
import
_
from
'lodash'
import
_
from
'lodash'
import
{
placeSuggestion
}
from
'@/api/baidu'
import
{
placeSuggestion
}
from
'@/api/baidu'
import
{
getWeatherInfoList
}
from
"@/views/weatherCondition/api"
;
export
default
{
export
default
{
name
:
'Home'
,
name
:
'Home'
,
components
:
{
NavList
},
components
:
{
NavList
},
...
...
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