Commit de5a8995 by 李伟康

修改代码

1 parent 47e41294
......@@ -60,61 +60,4 @@
.isFullSucreen-bottom {
bottom: constant(safe-area-inset-bottom) !important;
bottom: env(safe-area-inset-bottom) !important;
}
.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
const _routeHooks = Symbol('_routeHooks')
const _query = Symbol('_query')
const _routerList = Symbol('_routerList')
import { wxOnAppRouteFn, generateRoutList } from './wxOnAppRoute.js'
import { getNavigationBarTitleText } from '~/utils/cache/storageApi'
import { getUserInfo } from '~/utils/cache/userInfo'
import {
wxOnAppRouteFn,
generateRoutList
} from './wxOnAppRoute.js'
import {
getNavigationBarTitleText
} from '~/utils/cache/storageApi'
import {
getUserInfo
} from '~/utils/cache/userInfo'
class Router {
[_query] = {};
[_routeHooks] = [];
......@@ -15,7 +22,6 @@ class Router {
routeHooks: this[_routeHooks],
routerList: this[_routerList],
getPageInstance: this.getPageInstance,
getRootName: this.getRootName,
setNavigationBarTitleText: this.setNavigationBarTitleText,
getRouterList: this.getRouterList
}
......@@ -27,7 +33,10 @@ class Router {
if (getUserInfo()) title = getUserInfo().merchantName
const router = `${thisPage.__route__}.html`
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 (!navigationBarTitleText && !navigationStyle)
wx.setNavigationBarTitle({
......@@ -39,12 +48,6 @@ class Router {
getRouterList = () => {
return this[_routerList]
}
/**获取当前分包名 */
getRootName = () => {
let router = `/${this.getPageInstance().__route__}`
let { rootName } = this.getRouterList().find(item => router === item.url)
return rootName
}
/**获取页面对象实例 */
getPageInstance = (size = 1) => {
const pages = getCurrentPages()
......@@ -67,10 +70,7 @@ class Router {
parent = _parent
}
/**只传页面名 默认跳转当前包下的页面,相同名称默认第一个 */
if (!_name && !last_name) {
name = _parent
parent = this.getRootName() || parent
}
if (!_name && !last_name) name = _parent
const routerMapItem = this[_routerList].find(item => {
if (last_name) {
return item.parent === parent && item.name === last_name && item.subPages === name
......@@ -108,7 +108,10 @@ class Router {
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层
*/
go(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events)
let {
routerMapItem,
query
} = this.checkRouter(route, events)
if (routerMapItem.isTab) {
wx.switchTab({
url: routerMapItem.url
......@@ -132,7 +135,10 @@ class Router {
}
/**关闭所有页面,打开到应用内的某个页面 */
reLaunch(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events)
let {
routerMapItem,
query
} = this.checkRouter(route, events)
this.intercept().then(response => {
if (response) return
wx.reLaunch({
......@@ -142,7 +148,10 @@ class Router {
}
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
redirectTo(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events)
let {
routerMapItem,
query
} = this.checkRouter(route, events)
this.intercept().then(response => {
if (response) return
wx.redirectTo({
......@@ -194,4 +203,4 @@ class Router {
}
}
export default Router
export default Router
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!