优化支付宝支付流程与 Web 端体验
- 支付宝新窗口跳转,轮询与手动刷新增加加载反馈 - 支付回跳先校验订单状态,避免未付款误报成功 - 门户登录回调统一,云文件打开加载与版本冲突同步 - 精简本地 start.bat 与 README 说明 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -77,28 +77,42 @@
|
||||
? window.soonAuthedFetch(base + '/auth/me', { headers: { Authorization: 'Bearer ' + tok } })
|
||||
: fetch(base + '/auth/me', { headers: { Authorization: 'Bearer ' + tok } });
|
||||
meFetch
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (r) {
|
||||
if (r.status === 401) {
|
||||
clearSession();
|
||||
location.reload();
|
||||
return null;
|
||||
}
|
||||
if (!r.ok) {
|
||||
if (typeof window.soonToast === 'function') window.soonToast('网络异常,部分功能可能不可用', 'warn');
|
||||
return null;
|
||||
}
|
||||
return r.json();
|
||||
})
|
||||
.then(function (j) {
|
||||
if (!j) return;
|
||||
if (!j.ok || !j.data) {
|
||||
clearSession();
|
||||
location.reload();
|
||||
return;
|
||||
}
|
||||
if (typeof window.soonApplyMembership === 'function') {
|
||||
window.soonApplyMembership(j.data);
|
||||
}
|
||||
if (j.data.role === 'admin' && admin) admin.style.display = 'inline-flex';
|
||||
if (avatar && j.data.email) {
|
||||
avatar.style.display = 'inline-flex';
|
||||
avatar.textContent = j.data.email.charAt(0).toUpperCase();
|
||||
avatar.title = j.data.email;
|
||||
}
|
||||
if (typeof window.soonLoadMembership === 'function') {
|
||||
window.soonLoadMembership().then(function () {
|
||||
if (typeof window.soonRefreshPortalIdentity === 'function') {
|
||||
window.soonRefreshPortalIdentity();
|
||||
}
|
||||
});
|
||||
if (typeof window.soonRefreshPortalIdentity === 'function') {
|
||||
window.soonRefreshPortalIdentity();
|
||||
}
|
||||
if (typeof options.onAuthed === 'function') options.onAuthed(j.data);
|
||||
})
|
||||
.catch(function () { /* keep authed shell */ });
|
||||
.catch(function () {
|
||||
if (typeof window.soonToast === 'function') window.soonToast('网络异常,部分功能可能不可用', 'warn');
|
||||
});
|
||||
|
||||
if (logout) {
|
||||
logout.addEventListener('click', function (e) {
|
||||
|
||||
Reference in New Issue
Block a user