no message

Former-commit-id: fecd15de69d56381101476f4661390022320797b [formerly fecd15de69d56381101476f4661390022320797b [formerly fecd15de69d56381101476f4661390022320797b [formerly fecd15de69d56381101476f4661390022320797b [formerly ef319f6d08860c3e1496d77bf196a26e26834e1b [formerly 2b63a8f4aadb093749af078c0f0585894a4a8905]]]]]
Former-commit-id: 7ac89b5fbc75e657572856a53f7ec44f690051af
Former-commit-id: f2c7e3a59fed3ff686ec8570af3f487c4e69dd3a
Former-commit-id: 27b28805c5f32ffd40c825cf8afa9944b41367a3 [formerly 454932a2cac3059d4794516613533670d8a11de4]
Former-commit-id: 5e825ae2b734cd4e098a9614ac4ac307e43eedbd
Former-commit-id: 5aff1e6b7cfb8de0c38759f699418b73ea726b2e
Former-commit-id: 707a7a3cb50856c8eb6216664970c3d1e0b720b7
Former-commit-id: d4db2890074f6a3df7c580644413b0f6ca472750
Former-commit-id: 434daeea46dc29638a4f60e07974adc28be86cff
This commit is contained in:
liyang
2018-06-30 16:45:06 +08:00
parent ef56828ccf
commit 6ec19d0994
3 changed files with 52 additions and 18 deletions

View File

@@ -48,7 +48,6 @@ util.exitFullScreen = function () {
* @param {object} query query object
*/
util.openNewPage = function (vm, name, argu, query) {
console.log('vm.$store', vm.$store)
// 已经打开的页面
let pageOpenedList = vm.$store.state.d2admin.pageOpenedList
// 判断此页面是否已经打开 并且记录位置
@@ -59,22 +58,34 @@ util.openNewPage = function (vm, name, argu, query) {
return same
})
if (pageOpend) {
// 页面以前打开过
console.group('page opend')
console.log('pageOpendIndex: ', pageOpendIndex)
console.groupEnd()
// 虽然页面以前打开过
// 但是新的页面可能 name 一样,参数不一样
// 页面以前打开过 但是新的页面可能 name 一样,参数不一样
vm.$store.commit('d2adminpageOpenedListUpdateItem', {
index: pageOpendIndex,
argu: argu,
query: query
argu,
query
})
} else {
// 页面以前没有打开过
console.group('page not opend')
console.log('pageOpendIndex: ', pageOpendIndex)
console.groupEnd()
const tagPool = vm.$store.state.d2admin.tagPool
let tag = tagPool.find(t => t.name === name)
if (tag) {
vm.$store.commit('d2adminTagIncreate', {
tag, argu, query
})
}
}
}
/**
* 判断是否在其内
* @param {*} ele element
* @param {array} targetArr array
*/
util.oneOf = function (ele, targetArr) {
if (targetArr.indexOf(ele) >= 0) {
return true
} else {
return false
}
}

View File

@@ -92,19 +92,18 @@ new Vue({
* 处理路由 得到每一级的路由设置
*/
getAllTagFromRoutes () {
console.log('routes', frameInRoutes)
const tags = []
const tagPool = []
const push = function (routes) {
routes.forEach(route => {
if (route.children) {
push(route.children)
} else {
tags.push(route)
tagPool.push(route)
}
})
}
push(frameInRoutes)
console.log('tags', tags)
this.$store.commit('d2admintagPoolSet', tagPool)
}
}
})

View File

@@ -11,13 +11,15 @@ export default {
// 主题
themeList,
themeActive: themeList[1],
// 多页
// 当前显示的多页面列表
pageOpenedList: [
{
name: 'index',
title: '首页'
}
]
],
// 可以在多页 tab 模式下显示的页面
tagPool: []
},
mutations: {
/**
@@ -48,6 +50,28 @@ export default {
}).write()
}
},
/**
* 保存 tagPool (候选池)
* @param {state} state vuex state
* @param {Array} tagPool tags
*/
d2admintagPoolSet (state, tagPool) {
state.tagPool = tagPool
},
/**
* 新增一个 tag
* @param {state} state vuex state
* @param {object} param1 new tag info
*/
d2adminTagIncreate (state, { tag, argu, query }) {
// if (!Util.oneOf(tagObj.name, state.dontCache)) {
// state.cachePage.push(tagObj.name);
// localStorage.cachePage = JSON.stringify(state.cachePage);
// }
// state.pageOpenedList.push(tagObj);
// localStorage.pageOpenedList = JSON.stringify(state.pageOpenedList);
console.log('d2adminTagIncreate')
},
/**
* 切换全屏
* @param {state} state vuex state