Skip to content

Commit 4e9f8fa

Browse files
authored
Merge pull request #26 from full-ownership/fix
Fix: crash
2 parents 1e7f3eb + 75b48f1 commit 4e9f8fa

File tree

3 files changed

+19
-106
lines changed

3 files changed

+19
-106
lines changed

src/stores/mapCard.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,25 @@
11
import { defineStore } from 'pinia';
22
import axios from 'axios';
3-
<<<<<<< HEAD
43

54
export const useHouseInfoStore = defineStore('houseInfo', {
65
state: () => ({
76
houseInfos: { data: [] }, // 초기 상태 설정
8-
=======
9-
const BASE_URL = import.meta.env.VITE_API_BASE_URL;
10-
11-
export const useHouseInfoStore = defineStore('houseInfo', {
12-
state: () => ({
13-
houseInfos: { data: [] } ,
14-
>>>>>>> 6c2071d4ff1e5b7aacee95ac27651e9273893abb
157
}),
168
actions: {
179
async fetchHouseInfo(type) {
1810
try {
19-
<<<<<<< HEAD
2011
const response = await axios.get(`http://localhost:8080/api/houseinfos/${type}`);
21-
12+
2213
// 응답이 정상적으로 왔는지 확인
2314
if (response.data && Array.isArray(response.data) && response.data.length > 0) {
2415
this.houseInfos = response.data;
2516
//console.log(this.houseInfos.data[0].buildingUse); // 데이터가 존재할 때만 접근
26-
17+
2718
const valueArray = this.houseInfos.data.map(item => item.value);
2819
console.log(valueArray);
2920
} else {
3021
console.error('빈 데이터 또는 잘못된 데이터 구조:', response.data);
3122
}
32-
=======
33-
34-
const response = await axios.get(`http://localhost:8080/api/houseinfos/${type}`);
35-
36-
this.houseInfos.data = response.data.data;
37-
38-
//아파트 출력
39-
>>>>>>> 6c2071d4ff1e5b7aacee95ac27651e9273893abb
4023
} catch (error) {
4124
console.log('데이터를 가져오는데 실패했습니다.', error);
4225
}

src/views/CardView.vue

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
<div class="ml-2">
1010
<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">
1111
{{ buildingUse }}</span>
12-
<<<<<<< HEAD
1312
<h5 class="text-lg font-bold text-gray-800 pl-1">아파트 이름</h5>
14-
=======
13+
1514
<h5 class="text-lg font-bold text-gray-800 pl-1">{{ buildingName }}</h5>
16-
>>>>>>> 6c2071d4ff1e5b7aacee95ac27651e9273893abb
1715
<div class="pl-1">
1816
<span class="text-sm text-gray-600">
1917
{{ districtName }}</span>
@@ -25,15 +23,15 @@
2523
<span class="text-sm">{{ minPropertyPrice }}</span>
2624
<span class="text-md">만원</span>
2725
<span class="text-md"> - </span>
28-
<<<<<<< HEAD
26+
2927
<span class="text-md">최대 </span>
30-
=======
28+
3129
<span class="text-md">최대</span>
32-
>>>>>>> 6c2071d4ff1e5b7aacee95ac27651e9273893abb
30+
3331
<span class="text-sm">{{ maxPropertyPrice }}</span>
3432
<span class="text-md">만원</span>
3533
</div>
36-
34+
3735
<!-- 버튼 -->
3836
</div>
3937
</div>
@@ -42,7 +40,6 @@
4240

4341
<script setup>
4442
45-
<<<<<<< HEAD
4643
// export default {
4744
// props: {
4845
// image: {
@@ -69,8 +66,6 @@
6966
// },
7067
// };
7168
72-
=======
73-
>>>>>>> 6c2071d4ff1e5b7aacee95ac27651e9273893abb
7469
defineProps({
7570
id: Number, // int → Number
7671
buildingUse: String,

src/views/MapView.vue

Lines changed: 12 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<<<<<<< HEAD
21
<script setup>
32
import { KakaoMap } from 'vue3-kakao-maps';
43
import { ref, onMounted } from 'vue';
@@ -25,13 +24,13 @@ const onLoadKakaoMap = async (mapRef) => {
2524
console.log('Zoom level changed:', level.value);
2625
2726
if (!detailMode.value && level.value <= 10) {
28-
detailMode.value = true; // 상세 모드 활성화
29-
removePolygon(); // 기존 폴리곤 제거
30-
await init('/sig.json'); // 상세 데이터를 로드
27+
detailMode.value = true;
28+
removePolygon();
29+
await init('/sig.json');
3130
} else if (detailMode.value && level.value > 10) {
32-
detailMode.value = false; // 광역 모드 활성화
33-
removePolygon(); // 기존 폴리곤 제거
34-
await init('/sido.json'); // 광역 데이터를 로드
31+
detailMode.value = false;
32+
removePolygon();
33+
await init('/sido.json');
3534
}
3635
});
3736
};
@@ -122,8 +121,6 @@ const houseInfos = houseInfoStore.houseInfos;
122121

123122

124123

125-
=======
126-
>>>>>>> 6c2071d4ff1e5b7aacee95ac27651e9273893abb
127124
<template>
128125
<div class="flex flex-row items-center w-full h-[100vh] pt-20">
129126
<!-- 버튼 영역 -->
@@ -186,7 +183,6 @@ const houseInfos = houseInfoStore.houseInfos;
186183
<FilterButton></FilterButton>
187184
</div>
188185
<!-- 목록 영역 추가할 수 있습니다 -->
189-
<<<<<<< HEAD
190186
<div class="p-2">
191187

192188
<div v-if="houseInfosLoaded">
@@ -200,83 +196,22 @@ const houseInfos = houseInfoStore.houseInfos;
200196
<div v-else>
201197
<p>로딩 중...</p>
202198
</div>
203-
=======
204-
<div class="p-2 overflow-y-auto">
205-
206-
<!--<div v-if="houseInfosLoaded">-->
207-
<div v-for="(house, index) in houseInfos.data" :key="index">
208-
209-
<CardView
210-
:id="house.id"
211-
:buildingUse="house.buildingUse"
212-
:buildingName="house.buildingName"
213-
:districtName="house.districtName"
214-
:legalName="house.legalName"
215-
:minPropertyPrice="house.minPropertyPrice"
216-
:maxPropertyPrice="house.maxPropertyPrice"
217-
/>
218-
219-
</div>
220-
<!--</div>-->
221-
222-
<!-- 데이터가 로딩 중일 때 표시할 로딩 화면 -->
223-
224-
>>>>>>> 6c2071d4ff1e5b7aacee95ac27651e9273893abb
225199

226200
</div>
227201
</div>
228202

229203
<!-- 지도 표시 영역 -->
230204
<div class="relative w-full bg-purple-100">
231-
<<<<<<< HEAD
232205
<KakaoMap
233-
:lat="36.866826"
234-
:lng="127.7786567"
235-
:level="12"
236-
@onLoadKakaoMap="onLoadKakaoMap"
237-
style="width: 100%; height: 100vh;"
238-
/>
239-
=======
240-
<KakaoMap :lat="coordinate.lat" :lng="coordinate.lng" width="100%" height="100%"/>
241-
>>>>>>> 6c2071d4ff1e5b7aacee95ac27651e9273893abb
206+
:lat="36.866826"
207+
:lng="127.7786567"
208+
:level="12"
209+
@onLoadKakaoMap="onLoadKakaoMap"
210+
style="width: 100%; height: 100vh;"
211+
/>
242212
</div>
243213
</div>
244214

245215
</div>
246216
</div>
247217
</template>
248-
<<<<<<< HEAD
249-
=======
250-
251-
<script setup>
252-
import { KakaoMap } from 'vue3-kakao-maps';
253-
import { ref, onMounted } from 'vue';
254-
import { useHouseInfoStore } from '@/stores/mapCard'; // Pinia store 가져오기
255-
import CardView from './CardView.vue';
256-
257-
const coordinate = {
258-
lat: 37.566826,
259-
lng: 126.9786567,
260-
};
261-
262-
// 필터 버튼 목록
263-
const filters = ['가격', '면적', '사용승인일', '층수'];
264-
265-
// Pinia store 사용
266-
const houseInfoStore = useHouseInfoStore();
267-
268-
// 데이터를 가져오는 함수
269-
const fetchData = async (type) => {
270-
await houseInfoStore.fetchHouseInfo(type); // API 호출하여 데이터 가져오기
271-
//console.log(houseInfoStore.houseInfos.data); // store의 houseInfos 상태 출력
272-
};
273-
274-
onMounted(async () => {
275-
await fetchData('아파트'); // 데이터가 로딩된 후 실행
276-
});
277-
278-
// store에서 houseInfos 가져오기
279-
const houseInfos = houseInfoStore.houseInfos;
280-
281-
</script>
282-
>>>>>>> 6c2071d4ff1e5b7aacee95ac27651e9273893abb

0 commit comments

Comments
 (0)