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
38e5a7f5
Commit
38e5a7f5
authored
Jun 06, 2024
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 处理自定义菜单
parent
48f77515
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
82 additions
and
49 deletions
+82
-49
src/mocp/components/global-navbar/global-navbar.vue
+1
-1
src/mocp/components/global-page/global-page.vue
+0
-11
src/mocp/components/global-tabs/global-tabs.vue
+4
-0
src/mocp/components/widget/custom-tabbar.vue
+12
-12
src/mocp/store/base.js
+0
-3
src/mocp/store/user.js
+1
-1
src/mocp/utils/jump.js
+22
-2
src/pages.json
+7
-1
src/pages/modules/mocp/chat/index.vue
+1
-1
src/pages/modules/mocp/home/index.vue
+2
-14
src/pages/modules/mocp/panel/components/panel-menu.vue
+1
-1
src/pages/modules/mocp/panel/components/panel-navbar.vue
+1
-1
src/pages/modules/mocp/panel/index.vue
+1
-1
src/pages/modules/mocp/tab/index.vue
+29
-0
No files found.
src/mocp/components/global-navbar/global-navbar.vue
View file @
38e5a7f5
<
template
>
<
template
>
<!-- 全局自定义navbar -->
<!-- 全局自定义navbar -->
<view
class=
"mocp-navbar"
>
<view
class=
"mocp-navbar"
>
<up-navbar
:title=
"title"
:fixed=
"false"
:bgColor=
"bgColor"
:safeAreaInsetTop=
"false"
:titleStyle=
"getTitleStyle"
>
<up-navbar
:title=
"title"
:fixed=
"false"
:bgColor=
"bgColor"
:safeAreaInsetTop=
"false"
:titleStyle=
"getTitleStyle"
:leftIconSize=
"0"
>
<template
#
left
>
<template
#
left
>
<slot
name=
"left"
></slot>
<slot
name=
"left"
></slot>
</
template
>
</
template
>
...
...
src/mocp/components/global-page/global-page.vue
View file @
38e5a7f5
...
@@ -49,7 +49,6 @@
...
@@ -49,7 +49,6 @@
<global-button
type=
"primary"
size=
"large"
@
tap=
"handleFooterClick"
>
{{
footerBtnText
}}
</global-button>
<global-button
type=
"primary"
size=
"large"
@
tap=
"handleFooterClick"
>
{{
footerBtnText
}}
</global-button>
</view>
</view>
<slot
name=
"bottom"
></slot>
<slot
name=
"bottom"
></slot>
<custom-tabbar
:tabbarValue=
"tabbarValue"
></custom-tabbar>
</
template
>
</
template
>
</z-paging>
</z-paging>
</template>
</template>
...
@@ -72,16 +71,6 @@ const ps = defineProps({
...
@@ -72,16 +71,6 @@ const ps = defineProps({
type
:
[
String
,
Number
],
type
:
[
String
,
Number
],
default
:
0
default
:
0
},
},
//是否显示底部导航
showTabbar
:
{
type
:
Boolean
,
default
:
false
},
//底部导航选中的下标
tabbarValue
:
{
type
:
[
Number
,
String
],
default
:
1
},
//是否自动加载
//是否自动加载
auto
:
{
auto
:
{
type
:
Boolean
,
type
:
Boolean
,
...
...
src/mocp/components/global-tabs/global-tabs.vue
View file @
38e5a7f5
...
@@ -74,6 +74,10 @@ const ps = defineProps({
...
@@ -74,6 +74,10 @@ const ps = defineProps({
keyName
:
{
keyName
:
{
type
:
String
,
type
:
String
,
default
:
'name'
default
:
'name'
},
scrollable
:
{
type
:
Boolean
,
default
:
true
}
}
})
})
...
...
src/mocp/components/widget/custom-tabbar.vue
View file @
38e5a7f5
<
template
>
<
template
>
<up-tabbar
:value=
"
tabbar
Value"
:fixed=
"false"
:placeholder=
"false"
:safeAreaInsetBottom=
"true"
activeColor=
"#165dff"
inactiveColor=
"#4e5969"
>
<up-tabbar
:value=
"
model
Value"
:fixed=
"false"
:placeholder=
"false"
:safeAreaInsetBottom=
"true"
activeColor=
"#165dff"
inactiveColor=
"#4e5969"
>
<template
v-for=
"item in list"
:key=
"item.name"
>
<template
v-for=
"item in list"
:key=
"item.name"
>
<up-tabbar-item
:text=
"item.text"
@
click=
"handleClickTabbar"
>
<up-tabbar-item
:text=
"item.text"
@
click=
"handleClickTabbar"
:name=
"item.name"
>
<template
#
active-icon
>
<template
#
active-icon
>
<image
class=
"u-page__item__slot-icon"
:src=
"item.selectedIconPath"
mode=
"widthFix"
></image>
<image
class=
"u-page__item__slot-icon"
:src=
"item.selectedIconPath"
mode=
"widthFix"
></image>
</
template
>
</
template
>
...
@@ -16,38 +16,38 @@
...
@@ -16,38 +16,38 @@
<
script
setup
>
<
script
setup
>
import
{
ref
}
from
'vue'
import
{
ref
}
from
'vue'
const
es
=
defineEmits
([
'update:modelValue'
,
'change'
])
const
ps
=
defineProps
({
const
ps
=
defineProps
({
tabbar
Value
:
{
model
Value
:
{
type
:
[
Number
,
String
]
,
type
:
String
,
default
:
1
default
:
''
}
}
})
})
const
list
=
ref
([
const
list
=
ref
([
{
{
pagePath
:
'/home/index
'
,
name
:
'home
'
,
text
:
'首页'
,
text
:
'首页'
,
iconPath
:
'/static/mocp/image/menu/home.png'
,
iconPath
:
'/static/mocp/image/menu/home.png'
,
selectedIconPath
:
'/static/mocp/image/menu/home-select.png'
selectedIconPath
:
'/static/mocp/image/menu/home-select.png'
},
},
{
{
pagePath
:
'/panel/index
'
,
name
:
'panel
'
,
text
:
'工作台'
,
text
:
'工作台'
,
iconPath
:
'/static/mocp/image/menu/panel.png'
,
iconPath
:
'/static/mocp/image/menu/panel.png'
,
selectedIconPath
:
'/static/mocp/image/menu/panel-select.png'
selectedIconPath
:
'/static/mocp/image/menu/panel-select.png'
},
},
{
{
pagePath
:
'/chat/index
'
,
name
:
'chat
'
,
text
:
'沟通'
,
text
:
'沟通'
,
iconPath
:
'/static/mocp/image/menu/chat.png'
,
iconPath
:
'/static/mocp/image/menu/chat.png'
,
selectedIconPath
:
'/static/mocp/image/menu/chat-select.png'
selectedIconPath
:
'/static/mocp/image/menu/chat-select.png'
}
}
])
])
const
handleClickTabbar
=
(
index
)
=>
{
const
handleClickTabbar
=
(
name
)
=>
{
if
(
ps
.
tabbarValue
!=
index
)
{
es
(
'update:modelValue'
,
name
)
uni
.
$mocpJump
.
reLaunch
(
list
.
value
[
index
].
pagePath
)
es
(
'change'
,
name
)
}
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
...
...
src/mocp/store/base.js
View file @
38e5a7f5
...
@@ -4,7 +4,6 @@ import { defineStore } from 'pinia'
...
@@ -4,7 +4,6 @@ import { defineStore } from 'pinia'
const
useBaseStore
=
defineStore
(
'base'
,
{
const
useBaseStore
=
defineStore
(
'base'
,
{
state
:
()
=>
{
state
:
()
=>
{
return
{
return
{
isloading
:
false
,
//是否加载
selectList
:
{
selectList
:
{
deviceNumSelect
:
[]
//机号
deviceNumSelect
:
[]
//机号
},
},
...
@@ -14,7 +13,6 @@ const useBaseStore = defineStore('base', {
...
@@ -14,7 +13,6 @@ const useBaseStore = defineStore('base', {
getters
:
{},
getters
:
{},
actions
:
{
actions
:
{
async
initSysData
()
{
async
initSysData
()
{
if
(
this
.
isloading
)
return
uni
.
showLoading
({
uni
.
showLoading
({
title
:
'正在加载系统所有基本参数中,请稍后!'
,
title
:
'正在加载系统所有基本参数中,请稍后!'
,
mask
:
true
mask
:
true
...
@@ -23,7 +21,6 @@ const useBaseStore = defineStore('base', {
...
@@ -23,7 +21,6 @@ const useBaseStore = defineStore('base', {
await
this
.
getAircraftNumbers
()
await
this
.
getAircraftNumbers
()
await
this
.
getBasicParamsList
()
await
this
.
getBasicParamsList
()
uni
.
hideLoading
()
uni
.
hideLoading
()
this
.
isloading
=
true
}
catch
(
error
)
{
}
catch
(
error
)
{
uni
.
hideLoading
()
uni
.
hideLoading
()
}
}
...
...
src/mocp/store/user.js
View file @
38e5a7f5
...
@@ -69,7 +69,7 @@ const useUserStore = defineStore('user', {
...
@@ -69,7 +69,7 @@ const useUserStore = defineStore('user', {
})
})
}
}
//跳转工作台
//跳转工作台
uni
.
$mocpJump
.
redirectTo
(
'/
panel
/index'
)
uni
.
$mocpJump
.
redirectTo
(
'/
tab
/index'
)
},
},
//退出登录
//退出登录
handleLogOut
()
{
handleLogOut
()
{
...
...
src/mocp/utils/jump.js
View file @
38e5a7f5
...
@@ -81,8 +81,7 @@ export const reLaunch = (url, params = {}) => {
...
@@ -81,8 +81,7 @@ export const reLaunch = (url, params = {}) => {
/**
/**
* 封装 uni.navigateBack 为 Promise 版本
* 封装 uni.navigateBack 为 Promise 版本
* @param {string} url 要跳转的页面路径
* @param {string} delta 要回退的数量
* @param {Object} params 要传递的参数对象
* @returns {Promise} 返回一个 Promise 对象,resolve 表示跳转成功,reject 表示跳转失败
* @returns {Promise} 返回一个 Promise 对象,resolve 表示跳转成功,reject 表示跳转失败
*/
*/
export
const
navigateBack
=
(
delta
=
1
)
=>
{
export
const
navigateBack
=
(
delta
=
1
)
=>
{
...
@@ -99,3 +98,24 @@ export const navigateBack = (delta = 1) => {
...
@@ -99,3 +98,24 @@ export const navigateBack = (delta = 1) => {
})
})
})
})
}
}
/**
* 封装 uni.switchTab 为 Promise 版本
* @param {string} name 要跳转的tab页面名称
* @returns {Promise} 返回一个 Promise 对象,resolve 表示跳转成功,reject 表示跳转失败
*/
export
const
switchTab
=
(
name
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// 调用 uni.redirectTo 并处理结果
const
fullUrl
=
'tab/index?name='
+
name
uni
.
redirectTo
({
url
:
'/pages/modules/mocp'
+
fullUrl
,
success
:
()
=>
{
resolve
()
},
fail
:
(
err
)
=>
{
reject
(
err
)
}
})
})
}
src/pages.json
View file @
38e5a7f5
...
@@ -124,6 +124,12 @@
...
@@ -124,6 +124,12 @@
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"跟踪批示"
"navigationBarTitleText"
:
"跟踪批示"
}
}
},
{
"path"
:
"pages/modules/mocp/tab/index"
,
"style"
:
{
"navigationBarTitleText"
:
"tab页面"
}
}
}
],
],
"globalStyle"
:
{
"globalStyle"
:
{
...
@@ -142,7 +148,7 @@
...
@@ -142,7 +148,7 @@
"list"
:
[
"list"
:
[
{
{
"name"
:
"test"
,
//模式名称
"name"
:
"test"
,
//模式名称
"path"
:
"pages/modules/mocp/
panel
/index"
//启动页面,必选
"path"
:
"pages/modules/mocp/
tab
/index"
//启动页面,必选
},
},
{
{
"name"
:
"login"
,
//模式名称
"name"
:
"login"
,
//模式名称
...
...
src/pages/modules/mocp/chat/index.vue
View file @
38e5a7f5
<
template
>
<
template
>
<global-page
title=
"沟通"
:showNavLeft=
"false"
showTabbar
:tabbarValue=
"2"
></global-page>
<global-page
title=
"沟通"
:showNavLeft=
"false"
></global-page>
</
template
>
</
template
>
<
script
setup
></
script
>
<
script
setup
></
script
>
...
...
src/pages/modules/mocp/home/index.vue
View file @
38e5a7f5
<
template
>
<
template
>
<global-page
title=
"首页"
:showNavLeft=
"false"
showTabbar
:tabbarValue=
"0"
>
<global-page
title=
"首页"
:showNavLeft=
"false"
></global-page>
<template
#
bottom
>
<global-button
size=
"large"
type=
"primary"
@
tap=
"handleLogOut"
>
退出登录
</global-button>
</
template
>
</global-page>
</
template
>
</
template
>
<
script
setup
>
<
script
setup
></
script
>
import
useUserStore
from
'mocp/store/user'
//退出登录
const
userStore
=
useUserStore
()
const
handleLogOut
=
()
=>
{
userStore
.
handleLogOut
()
}
</
script
>
<
style
lang=
"scss"
></
style
>
<
style
lang=
"scss"
></
style
>
src/pages/modules/mocp/panel/components/panel-menu.vue
View file @
38e5a7f5
<
template
>
<
template
>
<view
class=
"content"
:style=
"
{ height: `calc(100vh - 344rpx - ${safeAreaInsets?.top + 'px'} - ${safeAreaInsets?.bottom + 'px'} - 50px)` }">
<view
class=
"content"
:style=
"
{ height: `calc(100vh - 344rpx - ${safeAreaInsets?.top + 'px'} - ${safeAreaInsets?.bottom + 'px'} - 50px)` }">
<view
class=
"tab-nav"
>
<view
class=
"tab-nav"
>
<global-tabs
:list=
"tabNav"
@
handleClick=
"handleClick"
></global-tabs>
<global-tabs
:list=
"tabNav"
@
handleClick=
"handleClick"
:scrollable=
"false"
></global-tabs>
</view>
</view>
<scroll-view
class=
"tab-content"
scroll-y=
"true"
>
<scroll-view
class=
"tab-content"
scroll-y=
"true"
>
<view
class=
"tab-content-item"
v-if=
"activeIndex == 0"
>
<view
class=
"tab-content-item"
v-if=
"activeIndex == 0"
>
...
...
src/pages/modules/mocp/panel/components/panel-navbar.vue
View file @
38e5a7f5
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
</view>
</view>
<view
class=
"navbar-bottom-list"
>
<view
class=
"navbar-bottom-list"
>
<view
class=
"list-item"
>
<view
class=
"list-item"
>
<image
class=
"list-item-image"
src=
"/static/mocp/image/panel/wd
xx
.png"
/>
<image
class=
"list-item-image"
src=
"/static/mocp/image/panel/wd
db
.png"
/>
<view
class=
"list-item-msg"
>
<view
class=
"list-item-msg"
>
<view
class=
"list-item-title"
>
我的待办
</view>
<view
class=
"list-item-title"
>
我的待办
</view>
<view
class=
"list-item-txt"
>
24
</view>
<view
class=
"list-item-txt"
>
24
</view>
...
...
src/pages/modules/mocp/panel/index.vue
View file @
38e5a7f5
<
template
>
<
template
>
<global-page
:showNavbar=
"false"
showTabbar
:tabbarValue=
"1"
>
<global-page
:showNavbar=
"false"
>
<!-- 导航栏 -->
<!-- 导航栏 -->
<template
#
top
>
<template
#
top
>
<image
class=
"page-bg"
src=
"/static/mocp/image/panel/page-bg.png"
/>
<image
class=
"page-bg"
src=
"/static/mocp/image/panel/page-bg.png"
/>
...
...
src/pages/modules/mocp/tab/index.vue
0 → 100644
View file @
38e5a7f5
<
template
>
<global-page>
<home
v-show=
"tabbarValue == 'home'"
></home>
<panel
v-show=
"tabbarValue == 'panel'"
></panel>
<chat
v-show=
"tabbarValue == 'chat'"
></chat>
<template
#
bottom
>
<global-button
size=
"large"
type=
"primary"
@
tap=
"handleLogOut"
v-show=
"tabbarValue == 'home'"
>
退出登录
</global-button>
<custom-tabbar
v-model=
"tabbarValue"
></custom-tabbar>
</
template
>
</global-page>
</template>
<
script
setup
>
import
home
from
'../home/index.vue'
import
panel
from
'../panel/index.vue'
import
chat
from
'../chat/index.vue'
import
{
ref
}
from
'vue'
import
useUserStore
from
'mocp/store/user'
const
query
=
defineProps
([
'name'
])
const
tabbarValue
=
ref
(
query
.
name
||
'panel'
)
//退出登录
const
userStore
=
useUserStore
()
const
handleLogOut
=
()
=>
{
userStore
.
handleLogOut
()
}
</
script
>
<
style
lang=
"scss"
></
style
>
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