Skip to content

Commit b234459

Browse files
feat : marker 찍기
1 parent 49ed1a3 commit b234459

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+463
-234
lines changed

src/assets/img/home/home (1).jpeg

11.4 KB

src/assets/img/home/home (10).jpeg

8.35 KB

src/assets/img/home/home (11).jpeg

11.5 KB

src/assets/img/home/home (12).jpeg

12.8 KB

src/assets/img/home/home (13).jpeg

9.49 KB

src/assets/img/home/home (14).jpeg

9.17 KB

src/assets/img/home/home (15).jpeg

8.69 KB

src/assets/img/home/home (16).jpeg

9.97 KB

src/assets/img/home/home (17).jpeg

11.2 KB

src/assets/img/home/home (18).jpeg

13.9 KB

src/assets/img/home/home (19).jpeg

12.7 KB

src/assets/img/home/home (2).jpeg

9.73 KB

src/assets/img/home/home (20).jpeg

10.6 KB

src/assets/img/home/home (21).jpeg

11.6 KB

src/assets/img/home/home (3).jpeg

12.8 KB

src/assets/img/home/home (4).jpeg

11.3 KB

src/assets/img/home/home (5).jpeg

10.5 KB

src/assets/img/home/home (6).jpeg

11 KB

src/assets/img/home/home (7).jpeg

10.2 KB

src/assets/img/home/home (8).jpeg

13.2 KB

src/assets/img/home/home (9).jpeg

11.9 KB
4.29 KB
4.12 KB
6.89 KB
9.2 KB
7.48 KB
3.46 KB
4.39 KB
4.44 KB
5.37 KB
4.95 KB
5.22 KB
4.32 KB
6.13 KB
4.34 KB
6.56 KB
5.36 KB
4.94 KB
8.64 KB
8.55 KB
9.33 KB
8.56 KB
3.17 KB
5.43 KB
7.18 KB
6.19 KB
6.3 KB
6.07 KB
4.48 KB
5.5 KB
7.47 KB
5.66 KB
6.98 KB
5.99 KB
3.89 KB
7.63 KB

src/router/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const routes = [
2626
component: LoginView,
2727
},
2828
{
29-
path: 'map/:param', // :param은 동적 라우트 파라미터
29+
path: 'map/', // :param은 동적 라우트 파라미터
3030
name: 'map',
3131
component: MapView,
3232
},
@@ -70,4 +70,4 @@ const router = createRouter({
7070
routes,
7171
});
7272

73-
export default router;
73+
export default router;

src/stores/mapCard.js

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,67 @@ import axios from 'axios';
33
import apiClient from '@/api'; // 위에서 만든 axios 인스턴스를 import
44

55
export const useHouseInfoStore = defineStore('houseInfo', {
6+
67
state: () => ({
78
houseInfos: { data: [] }, // 상태 정의 (초기값)
89
}),
910
actions: {
10-
async fetchHouseInfo(type) {
11+
async fetchHouseInfo(params) {
1112
try {
12-
// URL을 BASE_URL과 합쳐서 사용
13-
console.log("맵카드")
14-
console.log(apiClient)
15-
const response = await apiClient.get(`/api/houseinfos/${type}`);
16-
// response.data.data를 houseInfos에 할당 (주요 수정 부분)
17-
this.houseInfos= response.data.data;
18-
19-
// response.data를 콘솔에 출력하여 디버깅
13+
console.log("fetchHousdeInfo 동작시도")
14+
const queryParams = new URLSearchParams(params).toString(); // 쿼리 문자열 생성
15+
const endpoint = `/api/house-info/range?${queryParams}`;
16+
// API 요청
17+
console.log(endpoint)
18+
const response = await apiClient.get(endpoint);
19+
this.houseInfos = response.data.data;
20+
console.log("응답 데이터:", response.data.data);
21+
//console.log(response.data.data);
22+
} catch (error) {
23+
console.error("데이터를 가져오는데 실패했습니다.", error);
24+
}
25+
}
26+
,
2027

21-
console.log(response.data.data);
28+
// 필터링된 데이터를 가져오는 메서드
29+
async fetchFilteredHouseInfo({
30+
buildingUse,
31+
fromPrice,
32+
toPrice,
33+
fromArea,
34+
toArea,
35+
fromConstructYear,
36+
toConstructYear,
37+
// fromFloor,
38+
// toFloor,
39+
}) {
40+
try {
41+
// URL 쿼리 파라미터를 생성
42+
const queryParams = new URLSearchParams({
43+
buildingUse:buildingUse,
44+
fromPrice: fromPrice?.toString() || '0', // 기본값 0
45+
toPrice: toPrice?.toString() || '10000000', // 기본 최대값
46+
fromArea: fromArea?.toString() || '0', // 기본값 0
47+
toArea: toArea?.toString() || '100', // 기본 최대값
48+
fromConstructYear: fromConstructYear?.toString() || '1990', // 기본 최대값
49+
toConstructYear: toConstructYear?.toString() || '2024', // 기본 최대값
50+
// fromFloor: fromFloor?.toString() || '0', // 기본 최대값
51+
// toFloor: toFloor?.toString() || '40', // 기본 최대값
52+
}).toString();
2253

54+
console.log("필터링된 데이터 호출 URL:", `/api/houseinfos/range?${queryParams}`);
2355

24-
56+
// API 요청
57+
const response = await apiClient.get(`/api/houseinfos/range?${queryParams}`);
58+
this.houseInfos = response.data.data; // 데이터를 상태에 저장
59+
console.log("필터링된 데이터:", response.data.data);
2560
} catch (error) {
26-
console.log('데이터를 가져오는데 실패했습니다.', error);
61+
console.error('필터링된 데이터를 가져오는데 실패했습니다.', error);
2762
}
2863
},
64+
65+
66+
67+
2968
},
30-
});
69+
});

src/views/CardView.vue

Lines changed: 54 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,72 @@
1+
<script setup>
2+
import { ref, computed } from 'vue';
3+
4+
defineProps({
5+
imgUrl : String,
6+
id: Number,
7+
jibun: String, // int → Number
8+
buildingUse: String,
9+
buildingName: String,
10+
districtName: String,
11+
legalName: String,
12+
minPropertyPrice: Number, // double → Number
13+
maxPropertyPrice: Number // double → Number
14+
});
15+
16+
// 전달받은 imgUrl이 없을 경우 랜덤 이미지를 설정
17+
// const imgUrl = ref(null); // imgUrl이 null로 초기화
18+
// 랜덤 이미지를 반환하는 computed
19+
// 랜덤 이미지를 설정하는 변수
20+
const randomImg = new URL(`../assets/img/home/home (${Math.floor(Math.random() * 21) + 1}).jpeg`, import.meta.url).href;
21+
22+
console.log(randomImg)
23+
</script>
24+
25+
<style scoped>
26+
/* TailwindCSS 스타일을 사용하기 때문에 별도의 추가 스타일은 필요하지 않습니다. */
27+
</style>
28+
129
<template>
230
<div class="w-[360px] mx-auto p-1 mb-1">
331
<div class="bg-white border-b-2 flex flex-row py-3">
4-
<!-- 이미지 섹션 -->
5-
<div class="bg-pink-100 w-28 h-28 mx-2">
6-
이미지
7-
</div>
8-
<!-- 내용 섹션 -->
32+
<!-- 이미지 섹션 -->
33+
<div class="bg-pink-100 w-28 h-28 mx-2">
34+
<!-- imgUrl이 있으면 imgUrl 사용, 없으면 randomImage -->
35+
<img v-if="imgUrl" :src="imgUrl" alt="이미지" class="w-full h-full object-cover" />
36+
<img v-else :src="randomImg" alt="랜덤 이미지" class="w-full h-full object-cover" />
37+
</div>
38+
939
<div class="ml-2">
1040
<span class="inline-flex mb-1 items-center text-xxs w-auto text-gray-600 border-2 border-gray-200 bg-white rounded-lg px-2 text-center">
1141
{{ buildingUse }}</span>
1242
<h5 class="text-lg font-bold text-gray-800 pl-1">{{ buildingName }}</h5>
1343
<div class="pl-1">
1444
<span class="text-sm text-gray-600">
15-
{{ districtName }}</span>
45+
{{ districtName }}&nbsp;</span>
46+
<span class="text-sm text-gray-600">
47+
{{ legalName }}&nbsp;</span>
1648
<span class="text-sm text-gray-600">
17-
{{ legalName }}</span>
49+
{{ jibun }}</span>
1850
</div>
19-
<div class="pl-1">
20-
<span class="text-md">최소 </span>
21-
<span class="text-sm">{{ minPropertyPrice }}</span>
22-
<span class="text-md">만원</span>
23-
<span class="text-md"> - </span>
24-
<span class="text-md">최대</span>
25-
<span class="text-sm">{{ maxPropertyPrice }}</span>
26-
<span class="text-md">만원</span>
51+
<div class="pl-1 mt-1 flex flex-row justify-center">
52+
<div class="flex justify-center">
53+
<span class="bg-blue-500 text-white text-xxs px-2 py-1 mr-1 text-center">
54+
평당가
55+
</span>
56+
</div>
57+
<div class="px-2">
58+
<span class="text-sm">{{ minPropertyPrice }}</span>
59+
<span class="text-md">만원</span>
60+
<span class="text-md"> - </span>
61+
<span class="text-sm">{{ maxPropertyPrice }}</span>
62+
<span class="text-md">만원</span>
63+
</div>
64+
2765
</div>
28-
66+
2967
<!-- 버튼 -->
3068
</div>
3169
</div>
3270
</div>
3371
</template>
3472
35-
<script setup>
36-
37-
defineProps({
38-
id: Number, // int → Number
39-
buildingUse: String,
40-
buildingName: String,
41-
districtName: String,
42-
legalName: String,
43-
minPropertyPrice: Number, // double → Number
44-
maxPropertyPrice: Number // double → Number
45-
});
46-
47-
</script>
48-
49-
<style scoped>
50-
/* TailwindCSS 스타일을 사용하기 때문에 별도의 추가 스타일은 필요하지 않습니다. */
51-
52-
53-
</style>

src/views/HeaderView.vue

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<img alt="logo" src="@/assets/img/logo.png" class="w-24 -mr-1" @click="goToHome" />
66
</div>
77
<nav class="md:ml-auto flex flex-wrap items-center text-base justify-center">
8-
<a @click="goToMapView('아파트')" href="" class="mr-5 hover:text-gray-900">지도</a>
8+
<a @click="goToMapView({ buildingUse: '아파트', sidoName: '서울특별시', gugunName: '종로구' });" class="mr-5 hover:text-gray-900">지도</a>
99
<a @click="goToIntroductionView" class="mr-5 hover:text-gray-900">회사소개</a>
1010
<div>
1111
<div v-if="userStore.userInfos.data.nickname">
@@ -45,10 +45,18 @@ const goToLogin = () => {
4545
};
4646
4747
const goToMapView = (param) => {
48-
//console.log('mapView 등장')
49-
console.log(param)
50-
router.push({ name: 'map', params: {param} } );
51-
}
48+
49+
console.log('동작')
50+
51+
if (!param) {
52+
console.error("param is not provided");
53+
return;
54+
}
55+
56+
console.log("Received param:", param);
57+
// Router로 이동
58+
router.push({ name: 'map', query: { ...param } });
59+
};
5260
5361
const goToIntroductionView = () =>{
5462
router.push({name: 'introduction'})
@@ -60,10 +68,9 @@ const goToMyPage = () => {
6068
6169
const userStore = useUserStore();
6270
63-
// 컴포넌트가 마운트될 때 사용자 닉네임 가져오기
6471
onMounted(async () => {
65-
await userStore.fetchUserInfo(); // 닉네임 가져오기
72+
await userStore.fetchUserInfo();
6673
console.log(userStore.userInfos.data.nickname);
6774
});
6875
69-
</script>
76+
</script>

0 commit comments

Comments
 (0)