Commit 48e7d15c by 姜雷

Merge branch 'develop' into 'test'

修改切换数据首页逻辑 See merge request !82
parents ab67dc8c 759971c4
...@@ -34,6 +34,11 @@ export default { ...@@ -34,6 +34,11 @@ export default {
CampusRank, CampusRank,
EquipmentList, EquipmentList,
}, },
beforeRouteEnter(to, from, next) {
next(vm => {
vm.updateBackPage(from.name);
});
},
created() { created() {
this.initData(); this.initData();
}, },
...@@ -43,6 +48,7 @@ export default { ...@@ -43,6 +48,7 @@ export default {
'fetchConsumeList', 'fetchConsumeList',
'fetchTitleList', 'fetchTitleList',
]), ]),
...mapActions(['updateBackPage']),
initData() { initData() {
this.fetchReportList(); this.fetchReportList();
this.fetchConsumeList(); this.fetchConsumeList();
......
...@@ -166,7 +166,7 @@ export default { ...@@ -166,7 +166,7 @@ export default {
}, },
computed: { computed: {
...mapGetters('Dashboard', ['titleData']), ...mapGetters('Dashboard', ['titleData']),
...mapGetters(['collectList']), ...mapGetters(['collectList', 'dashboardBackPage']),
customerManage() { customerManage() {
let item = this.routers.find( let item = this.routers.find(
menu => menu.menuCode === process.env.VUE_APP_CUSTOMER_MENU_CODE menu => menu.menuCode === process.env.VUE_APP_CUSTOMER_MENU_CODE
...@@ -236,7 +236,11 @@ export default { ...@@ -236,7 +236,11 @@ export default {
}, },
clickHandle() { clickHandle() {
if (this.dashboardVisiable) { if (this.dashboardVisiable) {
this.$router.go(-1); if (this.dashboardBackPage) {
this.$router.push({ name: this.dashboardBackPage });
} else {
this.$router.push({ path: '/' });
}
} else { } else {
this.$router.push({ this.$router.push({
path: '/dashboard', path: '/dashboard',
......
...@@ -154,10 +154,7 @@ export default { ...@@ -154,10 +154,7 @@ export default {
) && ) &&
this.$router.options.base === '/' this.$router.options.base === '/'
) { ) {
this.$router.push({ path: '/' });
setTimeout(() => {
this.$router.push({ name: 'dashboard' }); this.$router.push({ name: 'dashboard' });
}, 400);
} else { } else {
this.$router.push({ path: '/' }); this.$router.push({ path: '/' });
} }
......
...@@ -2,16 +2,19 @@ import sidebar from './sidebar'; ...@@ -2,16 +2,19 @@ import sidebar from './sidebar';
import collect from './collect'; import collect from './collect';
import { FETCH_START, FETCH_DONE } from './mutation-types'; import { FETCH_START, FETCH_DONE } from './mutation-types';
const GET_WHITE_LIST = 'GET_WHITE_LIST'; const GET_WHITE_LIST = 'GET_WHITE_LIST';
const UPDATE_BACK_PAGE = 'UPDATE_BACK_PAGE';
let fetchCount = 0; let fetchCount = 0;
const state = () => ({ const state = () => ({
loading: false, loading: false,
whiteList: [], whiteList: [],
dashboardBackPage: undefined,
}); });
const getters = { const getters = {
loading: state => state.loading, loading: state => state.loading,
whiteList: state => state.whiteList, whiteList: state => state.whiteList,
dashboardBackPage: state => state.dashboardBackPage,
}; };
const actions = { const actions = {
...@@ -24,6 +27,9 @@ const actions = { ...@@ -24,6 +27,9 @@ const actions = {
getWhiteList({ commit }, list) { getWhiteList({ commit }, list) {
commit(GET_WHITE_LIST, list); commit(GET_WHITE_LIST, list);
}, },
updateBackPage({ commit }, name) {
commit(UPDATE_BACK_PAGE, name);
},
}; };
const mutations = { const mutations = {
[FETCH_START](state, notLoading) { [FETCH_START](state, notLoading) {
...@@ -43,6 +49,9 @@ const mutations = { ...@@ -43,6 +49,9 @@ const mutations = {
[GET_WHITE_LIST](state, list) { [GET_WHITE_LIST](state, list) {
state.whiteList = [...state.whiteList, ...list]; state.whiteList = [...state.whiteList, ...list];
}, },
[UPDATE_BACK_PAGE](state, name) {
state.dashboardBackPage = name;
},
}; };
export default { export default {
modules: { modules: {
......
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