From a0c7cdc14f44091cfe10665dfcb03965f8e69e05 Mon Sep 17 00:00:00 2001 From: jhynsoo Date: Mon, 20 May 2024 16:47:44 +0900 Subject: [PATCH] Feat: Add attraction search page --- src/api/attraction.js | 13 +- src/assets/base.css | 6 + src/components/common/KakaoMap.vue | 5 +- src/components/search/AttractionItem.vue | 90 ++++++++++++++ src/components/search/SearchBar.vue | 152 +++++++++++++++++++++++ src/components/search/SideBar.vue | 36 ++++-- src/stores/attractionStore.js | 16 +++ src/views/SearchView.vue | 7 +- 8 files changed, 302 insertions(+), 23 deletions(-) create mode 100644 src/components/search/AttractionItem.vue create mode 100644 src/components/search/SearchBar.vue create mode 100644 src/stores/attractionStore.js diff --git a/src/api/attraction.js b/src/api/attraction.js index 57c4586..765ed47 100644 --- a/src/api/attraction.js +++ b/src/api/attraction.js @@ -1,15 +1,10 @@ -import { localAxios } from "@/utils/http-commons"; +import { localAxios } from '@/utils/http-commons'; const local = localAxios; -function getArticles(contentTypeId, sidoCode, gugunCode, title, success, fail) { +function searchAttarctions(queryString, success, fail) { //list - local - .get( - `/attraction/search?contentTypeId=${contentTypeId}&sidoCode=${sidoCode}&gugunCode=${gugunCode}&title=${title}` - ) - .then(success) - .catch(fail); + local.get(`/attraction/search?contentTypeId=12&${queryString}`).then(success).catch(fail); } -export { getArticles }; +export { searchAttarctions }; diff --git a/src/assets/base.css b/src/assets/base.css index 156a713..aa387b8 100644 --- a/src/assets/base.css +++ b/src/assets/base.css @@ -19,6 +19,8 @@ --vt-c-text-light-2: rgba(60, 60, 60, 0.66); --vt-c-text-dark-1: var(--vt-c-white); --vt-c-text-dark-2: rgba(235, 235, 235, 0.64); + + --shadow: 0 2px 8px rgba(0, 0, 0, 0.15); } /* semantic color variables for this project */ @@ -118,6 +120,10 @@ textarea { font-size: 16px; } +*::placeholder { + color: var(--color-text-secondary); +} + p { white-space: pre; } diff --git a/src/components/common/KakaoMap.vue b/src/components/common/KakaoMap.vue index 2da57aa..e3a42de 100644 --- a/src/components/common/KakaoMap.vue +++ b/src/components/common/KakaoMap.vue @@ -21,10 +21,7 @@ onMounted(() => { diff --git a/src/components/search/AttractionItem.vue b/src/components/search/AttractionItem.vue new file mode 100644 index 0000000..3ab2337 --- /dev/null +++ b/src/components/search/AttractionItem.vue @@ -0,0 +1,90 @@ + + + + + diff --git a/src/components/search/SearchBar.vue b/src/components/search/SearchBar.vue new file mode 100644 index 0000000..9142bf4 --- /dev/null +++ b/src/components/search/SearchBar.vue @@ -0,0 +1,152 @@ + + + + + + + diff --git a/src/components/search/SideBar.vue b/src/components/search/SideBar.vue index 90ea1ba..e017c18 100644 --- a/src/components/search/SideBar.vue +++ b/src/components/search/SideBar.vue @@ -1,18 +1,40 @@ - + diff --git a/src/stores/attractionStore.js b/src/stores/attractionStore.js new file mode 100644 index 0000000..f564c66 --- /dev/null +++ b/src/stores/attractionStore.js @@ -0,0 +1,16 @@ +import { searchAttarctions } from '@/api/attraction'; +import { defineStore } from 'pinia'; +import { ref } from 'vue'; + +export const useAttractionStore = defineStore('attraction', () => { + const attractionList = ref([]); + + function search(queryString) { + console.log(searchAttarctions); + searchAttarctions(queryString, ({ data }) => { + attractionList.value = data; + }); + } + + return { attractionList, search }; +}); diff --git a/src/views/SearchView.vue b/src/views/SearchView.vue index 91bd6a7..0dea66d 100644 --- a/src/views/SearchView.vue +++ b/src/views/SearchView.vue @@ -7,17 +7,18 @@ import SideBar from '@/components/search/SideBar.vue';