重构 monorepo 并完善网页端订阅与首页体验
- 迁移为 frontend-web、frontend-electron、backend-web 与 docker 部署结构 - 网页端:订阅门禁二次弹窗、套餐/支付组件化、顶栏分组对齐 - 首页:最近文件与模板库布局优化,缩略图对齐,下载与删除操作 - 新增管理后台、支付与云端文件 API,更新 README 与项目规范 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function init() {
|
||||
if (!AdminApi.getToken()) {
|
||||
AdminApi.goLogin();
|
||||
return;
|
||||
}
|
||||
|
||||
var headerMount = document.getElementById('adminHeaderMount');
|
||||
var env = (window.SOON_DEPLOY_CONFIG && window.SOON_DEPLOY_CONFIG.env) || '';
|
||||
if (headerMount && window.AdminShell) {
|
||||
AdminShell.mountHeader(headerMount, { env: env || '' });
|
||||
}
|
||||
|
||||
AdminApi.fetchMe().then(function (me) {
|
||||
if (!me || me.role !== 'admin') {
|
||||
soonToast('需要管理员权限', 'warn');
|
||||
AdminApi.clearToken();
|
||||
setTimeout(AdminApi.goLogin, 600);
|
||||
return;
|
||||
}
|
||||
AdminState.currentAdminId = me.id;
|
||||
AdminState.adminLevel = AdminPermissions.normalizeLevel(me.admin_level);
|
||||
var emailEl = document.getElementById('adminEmail');
|
||||
if (emailEl) {
|
||||
var levelLabel = AdminState.adminLevel === 'ops' ? '运营' : '';
|
||||
emailEl.textContent = (me.email || '') + (levelLabel ? ' · ' + levelLabel : '');
|
||||
}
|
||||
|
||||
document.getElementById('adminLogout').onclick = function () {
|
||||
AdminApi.clearToken();
|
||||
AdminApi.goLogin();
|
||||
};
|
||||
|
||||
AdminPermissions.applyNav(AdminState.adminLevel);
|
||||
AdminRouter.init(AdminViews);
|
||||
});
|
||||
}
|
||||
|
||||
function boot() {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof layui !== 'undefined') {
|
||||
layui.use(['layer'], function () {
|
||||
window.layer = layui.layer;
|
||||
layer.config({ skin: 'soon-layer' });
|
||||
boot();
|
||||
});
|
||||
} else {
|
||||
boot();
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user