feat: Refactor channel management and UI components
- Removed hardcoded channel data from `channel.ts` and replaced it with a dynamic channel dictionary. - Introduced a new Pinia store `channel.ts` to manage selected and available channels. - Reworked `AddChannelDialog.vue` to allow users to search and select channels dynamically. - Updated `TaskCenter.vue` to utilize the new channel store and handle empty channel selections gracefully. - Enhanced IPC communication for loading and saving selected channels in the configuration. - Adjusted `runTaskOperationService.ts` to ensure proper handling of channel data. - Improved styling and structure of UI components for better user experience.
This commit is contained in:
@@ -34,18 +34,24 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Settings } from '@lucide/vue'
|
||||
import { taskCenterList, taskCenterItem } from '@constant/taskCenterList'
|
||||
import { channels } from '@constant/channel'
|
||||
import { useChannelStore } from '@stores/channel'
|
||||
import emitter from '@utils/emitter'
|
||||
|
||||
const channelStore = useChannelStore()
|
||||
const taskList = computed(() => taskCenterList)
|
||||
|
||||
// 点击任务项
|
||||
const handleTaskItem = (item: taskCenterItem) => {
|
||||
// 一键打开各渠道
|
||||
if (item.type === 'channel') {
|
||||
window.api.openChannel(channels.value)
|
||||
if (!channelStore.selectedChannels || channelStore.selectedChannels.length === 0) {
|
||||
ElMessage.warning('请先配置渠道')
|
||||
return
|
||||
}
|
||||
window.api.openChannel(JSON.parse(JSON.stringify(channelStore.selectedChannels)))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user