2.4.7 优化过滤 新增重置任务
This commit is contained in:
@@ -109,10 +109,42 @@ onMounted(() => {
|
||||
buildViewMap(props.accountGroups)
|
||||
}
|
||||
|
||||
// 监听本地存储变化,当配置更新时重新加载
|
||||
window.addEventListener('storage', handleStorageChange)
|
||||
// 监听自定义配置更新事件
|
||||
window.addEventListener('config-updated', handleConfigUpdate)
|
||||
|
||||
// Listeners specific to browser view
|
||||
// ...
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
// 清理监听器
|
||||
window.removeEventListener('storage', handleStorageChange)
|
||||
window.removeEventListener('config-updated', handleConfigUpdate)
|
||||
})
|
||||
|
||||
// 处理本地存储变化
|
||||
const handleStorageChange = (event) => {
|
||||
if (event.key === CONFIG_KEY) {
|
||||
loadConfig()
|
||||
// 强制重新构建 viewAccountMap,确保使用最新的账号信息
|
||||
if (props.accountGroups) {
|
||||
buildViewMap(props.accountGroups)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理配置更新事件
|
||||
const handleConfigUpdate = () => {
|
||||
console.log('[YoloBrowser] 收到配置更新事件,重新加载配置')
|
||||
loadConfig()
|
||||
// 强制重新构建 viewAccountMap,确保使用最新的账号信息
|
||||
if (props.accountGroups) {
|
||||
buildViewMap(props.accountGroups)
|
||||
}
|
||||
}
|
||||
|
||||
// Original loadConfig logic
|
||||
const loadConfig = () => {
|
||||
try {
|
||||
@@ -142,7 +174,7 @@ const buildViewMap = (groups) => {
|
||||
|
||||
watch(() => props.accountGroups, (newVal) => {
|
||||
if (newVal) buildViewMap(newVal)
|
||||
})
|
||||
}, { deep: true })
|
||||
|
||||
// Actions
|
||||
const handleTabSwitch = async (tab) => {
|
||||
@@ -166,6 +198,12 @@ const handleTabSwitch = async (tab) => {
|
||||
|
||||
const handleViewSwitch = async (viewId) => {
|
||||
selectedViewId.value = viewId
|
||||
// 重新加载配置,确保获取最新的账号信息
|
||||
loadConfig()
|
||||
// 强制重新构建 viewAccountMap,确保使用最新的账号信息
|
||||
if (props.accountGroups) {
|
||||
buildViewMap(props.accountGroups)
|
||||
}
|
||||
if (isElectron()) {
|
||||
await window.electronAPI.switchToView(viewId)
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ async function loadPkList() {
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载 PK 列表失败', e)
|
||||
ElMessage.error('加载失败,请稍后重试')
|
||||
// ElMessage.error('加载失败,请稍后重试')
|
||||
} finally {
|
||||
loading.value = false
|
||||
// 数据加载完成后,使用 nextTick 强制重新计算滚动位置
|
||||
|
||||
@@ -632,7 +632,7 @@ const toggleFilter = (filterName) => {
|
||||
const resetTask = async () => {
|
||||
try {
|
||||
ElMessageBox.confirm(
|
||||
'确定要重置任务吗?这将重启 Python 服务并重新加载工作台数据,可能会中断当前正在进行的操作。',
|
||||
'确定要重置任务吗?这将重启服务并中断当前正在进行的获取主播和大哥的任务。',
|
||||
'重置任务',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
|
||||
Reference in New Issue
Block a user