access.js 799 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { getToken, getAccessUser, hasPermission } from '@/utils/auth'
  2. export default {
  3. data () {
  4. return {
  5. }
  6. },
  7. computed: {
  8. operator: function () {
  9. return this.getUser.loginName
  10. },
  11. operatorText: function () {
  12. return `${this.getUser.realName}[${this.getUser.loginName}]`
  13. },
  14. operatorToken: function (){
  15. return getToken()
  16. },
  17. getUser: function () {
  18. var user = getAccessUser()
  19. if (user != null) {
  20. return user;
  21. } else {
  22. return {};
  23. }
  24. },
  25. opAuthorities () {
  26. return this.getUser == null ? [] : this.getUser.authorities
  27. }
  28. },
  29. created () {
  30. },
  31. mounted () {
  32. },
  33. destroyed () {
  34. },
  35. methods: {
  36. hasPermission (permissionStr) {
  37. return hasPermission(permissionStr)
  38. },
  39. }
  40. }