修复两个问题

This commit is contained in:
kate522 committed 2026-08-24 16:38:03 +08:00
1 parent 48a82403b2
commit 58f3f42bf8
15 files changed
+173 -23

No files matched your search

+41
View File
@@ -56,6 +56,38 @@
});
}
function applyAssetBalances(data) {
data = data || {};
var wallet = data.wallet_balance !== undefined ? data.wallet_balance : data.wallet;
var points = data.credit_balance !== undefined ? data.credit_balance : data.points_balance;
if (wallet !== undefined && wallet !== null && wallet !== '') {
var walletNumber = Number(wallet);
var walletText = Number.isFinite(walletNumber) ? walletNumber.toFixed(2) : String(wallet);
document.querySelectorAll('[data-aksrt-wallet-value]').forEach(function (element) {
element.textContent = walletText;
});
}
if (points !== undefined && points !== null && points !== '') {
var pointsNumber = Number(points);
var pointsText = Number.isFinite(pointsNumber) ? pointsNumber.toLocaleString() : String(points);
document.querySelectorAll('[data-aksrt-points-value]').forEach(function (element) {
element.textContent = pointsText;
});
}
}
function refreshAssetBalances(snapshot) {
if (snapshot && (snapshot.wallet_balance !== undefined || snapshot.wallet !== undefined)) {
applyAssetBalances(snapshot);
}
return api('/pay/assets').then(function (response) {
if (!response.ok) return null;
var data = response.data || (response.json && response.json.data) || response.json || {};
applyAssetBalances(data);
return data;
});
}
// Task-list "去签到" → scroll + click the real asset-card sign-in button.
function initSigninGoto() {
document.querySelectorAll('[data-aksrt-signin-goto]').forEach(function (el) {
@@ -333,6 +365,7 @@
activePoll = null;
if (result.success) {
notyf('支付成功,正在刷新…', 'success', 5, 'aksrt-balance-charge-payment-toast');
refreshAssetBalances();
window.setTimeout(function () { window.location.reload(); }, 800);
return;
}
@@ -416,6 +449,7 @@
return;
}
notyf((data && data.message) || '充值成功,正在刷新…', 'success', 5, 'aksrt-balance-charge-toast');
refreshAssetBalances(data);
window.setTimeout(function () { window.location.reload(); }, 800);
}).catch(function () {
busy = false;
@@ -547,6 +581,7 @@
var data = (r.json && r.json.data) ? r.json.data : r.json;
resetOperationKey(form);
notyf((data && data.message) || '转账成功,正在刷新…', 'success', 5, 'aksrt-balance-transfer-toast');
refreshAssetBalances();
window.setTimeout(function () { window.location.reload(); }, 800);
}).catch(function () {
busy = false;
@@ -606,6 +641,7 @@
var data = (r.json && r.json.data) ? r.json.data : r.json;
resetOperationKey(form);
notyf((data && data.message) || '购买成功,正在刷新…', 'success', 5, 'aksrt-balance-points-toast');
refreshAssetBalances(data);
window.setTimeout(function () { window.location.reload(); }, 800);
}).catch(function () {
busy = false;
@@ -742,8 +778,13 @@
}
window.AKSRTWithdrawInit = initWithdraw;
window.AKSRTAssetBalances = {
apply: applyAssetBalances,
refresh: refreshAssetBalances
};
function bootAssets() {
refreshAssetBalances();
initSigninGoto();
initAffiliateRevenue();
initVipShop();
+3 -2
View File
@@ -82,11 +82,12 @@
}
target.classList.add('is-loading');
var url = restUrl.replace(/\/$/, '') + '/user-center/panel/' + encodeURIComponent(name);
if (name === 'creator' || name === 'revenue' || name === 'posts' || name === 'follow') {
if (name === 'creator' || name === 'revenue' || name === 'posts' || name === 'follow' || name === 'orders') {
var params = queryParams || new URLSearchParams(window.location.search);
var allowedParams = name === 'creator' ? ['income_page'] :
(name === 'revenue' ? ['reward_tab', 'commission_page', 'user_page'] :
(name === 'posts' ? ['post_status', 'posts_page'] : ['follow_list', 'follow_page']));
(name === 'posts' ? ['post_status', 'posts_page'] :
(name === 'follow' ? ['follow_list', 'follow_page'] : ['order_status', 'order_type', 'order_number', 'order_page'])));
allowedParams.forEach(function(key) {
if (params.get(key)) url += (url.indexOf('?') === -1 ? '?' : '&') + key + '=' + encodeURIComponent(params.get(key));
});