mirror of
https://github.com/creativetimofficial/vue-material-kit.git
synced 2025-05-24 05:24:21 +08:00
View profile working, search bug fixed
This commit is contained in:
parent
600c960c3a
commit
57eb4d1edf
@ -4,25 +4,6 @@ import AboutView from "../views/LandingPages/AboutUs/AboutView.vue";
|
|||||||
import ContactView from "../views/LandingPages/ContactUs/ContactView.vue";
|
import ContactView from "../views/LandingPages/ContactUs/ContactView.vue";
|
||||||
import AuthorView from "../views/LandingPages/Author/AuthorView.vue";
|
import AuthorView from "../views/LandingPages/Author/AuthorView.vue";
|
||||||
import SignInBasicView from "../views/LandingPages/SignIn/BasicView.vue";
|
import SignInBasicView from "../views/LandingPages/SignIn/BasicView.vue";
|
||||||
import PageHeaders from "../layouts/sections/page-sections/page-headers/HeadersView.vue";
|
|
||||||
import PageFeatures from "../layouts/sections/page-sections/features/FeaturesView.vue";
|
|
||||||
import NavigationNavbars from "../layouts/sections/navigation/navbars/NavbarsView.vue";
|
|
||||||
import NavigationNavTabs from "../layouts/sections/navigation/nav-tabs/NavTabsView.vue";
|
|
||||||
import NavigationPagination from "../layouts/sections/navigation/pagination/PaginationView.vue";
|
|
||||||
import InputAreasInputs from "../layouts/sections/input-areas/inputs/InputsView.vue";
|
|
||||||
import InputAreasForms from "../layouts/sections/input-areas/forms/FormsView.vue";
|
|
||||||
import ACAlerts from "../layouts/sections/attention-catchers/alerts/AlertsView.vue";
|
|
||||||
import ACModals from "../layouts/sections/attention-catchers/modals/ModalsView.vue";
|
|
||||||
import ACTooltipsPopovers from "../layouts/sections/attention-catchers/tooltips-popovers/TooltipsPopoversView.vue";
|
|
||||||
import ElAvatars from "../layouts/sections/elements/avatars/AvatarsView.vue";
|
|
||||||
import ElBadges from "../layouts/sections/elements/badges/BadgesView.vue";
|
|
||||||
import ElBreadcrumbs from "../layouts/sections/elements/breadcrumbs/BreadcrumbsView.vue";
|
|
||||||
import ElButtons from "../layouts/sections/elements/buttons/ButtonsView.vue";
|
|
||||||
import ElButtonGroups from "../layouts/sections/elements/button-groups/ButtonGroupsView.vue";
|
|
||||||
import ElDropdowns from "../layouts/sections/elements/dropdowns/DropdownsView.vue";
|
|
||||||
import ElProgressBars from "../layouts/sections/elements/progress-bars/ProgressBarsView.vue";
|
|
||||||
import ElToggles from "../layouts/sections/elements/toggles/TogglesView.vue";
|
|
||||||
import ElTypography from "../layouts/sections/elements/typography/TypographyView.vue";
|
|
||||||
import Project from "../views/LandingPages/Project/Project.vue";
|
import Project from "../views/LandingPages/Project/Project.vue";
|
||||||
import Profile from "../views/LandingPages/Profile/Profile.vue";
|
import Profile from "../views/LandingPages/Profile/Profile.vue";
|
||||||
import TopSecretProject from "../views/LandingPages/Project/TopSecretProject.vue";
|
import TopSecretProject from "../views/LandingPages/Project/TopSecretProject.vue";
|
||||||
@ -30,7 +11,8 @@ import BasicRegister from "../views/LandingPages/SignIn/BasicRegister.vue";
|
|||||||
import ForgotPassword from "../views/LandingPages/SignIn/ForgotPassword.vue";
|
import ForgotPassword from "../views/LandingPages/SignIn/ForgotPassword.vue";
|
||||||
import Projects from "../views/LandingPages/Project/AllProjects.vue";
|
import Projects from "../views/LandingPages/Project/AllProjects.vue";
|
||||||
import Profiles from "../views/LandingPages/Profile/AllProfiles.vue";
|
import Profiles from "../views/LandingPages/Profile/AllProfiles.vue";
|
||||||
|
import ViewMyProfile from "../views/LandingPages/Profile/AdmireProfile.vue";
|
||||||
|
import EditMyProfile from "../views/LandingPages/Profile/EditProfile.vue";
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
@ -65,6 +47,18 @@ const router = createRouter({
|
|||||||
component: Profile
|
component: Profile
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
path: '/ViewMyProfile',
|
||||||
|
name: 'viewmyprofile',
|
||||||
|
component: ViewMyProfile
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
path: '/EditMyProfile',
|
||||||
|
name: 'editmyprofile',
|
||||||
|
component: EditMyProfile
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/profiles',
|
path: '/profiles',
|
||||||
name: 'profiles',
|
name: 'profiles',
|
||||||
@ -103,101 +97,8 @@ const router = createRouter({
|
|||||||
name: "signin-basic",
|
name: "signin-basic",
|
||||||
component: SignInBasicView,
|
component: SignInBasicView,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "/sections/page-sections/page-headers",
|
|
||||||
name: "page-headers",
|
|
||||||
component: PageHeaders,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/page-sections/features",
|
|
||||||
name: "page-features",
|
|
||||||
component: PageFeatures,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/navigation/navbars",
|
|
||||||
name: "navigation-navbars",
|
|
||||||
component: NavigationNavbars,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/navigation/nav-tabs",
|
|
||||||
name: "navigation-navtabs",
|
|
||||||
component: NavigationNavTabs,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/navigation/pagination",
|
|
||||||
name: "navigation-pagination",
|
|
||||||
component: NavigationPagination,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/input-areas/inputs",
|
|
||||||
name: "inputareas-inputs",
|
|
||||||
component: InputAreasInputs,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/input-areas/forms",
|
|
||||||
name: "inputareas-forms",
|
|
||||||
component: InputAreasForms,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/attention-catchers/alerts",
|
|
||||||
name: "ac-alerts",
|
|
||||||
component: ACAlerts,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/attention-catchers/modals",
|
|
||||||
name: "ac-modals",
|
|
||||||
component: ACModals,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/attention-catchers/tooltips-popovers",
|
|
||||||
name: "ac-tooltips-popovers",
|
|
||||||
component: ACTooltipsPopovers,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/elements/avatars",
|
|
||||||
name: "el-avatars",
|
|
||||||
component: ElAvatars,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/elements/badges",
|
|
||||||
name: "el-badges",
|
|
||||||
component: ElBadges,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/elements/breadcrumbs",
|
|
||||||
name: "el-breadcrumbs",
|
|
||||||
component: ElBreadcrumbs,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/elements/buttons",
|
|
||||||
name: "el-buttons",
|
|
||||||
component: ElButtons,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/elements/button-groups",
|
|
||||||
name: "el-button-groups",
|
|
||||||
component: ElButtonGroups,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/elements/dropdowns",
|
|
||||||
name: "el-dropdowns",
|
|
||||||
component: ElDropdowns,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/elements/progress-bars",
|
|
||||||
name: "el-progress-bars",
|
|
||||||
component: ElProgressBars,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/elements/toggles",
|
|
||||||
name: "el-toggles",
|
|
||||||
component: ElToggles,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/sections/elements/typography",
|
|
||||||
name: "el-typography",
|
|
||||||
component: ElTypography,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
45
src/views/LandingPages/Profile/AdmireProfile.vue
Normal file
45
src/views/LandingPages/Profile/AdmireProfile.vue
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<script setup>
|
||||||
|
import axios from 'axios';
|
||||||
|
import { onMounted, ref, computed } from "vue";
|
||||||
|
import NavbarDefault from "../../../examples/navbars/NavbarDefault.vue";
|
||||||
|
|
||||||
|
const isAuthenticated = computed(() => !!sessionStorage.getItem('access_token'));
|
||||||
|
const userId = computed(() => sessionStorage.getItem('user_id'));
|
||||||
|
const loggedUserName = computed(() => sessionStorage.getItem('username'));
|
||||||
|
|
||||||
|
const profileData = ref([]);
|
||||||
|
|
||||||
|
|
||||||
|
const getProfile = async () => {
|
||||||
|
const profileDataRecieved = await axios.get(`http://somebodyhire.me/api/profile/${userId.value}/`);
|
||||||
|
profileData.value = profileDataRecieved.data;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(async() => {
|
||||||
|
await getProfile();
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NavbarDefault />
|
||||||
|
<div>
|
||||||
|
<h1>Профиль пользователя {{ loggedUserName }} id {{ userId }}</h1>
|
||||||
|
<h2>{{ profileData.username }}</h2>
|
||||||
|
<p>{{ profileData.email }}</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
0
src/views/LandingPages/Profile/EditProfile.vue
Normal file
0
src/views/LandingPages/Profile/EditProfile.vue
Normal file
@ -7,7 +7,7 @@ import { ref } from "vue";
|
|||||||
const searchQuery = ref('');
|
const searchQuery = ref('');
|
||||||
const searchResultProjects = ref([]);
|
const searchResultProjects = ref([]);
|
||||||
const searchResultUsers = ref([]);
|
const searchResultUsers = ref([]);
|
||||||
|
const searchButtonIsPressed = ref(false);
|
||||||
const search = async () => {
|
const search = async () => {
|
||||||
try {
|
try {
|
||||||
const projectsResponse = await axios.get(`http://somebodyhire.me/api/search/projects/?search_query=${searchQuery.value}`);
|
const projectsResponse = await axios.get(`http://somebodyhire.me/api/search/projects/?search_query=${searchQuery.value}`);
|
||||||
@ -15,6 +15,7 @@ const search = async () => {
|
|||||||
|
|
||||||
const usersResponse = await axios.get(`http://somebodyhire.me/api/search/profiles/?search_query=${searchQuery.value}`);
|
const usersResponse = await axios.get(`http://somebodyhire.me/api/search/profiles/?search_query=${searchQuery.value}`);
|
||||||
searchResultUsers.value = usersResponse.data;
|
searchResultUsers.value = usersResponse.data;
|
||||||
|
searchButtonIsPressed.value = true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('There was an error fetching the search results', error);
|
console.error('There was an error fetching the search results', error);
|
||||||
}
|
}
|
||||||
@ -54,7 +55,7 @@ const search = async () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div v-if = "searchQuery.length > 0">
|
<div v-if = "searchQuery.length > 0 && searchButtonIsPressed === true" >
|
||||||
<h2 class="result-header">Ничего не найдено</h2>
|
<h2 class="result-header">Ничего не найдено</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user