Browse Source

删除测试菜单,修复本地缓存

master
hejl 6 days ago
parent
commit
dbda667abd
  1. 988
      gofaster/app/dist/renderer/js/index.js
  2. 3
      gofaster/app/package.json
  3. 89
      gofaster/app/src/main/index.js
  4. 6
      gofaster/app/src/preload.js
  5. 97
      gofaster/app/src/renderer/components/MainLayout.vue
  6. 107
      gofaster/app/src/renderer/modules/business-features/components/SpeedTest.vue
  7. 11
      gofaster/app/src/renderer/modules/business-features/index.js
  8. 42
      gofaster/app/src/renderer/modules/business-features/services/history.js
  9. 35
      gofaster/app/src/renderer/modules/business-features/services/speedTest.js
  10. 99
      gofaster/app/src/renderer/modules/business-features/views/History.vue
  11. 9
      gofaster/app/src/renderer/modules/config.js
  12. 97
      gofaster/app/src/renderer/modules/core/components/MainLayout.vue
  13. 18
      gofaster/app/src/renderer/modules/core/services/db.js
  14. 37
      gofaster/app/src/renderer/modules/core/views/Home.vue
  15. 4
      gofaster/app/src/renderer/modules/example-usage.js
  16. 3
      gofaster/app/src/renderer/modules/index.js
  17. 12
      gofaster/app/src/renderer/router/index.js
  18. 68
      gofaster/clear-electron-cache.ps1

988
gofaster/app/dist/renderer/js/index.js vendored

File diff suppressed because it is too large Load Diff

3
gofaster/app/package.json

@ -21,7 +21,8 @@ @@ -21,7 +21,8 @@
"start:fixed": "powershell -ExecutionPolicy Bypass -File start-fixed.ps1",
"start:fixed-debug": "powershell -ExecutionPolicy Bypass -File start-fixed.ps1 -Debug",
"diagnose": "powershell -ExecutionPolicy Bypass -File diagnose.ps1",
"diagnose:fix": "powershell -ExecutionPolicy Bypass -File diagnose.ps1 -Fix"
"diagnose:fix": "powershell -ExecutionPolicy Bypass -File diagnose.ps1 -Fix",
"clear:cache": "powershell -ExecutionPolicy Bypass -File ../clear-electron-cache.ps1"
},
"keywords": [],
"author": "",

89
gofaster/app/src/main/index.js

@ -255,7 +255,11 @@ function createWindow() { @@ -255,7 +255,11 @@ function createWindow() {
sandbox: false, // 保持false以支持preload脚本
// 禁用eval相关功能
enableBlinkFeatures: '',
disableBlinkFeatures: 'Auxclick'
disableBlinkFeatures: 'Auxclick',
// 缓存配置 - 禁用缓存以避免权限问题
partition: 'persist:main',
// 禁用缓存相关功能
backgroundThrottling: false
},
// 添加字体配置,确保中文正常显示
titleBarStyle: 'default',
@ -527,6 +531,46 @@ function createWindow() { @@ -527,6 +531,46 @@ function createWindow() {
if (app && typeof app.whenReady === 'function') {
app.whenReady().then(() => {
// 清理Electron缓存和用户数据
try {
const userDataPath = app.getPath('userData')
const cachePath = path.join(userDataPath, 'Cache')
const codeCachePath = path.join(userDataPath, 'Code Cache')
const gpuCachePath = path.join(userDataPath, 'GPUCache')
const sessionStoragePath = path.join(userDataPath, 'Session Storage')
console.log('🔧 开始清理Electron缓存...')
console.log('用户数据路径:', userDataPath)
// 清理各种缓存目录
const cacheDirs = [cachePath, codeCachePath, gpuCachePath, sessionStoragePath]
cacheDirs.forEach(cacheDir => {
if (fs.existsSync(cacheDir)) {
try {
fs.rmSync(cacheDir, { recursive: true, force: true })
console.log('✅ 已清理缓存目录:', cacheDir)
} catch (error) {
console.warn('⚠ 清理缓存目录失败:', cacheDir, error.message)
}
}
})
// 清理localStorage相关文件
const localStoragePath = path.join(userDataPath, 'Local Storage')
if (fs.existsSync(localStoragePath)) {
try {
fs.rmSync(localStoragePath, { recursive: true, force: true })
console.log('✅ 已清理Local Storage目录')
} catch (error) {
console.warn('⚠ 清理Local Storage失败:', error.message)
}
}
console.log('✅ Electron缓存清理完成')
} catch (error) {
console.error('❌ 清理Electron缓存失败:', error)
}
// 初始化窗口状态管理器
initWindowStateManager()
@ -619,6 +663,47 @@ if (app && typeof app.whenReady === 'function') { @@ -619,6 +663,47 @@ if (app && typeof app.whenReady === 'function') {
return { path: logFilePath }
});
// 清理Electron缓存的IPC处理器
ipcMain.handle('clear-electron-cache', async () => {
try {
const userDataPath = app.getPath('userData')
const cachePath = path.join(userDataPath, 'Cache')
const codeCachePath = path.join(userDataPath, 'Code Cache')
const gpuCachePath = path.join(userDataPath, 'GPUCache')
const sessionStoragePath = path.join(userDataPath, 'Session Storage')
const localStoragePath = path.join(userDataPath, 'Local Storage')
console.log('🔧 通过IPC清理Electron缓存...')
const cacheDirs = [cachePath, codeCachePath, gpuCachePath, sessionStoragePath, localStoragePath]
let clearedCount = 0
cacheDirs.forEach(cacheDir => {
if (fs.existsSync(cacheDir)) {
try {
fs.rmSync(cacheDir, { recursive: true, force: true })
console.log('✅ 已清理缓存目录:', cacheDir)
clearedCount++
} catch (error) {
console.warn('⚠ 清理缓存目录失败:', cacheDir, error.message)
}
}
})
return {
success: true,
message: `缓存清理完成,已清理 ${clearedCount} 个目录`,
clearedCount: clearedCount
}
} catch (error) {
console.error('❌ 清理Electron缓存失败:', error)
return {
success: false,
message: '清理缓存失败: ' + error.message
}
}
});
// 打开日志文件所在文件夹
ipcMain.handle('open-log-folder', async () => {
try {
@ -720,7 +805,7 @@ if (app && typeof app.whenReady === 'function') { @@ -720,7 +805,7 @@ if (app && typeof app.whenReady === 'function') {
message: '获取窗口状态信息失败: ' + error.message
}
}
})
});
}); // 闭合 app.whenReady().then() 的回调函数
} else {

6
gofaster/app/src/preload.js

@ -11,6 +11,8 @@ contextBridge.exposeInMainWorld('electronAPI', { @@ -11,6 +11,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
onErrorLogUpdated: (callback) => ipcRenderer.on('error-log-updated', callback),
openLogFolder: () => ipcRenderer.invoke('open-log-folder'),
getLocalIP: () => ipcRenderer.invoke('get-local-ip'),
// 添加应用关闭事件监听
onAppWillClose: (callback) => ipcRenderer.on('app-will-close', callback)
// 添加应用关闭事件监听
onAppWillClose: (callback) => ipcRenderer.on('app-will-close', callback),
// 清理Electron缓存
clearElectronCache: () => ipcRenderer.invoke('clear-electron-cache')
})

97
gofaster/app/src/renderer/components/MainLayout.vue

@ -74,6 +74,9 @@ @@ -74,6 +74,9 @@
<button class="menu-item" @click="openSettings">
<i class="icon"></i> 用户设置
</button>
<button class="menu-item" @click="clearCache">
<i class="icon">🧹</i> 清理缓存
</button>
<button class="menu-item" @click="logout">
<i class="icon">🚪</i> 退出登录
</button>
@ -302,9 +305,7 @@ export default { @@ -302,9 +305,7 @@ export default {
const allMenuItems = ref([
{ id: 'home', name: '欢迎', path: '/', icon: '🏠', favorite: false, requireAuth: false },
{ id: 'speed-test', name: '速度测试', path: '/speed-test', icon: '⚡', favorite: false, requireAuth: true },
{ id: 'user-management', name: '用户管理', path: '/user-management', icon: '👥', favorite: false, requireAuth: true },
{ id: 'history', name: '历史记录', path: '/history', icon: '📊', favorite: false, requireAuth: true },
{ id: 'user-profile', name: '个人资料', path: '/user-profile', icon: '👤', favorite: false, requireAuth: true },
{ id: 'settings', name: '用户设置', path: '/settings', icon: '⚙', favorite: false, requireAuth: false }
])
@ -329,8 +330,6 @@ export default { @@ -329,8 +330,6 @@ export default {
const path = route.path
if (path === '/') return ['欢迎']
if (path === '/user-management') return ['欢迎', '用户管理']
if (path === '/speed-test') return ['欢迎', '速度测试']
if (path === '/history') return ['欢迎', '历史记录']
if (path === '/settings') return ['欢迎', '用户设置']
if (path === '/user-profile') return ['欢迎', '个人资料']
return ['欢迎']
@ -902,6 +901,56 @@ export default { @@ -902,6 +901,56 @@ export default {
}
}
const clearCache = async () => {
try {
console.log('🧹 开始清理缓存...')
// localStorage
const keysToClear = [
'gofaster-settings',
'isLoggedIn',
'token',
'user',
'app-settings',
'theme-settings',
'user-preferences'
]
keysToClear.forEach(key => {
if (localStorage.getItem(key)) {
localStorage.removeItem(key)
console.log('✅ 已清理localStorage键:', key)
}
})
// gofaster
const allKeys = Object.keys(localStorage)
allKeys.forEach(key => {
if (key.startsWith('gofaster') || key.startsWith('electron')) {
localStorage.removeItem(key)
console.log('✅ 已清理localStorage键:', key)
}
})
// IPCElectron
if (window.electronAPI && window.electronAPI.clearElectronCache) {
const result = await window.electronAPI.clearElectronCache()
if (result.success) {
showToastMessage('success', '缓存清理成功', result.message)
} else {
showToastMessage('warning', '缓存清理部分失败', result.message)
}
} else {
showToastMessage('warning', '缓存清理', 'localStorage已清理,但无法清理Electron缓存')
}
console.log('✅ 缓存清理完成')
} catch (error) {
console.error('❌ 清理缓存失败:', error)
showToastMessage('error', '缓存清理失败', '清理缓存时发生错误: ' + error.message)
}
}
const logout = async () => {
try {
// token
@ -1003,9 +1052,43 @@ export default { @@ -1003,9 +1052,43 @@ export default {
}
}
onMounted(() => {
//
updateFavoriteMenu()
onMounted(() => {
// localStorage
try {
console.log('🔧 开始清理localStorage...')
const keysToClear = [
'gofaster-settings',
'isLoggedIn',
'token',
'user',
'app-settings',
'theme-settings',
'user-preferences'
]
keysToClear.forEach(key => {
if (localStorage.getItem(key)) {
localStorage.removeItem(key)
console.log('✅ 已清理localStorage键:', key)
}
})
// gofaster
const allKeys = Object.keys(localStorage)
allKeys.forEach(key => {
if (key.startsWith('gofaster') || key.startsWith('electron')) {
localStorage.removeItem(key)
console.log('✅ 已清理localStorage键:', key)
}
})
console.log('✅ localStorage清理完成')
} catch (error) {
console.error('❌ 清理localStorage失败:', error)
}
//
updateFavoriteMenu()
//
const userActivityEvents = ['mousedown', 'mousemove', 'keypress', 'scroll', 'touchstart', 'click']

107
gofaster/app/src/renderer/modules/business-features/components/SpeedTest.vue

@ -1,107 +0,0 @@ @@ -1,107 +0,0 @@
<template>
<div class="speed-test">
<h1>GoFaster Speed Test</h1>
<button @click="startTest" :disabled="testing">
{{ testing ? 'Testing...' : 'Start Test' }}
</button>
<div v-if="result" class="results">
<h3>Test Results:</h3>
<div class="result-item">
<span class="label">Download:</span>
<span class="value">{{ result.download }} Mbps</span>
</div>
<div class="result-item">
<span class="label">Upload:</span>
<span class="value">{{ result.upload }} Mbps</span>
</div>
<div class="result-item">
<span class="label">Ping:</span>
<span class="value">{{ result.ping }} ms</span>
</div>
</div>
</div>
</template>
<script>
import { ref } from 'vue'
import { useStore } from 'vuex'
export default {
name: 'SpeedTest',
setup() {
const store = useStore()
const testing = ref(false)
const result = ref(null)
const startTest = async () => {
testing.value = true
result.value = null
// ()
await new Promise(resolve => setTimeout(resolve, 2000))
const testResult = {
download: (Math.random() * 100).toFixed(2),
upload: (Math.random() * 50).toFixed(2),
ping: (Math.random() * 100).toFixed(2),
timestamp: new Date().toISOString()
}
//
await store.dispatch('saveTestResult', testResult)
result.value = testResult
testing.value = false
}
return { testing, result, startTest }
}
}
</script>
<style scoped>
.speed-test {
padding: 20px;
max-width: 600px;
margin: 0 auto;
text-align: center;
}
button {
padding: 10px 20px;
font-size: 16px;
background-color: #42b983;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
margin: 20px 0;
}
button:disabled {
background-color: #cccccc;
cursor: not-allowed;
}
.results {
margin-top: 20px;
padding: 15px;
background-color: #f5f5f5;
border-radius: 4px;
text-align: left;
}
.result-item {
margin: 10px 0;
display: flex;
justify-content: space-between;
}
.label {
font-weight: bold;
}
.value {
color: #42b983;
}
</style>

11
gofaster/app/src/renderer/modules/business-features/index.js

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
// 业务功能模块入口文件
// 速度测试功能
export { default as SpeedTest } from './components/SpeedTest.vue'
// 历史记录功能
export { default as History } from './views/History.vue'
// 业务服务
export { default as speedTestService } from './services/speedTest.js'
export { default as historyService } from './services/history.js'

42
gofaster/app/src/renderer/modules/business-features/services/history.js

@ -1,42 +0,0 @@ @@ -1,42 +0,0 @@
// 历史记录服务
class HistoryService {
constructor() {
this.testResults = []
}
// 加载测试结果
async loadTestResults() {
// 从本地存储或数据库加载测试结果
const stored = localStorage.getItem('gofaster-test-results')
if (stored) {
this.testResults = JSON.parse(stored)
}
return this.testResults
}
// 保存测试结果
async saveTestResult(result) {
this.testResults.push(result)
localStorage.setItem('gofaster-test-results', JSON.stringify(this.testResults))
return result
}
// 获取测试结果
getTestResults() {
return this.testResults
}
// 清除测试结果
async clearTestResults() {
this.testResults = []
localStorage.removeItem('gofaster-test-results')
}
// 格式化日期
formatDate(timestamp) {
return new Date(timestamp).toLocaleString()
}
}
export default new HistoryService()

35
gofaster/app/src/renderer/modules/business-features/services/speedTest.js

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
// 速度测试服务
class SpeedTestService {
constructor() {
this.testResults = []
}
// 开始速度测试
async startTest() {
// 模拟网络测试 (替换为真实测试逻辑)
await new Promise(resolve => setTimeout(resolve, 2000))
const testResult = {
download: (Math.random() * 100).toFixed(2),
upload: (Math.random() * 50).toFixed(2),
ping: (Math.random() * 100).toFixed(2),
timestamp: new Date().toISOString()
}
this.testResults.push(testResult)
return testResult
}
// 获取测试结果
getTestResults() {
return this.testResults
}
// 清除测试结果
clearTestResults() {
this.testResults = []
}
}
export default new SpeedTestService()

99
gofaster/app/src/renderer/modules/business-features/views/History.vue

@ -1,99 +0,0 @@ @@ -1,99 +0,0 @@
<template>
<div class="history-view">
<h1>Test History</h1>
<div v-if="testResults.length === 0" class="empty-state">
No speed tests recorded yet.
</div>
<div v-else class="history-list">
<div v-for="(result, index) in testResults" :key="index" class="history-item">
<div class="history-date">
{{ formatDate(result.timestamp) }}
</div>
<div class="history-stats">
<span class="stat download"> {{ result.download }} Mbps</span>
<span class="stat upload"> {{ result.upload }} Mbps</span>
<span class="stat ping"> {{ result.ping }} ms</span>
</div>
</div>
</div>
</div>
</template>
<script>
import { computed, onMounted } from 'vue'
import { useStore } from 'vuex'
export default {
name: 'HistoryView',
setup() {
const store = useStore()
onMounted(() => {
store.dispatch('loadTestResults')
})
const testResults = computed(() => store.state.testResults)
const formatDate = (timestamp) => {
return new Date(timestamp).toLocaleString()
}
return { testResults, formatDate }
}
}
</script>
<style scoped>
.history-view {
padding: 20px;
max-width: 800px;
margin: 0 auto;
}
.empty-state {
text-align: center;
padding: 40px;
color: #888;
}
.history-list {
margin-top: 20px;
}
.history-item {
padding: 15px;
margin-bottom: 10px;
background-color: #f9f9f9;
border-radius: 4px;
display: flex;
justify-content: space-between;
align-items: center;
}
.history-date {
color: #666;
}
.history-stats {
display: flex;
gap: 15px;
}
.stat {
font-weight: bold;
}
.download {
color: #42b983;
}
.upload {
color: #3498db;
}
.ping {
color: #e74c3c;
}
</style>

9
gofaster/app/src/renderer/modules/config.js

@ -28,14 +28,7 @@ export const MODULE_CONFIG = { @@ -28,14 +28,7 @@ export const MODULE_CONFIG = {
priority: 3
},
// 业务功能模块配置
'business-features': {
name: 'Business Features',
description: '业务功能模块',
version: '1.0.0',
dependencies: ['core', 'user-management'],
priority: 4
}
}
// 获取模块配置

97
gofaster/app/src/renderer/modules/core/components/MainLayout.vue

@ -76,6 +76,9 @@ @@ -76,6 +76,9 @@
<button class="menu-item" @click="openSettings">
<i class="fas fa-cog"></i> 用户设置
</button>
<button class="menu-item" @click="clearCache">
<i class="fas fa-broom"></i> 清理缓存
</button>
<button class="menu-item" @click="logout">
<i class="fas fa-sign-out-alt"></i> 退出登录
</button>
@ -304,10 +307,8 @@ export default { @@ -304,10 +307,8 @@ export default {
const allMenuItems = ref([
{ id: 'home', name: '欢迎', path: '/', icon: 'home', favorite: false, requireAuth: false },
{ id: 'speed-test', name: '速度测试', path: '/speed-test', icon: 'bolt', favorite: false, requireAuth: true },
{ id: 'user-management', name: '用户管理', path: '/user-management', icon: 'users', favorite: false, requireAuth: true },
{ id: 'role-management', name: '角色管理', path: '/role-management', icon: 'user-shield', favorite: false, requireAuth: true },
{ id: 'history', name: '历史记录', path: '/history', icon: 'chart-bar', favorite: false, requireAuth: true },
{ id: 'user-profile', name: '个人资料', path: '/user-profile', icon: 'user', favorite: false, requireAuth: true },
{ id: 'settings', name: '用户设置', path: '/settings', icon: 'cog', favorite: false, requireAuth: false }
])
@ -333,8 +334,6 @@ export default { @@ -333,8 +334,6 @@ export default {
if (path === '/') return ['欢迎']
if (path === '/user-management') return ['欢迎', '用户管理']
if (path === '/role-management') return ['欢迎', '角色管理']
if (path === '/speed-test') return ['欢迎', '速度测试']
if (path === '/history') return ['欢迎', '历史记录']
if (path === '/settings') return ['欢迎', '用户设置']
if (path === '/user-profile') return ['欢迎', '个人资料']
return ['欢迎']
@ -903,6 +902,56 @@ export default { @@ -903,6 +902,56 @@ export default {
}
}
const clearCache = async () => {
try {
console.log('🧹 开始清理缓存...')
// localStorage
const keysToClear = [
'gofaster-settings',
'isLoggedIn',
'token',
'user',
'app-settings',
'theme-settings',
'user-preferences'
]
keysToClear.forEach(key => {
if (localStorage.getItem(key)) {
localStorage.removeItem(key)
console.log('✅ 已清理localStorage键:', key)
}
})
// gofaster
const allKeys = Object.keys(localStorage)
allKeys.forEach(key => {
if (key.startsWith('gofaster') || key.startsWith('electron')) {
localStorage.removeItem(key)
console.log('✅ 已清理localStorage键:', key)
}
})
// IPCElectron
if (window.electronAPI && window.electronAPI.clearElectronCache) {
const result = await window.electronAPI.clearElectronCache()
if (result.success) {
showToastMessage('success', '缓存清理成功', result.message)
} else {
showToastMessage('warning', '缓存清理部分失败', result.message)
}
} else {
showToastMessage('warning', '缓存清理', 'localStorage已清理,但无法清理Electron缓存')
}
console.log('✅ 缓存清理完成')
} catch (error) {
console.error('❌ 清理缓存失败:', error)
showToastMessage('error', '缓存清理失败', '清理缓存时发生错误: ' + error.message)
}
}
const logout = async () => {
try {
// token
@ -1004,9 +1053,43 @@ export default { @@ -1004,9 +1053,43 @@ export default {
}
}
onMounted(() => {
//
updateFavoriteMenu()
onMounted(() => {
// localStorage
try {
console.log('🔧 开始清理localStorage...')
const keysToClear = [
'gofaster-settings',
'isLoggedIn',
'token',
'user',
'app-settings',
'theme-settings',
'user-preferences'
]
keysToClear.forEach(key => {
if (localStorage.getItem(key)) {
localStorage.removeItem(key)
console.log('✅ 已清理localStorage键:', key)
}
})
// gofaster
const allKeys = Object.keys(localStorage)
allKeys.forEach(key => {
if (key.startsWith('gofaster') || key.startsWith('electron')) {
localStorage.removeItem(key)
console.log('✅ 已清理localStorage键:', key)
}
})
console.log('✅ localStorage清理完成')
} catch (error) {
console.error('❌ 清理localStorage失败:', error)
}
//
updateFavoriteMenu()
//
const userActivityEvents = ['mousedown', 'mousemove', 'keypress', 'scroll', 'touchstart', 'click']

18
gofaster/app/src/renderer/modules/core/services/db.js

@ -44,23 +44,23 @@ async function initDB() { @@ -44,23 +44,23 @@ async function initDB() {
settings: {},
activities: [],
stats: {
totalTests: 0,
avgSpeed: '0 Mbps',
bestSpeed: '0 Mbps'
totalUsers: 0,
lastLogin: null,
profileComplete: false
},
userInfo: {
name: '用户',
email: 'user@example.com'
},
todoList: [
{ id: 1, text: '完成网络速度测试', completed: false, date: '今天' },
{ id: 2, text: '查看历史测试记录', completed: true, date: '昨天' },
{ id: 3, text: '配置测试参数', completed: false, date: '明天' }
{ id: 1, text: '完善个人资料', completed: false, date: '今天' },
{ id: 2, text: '查看系统设置', completed: true, date: '昨天' },
{ id: 3, text: '配置用户偏好', completed: false, date: '明天' }
],
recentActivities: [
{ id: 1, icon: '', title: '完成速度测试', time: '2小时前' },
{ id: 2, icon: '📊', title: '查看测试报告', time: '昨天' },
{ id: 3, icon: '', title: '更新设置', time: '3天前' }
{ id: 1, icon: '👤', title: '更新个人资料', time: '2小时前' },
{ id: 2, icon: '', title: '修改系统设置', time: '昨天' },
{ id: 3, icon: '🛡', title: '安全设置更新', time: '3天前' }
]
};

37
gofaster/app/src/renderer/modules/core/views/Home.vue

@ -19,16 +19,6 @@ @@ -19,16 +19,6 @@
<!-- 功能卡片区域 -->
<section v-if="isLoggedIn" class="features-section">
<div class="feature-card" @click="startSpeedTest">
<div class="feature-icon"><i class="fas fa-bolt"></i></div>
<h3>开始速度测试</h3>
<p>测试您的网络连接速度</p>
</div>
<div class="feature-card" @click="viewHistory">
<div class="feature-icon"><i class="fas fa-chart-bar"></i></div>
<h3>查看历史</h3>
<p>查看历史测试记录</p>
</div>
<div class="feature-card" @click="openSettings">
<div class="feature-icon"><i class="fas fa-cog"></i></div>
<h3>用户设置</h3>
@ -37,7 +27,7 @@ @@ -37,7 +27,7 @@
<div class="feature-card" @click="exportData">
<div class="feature-icon"><i class="fas fa-download"></i></div>
<h3>导出数据</h3>
<p>导出测试数据</p>
<p>导出个人数据</p>
</div>
</section>
@ -114,19 +104,19 @@ export default { @@ -114,19 +104,19 @@ export default {
},
currentDate: '',
stats: {
totalTests: 0,
avgSpeed: '0 Mbps',
bestSpeed: '0 Mbps'
totalUsers: 0,
lastLogin: null,
profileComplete: false
},
todoList: [
{ id: 1, text: '完成网络速度测试', completed: false, date: '今天' },
{ id: 2, text: '查看历史测试记录', completed: true, date: '昨天' },
{ id: 3, text: '配置测试参数', completed: false, date: '明天' }
{ id: 1, text: '完善个人资料', completed: false, date: '今天' },
{ id: 2, text: '查看系统设置', completed: true, date: '昨天' },
{ id: 3, text: '配置用户偏好', completed: false, date: '明天' }
],
recentActivities: [
{ id: 1, icon: 'fas fa-bolt', title: '完成速度测试', time: '2小时前' },
{ id: 2, icon: 'fas fa-chart-bar', title: '查看测试报告', time: '昨天' },
{ id: 3, icon: 'fas fa-cog', title: '更新设置', time: '3天前' }
{ id: 1, icon: 'fas fa-user', title: '更新个人资料', time: '2小时前' },
{ id: 2, icon: 'fas fa-cog', title: '修改系统设置', time: '昨天' },
{ id: 3, icon: 'fas fa-shield-alt', title: '安全设置更新', time: '3天前' }
],
db: null //
}
@ -191,12 +181,7 @@ export default { @@ -191,12 +181,7 @@ export default {
console.error('加载最近活动失败:', error);
}
},
startSpeedTest() {
this.$router.push('/speed-test');
},
viewHistory() {
this.$router.push('/history');
},
openSettings() {
//

4
gofaster/app/src/renderer/modules/example-usage.js

@ -9,8 +9,8 @@ import { userService, LoginModal, UserManagement } from './user-management' @@ -9,8 +9,8 @@ import { userService, LoginModal, UserManagement } from './user-management'
// 3. 导入系统设置模块
import { Settings } from './system-settings'
// 4. 导入业务功能模块
import { SpeedTest, History } from './business-features'
// 4. 导入角色管理模块
import { RoleManagement } from './role-management'
// 5. 导入模块管理器
import moduleManager from './ModuleManager'

3
gofaster/app/src/renderer/modules/index.js

@ -9,8 +9,7 @@ export * from './user-management/index.js' @@ -9,8 +9,7 @@ export * from './user-management/index.js'
// 系统设置模块
export * from './system-settings/index.js'
// 业务功能模块
export * from './business-features/index.js'
// 角色管理模块
export * from './role-management/index.js'

12
gofaster/app/src/renderer/router/index.js

@ -2,10 +2,8 @@ import { createRouter, createWebHashHistory } from 'vue-router' @@ -2,10 +2,8 @@ import { createRouter, createWebHashHistory } from 'vue-router'
// 直接导入组件,避免模块导出问题
import MainLayout from '@/modules/core/components/MainLayout.vue'
import Home from '@/modules/core/views/Home.vue'
import { History } from '@/modules/business-features'
import { UserManagement, UserProfile } from '@/modules/user-management'
import { Settings } from '@/modules/system-settings'
import { SpeedTest } from '@/modules/business-features'
import RoleManagement from '@/modules/role-management/views/RoleManagement.vue'
const routes = [
@ -18,21 +16,11 @@ const routes = [ @@ -18,21 +16,11 @@ const routes = [
name: 'Home',
component: Home
},
{
path: '/history',
name: 'History',
component: History
},
{
path: '/user-management',
name: 'UserManagement',
component: UserManagement
},
{
path: '/speed-test',
name: 'SpeedTest',
component: SpeedTest
},
{
path: '/settings',
name: 'Settings',

68
gofaster/clear-electron-cache.ps1

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
# 清理Electron缓存和用户数据脚本
# 用于修复 "Unable to move the cache: 拒绝访问" 错误
Write-Host "🔧 开始清理Electron缓存和用户数据..." -ForegroundColor Yellow
# 获取当前用户的应用数据路径
$userDataPath = "$env:APPDATA\gofaster"
$localDataPath = "$env:LOCALAPPDATA\gofaster"
Write-Host "用户数据路径: $userDataPath" -ForegroundColor Cyan
Write-Host "本地数据路径: $localDataPath" -ForegroundColor Cyan
# 定义需要清理的目录
$cacheDirs = @(
"$userDataPath\Cache",
"$userDataPath\Code Cache",
"$userDataPath\GPUCache",
"$userDataPath\Session Storage",
"$userDataPath\Local Storage",
"$localDataPath\Cache",
"$localDataPath\Code Cache",
"$localDataPath\GPUCache"
)
# 清理缓存目录
foreach ($dir in $cacheDirs) {
if (Test-Path $dir) {
try {
Write-Host "正在清理: $dir" -ForegroundColor Green
Remove-Item -Path $dir -Recurse -Force -ErrorAction Stop
Write-Host "✅ 已清理: $dir" -ForegroundColor Green
} catch {
Write-Host " 清理失败: $dir - $($_.Exception.Message)" -ForegroundColor Yellow
}
} else {
Write-Host "目录不存在: $dir" -ForegroundColor Gray
}
}
# 清理可能存在的其他缓存文件
$cacheFiles = @(
"$userDataPath\*.log",
"$userDataPath\*.tmp",
"$userDataPath\*.cache"
)
foreach ($pattern in $cacheFiles) {
try {
$files = Get-ChildItem -Path $pattern -ErrorAction SilentlyContinue
foreach ($file in $files) {
Remove-Item -Path $file.FullName -Force -ErrorAction Stop
Write-Host "✅ 已清理文件: $($file.Name)" -ForegroundColor Green
}
} catch {
Write-Host " 清理文件失败: $pattern - $($_.Exception.Message)" -ForegroundColor Yellow
}
}
Write-Host "✅ Electron缓存清理完成!" -ForegroundColor Green
Write-Host "现在可以重新启动应用程序了。" -ForegroundColor Cyan
# 询问是否立即启动应用
$startApp = Read-Host "是否立即启动应用程序? (y/n)"
if ($startApp -eq 'y' -or $startApp -eq 'Y') {
Write-Host "正在启动应用程序..." -ForegroundColor Yellow
Set-Location "app"
.\dev-enhanced.ps1
}
Loading…
Cancel
Save