Commit 0ce212e4 by 张立顺

IMGURL

1 parent c564c51b
......@@ -58,7 +58,7 @@
],
"include": []
},
"appid": "wxe10067a63c1856ac",
"appid": "wxfe82b8d65d07808f",
"projectname": "miniprogram-scrm-shopmall",
"condition": {}
}
\ No newline at end of file
const _routeHooks = Symbol('_routeHooks')
const _query = Symbol('_query')
const _routerList = Symbol('_routerList')
import {
generateRoutList
} from './wxOnAppRoute.js'
import {
getNavigationBarTitleText
} from '~/utils/cache/storageApi'
import {
getUserInfo
} from '~/utils/cache/userInfo'
import { IMG_URL } from '~/utils/constantData'
import { generateRoutList } from './wxOnAppRoute.js'
import { getNavigationBarTitleText } from '~/utils/cache/storageApi'
import { getUserInfo } from '~/utils/cache/userInfo'
class Router {
[_query] = {};
[_routeHooks] = [];
......@@ -21,6 +16,7 @@ class Router {
let thisPage = this.getPageInstance()
if (thisPage) {
thisPage.options = this[_query]
thisPage.setData({ IMGURL: IMG_URL })
this.setNavigationBarTitleText(thisPage)
let onRoute = thisPage.onRoute
typeof onRoute === 'function' && onRoute(this[_query])
......@@ -41,10 +37,7 @@ 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({
......@@ -116,10 +109,7 @@ 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
......@@ -133,20 +123,14 @@ class Router {
}
/**关闭所有页面,打开到应用内的某个页面 */
reLaunch(route, events) {
let {
routerMapItem,
query
} = this.checkRouter(route, events)
let { routerMapItem, query } = this.checkRouter(route, events)
wx.reLaunch({
url: `${routerMapItem.url}${query}`
})
}
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
redirectTo(route, events) {
let {
routerMapItem,
query
} = this.checkRouter(route, events)
let { routerMapItem, query } = this.checkRouter(route, events)
wx.redirectTo({
url: `${routerMapItem.url}${query}`
})
......@@ -183,4 +167,4 @@ class Router {
}
}
export default Router
\ No newline at end of file
export default Router
import { IMG_URL } from '~/utils/constantData'
// import { IMG_URL } from '~/utils/constantData'
/**
* 执行路由前的准备工作
*/
......@@ -7,8 +7,8 @@ import { IMG_URL } from '~/utils/constantData'
const routerBefore = next => {
// console.log("处理前置钩子逻辑");
// 配置图片全局路径
let page = wx.$router.getPageInstance()
page && (page.data.IMG_URL = IMG_URL)
// let page = wx.$router.getPageInstance()
// page && (page.data.IMG_URL = IMG_URL)
// page && page.setData({ IMG_URL })
// console.log()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!