Commit 57f027b0 by 姜雷

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

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