Commit 48e7d15c by 姜雷

Merge branch 'develop' into 'test'

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