refactor: 完成项目目录重构与代码迁移
本次提交完成了整体项目的目录梳理与代码迁移: 1. 将根级controlplane、webhost等目录的代码迁移至desktop/对应子目录,统一桌面端架构 2. 移动并整理了插件目录结构,将插件统一放入根级plugins/ 3. 调整了前端项目的路径与配置,统一前后端开发构建流程 4. 清理了废弃的旧版app/目录与冗余的构建中间文件 5. 更新了.gitignore与README.md,适配新的项目结构
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { reactive, ref } from 'vue'
|
||||
import { adminOverview } from './api'
|
||||
|
||||
export const store = reactive({
|
||||
appName: '37du 内网插件控制面',
|
||||
isAdmin: false,
|
||||
current: _get('cp_account'),
|
||||
token: _get('cp_token'),
|
||||
})
|
||||
|
||||
// 概览数据缓存:各管理页共用一份 adminOverview 结果,避免切页重复拉取
|
||||
export const overview = ref(null)
|
||||
export const overviewBusy = ref(false)
|
||||
|
||||
export async function loadOverview(force = false) {
|
||||
if (overview.value && !force) return overview.value
|
||||
overviewBusy.value = true
|
||||
try {
|
||||
overview.value = await adminOverview()
|
||||
return overview.value
|
||||
} finally {
|
||||
overviewBusy.value = false
|
||||
}
|
||||
}
|
||||
|
||||
export function resetOverview() {
|
||||
overview.value = null
|
||||
}
|
||||
|
||||
function _get(key) {
|
||||
try { return localStorage.getItem(key) || '' } catch (_) { return '' }
|
||||
}
|
||||
|
||||
export function clearSession() {
|
||||
store.current = ''
|
||||
store.token = ''
|
||||
store.isAdmin = false
|
||||
resetOverview()
|
||||
try { localStorage.removeItem('cp_account'); localStorage.removeItem('cp_token') } catch (_) {}
|
||||
}
|
||||
Reference in New Issue
Block a user