Commit b18e2558 by 姜雷

Merge branch 'test' into 'master'

Test See merge request !96
parents bc45c9a8 41873271
......@@ -2,11 +2,13 @@ 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
VUE_APP_CUSTOMER_OPERATE_CODE=0077
VUE_APP_SMAPRO_CODE=0069
VUE_APP_DASHBOARD_CODE=0079
VUE_APP_REGISTER_DASHBOARD_CODE=0083
VUE_APP_WHITE_LIST=/login,/404,/401
VUE_APP_SUBSYSTEM=http://ex-dev-dcxy-static.168cad.top
VUE_APP_SYSTEM_SERVER_URL=http://ex-dev-dcxy-system-manage.168cad.top
......
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
plugins: [require('autoprefixer')],
};
......@@ -5,11 +5,11 @@
:title="title"
>
<div
class="com-logo"
class="complate-logo"
slot="logo"
>
<img
src="@/assets/images/pic_logo.png"
src="@/assets/images/pic_logo@2x.png"
alt="logo"
>
</div>
......@@ -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,11 +174,19 @@ 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>
<style lang="scss">
@import '@/assets/styles/variables.scss';
.AppTopBar {
flex: 1;
display: flex;
......@@ -185,4 +198,21 @@ export default {
.left-box {
transition: all 0.48s;
}
.topTitle {
.complate-logo {
width: 319px;
height: 80px;
}
.com-title {
display: none;
}
}
@media screen and (max-width: $bigScreenWidth) {
.topTitle {
.complate-logo {
width: 160px;
height: 40px;
}
}
}
</style>
......@@ -19,7 +19,8 @@ let logout = false;
// request拦截器
service.interceptors.request.use(
conf => {
store.dispatch('fetchStart');
const { notLoading } = conf;
store.dispatch('fetchStart', notLoading);
if (store.getters.token) {
conf.headers = {
...conf.headers,
......@@ -51,7 +52,8 @@ service.interceptors.response.use(response => {
* code为非'0'是抛错
*/
setTimeout(() => {
store.dispatch('fetchDone');
const { notLoading } = response.config;
store.dispatch('fetchDone', notLoading);
}, 500);
if (res.code !== SUCCESS_CODE) {
if (
......
import { isCancel } from 'axios';
import { Message, MessageBox } from 'element-ui';
import store from '../store';
......@@ -37,10 +38,14 @@ export const errorHandle = error => {
});
return Promise.reject({ error, msg: '请求超时!' });
}
if (isCancel(error)) {
console.log('取消请求');
} else {
Message({
message: error.message,
type: 'error',
duration: 5 * 1000,
});
}
return Promise.reject(error);
};
......@@ -54,6 +54,7 @@
<script>
import { Dialog } from 'element-ui';
import Popup from '../Popup';
export default {
name: 'user-dialog-inner',
......@@ -65,6 +66,7 @@ export default {
default: false,
},
},
mixins: [Popup],
// mounted() {
// let dialogWidth = 0;
// console.log(this.$refs.userContent.$el.offsetWidth);
......
import Vue from 'vue';
import merge from 'element-ui/src/utils/merge';
import PopupManager from './popup-manager';
import getScrollBarWidth from 'element-ui/src/utils/scrollbar-width';
import { getStyle, addClass, removeClass, hasClass } from 'element-ui/src/utils/dom';
let idSeed = 1;
let scrollBarWidth;
const getDOM = function(dom) {
if (dom.nodeType === 3) {
dom = dom.nextElementSibling || dom.nextSibling;
getDOM(dom);
}
return dom;
};
export default {
props: {
visible: {
type: Boolean,
default: false
},
openDelay: {},
closeDelay: {},
zIndex: {},
modal: {
type: Boolean,
default: false
},
modalFade: {
type: Boolean,
default: true
},
modalClass: {},
modalAppendToBody: {
type: Boolean,
default: false
},
lockScroll: {
type: Boolean,
default: true
},
closeOnPressEscape: {
type: Boolean,
default: false
},
closeOnClickModal: {
type: Boolean,
default: false
}
},
beforeMount() {
this._popupId = 'popup-' + idSeed++;
PopupManager.register(this._popupId, this);
},
beforeDestroy() {
PopupManager.deregister(this._popupId);
PopupManager.closeModal(this._popupId);
this.restoreBodyStyle();
},
data() {
return {
opened: false,
bodyPaddingRight: null,
computedBodyPaddingRight: 0,
withoutHiddenClass: true,
rendered: false
};
},
watch: {
visible(val) {
if (val) {
if (this._opening) return;
if (!this.rendered) {
this.rendered = true;
Vue.nextTick(() => {
this.open();
});
} else {
this.open();
}
} else {
this.close();
}
}
},
methods: {
open(options) {
if (!this.rendered) {
this.rendered = true;
}
const props = merge({}, this.$props || this, options);
if (this._closeTimer) {
clearTimeout(this._closeTimer);
this._closeTimer = null;
}
clearTimeout(this._openTimer);
const openDelay = Number(props.openDelay);
if (openDelay > 0) {
this._openTimer = setTimeout(() => {
this._openTimer = null;
this.doOpen(props);
}, openDelay);
} else {
this.doOpen(props);
}
},
doOpen(props) {
if (this.$isServer) return;
if (this.willOpen && !this.willOpen()) return;
if (this.opened) return;
this._opening = true;
const dom = getDOM(this.$el);
const modal = props.modal;
const zIndex = props.zIndex;
if (zIndex) {
PopupManager.zIndex = zIndex;
}
if (modal) {
if (this._closing) {
PopupManager.closeModal(this._popupId);
this._closing = false;
}
PopupManager.openModal(this._popupId, PopupManager.nextZIndex(), this.modalAppendToBody ? undefined : dom, props.modalClass, props.modalFade);
if (props.lockScroll) {
this.withoutHiddenClass = !hasClass(document.body, 'el-popup-parent--hidden');
if (this.withoutHiddenClass) {
this.bodyPaddingRight = document.body.style.paddingRight;
this.computedBodyPaddingRight = parseInt(getStyle(document.body, 'paddingRight'), 10);
}
scrollBarWidth = getScrollBarWidth();
let bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
let bodyOverflowY = getStyle(document.body, 'overflowY');
if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === 'scroll') && this.withoutHiddenClass) {
document.body.style.paddingRight = this.computedBodyPaddingRight + scrollBarWidth + 'px';
}
addClass(document.body, 'el-popup-parent--hidden');
}
}
if (getComputedStyle(dom).position === 'static') {
dom.style.position = 'absolute';
}
dom.style.zIndex = PopupManager.nextZIndex();
this.opened = true;
this.onOpen && this.onOpen();
this.doAfterOpen();
},
doAfterOpen() {
this._opening = false;
},
close() {
if (this.willClose && !this.willClose()) return;
if (this._openTimer !== null) {
clearTimeout(this._openTimer);
this._openTimer = null;
}
clearTimeout(this._closeTimer);
const closeDelay = Number(this.closeDelay);
if (closeDelay > 0) {
this._closeTimer = setTimeout(() => {
this._closeTimer = null;
this.doClose();
}, closeDelay);
} else {
this.doClose();
}
},
doClose() {
this._closing = true;
this.onClose && this.onClose();
if (this.lockScroll) {
setTimeout(this.restoreBodyStyle, 200);
}
this.opened = false;
this.doAfterClose();
},
doAfterClose() {
PopupManager.closeModal(this._popupId);
this._closing = false;
},
restoreBodyStyle() {
if (this.modal && this.withoutHiddenClass) {
document.body.style.paddingRight = this.bodyPaddingRight;
removeClass(document.body, 'el-popup-parent--hidden');
}
this.withoutHiddenClass = true;
}
}
};
export {
PopupManager
};
import Vue from 'vue';
import { addClass, removeClass } from 'element-ui/src/utils/dom';
let hasModal = false;
let hasInitZIndex = false;
let zIndex = 1010;
const getModal = function() {
if (Vue.prototype.$isServer) return;
let modalDom = PopupManager.modalDom;
if (modalDom) {
hasModal = true;
} else {
hasModal = false;
modalDom = document.createElement('div');
PopupManager.modalDom = modalDom;
modalDom.addEventListener('touchmove', function(event) {
event.preventDefault();
event.stopPropagation();
});
modalDom.addEventListener('click', function() {
PopupManager.doOnModalClick && PopupManager.doOnModalClick();
});
}
return modalDom;
};
const instances = {};
const PopupManager = {
modalFade: true,
getInstance: function(id) {
return instances[id];
},
register: function(id, instance) {
if (id && instance) {
instances[id] = instance;
}
},
deregister: function(id) {
if (id) {
instances[id] = null;
delete instances[id];
}
},
nextZIndex: function() {
return PopupManager.zIndex++;
},
modalStack: [],
doOnModalClick: function() {
const topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
if (!topItem) return;
const instance = PopupManager.getInstance(topItem.id);
if (instance && instance.closeOnClickModal) {
instance.close();
}
},
openModal: function(id, zIndex, dom, modalClass, modalFade) {
if (Vue.prototype.$isServer) return;
if (!id || zIndex === undefined) return;
this.modalFade = modalFade;
const modalStack = this.modalStack;
for (let i = 0, j = modalStack.length; i < j; i++) {
const item = modalStack[i];
if (item.id === id) {
return;
}
}
const modalDom = getModal();
addClass(modalDom, 'v-modal');
if (this.modalFade && !hasModal) {
addClass(modalDom, 'v-modal-enter');
}
if (modalClass) {
let classArr = modalClass.trim().split(/\s+/);
classArr.forEach(item => addClass(modalDom, item));
}
setTimeout(() => {
removeClass(modalDom, 'v-modal-enter');
}, 200);
if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
dom.parentNode.appendChild(modalDom);
} else {
document.body.appendChild(modalDom);
}
if (zIndex) {
modalDom.style.zIndex = zIndex;
}
modalDom.tabIndex = 0;
modalDom.style.display = '';
this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
},
closeModal: function(id) {
const modalStack = this.modalStack;
const modalDom = getModal();
if (modalStack.length > 0) {
const topItem = modalStack[modalStack.length - 1];
if (topItem.id === id) {
if (topItem.modalClass) {
let classArr = topItem.modalClass.trim().split(/\s+/);
classArr.forEach(item => removeClass(modalDom, item));
}
modalStack.pop();
if (modalStack.length > 0) {
modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
}
} else {
for (let i = modalStack.length - 1; i >= 0; i--) {
if (modalStack[i].id === id) {
modalStack.splice(i, 1);
break;
}
}
}
}
if (modalStack.length === 0) {
if (this.modalFade) {
addClass(modalDom, 'v-modal-leave');
}
setTimeout(() => {
if (modalStack.length === 0) {
if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
modalDom.style.display = 'none';
PopupManager.modalDom = undefined;
}
removeClass(modalDom, 'v-modal-leave');
}, 200);
}
},
};
Object.defineProperty(PopupManager, 'zIndex', {
configurable: true,
get() {
if (!hasInitZIndex) {
zIndex = zIndex;
hasInitZIndex = true;
}
return zIndex;
},
set(value) {
zIndex = value;
},
});
const getTopPopup = function() {
if (Vue.prototype.$isServer) return;
if (PopupManager.modalStack.length > 0) {
const topPopup =
PopupManager.modalStack[PopupManager.modalStack.length - 1];
if (!topPopup) return;
const instance = PopupManager.getInstance(topPopup.id);
return instance;
}
};
if (!Vue.prototype.$isServer) {
// handle `esc` key when the popup is shown
window.addEventListener('keydown', function(event) {
if (event.keyCode === 27) {
const topPopup = getTopPopup();
if (topPopup && topPopup.closeOnPressEscape) {
topPopup.handleClose
? topPopup.handleClose()
: topPopup.handleAction
? topPopup.handleAction('cancel')
: topPopup.close();
}
}
});
}
export default PopupManager;
......@@ -37,24 +37,34 @@ export default {
default: true,
},
},
data() {
return {
selectedAll: false,
};
},
mixins: [areaMixin],
methods: {
changeHandle(val) {
if (val) {
if (val && val.length && val.indexOf(-1) > -1) {
if (val.length === this.dashboardArea.length + 1) {
if (val.length === this.dashboardArea.length) {
this.selectedAll = false;
this.$emit('input', val.filter(id => id !== -1));
} else {
this.selectedAll = true;
this.$emit('input', [
...this.dashboardArea.map(item => item.id),
-1,
]);
}
} else {
if (this.selectedAll) {
this.selectedAll = false;
this.$emit('input', []);
return;
} else {
this.$emit('input', this.dashboardArea.map(item => item.id));
return;
this.$emit('input', val);
}
}
// if (this.multiple && val.length == 0) {
// this.$emit('input', this.dashboardArea.map(item => item.id));
// } else {
this.$emit('input', val);
// }
} else {
this.$emit('input', null);
}
......
......@@ -18,6 +18,7 @@ const initAction = () => ({
fetchDashboardAreaList({ commit }, entity) {
return fetchDashboardAreaList({
data: entity,
notLoading: true,
}).then(res => {
const list = res.data;
commit(GET_AREA_LIST, list);
......
<template>
<div class="Dashboard-Campus-Service">
<div class="Dashboard-SearchBar bothSearch">
<search-item label="运营商">
<operator-select
:accessType="1"
:value="filters.operateId"
@input="val => changeOperatorHandle({ operateId: val })"
/>
</search-item>
<search-item label="区域">
<dashboard-area-select
:operateId="filters.operateId"
:value="filters.choiceareaIds"
multiple
@input="val => updateFilters({choiceareaIds: val})"
>
<el-option :value="-1">全选</el-option>
</dashboard-area-select>
</search-item>
<el-radio-group
class="Dashboard-Radio"
:value="filters.timeType"
@input="val => updateFilters({ timeType: val })"
>
<el-radio
class="Dashboard-Radio-item"
:label="0"
>本日</el-radio>
<el-radio
class="Dashboard-Radio-item"
:label="1"
>本月</el-radio>
<el-radio
class="Dashboard-Radio-item"
:label="2"
>本年</el-radio>
</el-radio-group>
<el-button
:loading="loading.service||loading.area||loading.equipment"
type="primary"
@click="fetchConsumeList"
class="CampusRank-search"
>搜索</el-button>
</div>
<div class="Dashboard-Campus-Service-chart">
<CampusRank />
<SeviceRatio />
</div>
</div>
</template>
<script>
import SeviceRatio from '../SeviceRatio/SeviceRatio';
import CampusRank from '../CampusRank/CampusRank';
import { mapGetters, mapActions } from 'vuex';
export default {
components: {
SeviceRatio,
CampusRank,
},
computed: {
...mapGetters('Dashboard', [
'campusRankList',
'filters',
'areaInfo',
'loading',
]),
},
methods: {
...mapActions('Dashboard', [
'fetchConsumeList',
'updateCampusName',
'updateFilters',
]),
changeOperatorHandle(data) {
this.updateFilters({ ...data, choiceareaIds: [] });
// this.fetchConsumeList();
},
},
};
</script>
<style lang="scss">
.Dashboard-Campus-Service {
.Dashboard & .Dashboard-SearchBar.bothSearch {
justify-content: flex-start;
align-items: center;
.Dashboard-Radio {
margin-left: 20px;
}
}
.Dashboard-Campus-Service-chart {
display: flex;
width: 100%;
.CampusRank-wrap {
position: relative;
flex: 1.2;
margin-right: 20px;
}
.CampusRank-wrap::after {
content: '';
position: absolute;
height: 80%;
top: 10%;
right: -10px;
border-right: 1px dotted #eee;
}
.SeviceRatio {
flex: 1;
}
}
.el-select {
.el-select__tags {
height: 90%;
overflow: hidden;
input {
display: none;
}
}
.el-input {
overflow: hidden;
}
.el-input__inner {
height: 100% !important;
}
}
}
</style>
<template>
<div
class="Dashboard-DataCard CampusRank-wrap"
class="CampusRank-wrap"
v-loading="loading.area"
>
<div class="Dashboard-SearchBar">
<search-item label="运营商">
<operator-select
:accessType="1"
:value="filters.operateId"
@input="val => changeOperatorHandle({ operateId: val })"
/>
</search-item>
<search-item label="区域">
<dashboard-area-select
:operateId="filters.operateId"
:value="filters.choiceareaIds"
multiple
@input="val => updateFilters({choiceareaIds: val})"
>
<el-option :value="-1">全选</el-option>
</dashboard-area-select>
</search-item>
<el-radio-group
class="Dashboard-Radio"
:value="filters.timeType"
@input="val => updateFilters({ timeType: val })"
>
<el-radio
class="Dashboard-Radio-item"
:label="0"
>本日</el-radio>
<el-radio
class="Dashboard-Radio-item"
:label="1"
>本月</el-radio>
<el-radio
class="Dashboard-Radio-item"
:label="2"
>本年</el-radio>
</el-radio-group>
<el-button
type="primary"
@click="fetchConsumeList"
class="CampusRank-search"
>搜索</el-button>
</div>
<div class="Dashboard-title">各区域消费占比</div>
<CampusRankChart
:data="campusRankListFillAreaname"
:changeCampusHandle="changeCampusHandle"
......@@ -120,21 +79,6 @@ export default {
<style lang="scss">
.CampusRank-wrap {
.el-select {
.el-select__tags {
height: 90%;
overflow: hidden;
input {
display: none;
}
}
.el-input {
overflow: hidden;
}
.el-input__inner {
height: 100% !important;
}
}
.CampusRank-search {
margin-right: 5px;
}
......
......@@ -37,8 +37,8 @@ export default {
this.chart = new G2.Chart({
container: 'CampusRank',
forceFit: true,
height: this.height,
padding: [20, 230, 20, 0],
height: this.height - 30,
padding: [20, 249, 20, 0],
});
this.chart.source(this.data);
this.chart.coord('theta', {
......@@ -51,7 +51,7 @@ export default {
position: 'right-center',
marker: 'square',
clickable: false,
offsetX: -4,
offsetX: 2,
useHtml: true,
containerTpl: `
<div class="g2-legend">
......@@ -73,14 +73,14 @@ export default {
style="display:inline-block;margin-right:10px;background-color:${color};"
></i>
<span class="g2-legend-text" title="${value}">${value}: </span>
<span class="g2-legend-price">${price}</span>
<span class="g2-legend-price">${price}</span>
</li>
`;
},
'g2-legend': {
width: '230px',
'max-width': '230px',
'max-height': this.height + 'px',
width: '244px',
'max-width': '244px',
'max-height': this.height - 30 + 'px',
right: 0,
},
'g2-legend-list-item': {
......
......@@ -14,7 +14,9 @@
class="CustomerFeedback-List"
v-if="show"
:style="`width:${width}px`"
v-loading="loading"
>
<template v-if="feedbackList && feedbackList.length">
<div
class="CustomerFeedback-Item"
v-for="(item, index) in feedbackList"
......@@ -23,9 +25,17 @@
<span class="CustomerFeedback-ItemNum">{{item.count}}</span>
<span
class="CustomerFeedback-ItemName"
@click="() => clickHandle(item)"
:title="item.areaName"
>{{item.areaName}}</span>
</div>
</template>
<template v-else>
<div class="noFeedbackText">
没有需要处理的反馈
</div>
</template>
</div>
</div>
</template>
......@@ -36,7 +46,12 @@ import { mapGetters, mapActions } from 'vuex';
export default {
name: 'CustomerFeedback',
computed: {
...mapGetters('Dashboard/customerFeedback', ['feedbackList', 'count']),
...mapGetters('Dashboard/customerFeedback', [
'feedbackList',
'count',
'loading',
]),
...mapGetters(['feedbackPage']),
},
data() {
return {
......@@ -58,6 +73,14 @@ export default {
initData() {
this.getFeedbackList();
},
clickHandle(data) {
const { areaId } = data;
if (this.feedbackPage) {
this.$router.push({ name: this.feedbackPage, query: { areaId } });
} else {
this.$message.error('无会员反馈页面权限');
}
},
},
};
</script>
......@@ -90,6 +113,9 @@ export default {
.CustomerFeedback-List {
flex: 1;
overflow-y: auto;
.noFeedbackText {
padding: 50px 20px;
}
}
.CustomerFeedback-Item {
display: flex;
......@@ -109,8 +135,8 @@ export default {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
}
}
}
@media screen and (max-width: $bigScreenWidth) {
......
import { getFeedbackList } from '@/api/dashboard/dashboard';
const FETCH_FFEDBACK_LIST = 'FETCH_FFEDBACK_LIST';
const FETCH_DATA = 'FETCH_DATA';
const state = () => ({
loading: false,
list: [],
count: 0,
});
......@@ -9,13 +11,21 @@ const state = () => ({
const getters = {
feedbackList: state => state.list,
count: state => state.count,
loading: state => state.loading,
};
const actions = {
getFeedbackList({ commit }) {
return getFeedbackList().then(res => {
commit(FETCH_DATA, true);
return getFeedbackList()
.then(res => {
const { data, count } = res;
commit(FETCH_FFEDBACK_LIST, { list: data, count });
commit(FETCH_DATA, false);
})
.catch(err => {
console.error(err);
commit(FETCH_DATA, false);
});
},
};
......@@ -25,6 +35,9 @@ const mutations = {
state.list = data.list;
state.count = data.count;
},
[FETCH_DATA](state, fetching) {
state.loading = fetching;
},
};
export default {
......
......@@ -108,3 +108,42 @@ export default {
},
};
</script>
<style lang="scss">
.Dashboard {
.Dashboard-DataCard {
background-color: #fff;
border-radius: 8px;
margin-right: 8px;
&:last-child {
margin-right: 0;
}
}
.Dashboard-SearchBar {
display: flex;
padding: 10px 0 20px;
}
.Dashboard-CampusData {
display: flex;
padding: 0 15px;
.Dashboard-title {
position: relative;
}
.Dashboard-title::before {
content: '';
position: absolute;
bottom: -12px;
left: 0;
width: 32px;
height: 4px;
background-color: #4e82fb;
}
.Dashboard-CampusItem {
flex: 1;
&:nth-child(2) {
flex: 1.4;
}
}
}
}
</style>
......@@ -4,7 +4,7 @@ import {
fetchTitleList,
} from '@/api/dashboard/dashboard';
import customerData from './CustomerData/CustomerDataStore';
// import customerRecharge from './CustomerRecharge/CustomerRechargeStore';
import customerRecharge from './CustomerRecharge/CustomerRechargeStore';
// import customerConsumption from './CustomerConsumption/CustomerConsumptionStore';
import customerFeedback from './CustomerFeedback/CustomerFeedbackStore';
import initFiltersStore from '@/store/modules/filters';
......@@ -16,6 +16,7 @@ const GET_TITLE_DATA = 'GET_TITLE_DATA';
const GET_PERCENT_DATA = 'GET_PERCENT_DATA';
const GET_EUIPMENT_DATA = 'GET_EUIPMENT_DATA';
const GET_CAMPUS_DATA = 'GET_CAMPUS_DATA';
const UPDATE_SERVICE_NAME = 'UPDATE_SERVICE_NAME';
const LOADING_AREA = 'LOADING_AREA';
const LOADING_SERVICE = 'LOADING_SERVICE';
const LOADING_EQUIPMENT = 'LOADING_EQUIPMENT';
......@@ -41,6 +42,9 @@ const state = () => ({
areaName: '',
areaId: undefined,
},
serviceInfo: {
serviceName: '',
},
consumeAfterVos: [],
consumeHardVos: [],
list: [],
......@@ -76,6 +80,7 @@ const getters = {
});
},
seviceRatioList: state => state.consume.percentList,
consumeServiceInfo: state => state.consume.serviceInfo,
loading: state => state.loading,
};
......@@ -112,12 +117,16 @@ const actions = {
})
.then(res => {
let list = res.data;
if (list.percentList && list.percentList.length) {
commit(UPDATE_SERVICE_NAME, list.percentList[0].serviceName);
}
if (data && data.updatePercentList) {
commit(GET_PERCENT_DATA, list);
commit(GET_EUIPMENT_DATA, list);
commit(LOADING_SERVICE, false);
} else if (data && data.updateEuipmentList) {
commit(GET_EUIPMENT_DATA, list);
commit(UPDATE_SERVICE_NAME, data.serviceName);
commit(LOADING_EQUIPMENT, false);
} else {
if (entity && entity.choiceareaIds) {
......@@ -217,6 +226,11 @@ const mutations = {
[GET_CAMPUS_DATA](state, name) {
state.consume.areaInfo = name;
},
[UPDATE_SERVICE_NAME](state, name) {
state.consume.serviceInfo = {
serviceName: name,
};
},
[LOADING_AREA](state, fetching) {
state.loading.area = fetching;
state.loading.service = fetching;
......@@ -239,7 +253,7 @@ export default {
modules: {
filtersStore,
customerData,
// customerRecharge,
customerRecharge,
// customerConsumption,
customerFeedback,
},
......
......@@ -6,8 +6,7 @@
<CustomerFeedback class="Dashboard-DataCard" />
</div>
<div class="Dashboard-Row Dashboard-OperatorData">
<CampusRank class="Dashboard-DataCard" />
<SeviceRatio class="Dashboard-DataCard" />
<CampusCustomerData class="Dashboard-DataCard" />
<EquipmentList class="Dashboard-DataCard" />
</div>
<!-- <CustomerRegister class="Dashboard-Row Dashboard-DataCard" /> -->
......@@ -18,11 +17,10 @@
<script>
import { mapActions, mapGetters } from 'vuex';
// import CustomerRegister from './CustomerRegister/CustomerRegister';
import SeviceRatio from './SeviceRatio/SeviceRatio';
import CampusRank from './CampusRank/CampusRank';
import EquipmentList from './EquipmentList/EquipmentList';
import CustomerFeedback from './CustomerFeedback/CustomerFeedback';
import CustomerData from './CustomerData/CustomerData';
import CampusCustomerData from './CampusCustomerData/CampusCustomerData';
export default {
name: 'Dashboard',
......@@ -30,9 +28,13 @@ export default {
// CustomerRegister,
CustomerData,
CustomerFeedback,
SeviceRatio,
CampusRank,
EquipmentList,
CampusCustomerData,
},
beforeRouteEnter(to, from, next) {
next(vm => {
vm.updateBackPage(from.name);
});
},
created() {
this.initData();
......@@ -43,6 +45,7 @@ export default {
'fetchConsumeList',
'fetchTitleList',
]),
...mapActions(['updateBackPage']),
initData() {
this.fetchReportList();
this.fetchConsumeList();
......@@ -128,43 +131,8 @@ export default {
flex: 1;
}
}
.Dashboard-title {
position: relative;
padding: 20px 0 12px;
margin: 0 20px;
}
.Dashboard-title::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 32px;
height: 4px;
background-color: #4e82fb;
}
}
.Dashboard-CampusData {
display: flex;
padding: 0 15px;
.Dashboard-title {
position: relative;
}
.Dashboard-title::before {
content: '';
position: absolute;
bottom: -12px;
left: 0;
width: 32px;
height: 4px;
background-color: #4e82fb;
}
.Dashboard-CampusItem {
flex: 1;
&:nth-child(2) {
flex: 1.4;
}
}
}
.Dashboard-OperatorData {
// flex: 1;
display: flex;
......@@ -186,9 +154,6 @@ export default {
.Dashboard-title {
display: flex;
align-items: center;
margin: 22px 10px 0;
padding-bottom: 20px;
border-bottom: 1px solid #f1f1f1;
.Dashboard-title-icon.service {
width: 28px;
height: 28px;
......@@ -210,16 +175,31 @@ export default {
}
.Dashboard-DataCard {
&:first-child {
flex: 2;
}
&:nth-child(2) {
flex: 1.5;
flex: 3.5;
}
&:last-child {
flex: 1.5;
}
}
}
.Dashboard-OperatorData,
.Dashboard-CustomerData {
.Dashboard-title {
position: relative;
padding: 20px 0 12px;
margin: 0 20px;
}
.Dashboard-title::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 32px;
height: 4px;
background-color: #4e82fb;
}
}
}
@media screen and (max-width: $bigScreenWidth) {
.Dashboard {
......
......@@ -7,7 +7,9 @@
<div class="Dashboard-title-icon equipment">
<img src="@/assets/images/dashboard/icon_paiming@2x.png" />
</div>
<div class="Dashboard-title-text">各设备消费排名</div>
<div class="Dashboard-title-text">
<span class="serviceName">{{consumeServiceInfo.serviceName}}</span>设备消费排名
</div>
<el-radio-group v-model="showTopFive">
<el-radio-button :label="true">前五名</el-radio-button>
<el-radio-button :label="false">后五名</el-radio-button>
......@@ -35,6 +37,7 @@ export default {
...mapGetters('Dashboard', [
'consumeHardVos',
'consumeAfterVos',
'consumeServiceInfo',
'loading',
]),
},
......@@ -48,10 +51,17 @@ export default {
@import '@/assets/styles/variables.scss';
.EquipmentList {
.Dashboard-title {
border-bottom: 1px solid #f1f1f1;
&::before {
display: none;
}
.el-radio-button__inner {
line-height: 0;
padding: 12px 20px;
}
.serviceName {
color: #f10000;
}
}
}
@media screen and (max-width: $bigScreenWidth) {
......
......@@ -46,7 +46,7 @@
>
{{ item.equipmentPosition }}
</div>
<div class="Dashboard-Equipment-money">{{ item.money.toFixed(2) }}</div>
<div class="Dashboard-Equipment-money">{{ item.money.toFixed(2) }}</div>
</div>
</template>
</div>
......
<template>
<div
class="Dashboard-DataCard"
class="SeviceRatio"
v-loading="loading.service"
>
<div class="Dashboard-title">
<div class="Dashboard-title-icon service">
<img src="@/assets/images/dashboard/icon_zhanbi@2x.png" />
</div>
<div class="Dashboard-title-text">各服务消费占比</div>
<!-- <div class="Dashboard-title-top">TOP1</div> -->
</div>
<div class="Dashboard-title">各服务消费占比</div>
<SeviceRatioChart
:data="seviceRatioList"
:changeServiceHandle="changeServiceHandle"
......@@ -32,6 +26,7 @@ export default {
changeServiceHandle(data) {
this.fetchConsumeList({
serviceId: data.serviceId,
serviceName: data.serviceName,
updateEuipmentList: true,
});
},
......
......@@ -32,13 +32,13 @@ export default {
this.chart = new G2.Chart({
container: 'SeviceRatio',
forceFit: true,
height: this.height,
padding: [0, 130, 0, 0],
height: this.height - 30,
padding: [0, 205, 0, 0],
});
this.chart.source(this.data);
this.chart.coord('theta', {
radius: 0.75,
innerRadius: 0.6,
radius: 0.9,
innerRadius: 0.75,
});
this.chart.tooltip(false);
// 图例
......@@ -46,7 +46,7 @@ export default {
position: 'right-center',
marker: 'square',
clickable: false,
offsetX: -10,
offsetX: -2,
useHtml: true,
containerTpl: `
<div class="g2-legend">
......@@ -67,13 +67,13 @@ export default {
class="g2-legend-marker"
style="display:inline-block;margin-right:10px;background-color:${color};"
></i>
<span class="g2-legend-text" title="${value}">${value}</span>
<span class="g2-legend-price">${price}</span>
<span class="g2-legend-text" title="${value}">${value}:</span>
<span class="g2-legend-price">${price}</span>
</li>
`;
},
'g2-legend': {
width: '140px',
width: '200px',
// left: '-20px',
},
'g2-legend-list-item': {
......@@ -96,7 +96,7 @@ export default {
position: ['50%', '50%'],
html: `<div class="SeviceRatio-centerText">
<span class="SeviceRatio-percent">0.00</span>%<br>
<span class="SeviceRatio-serviceName" ></span>
<span class="SeviceRatio-serviceName"></span>
</div>`,
alignX: 'middle',
alignY: 'middle',
......@@ -146,7 +146,7 @@ export default {
#SeviceRatio {
.g2-legend-text {
display: inline-block;
width: 46px;
width: 90px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
......
<template>
<div class="Dashboard Home-Dashboard">
<CustomerRegister
v-if="show"
class="Dashboard-Row Dashboard-DataCard"
/>
</div>
</template>
<script>
import CustomerRegister from '../Dashboard/CustomerRegister/CustomerRegister';
import { mapGetters, mapActions } from 'vuex';
export default {
name: 'Home-Dashboard',
components: {
CustomerRegister,
},
data() {
return {
show: false,
};
},
computed: {
...mapGetters(['asyncRoutes']),
},
mounted() {
let item = this.asyncRoutes.find(
item => item.menuCode === process.env.VUE_APP_REGISTER_DASHBOARD_CODE
);
if (item) {
this.fetchReportList();
this.show = true;
}
},
methods: {
...mapActions('Dashboard', ['fetchReportList']),
},
};
</script>
<style lang="scss">
.Home-Dashboard.Dashboard {
padding: 22px 34px 0;
overflow-y: hidden;
}
</style>
import pagination from '@/store/modules/pagination';
const GET_LIST = 'GET_LIST';
const state = () => ({
list: [],
});
const getters = {
listData: state => state.list,
};
const actions = {
fetchAboutList({ state, commit, dispatch }, entity) {
return new Promise(resolve => {
const list = [
{ id: 1, name: '123' },
{ id: 2, name: '223' },
{ id: 3, name: '323' },
];
const pagination = {
pageNum: state.pagination.pageNum,
pageSize: state.pagination.pageSize,
...entity,
total: 500,
};
dispatch('updatePagination', pagination);
commit(GET_LIST, list);
resolve();
});
return fetchAboutList({
data: {
pageNum: state.pagination.pageNum,
pageSize: state.pagination.pageSize,
...entity,
},
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_LIST, list);
});
},
};
const mutations = {
[GET_LIST]: (state, list) => {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
<template>
<list-layout>
<template slot="filterItem">
<search-item label="姓名">
<el-input
v-model.trim="filters.name"
clearable
/>
</search-item>
</template>
<template slot="filterBtn">
<el-button
type="primary"
@click="searchList"
>查询</el-button>
</template>
<Table
:listData="listData"
:showEditDialog="showEditDialog"
:showDetail="showDetail"
/>
<template slot="footer">
<md-pagination
:pagination="pagination"
:changePage="changePage"
:changeSizeHandle="changeSizeHandle"
/>
</template>
<EditDialog
:visible.sync="dialogEditVisible"
:resetDialog="resetEditDialog"
:type="editType"
:selected="selected"
:submitUpdateHandle="updateSelected"
:cancelHandle="resetEditDialog"
/>
<DetailDialog
:visible.sync="dialogDetailVisible"
:resetDialog="resetDetailDialog"
:selected="selected"
/>
</list-layout>
</template>
<script>
import ListMixin from '@/mixins/listPage.js';
import { mapGetters, mapActions } from 'vuex';
import Table from './components/Table';
import EditDialog from './components/EditDialog';
import DetailDialog from './components/DetailDialog';
export default {
name: 'about',
mixins: [ListMixin],
components: { Table, EditDialog, DetailDialog },
data() {
return {};
},
computed: {
...mapGetters('system/about', ['listData', 'pagination']),
},
methods: {
...mapActions('system/about', ['fetchAboutList', 'updatePagination']),
fetchList(entity) {
this.fetchAboutList(entity);
},
showEditDialog(type, data) {
this.editType = type;
this.selected = {
...data,
};
this.dialogEditVisible = true;
},
updateSelected() {
const type = this.editType;
this.dialogEditVisible = false;
},
showDetail(data) {
this.selected = {
...data,
};
this.dialogDetailVisible = true;
},
},
};
</script>
<template>
<normal-dialog
:visible="visible"
:before-close="resetDialog"
@update:visible="updateVisibleHandle"
class="SystemUserDetail"
>
<template slot="title">详情</template>
<form-area title="详情">
<form-line>
<form-item label="登录账号">{{selected.loginAccount}}</form-item>
<form-item label="姓名">{{selected.name}}</form-item>
</form-line>
</form-area>
<form-area title="操作记录">
<div
class="record-List"
v-for="(item, index) in selected.adminRecordVoList"
:key="index"
>
<span class="record-Item">{{getOperClassifyName(item.operClassify)}}</span>
<span class="record-Item">{{item.handler}}</span>
<span class="record-Item">{{$formatDate(item.createAt)}}</span>
</div>
</form-area>
</normal-dialog>
</template>
<script>
import dialogMixin from '@/mixins/dialog.js';
export default {
mixins: [dialogMixin],
};
</script>
<style lang="scss">
.SystemUserDetail {
.record-List {
.record-Item {
display: inline-block;
width: 30%;
}
}
.login-List {
display: flex;
justify-content: space-between;
padding-right: 40px;
}
}
</style>
<template>
<normal-dialog
:visible="visible"
:before-close="resetDialog"
@update:visible="updateVisibleHandle"
class="CreditMarginEdit"
>
<template
v-if="type == 0"
slot="title"
>
<img src="@/assets/images/dialog/add_icon.png" />
新增
</template>
<template
v-else
slot="title"
>
<img src="@/assets/images/dialog/edit_icon.png" />
编辑
</template>
<el-form label-width="180px">
<el-form-item label="姓名">
<el-input
v-model="selected.name"
:maxlength="20"
clearable
/>
</el-form-item>
</el-form>
<div slot="footer">
<el-button
type="primary"
@click="submitUpdateHandle"
:disabled="loading"
>确定</el-button>
<el-button @click="cancelHandle">取消</el-button>
</div>
</normal-dialog>
</template>
<script>
import dialogMixin from '@/mixins/dialog.js';
export default {
mixins: [dialogMixin],
methods: {
changeHandle(val) {
if (val.length > 11) {
this.selected.cellphone = val.slice(0, 11);
} else {
this.selected.cellphone = val;
}
},
},
};
</script>
<style lang="scss">
.CreditMarginEdit {
.el-input-number {
width: 100%;
.el-input__inner {
text-align: left;
}
}
}
</style>
<template>
<md-table
:data="listData"
v-loading="loading"
>
<md-table-column
type="index"
label="序号"
align="center"
min-width="55"
width="55"
/>
<md-table-column
label="姓名"
min-width="100"
prop="name"
align="center"
>
<template slot-scope="scope">
<span
class="pointer"
@click="showDetail(scope.row)"
>{{scope.row.name}}</span>
</template>
</md-table-column>
<md-table-column
label="操作"
min-width="200"
fixed="right"
>
<template slot-scope="scope">
<el-button
type="primary"
@click="showEditDialog(1, scope.row)"
>修改</el-button>
</template>
</md-table-column>
</md-table>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
props: {
listData: { type: Array },
showEditDialog: { type: Function },
showDetail: { type: Function },
},
computed: {
...mapGetters(['loading']),
},
};
</script>
import about from './about';
export default {
install(store) {
if (!store.state.system) {
store.registerModule(['system'], {
namespaced: true,
});
}
if (!store.state.system.about) {
store.registerModule(['system', 'about'], about);
}
},
uninstall(store) {
store.unregisterModule(['system', 'about']);
},
};
......@@ -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;
......
......@@ -12,88 +12,17 @@
class="IconMenus-list"
v-else
>
<MenuItem
v-if="customerManage && customerManage.length"
menuName="会员管理"
:menuList="customerManage[0].children"
:selectRouteMenu="selectRouteMenu"
>
<img
slot="icon"
src="@/assets/images/layout/icon_huiyuanguanli@2x.png"
/>
</MenuItem>
<!-- <MenuItem menuName="自助运营">
<img
slot="icon"
src="@/assets/images/layout/icon_zizhuyunying@2x.png"
/>
</MenuItem> -->
<MenuItem
v-if="baseManage && baseManage.length"
menuName="基础数据"
:menuList="baseManage[0].children"
:selectRouteMenu="selectRouteMenu"
>
<img
slot="icon"
src="@/assets/images/layout/icon_jichu@2x.png"
/>
</MenuItem>
<MenuItem
v-if="systemManage && systemManage.length"
menuName="系统管理"
:menuList="systemManage[0].children"
:selectRouteMenu="selectRouteMenu"
>
<img
slot="icon"
src="@/assets/images/layout/icon_xitong@2x.png"
/>
</MenuItem>
<MenuItem
v-if="statisticsManage && statisticsManage.length"
menuName="统计系统"
:menuList="statisticsManage[0].children"
:selectRouteMenu="selectRouteMenu"
>
<img
slot="icon"
src="@/assets/images/layout/icon_baobiao.png"
/>
</MenuItem>
<MenuItem
v-if="deviceManage && deviceManage.length"
menuName="设备系统"
:menuList="deviceManage[0].children"
:selectRouteMenu="selectRouteMenu"
>
<img
slot="icon"
src="@/assets/images/layout/icon_shebei.png"
/>
</MenuItem>
<MenuItem
v-if="customerOperate && customerOperate.length"
menuName="运营管理"
:menuList="customerOperate[0].children"
v-for="(route) in formatRoute"
:key="route.name"
:menuName="route.meta.title"
:menuList="route.children"
:selectRouteMenu="selectRouteMenu"
>
<img
slot="icon"
src="@/assets/images/layout/icon_yunying.png"
/>
</MenuItem>
<MenuItem
v-if="smapreManage && smapreManage.length"
menuName="微信端"
:menuList="smapreManage[0].children"
:selectRouteMenu="selectRouteMenu"
>
<img
slot="icon"
src="@/assets/images/layout/wechat.png"
:src="route.meta.icon"
/>
</MenuItem>
<!-- <div @click="() => toggleFastLink(false)">
......@@ -139,7 +68,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',
......@@ -166,24 +95,14 @@ export default {
},
computed: {
...mapGetters('Dashboard', ['titleData']),
...mapGetters(['collectList']),
customerManage() {
let item = this.routers.find(
menu => menu.menuCode === process.env.VUE_APP_CUSTOMER_MENU_CODE
...mapGetters(['collectList', 'dashboardBackPage']),
formatRoute() {
let routeList = this.routers.filter(
menu =>
menu.menuCode !== process.env.VUE_APP_DASHBOARD_CODE &&
menu.menuCode !== process.env.VUE_APP_REGISTER_DASHBOARD_CODE
);
return item ? formatRouteLink([item]) : null;
},
baseManage() {
let item = this.routers.find(
menu => menu.menuCode === process.env.VUE_APP_BASE_MENU_CODE
);
return item ? formatRouteLink([item]) : null;
},
systemManage() {
let item = this.routers.find(
menu => menu.menuCode === process.env.VUE_APP_SYSTEM_MENU_CODE
);
return item ? formatRouteLink([item]) : null;
return formatRouteLink(routeList);
},
dashboardButtonVisiable() {
let item = this.routers.find(
......@@ -191,30 +110,6 @@ export default {
);
return item ? true : false;
},
statisticsManage() {
let item = this.routers.find(
menu => menu.menuCode === process.env.VUE_APP_STATISTICS_MENU_CODE
);
return item ? formatRouteLink([item]) : null;
},
deviceManage() {
let item = this.routers.find(
menu => menu.menuCode === process.env.VUE_APP_DEVICE_MENU_CODE
);
return item ? formatRouteLink([item]) : null;
},
customerOperate() {
let item = this.routers.find(
menu => menu.menuCode === process.env.VUE_APP_CUSTOMER_OPERATE_CODE
);
return item ? formatRouteLink([item]) : null;
},
smapreManage() {
let item = this.routers.find(
menu => menu.menuCode === process.env.VUE_APP_SMAPRO_CODE
);
return item ? formatRouteLink([item]) : null;
},
},
watch: {
collectList(val) {
......@@ -229,14 +124,18 @@ 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 : [];
},
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',
......
<template>
<div class="avatar-container">
<TimeBox />
<div class="avatar-name">
<span>欢迎您,{{ userInfo.name }}</span>
<span
......@@ -42,6 +41,7 @@
</div>
</span>
</div>
<TimeBox />
<normal-dialog
title="修改密码"
......@@ -507,15 +507,13 @@ export default {
<style lang="scss">
@import '../../../assets/styles/variables.scss';
.avatar-container {
margin-left: 66px;
margin-left: 44px;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
color: #fff;
line-height: 22px;
font-size: 12px;
flex: 1;
justify-content: flex-end;
.avatar-container-line {
margin: 0 20px;
}
......@@ -524,6 +522,7 @@ export default {
align-items: center;
line-height: 20px;
font-size: 14px;
margin-right: 20px;
.avatar-name-icon {
position: relative;
margin-left: 6px;
......
......@@ -154,10 +154,7 @@ export default {
) &&
this.$router.options.base === '/'
) {
this.$router.push({ path: '/' });
setTimeout(() => {
this.$router.push({ name: 'dashboard' });
}, 400);
} else {
this.$router.push({ path: '/' });
}
......
......@@ -20,7 +20,8 @@ const createBaseFetch = config => {
// request拦截器
service.interceptors.request.use(
conf => {
store.dispatch('fetchStart');
const { notLoading } = conf;
store.dispatch('fetchStart', notLoading);
if (store.getters.token) {
conf.headers = {
...conf.headers,
......@@ -52,7 +53,8 @@ const createBaseFetch = config => {
* code为非'0'是抛错
*/
setTimeout(() => {
store.dispatch('fetchDone');
const { notLoading } = response.config;
store.dispatch('fetchDone', notLoading);
}, 500);
if (res.code !== SUCCESS_CODE) {
if (
......
......@@ -14,9 +14,12 @@ const constantRouterMap = [
{
path: '/',
name: 'home',
meta: { title: '首页', icon: HomeIcon },
// component: _import('Home'),
component: { render: h => <router-view /> },
meta: {
title: '首页',
icon: HomeIcon,
store: require('@/containers/Dashboard/store').default,
},
component: _import('HomePage/Home'),
},
{
path: '/dashboard',
......
......@@ -2,16 +2,22 @@ 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';
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 = {
......@@ -24,6 +30,12 @@ const actions = {
getWhiteList({ commit }, list) {
commit(GET_WHITE_LIST, list);
},
updateBackPage({ commit }, name) {
commit(UPDATE_BACK_PAGE, name);
},
updateFeedbackPage({ commit }, name) {
commit(UPDATE_FEEDBACK_PAGE, name);
},
};
const mutations = {
[FETCH_START](state, notLoading) {
......@@ -43,6 +55,12 @@ const mutations = {
[GET_WHITE_LIST](state, list) {
state.whiteList = [...state.whiteList, ...list];
},
[UPDATE_BACK_PAGE](state, name) {
state.dashboardBackPage = name;
},
[UPDATE_FEEDBACK_PAGE](state, name) {
state.feedbackPage = name;
},
};
export default {
modules: {
......
......@@ -4,14 +4,23 @@ export const formatRouteLink = (addRoute, path = '/') => {
return {
path: path + route.menuLink,
name: route.id.toString(),
meta: { title: route.menuName, icon: route.menuPicSmall },
meta: {
title: route.menuName,
icon: route.menuPicSmall,
bicon: route.menuPicBig,
},
children: formatRouteLink(route.childs, path + route.menuLink + '/'),
};
} else {
return {
path: path + route.menuLink,
name: route.id.toString(),
meta: { title: route.menuName, icon: route.menuPicSmall },
menuCode: route.menuCode,
meta: {
title: route.menuName,
icon: route.menuPicSmall,
bicon: route.menuPicBig,
},
};
}
});
......@@ -40,6 +49,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 +78,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 +93,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