UserTools.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template lang="html">
  2. <div id="user-tools">
  3. <h4
  4. class="mdi mdi-account"
  5. >
  6. <a href="/user">
  7. {{ mail }}
  8. </a>
  9. </h4>
  10. <a href="/admin/content/materials"
  11. v-if="isAdmin"
  12. class="mdi mdi-settings"
  13. title="admin"
  14. ></a>
  15. <a href="/user/logout"
  16. @click.prevent="onLogout()"
  17. class="mdi mdi-logout"
  18. title="logout"
  19. ></a>
  20. <UserFlags/>
  21. </div>
  22. </template>
  23. <script>
  24. import { mapState, mapActions } from 'vuex'
  25. import UserFlags from 'vuejs/components/User/UserFlags'
  26. export default {
  27. components: {
  28. UserFlags
  29. },
  30. // data () {
  31. // return {
  32. // mail: "Hello User!"
  33. // }
  34. // },
  35. computed: {
  36. ...mapState({
  37. mail: state => state.User.mail,
  38. isAdmin: state => state.User.isAdmin,
  39. flags: state => state.User.flags
  40. })
  41. },
  42. methods: {
  43. ...mapActions({
  44. userLogout: 'User/userLogout'
  45. }),
  46. onLogout () {
  47. console.log("UserTools onLogout")
  48. this.userLogout()
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="css" scoped>
  54. #user-tools{
  55. margin-right:0.5em;
  56. /* padding-right:0.5em; */
  57. /* border-right:1px solid #222; */
  58. }
  59. h4{
  60. margin:0;
  61. display:inline-block;
  62. font-size:inherited;
  63. vertical-align: top;
  64. }
  65. </style>