Skip to content

Commit

Permalink
Merge pull request #38 from study2895/main
Browse files Browse the repository at this point in the history
[Feat] Tailwind CSS purge ์„ค์ • ์ถ”๊ฐ€ ๋ฐ ๋ฉ”์ธํŽ˜์ด์ง€ ๋ฐฑ์—”๋“œ ๋กœ์ง ์ž‘์„ฑ
  • Loading branch information
study2895 authored Nov 6, 2024
2 parents f6f86a0 + 7e07880 commit 878002a
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#๋ฐฑ์—”๋“œ ํฌํŠธ ๋ฒˆํ˜ธ
VUE_APP_BE_API_URL=http://localhost:8082
VUE_APP_BE_API_URL=http://ec2-43-202-20-87.ap-northeast-2.compute.amazonaws.com:8080/
103 changes: 87 additions & 16 deletions src/views/mainpage/MainpageView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,7 @@
ํ† ์‹คํ† ์‹ค ์•„์ฝ”๊ฐ€ ์ž๋ผ๋Š” ์ค‘
</p>
</div>
<img
src="@/assets/Icons/akoming/mainpage/ako-01.svg"
alt="์•„์ฝ” ์ด๋ฏธ์ง€"
class="w-64 h-64 mx-auto"
/>
<img :src="akoImage" alt="์•„์ฝ” ์ด๋ฏธ์ง€" class="w-64 h-64 mx-auto" />
</div>
</main>
<MainFooter />
Expand All @@ -123,24 +119,99 @@
</template>

<script setup>
import { ref } from 'vue'
import { ref, onMounted } from 'vue'
import axios from 'axios'
import MainHeader from '@/components/layout/Header.vue'
import MainFooter from '@/components/layout/Footer.vue'
import attendanceIcon from '@/assets/Icons/akoming/todo/attendance.svg'
import akojagukIcon from '@/assets/Icons/akoming/todo/akojaguk.svg'
import commentIcon from '@/assets/Icons/akoming/todo/comment.svg'
import akofolioIcon from '@/assets/Icons/akoming/todo/akofolio.svg'
// Tasks for the to-do list
const tasks = ref([
{ name: '์•„์ฝ”๋ฐ ์ถœ์„', completed: false },
{ name: '์•„์ฝ”์ž๊ตญ', completed: false },
{ name: '๋Œ“๊ธ€ ๋‚จ๊ธฐ๊ธฐ', completed: false },
{ name: '์•„์ฝ”ํด๋ฆฌ์˜ค', completed: false }
])
// ๊ฐ ํ€˜์ŠคํŠธ์˜ ์ƒํƒœ๋ฅผ ๋ฐ›์•„์™€์„œ tasks์— ์—…๋ฐ์ดํŠธํ•˜๋Š” ํ•จ์ˆ˜
const fetchQuestStatus = async () => {
try {
const userId = 'user-id' // ์‹ค์ œ ์‚ฌ์šฉ์ž ID๋กœ ์„ค์ •ํ•ด์•ผ ํ•จ
const response = await axios.get(`/api/quests/${userId}`)
const { quest1, quest2, quest3, quest4 } = response.data
tasks.value[0].completed = quest1 // ์•„์ฝ”๋ฐ ์ถœ์„
tasks.value[1].completed = quest2 // ์•„์ฝ”์ž๊ตญ
tasks.value[2].completed = quest3 // ๋Œ“๊ธ€ ๋‚จ๊ธฐ๊ธฐ
tasks.value[3].completed = quest4 // ์•„์ฝ”ํด๋ฆฌ์˜ค
} catch (error) {
console.error('ํ€˜์ŠคํŠธ ์ƒํƒœ๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ:', error)
}
}
// ์Šคํƒฌํ”„ ์ƒํƒœ ์ •์˜
const stamps = ref([
{ label: 'A', completed: true, position: { top: '-18px', left: '12px' } },
{ label: 'K', completed: true, position: { top: '-18px', left: '147px' } },
{ label: 'O', completed: true, position: { top: '62px', left: '262px' } },
{ label: 'A', completed: false, position: { top: '-18px', left: '12px' } },
{ label: 'K', completed: false, position: { top: '-18px', left: '147px' } },
{ label: 'O', completed: false, position: { top: '62px', left: '262px' } },
{ label: 'M', completed: false, position: { top: '144px', left: '157px' } },
{ label: 'I', completed: false, position: { top: '144px', left: '22px' } },
{ label: 'N', completed: false, position: { top: '297px', left: '102px' } },
{ label: 'G', completed: false, position: { top: '297px', left: '237px' } }
])
// ๊ฐ ์Šคํƒฌํ”„์˜ ์ƒํƒœ๋ฅผ ๋ฐ›์•„์™€์„œ stamps์— ์—…๋ฐ์ดํŠธํ•˜๋Š” ํ•จ์ˆ˜
const fetchStampsStatus = async () => {
try {
const userId = 'user-id' // ์‹ค์ œ ์‚ฌ์šฉ์ž ID๋กœ ์„ค์ •ํ•ด์•ผ ํ•จ
const response = await axios.get(`/api/quests/${userId}`)
const { stamp1, stamp2, stamp3, stamp4, stamp5, stamp6, stamp7 } =
response.data
stamps.value[0].completed = stamp1 // ์Šคํƒฌํ”„ A
stamps.value[1].completed = stamp2 // ์Šคํƒฌํ”„ K
stamps.value[2].completed = stamp3 // ์Šคํƒฌํ”„ O
stamps.value[3].completed = stamp4 // ์Šคํƒฌํ”„ M
stamps.value[4].completed = stamp5 // ์Šคํƒฌํ”„ I
stamps.value[5].completed = stamp6 // ์Šคํƒฌํ”„ N
stamps.value[6].completed = stamp7 // ์Šคํƒฌํ”„ G
} catch (error) {
console.error('์Šคํƒฌํ”„ ์ƒํƒœ๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ:', error)
}
}
// ์•„์ฝ” ์ด๋ฏธ์ง€ ๊ฒฝ๋กœ ์ €์žฅํ•  ๋ณ€์ˆ˜
const elephantIcons = [
'@/assets/Icons/akoming/mainpage/ako-01.svg',
'@/assets/Icons/akoming/mainpage/ako-02.svg',
'@/assets/Icons/akoming/mainpage/ako-03.svg',
'@/assets/Icons/akoming/mainpage/ako-04.svg',
'@/assets/Icons/akoming/mainpage/ako-05.svg',
'@/assets/Icons/akoming/mainpage/ako-06.svg'
]
const akoImage = ref(elephantIcons[0])
// Level์— ๋”ฐ๋ฅธ ์•„์ฝ” ์ด๋ฏธ์ง€ ์„ค์ • ํ•จ์ˆ˜
const setElephantIconByLevel = async () => {
try {
const response = await axios.get('/api/goals')
const level = response.data.level
if (level >= 1 && level <= 6) {
akoImage.value = elephantIcons[level - 1]
} else {
console.warn('์œ ํšจํ•œ level ๊ฐ’์ด ์•„๋‹™๋‹ˆ๋‹ค:', level)
akoImage.value = elephantIcons[0] // ๊ธฐ๋ณธ ์ด๋ฏธ์ง€๋กœ ์„ค์ •
}
} catch (error) {
console.error('์•„์ฝ” ์ด๋ฏธ์ง€๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ:', error)
akoImage.value = elephantIcons[0] // ์˜ค๋ฅ˜ ์‹œ ๊ธฐ๋ณธ ์ด๋ฏธ์ง€๋กœ ์„ค์ •
}
}
// Functions to get icons based on task name and completion status
const getCompletedStampIcon = (label) => {
return require(`@/assets/Icons/akoming/stamp/color/color${label.toLowerCase()}.svg`)
Expand All @@ -150,13 +221,6 @@ const getGrayStampIcon = (label) => {
return require(`@/assets/Icons/akoming/stamp/gray/gray${label.toLowerCase()}.svg`)
}
const tasks = ref([
{ name: '์•„์ฝ”๋ฐ ์ถœ์„', completed: true },
{ name: '์•„์ฝ”์ž๊ตญ', completed: true },
{ name: '๋Œ“๊ธ€ ๋‚จ๊ธฐ๊ธฐ', completed: false },
{ name: '์•„์ฝ”ํด๋ฆฌ์˜ค', completed: false }
])
const getTaskIcon = (taskName) => {
switch (taskName) {
case '์•„์ฝ”๋ฐ ์ถœ์„':
Expand All @@ -171,4 +235,11 @@ const getTaskIcon = (taskName) => {
return null
}
}
// onMounted์—์„œ ํ˜ธ์ถœํ•˜์—ฌ ์ดˆ๊ธฐ ๋ฐ์ดํ„ฐ ๋กœ๋“œ
onMounted(() => {
fetchQuestStatus()
fetchStampsStatus() // ์Šคํƒฌํ”„ ์ƒํƒœ๋„ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ
setElephantIconByLevel()
})
</script>
3 changes: 2 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ module.exports = {
}
}
},
plugins: []
plugins: [],
purge: ['./src/**/*.html', './src/**/*.vue', './public/**/*.html']
}
6 changes: 3 additions & 3 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ module.exports = defineConfig({
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8082', // ๋ฐฑ์—”๋“œ ์„œ๋ฒ„ ์ฃผ์†Œ
changeOrigin: true, // ๋ฐฑ์—”๋“œ ์„œ๋ฒ„์˜ ๋„๋ฉ”์ธ๊ณผ ์ƒ๊ด€์—†์ด ์š”์ฒญ์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๊ฒŒ ํ—ˆ์šฉ
secure: false // HTTPS๊ฐ€ ์•„๋‹ˆ๋ฏ€๋กœ ์„ค์ • (ํ•„์š”ํ•œ ๊ฒฝ์šฐ ์ถ”๊ฐ€)
target:
'http://ec2-43-202-20-87.ap-northeast-2.compute.amazonaws.com:8080',
changeOrigin: true
}
},
port: 3000
Expand Down

0 comments on commit 878002a

Please sign in to comment.