更新任务列表等

This commit is contained in:
24kycj
2024-11-09 14:41:39 +08:00
parent 343822e81e
commit 10ec7b1ba0
9 changed files with 323 additions and 114 deletions
+7 -4
View File
@@ -7,14 +7,15 @@ let isConnect = false
const getDefaultState = () => {
return {
reconnections: 0,
taskList: []
}
}
const state = getDefaultState()
const mutations = {
set_client_id: (state, client_id) => {
state.client_id = client_id
setData: (state, obj) => {
state[obj.name] = obj.data
},
}
@@ -43,8 +44,10 @@ const actions = {
// 接收消息
websocketonmessage({ commit, dispatch }, e) {
const data = JSON.parse(e.data) // 转json对象
if (data.state) {
if (data.resp_name) {
if (data.resp_name === 'task_list') {
commit('chat/setData', { name: 'taskList', data: data.resp_info.task_list })
}
} else {
if (data.type === 'init') {
state.pingNum = 0