原先兑换弹窗里只有「立即兑换」,没有 CDK 的用户只能关掉弹窗 再去找外层购买入口,路径绕。 改为并排两个动作: - 立即兑换(原有,flex-1) - 没有 CDK?立即购买(flex-1,沿用外层购买的珊瑚渐变样式) 新按钮等同于点击外层「购买 CDK 兑换码」入口:先关闭兑换弹窗, 再调用同一个 onCdkBuyClick()(弹流程说明 → 确认后跳购买平台), 避免两个弹窗叠加;购买入口未开放时提示「请联系管理员」。 npm run build 与 vue-tsc 均通过。
This commit is contained in:
@@ -94,6 +94,18 @@ function onCdkBuyClick() {
|
||||
if (!cdkBuyUrl.value) return
|
||||
showCdkBuyConfirm.value = true
|
||||
}
|
||||
// 兑换弹窗内「没有 CDK?立即购买」:等同于点击外层购买入口。
|
||||
// 先关闭兑换弹窗,再走同一套 onCdkBuyClick(弹流程说明 → 确认后跳购买平台),
|
||||
// 避免两个弹窗叠加。
|
||||
function onBuyFromRedeemModal() {
|
||||
closeRedeemModal()
|
||||
if (!cdkBuyVisible.value) {
|
||||
message.warning('购买入口暂未开放,请联系管理员')
|
||||
return
|
||||
}
|
||||
onCdkBuyClick()
|
||||
}
|
||||
|
||||
// 确认后在新标签打开购买平台。用真实 <a> 动态点击而非 window.open,
|
||||
// 避免手机浏览器把它当弹窗强制当前页打开。
|
||||
function confirmCdkBuy() {
|
||||
@@ -773,16 +785,27 @@ async function handleRedeemInvite() {
|
||||
<p v-if="captchaSubmitError" class="text-xs text-red-500 mt-1">{{ captchaSubmitError }}</p>
|
||||
</div>
|
||||
|
||||
<!-- 兑换按钮 -->
|
||||
<Button
|
||||
class="w-full h-10 text-sm font-medium"
|
||||
:disabled="redeeming"
|
||||
@click="handleRedeem"
|
||||
>
|
||||
<RefreshCw v-if="redeeming" class="h-4 w-4 animate-spin" />
|
||||
<Gift v-else class="h-4 w-4" />
|
||||
{{ redeeming ? '兑换中...' : '立即兑换' }}
|
||||
</Button>
|
||||
<!-- 兑换 / 购买 两个动作并排 -->
|
||||
<div class="flex gap-2">
|
||||
<Button
|
||||
class="flex-1 h-10 text-sm font-medium"
|
||||
:disabled="redeeming"
|
||||
@click="handleRedeem"
|
||||
>
|
||||
<RefreshCw v-if="redeeming" class="h-4 w-4 animate-spin" />
|
||||
<Gift v-else class="h-4 w-4" />
|
||||
{{ redeeming ? '兑换中...' : '立即兑换' }}
|
||||
</Button>
|
||||
<!-- 没有 CDK 时直接去购买:等价于点击外层的「购买 CDK 兑换码」入口 -->
|
||||
<button
|
||||
type="button"
|
||||
class="press flex-1 h-10 rounded-xl text-sm font-semibold text-white flex items-center justify-center gap-1.5 cdk-goto-btn"
|
||||
@click="onBuyFromRedeemModal"
|
||||
>
|
||||
<ShoppingCart class="w-4 h-4" />
|
||||
没有 CDK?立即购买
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</AppDialog>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user