UserTools.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template lang="html">
  2. <div id="user-tools">
  3. <!-- <h4
  4. > -->
  5. <a class="mdi mdi-account" href="/user">
  6. <span>{{ mail }}</span>
  7. </a>
  8. <!-- </h4> -->
  9. <a href="/admin/content/materials"
  10. v-if="isAdmin"
  11. class="mdi mdi-settings"
  12. title="admin"
  13. ></a>
  14. <a href="/user/logout"
  15. @click.prevent="onLogout()"
  16. class="mdi mdi-logout"
  17. title="logout"
  18. ></a>
  19. <UserFlags v-if="isAdherent"/>
  20. </div>
  21. </template>
  22. <script>
  23. import { mapState, mapActions } from 'vuex'
  24. import UserFlags from 'vuejs/components/User/UserFlags'
  25. export default {
  26. components: {
  27. UserFlags
  28. },
  29. // data () {
  30. // return {
  31. // mail: "Hello User!"
  32. // }
  33. // },
  34. computed: {
  35. ...mapState({
  36. mail: state => state.User.mail,
  37. isAdmin: state => state.User.isAdmin,
  38. isAdherent: state => state.User.isAdherent,
  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.2em;
  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>