Commit 8b77b308 by YoMon

1

parent 844b0d17
......@@ -48,16 +48,16 @@ export default {
},
computed: {
visitedViews() {
// return this.$store.state.systemTags.sVisitedViews
if (this.tabNow === 0) {
return this.$store.state.systemTags.sVisitedViews
} else if (this.tabNow === 1) {
return this.$store.state.goodsTags.gVisitedViews
} else if (this.tabNow === 2) {
return this.$store.state.orderTags.oVisitedViews
} else {
return this.$store.state.financalTags.fVisitedViews
}
return this.$store.state.systemTags.sVisitedViews
// if (this.tabNow === 0) {
// return this.$store.state.systemTags.sVisitedViews
// } else if (this.tabNow === 1) {
// return this.$store.state.goodsTags.gVisitedViews
// } else if (this.tabNow === 2) {
// return this.$store.state.orderTags.oVisitedViews
// } else {
// return this.$store.state.financalTags.fVisitedViews
// }
}
},
watch: {
......@@ -77,16 +77,16 @@ export default {
if (!route) {
return false
}
// this.$store.dispatch('sAddVisitedViews', route)
if (this.tabNow === 0) {
this.$store.dispatch('sAddVisitedViews', route)
} else if (this.tabNow === 1) {
this.$store.dispatch('gAddVisitedViews', route)
} else if (this.tabNow === 2) {
this.$store.dispatch('oAddVisitedViews', route)
} else {
this.$store.dispatch('fAddVisitedViews', route)
}
this.$store.dispatch('sAddVisitedViews', route)
// if (this.tabNow === 0) {
// this.$store.dispatch('sAddVisitedViews', route)
// } else if (this.tabNow === 1) {
// this.$store.dispatch('gAddVisitedViews', route)
// } else if (this.tabNow === 2) {
// this.$store.dispatch('oAddVisitedViews', route)
// } else {
// this.$store.dispatch('fAddVisitedViews', route)
// }
},
// 获取列表数据
getOrderCtg() {
......
const getters = {
sVisitedViews: state => state.systemTags.sVisitedViews,
sCachedViews: state => state.systemTags.sCachedViews,
gVisitedViews: state => state.goodsTags.gVisitedViews,
gCachedViews: state => state.goodsTags.gCachedViews,
oVisitedViews: state => state.goodsTags.oVisitedViews,
oCachedViews: state => state.goodsTags.oCachedViews,
fVisitedViews: state => state.financalTags.fVisitedViews,
fCachedViews: state => state.financalTags.fCachedViews
sCachedViews: state => state.systemTags.sCachedViews
}
export default getters
......@@ -2,9 +2,9 @@ import Vue from 'vue'
import Vuex from 'vuex'
import systemTags from './modules/system-tags'
import usrAuth from './modules/usr-auth'
import goodsTags from './modules/goods-tags'
import orderTags from './modules/order-manage-tags'
import financalTags from './modules/financal-tags'
// import goodsTags from './modules/goods-tags'
// import orderTags from './modules/order-manage-tags'
// import financalTags from './modules/financal-tags'
import getters from './getters'
Vue.use(Vuex)
......@@ -14,10 +14,7 @@ const store = () => {
return new Vuex.Store({
modules: {
usrAuth,
systemTags,
goodsTags,
orderTags,
financalTags
systemTags
},
getters
})
......
const financalTags = {
state: {
fVisitedViews: [],
fCachedViews: []
},
mutations: {
F_ADD_VISITED_VIEWS: (state, view) => {
if (state.fVisitedViews.some(v => v.path === view.path)) return
if (view.path === '/') return
state.fVisitedViews.push(
Object.assign({}, view, {
title: view.meta.title || 'no-name'
})
)
if (!view.meta.noCache) {
state.fCachedViews.push(view.name)
}
},
F_DEL_VISITED_VIEWS: (state, view) => {
for (const [i, v] of state.fVisitedViews.entries()) {
if (v.path === view.path) {
state.fVisitedViews.splice(i, 1)
break
}
}
for (const i of state.fCachedViews) {
if (i === view.name) {
const index = state.fCachedViews.indexOf(i)
state.fCachedViews.splice(index, 1)
break
}
}
},
F_DEL_OTHERS_VIEWS: (state, view) => {
for (const [i, v] of state.fVisitedViews.entries()) {
if (v.path === view.path) {
state.fVisitedViews = state.fVisitedViews.slice(i, i + 1)
break
}
}
for (const i of state.fCachedViews) {
if (i === view.name) {
const index = state.fCachedViews.indexOf(i)
state.fCachedViews = state.fCachedViews.slice(index, index + 1)
break
}
}
},
F_DEL_ALL_VIEWS: state => {
state.sVisitedViews = []
state.fCachedViews = []
}
},
actions: {
fAddVisitedViews({ commit }, view) {
commit('F_ADD_VISITED_VIEWS', view)
},
fDelVisitedViews({ commit, state }, view) {
return new Promise(resolve => {
commit('F_DEL_VISITED_VIEWS', view)
resolve([...state.fVisitedViews])
})
},
fDelOthersViews({ commit, state }, view) {
return new Promise(resolve => {
commit('F_DEL_OTHERS_VIEWS', view)
resolve([...state.fVisitedViews])
})
},
fDelAllViews({ commit, state }) {
return new Promise(resolve => {
commit('F_DEL_ALL_VIEWS')
resolve([...state.fVisitedViews])
})
}
}
}
export default financalTags
const goodsTags = {
state: {
gVisitedViews: [],
gCachedViews: []
},
mutations: {
G_ADD_VISITED_VIEWS: (state, view) => {
if (state.gVisitedViews.some(v => v.path === view.path)) return
if (view.path === '/') return
state.gVisitedViews.push(
Object.assign({}, view, {
title: view.meta.title || 'no-name'
})
)
if (!view.meta.noCache) {
state.gCachedViews.push(view.name)
}
},
G_DEL_VISITED_VIEWS: (state, view) => {
for (const [i, v] of state.gVisitedViews.entries()) {
if (v.path === view.path) {
state.gVisitedViews.splice(i, 1)
break
}
}
for (const i of state.gCachedViews) {
if (i === view.name) {
const index = state.gCachedViews.indexOf(i)
state.gCachedViews.splice(index, 1)
break
}
}
},
G_DEL_OTHERS_VIEWS: (state, view) => {
for (const [i, v] of state.gVisitedViews.entries()) {
if (v.path === view.path) {
state.gVisitedViews = state.gVisitedViews.slice(i, i + 1)
break
}
}
for (const i of state.gCachedViews) {
if (i === view.name) {
const index = state.gCachedViews.indexOf(i)
state.gCachedViews = state.gCachedViews.slice(index, index + 1)
break
}
}
},
G_DEL_ALL_VIEWS: state => {
state.gVisitedViews = []
state.gCachedViews = []
}
},
actions: {
gaddVisitedViews({ commit }, view) {
commit('G_ADD_VISITED_VIEWS', view)
},
gdelVisitedViews({ commit, state }, view) {
return new Promise(resolve => {
commit('G_DEL_VISITED_VIEWS', view)
resolve([...state.gVisitedViews])
})
},
gdelOthersViews({ commit, state }, view) {
return new Promise(resolve => {
commit('G_DEL_OTHERS_VIEWS', view)
resolve([...state.gVisitedViews])
})
},
gdelAllViews({ commit, state }) {
return new Promise(resolve => {
commit('G_DEL_ALL_VIEWS')
resolve([...state.gVisitedViews])
})
}
}
}
export default goodsTags
const orderTags = {
state: {
oVisitedViews: [],
oCachedViews: []
},
mutations: {
O_ADD_VISITED_VIEWS: (state, view) => {
if (state.oVisitedViews.some(v => v.path === view.path)) return
if (view.path === '/') return
state.oVisitedViews.push(
Object.assign({}, view, {
title: view.meta.title || 'no-name'
})
)
if (!view.meta.noCache) {
state.oCachedViews.push(view.name)
}
},
O_DEL_VISITED_VIEWS: (state, view) => {
for (const [i, v] of state.oVisitedViews.entries()) {
if (v.path === view.path) {
state.oVisitedViews.splice(i, 1)
break
}
}
for (const i of state.oCachedViews) {
if (i === view.name) {
const index = state.oCachedViews.indexOf(i)
state.oCachedViews.splice(index, 1)
break
}
}
},
O_DEL_OTHERS_VIEWS: (state, view) => {
for (const [i, v] of state.oVisitedViews.entries()) {
if (v.path === view.path) {
state.oVisitedViews = state.oVisitedViews.slice(i, i + 1)
break
}
}
for (const i of state.oCachedViews) {
if (i === view.name) {
const index = state.oCachedViews.indexOf(i)
state.oCachedViews = state.oCachedViews.slice(index, index + 1)
break
}
}
},
O_DEL_ALL_VIEWS: state => {
state.oVisitedViews = []
state.oCachedViews = []
}
},
actions: {
oAddVisitedViews({ commit }, view) {
commit('O_ADD_VISITED_VIEWS', view)
},
oDelVisitedViews({ commit, state }, view) {
return new Promise(resolve => {
commit('O_DEL_VISITED_VIEWS', view)
resolve([...state.visitedViews])
})
},
oDelOthersViews({ commit, state }, view) {
return new Promise(resolve => {
commit('O_DEL_OTHERS_VIEWS', view)
resolve([...state.oVisitedViews])
})
},
oDelAllViews({ commit, state }) {
return new Promise(resolve => {
commit('O_DEL_ALL_VIEWS')
resolve([...state.oVisitedViews])
})
}
}
}
export default orderTags
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment