Commit 57f027b0 by 姜雷

点击反馈跳转到反馈页面携带区域参数

parent 26c949dd
......@@ -2,6 +2,7 @@ VUE_APP_BASE_URL=/
VUE_APP_CUSTOMER_MENU_CODE=0001
VUE_APP_BASE_MENU_CODE=0002
VUE_APP_SYSTEM_MENU_CODE=0003
VUE_APP_FEEDBACK_MENU_CODE=0018
VUE_APP_STATISTICS_MENU_CODE=0044
VUE_APP_DEVICE_MENU_CODE=0048
VUE_APP_DASHBOARD_CODE=0079
......
......@@ -62,9 +62,10 @@
import UserBox from './containers/layout/components/UserBox';
import IconMenus from './containers/layout/IconMenu/IconMenu';
import CollectMenu from './containers/layout/Collect/Collect';
import { mapGetters } from 'vuex';
import { mapGetters, mapActions } from 'vuex';
import { getStorageData, setStorageData } from '@/utils/auth';
import { STSTEM_STATE_KEY } from '@/config';
import { getMenuDataByCode } from '@/utils/route';
export default {
name: 'App',
......@@ -105,6 +106,9 @@ export default {
this.title = document.title;
},
watch: {
route(newVal) {
this.getFeedbackPage();
},
$route(newVal) {
this.routerDone = false;
if (newVal.meta && newVal.meta.store) {
......@@ -115,6 +119,7 @@ export default {
},
},
methods: {
...mapActions(['updateFeedbackPage']),
showComponents(store) {
this.isInnerPage =
this.whiteList.indexOf(this.$route.path) !== -1 ? false : true;
......@@ -169,6 +174,13 @@ export default {
};
}
},
getFeedbackPage() {
let feedbackCode = process.env.VUE_APP_FEEDBACK_MENU_CODE;
let menu = getMenuDataByCode(this.route, feedbackCode);
if (menu) {
this.updateFeedbackPage(menu.name);
}
},
},
};
</script>
......
......@@ -23,6 +23,7 @@
<span class="CustomerFeedback-ItemNum">{{item.count}}</span>
<span
class="CustomerFeedback-ItemName"
@click="() => clickHandle(item)"
:title="item.areaName"
>{{item.areaName}}</span>
</div>
......@@ -37,6 +38,7 @@ export default {
name: 'CustomerFeedback',
computed: {
...mapGetters('Dashboard/customerFeedback', ['feedbackList', 'count']),
...mapGetters(['feedbackPage']),
},
data() {
return {
......@@ -58,6 +60,14 @@ export default {
initData() {
this.getFeedbackList();
},
clickHandle(data) {
const { areaId } = data;
if (this.feedbackPage) {
this.$router.push({ name: this.feedbackPage, params: { areaId } });
} else {
this.$message.error('无会员反馈页面权限');
}
},
},
};
</script>
......@@ -109,8 +119,8 @@ export default {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
}
}
}
@media screen and (max-width: $bigScreenWidth) {
......
......@@ -6,7 +6,7 @@
<script>
import CollectMixin from '@/mixins/collect/collect.js';
import { getCollectMenu } from '@/utils/route';
import { getMenuDataById } from '@/utils/route';
export default {
name: 'Collect',
......@@ -27,7 +27,7 @@ export default {
) {
let list = this.collectList.map(item => {
let name = item.menuId.toString();
return getCollectMenu(this.routers, name);
return getMenuDataById(this.routers, name);
});
list = list.filter(item => !!item);
return list;
......
......@@ -139,7 +139,7 @@
<script>
import MenuItem from './components/MenuItem';
import { mapGetters } from 'vuex';
import { formatRouteLink, getFilterMenu, getCollectMenu } from '@/utils/route';
import { formatRouteLink, getMenuDataById } from '@/utils/route';
export default {
name: 'IconMenus',
......@@ -229,7 +229,7 @@ export default {
let routers = formatRouteLink(this.routers);
let list = val.map(item => {
let name = item.menuId.toString();
return getCollectMenu(routers, name);
return getMenuDataById(routers, name);
});
list = list.filter(item => !!item);
this.collectRouteList = list && list.length ? list : [];
......
......@@ -3,18 +3,21 @@ 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';
const UPDATE_FEEDBACK_PAGE = 'UPDATE_FEEDBACK_PAGE';
let fetchCount = 0;
const state = () => ({
loading: false,
whiteList: [],
dashboardBackPage: undefined,
feedbackPage: undefined,
});
const getters = {
loading: state => state.loading,
whiteList: state => state.whiteList,
dashboardBackPage: state => state.dashboardBackPage,
feedbackPage: state => state.feedbackPage,
};
const actions = {
......@@ -30,6 +33,9 @@ const actions = {
updateBackPage({ commit }, name) {
commit(UPDATE_BACK_PAGE, name);
},
updateFeedbackPage({ commit }, name) {
commit(UPDATE_FEEDBACK_PAGE, name);
},
};
const mutations = {
[FETCH_START](state, notLoading) {
......@@ -52,6 +58,9 @@ const mutations = {
[UPDATE_BACK_PAGE](state, name) {
state.dashboardBackPage = name;
},
[UPDATE_FEEDBACK_PAGE](state, name) {
state.feedbackPage = name;
},
};
export default {
modules: {
......
......@@ -11,6 +11,7 @@ export const formatRouteLink = (addRoute, path = '/') => {
return {
path: path + route.menuLink,
name: route.id.toString(),
menuCode: route.menuCode,
meta: { title: route.menuName, icon: route.menuPicSmall },
};
}
......@@ -40,6 +41,7 @@ export const getAuthRoute = (asyncRouterMap, addRoute, path = '/') => {
path: path + route.menuLink,
component: localcomponent.component,
name: route.id,
menuCode: route.menuCode,
meta: {
...localcomponent.meta,
title: route.menuName,
......@@ -68,12 +70,12 @@ export const getAuthRoute = (asyncRouterMap, addRoute, path = '/') => {
});
};
export const getCollectMenu = (routeList, name) => {
export const getMenuDataById = (routeList, name) => {
let menuData = null;
for (let index = 0; index < routeList.length; index++) {
const element = routeList[index];
if (element.children && element.children.length) {
menuData = getCollectMenu(element.children, name);
menuData = getMenuDataById(element.children, name);
if (menuData) break;
} else if (element.name === name) {
menuData = element;
......@@ -83,14 +85,14 @@ export const getCollectMenu = (routeList, name) => {
return menuData;
};
export const getFilterMenu = (allRouterMap, id) => {
export const getMenuDataByCode = (allRouterMap, code) => {
let menuData = null;
for (let index = 0; index < allRouterMap.length; index++) {
const element = allRouterMap[index];
if (element.childs && element.childs.length) {
menuData = getFilterMenu(element.childs, id);
if (element.children && element.children.length) {
menuData = getMenuDataByCode(element.children, code);
if (menuData) break;
} else if (element.id === id) {
} else if (element.menuCode === code) {
menuData = element;
break;
}
......
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