diff --git a/frontend/src/assets/css/catalog.css b/frontend/src/assets/css/catalog.css index 2a435a2..7753c05 100644 --- a/frontend/src/assets/css/catalog.css +++ b/frontend/src/assets/css/catalog.css @@ -27,7 +27,6 @@ h1, h2, h3, h4, h5, h6 { width: 100%; } - /* Container */ .container { width: 100%; @@ -35,150 +34,6 @@ h1, h2, h3, h4, h5, h6 { margin: 0 auto; } - -/* Header */ - -.header { - width: 100%; - - position: absolute; - top: 0; - left: 0; - right: 0; - z-index: 1000; -} - -.header__table { - width: 1052px; - height: 100px; - border: 2px solid white; - margin: 50px auto 0; - display: flex; - flex-direction: row; - justify-content: center; - - color: white; - -} - -.header__image { - width: 140px; - height: 96px; - margin: 0 auto; - - background: url("@/assets/images/metr.svg") center - no-repeat; - background-size: cover; - border-right: 2px solid white; -} - -.header__block { - width: 145px; - height: 96px; - margin: 0 auto; - border-right: 2px solid white; -} - -.header__search { - width: 426px; - height: 96px; - margin: 0 auto; - display: flex; - flex-direction: row; - justify-content: center; - - border-right: 2px solid white; -} - -.search { - width: 340px; - height: 40px; - padding-top: 25px; - display: flex; - flex-direction: row; - justify-content: space-between; -} - -.search__block { - width: 300px; - height: 40px; - margin: 0; - padding-top: 20px; - - background: white; - border: 1px solid black; -} - -.search__img { - width: 40px; - height: 40px; - margin: 0; - padding-top: 2px; -} - -.header__contacts { - width: 46px; - height: 96px; - margin: 0 auto; - display: flex; - flex-direction: column; -} - -.header__contacts__imgtop { - width: 48px; - height: 48px; - padding-top: 5px; - border-bottom: 2px solid white; -} - -.header__contacts__img { - width: 48px; - height: 48px; - padding-top: 5px; -} - -.header__block__content { - width: 70px; - height: 20px; - margin: 0 auto; - padding-top: 35px; -} - -.header__block__contenttop { - width: 145px; - height: 48px; - margin: 0 auto; - border-bottom: 2px solid white; -} - -.header__block__contentbott { - width: 145px; - height: 48px; -} - -.nav__link { - text-decoration: none; - color: white; - font-size: 15px; - - display: flex; - flex-direction: row; - justify-content: center; - padding-top: 10px; -} - -.nav__link_tomsk { - text-decoration: none; - color: white; - font-size: 15px; - -} - -.nav__link:hover, .nav__link_tomsk:hover { - color: #389EEB; - transition: color .2s linear; -} - /* Intro */ .intro { width: 100%; diff --git a/frontend/src/assets/css/offer.css b/frontend/src/assets/css/offer.css index b9ca953..c3584ac 100644 --- a/frontend/src/assets/css/offer.css +++ b/frontend/src/assets/css/offer.css @@ -35,150 +35,6 @@ h1, h2, h3, h4, h5, h6 { margin: 0 auto; } - -/* Header */ - -.header { - width: 100%; - - position: absolute; - top: 0; - left: 0; - right: 0; - z-index: 1000; -} - -.header__table { - width: 1052px; - height: 100px; - border: 2px solid white; - margin: 50px auto 0; - display: flex; - flex-direction: row; - justify-content: center; - - color: white; - -} - -.header__image { - width: 140px; - height: 96px; - margin: 0 auto; - - background: url("../../../raw/assets/images/metr.svg") center - no-repeat; - background-size: cover; - border-right: 2px solid white; -} - -.header__block { - width: 145px; - height: 96px; - margin: 0 auto; - border-right: 2px solid white; -} - -.header__search { - width: 426px; - height: 96px; - margin: 0 auto; - display: flex; - flex-direction: row; - justify-content: center; - - border-right: 2px solid white; -} - -.search { - width: 340px; - height: 40px; - padding-top: 25px; - display: flex; - flex-direction: row; - justify-content: space-between; -} - -.search__block { - width: 300px; - height: 40px; - margin: 0; - padding-top: 20px; - - background: white; - border: 1px solid black; -} - -.search__img { - width: 40px; - height: 40px; - margin: 0; - padding-top: 2px; -} - -.header__contacts { - width: 46px; - height: 96px; - margin: 0 auto; - display: flex; - flex-direction: column; -} - -.header__contacts__imgtop { - width: 48px; - height: 48px; - padding-top: 5px; - border-bottom: 2px solid white; -} - -.header__contacts__img { - width: 48px; - height: 48px; - padding-top: 5px; -} - -.header__block__content { - width: 70px; - height: 20px; - margin: 0 auto; - padding-top: 35px; -} - -.header__block__contenttop { - width: 145px; - height: 48px; - margin: 0 auto; - border-bottom: 2px solid white; -} - -.header__block__contentbott { - width: 145px; - height: 48px; -} - -.nav__link { - text-decoration: none; - color: white; - font-size: 15px; - - display: flex; - flex-direction: row; - justify-content: center; - padding-top: 10px; -} - -.nav__link_tomsk { - text-decoration: none; - color: white; - font-size: 15px; - -} - -.nav__link:hover, .nav__link_tomsk:hover { - color: #389EEB; - transition: color .2s linear; -} - /* Intro */ .intro { width: 100%; diff --git a/frontend/src/assets/css/profile.css b/frontend/src/assets/css/profile.css index 4dbbb05..ba5e2c2 100644 --- a/frontend/src/assets/css/profile.css +++ b/frontend/src/assets/css/profile.css @@ -35,150 +35,6 @@ h1, h2, h3, h4, h5, h6 { margin: 0 auto; } - -/* Header */ - -.header { - width: 100%; - - position: absolute; - top: 0; - left: 0; - right: 0; - z-index: 1000; -} - -.header__table { - width: 1052px; - height: 100px; - border: 2px solid white; - margin: 50px auto 0; - display: flex; - flex-direction: row; - justify-content: center; - - color: white; - -} - -.header__image { - width: 140px; - height: 96px; - margin: 0 auto; - - background: url("@/assets/images/metr.svg") center - no-repeat; - background-size: cover; - border-right: 2px solid white; -} - -.header__block { - width: 145px; - height: 96px; - margin: 0 auto; - border-right: 2px solid white; -} - -.header__search { - width: 426px; - height: 96px; - margin: 0 auto; - display: flex; - flex-direction: row; - justify-content: center; - - border-right: 2px solid white; -} - -.search { - width: 340px; - height: 40px; - padding-top: 25px; - display: flex; - flex-direction: row; - justify-content: space-between; -} - -.search__block { - width: 300px; - height: 40px; - margin: 0; - padding-top: 20px; - - background: white; - border: 1px solid black; -} - -.search__img { - width: 40px; - height: 40px; - margin: 0; - padding-top: 2px; -} - -.header__contacts { - width: 46px; - height: 96px; - margin: 0 auto; - display: flex; - flex-direction: column; -} - -.header__contacts__imgtop { - width: 48px; - height: 48px; - padding-top: 5px; - border-bottom: 2px solid white; -} - -.header__contacts__img { - width: 48px; - height: 48px; - padding-top: 5px; -} - -.header__block__content { - width: 70px; - height: 20px; - margin: 0 auto; - padding-top: 35px; -} - -.header__block__contenttop { - width: 145px; - height: 48px; - margin: 0 auto; - border-bottom: 2px solid white; -} - -.header__block__contentbott { - width: 145px; - height: 48px; -} - -.nav__link { - text-decoration: none; - color: white; - font-size: 15px; - - display: flex; - flex-direction: row; - justify-content: center; - padding-top: 10px; -} - -.nav__link_tomsk { - text-decoration: none; - color: white; - font-size: 15px; - -} - -.nav__link:hover, .nav__link_tomsk:hover { - color: #389EEB; - transition: color .2s linear; -} - /* Intro */ .intro { width: 100%; diff --git a/frontend/src/assets/css/style.css b/frontend/src/assets/css/style.css index bffd3ed..dea5b98 100644 --- a/frontend/src/assets/css/style.css +++ b/frontend/src/assets/css/style.css @@ -35,150 +35,6 @@ h1, h2, h3, h4, h5, h6 { margin: 0 auto; } - -/* Header */ - -.header { - width: 100%; - - position: absolute; - top: 0; - left: 0; - right: 0; - z-index: 1000; -} - -.header__table { - width: 1052px; - height: 100px; - border: 2px solid white; - margin: 50px auto 0; - display: flex; - flex-direction: row; - justify-content: center; - - color: white; - -} - -.header__image { - width: 140px; - height: 96px; - margin: 0 auto; - - background: url("../images/metr.svg") center - no-repeat; - background-size: cover; - border-right: 2px solid white; -} - -.header__block { - width: 145px; - height: 96px; - margin: 0 auto; - border-right: 2px solid white; -} - -.header__search { - width: 426px; - height: 96px; - margin: 0 auto; - display: flex; - flex-direction: row; - justify-content: center; - - border-right: 2px solid white; -} - -.search { - width: 340px; - height: 40px; - padding-top: 25px; - display: flex; - flex-direction: row; - justify-content: space-between; -} - -.search__block { - width: 300px; - height: 40px; - margin: 0; - padding-top: 20px; - - background: white; - border: 1px solid black; -} - -.search__img { - width: 40px; - height: 40px; - margin: 0; - padding-top: 2px; -} - -.header__contacts { - width: 46px; - height: 96px; - margin: 0 auto; - display: flex; - flex-direction: column; -} - -.header__contacts__imgtop { - width: 48px; - height: 48px; - padding-top: 5px; - border-bottom: 2px solid white; -} - -.header__contacts__img { - width: 48px; - height: 48px; - padding-top: 5px; -} - -.header__block__content { - width: 70px; - height: 20px; - margin: 0 auto; - padding-top: 35px; -} - -.header__block__contenttop { - width: 145px; - height: 48px; - margin: 0 auto; - border-bottom: 2px solid white; -} - -.header__block__contentbott { - width: 145px; - height: 48px; -} - -.nav__link { - text-decoration: none; - color: white; - font-size: 15px; - - display: flex; - flex-direction: row; - justify-content: center; - padding-top: 10px; -} - -.nav__link_tomsk { - text-decoration: none; - color: white; - font-size: 15px; - -} - -.nav__link:hover, .nav__link_tomsk:hover { - color: #389EEB; - transition: color .2s linear; -} - /* Intro */ .intro { width: 100%; diff --git a/frontend/src/components/ProfileAbout.vue b/frontend/src/components/ProfileAbout.vue index 449fee0..3c58152 100644 --- a/frontend/src/components/ProfileAbout.vue +++ b/frontend/src/components/ProfileAbout.vue @@ -7,14 +7,26 @@
-

Занимаюсь продажей квартир более 10 лет.

+

Имя Фамилия:

{{ name }}

+

Почта:

{{ user.email }}

+

Телефон:

{{ user.phone || 'Не указано' }}

diff --git a/frontend/src/components/ProfileAddOffer.vue b/frontend/src/components/ProfileAddOffer.vue index dbc07c8..f4a3f23 100644 --- a/frontend/src/components/ProfileAddOffer.vue +++ b/frontend/src/components/ProfileAddOffer.vue @@ -50,12 +50,51 @@ + diff --git a/frontend/src/components/TheHeader.vue b/frontend/src/components/TheHeader.vue new file mode 100644 index 0000000..2d3bbc0 --- /dev/null +++ b/frontend/src/components/TheHeader.vue @@ -0,0 +1,225 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/services/api.js b/frontend/src/services/api.js index ce14510..f98c0b8 100644 --- a/frontend/src/services/api.js +++ b/frontend/src/services/api.js @@ -1,6 +1,21 @@ import axios from 'axios'; -export default axios.create({ +const instance = axios.create({ baseURL: 'http://tusur.tk:9080/api', withCredentials: true, }); + +instance.interceptors.request.use(function (config) { + const savedUser = JSON.parse(localStorage.getItem('auth')) || null; + if (savedUser === null) + return config; + + const token = savedUser.data.token; + config.headers.Authorization = `Bearer ${token}`; + + return config; +}, function (error) { + return Promise.reject(error); +}); + +export default instance; diff --git a/frontend/src/services/offer.js b/frontend/src/services/offer.js new file mode 100644 index 0000000..de028b6 --- /dev/null +++ b/frontend/src/services/offer.js @@ -0,0 +1,10 @@ +import api from "@/services/api"; + +export const OfferService = { + async add(data) { + const resp = await api.post('/offers', data); + return resp; + }, +}; + +export default OfferService; diff --git a/frontend/src/store/modules/auth.js b/frontend/src/store/modules/auth.js index 162aabb..975b56f 100644 --- a/frontend/src/store/modules/auth.js +++ b/frontend/src/store/modules/auth.js @@ -8,6 +8,11 @@ export const state = { }; export const actions = { + async registration({ commit }, { email, password }) { + const { data: user } = await authService.registration(email, password); + commit('SET_USER', user.data); + commit('SET_TOKEN', user.token); + }, async login({ commit }, { email, password }) { const { data: user } = await authService.login(email, password); commit('SET_USER', user.data); diff --git a/frontend/src/views/AuthView.vue b/frontend/src/views/AuthView.vue index d58dc20..fdd813a 100644 --- a/frontend/src/views/AuthView.vue +++ b/frontend/src/views/AuthView.vue @@ -52,7 +52,9 @@ export default { }); }, registration() { - + this.$store.dispatch('registration', this.credentials).then(() => { + this.$router.push('/profile'); + }); }, auth() { if (this.authForm) @@ -60,6 +62,10 @@ export default { else this.registration(); } + }, + mounted() { + if (this.$store.getters.userAuthenticated) + this.$router.push('/profile'); } } > diff --git a/frontend/src/views/CatalogView.vue b/frontend/src/views/CatalogView.vue index b0ab646..70ce36f 100644 --- a/frontend/src/views/CatalogView.vue +++ b/frontend/src/views/CatalogView.vue @@ -1,60 +1,5 @@ diff --git a/frontend/src/views/MainView.vue b/frontend/src/views/MainView.vue index c6a4c13..1603f33 100644 --- a/frontend/src/views/MainView.vue +++ b/frontend/src/views/MainView.vue @@ -1,58 +1,5 @@