Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit de5a8995
authored
Oct 09, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改代码
1 parent
47e41294
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
75 deletions
common.wxss
router/router.js
common.wxss
View file @
de5a899
...
@@ -61,60 +61,3 @@
...
@@ -61,60 +61,3 @@
bottom: constant(safe-area-inset-bottom) !important;
bottom: constant(safe-area-inset-bottom) !important;
bottom: env(safe-area-inset-bottom) !important;
bottom: env(safe-area-inset-bottom) !important;
}
}
\ No newline at end of file
\ No newline at end of file
.default-btn {
width: 686rpx;
height: 88rpx;
background: var(--btnColor);
border-radius: var(--borderRadius);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: var(--margin);
}
.list-nothing {
width: 100%;
padding: 8rpx 0 30rpx;
text-align: center;
font-size: 28rpx;
color: #C1C2C3;
}
.list-nothing .icon {
width: 320rpx;
height: 320rpx;
}
.list-not {
display: flex;
align-items: center;
justify-content: center;
color: #999;
font-size: 24rpx;
height: 100%;
}
@keyframes show-box {
0% {
opacity: 0;
transform: scale(2.5);
}
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes show-box-opacity {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
\ No newline at end of file
\ No newline at end of file
router/router.js
View file @
de5a899
const
_routeHooks
=
Symbol
(
'_routeHooks'
)
const
_routeHooks
=
Symbol
(
'_routeHooks'
)
const
_query
=
Symbol
(
'_query'
)
const
_query
=
Symbol
(
'_query'
)
const
_routerList
=
Symbol
(
'_routerList'
)
const
_routerList
=
Symbol
(
'_routerList'
)
import
{
wxOnAppRouteFn
,
generateRoutList
}
from
'./wxOnAppRoute.js'
import
{
import
{
getNavigationBarTitleText
}
from
'~/utils/cache/storageApi'
wxOnAppRouteFn
,
import
{
getUserInfo
}
from
'~/utils/cache/userInfo'
generateRoutList
}
from
'./wxOnAppRoute.js'
import
{
getNavigationBarTitleText
}
from
'~/utils/cache/storageApi'
import
{
getUserInfo
}
from
'~/utils/cache/userInfo'
class
Router
{
class
Router
{
[
_query
]
=
{};
[
_query
]
=
{};
[
_routeHooks
]
=
[];
[
_routeHooks
]
=
[];
...
@@ -15,7 +22,6 @@ class Router {
...
@@ -15,7 +22,6 @@ class Router {
routeHooks
:
this
[
_routeHooks
],
routeHooks
:
this
[
_routeHooks
],
routerList
:
this
[
_routerList
],
routerList
:
this
[
_routerList
],
getPageInstance
:
this
.
getPageInstance
,
getPageInstance
:
this
.
getPageInstance
,
getRootName
:
this
.
getRootName
,
setNavigationBarTitleText
:
this
.
setNavigationBarTitleText
,
setNavigationBarTitleText
:
this
.
setNavigationBarTitleText
,
getRouterList
:
this
.
getRouterList
getRouterList
:
this
.
getRouterList
}
}
...
@@ -27,7 +33,10 @@ class Router {
...
@@ -27,7 +33,10 @@ class Router {
if
(
getUserInfo
())
title
=
getUserInfo
().
merchantName
if
(
getUserInfo
())
title
=
getUserInfo
().
merchantName
const
router
=
`
${
thisPage
.
__route__
}
.html`
const
router
=
`
${
thisPage
.
__route__
}
.html`
if
(
__wxConfig
&&
__wxConfig
.
page
&&
__wxConfig
.
page
[
router
])
{
if
(
__wxConfig
&&
__wxConfig
.
page
&&
__wxConfig
.
page
[
router
])
{
let
{
navigationBarTitleText
,
navigationStyle
}
=
__wxConfig
.
page
[
router
].
window
let
{
navigationBarTitleText
,
navigationStyle
}
=
__wxConfig
.
page
[
router
].
window
if
(
!
title
)
title
=
'生意助手'
if
(
!
title
)
title
=
'生意助手'
if
(
!
navigationBarTitleText
&&
!
navigationStyle
)
if
(
!
navigationBarTitleText
&&
!
navigationStyle
)
wx
.
setNavigationBarTitle
({
wx
.
setNavigationBarTitle
({
...
@@ -39,12 +48,6 @@ class Router {
...
@@ -39,12 +48,6 @@ class Router {
getRouterList
=
()
=>
{
getRouterList
=
()
=>
{
return
this
[
_routerList
]
return
this
[
_routerList
]
}
}
/**获取当前分包名 */
getRootName
=
()
=>
{
let
router
=
`/
${
this
.
getPageInstance
().
__route__
}
`
let
{
rootName
}
=
this
.
getRouterList
().
find
(
item
=>
router
===
item
.
url
)
return
rootName
}
/**获取页面对象实例 */
/**获取页面对象实例 */
getPageInstance
=
(
size
=
1
)
=>
{
getPageInstance
=
(
size
=
1
)
=>
{
const
pages
=
getCurrentPages
()
const
pages
=
getCurrentPages
()
...
@@ -67,10 +70,7 @@ class Router {
...
@@ -67,10 +70,7 @@ class Router {
parent
=
_parent
parent
=
_parent
}
}
/**只传页面名 默认跳转当前包下的页面,相同名称默认第一个 */
/**只传页面名 默认跳转当前包下的页面,相同名称默认第一个 */
if
(
!
_name
&&
!
last_name
)
{
if
(
!
_name
&&
!
last_name
)
name
=
_parent
name
=
_parent
parent
=
this
.
getRootName
()
||
parent
}
const
routerMapItem
=
this
[
_routerList
].
find
(
item
=>
{
const
routerMapItem
=
this
[
_routerList
].
find
(
item
=>
{
if
(
last_name
)
{
if
(
last_name
)
{
return
item
.
parent
===
parent
&&
item
.
name
===
last_name
&&
item
.
subPages
===
name
return
item
.
parent
===
parent
&&
item
.
name
===
last_name
&&
item
.
subPages
===
name
...
@@ -108,7 +108,10 @@ class Router {
...
@@ -108,7 +108,10 @@ class Router {
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层
*/
*/
go
(
route
,
events
)
{
go
(
route
,
events
)
{
let
{
routerMapItem
,
query
}
=
this
.
checkRouter
(
route
,
events
)
let
{
routerMapItem
,
query
}
=
this
.
checkRouter
(
route
,
events
)
if
(
routerMapItem
.
isTab
)
{
if
(
routerMapItem
.
isTab
)
{
wx
.
switchTab
({
wx
.
switchTab
({
url
:
routerMapItem
.
url
url
:
routerMapItem
.
url
...
@@ -132,7 +135,10 @@ class Router {
...
@@ -132,7 +135,10 @@ class Router {
}
}
/**关闭所有页面,打开到应用内的某个页面 */
/**关闭所有页面,打开到应用内的某个页面 */
reLaunch
(
route
,
events
)
{
reLaunch
(
route
,
events
)
{
let
{
routerMapItem
,
query
}
=
this
.
checkRouter
(
route
,
events
)
let
{
routerMapItem
,
query
}
=
this
.
checkRouter
(
route
,
events
)
this
.
intercept
().
then
(
response
=>
{
this
.
intercept
().
then
(
response
=>
{
if
(
response
)
return
if
(
response
)
return
wx
.
reLaunch
({
wx
.
reLaunch
({
...
@@ -142,7 +148,10 @@ class Router {
...
@@ -142,7 +148,10 @@ class Router {
}
}
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
redirectTo
(
route
,
events
)
{
redirectTo
(
route
,
events
)
{
let
{
routerMapItem
,
query
}
=
this
.
checkRouter
(
route
,
events
)
let
{
routerMapItem
,
query
}
=
this
.
checkRouter
(
route
,
events
)
this
.
intercept
().
then
(
response
=>
{
this
.
intercept
().
then
(
response
=>
{
if
(
response
)
return
if
(
response
)
return
wx
.
redirectTo
({
wx
.
redirectTo
({
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment