lixin-web
Version:
vue and bootstrap
33 lines (31 loc) • 620 B
JavaScript
import Will from '_Will'
import {mapGetters,mapMutations} from 'vuex'
export const agentableTips = (vm) => {
Will.error('您不是代理,不能访问该页面',[() => {
vm.$router.push('/')
vm.loading && vm.spin(false)
},2500])
}
export default {
watch:{
isAgent(val){
val === 0 && agentableTips(this)
},
},
methods:{
...mapMutations([
'spin'
])
},
computed:{
...mapGetters([
'loading',
'isAgent'
])
},
beforeRouteEnter(to, from, next){
next(vm => {
vm.isAgent === 0 && agentableTips(vm)
})
}
}