后台新增获取游戏连接按钮

This commit is contained in:
2026-04-28 11:06:56 +08:00
parent a7b2f2cd91
commit 63db23df2d
7 changed files with 134 additions and 4 deletions

View File

@@ -76,6 +76,9 @@
"paidDrawCount": "Paid Draw Count",
"freeDrawCount": "Free Draw Count",
"createTime": "Create Time",
"updateTime": "Update Time"
"updateTime": "Update Time",
"getGameLink": "Get Game Link",
"getGameLinkSuccess": "Game link copied",
"getGameLinkFail": "Failed to get game link"
}
}

View File

@@ -76,6 +76,9 @@
"paidDrawCount": "购买抽奖次数",
"freeDrawCount": "赠送抽奖次数",
"createTime": "创建时间",
"updateTime": "更新时间"
"updateTime": "更新时间",
"getGameLink": "获取游戏链接",
"getGameLinkSuccess": "游戏链接已复制",
"getGameLinkFail": "获取游戏链接失败"
}
}

View File

@@ -73,6 +73,16 @@ export default {
})
},
/**
* 获取玩家游戏链接
*/
getGameUrl(params: { id: number | string; lang?: 'zh' | 'en' }) {
return request.get<Api.Common.ApiData>({
url: '/core/dice/player/DicePlayer/getGameUrl',
params
})
},
/**
* 获取彩金池配置选项DiceLotteryPoolConfig.id、name供 lottery_config_id 下拉使用
* @returns [ { id, name } ]

View File

@@ -64,7 +64,14 @@
</template>
<!-- 操作 -->
<template #operation="{ row }">
<div class="flex gap-2">
<div class="flex items-center justify-center gap-1">
<SaButton
v-permission="'dice:player:index:getGameUrl'"
type="success"
icon="ri:links-line"
:tool-tip="$t('page.table.getGameLink')"
@click="handleGetGameUrl(row)"
/>
<SaButton
v-permission="'dice:player:index:update'"
type="secondary"
@@ -98,6 +105,8 @@
</template>
<script setup lang="ts">
import { ElMessage } from 'element-plus'
import { useClipboard } from '@vueuse/core'
import { useI18n } from 'vue-i18n'
import { useTable } from '@/hooks/core/useTable'
import { useSaiAdmin } from '@/composables/useSaiAdmin'
@@ -107,6 +116,7 @@
import WalletOperateDialog from './modules/WalletOperateDialog.vue'
const { t } = useI18n()
const { copy } = useClipboard()
// 搜索表单
const searchForm = ref({
@@ -221,7 +231,7 @@
{
prop: 'operation',
label: 'table.actions.operation',
width: 100,
width: 132,
align: 'center',
fixed: 'right',
useSlot: true
@@ -268,4 +278,21 @@
}
walletDialogVisible.value = true
}
async function handleGetGameUrl(row: Record<string, any>) {
try {
const res = await api.getGameUrl({ id: row.id })
const url =
typeof res?.url === 'string' ? res.url : typeof res?.data?.url === 'string' ? res.data.url : ''
if (!url) {
ElMessage.warning(t('page.table.getGameLinkFail'))
return
}
await copy(url)
ElMessage.success(t('page.table.getGameLinkSuccess'))
} catch (e: any) {
const msg = typeof e?.message === 'string' && e.message !== '' ? e.message : t('page.table.getGameLinkFail')
ElMessage.warning(msg)
}
}
</script>