fix. 액션버튼 api 데이터 수정 적용
This commit is contained in:
@@ -5,12 +5,6 @@ import type {
|
||||
} from '#layers/types/api/pageData'
|
||||
import type { ButtonType } from '#layers/types/components/button'
|
||||
|
||||
/** 어드민 버튼 유형 (시스템 버튼 / 이미지 버튼) */
|
||||
const BUTTON_CATEGORY = {
|
||||
SYSTEM: 'SYSTEM', // 시스템 버튼
|
||||
IMAGE: 'IMAGE', // 이미지 버튼
|
||||
} as const
|
||||
|
||||
/** 어드민 버튼 타입 */
|
||||
const BUTTON_ACTION_TYPE = {
|
||||
URL: 'URL',
|
||||
@@ -26,16 +20,6 @@ const OS_TYPE = {
|
||||
PC: 1,
|
||||
} as const
|
||||
|
||||
const MARKET_TYPE = {
|
||||
PC: 'pc',
|
||||
GOOGLE_PLAY: 'google_play',
|
||||
APP_STORE: 'app_store',
|
||||
} as const
|
||||
|
||||
const LINK_TARGET = {
|
||||
BLANK: '_blank',
|
||||
} as const
|
||||
|
||||
interface Props {
|
||||
resourcesData: PageDataResourceGroup[]
|
||||
buttonSize?: string
|
||||
@@ -58,8 +42,7 @@ const buttonList = computed<PageDataResourceGroup[]>(
|
||||
|
||||
/** 버튼 유형이 '시스템 버튼'인지 확인 */
|
||||
const isSystemButton = (button: PageDataResourceGroup): boolean => {
|
||||
// [TODO] 어디민 개발 후 수정 필요
|
||||
return button.btn_info?.btn_category === BUTTON_CATEGORY.SYSTEM
|
||||
return button.btn_info?.btn_category === 'system'
|
||||
}
|
||||
|
||||
/** 버튼 타입이 '게임 실행'인지 확인 */
|
||||
@@ -81,7 +64,7 @@ const getButtonType = (btnInfo?: PageDataResourceGroupBtnInfo): ButtonType => {
|
||||
const target = btnInfo?.detail?.action?.link_target
|
||||
|
||||
if (btnType === BUTTON_ACTION_TYPE.URL && target) {
|
||||
return target === LINK_TARGET.BLANK ? 'external' : 'internal'
|
||||
return target === '_blank' ? 'external' : 'internal'
|
||||
}
|
||||
|
||||
if (btnType === BUTTON_ACTION_TYPE.DOWNLOAD) return 'download'
|
||||
@@ -95,11 +78,11 @@ const isRunButtonVisible = (btnInfo: PageDataResourceGroupBtnInfo): boolean => {
|
||||
const marketType = btnInfo?.detail?.market_type
|
||||
|
||||
switch (marketType) {
|
||||
case MARKET_TYPE.PC:
|
||||
case 'pc':
|
||||
return false
|
||||
case MARKET_TYPE.GOOGLE_PLAY:
|
||||
case 'google_play':
|
||||
return device.isAndroid
|
||||
case MARKET_TYPE.APP_STORE:
|
||||
case 'app_store':
|
||||
return device.isApple
|
||||
default:
|
||||
return true
|
||||
@@ -209,20 +192,17 @@ const handleButtonClick = (button: PageDataResourceGroup) => {
|
||||
"
|
||||
type="duplication"
|
||||
:platform="button.btn_info?.detail?.market_type"
|
||||
:background-color="getColorCodeFromData(button.btn_info, 'btn')"
|
||||
:text-color="getColorCodeFromData(button.btn_info, 'txt')"
|
||||
@click="handleButtonClick(button)"
|
||||
>
|
||||
{{ button.btn_info?.txt_btn_name }}
|
||||
</BlocksButtonLauncher>
|
||||
|
||||
<!-- 버튼 유형: 이미지 버튼 + 타입: 기타 -->
|
||||
<!-- [TODO] api 개발 후 수정 필요 (background-image, alt 에 연결 필요) -->
|
||||
<AtomsButtonImage
|
||||
v-else-if="!isSystemButton(button) && !isLauncherButton(button)"
|
||||
v-else-if="!isLauncherButton(button)"
|
||||
:href="button.btn_info?.detail?.action?.url"
|
||||
:background-image="'/images/test.png'"
|
||||
alt="test"
|
||||
:background-image="formatPathHost(button.btn_info?.res_path)"
|
||||
:alt="button.btn_info?.txt_btn_name"
|
||||
:disabled="isDisabled(button)"
|
||||
@click="handleButtonClick(button)"
|
||||
/>
|
||||
|
||||
@@ -89,6 +89,7 @@ export interface PageDataResourceGroupBtnInfo extends ColorObject {
|
||||
btn_category: string
|
||||
txt_btn_name: string
|
||||
detail: Record<string, any>
|
||||
res_path?: string
|
||||
disabled?: boolean
|
||||
use_game_font: 0 | 1 // 0: 사용하지 않음, 1: 사용함
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user