fix(frontend): 卡密兑换通知接入全局 notyf Toast 固定 id 流
- credits.js initCardPass 从 setTip 内联提示迁移为固定 id 三态 notyf 流 (aksrt-card-pass-toast:load → success/danger 原位更新), 成功后延迟 800ms 刷新以保证成功 Toast 可见,对齐其余资产操作。 - credits-wallet.php 删除 data-aksrt-card-tip 死元素;credits.css 删除 .uc-card-pass__tip 死样式。 - 契约:toast-contract 将卡密兑换纳入固定 id 流清单并禁止 tip 回潮; card-pass-universal-redeem 新增 Toast 流断言(27/27 通过)。 - 验证:容器内真实抓取 /user/balance/ 确认弹窗正常渲染且无 tip 残留。
This commit is contained in:
1 parent
64ed47165d
commit
1889c9f048
5 files changed
+28
-26
No files matched your search
@@ -849,13 +849,6 @@ body.uc-modal-open {
|
||||
justify-content: flex-end;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.uc-card-pass__tip {
|
||||
margin: 8px 0 0;
|
||||
font-size: 12px;
|
||||
color: #059669;
|
||||
min-height: 1.2em;
|
||||
}
|
||||
.uc-card-pass__tip.is-error { color: #b91c1c; }
|
||||
|
||||
|
||||
|
||||
|
||||
+6
-13
@@ -286,16 +286,9 @@
|
||||
});
|
||||
|
||||
Array.prototype.forEach.call(roots, function (root) {
|
||||
var tip = root.querySelector('[data-aksrt-card-tip]');
|
||||
var busy = false;
|
||||
resetOperationKeyOnChange(root);
|
||||
|
||||
function setTip(text, isError) {
|
||||
if (!tip) return;
|
||||
tip.textContent = text || '';
|
||||
tip.classList.toggle('is-error', !!isError);
|
||||
}
|
||||
|
||||
var btn = root.querySelector('[data-aksrt-card-redeem]');
|
||||
if (!btn) return;
|
||||
|
||||
@@ -308,14 +301,14 @@
|
||||
var card = cardInput ? String(cardInput.value || '').trim() : '';
|
||||
// 卡号为选填:是否需要卡号由后端按卡密类型判定并返回错误提示。
|
||||
if (!password) {
|
||||
setTip('请输入卡密', true);
|
||||
notyf('请输入卡密', 'danger');
|
||||
if (pwInput) pwInput.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
busy = true;
|
||||
btn.disabled = true;
|
||||
setTip('正在兑换…');
|
||||
notyf('正在兑换…', 'load', '', 'aksrt-card-pass-toast');
|
||||
|
||||
var body = { password: password, type: type };
|
||||
if (card) body.card = card;
|
||||
@@ -328,7 +321,7 @@
|
||||
busy = false;
|
||||
btn.disabled = false;
|
||||
if (!r.ok || (r.json && r.json.code && !r.json.success)) {
|
||||
setTip((r.json && r.json.message) || '兑换失败', true);
|
||||
notyf((r.json && r.json.message) || '兑换失败', 'danger', 5, 'aksrt-card-pass-toast');
|
||||
return;
|
||||
}
|
||||
var data = (r.json && r.json.data) ? r.json.data : r.json;
|
||||
@@ -338,12 +331,12 @@
|
||||
if (redeemedType === 'vip' && window.AksrtModalRuntime && typeof window.AksrtModalRuntime.invalidate === 'function') {
|
||||
window.AksrtModalRuntime.invalidate(['vip', 'orders']);
|
||||
}
|
||||
setTip((data && data.message) || '兑换成功,正在刷新…');
|
||||
window.location.reload();
|
||||
notyf((data && data.message) || '兑换成功,正在刷新…', 'success', 5, 'aksrt-card-pass-toast');
|
||||
window.setTimeout(function () { window.location.reload(); }, 800);
|
||||
}).catch(function () {
|
||||
busy = false;
|
||||
btn.disabled = false;
|
||||
setTip('网络错误,请重试', true);
|
||||
notyf('网络错误,请重试', 'danger', 5, 'aksrt-card-pass-toast');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user