Info.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <section class="detail section">
  3. <div class="adaptive_flex basic_content">
  4. <div class="column">
  5. <h1>Личный кабинет</h1>
  6. <p>Email: {{ user ? user.email : "email не привязан"}}</p>
  7. <p>Имя: {{ user ? user.first_name : ""}}</p>
  8. <!--p>Телефон: {{ phone ? phone : "телефон не привязан" }}</p-->
  9. <button class="simple-button" @click="logout">Выйти</button>
  10. </div>
  11. </div>
  12. </section>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. user: {
  18. type: Object,
  19. },
  20. },
  21. head() {
  22. return {
  23. title: "Личный кабинет",
  24. };
  25. },
  26. methods: {
  27. logout () {
  28. this.$auth.logout()
  29. .then((res) => {
  30. if (res.data.success == true) {
  31. this.$router.push({path: '/'})
  32. }
  33. })
  34. }
  35. },
  36. mounted() {
  37. if (!this.$store.state.auth.user) {
  38. this.$route.push('user/authorization')
  39. }
  40. }
  41. };
  42. </script>
  43. <style lang="less">
  44. .user {
  45. &__wrapper {
  46. padding-bottom: 100px;
  47. display: flex;
  48. flex-direction: column;
  49. justify-content: center;
  50. height: 100%;
  51. max-height: 750px;
  52. background: white;
  53. height: 100%;
  54. max-width: 400px;
  55. margin: 0 auto;
  56. p {
  57. display: inline-flex;
  58. margin-bottom: 15px;
  59. }
  60. }
  61. }
  62. </style>