Commit fcc1343c by fengzhaoyu

角色判断修改

parents b44811bd e0438335
...@@ -28,17 +28,13 @@ axios.interceptors.request.use((config) => { ...@@ -28,17 +28,13 @@ axios.interceptors.request.use((config) => {
}) })
// 配置请求返回的拦截器, // 配置请求返回的拦截器,
axios.interceptors.response.use(res => { axios.interceptors.response.use(res => {
// if (res.data.resultCode === 0) {
// return Promise.resolve(res)
// } else {
// return Promise.reject()
// }
if (res.data.code === 0 || res.data.resultCode === 0) { if (res.data.code === 0 || res.data.resultCode === 0) {
store.dispatch('setSpinning', false) store.dispatch('setSpinning', false)
return Promise.resolve(res) return Promise.resolve(res)
} else if (res.data.code === 40003 || res.data.resultCode === 40003) { } else if (res.data.code === 40003 || res.data.resultCode === 40003) {
store.dispatch('setSpinning', false)
message.error('权限不足') message.error('权限不足')
return Promise.reject('1') return Promise.reject()
} }
}, err => { }, err => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
......
...@@ -54,6 +54,7 @@ export default { ...@@ -54,6 +54,7 @@ export default {
$http.post('/admin/menu/user', data).then(res => { $http.post('/admin/menu/user', data).then(res => {
const result = that.getSelectList(res.data.data) const result = that.getSelectList(res.data.data)
store.dispatch('setMenuList', that.selectList) store.dispatch('setMenuList', that.selectList)
console.log(that.selectList)
}) })
config.ddconfig() config.ddconfig()
}, },
...@@ -69,6 +70,7 @@ export default { ...@@ -69,6 +70,7 @@ export default {
this.$router.push({ name: obj.key }) this.$router.push({ name: obj.key })
}, },
getSelectList (data) { getSelectList (data) {
console.log(data, '12313123')
let that = this let that = this
const addKey = data => data.map(item => { const addKey = data => data.map(item => {
if (item.children.length > 0) { if (item.children.length > 0) {
......
...@@ -36,12 +36,21 @@ export default { ...@@ -36,12 +36,21 @@ export default {
data () { data () {
return { return {
defaultSelectedKeys: 'defaultSelectedKeys', defaultSelectedKeys: 'defaultSelectedKeys',
chooseMenuList: 'classificationOfDishes' chooseMenuList: ''
} }
}, },
created () { created () {
this.defaultSelectedKeys = this.$route.name this.defaultSelectedKeys = this.$route.name
this.chooseMenuList = this.$route.name this.chooseMenuList = this.$route.name
if (this.$store.state.menuList.indexOf('4100') > -1) {
this.chooseMenuList = 'classificationOfDishes'
} else if (this.$store.state.menuList.indexOf('4200') > -1) {
this.chooseMenuList = 'menuManagement'
} else if (this.$store.state.menuList.indexOf('4300') > -1) {
this.chooseMenuList = 'consumptionOrder'
} else if (this.$store.state.menuList.indexOf('4400') > -1) {
this.chooseMenuList = 'consumptionStatistics'
}
}, },
watch: { watch: {
$route (to, from) { $route (to, from) {
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
<a-menu-item v-if="this.$store.state.menuList.indexOf('3300') > -1" class="itemFlex" key="allowancePayment"><div :class="[chooseMenuList === 'allowancePayment' ? 'menuIcon menuIcon3_2' : 'menuIcon menuIcon3_1']"></div>津贴发放</a-menu-item> <a-menu-item v-if="this.$store.state.menuList.indexOf('3300') > -1" class="itemFlex" key="allowancePayment"><div :class="[chooseMenuList === 'allowancePayment' ? 'menuIcon menuIcon3_2' : 'menuIcon menuIcon3_1']"></div>津贴发放</a-menu-item>
<a-menu-item v-if="this.$store.state.menuList.indexOf('3400') > -1" class="itemFlex" key="recordsOfConsumption"><div :class="[chooseMenuList === 'recordsOfConsumption' ? 'menuIcon menuIcon4_2' : 'menuIcon menuIcon4_1']"></div>消费记录</a-menu-item> <a-menu-item v-if="this.$store.state.menuList.indexOf('3400') > -1" class="itemFlex" key="recordsOfConsumption"><div :class="[chooseMenuList === 'recordsOfConsumption' ? 'menuIcon menuIcon4_2' : 'menuIcon menuIcon4_1']"></div>消费记录</a-menu-item>
<a-menu-item v-if="this.$store.state.menuList.indexOf('3500') > -1" class="itemFlex" key="systemReconciliation"><div :class="[chooseMenuList === 'systemReconciliation' ? 'menuIcon menuIcon6_2' : 'menuIcon menuIcon6_1']"></div>系统对账</a-menu-item> <a-menu-item v-if="this.$store.state.menuList.indexOf('3500') > -1" class="itemFlex" key="systemReconciliation"><div :class="[chooseMenuList === 'systemReconciliation' ? 'menuIcon menuIcon6_2' : 'menuIcon menuIcon6_1']"></div>系统对账</a-menu-item>
<!-- <a-menu-item class="itemFlex" key="cashierManagement"><div :class="[chooseMenuList === 'cashierManagement' ? 'menuIcon menuIcon5_2' : 'menuIcon menuIcon5_1']"></div>设置收银员</a-menu-item>
<a-menu-item class="itemFlex" key="SetAdministrators"><div :class="[chooseMenuList === 'SetAdministrators' ? 'menuIcon menuIcon5_2' : 'menuIcon menuIcon5_1']"></div>设置管理员</a-menu-item> -->
<a-menu-item v-if="this.$store.state.menuList.indexOf('3600') > -1" class="itemFlex" key="paymentManagementSetting"><div :class="[chooseMenuList === 'paymentManagementSetting' ? 'menuIcon menuIcon7_2' : 'menuIcon menuIcon7_1']"></div>设置中心</a-menu-item> <a-menu-item v-if="this.$store.state.menuList.indexOf('3600') > -1" class="itemFlex" key="paymentManagementSetting"><div :class="[chooseMenuList === 'paymentManagementSetting' ? 'menuIcon menuIcon7_2' : 'menuIcon menuIcon7_1']"></div>设置中心</a-menu-item>
<a-menu-item v-if="this.$store.state.menuList.indexOf('3700') > -1" class="itemFlex" key="operationLog"><div :class="[chooseMenuList === 'operationLog' ? 'menuIcon menuIcon8_2' : 'menuIcon menuIcon8_1']"></div>操作日志</a-menu-item> <a-menu-item v-if="this.$store.state.menuList.indexOf('3700') > -1" class="itemFlex" key="operationLog"><div :class="[chooseMenuList === 'operationLog' ? 'menuIcon menuIcon8_2' : 'menuIcon menuIcon8_1']"></div>操作日志</a-menu-item>
</a-menu> </a-menu>
...@@ -33,13 +31,28 @@ export default { ...@@ -33,13 +31,28 @@ export default {
data () { data () {
return { return {
defaultSelectedKeys: 'defaultSelectedKeys', defaultSelectedKeys: 'defaultSelectedKeys',
chooseMenuList: 'accountManagement' chooseMenuList: ''
} }
}, },
created () { created () {
console.log(this.$store.state.menuList, 11111) console.log(this.$store.state.menuList, 11111)
this.defaultSelectedKeys = this.$route.name this.defaultSelectedKeys = this.$route.name
this.chooseMenuList = this.$route.name this.chooseMenuList = this.$route.name
if (this.$store.state.menuList.indexOf('3100') > -1) {
this.chooseMenuList = 'accountManagement'
} else if (this.$store.state.menuList.indexOf('3200') > -1) {
this.chooseMenuList = 'rechargeRecord'
} else if (this.$store.state.menuList.indexOf('3300') > -1) {
this.chooseMenuList = 'allowancePayment'
} else if (this.$store.state.menuList.indexOf('3400') > -1) {
this.chooseMenuList = 'recordsOfConsumption'
} else if (this.$store.state.menuList.indexOf('3500') > -1) {
this.chooseMenuList = 'systemReconciliation'
} else if (this.$store.state.menuList.indexOf('3600') > -1) {
this.chooseMenuList = 'paymentManagementSetting'
} else if (this.$store.state.menuList.indexOf('3700') > -1) {
this.chooseMenuList = 'operationLog'
}
}, },
watch: { watch: {
$route (to, from) { $route (to, from) {
......
...@@ -33,6 +33,9 @@ export default { ...@@ -33,6 +33,9 @@ export default {
created () { created () {
this.defaultSelectedKeys = this.$route.name this.defaultSelectedKeys = this.$route.name
this.chooseMenuList = this.$route.name this.chooseMenuList = this.$route.name
if (this.$store.state.menuList.indexOf('9100') > -1) {
this.chooseMenuList = 'rightsManagement'
}
}, },
watch: { watch: {
$route (to, from) { $route (to, from) {
......
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