diff --git a/package.json b/package.json index f721e4d..3f13cdd 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "path-to-regexp": "2.4.0", "view-design": "^4.7.0", "vue": "2.6.10", + "vue-matomo": "^4.2.0", "vue-router": "3.0.6", "vuex": "3.1.0", "wangeditor": "^4.7.12" diff --git a/public/index.html b/public/index.html index fa2be91..12c6783 100644 --- a/public/index.html +++ b/public/index.html @@ -13,5 +13,8 @@
+ + + diff --git a/src/App.vue b/src/App.vue index e1f2fe0..82011f4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,12 +1,28 @@ - - - diff --git a/src/layout/noLayout.vue b/src/layout/noLayout.vue new file mode 100644 index 0000000..fd0677d --- /dev/null +++ b/src/layout/noLayout.vue @@ -0,0 +1,47 @@ + + + + + + + diff --git a/src/main.js b/src/main.js index 9232d99..effd60e 100644 --- a/src/main.js +++ b/src/main.js @@ -46,3 +46,23 @@ new Vue({ store, render: h => h(App) }) + +import VueMatomo from 'vue-matomo' + +Vue.use(VueMatomo, { + host: 'http://192.168.60.99:9000/', // 这里配置你自己的piwik服务器地址和网站ID + siteId: 1,//siteId值 + // 根据router自动注册 + router: router, + // // 是否需要在发送追踪信息之前请求许可 + // // 默认false + requireConsent: false, + enableLinkTracking: true, + // // 是否追踪初始页面 + // // 默认true + trackInitialView: false, + // // 最终的追踪js文件名 + // // 默认 'piwik' + trackerFileName: 'matomo', + debug: false +}); diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 5a221e7..5e926ba 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -23,10 +23,23 @@ function hasPermission(roles, route) { * @param view 格式必须为 xxx/xxx 开头不要加斜杠 * @returns */ -export const loadView = (view) => { +export const loadView = (view) => { + //console.log('loadView'); return (resolve) => require([`@/views${view}`], resolve); } - + + +const componentHandler = (item) => { + //return path === '#'|| path == '' ? Layout : loadView(path) + if(item.url === '#' || item.url === ''){ + return Layout + } + if(item.path&&item.path.includes('#') && item.path !== '#'){ + console.log('@/layout/noLayout'); + return ()=>import('@/layout/noLayout') + } + return loadView(item.url) +} /** * Filter asynchronous routing tables by recursion @@ -79,13 +92,16 @@ export function generaMenu(routes, data) { }) } else { var path = item.url; - if (item.path != "null" && item.path != null && item.path != "") { + if (item.path != "null" && item.path != null && item.path != ""&& item.path != "##") { path = item.path - } + } + console.log(path) const menu = { - path: (path === '#' ? item.id + '_key' : path), + + path: (path.includes('#') ? item.id + '_key' : path), redirect: (item.children.length > 0 ? "noRedirect" : ""), - component: item.url === '#' ? Layout : loadView(item.url), + //component: item.url === '#' ? Layout : loadView(item.url), + component:componentHandler(item), // hidden: true, children: [], name: 'menu_' + item.id,