Commit d0c30963 by 胡悦

提交

1 parent b49bcbe5
{
"root": true,
"env": {
"node": true
},
"extends": ["plugin:vue/essential", "@vue/prettier"],
"rules": {
"no-console": "off",
"no-unused-vars":"off",
"prettier.endOfLine": "crlf",
"endOfLine":"auto"
},
"parserOptions": {
"parser": "babel-eslint"
}
}
module.exports = {
root: true,
env: {
node: true
},
extends: ['plugin:vue/essential', '@vue/prettier'],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
"no-unused-vars":"off",
"prettier.endOfLine": "crlf",
"endOfLine":"auto"
}
}
{ {
"name": "blog", "name": "settings",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
......
...@@ -8,19 +8,27 @@ VueRouter.prototype.push = function push(location) { ...@@ -8,19 +8,27 @@ VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err) return originalPush.call(this, location).catch(err => err)
} }
function getRoutes({ name, id, routesData }) { // function getRoutes({ name, id, routesData }) {
const routes = [] // const routes = []
if (routesData && name && id) { // if (routesData && name && id) {
for (let i = 0, length = routesData.length; i < length; i += 1) { // for (let i = 0, length = routesData.length; i < length; i += 1) {
const element = routesData[i] // const element = routesData[i]
if (element && element.path && element.path.includes(name) && element.meta && element.meta.id && element.meta.id.startsWith(id)) { // if (element && element.path && element.path.includes(name) && element.meta && element.meta.id && element.meta.id.startsWith(id)) {
const path = element.path.slice(name.length + 1) // const path = element.path.slice(name.length + 1)
element.path = path // element.path = path
element.component = () => import('@/views' + path + '.vue') // element.component = () => import('@/views' + path + '.vue')
routes.push(element) // routes.push(element)
} // }
} // }
} // }
// return routes
// }
function getRoutes(routesData) {
return routesData.reduce((routes, route) => {
routes.push({ ...route, component: () => import('@/views' + route.path + '.vue') })
return routes return routes
}, [])
} }
export { VueRouter, routes, getRoutes } export { VueRouter, routes, getRoutes }
...@@ -18,7 +18,7 @@ const staticRoutes = Object.freeze([{ ...@@ -18,7 +18,7 @@ const staticRoutes = Object.freeze([{
}, },
{ {
name: 'BaseInfo', name: 'BaseInfo',
path: '/baseInfo', path: '/baseInfo/index',
component: resolve => require([`@/views/baseInfo/index.vue`], resolve), component: resolve => require([`@/views/baseInfo/index.vue`], resolve),
meta: {} meta: {}
}, },
...@@ -30,26 +30,26 @@ const staticRoutes = Object.freeze([{ ...@@ -30,26 +30,26 @@ const staticRoutes = Object.freeze([{
}, },
{ {
name: 'Account', name: 'Account',
path: '/account', path: '/account/index',
component: resolve => require([`@/views/account/index.vue`], resolve), component: resolve => require([`@/views/account/index.vue`], resolve),
meta: { meta: {
url: 'http://192.168.2.9:5501/html/merchant/index.html' url: 'http://192.168.1.68:5501/html/merchant/index.html'
} }
}, },
{ {
name: 'Employee', name: 'Employee',
path: '/employee', path: '/employee/index',
component: resolve => require([`@/views/employee/index.vue`], resolve), component: resolve => require([`@/views/employee/index.vue`], resolve),
meta: { meta: {
url: 'http://192.168.2.9:5501/html/employee/index.html' url: 'http://192.168.1.68:5501/html/employee/index.html'
} }
}, },
{ {
name: 'Role', name: 'Role',
path: '/role', path: '/role/index',
component: resolve => require([`@/views/role/index.vue`], resolve), component: resolve => require([`@/views/role/index.vue`], resolve),
meta: { meta: {
url: 'http://192.168.2.9:5501/html/role/index.html' url: 'http://192.168.1.68:5501/html/role/index.html'
} }
}, },
]) ])
......
...@@ -23,7 +23,8 @@ export async function bootstrap({ name, id, history, common, messenger, globalSt ...@@ -23,7 +23,8 @@ export async function bootstrap({ name, id, history, common, messenger, globalSt
Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] }) Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
const routesData = common.utils.deepClone(globalState.routers) const routesData = common.utils.deepClone(globalState.routers)
routes = getRoutes({ name, id, routesData }) // routes = getRoutes({ name, id, routesData })
routes = getRoutes(routesData)
subscribe({ messenger }) subscribe({ messenger })
} }
export async function mount(props) { export async function mount(props) {
......
<template> <template>
<div> <div>
<GLExternal :url="url" :subscribe="subscribe"></GLExternal> <GLExternal v-if="url" :url="url" :subscribe="subscribe"></GLExternal>
</div> </div>
</template> </template>
<script> <script>
const params = {
merchantAccountLevel: 1,
merchantId: 81,
model: 2
}
export default { export default {
name: 'adapter', name: 'account',
data() { data() {
return { return {
url: this.$router.currentRoute.meta.url // url: `${this.$router.currentRoute.meta.url}?merchantAccountLevel=${merchantAccountLevel}&merchantId=${merchantId}`
url: ''
} }
}, },
mounted() {
console.log(this.$common)
this.url = this.$router.currentRoute.meta.url + '?' + this.$common.utils.genUrlParams(params)
},
methods: { methods: {
subscribe(child) { subscribe(child) {
child.on('route-to', params => { child.on('route-to', params => {
this.$history.push(params) console.log(params, '-----------------------')
this.$history.push(params.path)
}) })
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!