袁聪的前端调修
This commit is contained in:
@@ -33,6 +33,9 @@ const ADVISOR_LINKS = [
|
||||
|
||||
const OPERATOR_LINKS = [
|
||||
['operator-dashboard', '运营工作台', '/portal/employee-operations/dashboard/'],
|
||||
['operator-offsite', '场外申赎', '/portal/employee-operations/offsite/'],
|
||||
['operator-promotion', '推介材料', '/portal/employee-operations/promotion/'],
|
||||
['operator-nl2sql', 'NL2SQL', '/portal/employee-operations/nl2sql/'],
|
||||
['public-products', '公开产品', '/portal/guest/products/'],
|
||||
];
|
||||
|
||||
@@ -121,19 +124,26 @@ export function mountShell({ active, mode = 'public' }) {
|
||||
window.location.assign('/portal/guest/home/?reason=signed-out');
|
||||
});
|
||||
const networkStatus = document.querySelector('[data-network-status]');
|
||||
window.addEventListener('offline', () => {
|
||||
networkStatus.textContent = '网络已断开';
|
||||
let networkStatusTimer = 0;
|
||||
const hideNetworkStatus = () => {
|
||||
window.clearTimeout(networkStatusTimer);
|
||||
networkStatus.classList.remove('network-status--visible');
|
||||
};
|
||||
const showNetworkStatus = (message, duration = 3600) => {
|
||||
window.clearTimeout(networkStatusTimer);
|
||||
networkStatus.textContent = message;
|
||||
networkStatus.classList.add('network-status--visible');
|
||||
if (duration > 0) networkStatusTimer = window.setTimeout(hideNetworkStatus, duration);
|
||||
};
|
||||
window.addEventListener('offline', () => {
|
||||
showNetworkStatus('网络已断开', 0);
|
||||
});
|
||||
window.addEventListener('online', () => {
|
||||
networkStatus.textContent = '网络已恢复,请点击刷新';
|
||||
networkStatus.classList.add('network-status--visible');
|
||||
window.setTimeout(() => networkStatus.classList.remove('network-status--visible'), 3000);
|
||||
showNetworkStatus('网络已恢复,请点击刷新', 3000);
|
||||
});
|
||||
window.addEventListener('portal:error', (event) => {
|
||||
const detail = event.detail || {};
|
||||
networkStatus.textContent = detail.message || '请求未完成';
|
||||
networkStatus.classList.add('network-status--visible');
|
||||
showNetworkStatus(detail.message || '请求未完成');
|
||||
});
|
||||
if (new URLSearchParams(window.location.search).get('reason') === 'signed-out') {
|
||||
networkStatus.textContent = '您已安全退出登录';
|
||||
|
||||
Reference in New Issue
Block a user