fix(user-center): restore ajax tab navigation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
02fcde3c84
commit
8a007b9ee7
3 files changed
+15
-8
No files matched your search
@@ -10,9 +10,8 @@
|
|||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
.uc-mobile-tabs {
|
.uc-mobile-tabs {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: wrap;
|
||||||
overflow-x: auto;
|
overflow: hidden;
|
||||||
overflow-y: hidden;
|
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
padding-bottom: 12px;
|
padding-bottom: 12px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
|
|||||||
@@ -226,6 +226,10 @@
|
|||||||
setWithdrawBusy(false);
|
setWithdrawBusy(false);
|
||||||
}).catch(function () { setWithdrawBusy(false); setWithdrawTip('网络错误,请稍后重试', true); });
|
}).catch(function () { setWithdrawBusy(false); setWithdrawTip('网络错误,请稍后重试', true); });
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initRewardNavigation(root, rest, data) {
|
||||||
var rewardTabs = root.querySelectorAll('.uc-reward-tabs a, .uc-reward-pagination a');
|
var rewardTabs = root.querySelectorAll('.uc-reward-tabs a, .uc-reward-pagination a');
|
||||||
rewardTabs.forEach(function (link) {
|
rewardTabs.forEach(function (link) {
|
||||||
link.addEventListener('click', function (event) {
|
link.addEventListener('click', function (event) {
|
||||||
@@ -246,16 +250,20 @@
|
|||||||
if (!next) throw new Error('revenue-html-empty');
|
if (!next) throw new Error('revenue-html-empty');
|
||||||
current.replaceWith(next);
|
current.replaceWith(next);
|
||||||
window.history.pushState({}, '', targetUrl);
|
window.history.pushState({}, '', targetUrl);
|
||||||
init(next);
|
window.AKSRTRevenueCenterInit(next);
|
||||||
});
|
});
|
||||||
}).catch(function () {
|
}).catch(function () {
|
||||||
if (typeof showToast === 'function') showToast('加载失败,请重试');
|
if (typeof showToast === 'function') showToast('加载失败,请重试');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.AKSRTRevenueCenterInit = init;
|
window.AKSRTRevenueCenterInit = function (root) {
|
||||||
init(document.querySelector('[data-aksrt-revenue-page]'));
|
init(root);
|
||||||
|
var data = window.aksrtData || {};
|
||||||
|
var rest = data.restUrl || data.apiUrl || '';
|
||||||
|
if (root && rest) initRewardNavigation(root, rest.replace(/\/$/, ''), data);
|
||||||
|
};
|
||||||
|
window.AKSRTRevenueCenterInit(document.querySelector('[data-aksrt-revenue-page]'));
|
||||||
})();
|
})();
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
var target = panels[name].panel;
|
var target = panels[name].panel;
|
||||||
if (target.dataset.panelLoaded === 'true') return Promise.resolve();
|
if (target.dataset.panelLoaded === 'true') return Promise.resolve();
|
||||||
if (target._aksrtPanelRequest) return target._aksrtPanelRequest;
|
if (target._aksrtPanelRequest) return target._aksrtPanelRequest;
|
||||||
var restUrl = (window.aksrtData && (window.aksrtData.restUrl || window.aksrtData.apiUrl)) || '';
|
var restUrl = (window.aksrtData && (window.aksrtData.restUrl || window.aksrtData.apiUrl)) || cfg.restUrl || '';
|
||||||
if (!restUrl) return Promise.reject(new Error('rest-unavailable'));
|
if (!restUrl) return Promise.reject(new Error('rest-unavailable'));
|
||||||
target.classList.add('is-loading');
|
target.classList.add('is-loading');
|
||||||
var url = restUrl.replace(/\/$/, '') + '/user-center/panel/' + encodeURIComponent(name);
|
var url = restUrl.replace(/\/$/, '') + '/user-center/panel/' + encodeURIComponent(name);
|
||||||
|
|||||||
Reference in new issue
Block a user