Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mocp-uniapp
Overview
Overview
Details
Activity
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
pangchong
mocp-uniapp
Commits
2c981718
Commit
2c981718
authored
Jun 07, 2024
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 天气预报
parent
38e5a7f5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
17 deletions
+82
-17
src/mocp/api/base.js
+8
-0
src/mocp/api/panel.js
+10
-0
src/mocp/store/base.js
+21
-5
src/pages/modules/mocp/panel/components/panel-navbar.vue
+16
-5
src/pages/modules/mocp/panel/index.vue
+0
-5
src/pages/modules/mocp/tab/index.vue
+27
-2
No files found.
src/mocp/api/base.js
View file @
2c981718
...
...
@@ -32,3 +32,11 @@ export const getBasicParamsListApi = (data, config) => {
config
})
}
export
const
getTerminalListApi
=
(
data
,
config
)
=>
{
return
http
({
method
:
'POST'
,
url
:
'/terminal/getTerminalList'
,
data
,
config
})
}
src/mocp/api/panel.js
0 → 100644
View file @
2c981718
import
{
http
}
from
'mocp/utils/http'
export
const
findWeatherSynopsesMessagesApi
=
(
data
,
config
)
=>
{
return
http
({
method
:
'POST'
,
url
:
'/basicinfo/findWeatherSynopsesMessages'
,
data
,
config
})
}
src/mocp/store/base.js
View file @
2c981718
import
{
getAircraftNumbersApi
,
getBasicParamsListApi
}
from
'mocp/api/base'
import
{
getAircraftNumbersApi
,
getBasicParamsListApi
,
getTerminalListApi
}
from
'mocp/api/base'
import
{
defineStore
}
from
'pinia'
const
useBaseStore
=
defineStore
(
'base'
,
{
state
:
()
=>
{
return
{
selectList
:
{
deviceNumSelect
:
[]
//机号
deviceNumSelect
:
[],
//机号
terminalSelect
:
[]
//航站下拉数据
},
allBasicParams
:
{}
}
},
getters
:
{},
getters
:
{
getTerminalSelect
(
state
)
{
return
state
.
selectList
.
terminalSelect
?.
reduce
((
q
,
w
)
=>
{
if
(
!
q
[
w
.
terminalCode
])
{
q
[
w
.
terminalCode
]
=
[]
}
q
[
w
.
terminalCode
]
=
w
.
terminalCity
+
'-'
+
w
.
terminalName
+
'-'
+
w
.
terminalCode
return
q
},
{})
}
},
actions
:
{
async
initSysData
()
{
uni
.
showLoading
({
...
...
@@ -18,8 +29,7 @@ const useBaseStore = defineStore('base', {
mask
:
true
})
try
{
await
this
.
getAircraftNumbers
()
await
this
.
getBasicParamsList
()
await
Promise
.
all
(
this
.
getAircraftNumbers
(),
this
.
getBasicParamsList
(),
this
.
getTerminalList
())
uni
.
hideLoading
()
}
catch
(
error
)
{
uni
.
hideLoading
()
...
...
@@ -31,6 +41,12 @@ const useBaseStore = defineStore('base', {
this
.
selectList
.
deviceNumSelect
=
res
.
data
}
},
async
getTerminalList
()
{
const
res
=
await
getTerminalListApi
({
pageSize
:
100
,
pageIndex
:
1
})
if
(
res
.
code
==
200
)
{
this
.
selectList
.
terminalSelect
=
res
.
data
.
list
}
},
async
getBasicParamsList
()
{
const
res
=
await
getBasicParamsListApi
({})
if
(
res
.
code
==
200
)
{
...
...
src/pages/modules/mocp/panel/components/panel-navbar.vue
View file @
2c981718
...
...
@@ -4,11 +4,11 @@
<view
class=
"navbar-box-info"
>
<image
src=
"/static/mocp/image/panel/logo.png"
/>
</view>
<view
class=
"navbar-box-weather"
>
<
image
src=
"/static/mocp/image/panel/weather.png"
/
>
<view
class=
"navbar-box-weather"
v-if=
"weatherInfo"
>
<
!--
<image
src=
"/static/mocp/image/panel/weather.png"
/>
--
>
<view
class=
"info"
>
<view
class=
"place"
>
武汉-WUH
</view>
<view
class=
"txt"
>
晴转多云 22
°
</view>
<view
class=
"place"
>
{{
baseStore
.
getTerminalSelect
[
userStore
.
userInfo
?.
terminal
]
}}
</view>
<view
class=
"txt"
>
{{
weatherInfo
.
weatherInfoTxt
}}
{{
weatherInfo
.
temperature
}}
°
</view>
</view>
</view>
</view>
...
...
@@ -32,7 +32,18 @@
</view>
</
template
>
<
script
setup
></
script
>
<
script
setup
>
import
{
ref
}
from
'vue'
import
useUserStore
from
'mocp/store/user'
import
useBaseStore
from
'mocp/store/base'
const
userStore
=
useUserStore
()
const
baseStore
=
useBaseStore
()
const
weatherInfo
=
ref
()
uni
.
$on
(
'sendWeatherInfo'
,
(
info
)
=>
{
weatherInfo
.
value
=
info
})
</
script
>
<
style
lang=
"scss"
scoped
>
@import
'../constants/panel-navbar.scss'
;
</
style
>
src/pages/modules/mocp/panel/index.vue
View file @
2c981718
...
...
@@ -13,11 +13,6 @@
<
script
setup
>
import
PanelNavbar
from
'./components/panel-navbar.vue'
import
PanelMenu
from
'./components/panel-menu.vue'
import
useBaseStore
from
'mocp/store/base'
//加载基础参数
const
baseStore
=
useBaseStore
()
baseStore
.
initSysData
()
</
script
>
<
style
lang=
"scss"
scoped
>
.page-bg
{
...
...
src/pages/modules/mocp/tab/index.vue
View file @
2c981718
...
...
@@ -14,13 +14,38 @@
import
home
from
'../home/index.vue'
import
panel
from
'../panel/index.vue'
import
chat
from
'../chat/index.vue'
import
{
ref
}
from
'vue'
import
{
ref
,
watch
}
from
'vue'
import
useUserStore
from
'mocp/store/user'
import
useBaseStore
from
'mocp/store/base'
import
{
findWeatherSynopsesMessagesApi
}
from
'mocp/api/panel'
import
{
onLoad
}
from
'@dcloudio/uni-app'
const
userStore
=
useUserStore
()
const
baseStore
=
useBaseStore
()
//天气信息
const
weatherInfo
=
ref
()
const
findWeatherSynopsesMessages
=
async
()
=>
{
const
res
=
await
findWeatherSynopsesMessagesApi
({
airportCode
:
userStore
.
userInfo
.
terminal
})
if
(
res
.
code
==
200
)
{
weatherInfo
.
value
=
res
.
data
?.
at
(
-
1
)
uni
.
$emit
(
'sendWeatherInfo'
,
weatherInfo
.
value
)
}
}
onLoad
(
async
()
=>
{
//加载基础参数
await
baseStore
.
initSysData
()
//加载天气信息
await
findWeatherSynopsesMessages
()
})
//页面参数
const
query
=
defineProps
([
'name'
])
const
tabbarValue
=
ref
(
query
.
name
||
'panel'
)
watch
(
tabbarValue
,
(
value
)
=>
{
if
(
value
==
'panel'
)
{
findWeatherSynopsesMessages
()
}
})
//退出登录
const
userStore
=
useUserStore
()
const
handleLogOut
=
()
=>
{
userStore
.
handleLogOut
()
}
...
...
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