Commit 1fb2c089 by liang ce

修改默认菜单

parent 54e80fd3
......@@ -28,18 +28,13 @@ axios.interceptors.request.use((config) => {
})
// 配置请求返回的拦截器,
axios.interceptors.response.use(res => {
// if (res.data.resultCode === 0) {
// return Promise.resolve(res)
// } else {
// if (res.data.code === 0 || res.data.resultCode === 0) {
// store.dispatch('setSpinning', false)
return Promise.resolve(res)
// } else if (res.data.code === 40003 || res.data.resultCode === 40003) {
// message.error('权限不足')
// return Promise.reject()
// }
if (res.data.code === 0 || res.data.resultCode === 0) {
store.dispatch('setSpinning', false)
return Promise.resolve(res)
} else if (res.data.code === 40003 || res.data.resultCode === 40003) {
message.error('权限不足')
return Promise.reject('1')
}
}, err => {
return new Promise((resolve, reject) => {
console.log(err)
......@@ -80,22 +75,21 @@ axios.interceptors.response.use(res => {
const $http = {
post: (url, data) => {
return new Promise((resolve, reject) => {
// let postData
// if (data === undefined) {
// postData = {
// orgId: localStorage.getItem('orgId')
// }
// } else {
// postData = data
// postData.orgId = localStorage.getItem('orgId')
// }
let postData = data === undefined ? '' : data
axios.post(`${BASE_URL}${url}`, postData, {
headers: {
'Content-Type': 'application/json; charset=UTF-8'
}
}).then((res) => {
return resolve(res)
if (res.data.code === 0 || res.data.resultCode === 0) {
store.dispatch('setSpinning', false)
return Promise.resolve(res)
} else if (res.data.code === 40003 || res.data.resultCode === 40003) {
message.error('权限不足')
return Promise.reject()
}
}).catch((err) => {
console.log(err)
})
})
},
......@@ -103,7 +97,15 @@ const $http = {
return new Promise((resolve, reject) => {
let getData = data === undefined ? '' : qs.stringify(data)
axios.get(`${BASE_URL}${url}?${getData}`).then((res) => {
return resolve(res)
if (res.data.code === 0 || res.data.resultCode === 0) {
store.dispatch('setSpinning', false)
return Promise.resolve(res)
} else if (res.data.code === 40003 || res.data.resultCode === 40003) {
message.error('权限不足')
return Promise.reject()
}
}).catch((err) => {
console.log(err)
})
})
},
......@@ -111,7 +113,15 @@ const $http = {
return new Promise((resolve, reject) => {
let getData = data === undefined ? '' : qs.stringify(data)
axios.delete(`${BASE_URL}${url}?${getData}`).then((res) => {
return resolve(res)
if (res.data.code === 0 || res.data.resultCode === 0) {
store.dispatch('setSpinning', false)
return Promise.resolve(res)
} else if (res.data.code === 40003 || res.data.resultCode === 40003) {
message.error('权限不足')
return Promise.reject()
}
}).catch((err) => {
console.log(err)
})
})
}
......
......@@ -60,7 +60,7 @@ export default {
watch: {
$route (to, from) {
this.title = to.meta.title.split('/')
this.defaultSelectedKeys = this.$route.matched[1] && this.$route.matched[1].name ? this.$route.matched[1].name : ''
this.defaultSelectedKeys = this.$route.matched[1] && this.$route.matched[1].name ? this.$route.matched[1].name : ''
}
},
computed: {},
......
......@@ -42,6 +42,15 @@ export default {
created () {
this.defaultSelectedKeys = 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: {
$route (to, from) {
......
......@@ -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('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 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('3700') > -1" class="itemFlex" key="operationLog"><div :class="[chooseMenuList === 'operationLog' ? 'menuIcon menuIcon8_2' : 'menuIcon menuIcon8_1']"></div>操作日志</a-menu-item>
</a-menu>
......@@ -33,12 +31,27 @@ export default {
data () {
return {
defaultSelectedKeys: 'defaultSelectedKeys',
chooseMenuList: 'accountManagement'
chooseMenuList: ''
}
},
created () {
this.defaultSelectedKeys = 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: {
$route (to, from) {
......
......@@ -33,6 +33,9 @@ export default {
created () {
this.defaultSelectedKeys = this.$route.name
this.chooseMenuList = this.$route.name
if (this.$store.state.menuList.indexOf('9100') > -1) {
this.chooseMenuList = 'rightsManagement'
}
},
watch: {
$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