Skip to content

Commit 77140d1

Browse files
Merge pull request #23 from full-ownership/feature/intro
feat : try to show information of houseinfos
2 parents 31a48a6 + 11f1f50 commit 77140d1

File tree

9 files changed

+660
-167
lines changed

9 files changed

+660
-167
lines changed

package-lock.json

Lines changed: 525 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"eslint": "^9.14.0",
3434
"eslint-plugin-vue": "^9.30.0",
3535
"postcss": "^8.4.49",
36+
"sass": "^1.81.0",
3637
"sass-embedded": "^1.81.0",
3738
"tailwindcss": "^3.4.15",
3839
"vite": "^5.4.11",

src/Component/MapView.vue

Lines changed: 0 additions & 92 deletions
This file was deleted.

src/stores/mapCard.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { defineStore } from 'pinia';
2+
import axios from 'axios';
3+
4+
export const useHouseInfoStore = defineStore('houseInfo', {
5+
state: () => ({
6+
houseInfos: { data: [] }, // 초기 상태 설정
7+
}),
8+
actions: {
9+
async fetchHouseInfo(type) {
10+
try {
11+
const response = await axios.get(`http://localhost:8080/api/houseinfos/${type}`);
12+
13+
// 응답이 정상적으로 왔는지 확인
14+
if (response.data && Array.isArray(response.data) && response.data.length > 0) {
15+
this.houseInfos = response.data;
16+
//console.log(this.houseInfos.data[0].buildingUse); // 데이터가 존재할 때만 접근
17+
18+
const valueArray = this.houseInfos.data.map(item => item.value);
19+
console.log(valueArray);
20+
} else {
21+
console.error('빈 데이터 또는 잘못된 데이터 구조:', response.data);
22+
}
23+
} catch (error) {
24+
console.log('데이터를 가져오는데 실패했습니다.', error);
25+
}
26+
},
27+
},
28+
});

src/views/CardView.vue

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
<!-- 내용 섹션 -->
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">
11-
아파트</span>
11+
{{ buildingUse }}</span>
1212
<h5 class="text-lg font-bold text-gray-800 pl-1">아파트 이름</h5>
1313
<div class="pl-1">
1414
<span class="text-sm text-gray-600">
15-
동작구</span>
15+
{{ districtName }}</span>
1616
<span class="text-sm text-gray-600">
17-
동자동</span>
17+
{{ legalName }}</span>
1818
</div>
1919
<div class="pl-1">
2020
<span class="text-md">최소 </span>
21-
<span class="text-sm">00</span>
21+
<span class="text-sm">{{ minPropertyPrice }}</span>
2222
<span class="text-md">만원</span>
2323
<span class="text-md"> - </span>
2424
<span class="text-md">최대 </span>
25-
<span class="text-sm">00</span>
25+
<span class="text-sm">{{ maxPropertyPrice }}</span>
2626
<span class="text-md">만원</span>
2727
</div>
2828
<!-- 버튼 -->
@@ -31,32 +31,44 @@
3131
</div>
3232
</template>
3333

34-
<script>
35-
export default {
36-
props: {
37-
image: {
38-
type: String,
39-
required: true,
40-
},
41-
title: {
42-
type: String,
43-
required: true,
44-
},
45-
description: {
46-
type: String,
47-
required: true,
48-
},
49-
buttonText: {
50-
type: String,
51-
default: "Click Me",
52-
},
53-
},
54-
methods: {
55-
onButtonClick() {
56-
this.$emit("button-click");
57-
},
58-
},
59-
};
34+
<script setup>
35+
36+
// export default {
37+
// props: {
38+
// image: {
39+
// type: String,
40+
// required: true,
41+
// },
42+
// title: {
43+
// type: String,
44+
// required: true,
45+
// },
46+
// description: {
47+
// type: String,
48+
// required: true,
49+
// },
50+
// buttonText: {
51+
// type: String,
52+
// default: "Click Me",
53+
// },
54+
// },
55+
// methods: {
56+
// onButtonClick() {
57+
// this.$emit("button-click");
58+
// },
59+
// },
60+
// };
61+
62+
defineProps({
63+
id: Number, // int → Number
64+
buildingUse: String,
65+
buildingName: String,
66+
districtName: String,
67+
legalName: String,
68+
minPropertyPrice: Number, // double → Number
69+
maxPropertyPrice: Number // double → Number
70+
});
71+
6072
</script>
6173

6274
<style scoped>

src/views/HeaderView.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const goToHome = () => {
2828
router.push({ name: 'home' });
2929
};
3030
31+
3132
const goToLogin = () => {
3233
console.log('Login button clicked');
3334
router.push({ name: 'login' });

src/views/MapView.vue

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
<script setup>
2-
import { KakaoMap } from 'vue3-kakao-maps';
3-
import CardView from './CardView.vue';
4-
//import RangeSlider from '@/Component/RangeSlider.vue';
5-
6-
const coordinate = {
7-
lat: 37.566826,
8-
lng: 126.9786567,
9-
};
10-
11-
// 필터 버튼 목록
12-
const filters = ['가격', '면적', '사용승인일', '층수'];
13-
</script>
14-
151
<template>
162
<div class="flex flex-row items-center w-full h-[100vh] pt-20">
173
<!-- 버튼 영역 -->
@@ -75,34 +61,58 @@ const filters = ['가격', '면적', '사용승인일', '층수'];
7561
</div>
7662
<!-- 목록 영역 추가할 수 있습니다 -->
7763
<div class="p-2">
78-
<CardView description="hi" @click="showFrame = !showFrame"></CardView>
79-
<CardView description="hi"></CardView>
8064

81-
<!-- slide 효과 열리는 프레임 -->
82-
<div v-show="showFrame" class="absolute top-40 bottom-0 left-[460px] w-72 bg-blue-500 h-72 p-1 shadow-lg rounded-md z-10
83-
transition-all duration-2000 ease-in-out" :style="{'left': showFrame ? 'translateX(500px)' : 'translateX(0)'}">
84-
<div class="bg-white w-full h-full"> 프레임입니다만 </div>
85-
</div>
65+
<div v-if="houseInfosLoaded">
66+
<div v-for="(house, index) in houseInfos.data" :key="index">
67+
<p>{{ house.name }}</p>
68+
<p>{{ house.price }}</p>
69+
</div>
70+
</div>
71+
72+
<!-- 데이터가 로딩 중일 때 표시할 로딩 화면 -->
73+
<div v-else>
74+
<p>로딩 중...</p>
75+
</div>
8676

8777
</div>
8878
</div>
8979

9080
<!-- 지도 표시 영역 -->
9181
<div class="relative w-full bg-purple-100">
9282
<KakaoMap :lat="coordinate.lat" :lng="coordinate.lng" width="100%" height="100%"/>
93-
<!-- 이동해야하는 자리 -->
9483
</div>
9584
</div>
9685

9786
</div>
9887
</div>
9988
</template>
100-
<script>
101-
export default {
102-
data() {
103-
return {
104-
showFrame: false, // Frame의 표시 여부를 관리하는 상태 변수
105-
};
106-
},
89+
90+
<script setup>
91+
import { KakaoMap } from 'vue3-kakao-maps';
92+
import { ref, onMounted } from 'vue';
93+
import { useHouseInfoStore } from '@/stores/mapCard'; // Pinia store 가져오기
94+
95+
const coordinate = {
96+
lat: 37.566826,
97+
lng: 126.9786567,
98+
};
99+
100+
// 필터 버튼 목록
101+
const filters = ['가격', '면적', '사용승인일', '층수'];
102+
103+
// Pinia store 사용
104+
const houseInfoStore = useHouseInfoStore();
105+
106+
// 데이터를 가져오는 함수
107+
const fetchData = async (type) => {
108+
await houseInfoStore.fetchHouseInfo(type); // API 호출하여 데이터 가져오기
109+
//console.log(houseInfoStore.houseInfos.data); // store의 houseInfos 상태 출력
107110
};
111+
112+
onMounted(async () => {
113+
await fetchData('아파트'); // 데이터가 로딩된 후 실행
114+
});
115+
116+
// store에서 houseInfos 가져오기
117+
const houseInfos = houseInfoStore.houseInfos;
108118
</script>

tailwind.config.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
21
module.exports = {
3-
purge: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
4-
darkMode: false, // or 'media' or 'class'
5-
theme: {
2+
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'], // 'purge' 대신 'content' 사용
3+
darkMode: 'media', // 'false' 대신 'media'로 설정 (또는 이 줄을 아예 제거 가능)
4+
theme: {
65
extend: {
76
fontFamily: {
8-
Pretendard: ["Pretendard"],
7+
Pretendard: ["Pretendard"],
98
PretendardRegular: ["Pretendard Regular"],
109
PretendardSemiBold: ["Pretendard SemiBold"],
1110
PretendardBold: ["Pretendard Bold"],
12-
},
11+
},
1312
fontSize: {
1413
'xxs': '0.65rem', // 10px
1514
},
1615
},
1716
},
18-
variants: {
19-
extend: {},
20-
},
21-
plugins: [],
22-
}
17+
variants: {
18+
extend: {},
19+
},
20+
plugins: [],
21+
}

vite.config.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@ import vueDevTools from 'vite-plugin-vue-devtools'
88
// https://vite.dev/config/
99
export default defineConfig({
1010
server: {
11-
port: 3000, // 원하는 포트 번호로 변경
11+
port: 3000,
12+
proxy: {
13+
'/api': {
14+
target: 'http://localhost:8080', // 첫 번째 서버 주소
15+
changeOrigin: true,
16+
secure: false, // https 사용하지 않는 경우 false로 설정
17+
rewrite: (path) => path.replace(/^\/api/, ''), // 프록시 경로를 적절히 수정
18+
},
19+
// 추가적인 프록시 설정이 필요하면 아래와 같이 작성할 수 있습니다.
20+
21+
},
1222
},
1323
plugins: [
1424
vue(),
@@ -17,7 +27,7 @@ export default defineConfig({
1727
],
1828
resolve: {
1929
alias: {
20-
'@': fileURLToPath(new URL('./src', import.meta.url))
30+
'@': fileURLToPath(new URL('./src', import.meta.url)),
2131
},
22-
}
32+
},
2333
})

0 commit comments

Comments
 (0)