1. 移除naive-ui依赖,迁移前端至Element Plus 2. 重构后端数据库层,切换为MySQL替代SQLite 3. 调整项目部署架构,停止exe打包改为源码部署 4. 新增设备上报接口与相关数据库模型 5. 优化配置路径与SQL语法,替换为MySQL占位符格式 6. 调整站点名称与文案,统一为「37du 插件管理平台」 7. 新增SQLite到MySQL迁移脚本
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
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'),
|
|
nickname: '',
|
|
})
|
|
|
|
// 概览数据缓存:各管理页共用一份 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
|
|
store.nickname = ''
|
|
resetOverview()
|
|
try { localStorage.removeItem('cp_account'); localStorage.removeItem('cp_token') } catch (_) {}
|
|
} |