Skip to content

Commit

Permalink
add rank item event yn
Browse files Browse the repository at this point in the history
  • Loading branch information
da-in committed Apr 16, 2024
1 parent e2fa5f1 commit ad119fc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 25 deletions.
4 changes: 4 additions & 0 deletions src/assets/gift.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 17 additions & 15 deletions src/pages/rank/_components/Rank.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@
<div :class="style({type})">
<div class="min-w-14">
<span v-if="item?.rank && item?.rank > 4 ">{{ item?.rank }}</span>
<img v-else-if="item?.rank===1" :src="medal1" alt="1st"/>
<img v-else-if="item?.rank===2" :src="medal2" alt="1st"/>
<img v-else-if="item?.rank===3" :src="medal3" alt="1st"/>
<img v-else-if="item?.rank===4" :src="medal4" alt="1st"/>
<img v-else-if="item?.rank===1" :src="medal1" alt="1st" />
<img v-else-if="item?.rank===2" :src="medal2" alt="1st" />
<img v-else-if="item?.rank===3" :src="medal3" alt="1st" />
<img v-else-if="item?.rank===4" :src="medal4" alt="1st" />
</div>
<span class="flex-1 text-caption-b">{{ item?.nickName }}</span>
<div class="flex text-body-b">
<img v-if="item?.eventYn" class="mr-1" :src="gift" alt="이벤트 참여" />
<span class="pr-1">{{ item?.score }}</span>
<img :src="coinSm" alt="코인"/>
<img :src="coinSm" alt="코인" />
</div>
</div>
</template>
<script setup lang="ts">
import {computed, PropType} from 'vue'
import {RankItem} from '../../../requests/fetch/getRank.ts'
import medal1 from '../../../assets/medal1.svg'
import medal2 from '../../../assets/medal2.svg'
import medal3 from '../../../assets/medal3.svg'
import medal4 from '../../../assets/medal4.svg'
import coinSm from '../../../assets/coin-sm.svg'
import {cva} from 'class-variance-authority'
import { computed, PropType } from 'vue'
import { RankItem } from '../../../requests/fetch/getRank.ts'
import medal1 from '@/assets/medal1.svg'
import medal2 from '@/assets/medal2.svg'
import medal3 from '@/assets/medal3.svg'
import medal4 from '@/assets/medal4.svg'
import coinSm from '@/assets/coin-sm.svg'
import gift from '@/assets/gift.svg'
import { cva } from 'class-variance-authority'
const props = defineProps({
item: {
Expand All @@ -45,8 +47,8 @@ const style = cva(
variants: {
type: {
'highlight': 'rounded-lg bg-white mt-1 border-2 pl-2 pr-4',
'normal': 'border-b-solid border-b-2 last:border-b-0 border-b-dark-green px-4'
}
'normal': 'border-b-solid border-b-2 last:border-b-0 border-b-dark-green px-4',
},
},
})
</script>
21 changes: 11 additions & 10 deletions src/requests/fetch/getRank.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import {zaxios} from '../zaxios.ts'
import { zaxios } from '../zaxios.ts'

export interface GetRankParams {
pageNumber: number,
dateTime: number,
pageNumber: number
dateTime: number
}

export interface RankItem {
nickName: string,
score: number,
rank: number
nickName: string
score: number
rank: number
eventYn: boolean
}

export interface GetRankResult {
nextPageNumber: number
rankList: RankItem[],
totalCount: number
nextPageNumber: number
rankList: RankItem[]
totalCount: number
}

export const getRank = async (params: GetRankParams): Promise<GetRankResult> => {
const response = await zaxios.get('/rank', {
params
params,
})
return response.data
}

0 comments on commit ad119fc

Please sign in to comment.