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 d640b8fa
authored
Oct 25, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加媒体资源版本号
1 parent
2d8cbc61
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
15 deletions
mixins/imgUrl.js
router/router.js
utils/constantData.js
mixins/imgUrl.js
View file @
d640b8f
import
{
IMG_URL
}
from
'~/utils/constantData'
import
{
IMG_URL
,
IMG_VERSION
}
from
'~/utils/constantData'
module
.
exports
=
Behavior
({
data
:
{
IMGURL
:
IMG_URL
IMGURL
:
IMG_URL
,
IMG_VERSION
:
IMG_VERSION
()
}
})
router/router.js
View file @
d640b8f
const
_routeHooks
=
Symbol
(
'_routeHooks'
)
const
_query
=
Symbol
(
'_query'
)
const
_routerList
=
Symbol
(
'_routerList'
)
import
{
IMG_URL
}
from
'~/utils/constantData'
import
{
IMG_URL
,
IMG_VERSION
}
from
'~/utils/constantData'
import
{
generateRoutList
}
from
'./wxOnAppRoute.js'
import
{
getNavigationBarTitleText
}
from
'~/utils/cache/storageApi'
import
{
getUserInfo
}
from
'~/utils/cache/userInfo'
...
...
@@ -15,8 +15,8 @@ class Router {
wx
.
onAppRoute
(
e
=>
{
let
thisPage
=
this
.
getPageInstance
()
if
(
thisPage
)
{
thisPage
.
setData
({
IMG_URL
})
if
(
Object
.
keys
(
this
[
_query
]).
length
)
thisPage
.
options
=
{
thisPage
.
setData
({
IMG_URL
,
img_version
:
IMG_VERSION
()
})
if
(
Object
.
keys
(
this
[
_query
]).
length
)
thisPage
.
options
=
{
...
thisPage
.
options
,
...
this
[
_query
]
}
...
...
@@ -58,7 +58,7 @@ class Router {
return
pages
[
pages
.
length
-
size
]
}
checkRouter
(
route
,
events
)
{
checkRouter
(
route
,
events
)
{
this
[
_query
]
=
events
||
{}
const
[
_parent
,
_name
,
last_name
]
=
route
.
split
(
'.'
)
let
name
=
route
...
...
@@ -95,7 +95,7 @@ class Router {
}
}
/**跳转至H5 */
jumpH5
(
url
)
{
jumpH5
(
url
)
{
wx
.
navigateTo
({
url
:
`/pages/webView/webView?url=
${
encodeURIComponent
(
url
)}
`
})
...
...
@@ -103,7 +103,7 @@ class Router {
/**页面跳转
*
*/
jump
(
e
)
{
jump
(
e
)
{
const
item
=
e
.
currentTarget
.
dataset
this
.
go
(
item
.
url
,
item
)
}
...
...
@@ -111,7 +111,7 @@ class Router {
* 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 ||
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层
*/
go
(
route
,
events
)
{
go
(
route
,
events
)
{
let
{
routerMapItem
,
query
}
=
this
.
checkRouter
(
route
,
events
)
if
(
routerMapItem
.
isTab
)
{
wx
.
switchTab
({
...
...
@@ -125,14 +125,14 @@ class Router {
}
}
/**关闭所有页面,打开到应用内的某个页面 */
reLaunch
(
route
,
events
)
{
reLaunch
(
route
,
events
)
{
let
{
routerMapItem
,
query
}
=
this
.
checkRouter
(
route
,
events
)
wx
.
reLaunch
({
url
:
`
${
routerMapItem
.
url
}${
query
}
`
})
}
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
redirectTo
(
route
,
events
)
{
redirectTo
(
route
,
events
)
{
let
{
routerMapItem
,
query
}
=
this
.
checkRouter
(
route
,
events
)
wx
.
redirectTo
({
url
:
`
${
routerMapItem
.
url
}${
query
}
`
...
...
@@ -141,7 +141,7 @@ class Router {
/**prevPageSize = 1
* 返回上prevPageSize页
* callBack返回上prevPageSize页对象 */
back
(
callBack
,
prevPageSize
=
1
)
{
back
(
callBack
,
prevPageSize
=
1
)
{
let
prevPage
=
this
.
getPageInstance
(
Number
(
prevPageSize
)
+
1
)
if
(
callBack
&&
'function'
===
typeof
callBack
)
callBack
(
prevPage
)
wx
.
navigateBack
({
...
...
@@ -150,18 +150,18 @@ class Router {
this
.
goHome
()
})
}
goHome
()
{
goHome
()
{
let
[
index
]
=
this
[
_routerList
]
wx
.
reLaunch
({
url
:
index
.
url
})
}
/**获取上一个页面传的数据 */
getData
(
callBack
)
{
getData
(
callBack
)
{
const
data
=
this
.
getPageInstance
().
getOpenerEventChannel
()
if
(
Object
.
keys
(
data
).
length
!==
0
)
data
.
on
(
'getData'
,
res
=>
callBack
(
res
))
}
onRoute
(
fn
)
{
onRoute
(
fn
)
{
this
[
_routeHooks
].
push
(
fn
)
return
()
=>
{
const
i
=
list
.
indexOf
(
fn
)
...
...
utils/constantData.js
View file @
d640b8f
...
...
@@ -16,3 +16,8 @@ export const STORAGE_OBJECTkEY = {
firstLogin
:
'firstLogin'
,
authphone
:
'authphone'
}
export
const
IMG_VERSION
=
()
=>
{
const
accountInfo
=
wx
.
getAccountInfoSync
()
return
accountInfo
.
miniProgram
.
version
||
'1.0.0'
}
\ No newline at end of file
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